@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

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

:root {
  --bg: #0a0a0a;
  --surface: #111111;
  --surface2: #171717;
  --fg: #ffffff;
  --muted: #888888;
  --dim: #555555;
  --border: rgba(255,255,255,0.08);
  --border-hover: rgba(255,255,255,0.16);
  --sidebar-w: 240px;
  --amber: #f59e0b;
  --blue: #3b82f6;
  --green: #10b981;
  --red: #ef4444;
}

html, body {
  background: var(--bg);
  color: var(--fg);
  font-family: 'Inter', sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  line-height: 1.6;
}

/* ─── SIDEBAR ─── */
.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 100;
  padding: 1.5rem 0 1rem;
}

.sidebar-logo {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--fg);
  text-decoration: none;
  padding: 0 1.25rem;
  margin-bottom: 1.75rem;
  display: block;
}

.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 0 0.625rem;
  overflow-y: auto;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.475rem 0.75rem;
  border-radius: 6px;
  text-decoration: none;
  font-size: 0.83rem;
  font-weight: 500;
  color: var(--muted);
  transition: all 0.15s;
  white-space: nowrap;
}

.sidebar-nav a:hover { color: var(--fg); background: rgba(255,255,255,0.05); }
.sidebar-nav a.active { color: var(--fg); background: rgba(255,255,255,0.07); }
.sidebar-nav a svg { width: 15px; height: 15px; flex-shrink: 0; }

.sidebar-bottom {
  padding: 0.875rem 1.25rem 0;
  border-top: 1px solid var(--border);
  margin-top: 0.75rem;
}

.sidebar-client-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 0.1rem;
}

.sidebar-client-role {
  font-size: 0.72rem;
  color: var(--muted);
  margin-bottom: 0.625rem;
}

.sidebar-month {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.72rem;
  color: var(--muted);
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  margin-bottom: 0.625rem;
}

.sidebar-month-dot {
  width: 5px; height: 5px;
  background: var(--green);
  border-radius: 50%;
  flex-shrink: 0;
}

.sidebar-switcher {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.625rem;
  border-radius: 5px;
  border: 1px solid var(--border);
  background: none;
  color: var(--dim);
  font-size: 0.72rem;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: all 0.15s;
  width: 100%;
}

.sidebar-switcher:hover { color: var(--muted); border-color: var(--border-hover); }
.sidebar-switcher svg { width: 12px; height: 12px; flex-shrink: 0; }

/* ─── MAIN ─── */
.main {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  padding: 2.5rem 3rem;
}

/* ─── PAGE HEADER ─── */
.page-header { margin-bottom: 2rem; }
.page-title { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.03em; margin-bottom: 0.25rem; }
.page-subtitle { font-size: 0.83rem; color: var(--muted); }

/* ─── SECTION LABEL ─── */
.section-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--dim);
  margin-bottom: 0.75rem;
}

/* ─── METRICS GRID ─── */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 2rem;
}

.metric-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.125rem 1.25rem;
}

.metric-label {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

.metric-value {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1;
  margin-bottom: 0.375rem;
}

.metric-sub {
  font-size: 0.72rem;
  color: var(--dim);
}

.metric-sub em { font-style: normal; color: var(--muted); }

/* ─── CARDS ─── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem;
}

/* ─── BADGES ─── */
.badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.18rem 0.5rem;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.badge-amber { background: rgba(245,158,11,0.12); color: #f59e0b; }
.badge-blue  { background: rgba(59,130,246,0.12);  color: #60a5fa; }
.badge-green { background: rgba(16,185,129,0.12);  color: #34d399; }
.badge-red   { background: rgba(239,68,68,0.12);   color: #f87171; }
.badge-gray  { background: rgba(255,255,255,0.06); color: var(--muted); }

/* ─── BUTTONS ─── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 1rem;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 500;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
  border: none;
  white-space: nowrap;
}

.btn svg { width: 14px; height: 14px; flex-shrink: 0; }

.btn-primary { background: var(--fg); color: var(--bg); }
.btn-primary:hover { background: #e0e0e0; }
.btn-ghost { background: none; border: 1px solid var(--border); color: var(--muted); }
.btn-ghost:hover { border-color: var(--border-hover); color: var(--fg); }
.btn-outline { background: none; border: 1px solid var(--border); color: var(--fg); }
.btn-outline:hover { border-color: var(--border-hover); background: rgba(255,255,255,0.04); }
.btn-sm { padding: 0.3rem 0.75rem; font-size: 0.75rem; }

/* ─── TABLE ─── */
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--dim);
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.table td {
  padding: 0.8rem 1rem;
  font-size: 0.83rem;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  vertical-align: middle;
}

.table tr:last-child td { border-bottom: none; }
.table tbody tr { cursor: pointer; transition: background 0.12s; }
.table tbody tr:hover td { background: rgba(255,255,255,0.025); }

/* ─── TABS ─── */
.tabs {
  display: flex;
  gap: 0.125rem;
  background: rgba(255,255,255,0.04);
  border-radius: 7px;
  padding: 3px;
}

.tab {
  padding: 0.35rem 0.875rem;
  border-radius: 5px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s;
  border: none;
  background: none;
  font-family: 'Inter', sans-serif;
}

.tab:hover { color: var(--fg); }
.tab.active { background: var(--surface2); color: var(--fg); }

/* ─── TOOLBAR ─── */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

/* ─── PROGRESS BAR ─── */
.progress-bar {
  width: 100%;
  height: 4px;
  background: rgba(255,255,255,0.06);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 0.5rem;
}

.progress-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.6s ease;
}

.progress-green  { background: var(--green); }
.progress-amber  { background: var(--amber); }
.progress-blue   { background: var(--blue); }
.progress-red    { background: var(--red); }

/* ─── ACCORDION ─── */
.accordion {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 0.75rem;
}

.accordion-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  cursor: pointer;
  user-select: none;
  transition: background 0.12s;
}

.accordion-header:hover { background: rgba(255,255,255,0.025); }
.accordion-title { font-size: 0.9rem; font-weight: 600; }

.accordion-chevron {
  width: 16px; height: 16px;
  color: var(--dim);
  transition: transform 0.2s;
  flex-shrink: 0;
}

.accordion.open .accordion-chevron { transform: rotate(180deg); }

.accordion-body {
  padding: 0 1.25rem 1.25rem;
  display: none;
  font-size: 0.83rem;
  color: rgba(255,255,255,0.75);
  line-height: 1.7;
}

.accordion.open .accordion-body { display: block; }

/* ─── TAGS ─── */
.tags { display: flex; flex-wrap: wrap; gap: 0.375rem; margin-top: 0.75rem; }
.tag {
  font-size: 0.72rem;
  font-weight: 500;
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
}
.tag-green { background: rgba(16,185,129,0.1); color: #34d399; border: 1px solid rgba(16,185,129,0.2); }
.tag-red   { background: rgba(239,68,68,0.1);  color: #f87171; border: 1px solid rgba(239,68,68,0.2); }

/* ─── MODAL ─── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 500;
  align-items: center;
  justify-content: center;
}

.modal-overlay.open { display: flex; }

.modal {
  background: #141414;
  border: 1px solid var(--border-hover);
  border-radius: 12px;
  padding: 1.75rem;
  width: 480px;
  max-width: 90vw;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 1.25rem;
  letter-spacing: -0.02em;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

/* ─── FORM ─── */
.form-group { margin-bottom: 1rem; }

.form-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 0.375rem;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  font-size: 0.83rem;
  font-family: 'Inter', sans-serif;
  color: var(--fg);
  outline: none;
  transition: border-color 0.15s;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: rgba(255,255,255,0.25);
}

.form-select option { background: #1a1a1a; }
.form-textarea { resize: vertical; min-height: 80px; line-height: 1.5; }

/* ─── BACK LINK ─── */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.8rem;
  color: var(--muted);
  text-decoration: none;
  margin-bottom: 1.75rem;
  transition: color 0.15s;
}
.back-link:hover { color: var(--fg); }
.back-link svg { width: 14px; height: 14px; }

/* ─── SEARCH ─── */
.search-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 0.5rem 0.75rem;
  flex: 1;
  max-width: 280px;
}

.search-bar svg { width: 14px; height: 14px; color: var(--dim); flex-shrink: 0; }

.search-bar input {
  background: none;
  border: none;
  outline: none;
  font-size: 0.83rem;
  color: var(--fg);
  font-family: 'Inter', sans-serif;
  width: 100%;
}

.search-bar input::placeholder { color: var(--dim); }

/* ─── ADMIN BANNER ─── */
.admin-banner {
  display: none;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: var(--amber);
  background: rgba(245,158,11,0.07);
  border: 1px solid rgba(245,158,11,0.18);
  border-radius: 7px;
  padding: 0.5rem 0.875rem;
  margin-bottom: 1.5rem;
}

.admin-banner svg { width: 14px; height: 14px; flex-shrink: 0; }
body.admin-mode .admin-banner { display: flex; }

/* ─── PILL ─── */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.72rem;
  font-weight: 500;
  padding: 0.2rem 0.625rem;
  border-radius: 20px;
  border: 1px solid var(--border);
  color: var(--muted);
}

/* ─── AVATAR ─── */
.avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
  flex-shrink: 0;
  letter-spacing: 0;
}

.avatar-lg {
  width: 52px; height: 52px;
  font-size: 1rem;
}

/* ─── DIVIDER ─── */
hr { border: none; border-top: 1px solid var(--border); margin: 1.5rem 0; }

/* ─── EMPTY STATE ─── */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--dim);
  font-size: 0.85rem;
}

/* ─── SCROLLBAR ─── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.15); }
