* { box-sizing: border-box; }
body { font-family: system-ui, sans-serif; margin: 0; padding: 1rem; background: #1a1a1a; color: #e0e0e0; }
a { color: #6ab; }
h1 { font-size: 1.25rem; margin-bottom: 1rem; }
.top-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin: -0.25rem 0 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid #333;
}
.top-nav-links { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; }
.top-nav-links a { color: #9ab; text-decoration: none; padding: 0.2rem 0.35rem; border-radius: 3px; }
.top-nav-links a:hover { color: #cde; background: #2a2a2a; }
.top-nav-links a.is-active { color: #eef; background: #345; }
.top-nav-user { display: flex; gap: 0.75rem; align-items: center; color: #aaa; font-size: 0.9rem; }
.top-nav-user a { color: #9ab; }
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-card {
  background: #252525;
  border: 1px solid #444;
  border-radius: 10px;
  padding: 1.5rem 1.75rem;
  width: 100%;
  max-width: 380px;
}
.login-card h1 { margin-top: 0; }
.login-sub { color: #888; margin-top: -0.5rem; margin-bottom: 1rem; }
.login-error { color: #e99; background: #3a1a1a; border: 1px solid #633; padding: 0.5rem 0.65rem; border-radius: 4px; }
.login-card label { display: block; margin-top: 0.75rem; margin-bottom: 0.25rem; color: #999; font-size: 0.85rem; }
.login-card input { width: 100%; padding: 0.5rem; border: 1px solid #444; border-radius: 4px; background: #2a2a2a; color: #e0e0e0; }
.login-submit { margin-top: 1.1rem; width: 100%; }
.panel { margin: 1rem 0 1.5rem; padding: 1rem; border: 1px solid #333; border-radius: 8px; background: #202020; }
.panel h2 { margin-top: 0; font-size: 1.05rem; }
.roles-list { margin: 0; padding-left: 1.1rem; color: #bbb; }
.emp-form label { display: block; margin-top: 0.65rem; margin-bottom: 0.25rem; color: #999; font-size: 0.85rem; }
.emp-form input:not([type="checkbox"]), .emp-form select, .emp-form textarea {
  width: 100%; max-width: 420px; padding: 0.45rem 0.55rem; border: 1px solid #444; border-radius: 4px; background: #2a2a2a; color: #e0e0e0;
}
.emp-form .chk { display: flex; align-items: center; gap: 0.45rem; }
.flash-ok { color: #9d9; background: #1a2e1a; border: 1px solid #3a5; padding: 0.45rem 0.65rem; border-radius: 4px; }
.flash-err { color: #e99; background: #3a1a1a; border: 1px solid #633; padding: 0.45rem 0.65rem; border-radius: 4px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; margin-bottom: 0.75rem; }
.toolbar input[type="text"] { padding: 0.4rem 0.6rem; width: 220px; border: 1px solid #444; border-radius: 4px; background: #2a2a2a; color: #e0e0e0; }
.toolbar label { display: inline-flex; align-items: center; gap: 0.35rem; cursor: pointer; }
.toolbar-per-page select { margin-left: 0.25rem; padding: 0.3rem 0.4rem; border: 1px solid #444; border-radius: 4px; background: #2a2a2a; color: #e0e0e0; }
.toolbar button, .btn { padding: 0.4rem 0.75rem; border-radius: 4px; border: 1px solid #555; background: #333; color: #e0e0e0; cursor: pointer; text-decoration: none; font-size: 0.9rem; }
.toolbar button:hover, .btn:hover { background: #444; }
.alphabet-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  align-items: center;
  margin: 0 0 1rem;
  max-width: 100%;
}
.alphabet-label { color: #888; font-size: 0.8rem; margin-right: 0.35rem; }
.alphabet-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.55rem;
  padding: 0.15rem 0.35rem;
  border: 1px solid #3a3a3a;
  border-radius: 3px;
  color: #9ab;
  text-decoration: none;
  font-size: 0.78rem;
  line-height: 1.2;
  background: #222;
}
.alphabet-chip:hover { background: #333; color: #cde; }
.alphabet-chip.is-active { background: #345; border-color: #567; color: #eef; }
.hide-reason-note { margin-top: 0.25rem; color: #a98; font-size: 0.72rem; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.modal-content-sm { max-width: 420px; }
.stats-inn { color: #aaa; font-size: 0.92rem; margin: 0 0 0.65rem; line-height: 1.4; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { padding: 0.5rem 0.6rem; text-align: left; border-bottom: 1px solid #333; }
th { background: #252525; color: #999; font-weight: 600; }
th a { color: #9bd; text-decoration: none; }
th a:hover { text-decoration: underline; }
th .sort-mark {
  display: inline-block;
  margin-left: 0.25em;
  color: #cce0ff;
  font-size: 1.05em;
  font-weight: 700;
  line-height: 1;
  vertical-align: middle;
}
tr.hidden-row { opacity: 0.6; }
tr.not-shop-row { opacity: 0.75; }
tr.in-work-row { background: rgba(60, 80, 120, 0.12); }
.domain { max-width: 200px; overflow: hidden; text-overflow: ellipsis; }
.cell-company { max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.cell-title { max-width: 280px; overflow: hidden; text-overflow: ellipsis; }
.cell-desc { max-width: 300px; overflow: hidden; text-overflow: ellipsis; }
.actions { white-space: nowrap; }
.actions button { padding: 0.2rem 0.5rem; margin-right: 0.25rem; font-size: 0.8rem; }
.badge { font-size: 0.7rem; padding: 0.15rem 0.4rem; border-radius: 3px; margin-left: 0.25rem; }
.badge-hidden { background: #552; color: #dc9; }
.badge-not-shop { background: #535; color: #d9d; }
.badge-in-work { background: #356; color: #9cd; }
a.badge-crm { background: #254; color: #9dc; text-decoration: none; }
a.badge-crm:hover { background: #376; color: #cef; }
.pagination { margin-top: 1rem; display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.pagination a, .pagination span { padding: 0.3rem 0.5rem; }
.modal { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.7); z-index: 10; align-items: center; justify-content: center; padding: 1rem; }
.modal.show { display: flex; }
.modal-content { background: #252525; border-radius: 8px; padding: 1.25rem; max-width: 560px; width: 100%; max-height: 90vh; overflow: auto; }
.modal-content h2 { margin-top: 0; font-size: 1.1rem; }
.modal-content label { display: block; margin-top: 0.75rem; margin-bottom: 0.25rem; color: #999; font-size: 0.85rem; }
.modal-content input:not([type="checkbox"]):not([type="hidden"]), .modal-content textarea { width: 100%; padding: 0.5rem; border: 1px solid #444; border-radius: 4px; background: #2a2a2a; color: #e0e0e0; }
.modal-content input.field-info { background: #222; color: #b8b8b8; border-color: #3a3a3a; cursor: default; user-select: text; }
.modal-content .field-info-hint { display: block; margin: -0.15rem 0 0.35rem; color: #666; font-size: 0.75rem; line-height: 1.3; }
.modal-content label:has(input[type="checkbox"]) { display: flex; align-items: center; gap: 0.5rem; }
.modal-content input[type="checkbox"] { width: auto; flex-shrink: 0; }
.modal-content textarea { min-height: 80px; resize: vertical; }
.modal-actions { margin-top: 1.25rem; display: flex; gap: 0.5rem; flex-wrap: wrap; }
.btn-primary { background: #3a5; color: #fff; border-color: #3a5; }
.btn-primary:hover { background: #4b6; }
body.busy-locked { overflow: hidden; }
.busy-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(0, 0, 0, 0.72);
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.busy-overlay.show { display: flex; }
.busy-box {
  background: #252525;
  border: 1px solid #444;
  border-radius: 10px;
  padding: 1.5rem 2rem;
  min-width: 260px;
  max-width: 360px;
  text-align: center;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}
.busy-box.busy-wide { max-width: 440px; }
.busy-panel[hidden] { display: none !important; }
.busy-spinner {
  width: 40px;
  height: 40px;
  margin: 0 auto 1rem;
  border: 3px solid #3a3a3a;
  border-top-color: #6ab;
  border-radius: 50%;
  animation: busy-spin 0.85s linear infinite;
}
@keyframes busy-spin {
  to { transform: rotate(360deg); }
}
.busy-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 1rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.45rem;
  font-weight: 700;
  line-height: 1;
}
.busy-icon-success { background: #1a3d2a; color: #7d9; border: 2px solid #3a6; }
.busy-icon-error { background: #3d1a1a; color: #e99; border: 2px solid #844; }
.busy-text { margin: 0; color: #ddd; font-size: 0.95rem; line-height: 1.4; }
.busy-sub {
  margin: 0.5rem 0 0;
  color: #888;
  font-size: 0.8rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}
.busy-overlay.busy-state-success .busy-text { color: #cfe; }
.busy-overlay.busy-state-error .busy-text { color: #fcc; }
.busy-actions {
  margin-top: 1.25rem;
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  flex-wrap: wrap;
}
.busy-actions[hidden] { display: none !important; }
