/* ── Design tokens ──────────────────────────────────────────────────────────── */
:root {
  --bg: #ffffff;
  --panel: #f6f6f6;
  --panel-2: #eeeeee;
  --text: #0d0d0d;
  --muted: #6a6a6a;
  --accent: #111111;
  --accent2: #2d2d2d;
  --border: #e2e2e2;
  --shadow: 0 1px 8px rgba(0,0,0,.06);
}

/* ── Dark mode ──────────────────────────────────────────────────────────────── */
body.dark-mode {
  --bg: #0a0a0a;
  --panel: #111111;
  --panel-2: #171717;
  --text: #f2ede6;
  --muted: #b0a89f;
  --accent: #c9a85c;
  --accent2: #a07c38;
  --border: #242424;
  --shadow: 0 2px 16px rgba(0,0,0,.28);
}

/* ── Reset ──────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  font-size: 13px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { display: block; max-width: 100%; }
button, input, textarea, select { font: inherit; }

/* ── Layout ─────────────────────────────────────────────────────────────────── */
.container { max-width: 1340px; margin: 0 auto; padding: 16px 20px; }

/* ── Site Header ────────────────────────────────────────────────────────────── */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: #0d0d0d;
  border-bottom: 1px solid rgba(255,255,255,.07);
}
body.dark-mode .site-header { background: #050505; }
.site-header__inner {
  display: flex; align-items: center; justify-content: space-between;
  max-width: 1340px; margin: 0 auto; padding: 0 28px; height: 64px;
}

/* Logo */
.site-logo { display: inline-flex; align-items: center; flex-shrink: 0; }
.site-logo__img { height: 36px; width: auto; display: block; }
.site-logo__dark { display: none; }
body.dark-mode .site-logo__light { display: none; }
body.dark-mode .site-logo__dark { display: block; }
.site-logo:hover { opacity: .85; text-decoration: none; }

/* Header right actions */
.site-header__actions { display: flex; align-items: center; gap: 6px; }

/* Notification icon link */
.site-header__icon-link {
  position: relative; display: flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 8px; color: rgba(255,255,255,.75);
  border: 1px solid rgba(255,255,255,.10); background: transparent; cursor: pointer;
  transition: background .15s, color .15s;
}
.site-header__icon-link:hover { background: rgba(255,255,255,.08); color: #fff; text-decoration: none; }
.site-header__badge {
  position: absolute; top: 4px; right: 4px;
  background: #dc2626; color: #fff; border-radius: 999px;
  font-size: 9px; font-weight: 700; padding: 1px 4px; min-width: 14px; text-align: center;
  line-height: 1.4;
}

/* Icon button (dark mode toggle) */
.site-header__icon-btn {
  display: flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 8px;
  border: 1px solid rgba(255,255,255,.10); background: transparent;
  color: rgba(255,255,255,.75); cursor: pointer; transition: background .15s, color .15s;
}
.site-header__icon-btn:hover { background: rgba(255,255,255,.08); color: #fff; }

/* Sign In button (unauthenticated) */
.site-header__signin {
  display: inline-flex; align-items: center;
  padding: 8px 20px; border-radius: 6px;
  background: #fff; color: #0d0d0d;
  font-size: 13px; font-weight: 600; letter-spacing: .01em;
  border: 1px solid rgba(255,255,255,.9);
  transition: background .15s, color .15s;
  white-space: nowrap; margin-left: 4px;
}
.site-header__signin:hover { background: rgba(255,255,255,.88); text-decoration: none; color: #0d0d0d; }

/* Burger button */
.burger-btn {
  display: flex; flex-direction: column; justify-content: center; align-items: center;
  gap: 5px; width: 42px; height: 42px; padding: 0;
  border: 1px solid rgba(255,255,255,.12); border-radius: 8px;
  background: transparent; cursor: pointer;
  transition: background .15s;
}
.burger-btn:hover { background: rgba(255,255,255,.08); }
.burger-btn__line {
  display: block; width: 18px; height: 1.5px;
  background: rgba(255,255,255,.85); border-radius: 2px;
  transition: transform .25s, opacity .25s;
}
.burger-btn.is-open .burger-btn__line:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
.burger-btn.is-open .burger-btn__line:nth-child(2) { opacity: 0; }
.burger-btn.is-open .burger-btn__line:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

/* ── Full-screen Nav Overlay ─────────────────────────────────────────────────── */
.nav-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: #0d0d0d;
  display: flex; flex-direction: column;
  opacity: 0; pointer-events: none;
  transition: opacity .3s ease;
}
.nav-overlay.is-open { opacity: 1; pointer-events: auto; }

.nav-overlay__close {
  position: absolute; top: 16px; right: 24px;
  display: flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: 8px;
  border: 1px solid rgba(255,255,255,.12); background: transparent;
  color: rgba(255,255,255,.75); cursor: pointer;
  transition: background .15s, color .15s;
}
.nav-overlay__close:hover { background: rgba(255,255,255,.1); color: #fff; }

.nav-overlay__body {
  display: grid; grid-template-columns: 320px 1fr; gap: 0;
  height: 100%; padding: 80px 60px 60px;
}
.nav-overlay__info {
  display: flex; flex-direction: column; gap: 32px;
  padding-right: 60px; border-right: 1px solid rgba(255,255,255,.08);
  color: rgba(255,255,255,.55);
}
.nav-overlay__label {
  font-size: 10px; font-weight: 700; letter-spacing: .14em;
  text-transform: uppercase; color: rgba(255,255,255,.35);
}
.nav-overlay__firm { font-size: 14px; font-weight: 600; color: rgba(255,255,255,.9); line-height: 1.4; }
.nav-overlay__detail { font-size: 13px; line-height: 1.6; }
.nav-overlay__user { margin-top: auto; padding-top: 32px; border-top: 1px solid rgba(255,255,255,.08); color: rgba(255,255,255,.8); }

.nav-overlay__links {
  display: flex; flex-direction: column; justify-content: center;
  padding-left: 80px; gap: 4px;
}
.nav-overlay__link {
  display: block; font-size: clamp(24px, 3.5vw, 44px);
  font-weight: 300; letter-spacing: -.02em; line-height: 1.2;
  color: rgba(255,255,255,.45); padding: 8px 0;
  transition: color .15s;
}
.nav-overlay__link:hover,
.nav-overlay__link.is-active { color: #fff; text-decoration: none; }
.nav-overlay__link--logout {
  font-size: 13px; font-weight: 500; letter-spacing: .01em;
  color: rgba(255,255,255,.35); margin-top: 24px; padding-top: 24px;
  border-top: 1px solid rgba(255,255,255,.08);
}
.nav-overlay__link--logout:hover { color: rgba(255,255,255,.7); }

/* Overlay mobile */
@media(max-width:720px) {
  .nav-overlay__body { grid-template-columns: 1fr; padding: 72px 28px 40px; }
  .nav-overlay__info { display: none; }
  .nav-overlay__links { padding-left: 0; justify-content: flex-start; padding-top: 8px; }
  .nav-overlay__link { font-size: clamp(22px, 7vw, 36px); }
}

/* ── Responsive header ───────────────────────────────────────────────────────── */
@media(max-width:600px) {
  .site-header__inner { padding: 0 16px; height: 56px; }
  .site-logo__img { height: 28px; }
}
.toolbar .input { max-width: 100%; }

/* ── Grid ───────────────────────────────────────────────────────────────────── */
.grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 12px; }
.col-2 { grid-column: span 2; }
.col-3 { grid-column: span 3; }
.col-4 { grid-column: span 4; }
.col-6 { grid-column: span 6; }
.col-12 { grid-column: span 12; }
.grid4 { display: grid; grid-template-columns: repeat(4,1fr); gap: 12px; }
@media(max-width:860px) {
  .col-2,.col-3,.col-4,.col-6 { grid-column: span 12; }
  .grid4 { grid-template-columns: repeat(2,1fr); }
}
@media(max-width:540px) {
  .grid4 { grid-template-columns: 1fr; }
}

/* ── Card ───────────────────────────────────────────────────────────────────── */
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px;
  margin: 10px 0;
  box-shadow: var(--shadow);
}

/* ── Typography ─────────────────────────────────────────────────────────────── */
.h1 { font-size: 20px; font-weight: 700; letter-spacing: -.02em; margin: 0 0 8px; }
.small { font-size: 12px; color: var(--muted); }
.big { font-size: 26px; font-weight: 800; letter-spacing: -.02em; margin-top: 4px; color: var(--text); }

/* ── Toolbar ─────────────────────────────────────────────────────────────────── */
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
.toolbar .input { max-width: 260px; }

/* ── Table ──────────────────────────────────────────────────────────────────── */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { border-bottom: 1px solid var(--border); padding: 8px 10px; text-align: left; font-size: 13px; }
.table th { color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.table tbody tr:hover { background: var(--panel); }

/* ── Badge ──────────────────────────────────────────────────────────────────── */
.badge {
  display: inline-block; padding: 2px 7px; border-radius: 999px;
  border: 1px solid var(--border); font-size: 11px; color: var(--muted);
}

/* ── Buttons ────────────────────────────────────────────────────────────────── */
.btn {
  display: inline-block; padding: 7px 12px;
  border-radius: 7px; border: 1px solid var(--border);
  background: var(--panel); color: var(--text);
  cursor: pointer; font-size: 13px; font-weight: 500; white-space: nowrap;
}
.btn:hover { background: var(--panel-2); text-decoration: none; color: var(--text); }
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { background: var(--accent2); border-color: var(--accent2); color: #fff; }
.btn-danger { background: #b91c1c; color: #fff; border-color: #991b1b; }
.btn-danger:hover { background: #991b1b; border-color: #7f1d1d; color: #fff; }

/* ── Inputs ─────────────────────────────────────────────────────────────────── */
.input {
  width: 100%; padding: 7px 11px;
  border-radius: 7px; border: 1px solid var(--border);
  background: var(--bg); color: var(--text); font-size: 13px;
  transition: border-color .15s;
}
.input:focus { outline: none; border-color: var(--accent); }
textarea.input { resize: vertical; min-height: 100px; }
.label { display: block; margin: 0 0 4px; color: var(--muted); font-size: 12px; font-weight: 500; }

/* ── Alert ──────────────────────────────────────────────────────────────────── */
.alert {
  border: 1px solid var(--border); border-left: 3px solid var(--accent);
  background: var(--panel); padding: 9px 12px;
  border-radius: 8px; margin: 8px 0; font-size: 13px;
}
.alert.error { border-left-color: #dc2626; }
.alert.success { border-left-color: #16a34a; }

/* ── Footer ─────────────────────────────────────────────────────────────────── */
.footer { padding: 18px 0; color: var(--muted); font-size: 12px; border-top: 1px solid var(--border); margin-top: 24px; }

/* ── CMS / sidebar layout ───────────────────────────────────────────────────── */
.cms-shell { display: grid; grid-template-columns: 240px minmax(0,1fr); gap: 18px; align-items: start; }
.cms-sidebar { position: sticky; top: 58px; }
.cms-sidebar__title { font-size: 18px; font-weight: 700; letter-spacing: -.02em; margin-bottom: 4px; }
.cms-sidebar__nav { display: grid; gap: 3px; margin-top: 12px; }
.cms-sidebar__nav a {
  display: block; padding: 7px 11px; border: 1px solid var(--border);
  border-radius: 7px; color: var(--text); background: var(--bg); font-size: 13px;
}
.cms-sidebar__nav a:hover { background: var(--accent); color: #fff; border-color: var(--accent); text-decoration: none; }
.cms-main { display: grid; gap: 14px; }
.cms-main .col-2,.cms-main .col-3,.cms-main .col-4 { grid-column: span 6; }
.cms-main .col-6 { grid-column: span 6; }
.cms-main .col-12 { grid-column: span 12; }
.cms-card__head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-end; margin-bottom: 12px; flex-wrap: wrap; }
.cms-disclosure { border: 1px solid var(--border); border-radius: 10px; background: var(--panel); margin-top: 10px; overflow: hidden; }
.cms-disclosure summary { list-style: none; cursor: pointer; padding: 13px 15px; display: flex; justify-content: space-between; gap: 10px; align-items: center; font-weight: 600; font-size: 13px; }
.cms-disclosure summary::-webkit-details-marker { display: none; }
.cms-disclosure[open] summary { border-bottom: 1px solid var(--border); }
.cms-form-block { padding: 14px; }
.cms-form-block .input, .cms-form-block textarea { min-height: 34px; }
.cms-form-block textarea { min-height: 110px; }
.cms-grid-tight { gap: 10px; }
.cms-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.cms-delete-form { padding: 0 14px 14px; }
.cms-card .small { max-width: 580px; }
@media(max-width:980px) {
  .cms-shell { grid-template-columns: 1fr; }
  .cms-sidebar { position: static; }
  .cms-main .col-2,.cms-main .col-3,.cms-main .col-4,.cms-main .col-6 { grid-column: span 12; }
}

/* ── Kanban board ───────────────────────────────────────────────────────────── */
.kanban-col { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 12px; min-height: 280px; }
.kanban-card { background: var(--bg); border: 1px solid var(--border); border-radius: 7px; padding: 9px 11px; margin: 5px 0; font-size: 13px; cursor: grab; }
.kanban-card:active { cursor: grabbing; }

/* ── Rich text editor ───────────────────────────────────────────────────────── */
.rte-toolbar { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 5px; }
.rte-toolbar button { padding: 4px 8px; border: 1px solid var(--border); background: var(--panel); color: var(--text); border-radius: 6px; cursor: pointer; font-size: 12px; }
.rte-editor { min-height: 110px; overflow-y: auto; resize: vertical; white-space: pre-wrap; line-height: 1.5; }

/* ── Dark mode component overrides ─────────────────────────────────────────── */
body.dark-mode .brand-link { border-color: rgba(255,255,255,.08); }
body.dark-mode .menu a:hover { background: #1a1a1a; }
body.dark-mode .card { background: var(--panel); }
body.dark-mode .input { background: #0d0d0d; border-color: var(--border); }
body.dark-mode .btn { background: #181818; border-color: var(--border); color: var(--text); }
body.dark-mode .btn:hover { background: #222222; }
body.dark-mode .btn-primary { background: var(--accent); border-color: var(--accent); color: #0a0a0a; }
body.dark-mode .btn-primary:hover { background: var(--accent2); border-color: var(--accent2); color: #0a0a0a; }
body.dark-mode .cms-sidebar__nav a { background: #0d0d0d; border-color: var(--border); }
body.dark-mode .rte-toolbar button { background: #181818; border-color: var(--border); }
body.dark-mode .kanban-card { background: #0d0d0d; }
body.dark-mode .table tbody tr:hover { background: #151515; }

/* ── Login / auth page ──────────────────────────────────────────────────────── */
.auth-wrap { min-height: 100vh; display: flex; }
.auth-brand {
  width: 400px; flex-shrink: 0; background: #0d0d0d; color: #f2ede6;
  display: flex; flex-direction: column; justify-content: flex-end;
  padding: 48px; gap: 16px; position: relative;
}
.auth-brand__logo { position: absolute; top: 40px; left: 48px; }
.auth-brand__logo img { height: 32px; width: auto; }
.auth-brand .brand-mark { font-size: 10px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: rgba(255,255,255,.35); margin-bottom: 10px; }
.auth-brand .brand-name { font-size: 28px; font-weight: 300; letter-spacing: -.02em; line-height: 1.2; color: #f2ede6; }
.auth-brand .brand-tagline { font-size: 13px; color: rgba(255,255,255,.45); margin-top: 6px; }
.auth-panel { flex: 1; display: flex; align-items: center; justify-content: center; padding: 40px 24px; background: var(--bg); }
.auth-form { width: 100%; max-width: 380px; }
.auth-form .h1 { font-size: 22px; font-weight: 600; margin-bottom: 4px; letter-spacing: -.01em; }
.auth-form .small { margin-bottom: 20px; }
@media(max-width:680px) { .auth-brand { display: none; } .auth-panel { padding: 28px 16px; } }

/* ── Workspace-lite (kept as compatibility stub) ────────────────────────────── */
.workspace-lite .container { max-width: 1340px; }

/* ── Utility spacing ────────────────────────────────────────────────────────── */
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
