/* Zeeny Ops — Majlis dark system (Clash Display + Geist) */

:root {
  --bg: #0C1E19;
  --surface: #12251F;
  --surface-2: #173028;
  --surface-3: #1D3A30;
  --text: #EFE9DC;
  --text-muted: #A9B4A8;
  --accent: #D9A648;
  --accent-hover: #E5B85F;
  --on-accent: #14100A;
  --border: rgba(239, 233, 220, 0.14);
  --border-strong: rgba(239, 233, 220, 0.28);

  /* status colors (kept inside the Majlis warmth) */
  --st-backlog: #8FA093;
  --st-planned: #C9BFA8;
  --st-progress: #D9A648;
  --st-waiting: #D08663;
  --st-done: #6FBF8F;
  --danger: #D07A6A;

  --font-display: 'Clash Display', 'Segoe UI', sans-serif;
  --font-body: 'Geist', 'Segoe UI', sans-serif;

  --fs-12: 0.75rem;
  --fs-14: 0.875rem;
  --fs-16: 1rem;
  --fs-18: 1.125rem;
  --fs-24: 1.5rem;
  --fs-32: 2rem;

  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --sidebar-w: 232px;
}

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

html { color-scheme: dark; }

body {
  background:
    radial-gradient(1200px 500px at 85% -10%, rgba(217, 166, 72, 0.07), transparent 60%),
    radial-gradient(900px 600px at -10% 110%, rgba(46, 125, 107, 0.12), transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--fs-16);
  line-height: 1.55;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}

img, svg { display: block; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.15;
}

::selection { background: var(--accent); color: var(--on-accent); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ── Shell ─────────────────────────────────────────────── */
.app { display: flex; min-height: 100dvh; }

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 20px 14px;
  border-right: 1px solid var(--border);
  background: rgba(12, 30, 25, 0.6);
  position: sticky;
  top: 0;
  height: 100dvh;
  overflow-y: auto;
}

.brand { display: flex; align-items: center; gap: 10px; padding: 2px 8px; }
.brand-mark {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  background: var(--accent); color: var(--on-accent);
  font-family: var(--font-display); font-weight: 700; font-size: 19px;
  border-radius: 9px;
}
.brand-name { font-family: var(--font-display); font-weight: 600; font-size: 19px; letter-spacing: 0.01em; }
.brand-name em { font-style: normal; color: var(--accent); }

.side-label {
  display: block;
  font-size: var(--fs-12); font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.09em;
  color: var(--text-muted);
  margin: 0 8px 6px;
}
.client-row { display: flex; align-items: center; gap: 8px; padding: 0 8px; }
.client-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); flex: 0 0 auto; }
.client-switch select {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 9px 10px;
  font-weight: 500;
  cursor: pointer;
}
.ghost-btn {
  margin: 8px 8px 0;
  background: none;
  border: 1px dashed var(--border-strong);
  color: var(--text-muted);
  border-radius: var(--r-sm);
  padding: 7px 10px;
  font-size: var(--fs-14);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.ghost-btn:hover { color: var(--accent); border-color: var(--accent); }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  color: var(--text-muted);
  font-weight: 500;
  font-size: 15px;
  transition: background 0.15s, color 0.15s;
  min-height: 44px;
}
.nav a svg { width: 19px; height: 19px; flex: 0 0 auto; }
.nav a:hover { color: var(--text); background: rgba(239, 233, 220, 0.05); }
.nav a.active { color: var(--accent); background: rgba(217, 166, 72, 0.11); }

.side-foot { margin-top: auto; font-size: var(--fs-12); color: var(--text-muted); padding: 0 8px; opacity: 0.75; }

.main { flex: 1; min-width: 0; padding: 26px 30px 70px; }

.menu-btn { display: none; }
.scrim { display: none; }

/* ── View header ───────────────────────────────────────── */
.view-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; margin-bottom: 22px; flex-wrap: wrap; }
.view-head h1 { font-size: var(--fs-32); }
.view-head .sub { color: var(--text-muted); font-size: var(--fs-14); margin-top: 4px; }
.head-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--accent); color: var(--on-accent);
  border: none; border-radius: var(--r-sm);
  padding: 10px 16px;
  font-weight: 600; font-size: var(--fs-14);
  cursor: pointer;
  min-height: 44px;
  transition: background 0.15s, transform 0.1s;
}
.btn:hover { background: var(--accent-hover); }
.btn:active { transform: translateY(1px); }
.btn.secondary { background: var(--surface-2); color: var(--text); border: 1px solid var(--border-strong); }
.btn.secondary:hover { background: var(--surface-3); }
.btn.danger { background: none; color: var(--danger); border: 1px solid var(--danger); }

/* ── Cards / panels ────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 20px;
}
.card h2 { font-size: var(--fs-18); margin-bottom: 14px; }
.card .kicker {
  font-size: var(--fs-12); font-weight: 600; letter-spacing: 0.09em;
  text-transform: uppercase; color: var(--text-muted); margin-bottom: 8px;
}

.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }

/* ── Dashboard ─────────────────────────────────────────── */
.stat { display: flex; flex-direction: column; gap: 4px; }
.stat .num { font-family: var(--font-display); font-size: var(--fs-32); font-weight: 700; color: var(--accent); line-height: 1; }
.stat .num small { font-size: var(--fs-16); color: var(--text-muted); font-weight: 500; }
.stat .lbl { color: var(--text-muted); font-size: var(--fs-14); }

.meter { height: 8px; background: rgba(239, 233, 220, 0.09); border-radius: 999px; overflow: hidden; margin-top: 10px; }
.meter > i { display: block; height: 100%; background: var(--accent); border-radius: 999px; transition: width 0.3s ease-out; }
.meter.green > i { background: var(--st-done); }

.score-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); }
.score-row:first-of-type { border-top: none; }
.score-row .t { font-size: 15px; }
.score-row .v { font-weight: 600; color: var(--text-muted); font-size: var(--fs-14); white-space: nowrap; }
.score-row .v.ok { color: var(--st-done); }

.list-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); font-size: 15px; }
.list-row:first-of-type { border-top: none; }
.list-row .when { color: var(--text-muted); font-size: var(--fs-12); white-space: nowrap; }
.list-row .grow { flex: 1; min-width: 0; }

/* ── Chips & badges ────────────────────────────────────── */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: var(--fs-12); font-weight: 600;
  border: 1px solid transparent;
  white-space: nowrap;
}
.chip::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.chip.backlog { color: var(--st-backlog); border-color: rgba(143, 160, 147, 0.4); }
.chip.planned { color: var(--st-planned); border-color: rgba(201, 191, 168, 0.4); }
.chip.in_progress, .chip.live, .chip.drafted { color: var(--st-progress); border-color: rgba(217, 166, 72, 0.45); }
.chip.waiting, .chip.paused { color: var(--st-waiting); border-color: rgba(208, 134, 99, 0.45); }
.chip.done, .chip.posted, .chip.paid { color: var(--st-done); border-color: rgba(111, 191, 143, 0.45); }
.chip.idea { color: var(--text-muted); border-color: var(--border-strong); }
.chip.approved { color: #9FC5B8; border-color: rgba(159, 197, 184, 0.45); }

.cat-tag {
  font-size: 11px; font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase;
  color: var(--accent); opacity: 0.9;
}

/* ── Kanban board ──────────────────────────────────────── */
.board {
  display: grid;
  grid-template-columns: repeat(5, minmax(232px, 1fr));
  gap: 14px;
  align-items: start;
  overflow-x: auto;
  padding-bottom: 10px;
  scroll-snap-type: x mandatory;
}
.col { scroll-snap-align: start; background: rgba(18, 37, 31, 0.65); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 12px; min-height: 200px; }
.col.drag-over { border-color: var(--accent); background: rgba(217, 166, 72, 0.06); }
.col-head { display: flex; align-items: center; justify-content: space-between; padding: 2px 4px 10px; }
.col-head h3 { font-size: var(--fs-14); font-weight: 600; font-family: var(--font-body); letter-spacing: 0.02em; }
.col-head .count { font-size: var(--fs-12); color: var(--text-muted); background: var(--surface-2); border-radius: 999px; padding: 2px 9px; }
.col[data-status="backlog"] .col-head h3 { color: var(--st-backlog); }
.col[data-status="planned"] .col-head h3 { color: var(--st-planned); }
.col[data-status="in_progress"] .col-head h3 { color: var(--st-progress); }
.col[data-status="waiting"] .col-head h3 { color: var(--st-waiting); }
.col[data-status="done"] .col-head h3 { color: var(--st-done); }

.tcard {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 12px;
  margin-bottom: 10px;
  cursor: grab;
  transition: border-color 0.15s, transform 0.15s;
}
.tcard:hover { border-color: var(--border-strong); }
.tcard.dragging { opacity: 0.45; }
.tcard .t { font-size: var(--fs-14); line-height: 1.4; margin: 6px 0 8px; }
.tcard.is-done .t { text-decoration: line-through; color: var(--text-muted); }
.tcard .meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tcard .note-preview { font-size: var(--fs-12); color: var(--text-muted); margin-top: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tcard .due { font-size: 11px; color: var(--st-waiting); }
.move-btn {
  background: none; border: none; padding: 6px; margin: -6px;
  color: var(--text-muted); cursor: pointer; border-radius: 6px;
}
.move-btn:hover { color: var(--accent); }
.add-card {
  width: 100%;
  background: none; border: 1px dashed var(--border);
  color: var(--text-muted); border-radius: var(--r-md);
  padding: 9px; font-size: var(--fs-14); cursor: pointer;
  min-height: 42px;
}
.add-card:hover { color: var(--accent); border-color: var(--accent); }

/* ── Calendar ──────────────────────────────────────────── */
.cal-nav { display: flex; align-items: center; gap: 12px; }
.cal-nav h2 { font-size: var(--fs-24); min-width: 190px; text-align: center; }
.cal-nav button {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r-sm); width: 44px; height: 44px;
  cursor: pointer; display: grid; place-items: center; color: var(--text);
}
.cal-nav button:hover { border-color: var(--accent); color: var(--accent); }

.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.cal-dow { text-align: center; font-size: var(--fs-12); font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); padding: 8px 0 10px; }
.cal-day {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  min-height: 104px;
  padding: 8px;
  display: flex; flex-direction: column; gap: 5px;
  cursor: pointer;
  transition: border-color 0.15s;
}
.cal-day:hover { border-color: var(--border-strong); }
.cal-day.other { opacity: 0.35; }
.cal-day.today { border-color: var(--accent); }
.cal-day .d { font-size: var(--fs-12); font-weight: 600; color: var(--text-muted); }
.cal-day.today .d { color: var(--accent); }
.pill {
  font-size: 11px; font-weight: 600;
  border-radius: 6px; padding: 3px 7px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  border-inline-start: 3px solid;
  background: var(--surface-3);
  cursor: pointer;
  text-align: start;
  border-top: 0; border-bottom: 0; border-inline-end: 0;
  width: 100%;
}
.pill.planned { border-color: var(--st-planned); color: var(--st-planned); }
.pill.drafted { border-color: var(--st-progress); color: var(--st-progress); }
.pill.approved { border-color: #9FC5B8; color: #9FC5B8; }
.pill.posted { border-color: var(--st-done); color: var(--st-done); }
.cal-legend { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 14px; color: var(--text-muted); font-size: var(--fs-12); }
.cal-legend span { display: inline-flex; align-items: center; gap: 6px; }
.cal-legend i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }

/* ── Tables (payments, metrics) ────────────────────────── */
.tbl { width: 100%; border-collapse: collapse; font-size: 15px; }
.tbl th {
  text-align: start; font-size: var(--fs-12); font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted);
  padding: 10px 12px; border-bottom: 1px solid var(--border-strong);
}
.tbl td { padding: 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: none; }
.tbl .num { font-variant-numeric: tabular-nums; font-weight: 600; }
.tbl-wrap { overflow-x: auto; }

.toggle {
  position: relative;
  width: 46px; height: 26px;
  border-radius: 999px;
  background: var(--surface-3);
  border: 1px solid var(--border-strong);
  cursor: pointer;
  transition: background 0.2s;
  flex: 0 0 auto;
}
.toggle::after {
  content: '';
  position: absolute; top: 2px; left: 2px;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--text-muted);
  transition: transform 0.2s, background 0.2s;
}
.toggle[aria-checked="true"] { background: rgba(111, 191, 143, 0.25); border-color: var(--st-done); }
.toggle[aria-checked="true"]::after { transform: translateX(20px); background: var(--st-done); }

/* ── Campaign cards ────────────────────────────────────── */
.camp {
  display: flex; flex-direction: column; gap: 10px;
}
.camp .top { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.camp h3 { font-size: var(--fs-18); }
.camp .offer { color: var(--text); font-size: 15px; }
.camp .notes { color: var(--text-muted); font-size: var(--fs-14); }
.camp .facts { display: flex; gap: 18px; flex-wrap: wrap; padding-top: 8px; border-top: 1px solid var(--border); }
.camp .fact { display: flex; flex-direction: column; gap: 1px; }
.camp .fact b { font-size: var(--fs-16); font-variant-numeric: tabular-nums; }
.camp .fact span { font-size: var(--fs-12); color: var(--text-muted); }
.stepper { display: inline-flex; align-items: center; gap: 6px; }
.stepper button {
  width: 34px; height: 34px; border-radius: var(--r-sm);
  background: var(--surface-2); border: 1px solid var(--border-strong);
  cursor: pointer; font-weight: 700; font-size: 16px;
}
.stepper button:hover { border-color: var(--accent); color: var(--accent); }
.stepper b { min-width: 34px; text-align: center; font-variant-numeric: tabular-nums; }

/* ── Assets ────────────────────────────────────────────── */
.asset-row { display: flex; align-items: center; gap: 14px; padding: 13px 0; border-top: 1px solid var(--border); }
.asset-row:first-of-type { border-top: none; }
.asset-row .grow { flex: 1; min-width: 0; }
.asset-row .who { font-size: var(--fs-12); color: var(--st-waiting); }
.asset-row .when { font-size: var(--fs-12); color: var(--text-muted); }
.asset-row.got .grow > div:first-child { color: var(--text-muted); text-decoration: line-through; }

/* ── Activity log ──────────────────────────────────────── */
.log-item { display: flex; gap: 14px; padding: 12px 0; border-top: 1px solid var(--border); }
.log-item:first-of-type { border-top: none; }
.log-item .dot { width: 9px; height: 9px; border-radius: 50%; margin-top: 7px; flex: 0 0 auto; }
.log-item .dot.auto { background: var(--text-muted); }
.log-item .dot.manual { background: var(--accent); }
.log-item .ts { font-size: var(--fs-12); color: var(--text-muted); margin-top: 2px; }
.filter-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.filter-row select, .filter-row input {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r-sm); padding: 9px 12px; min-height: 44px;
}

/* ── Modal & forms ─────────────────────────────────────── */
dialog {
  margin: auto;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-lg);
  padding: 24px;
  width: min(480px, calc(100vw - 32px));
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.5);
}
dialog::backdrop { background: rgba(5, 12, 10, 0.65); backdrop-filter: blur(2px); }
dialog h2 { font-size: var(--fs-24); margin-bottom: 18px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: var(--fs-14); font-weight: 500; color: var(--text-muted); margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  padding: 10px 12px;
  min-height: 44px;
}
.field textarea { min-height: 84px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; flex-wrap: wrap; }
.form-actions .btn.danger { margin-right: auto; }

/* ── Toast ─────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 22px; left: 50%;
  transform: translate(-50%, 80px);
  background: var(--surface-3);
  border: 1px solid var(--border-strong);
  color: var(--text);
  border-radius: var(--r-md);
  padding: 12px 18px;
  font-size: var(--fs-14);
  opacity: 0;
  transition: transform 0.25s ease-out, opacity 0.25s ease-out;
  z-index: 60;
  pointer-events: none;
  max-width: calc(100vw - 32px);
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.toast.error { border-color: var(--danger); color: var(--danger); }

.loading { color: var(--text-muted); padding: 40px 0; }
.empty { color: var(--text-muted); font-size: var(--fs-14); padding: 14px 0; }

/* ── Mobile ────────────────────────────────────────────── */
@media (max-width: 860px) {
  .main { padding: 70px 16px 60px; }

  .menu-btn {
    display: grid; place-items: center;
    position: fixed; top: 12px; left: 12px; z-index: 45;
    width: 44px; height: 44px;
    background: var(--surface-2);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-md);
    color: var(--text);
    cursor: pointer;
  }
  .menu-btn svg { width: 20px; height: 20px; }

  .sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 50;
    transform: translateX(-105%);
    transition: transform 0.25s ease-out;
    background: var(--surface);
    width: min(300px, 84vw);
    box-shadow: 30px 0 60px rgba(0, 0, 0, 0.4);
  }
  .sidebar.open { transform: none; }

  .scrim {
    display: block;
    position: fixed; inset: 0; z-index: 48;
    background: rgba(5, 12, 10, 0.6);
    opacity: 0; pointer-events: none;
    transition: opacity 0.25s;
  }
  .scrim.show { opacity: 1; pointer-events: auto; }

  .view-head h1 { font-size: var(--fs-24); }
  .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; }

  .board { grid-template-columns: repeat(5, 84vw); }

  .cal-grid { gap: 3px; }
  .cal-day { min-height: 64px; padding: 4px; border-radius: 8px; }
  .pill { font-size: 0; padding: 0; height: 8px; border-radius: 4px; border-inline-start-width: 0; }
  .pill.planned { background: var(--st-planned); }
  .pill.drafted { background: var(--st-progress); }
  .pill.approved { background: #9FC5B8; }
  .pill.posted { background: var(--st-done); }
  .cal-nav h2 { min-width: 0; font-size: var(--fs-18); }
}

@media (min-width: 861px) and (max-width: 1180px) {
  .grid.cols-4 { grid-template-columns: repeat(2, 1fr); }
  .grid.cols-3 { grid-template-columns: repeat(2, 1fr); }
}
