/* ── AIMLSE Admin — IBM Carbon-inspired design system ────────────────────────
   Dark UI-shell header + light, flat, high-contrast content area. IBM Plex
   type, IBM Blue accent, sharp corners, minimal shadow — the enterprise-
   console aesthetic (ibm.com / IBM Cloud console), not a generic dark SaaS
   template.
   ─────────────────────────────────────────────────────────────────────────── */
:root {
  --bg:         #ffffff;
  --bg-subtle:  #f4f4f4;
  --surface:    #ffffff;
  --surface2:   #f4f4f4;
  --surface3:   #e8e8e8;
  --border:     #e0e0e0;
  --border2:    #c6c6c6;
  --shell:      #161616;
  --shell-hover:#262626;
  --text:       #161616;
  --text-muted: #525252;
  --text-faint: #8d8d8d;
  --blue:       #0f62fe;
  --blue-hover: #0043ce;
  --blue-tint:  #edf5ff;
  --danger:     #da1e28;
  --danger-tint:#fff1f1;
  --success:    #24a148;
  --success-tint:#defbe6;
  --warning:    #f1c21b;
  --font-ui:      'IBM Plex Sans', -apple-system, 'Segoe UI', sans-serif;
  --font-display: 'IBM Plex Sans', var(--font-ui);
  --font-mono:    'IBM Plex Mono', 'SF Mono', monospace;
  --radius:    2px;
  --radius-lg: 2px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,.12);
  --shadow-lg: 0 8px 28px rgba(0,0,0,.18);
  --transition: all .12s cubic-bezier(.2,0,.38,.9);
}

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

body {
  font-family: var(--font-ui);
  background: var(--bg-subtle);
  color: var(--text);
  min-height: 100vh;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

*:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 0; }
::-webkit-scrollbar-thumb:hover { background: var(--text-faint); }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ── Topbar (IBM UI Shell header: dark, always) ──────────────────────────── */
.topbar {
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  background: var(--shell);
  border-bottom: 1px solid #000;
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar-left { display: flex; align-items: center; gap: 0; height: 100%; }

.logo-img {
  height: 22px;
  width: 22px;
  object-fit: contain;
  border-radius: 3px;
  flex-shrink: 0;
}

.logo-text {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .04em;
  color: #ffffff;
}

.topbar-left > a {
  padding: 0 16px;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
}

.page-title {
  font-size: 13px;
  font-weight: 400;
  color: #c6c6c6;
  border-left: 1px solid #393939;
  padding: 0 16px;
  height: 100%;
  display: flex;
  align-items: center;
}

.topbar-right { display: flex; align-items: center; gap: 16px; padding-right: 4px; }

.user-info { font-size: 12.5px; color: #c6c6c6; }

.topbar .btn-ghost {
  background: transparent;
  border-color: #393939;
  color: #f4f4f4;
}
.topbar .btn-ghost:hover { background: var(--shell-hover); border-color: #525252; }

/* ── Layout ───────────────────────────────────────────────────────────────── */
.layout {
  display: flex;
  height: calc(100vh - 48px);
}

/* ── Sidebar ──────────────────────────────────────────────────────────────── */
.sidebar {
  width: 224px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  overflow-y: auto;
}

.sidebar-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px 10px 16px;
  border-radius: 0;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-family: var(--font-ui);
  font-size: 13.5px;
  font-weight: 500;
  text-align: left;
  transition: var(--transition);
  width: 100%;
  border-left: 3px solid transparent;
}

.sidebar-item:hover { background: var(--surface2); color: var(--text); }
.sidebar-item.active { background: var(--blue-tint); color: var(--blue-hover); border-left-color: var(--blue); font-weight: 600; }
.sidebar-item svg { flex-shrink: 0; opacity: .8; }
.sidebar-item.active svg { opacity: 1; }

/* ── Content ──────────────────────────────────────────────────────────────── */
.content {
  flex: 1;
  overflow-y: auto;
  padding: 32px 40px 64px;
}

.tab { display: none; }
.tab.active { display: block; }

.section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

h2 { font-family: var(--font-display); font-size: 24px; font-weight: 600; color: var(--text); letter-spacing: -.01em; }
.subtitle { font-size: 13.5px; color: var(--text-muted); margin-top: 6px; line-height: 1.5; max-width: 62ch; }

/* ── Buttons (Carbon: flat, sharp, no lift) ──────────────────────────────── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 0;
  border: none;
  background: var(--blue);
  color: #ffffff;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition);
}
.btn-primary:hover { background: var(--blue-hover); }
.btn-primary:active { background: #002d9c; }
.btn-primary:disabled { opacity: .45; cursor: not-allowed; }

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border-radius: 0;
  border: 1px solid var(--border2);
  background: transparent;
  color: var(--text);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}
.btn-ghost:hover { background: var(--surface2); border-color: var(--text-faint); }

.btn-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 0;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
}
.btn-icon:hover { background: var(--surface2); color: var(--text); }

.btn-danger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 0;
  border: 1px solid transparent;
  background: transparent;
  color: var(--danger);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}
.btn-danger:hover { background: var(--danger-tint); border-color: rgba(218,30,40,.3); }

/* ── Cards / grid ─────────────────────────────────────────────────────────── */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0;
  padding: 20px 22px;
}

.workspace-card { display: flex; flex-direction: column; gap: 11px; transition: var(--transition); border-top: 3px solid var(--border); }
.workspace-card:hover { border-top-color: var(--blue); box-shadow: var(--shadow-sm); }

.wc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.wc-title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wc-meta { font-size: 12px; color: var(--text-muted); display: flex; align-items: center; gap: 12px; }

.member-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  border-radius: 0;
  background: var(--surface2);
  border: 1px solid var(--border);
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  flex-shrink: 0;
}

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  flex-shrink: 0;
}

.wc-members {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 2px 0;
}
.wc-member {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  font-size: 12px;
  color: var(--text);
}
.wc-member-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.wc-member-off { opacity: 0.45; }
.wc-member-empty { font-size: 12px; color: var(--text-muted); font-style: italic; }

.wc-actions { display: flex; align-items: center; gap: 8px; }

.wc-invite {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 0;
  padding: 7px 10px;
  font-size: 12px;
  overflow: hidden;
}

.wc-invite-url {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 11px;
}

.copy-btn {
  border: none;
  background: var(--blue);
  color: #fff;
  border-radius: 0;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: var(--transition);
}
.copy-btn:hover { background: var(--blue-hover); }

/* ── Table ────────────────────────────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  background: var(--surface);
}

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

.data-table thead th {
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--surface2);
  border-bottom: 1px solid var(--border2);
  padding: 12px 16px;
  white-space: nowrap;
}

.data-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background .1s;
}
.data-table tbody tr:last-child { border-bottom: none; }
.data-table tbody tr:hover { background: var(--blue-tint); }

.data-table td {
  padding: 13px 16px;
  font-size: 13.5px;
  color: var(--text);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}
.badge-active { background: var(--success-tint); color: #0e6027; }
.badge-inactive { background: var(--surface3); color: var(--text-muted); }
/* Booking workflow statuses */
.badge-new { background: var(--blue-tint); color: var(--blue-hover); }
.badge-confirmed { background: var(--success-tint); color: #0e6027; }
.badge-cancelled { background: var(--danger-tint); color: var(--danger); }
.badge-done { background: var(--surface3); color: var(--text-muted); }

/* ── Stat cards ───────────────────────────────────────────────────────────── */
.stat-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1px;
  margin-bottom: 28px;
  background: var(--border);
  border: 1px solid var(--border);
}
.stat-card {
  flex: 1;
  min-width: 130px;
  background: var(--surface);
  border: none;
  border-radius: 0;
  padding: 16px 18px;
  transition: var(--transition);
}
.stat-card.stat-online { box-shadow: inset 3px 0 0 var(--success); }
.stat-card.stat-danger .stat-val { color: var(--danger); }
.stat-val {
  display: flex;
  align-items: center;
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.1;
}
.stat-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  margin-top: 6px;
}

/* ── Invite form ──────────────────────────────────────────────────────────── */
.invite-form { max-width: 660px; }

.invite-row {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 10px;
  flex-wrap: wrap;
}

.form-label { font-size: 12px; color: var(--text-muted); font-weight: 600; }

.form-input {
  flex: 1;
  min-width: 180px;
  padding: 9px 12px;
  border-radius: 0;
  border: 1px solid var(--border2);
  border-bottom: 2px solid var(--text-faint);
  background: var(--surface2);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 13.5px;
  outline: none;
  transition: var(--transition);
}
.form-input:focus { border-bottom-color: var(--blue); background: var(--surface); }

/* ── Banners / toast ──────────────────────────────────────────────────────── */
.banner {
  padding: 12px 14px;
  border-radius: 0;
  font-size: 13.5px;
  line-height: 1.5;
  border-left: 3px solid transparent;
}
.banner.error   { background: var(--danger-tint); border-left-color: var(--danger); color: #a2191f; }
.banner.success { background: var(--success-tint); border-left-color: var(--success); color: #0e6027; }
.hidden { display: none !important; }

.toast {
  position: fixed;
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--shell);
  border: none;
  border-radius: 0;
  padding: 12px 22px;
  font-size: 13.5px;
  color: #fff;
  box-shadow: var(--shadow-lg);
  z-index: 9999;
  transition: opacity 0.3s;
}

/* ── Empty state ──────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 64px 20px;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
.empty-state svg { opacity: .3; }
.empty-state p { font-size: 14px; }

/* ── Modal ────────────────────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(22,22,22,.55);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal {
  background: var(--surface);
  border: none;
  border-radius: 0;
  width: 440px;
  max-width: calc(100vw - 32px);
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  box-shadow: var(--shadow-lg);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-header h3 { font-family: var(--font-display); font-size: 17px; font-weight: 600; color: var(--text); }

.modal-body { display: flex; flex-direction: column; gap: 8px; }

.hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ── Analytics dashboard ──────────────────────────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1px;
  margin-bottom: 28px;
  background: var(--border);
  border: 1px solid var(--border);
}

.kpi-card {
  position: relative;
  background: var(--surface);
  border: none;
  border-radius: 0;
  padding: 18px 20px;
}

.kpi-value {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.1;
}

.kpi-label {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-muted);
  margin-top: 8px;
}

.kpi-sub {
  font-size: 11px;
  color: var(--text-faint);
  margin-top: 4px;
}

.chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0;
  padding: 20px 22px;
  margin-bottom: 20px;
}

.chart-card-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 20px;
}

.chart-card-head h3 {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.chart-card-sub {
  font-size: 11.5px;
  color: var(--text-muted);
  font-weight: 400;
}

.chart-empty {
  font-size: 13px;
  color: var(--text-muted);
  padding: 24px 0;
  text-align: center;
}

.analytics-row {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

/* Vertical bar chart (signups / traffic over time) */
.bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 140px;
}

.bar-col {
  flex: 1;
  min-width: 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
}

.bar-col-track {
  flex: 1;
  width: 100%;
  display: flex;
  align-items: flex-end;
}

.bar-col-fill {
  width: 100%;
  background: var(--blue);
  border-radius: 0;
  min-height: 2px;
  transition: opacity 0.15s;
}

.bar-col:hover .bar-col-fill { opacity: 0.65; background: var(--blue-hover); }

.bar-col-label {
  font-size: 9px;
  color: var(--text-faint);
  margin-top: 6px;
  white-space: nowrap;
  transform: rotate(-40deg);
  transform-origin: top left;
  height: 14px;
}

/* Horizontal bar list (top paths / status / geo) */
.hbar-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.hbar-row {
  display: grid;
  grid-template-columns: 140px 1fr 40px;
  align-items: center;
  gap: 10px;
}

.hbar-label {
  font-size: 12.5px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--font-mono);
}

.hbar-track {
  background: var(--surface3);
  border-radius: 0;
  height: 8px;
  overflow: hidden;
}

.hbar-fill {
  height: 100%;
  background: var(--blue);
  border-radius: 0;
}

.hbar-value {
  font-size: 12px;
  color: var(--text-muted);
  text-align: right;
  font-variant-numeric: tabular-nums;
}
