:root {
  --bg: #0a0d13;
  --bg2: #0e131b;
  --surface: #131a24;
  --surface2: #182130;
  --surface3: #1e2939;
  --border: rgba(255, 255, 255, 0.07);
  --border-strong: rgba(232, 182, 76, 0.35);
  --gold: #e8b64c;
  --gold-soft: #f5d98e;
  --gold-deep: #c9962f;
  --gold-grad: linear-gradient(135deg, #f7dfa0 0%, #e8b64c 45%, #c9962f 100%);
  --teal: #37c8a8;
  --teal-soft: #a5e9d8;
  --rose: #e87ba0;
  --rose-soft: #f2c6d6;
  --violet: #8f7ee8;
  --blue: #5aa9e6;
  --orange: #f2a33c;
  --green: #3ddc97;
  --text: #eef1f6;
  --text-dim: #97a1b0;
  --ok: #3ddc97;
  --warn: #f2a33c;
  --danger: #f2606b;
  --shadow: 0 18px 44px rgba(0, 0, 0, 0.5);
  --shadow-soft: 0 8px 24px rgba(0, 0, 0, 0.35);
  --radius: 18px;
  --radius-sm: 12px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { height: 100%; }

body {
  background:
    radial-gradient(1100px 480px at 85% -10%, rgba(232, 182, 76, 0.12), transparent 60%),
    radial-gradient(900px 420px at -5% 5%, rgba(55, 200, 168, 0.08), transparent 55%),
    radial-gradient(700px 380px at 60% 110%, rgba(143, 126, 232, 0.07), transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
  line-height: 1.5;
}

::selection { background: rgba(232, 182, 76, 0.35); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(232, 182, 76, 0.22);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: rgba(232, 182, 76, 0.4); background-clip: content-box; }

/* ---------------- Topbar ---------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 26px;
  background: rgba(14, 19, 27, 0.82);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand-dot {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: var(--gold-grad);
  box-shadow: 0 0 24px rgba(232, 182, 76, 0.5);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}
.brand-dot::after {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 7px;
  background: var(--bg2);
}
.brand h1 {
  font-family: "Outfit", "Inter", sans-serif;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 3px;
  background: var(--gold-grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.topbar-actions { display: flex; gap: 12px; align-items: center; }

.day-label {
  font-size: 13px;
  color: var(--text-dim);
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(24, 33, 48, 0.6);
}

.role-select {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 14px;
  font-size: 14px;
  cursor: pointer;
  transition: border-color 0.2s;
}
.role-select:focus { outline: 2px solid var(--gold); border-color: transparent; }

.lang-btn {
  background: transparent;
  color: var(--gold-soft);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 9px 18px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 1px;
  cursor: pointer;
  transition: all 0.2s;
}
.lang-btn:hover { background: rgba(232, 182, 76, 0.16); box-shadow: 0 0 16px rgba(232, 182, 76, 0.25); }

/* ---------------- Layout ---------------- */

.layout { display: flex; min-height: calc(100vh - 65px); }

.sidebar {
  width: 236px;
  flex-shrink: 0;
  background: rgba(14, 19, 27, 0.55);
  border-right: 1px solid var(--border);
  padding: 18px 12px;
  overflow-y: auto;
  position: sticky;
  top: 65px;
  height: calc(100vh - 65px);
}

.sidebar nav { display: flex; flex-direction: column; gap: 3px; }
.sidebar hr { border: none; border-top: 1px solid var(--border); margin: 12px 8px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: transparent;
  border: none;
  border-left: 3px solid transparent;
  color: var(--text-dim);
  text-align: left;
  padding: 11px 14px;
  font-size: 14px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.18s;
  position: relative;
}
.nav-item svg { flex-shrink: 0; opacity: 0.7; transition: opacity 0.18s; }
.nav-item:hover { color: var(--text); background: rgba(255, 255, 255, 0.045); }
.nav-item:hover svg { opacity: 1; }
.nav-item.active {
  color: var(--gold-soft);
  background: linear-gradient(90deg, rgba(232, 182, 76, 0.16), rgba(232, 182, 76, 0.02));
  border-left-color: var(--gold);
  font-weight: 600;
}
.nav-item.active svg { opacity: 1; }
.nav-item.active::after {
  content: "";
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 10px var(--gold);
}
.nav-item.hidden { display: none; }

.view {
  flex: 1;
  padding: 28px 30px 56px;
  max-width: 1220px;
  margin: 0 auto;
  width: 100%;
  animation: fadeIn 0.35s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------------- Grid & cards ---------------- */

.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }

.card {
  background: linear-gradient(165deg, rgba(24, 33, 48, 0.85), rgba(14, 19, 27, 0.9));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-soft);
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
  position: relative;
  overflow: hidden;
}
.card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--gold-grad);
  opacity: 0.55;
}
.card:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow);
}

.card h3 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1.4px;
  color: var(--text-dim);
  margin-bottom: 12px;
  font-weight: 700;
}

.chart-card { display: flex; flex-direction: column; }
.chart-card h3 { color: var(--gold-soft); }

.aq-wrap { margin-bottom: 20px; }
.aq-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 26px 0 10px;
}
.aq-head strong {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.3px;
}
.aq-actions { display: flex; gap: 8px; }
.aq-actions .btn.sm { padding: 5px 8px; }

.aq-group { margin-bottom: 26px; }
.aq-group-title {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--gold-soft);
  border: 1px solid var(--gold-dim);
  background: rgba(212, 175, 55, 0.06);
  border-radius: 999px;
  padding: 4px 14px;
  margin-bottom: 14px;
}
.starter-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}
.starter-bar > span {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---------------- Metrics / KPI ---------------- */

.metric { position: relative; }
.metric-value {
  font-family: "Outfit", "Inter", sans-serif;
  font-size: 30px;
  font-weight: 800;
  letter-spacing: 0.5px;
  background: var(--gold-grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.1;
}
.metric-label { font-size: 13px; color: var(--text-dim); margin-top: 6px; font-weight: 500; }
.metric.good .metric-value { background: linear-gradient(135deg, #8cebbf, #3ddc97); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.metric.warn .metric-value { background: linear-gradient(135deg, #f7c878, #f2a33c); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.metric.danger .metric-value { background: linear-gradient(135deg, #f9a3aa, #f2606b); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.metric.teal .metric-value { background: linear-gradient(135deg, #9ae9d6, #37c8a8); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.metric.violet .metric-value { background: linear-gradient(135deg, #b7acf5, #8f7ee8); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }

.metric.with-icon { display: flex; align-items: flex-start; gap: 14px; }
.metric-icon {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(232, 182, 76, 0.1);
  border: 1px solid var(--border);
  color: var(--gold-soft);
}
.metric-icon svg { width: 22px; height: 22px; }

/* ---------------- Tables ---------------- */

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th {
  text-align: left;
  color: var(--gold-soft);
  font-weight: 600;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
}
td { padding: 11px 12px; border-bottom: 1px solid rgba(255, 255, 255, 0.05); color: var(--text); }
tr:hover td { background: rgba(255, 255, 255, 0.025); }
tbody tr:last-child td { border-bottom: none; }
td.num, th.num { text-align: right; }

/* ---------------- Badges & pills ---------------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.3px;
}
.badge::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
}
.badge.ok { background: rgba(61, 220, 151, 0.13); color: var(--ok); }
.badge.warn { background: rgba(242, 163, 60, 0.13); color: var(--warn); }
.badge.danger { background: rgba(242, 96, 107, 0.13); color: var(--danger); }
.badge.gold { background: rgba(232, 182, 76, 0.14); color: var(--gold-soft); }
.badge.dim { background: rgba(151, 161, 176, 0.13); color: var(--text-dim); }
.badge.teal { background: rgba(55, 200, 168, 0.14); color: var(--teal-soft); }

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px; border-radius: 999px; font-size: 12px; font-weight: 800;
  letter-spacing: 0.5px; text-transform: uppercase;
}
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; box-shadow: 0 0 8px currentColor; }
.pill.open { background: rgba(61, 220, 151, 0.14); color: var(--ok); }
.pill.closed { background: rgba(242, 96, 107, 0.14); color: var(--danger); }

/* ---------------- Toolbar ---------------- */

.toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 22px;
  flex-wrap: wrap;
}
.toolbar .spacer { flex: 1; }
.toolbar h2 {
  font-family: "Outfit", "Inter", sans-serif;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0.5px;
  background: var(--gold-grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* ---------------- Forms & buttons ---------------- */

input, select, textarea {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
}
input:focus, select:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(232, 182, 76, 0.15); }

.btn {
  background: var(--gold-grad);
  color: #16160e;
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.3px;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(232, 182, 76, 0.3);
  transition: all 0.2s;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 10px 24px rgba(232, 182, 76, 0.42); }
.btn:active { transform: translateY(0); }
.btn.ghost {
  background: transparent;
  color: var(--gold-soft);
  border: 1px solid var(--border-strong);
  box-shadow: none;
}
.btn.ghost:hover { background: rgba(232, 182, 76, 0.12); box-shadow: 0 0 14px rgba(232, 182, 76, 0.2); }
.btn.danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid rgba(242, 96, 107, 0.5);
  box-shadow: none;
}
.btn.danger:hover { background: rgba(242, 96, 107, 0.12); box-shadow: 0 0 14px rgba(242, 96, 107, 0.2); }
.btn.sm { padding: 6px 9px; border-radius: 8px; line-height: 1; }
.btn.sm svg { vertical-align: -2px; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
.form-field label {
  display: block;
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-weight: 600;
}
.form-field select, .form-field input { width: 100%; }
.form-field.full { grid-column: 1 / -1; }

.form-card { margin-bottom: 16px; }
.form-title { font-size: 15px; font-weight: 700; color: var(--gold-soft); margin-bottom: 14px; }
.form-actions { display: flex; gap: 10px; margin-top: 16px; }

.rate-input { width: 90px; text-align: center; padding: 7px 8px; }

/* ---------------- Section titles ---------------- */

.section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 17px;
  font-weight: 700;
  color: var(--gold-soft);
  margin: 30px 0 14px;
  letter-spacing: 0.4px;
}
.section-title::before {
  content: "";
  width: 4px;
  height: 20px;
  border-radius: 4px;
  background: var(--gold-grad);
  box-shadow: 0 0 10px rgba(232, 182, 76, 0.5);
}
.section-title:first-of-type { margin-top: 0; }

.muted { color: var(--text-dim); font-size: 13px; }

/* ---------------- Search / segmented controls ---------------- */

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 12px;
  color: var(--text-dim);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.search-box:focus-within { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(232, 182, 76, 0.15); }
.search-box input { border: none; background: transparent; padding: 10px 0; width: 220px; }
.search-box input:focus { outline: none; box-shadow: none; }

.seg { display: flex; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 4px; gap: 4px; }
.seg-btn {
  background: transparent; color: var(--text-dim); border: none;
  padding: 8px 18px; font-size: 13px; font-weight: 700; letter-spacing: 0.5px;
  border-radius: 9px; cursor: pointer; transition: all 0.2s;
}
.seg-btn:hover { color: var(--text); }
.seg-btn.active { background: var(--gold-grad); color: #16160e; box-shadow: 0 4px 14px rgba(232, 182, 76, 0.35); }

/* ---------------- Charts ---------------- */

.chart { width: 100%; height: auto; }
.chart-label { font-size: 11px; fill: var(--text-dim); font-weight: 600; }
.chart-axis { font-size: 10px; fill: var(--text-dim); }
.chart-card svg { margin-top: 6px; }

.chart-legend {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 10px;
  font-size: 12px;
  color: var(--text-dim);
}
.cl-item { display: inline-flex; align-items: center; gap: 6px; }
.cl-dot { width: 10px; height: 10px; border-radius: 3px; }

.donut-wrap { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.donut-svg { position: relative; flex-shrink: 0; }
.donut-center {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 24px; font-weight: 800; color: var(--gold-soft); pointer-events: none;
}
.donut-legend { flex: 1; min-width: 160px; display: flex; flex-direction: column; gap: 8px; }
.donut-legend-row { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.donut-legend-row .dot { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.donut-legend-row .lk { flex: 1; color: var(--text); }
.donut-legend-row .lv { color: var(--gold-soft); font-weight: 700; }

.hbar-list { display: flex; flex-direction: column; gap: 12px; }
.hbar-row { display: grid; grid-template-columns: 130px 1fr 70px; gap: 12px; align-items: center; font-size: 13px; }
.hbar-label { color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbar-label em { color: var(--gold-soft); font-style: normal; font-weight: 700; margin-right: 2px; }
.hbar-track { height: 10px; background: rgba(255, 255, 255, 0.06); border-radius: 6px; overflow: hidden; }
.hbar-fill { height: 100%; border-radius: 6px; transition: width 0.6s ease; box-shadow: 0 0 10px rgba(232, 182, 76, 0.25); }
.hbar-value { text-align: right; color: var(--text); font-weight: 700; }

/* ---------------- Heatmap ---------------- */

.heatmap {
  display: flex;
  flex-direction: column;
  gap: 5px;
  overflow-x: auto;
  padding-bottom: 4px;
}
.hm-row { display: flex; gap: 5px; align-items: center; }
.hm-cell {
  flex-shrink: 0;
  min-width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  font-size: 11px;
  font-weight: 700;
}
.hm-label {
  min-width: 74px;
  justify-content: flex-start;
  color: var(--text-dim);
  font-weight: 600;
  font-size: 12px;
}
.hm-col { color: var(--text-dim); font-size: 11px; height: 22px; }
.hm-val { color: #fff; transition: transform 0.15s; }
.hm-val:hover { transform: scale(1.08); }

/* ---------------- Appointments / misc ---------------- */

.appointment-row {
  display: grid;
  grid-template-columns: 110px 1fr 1fr 1fr 120px;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  transition: background 0.15s;
}
.appointment-row:hover { background: rgba(255, 255, 255, 0.03); }
.appointment-row.time { color: var(--gold-soft); font-weight: 700; }

.day-check { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.day-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 11px; border: 1px solid var(--border); border-radius: 999px;
  font-size: 12px; color: var(--text-dim); cursor: pointer; transition: all 0.15s;
}
.day-chip:has(input:checked) { border-color: var(--gold); color: var(--gold-soft); background: rgba(232, 182, 76, 0.1); }
.day-chip input { accent-color: var(--gold); }

.rule-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 4px; border-bottom: 1px solid rgba(255, 255, 255, 0.05); font-size: 14px; cursor: pointer;
}
.rule-row:last-child { border-bottom: none; }
.rule-row input { accent-color: var(--gold); transform: scale(1.15); cursor: pointer; }

/* ---------------- Closed overlay ---------------- */

.closed-overlay {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(1000px 500px at 50% -20%, rgba(232, 182, 76, 0.12), transparent 60%),
    rgba(8, 11, 17, 0.96);
  backdrop-filter: blur(6px);
}
.closed-card { text-align: center; padding: 40px 50px; }
.closed-card .brand { justify-content: center; margin-bottom: 22px; }
.closed-icon { color: var(--gold); margin: 10px 0 8px; }
.closed-card h2 { font-size: 30px; font-weight: 800; letter-spacing: 2px; color: var(--gold-soft); margin-bottom: 14px; }
.closed-clock { font-family: "Outfit", sans-serif; font-size: 52px; font-weight: 800; letter-spacing: 4px; background: var(--gold-grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; font-variant-numeric: tabular-nums; }
.closed-date { color: var(--text-dim); font-size: 15px; margin-top: 8px; text-transform: capitalize; }
.closed-open { color: var(--text); font-size: 16px; margin: 18px 0 26px; }
.closed-open::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 10px var(--gold); margin-right: 8px; }

/* ---------------- Responsive ---------------- */

@media (max-width: 900px) {
  .layout { flex-direction: column; }
  .sidebar {
    width: 100%;
    height: auto;
    position: static;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 12px;
  }
  .sidebar nav { flex-direction: row; flex-wrap: wrap; }
  .nav-item { border-left: none; border-bottom: 3px solid transparent; }
  .nav-item.active { border-bottom-color: var(--gold); border-left: none; }
  .nav-item.active::after { display: none; }
  .view { padding: 20px 16px 44px; }
  .form-row { grid-template-columns: 1fr; }
  .appointment-row { grid-template-columns: 80px 1fr 1fr; }
  .topbar { padding: 12px 16px; }
  .day-label { display: none; }
}
