:root {
  --bg: #f3f5f7;
  --bg-soft: #edf0f4;
  --card: #ffffff;
  --text: #252d38;
  --muted: #748092;
  --muted-2: #526173;
  --line: #dce2e8;
  --line-soft: #e8edf2;
  --brand: #315bda;
  --brand-dark: #2548b8;
  --brand-soft: #e8eeff;
  --brand-ring: rgba(49, 91, 218, 0.22);

  --sidebar-bg: #ffffff;
  --sidebar-bg-active: var(--brand-soft);
  --sidebar-bg-hover: var(--bg-soft);
  --accent: #315bda;
  --accent-dark: #2548b8;
  --btn-primary: #315bda;
  --content-bg: #f3f5f7;
  --card-bg: #ffffff;
  --text-muted: #748092;
  --border: #dce2e8;
  --header-h: 64px;
  --sidebar-w: 260px;
  --danger: #dc2626;
  --ok: #16a34a;
  --warn: #d97706;
  --radius: 14px;
  --radius-lg: 20px;
  --shadow-card: 0 4px 12px rgba(25, 63, 72, 0.04);
  --shadow-lift: 0 10px 28px rgba(24, 58, 66, 0.07);
  --font-display: "Onest", "Manrope", sans-serif;
  --font-body: "Manrope", "Onest", sans-serif;
}

body.theme-dark {
  --bg: #111827;
  --bg-soft: #1a2332;
  --card: #1f2937;
  --text: #f3f4f6;
  --muted: #9ca3af;
  --muted-2: #cbd5e1;
  --line: #374151;
  --line-soft: #2d3748;
  --brand-soft: rgba(49, 91, 218, 0.22);
  --sidebar-bg: #0f172a;
  --sidebar-bg-active: rgba(49, 91, 218, 0.28);
  --sidebar-bg-hover: rgba(255, 255, 255, 0.06);
  --content-bg: #111827;
  --card-bg: #1f2937;
  --text-muted: #9ca3af;
  --border: #374151;
  --btn-primary: #315bda;
  --shadow-card: 0 4px 12px rgba(0, 0, 0, 0.25);
  --shadow-lift: 0 10px 28px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  background: var(--content-bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }

h1, h2, h3, h4, .topbar-title, .section-head h2, .sidebar-brand,
.login-card h1, .login-card h3, .modal-card header h5 {
  font-family: var(--font-display);
  letter-spacing: -0.02em;
}

.app-shell {
  display: flex;
  min-height: 100vh;
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, #e8eeff 0%, transparent 55%),
    var(--bg);
}
body.theme-dark .app-shell {
  background: var(--bg);
}

/* —— Sidebar —— */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--sidebar-bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 100;
  border-right: 1px solid var(--line);
  box-shadow: 4px 0 24px rgba(24, 58, 66, 0.03);
}

.sidebar-profile {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 16px;
  border-bottom: 1px solid var(--line-soft);
}

.avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, #315bda 0%, #6b8cff 55%, #a8bfff 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(49, 91, 218, 0.28);
  font-family: var(--font-display);
}

.avatar.sm { width: 32px; height: 32px; font-size: 11px; }

.sidebar-profile-name {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
  word-break: break-word;
  color: var(--text);
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 10px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  color: var(--muted-2);
  font-size: 0.925rem;
  font-weight: 550;
  cursor: pointer;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  border-radius: 11px;
  margin-bottom: 2px;
  transition: background 0.15s, color 0.15s;
}

.nav-item:hover {
  background: var(--sidebar-bg-hover);
  color: var(--text);
}
.nav-item.active {
  background: var(--sidebar-bg-active);
  color: var(--brand);
  font-weight: 650;
}

.nav-item .ico {
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: inherit;
}

.nav-item .ico .ico-svg,
.nav-item .chev .ico-svg {
  width: 20px;
  height: 20px;
  display: block;
  flex-shrink: 0;
}

.nav-item .chev {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  color: inherit;
  opacity: 0.85;
}

.nav-item .chev .ico-svg {
  width: 16px;
  height: 16px;
}

.nav-sub {
  display: none;
  background: transparent;
  margin: 0 0 4px;
}
.nav-sub.open { display: block; }
.nav-sub .nav-item { padding-left: 44px; font-size: 13px; }

.sidebar-footer {
  border-top: 1px solid var(--line-soft);
  padding: 8px 10px 14px;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

/* —— Main —— */
.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  height: var(--header-h);
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 50;
}
body.theme-dark .topbar {
  background: rgba(31, 41, 55, 0.92);
}

.topbar-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: 11px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s, transform 0.12s;
  background: #fff;
  color: var(--text);
  white-space: nowrap;
  min-height: 38px;
}
body.theme-dark .btn { background: var(--card-bg); }

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-primary {
  background: var(--btn-primary);
  color: #fff;
  border-color: var(--btn-primary);
  box-shadow: 0 6px 16px rgba(49, 91, 218, 0.22);
}
.btn-primary:hover:not(:disabled) {
  background: var(--brand-dark);
  transform: translateY(-1px);
}

.btn-accent {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  box-shadow: 0 4px 12px rgba(49, 91, 218, 0.18);
}
.btn-accent:hover:not(:disabled) { background: var(--accent-dark); }

.btn-outline {
  background: var(--card-bg);
  border-color: var(--border);
  color: var(--text);
}
.btn-outline:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--brand-soft);
}

.btn-danger {
  background: #fff;
  color: var(--danger);
  border-color: #fecaca;
}
.btn-danger:hover:not(:disabled) { background: #fef2f2; }
body.theme-dark .btn-danger {
  background: transparent;
  border-color: #7f1d1d;
}

.btn-warn {
  background: #fff7ed;
  color: #c2410c;
  border-color: #fed7aa;
}

.btn-lunch {
  background: var(--brand-soft);
  color: var(--brand-dark);
  border-color: #c7d4ff;
}

.shift-timer {
  background: var(--ok);
  color: #fff;
  padding: 7px 12px;
  border-radius: 11px;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 14px;
  font-weight: 700;
  min-width: 96px;
  text-align: center;
}
.shift-timer.paused { background: var(--warn); color: #111; }
.shift-timer.idle { background: #94a3b8; }

.notif-wrap { position: relative; }
.notif-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--card-bg);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  position: relative;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.notif-btn:hover {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-ring);
}
.notif-badge {
  display: none;
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
}
.notif-badge.show { display: block; }
.notif-dropdown {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: 300px;
  max-height: 360px;
  overflow-y: auto;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-lift);
  padding: 8px 0;
  z-index: 80;
}
.notif-dropdown.open { display: block; }
.notif-item {
  padding: 10px 14px;
  font-size: 13px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  line-height: 1.35;
}
.notif-item:last-child { border-bottom: none; }
.notif-item.unread {
  color: var(--text);
  background: var(--brand-soft);
  font-weight: 600;
}
.notif-item .notif-time {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  font-weight: 400;
  color: var(--text-muted);
}
.notif-empty {
  padding: 16px 14px;
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
}

.content {
  padding: 24px 28px 48px;
  flex: 1;
}

.panel {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.subnav {
  background: var(--accent);
  display: flex;
  gap: 4px;
  padding: 0 12px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  overflow-x: auto;
}
.subnav a, .subnav span {
  color: rgba(255, 255, 255, 0.85);
  padding: 12px 14px;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
}
.subnav a.active, .subnav span.active {
  color: #fff;
  border-bottom-color: #fff;
  font-weight: 700;
}

.panel-body { padding: 16px 18px 20px; }

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}
.filter-chip {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 11px;
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 500;
}
.filter-chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.section-head h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
}
.section-head .meta { color: var(--text-muted); font-size: 13px; margin-top: 4px; }

.appt-table {
  width: 100%;
  border-collapse: collapse;
}
.appt-table th {
  text-align: left;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-soft);
}
.appt-table td {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  font-size: 14px;
}
.appt-table tr:hover td { background: var(--brand-soft); }
.appt-table .night-row td { background: rgba(99, 102, 241, 0.08); }

.badge {
  display: inline-block;
  background: #252d38;
  color: #fff;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 650;
}
.price-tag { color: var(--danger); font-weight: 700; font-size: 13px; }
.svc-meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.loc-city { color: var(--accent); font-weight: 700; font-size: 13px; }
.loc-addr { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.locked-box {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 280px;
  text-align: center;
  padding: 40px 20px;
}
.locked-box p {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-muted);
  margin: 0;
  font-family: var(--font-display);
}

.settings-list { max-width: 520px; }
.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.settings-row label { font-weight: 600; font-size: 14px; }
.settings-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}
.settings-disabled {
  opacity: 0.55;
  pointer-events: none;
}
.settings-admin-note {
  margin-top: 10px;
  font-size: 12px;
  color: var(--text-muted);
}

.switch {
  position: relative;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
  position: absolute;
  inset: 0;
  background: #cbd5e1;
  border-radius: 999px;
  cursor: pointer;
  transition: 0.2s;
}
.switch .slider::before {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: 0.2s;
}
.switch input:checked + .slider { background: var(--accent); }
.switch input:checked + .slider::before { transform: translateX(20px); }

.select-fake {
  min-width: 160px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--bg-soft);
  color: var(--text-muted);
  font-size: 13px;
}

.support-fab {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 90;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 11px;
  padding: 12px 18px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 6px 20px rgba(49, 91, 218, 0.35);
}
.support-fab .info {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
}
.support-toast {
  display: none;
  position: fixed;
  right: 20px;
  bottom: 72px;
  z-index: 91;
  background: var(--card-bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 16px;
  box-shadow: var(--shadow-lift);
  font-size: 13px;
  max-width: 280px;
}
.support-toast.open { display: block; }
.support-toast a {
  color: var(--accent);
  font-weight: 650;
  text-decoration: none;
}
.support-toast a:hover { text-decoration: underline; }

.alert {
  padding: 12px 14px;
  border-radius: 12px;
  margin-bottom: 14px;
  font-size: 14px;
}
.alert-danger { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.alert-warning { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }
body.theme-dark .alert-danger { background: #450a0a; color: #fecaca; border-color: #7f1d1d; }
body.theme-dark .alert-warning { background: #451a03; color: #fde68a; border-color: #92400e; }

.modal-backdrop-custom {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(37, 45, 56, 0.42);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 16px;
  backdrop-filter: blur(2px);
}
.modal-backdrop-custom.open { display: flex; }
.modal-card {
  background: var(--card-bg);
  color: var(--text);
  width: 100%;
  max-width: 720px;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(24, 58, 66, 0.14);
  border: 1px solid var(--line);
  max-height: 92vh;
  overflow-y: auto;
}
.modal-card header {
  background: var(--accent);
  color: #fff;
  padding: 14px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal-card header h5 { margin: 0; font-size: 16px; }
.modal-card .body { padding: 18px; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.modal-card .body .full { grid-column: 1 / -1; }
.modal-card footer {
  padding: 12px 18px 18px;
  display: flex;
  gap: 10px;
}
.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 550;
  color: var(--muted-2);
  margin-bottom: 8px;
}
.form-control, .form-select {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card-bg);
  color: var(--text);
  font-size: 14px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.form-control:focus, .form-select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-ring);
}
.form-text { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.btn-close-x {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 22px;
  cursor: pointer;
  line-height: 1;
}

.break-banner, .lunch-banner {
  display: none;
  margin-bottom: 14px;
  padding: 12px 14px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 14px;
}
.break-banner {
  background: #fff7ed;
  color: #9a3412;
  border: 1px solid #fed7aa;
}
.lunch-banner {
  background: var(--brand-soft);
  color: #1e3a8a;
  border: 1px solid #c7d4ff;
}
.break-banner.open, .lunch-banner.open { display: block; }

.staff-layout {
  display: grid;
  grid-template-columns: minmax(260px, 340px) 1fr;
  gap: 16px;
  align-items: start;
}
.staff-salon-field { margin-bottom: 4px; }
.badge-admin { background: #b91c1c; }
.badge-senior { background: #d97706; color: #111; }
.badge-barber { background: #16a34a; }
.badge-operator { background: #315bda; }

/* —— Login (LK style) —— */
.login-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 56px 20px 40px;
  margin: 0;
  background:
    radial-gradient(ellipse 70% 45% at 50% 0%, #e8eeff 0%, transparent 58%),
    var(--bg);
}
.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.3;
}
.login-brand .brand-mark {
  position: relative;
  flex: 0 0 40px;
  width: 40px;
  height: 44px;
}
.login-brand .brand-mark span {
  position: absolute;
  width: 26px;
  height: 28px;
  border: 2px solid var(--brand);
  border-radius: 4px;
  left: 0;
  top: 0;
}
.login-brand .brand-mark span + span {
  left: 12px;
  top: 13px;
  opacity: 0.72;
}
.login-brand small {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--muted);
  font-family: var(--font-body);
  letter-spacing: 0;
}
.login-card {
  width: 100%;
  max-width: 420px;
  margin-top: 36px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 36px 36px 32px;
  box-shadow: 0 14px 40px rgba(24, 58, 66, 0.07);
}
.login-card h1,
.login-card h3 {
  margin: 0 0 8px;
  font-size: 1.65rem;
  font-weight: 750;
  letter-spacing: -0.03em;
  line-height: 1.2;
  color: var(--text);
  text-align: left;
}
.login-card .login-sub,
.login-card .lead {
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.55;
  margin: 0 0 22px;
  text-align: left;
}
.login-card .btn-primary {
  width: 100%;
  padding: 12px 18px;
  margin-top: 8px;
  min-height: 44px;
}
.login-card .form-row { margin-bottom: 14px; }

@media (max-width: 900px) {
  .sidebar { width: 72px; }
  .sidebar-profile-name,
  .nav-item span.label,
  .nav-item .chev,
  .sidebar-brand span { display: none; }
  .sidebar-profile { justify-content: center; padding: 14px 8px; }
  .nav-item { justify-content: center; padding: 12px 8px; }
  .main { margin-left: 72px; }
  .modal-card .body { grid-template-columns: 1fr; }
  .topbar { flex-wrap: wrap; height: auto; padding: 10px 12px; }
  .staff-layout { grid-template-columns: 1fr; }
  .content { padding: 16px; }
}
