/* ═══════════════════════════════════════════════════
   БУДИЛЬНИК — Design System v2
   Medical Minimalism · Clinical Precision
   ═══════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

/* ── TOKENS ── */
:root {
  /* Background */
  --bg:             #F7F8FA;
  --surface:        #FFFFFF;
  --surface-alt:    #F0F2F5;
  --surface-hover:  #EAECF0;

  /* Text */
  --text:           #0D1117;
  --text-secondary: #374151;
  --muted:          #6B7280;
  --muted-light:    #9CA3AF;

  /* Borders */
  --line:           #E5E7EB;
  --line-strong:    #D1D5DB;

  /* Accent — Medical Blue */
  --accent:         #1D6FA4;
  --accent-hover:   #1A5F8E;
  --accent-soft:    #EBF4FB;
  --accent-mid:     #BFDBF0;

  /* Semantic */
  --success:        #16A34A;
  --success-soft:   #DCFCE7;
  --warning:        #D97706;
  --warning-soft:   #FEF3C7;
  --danger:         #DC2626;
  --danger-soft:    #FEE2E2;

  /* Segments */
  --vip:            #7C3AED;
  --vip-soft:       #EDE9FE;
  --mid:            #1D6FA4;
  --mid-soft:       #EBF4FB;
  --once:           #6B7280;
  --once-soft:      #F3F4F6;
  --medical:        #B45309;
  --medical-soft:   #FEF3C7;
  --cosm:           #0F766E;
  --cosm-soft:      #CCFBF1;
  --red-zone:       #DC2626;
  --red-zone-soft:  #FEE2E2;

  /* Layout */
  --sidebar-w:      200px;

  /* Typography */
  --font:           'Plus Jakarta Sans', 'Helvetica Neue', sans-serif;
  --font-mono:      'JetBrains Mono', 'Fira Mono', monospace;

  /* Elevation */
  --shadow-xs:      0 1px 2px rgba(13,17,23,0.06);
  --shadow-sm:      0 2px 8px rgba(13,17,23,0.07);
  --shadow-md:      0 4px 16px rgba(13,17,23,0.08);
  --shadow-lg:      0 12px 40px rgba(13,17,23,0.12);

  /* Radius */
  --r-xs:  6px;
  --r-sm:  8px;
  --r-md:  12px;
  --r-lg:  14px;
  --r-xl:  18px;
  --r-2xl: 22px;

  /* Motion */
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --dur:  150ms;
}

/* ── RESET ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; -webkit-font-smoothing: antialiased; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
button { font-family: var(--font); cursor: pointer; }
input, select, textarea { font-family: var(--font); }

/* ── APP SHELL ── */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
}

/* ── SIDEBAR ── */
.side-nav {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--line);
  overflow: hidden;
}

.brand {
  padding: 20px 16px 16px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.brand-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.brand-copy {
  min-width: 0;
}

.brand-title {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--text);
  line-height: 1;
  margin-bottom: 4px;
}

.brand-mark {
  display: inline-block;
  width: 7px;
  height: 7px;
  background: var(--accent);
  border-radius: 50%;
  margin-left: 2px;
  vertical-align: middle;
  position: relative;
  top: -1px;
  animation: brand-pulse 2.4s ease infinite;
}

@keyframes brand-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.7); }
}

.brand-note {
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
  letter-spacing: 0.01em;
  line-height: 1.4;
}

.mobile-bottom-nav,
.mobile-bottom-link,
.mobile-bottom-menu,
.side-nav-close,
.app-shell-overlay {
  display: none;
}

.side-nav-section {
  padding: 12px 10px 4px;
  flex-shrink: 0;
}

.side-nav-section-label {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted-light);
  padding: 0 8px;
  margin-bottom: 4px;
  display: block;
}

.side-nav-links {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 10px;
  flex-shrink: 0;
}

.side-nav-links-main {
  flex: 1;
  min-height: 0;
}

.side-nav-links-secondary {
  padding-top: 0;
  padding-bottom: 10px;
}

.side-nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 600;
  transition: background var(--dur) var(--ease),
              color var(--dur) var(--ease),
              border-color var(--dur) var(--ease);
  position: relative;
}

.side-nav-link:hover {
  background: var(--surface-alt);
  color: var(--text-secondary);
}

.side-nav-link.active {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent-mid);
}

.side-nav-icon {
  width: 28px;
  height: 28px;
  border-radius: var(--r-sm);
  background: var(--surface-alt);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  transition: background var(--dur), border-color var(--dur);
}

.side-nav-icon svg {
  width: 13px;
  height: 13px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.side-nav-link.active .side-nav-icon {
  background: var(--accent-soft);
  border-color: var(--accent-mid);
  color: var(--accent);
}

.side-nav-label { flex: 1; }

.side-nav-badge {
  font-size: 10px;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--accent);
  background: var(--accent-soft);
  padding: 1px 6px;
  border-radius: 10px;
  min-width: 20px;
  text-align: center;
}

.side-nav-footer {
  padding: 14px 18px;
  border-top: 1px solid var(--line);
  flex-shrink: 0;
}

.side-nav-auth {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.side-branch-block {
  padding: 10px 10px 12px;
  border-top: 1px solid var(--line);
  flex-shrink: 0;
}

.side-branch-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.side-branch-btn {
  height: 36px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: -0.01em;
  transition: all var(--dur) var(--ease);
}

.side-branch-btn:hover {
  background: var(--surface-alt);
  color: var(--text-secondary);
}

.side-branch-btn.active {
  background: var(--accent-soft);
  border-color: var(--accent-mid);
  color: var(--accent);
}

.side-branch-note {
  margin-top: 8px;
  font-size: 10.5px;
  line-height: 1.45;
  color: var(--muted-light);
}

.side-nav-footer-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted-light);
}

.side-nav-user {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 700;
  word-break: break-word;
}

.side-nav-logout {
  height: 34px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--surface-alt);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 700;
  transition: all var(--dur) var(--ease);
}

.side-nav-logout:hover {
  background: var(--danger-soft);
  border-color: #FECACA;
  color: var(--danger);
}

/* ── WORKSPACE ── */
.workspace {
  min-width: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── TOPBAR ── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(247, 248, 250, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}

.topbar-title {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  white-space: nowrap;
}

.topbar-sep {
  color: var(--line-strong);
  font-weight: 300;
  font-size: 18px;
}

.topbar-sub {
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
}

.topbar-spacer { flex: 1; }

.topbar-count {
  font-size: 12px;
  color: var(--muted);
  font-family: var(--font-mono);
  background: var(--surface-alt);
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid var(--line);
}

/* ── CARD ── */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-xs);
}

.card-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 10px;
}

.card-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -0.01em;
  flex: 1;
}

.card-body { padding: 18px; }

/* ── BUTTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--r-sm);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  border: 1px solid transparent;
  transition: all var(--dur) var(--ease);
  white-space: nowrap;
  cursor: pointer;
}

.btn svg {
  width: 13px; height: 13px;
  stroke: currentColor; fill: none;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}

.btn-primary {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--line-strong);
}
.btn-ghost:hover { background: var(--surface-alt); }

.btn-soft {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent-mid);
}
.btn-soft:hover { background: var(--accent-mid); }

.btn-danger {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: #FECACA;
}
.btn-danger:hover { background: var(--danger); color: white; border-color: var(--danger); }

.btn-success {
  background: var(--success-soft);
  color: var(--success);
  border-color: #BBF7D0;
}
.btn-success:hover { background: var(--success); color: white; border-color: var(--success); }

.btn-warning {
  background: var(--warning-soft);
  color: var(--warning);
  border-color: #FDE68A;
}
.btn-warning:hover { background: var(--warning); color: white; border-color: var(--warning); }

.btn-sm { padding: 5px 11px; font-size: 12px; }
.btn-lg { padding: 11px 22px; font-size: 14px; }
.btn-full { width: 100%; }

.btn-icon {
  width: 32px; height: 32px;
  padding: 0;
  border-radius: var(--r-sm);
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  display: grid; place-items: center;
  transition: all var(--dur);
}
.btn-icon:hover { background: var(--surface-alt); color: var(--text); }
.btn-icon svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ── BADGES ── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.01em;
  white-space: nowrap;
  line-height: 1.4;
}

.badge-vip     { background: var(--vip-soft);     color: var(--vip);     }
.badge-mid     { background: var(--mid-soft);     color: var(--mid);     }
.badge-once    { background: var(--once-soft);    color: var(--once);    }
.badge-medical { background: var(--medical-soft); color: var(--medical); }
.badge-cosm    { background: var(--cosm-soft);    color: var(--cosm);    }
.badge-red     { background: var(--red-zone-soft);color: var(--red-zone);}
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-neutral { background: var(--surface-alt);  color: var(--muted);   }
.badge-accent  { background: var(--accent-soft);  color: var(--accent);  }

/* ── PILL TABS ── */
.pill-tabs {
  display: flex;
  gap: 2px;
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 3px;
}

.pill-tab {
  padding: 6px 14px;
  border-radius: var(--r-sm);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: all var(--dur) var(--ease);
  border: none;
  background: transparent;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
}

.pill-tab:hover { color: var(--text-secondary); background: rgba(255,255,255,0.6); }

.pill-tab.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-xs);
}

.pill-tab-count {
  font-size: 10px;
  font-family: var(--font-mono);
  background: var(--surface-alt);
  color: var(--muted);
  padding: 1px 5px;
  border-radius: 8px;
  border: 1px solid var(--line);
}
.pill-tab.active .pill-tab-count {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent-mid);
}

/* ── FORM ELEMENTS ── */
.input {
  width: 100%;
  height: 38px;
  padding: 0 12px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  font-family: var(--font);
  font-size: 13px;
  color: var(--text);
  outline: none;
  transition: border-color var(--dur), box-shadow var(--dur);
}
.input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(29, 111, 164, 0.10);
}
.input::placeholder { color: var(--muted-light); }

.input-search {
  padding-left: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='none' stroke='%236B7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' viewBox='0 0 24 24'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 11px center;
}

.select {
  height: 38px;
  padding: 0 10px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  font-family: var(--font);
  font-size: 13px;
  color: var(--text);
  outline: none;
  cursor: pointer;
  transition: border-color var(--dur);
}
.select:focus { border-color: var(--accent); }

.textarea {
  width: 100%;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  font-family: var(--font);
  font-size: 13px;
  color: var(--text);
  outline: none;
  resize: vertical;
  transition: border-color var(--dur), box-shadow var(--dur);
  line-height: 1.5;
}
.textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(29, 111, 164, 0.10);
}
.textarea::placeholder { color: var(--muted-light); }

/* ── STAT CARD ── */
.stat-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.stat-label {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
}

.stat-value {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.05em;
  line-height: 1;
  font-family: var(--font-mono);
  color: var(--text);
}

.stat-note {
  font-size: 11.5px;
  color: var(--muted);
  font-weight: 500;
}

/* ── TABLE ── */
.data-table { width: 100%; border-spacing: 0; }

.data-table th {
  padding: 9px 14px;
  text-align: left;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--surface-alt);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.data-table th:first-child { border-radius: var(--r-sm) 0 0 0; }
.data-table th:last-child  { border-radius: 0 var(--r-sm) 0 0; }

.data-table td {
  padding: 11px 14px;
  font-size: 13px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  color: var(--text-secondary);
}

.data-table tr:last-child td { border-bottom: none; }

.data-table tbody tr {
  transition: background var(--dur);
  cursor: pointer;
}

.data-table tbody tr:hover td { background: var(--surface-alt); }
.data-table tbody tr.selected td { background: var(--accent-soft); }

.td-client-name {
  font-weight: 700;
  color: var(--text);
  font-size: 13.5px;
  display: block;
  letter-spacing: -0.01em;
}

.td-client-phone {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--muted);
  display: block;
  margin-top: 2px;
}

.td-mono {
  font-family: var(--font-mono);
  font-size: 12.5px;
  text-align: right;
}

.td-muted { color: var(--muted); font-size: 12.5px; }

/* ── MODAL ── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(13, 17, 23, 0.4);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms var(--ease);
}

.modal-backdrop.open {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-2xl);
  box-shadow: var(--shadow-lg);
  width: 680px;
  max-width: calc(100vw - 48px);
  max-height: calc(100vh - 80px);
  display: flex;
  flex-direction: column;
  transform: translateY(20px) scale(0.97);
  transition: transform 200ms var(--ease);
  overflow: hidden;
}

.modal-backdrop.open .modal {
  transform: none;
}

.modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: flex-start;
  gap: 12px;
  flex-shrink: 0;
}

.modal-title {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.03em;
  flex: 1;
}

.modal-body {
  padding: 20px 24px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 14px 24px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-shrink: 0;
}

/* ── META GRID ── */
.meta-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
  margin-bottom: 16px;
}

.meta-cell {
  background: var(--surface);
  padding: 12px 14px;
}

.meta-cell-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 4px;
}

.meta-cell-value {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}

.meta-cell-value.mono {
  font-family: var(--font-mono);
  font-size: 13px;
}

/* ── SECTION LABEL ── */
.section-label {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
}

/* ── EMPTY STATE ── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 24px;
  gap: 10px;
  text-align: center;
}

.empty-state-icon {
  width: 48px;
  height: 48px;
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  display: grid;
  place-items: center;
  margin-bottom: 4px;
}

.empty-state-icon svg {
  width: 20px; height: 20px;
  stroke: var(--muted); fill: none;
  stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round;
}

.empty-state-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-secondary);
  letter-spacing: -0.01em;
}

.empty-state-note {
  font-size: 12.5px;
  color: var(--muted);
  max-width: 280px;
  line-height: 1.6;
}

/* ── SKELETON ── */
@keyframes skeleton-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.skeleton {
  background: var(--surface-alt);
  border-radius: var(--r-xs);
  animation: skeleton-pulse 1.6s ease infinite;
}

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted-light); }

/* ── DIVIDER ── */
.divider {
  height: 1px;
  background: var(--line);
  margin: 16px 0;
}

/* ── CHECKBOX ── */
.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  cursor: pointer;
}

.checkbox-row input[type="checkbox"] {
  accent-color: var(--accent);
  width: 14px;
  height: 14px;
}

.checkbox-label {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}

/* ── RESULT BUTTONS (Будильник) ── */
.result-buttons {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.result-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--dur) var(--ease);
  text-align: left;
}

.result-btn:hover { border-color: var(--accent-mid); background: var(--accent-soft); color: var(--accent); }
.result-btn.selected-success { border-color: #BBF7D0; background: var(--success-soft); color: var(--success); }
.result-btn.selected-nodial  { border-color: #FDE68A; background: var(--warning-soft); color: var(--warning); }
.result-btn.selected-refuse  { border-color: var(--line-strong); background: var(--surface-alt); color: var(--muted); }
.result-btn.selected-repeat  { border-color: var(--accent-mid); background: var(--accent-soft); color: var(--accent); }
.result-btn.selected-red     { border-color: #FECACA; background: var(--danger-soft); color: var(--danger); }

.result-btn-icon {
  font-size: 16px;
  flex-shrink: 0;
}

.repeat-days-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.repeat-days-input {
  width: 52px;
  height: 28px;
  padding: 0 8px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-xs);
  font-family: var(--font-mono);
  font-size: 13px;
  text-align: center;
  outline: none;
  background: var(--surface);
}

.repeat-days-input:focus { border-color: var(--accent); }
.repeat-days-label { font-size: 12px; color: var(--muted); font-weight: 500; }

/* ── SCRIPT BLOCK ── */
.script-block {
  background: var(--accent-soft);
  border: 1px solid var(--accent-mid);
  border-left: 3px solid var(--accent);
  border-radius: var(--r-sm);
  padding: 12px 14px;
}

.script-block-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 6px;
}

.script-block-text {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ── HISTORY TABLE (compact) ── */
.visit-row {
  display: grid;
  grid-template-columns: 96px 1fr 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  font-size: 12.5px;
}

.visit-row:last-child { border-bottom: none; }

.visit-date {
  font-family: var(--font-mono);
  color: var(--muted);
  font-size: 12px;
}

.visit-master { color: var(--text-secondary); font-weight: 500; }
.visit-service { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.visit-sum {
  font-family: var(--font-mono);
  font-weight: 500;
  color: var(--text);
  text-align: right;
}

/* ── COMMENT BOX ── */
.comment-box {
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 10px 12px;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
  font-style: italic;
}

/* ── FILTER PANEL ── */
.filter-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
}

.filter-section {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.filter-section:last-child { border-bottom: none; }

.filter-section-title {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
}

.preset-buttons {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.preset-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 10px;
  border-radius: var(--r-xs);
  border: 1px solid transparent;
  background: transparent;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: all var(--dur);
}

.preset-btn:hover { background: var(--surface-alt); color: var(--text-secondary); }
.preset-btn.active { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-mid); }

.preset-btn-count {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
}
.preset-btn.active .preset-btn-count { color: var(--accent); }

/* ── TASK CARD (list item) ── */
.task-item {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  transition: background var(--dur);
  position: relative;
}

.task-item:hover { background: var(--surface-alt); }
.task-item.active { background: var(--accent-soft); }
.task-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 8px; bottom: 8px;
  width: 3px;
  background: var(--accent);
  border-radius: 0 2px 2px 0;
}

.task-item-name {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  margin-bottom: 5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.task-item-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 5px;
}

.task-item-phone {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 3px;
}

.task-item-days {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 2px;
}

/* ── LOADING STATE ── */
.loading-rows {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.loading-row {
  padding: 12px 14px;
  display: flex;
  gap: 12px;
  border-bottom: 1px solid var(--line);
}

/* ── TOAST ── */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 200;
  background: var(--text);
  color: white;
  padding: 10px 18px;
  border-radius: var(--r-md);
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  transform: translateY(16px);
  opacity: 0;
  transition: all 220ms var(--ease);
  pointer-events: none;
}
.toast.show { transform: none; opacity: 1; }
.toast.success { background: var(--success); }
.toast.error   { background: var(--danger); }
.toast.warn    { background: var(--warning); }

@media (max-width: 960px) {
  .app {
    display: block;
    min-height: 100dvh;
  }

  .workspace {
    min-height: 100dvh;
    padding-bottom: calc(82px + env(safe-area-inset-bottom));
  }

  .side-nav {
    position: fixed;
    top: 0;
    left: 0;
    width: min(86vw, 320px);
    height: 100dvh;
    z-index: 220;
    transform: translateX(calc(-100% - 16px));
    transition: transform 180ms var(--ease);
    box-shadow: 0 24px 48px rgba(13, 17, 23, 0.18);
    overflow-y: auto;
    overflow-x: hidden;
  }

  body.nav-open {
    overflow: hidden;
  }

  body.nav-open .side-nav {
    transform: translateX(0);
  }

  .mobile-bottom-nav {
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: 10px;
    z-index: 240;
    padding: 8px;
    border-radius: 22px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.94);
    box-shadow: var(--shadow-md);
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 4px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: opacity 180ms var(--ease), transform 180ms var(--ease);
  }

  .mobile-bottom-link,
  .mobile-bottom-menu {
    min-width: 0;
    min-height: 56px;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    color: var(--muted);
    border: 1px solid transparent;
    background: transparent;
    font-size: 10px;
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -0.01em;
  }

  .mobile-bottom-link.active,
  .mobile-bottom-menu.active {
    background: var(--accent-soft);
    color: var(--accent);
    border-color: var(--accent-mid);
  }

  .mobile-bottom-link svg,
  .mobile-bottom-menu svg,
  .side-nav-close svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  .side-nav-close {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: var(--surface-alt);
    color: var(--muted);
    display: grid;
    place-items: center;
    flex-shrink: 0;
  }

  .app-shell-overlay {
    position: fixed;
    inset: 0;
    z-index: 210;
    border: 0;
    background: rgba(13, 17, 23, 0.34);
    opacity: 0;
    pointer-events: none;
    transition: opacity 180ms var(--ease);
  }

  body.nav-open .app-shell-overlay {
    display: block;
    opacity: 1;
    pointer-events: auto;
  }

  body.nav-open .mobile-bottom-nav {
    opacity: 0;
    pointer-events: none;
    transform: translateY(12px);
  }

  .brand {
    padding: 16px;
  }

  .topbar {
    padding-left: 16px;
    padding-right: 16px;
  }
}

@media (max-width: 640px) {
  .mobile-bottom-nav {
    left: 8px;
    right: 8px;
    bottom: 8px;
    padding: 6px;
    border-radius: 20px;
  }

  .mobile-bottom-link,
  .mobile-bottom-menu {
    min-height: 52px;
    border-radius: 14px;
    font-size: 9.5px;
  }

  .topbar {
    height: auto;
    min-height: 56px;
    padding: 12px 14px;
    align-items: flex-start;
    gap: 8px;
    flex-wrap: wrap;
  }

  .topbar-title {
    white-space: normal;
  }

  .toast {
    left: 12px;
    right: 12px;
    bottom: 12px;
  }
}
