/* Glee CC CRM design system — Vexyron Labs */
:root {
  --bg: #f3f5f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e3e8f0;
  --border-strong: #cfd7e4;
  --text: #0f172a;
  --text-2: #475569;
  --text-3: #8391a7;
  --primary: #2054e6;
  --primary-600: #1a46c7;
  --primary-50: #edf2ff;
  --primary-100: #dbe5ff;
  --nav: #0a1022;
  --nav-2: #111a33;
  --nav-text: #a3b0cc;
  --success: #0f9f6e;
  --warning: #c27803;
  --danger: #d92d42;
  --radius: 12px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05);
  --shadow: 0 1px 3px rgba(15, 23, 42, .06), 0 8px 24px -12px rgba(15, 23, 42, .12);
  --shadow-lg: 0 24px 60px -20px rgba(10, 16, 34, .35);
}

* { -webkit-tap-highlight-color: transparent; }
html, body { background: var(--bg); color: var(--text); }
body { font-family: Inter, ui-sans-serif, system-ui, sans-serif; font-feature-settings: "cv11", "ss01"; -webkit-font-smoothing: antialiased; }
::selection { background: var(--primary-100); }
.tabular { font-variant-numeric: tabular-nums; }
.mono { font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .82rem; }

/* ---------- App shell ---------- */
.sidebar { background: linear-gradient(180deg, var(--nav) 0%, #0c1530 100%); color: var(--nav-text); width: 252px; }
.sidebar .brand { height: 64px; border-bottom: 1px solid rgba(255,255,255,.06); }
.logo-mark { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-weight: 800; color: #fff;
  background: linear-gradient(135deg, #3b6cff 0%, #1d3fd0 100%); box-shadow: 0 6px 16px -6px rgba(59,108,255,.7), inset 0 1px 0 rgba(255,255,255,.25); }
.nav-section { font-size: 10.5px; letter-spacing: .09em; text-transform: uppercase; color: #5f6d8c; font-weight: 600; padding: 18px 14px 6px; }
.nav-item { position: relative; display: flex; align-items: center; gap: 11px; padding: 8px 12px; margin: 1px 0; border-radius: 9px;
  font-size: 13.5px; font-weight: 500; color: var(--nav-text); transition: background .12s, color .12s; }
.nav-item:hover { background: rgba(255,255,255,.05); color: #e6ebf7; }
.nav-item.active { background: rgba(59,108,255,.16); color: #fff; }
.nav-item.active::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: #4f7cff; }
.nav-item .count { margin-left: auto; font-size: 11px; font-weight: 600; background: rgba(255,255,255,.08); color: #c9d3ea; padding: 1px 7px; border-radius: 999px; }
.nav-item.active .count { background: #3b6cff; color: #fff; }

.topbar { height: 64px; background: rgba(255,255,255,.86); backdrop-filter: saturate(180%) blur(10px); border-bottom: 1px solid var(--border); }
.search-trigger { display: flex; align-items: center; gap: 10px; height: 38px; width: 100%; max-width: 440px; padding: 0 12px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text-3); font-size: 13.5px; transition: .15s; }
.search-trigger:hover { border-color: var(--border-strong); background: #fff; }
.kbd { font-size: 11px; font-weight: 600; color: var(--text-3); border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 5px; padding: 0 5px; background: #fff; }

.crumbs { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-3); }
.crumbs a:hover { color: var(--primary); }

.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.page-title { font-size: 22px; font-weight: 700; letter-spacing: -.02em; color: var(--text); }
.page-sub { font-size: 13.5px; color: var(--text-2); margin-top: 3px; }

/* ---------- Surfaces ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.card-title { font-size: 14px; font-weight: 650; color: var(--text); }
.card-sub { font-size: 12px; color: var(--text-3); }
.card-body { padding: 18px; }

.kpi { padding: 16px 18px; display: flex; gap: 14px; align-items: flex-start; }
.kpi-icon { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; flex: none; }
.kpi-label { font-size: 12px; font-weight: 500; color: var(--text-2); }
.kpi-value { font-size: 24px; font-weight: 750; letter-spacing: -.02em; color: var(--text); line-height: 1.2; margin-top: 2px; }
.kpi-sub { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.tone-blue   { background: #eaf0ff; color: #2054e6; }
.tone-green  { background: #e6f7f0; color: #0f9f6e; }
.tone-amber  { background: #fdf3e2; color: #c27803; }
.tone-violet { background: #f1ecff; color: #6d3fe0; }
.tone-rose   { background: #fdecef; color: #d92d42; }
.tone-slate  { background: #eef1f6; color: #475569; }
.tone-cyan   { background: #e4f6fa; color: #0e8aa6; }

/* ---------- Tables ---------- */
.table-wrap { overflow: auto; }
table.data { width: 100%; border-collapse: separate; border-spacing: 0; }
table.data thead th { position: sticky; top: 0; z-index: 1; background: var(--surface-2); color: var(--text-2); font-size: 11.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .04em; text-align: left; white-space: nowrap; padding: 10px 14px; border-bottom: 1px solid var(--border); }
table.data td { padding: 10px 14px; border-bottom: 1px solid #edf1f6; font-size: 13.5px; vertical-align: middle; color: #1e293b; }
table.data tbody tr { transition: background .1s; }
table.data tbody tr:hover { background: #f7f9fd; }
table.data tbody tr.selected { background: var(--primary-50); }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
.row-link { color: var(--text); font-weight: 600; }
.row-link:hover { color: var(--primary); text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; white-space: nowrap; line-height: 1.5; }
.badge .dot { width: 6px; height: 6px; border-radius: 999px; background: currentColor; }
.b-green { background: #e3f6ee; color: #0b7f58; }
.b-amber { background: #fdf1dc; color: #a26203; }
.b-blue  { background: #e8efff; color: #1d4ed8; }
.b-red   { background: #fde8eb; color: #c21f35; }
.b-slate { background: #eef1f5; color: #4b5869; }
.b-violet{ background: #efe9ff; color: #5b34c9; }

/* ---------- Forms ---------- */
.label { display: block; font-size: 12.5px; font-weight: 600; color: #334155; margin-bottom: 6px; }
.hint { font-size: 11.5px; color: var(--text-3); margin-top: 5px; }
.input { width: 100%; height: 38px; border: 1px solid var(--border-strong); border-radius: 9px; padding: 0 11px; font-size: 13.5px; background: #fff; color: var(--text); transition: border .12s, box-shadow .12s; }
textarea.input { height: auto; padding: 9px 11px; line-height: 1.5; }
select.input { padding-right: 30px; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238391a7' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 9px center; background-size: 15px; }
.input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(32,84,230,.14); }
.input-sm { height: 32px; font-size: 12.5px; padding: 0 9px; border-radius: 8px; }
select.input-sm { padding-right: 26px; background-position: right 6px center; }
.input-icon { position: relative; }
.input-icon > svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.input-icon > .input { padding-left: 36px; }
.check { width: 16px; height: 16px; border-radius: 4px; accent-color: var(--primary); cursor: pointer; }
.file-drop { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center; border: 1.5px dashed var(--border-strong); border-radius: 12px; padding: 20px; background: var(--surface-2); color: var(--text-2); font-size: 13px; cursor: pointer; transition: .15s; }
.file-drop:hover, .file-drop.drag { border-color: var(--primary); background: var(--primary-50); color: var(--primary); }
.file-drop input { display: none; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 38px; padding: 0 14px; border-radius: 9px; font-size: 13.5px; font-weight: 600; white-space: nowrap; transition: background .12s, border-color .12s, box-shadow .12s, color .12s; cursor: pointer; border: 1px solid transparent; }
.btn-sm { height: 32px; padding: 0 11px; font-size: 12.5px; border-radius: 8px; }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 1px 2px rgba(32,84,230,.3), inset 0 1px 0 rgba(255,255,255,.12); }
.btn-primary:hover { background: var(--primary-600); }
.btn-secondary { background: #fff; border-color: var(--border-strong); color: #1e293b; box-shadow: var(--shadow-sm); }
.btn-secondary:hover { background: var(--surface-2); border-color: #b8c3d5; }
.btn-ghost { color: var(--text-2); }
.btn-ghost:hover { background: #eef2f8; color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #bd2236; }
.btn-danger-soft { background: #fdecef; color: #c21f35; }
.btn-danger-soft:hover { background: #fbd5db; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #0b8a5f; }
.btn-icon { width: 34px; height: 34px; padding: 0; border-radius: 9px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); overflow-x: auto; }
.tab { display: inline-flex; align-items: center; gap: 7px; padding: 10px 14px; font-size: 13.5px; font-weight: 600; color: var(--text-2); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab .count { font-size: 11px; background: #eef1f6; color: var(--text-2); padding: 0 7px; border-radius: 999px; }
.tab.active .count { background: var(--primary-100); color: var(--primary); }

/* ---------- Avatars ---------- */
.avatar { display: grid; place-items: center; border-radius: 999px; font-weight: 700; color: #fff; flex: none; }
.av-0 { background: linear-gradient(135deg,#3b6cff,#1d3fd0); }
.av-1 { background: linear-gradient(135deg,#10b981,#047857); }
.av-2 { background: linear-gradient(135deg,#f59e0b,#c2410c); }
.av-3 { background: linear-gradient(135deg,#8b5cf6,#5b21b6); }
.av-4 { background: linear-gradient(135deg,#ec4899,#be185d); }
.av-5 { background: linear-gradient(135deg,#06b6d4,#0e7490); }

/* ---------- Menus / popovers ---------- */
.menu { position: absolute; right: 0; top: calc(100% + 8px); min-width: 220px; background: #fff; border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px; z-index: 50; display: none; }
.menu.open { display: block; }
.menu a, .menu button { display: flex; width: 100%; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; font-size: 13.5px; color: #1e293b; text-align: left; }
.menu a:hover, .menu button:hover { background: var(--surface-2); }
.menu hr { border: 0; border-top: 1px solid var(--border); margin: 6px 0; }

/* ---------- Command palette ---------- */
.palette-backdrop { position: fixed; inset: 0; background: rgba(10,16,34,.45); backdrop-filter: blur(3px); z-index: 80; display: none; align-items: flex-start; justify-content: center; padding: 12vh 16px 16px; }
.palette-backdrop.open { display: flex; }
.palette { width: 100%; max-width: 620px; background: #fff; border-radius: 16px; box-shadow: var(--shadow-lg); overflow: hidden; }
.palette input { width: 100%; height: 56px; border: 0; padding: 0 18px 0 50px; font-size: 16px; outline: none; }
.palette .hint-row { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--border); background: var(--surface-2); font-size: 12px; color: var(--text-3); }

/* ---------- Modal ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(10,16,34,.5); backdrop-filter: blur(2px); z-index: 70; display: none; align-items: center; justify-content: center; padding: 16px; }
.modal-backdrop.open { display: flex; }
.modal { width: 100%; max-width: 480px; background: #fff; border-radius: 16px; box-shadow: var(--shadow-lg); overflow: hidden; }
.modal-head { padding: 18px 20px 0; }
.modal-body { padding: 14px 20px 18px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; background: var(--surface-2); border-top: 1px solid var(--border); }

/* ---------- Toasts ---------- */
.toast-stack { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 90; max-width: calc(100vw - 40px); }
.toast { display: flex; align-items: flex-start; gap: 10px; min-width: 280px; max-width: 420px; background: #0f172a; color: #e2e8f0; border-radius: 12px; padding: 12px 14px; box-shadow: var(--shadow-lg); font-size: 13.5px; animation: toast-in .25s ease-out; }
.toast.ok svg { color: #34d399; } .toast.err svg { color: #fb7185; }
@keyframes toast-in { from { transform: translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- Bulk bar ---------- */
.bulkbar { position: sticky; bottom: 16px; z-index: 30; display: none; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 12px; padding: 10px 14px; border-radius: 12px; background: #0f172a; color: #fff; box-shadow: var(--shadow-lg); }
.bulkbar.show { display: flex; }
.bulkbar .input-sm { background-color: #1e293b; border-color: #334155; color: #fff; }

/* ---------- Misc ---------- */
.empty { padding: 48px 20px; text-align: center; color: var(--text-3); font-size: 13.5px; }
.empty .ic { width: 48px; height: 48px; margin: 0 auto 12px; border-radius: 14px; display: grid; place-items: center; background: #eef1f6; color: var(--text-2); }
.empty .t { font-size: 15px; font-weight: 650; color: var(--text); margin-bottom: 4px; }
.meter { height: 6px; border-radius: 999px; background: #edf1f6; overflow: hidden; }
.meter > span { display: block; height: 100%; border-radius: 999px; background: var(--primary); }
.dl { display: grid; grid-template-columns: 130px 1fr; gap: 10px 14px; font-size: 13.5px; }
.dl dt { color: var(--text-3); }
.dl dd { color: var(--text); font-weight: 500; word-break: break-word; }
.timeline { position: relative; }
.timeline::before { content: ""; position: absolute; left: 15px; top: 6px; bottom: 6px; width: 2px; background: #edf1f6; }
.tl-item { position: relative; display: flex; gap: 12px; padding-bottom: 16px; }
.tl-dot { position: relative; z-index: 1; width: 32px; height: 32px; border-radius: 999px; display: grid; place-items: center; flex: none; border: 3px solid #fff; }
.danger-zone { border: 1px solid #f6c8cf; border-radius: var(--radius); background: #fffafb; }
.status-dot { width: 8px; height: 8px; border-radius: 999px; background: #22c55e; box-shadow: 0 0 0 3px rgba(34,197,94,.18); }
details > summary { list-style: none; } details > summary::-webkit-details-marker { display: none; }

@media (max-width: 1023px) {
  .sidebar { position: fixed; inset: 0 auto 0 0; z-index: 60; transform: translateX(-100%); transition: transform .2s ease; }
  .sidebar.open { transform: none; box-shadow: var(--shadow-lg); }
  .sidebar-scrim { position: fixed; inset: 0; z-index: 55; background: rgba(10,16,34,.45); display: none; }
  .sidebar-scrim.open { display: block; }
}
