/* ═══════════════════════════════════════════════════════════
   PolicyVault — style.css  (Coleebri Brand)
   ═══════════════════════════════════════════════════════════ */

/* ── Variables ─────────────────────────────────────────────── */
:root {
  /* Brand palette */
  --brand:        #00889a;
  --brand-2:      #33a0ae;
  --brand-3:      #66b8c2;
  --brand-4:      #99cfd7;
  --brand-5:      #cce7eb;
  --brand-6:      #e6f3f5;
  --brand-dark:   #006d7b;
  --brand-darker: #00525c;

  /* Accent */
  --green:  #7fbf60;
  --yellow: #f5c518;
  --red:    #f28d85;
  --blue:   #9ab6e0;
  --renew:  #cddc39;

  /* Light mode */
  --bg:     #ffffff;
  --bg-2:   #fafafa;
  --bg-3:   #f4f4f5;
  --border: #e4e4e7;
  --text-1: #09090b;
  --text-2: #52525b;
  --text-3: #a1a1aa;

  /* Component */
  --sidebar-bg: #00525c;
  --sidebar-text: rgba(255,255,255,.82);
  --sidebar-muted: rgba(255,255,255,.44);
  --sidebar-active-bg: rgba(255,255,255,.14);
  --sidebar-hover-bg: rgba(255,255,255,.08);
  --sidebar-border: rgba(255,255,255,.10);

  --r:  8px;
  --rs: 6px;
  --rx: 4px;

  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  --shadow-sm: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md: 0 4px 16px rgba(0,0,0,.08);
  --shadow-lg: 0 8px 30px rgba(0,0,0,.12);

  --tw: 240px;
  --topbar-h: 56px;
}
html.dark {
  --bg:     #0a0f10;
  --bg-2:   #111718;
  --bg-3:   #192022;
  --border: #1e2d30;
  --text-1: #f0fafb;
  --text-2: #8fb8be;
  --text-3: #4d7d85;
  --sidebar-bg: #071113;
  --sidebar-border: rgba(255,255,255,.07);
  --shadow-sm: 0 1px 3px rgba(0,0,0,.3);
  --shadow-md: 0 4px 16px rgba(0,0,0,.4);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text-1);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ── Login page ────────────────────────────────────────────── */
#login-page {
  display: flex;
  min-height: 100vh;
  background: var(--bg);
}
.login-card {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: 420px;
  min-height: 100vh;
  padding: 48px 48px;
  background: var(--bg);
  border-right: 1px solid var(--border);
}
.login-bg {
  flex: 1;
  background: var(--brand-darker);
  position: relative;
  overflow: hidden;
}
.login-bg-pattern {
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 30% 40%, rgba(0,136,154,.3) 0%, transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(0,82,92,.5) 0%, transparent 50%);
}
.login-brand { margin-bottom: 40px; }
.login-logo {
  height: 44px;
  object-fit: contain;
}
html.dark .login-logo { filter: brightness(0) invert(1) opacity(.9); }
.login-title { margin-bottom: 32px; }
.login-title h1 { font-size: 24px; font-weight: 700; color: var(--text-1); margin-bottom: 4px; }
.login-title p { font-size: 14px; color: var(--text-2); }
.login-field { margin-bottom: 16px; }
.login-field label { display: block; font-size: 13px; font-weight: 500; color: var(--text-2); margin-bottom: 6px; }
.login-input-wrap { position: relative; }
.login-input-wrap i {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--text-3); font-size: 14px; pointer-events: none;
}
.login-input-wrap input {
  width: 100%; padding: 10px 12px 10px 36px;
  border: 1px solid var(--border); border-radius: var(--r);
  background: var(--bg-2); color: var(--text-1);
  font-size: 14px; font-family: var(--font);
  transition: border-color .15s, box-shadow .15s; outline: none;
}
.login-input-wrap input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(0,136,154,.12);
}
.login-error {
  background: rgba(242,141,133,.1); border: 1px solid rgba(242,141,133,.3);
  color: #c0392b; padding: 9px 12px; border-radius: var(--rs);
  font-size: 13px; margin-bottom: 12px;
}
.login-btn {
  width: 100%; padding: 11px 16px;
  background: var(--brand); color: #fff;
  border: none; border-radius: var(--r);
  font-size: 14px; font-weight: 600; font-family: var(--font);
  cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: background .15s, transform .1s;
}
.login-btn:hover { background: var(--brand-dark); }
.login-btn:active { transform: scale(.99); }
.login-btn:disabled { opacity: .6; cursor: default; }
.login-footer { margin-top: 32px; font-size: 12px; color: var(--text-3); text-align: center; }

/* ── Layout ────────────────────────────────────────────────── */
#app { display: flex; height: 100vh; overflow: hidden; }

/* ── Sidebar ───────────────────────────────────────────────── */
#sidebar {
  width: var(--tw);
  flex-shrink: 0;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  transition: transform .25s ease;
  z-index: 100;
}
.sb-top { flex: 1; padding: 0 0 8px; }
.sb-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 16px 14px;
  border-bottom: 1px solid var(--sidebar-border);
  margin-bottom: 8px;
}
.sb-logo {
  width: 34px; height: 34px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  background: rgba(255,255,255,.12);
  flex-shrink: 0;
}
.sb-logo-img { width: 26px; height: 26px; object-fit: contain; }
.sb-brand-text { display: flex; flex-direction: column; min-width: 0; }
.sb-brand-name { font-size: 14px; font-weight: 700; color: #fff; line-height: 1.2; }
.sb-brand-sub { font-size: 11px; color: var(--sidebar-muted); }

.sb-nav { padding: 0 8px; }
.sb-label {
  font-size: 10px; font-weight: 600; letter-spacing: .08em;
  text-transform: uppercase; color: var(--sidebar-muted);
  padding: 14px 8px 4px; user-select: none;
}
.sb-item {
  display: flex; align-items: center; gap: 9px;
  width: 100%; padding: 7px 9px;
  border: none; background: none;
  color: var(--sidebar-text);
  font-size: 13.5px; font-weight: 500; font-family: var(--font);
  border-radius: var(--rs); cursor: pointer;
  transition: background .13s, color .13s;
  text-align: left;
}
.sb-item i { font-size: 14px; width: 16px; text-align: center; flex-shrink: 0; }
.sb-item span:first-of-type { flex: 1; }
.sb-item:hover { background: var(--sidebar-hover-bg); color: #fff; }
.sb-item.active { background: var(--sidebar-active-bg); color: #fff; }
.sb-item.active i { color: var(--brand-4); }
.sb-count {
  font-size: 11px; font-weight: 600;
  background: rgba(255,255,255,.12); color: rgba(255,255,255,.7);
  padding: 1px 6px; border-radius: 10px;
}

.sb-bottom {
  padding: 8px; border-top: 1px solid var(--sidebar-border);
  display: flex; flex-direction: column; gap: 4px;
}
.sb-action {
  background: var(--brand) !important;
  color: #fff !important;
  font-weight: 600 !important;
  border-radius: var(--rs) !important;
  justify-content: flex-start !important;
}
.sb-action:hover { background: var(--brand-dark) !important; }

.sb-user-row {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px;
}
.sb-user-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--brand); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; flex-shrink: 0;
}
.sb-user-info { flex: 1; min-width: 0; }
.sb-user-name { display: block; font-size: 12px; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-user-role { display: block; font-size: 10px; color: var(--sidebar-muted); text-transform: capitalize; }
.sb-logout {
  background: none; border: none; cursor: pointer;
  color: var(--sidebar-muted); font-size: 14px; padding: 4px;
  border-radius: 4px; transition: color .13s;
}
.sb-logout:hover { color: var(--red); }

.sb-theme-toggle {
  background: none; border: none; cursor: pointer;
  color: var(--sidebar-muted); font-size: 14px;
  padding: 6px 9px; border-radius: var(--rs);
  transition: color .13s, background .13s;
  align-self: flex-start;
}
.sb-theme-toggle:hover { color: #fff; background: var(--sidebar-hover-bg); }
.sb-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 99;
}

/* ── Main ──────────────────────────────────────────────────── */
#main { flex: 1; overflow-y: auto; display: flex; flex-direction: column; }
.view { flex: 1; }
.wrap { max-width: 1100px; margin: 0 auto; padding: 32px 28px; }
@media(max-width:768px){ .wrap { padding: 20px 16px; } }

/* ── Topbar (mobile) ───────────────────────────────────────── */
.topbar {
  display: none; align-items: center; gap: 10px;
  height: var(--topbar-h); padding: 0 16px;
  background: var(--sidebar-bg);
  border-bottom: 1px solid var(--sidebar-border);
  position: sticky; top: 0; z-index: 90;
}
.topbar-menu, .topbar-action {
  background: rgba(255,255,255,.1); border: none; cursor: pointer;
  width: 36px; height: 36px; border-radius: var(--rs);
  color: #fff; font-size: 16px;
  display: flex; align-items: center; justify-content: center;
}
.topbar-brand { flex: 1; text-align: center; font-size: 15px; font-weight: 700; color: #fff; }

/* ── Page header ───────────────────────────────────────────── */
.pg-hdr {
  display: flex; align-items: flex-start; gap: 16px;
  margin-bottom: 24px; flex-wrap: wrap;
}
.pg-hdr-left { flex: 1; }
.pg-hdr-left h1 { font-size: 22px; font-weight: 700; color: var(--text-1); }
.pg-hdr-left p { font-size: 13px; color: var(--text-2); margin-top: 2px; }
.pg-hdr-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 16px; border-radius: var(--r);
  font-size: 13.5px; font-weight: 600; font-family: var(--font);
  border: 1px solid transparent; cursor: pointer;
  transition: all .15s; white-space: nowrap;
}
.btn-primary { background: var(--brand); color: #fff; border-color: var(--brand); }
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn-secondary {
  background: var(--bg); color: var(--text-1);
  border-color: var(--border);
}
.btn-secondary:hover { background: var(--bg-3); border-color: var(--brand-4); }
.btn-ghost { background: none; color: var(--text-2); border-color: transparent; }
.btn-ghost:hover { background: var(--bg-3); color: var(--text-1); }
.btn-danger { background: rgba(242,141,133,.12); color: #c0392b; border-color: rgba(242,141,133,.3); }
.btn-danger:hover { background: rgba(242,141,133,.2); }
.btn-sm { padding: 6px 12px; font-size: 12.5px; }
.btn:disabled { opacity: .5; cursor: default; }

.icon-btn {
  background: none; border: none; cursor: pointer;
  color: var(--text-3); font-size: 14px; padding: 5px;
  border-radius: var(--rx); transition: color .13s, background .13s;
  display: inline-flex; align-items: center; justify-content: center;
}
.icon-btn:hover { color: var(--text-1); background: var(--bg-3); }
.icon-btn.danger:hover { color: var(--red); background: rgba(242,141,133,.1); }

/* ── Stat cards ────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 16px;
  display: flex; align-items: center; gap: 12px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .15s, border-color .15s;
}
.stat-card:hover { box-shadow: var(--shadow-md); border-color: var(--brand-4); }
.stat-icon {
  width: 38px; height: 38px; border-radius: var(--rs);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; flex-shrink: 0;
}
.stat-icon.neutral { background: var(--brand-6); color: var(--brand); }
.stat-icon.green   { background: rgba(127,191,96,.12); color: var(--green); }
.stat-icon.amber   { background: rgba(245,197,24,.12); color: #d4ac0d; }
.stat-icon.red     { background: rgba(242,141,133,.12); color: var(--red); }
.stat-icon.blue    { background: rgba(154,182,224,.12); color: var(--blue); }
.stat-icon.purple  { background: rgba(0,136,154,.1); color: var(--brand); }
.stat-icon.teal    { background: var(--brand-6); color: var(--brand); }
.stat-val { font-size: 22px; font-weight: 800; color: var(--text-1); line-height: 1; }
.stat-lbl { font-size: 11.5px; color: var(--text-2); margin-top: 3px; }

/* ── Section breakdown ─────────────────────────────────────── */
.section-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
  margin-bottom: 28px;
}
.section-card {
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--r); padding: 14px 16px;
  cursor: pointer; transition: all .15s;
}
.section-card:hover { border-color: var(--brand); background: var(--brand-6); }
.section-card-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.section-card-name { font-size: 13px; font-weight: 600; color: var(--text-1); }
.section-card-cnt { font-size: 20px; font-weight: 800; color: var(--brand); }
.section-bar { height: 4px; background: var(--bg-3); border-radius: 2px; overflow: hidden; }
.section-bar-fill { height: 100%; background: var(--brand); border-radius: 2px; transition: width .6s ease; }

/* ── Review alert banner on dashboard ─────────────────────── */
.review-alert {
  background: linear-gradient(135deg, var(--brand-6) 0%, #fff 100%);
  border: 1px solid var(--brand-5);
  border-left: 4px solid var(--brand);
  border-radius: var(--r);
  padding: 16px 20px;
  margin-bottom: 24px;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
}
html.dark .review-alert { background: linear-gradient(135deg, rgba(0,136,154,.12) 0%, var(--bg-2) 100%); }
.review-alert-icon { font-size: 24px; color: var(--brand); flex-shrink: 0; }
.review-alert-text { flex: 1; }
.review-alert-text strong { display: block; font-size: 14px; font-weight: 700; color: var(--text-1); }
.review-alert-text span { font-size: 13px; color: var(--text-2); }

/* Needs Review table */
.needs-review-list { margin-bottom: 28px; }
.nrl-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; border-radius: var(--rs);
  border: 1px solid var(--border); background: var(--bg);
  margin-bottom: 6px; transition: border-color .13s;
}
.nrl-item:hover { border-color: var(--brand-3); }
.nrl-item-name { flex: 1; font-size: 13px; font-weight: 600; color: var(--text-1); }
.nrl-item-section { font-size: 11px; color: var(--text-3); }
.nrl-item-date { font-size: 12px; font-weight: 600; white-space: nowrap; }
.nrl-item-date.overdue { color: var(--red); }
.nrl-item-date.soon { color: #d4ac0d; }
.nrl-view-btn { font-size: 12px; color: var(--brand); text-decoration: none; background: none; border: none; cursor: pointer; padding: 4px 8px; border-radius: var(--rx); transition: background .13s; }
.nrl-view-btn:hover { background: var(--brand-6); }

/* ── Recent review log mini table ──────────────────────────── */
.mini-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.mini-table th { font-size: 11px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .05em; padding: 6px 10px; border-bottom: 1px solid var(--border); text-align: left; }
.mini-table td { padding: 8px 10px; border-bottom: 1px solid var(--border); color: var(--text-2); }
.mini-table tr:last-child td { border-bottom: none; }

/* ── Toolbar / filters ─────────────────────────────────────── */
.toolbar {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 16px; flex-wrap: wrap;
}
.search-wrap {
  position: relative; flex: 1; min-width: 200px;
}
.search-wrap i {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  color: var(--text-3); font-size: 13px;
}
.search-wrap input {
  width: 100%; padding: 7px 10px 7px 30px;
  border: 1px solid var(--border); border-radius: var(--r);
  background: var(--bg); color: var(--text-1);
  font-size: 13px; font-family: var(--font); outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.search-wrap input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(0,136,154,.1); }

.filter-group { display: flex; gap: 8px; flex-wrap: wrap; }
.filter-group select {
  padding: 7px 28px 7px 10px;
  border: 1px solid var(--border); border-radius: var(--r);
  background: var(--bg); color: var(--text-1);
  font-size: 13px; font-family: var(--font); outline: none; cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%2371717a'%3E%3Cpath fill-rule='evenodd' d='M4.22 6.22a.75.75 0 011.06 0L8 8.94l2.72-2.72a.75.75 0 111.06 1.06l-3.25 3.25a.75.75 0 01-1.06 0L4.22 7.28a.75.75 0 010-1.06z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 16px;
  transition: border-color .15s;
}
.filter-group select:focus { border-color: var(--brand); }

/* ── Bulk bar ──────────────────────────────────────────────── */
.bulk-bar {
  display: none; align-items: center; gap: 10px;
  background: var(--brand-6); border: 1px solid var(--brand-5);
  border-radius: var(--r); padding: 8px 14px; margin-bottom: 12px;
  flex-wrap: wrap;
}
html.dark .bulk-bar { background: rgba(0,136,154,.12); border-color: rgba(0,136,154,.2); }
.bulk-bar.show { display: flex; }
.sel-cnt { font-size: 13px; font-weight: 600; color: var(--brand); flex: 1; }
.sep { width: 1px; height: 20px; background: var(--border); }

/* ── Table ─────────────────────────────────────────────────── */
.table-wrap { border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; background: var(--bg); }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead tr { background: var(--bg-2); }
th {
  padding: 10px 12px; text-align: left;
  font-size: 11.5px; font-weight: 600; color: var(--text-2);
  letter-spacing: .03em; text-transform: uppercase;
  border-bottom: 1px solid var(--border);
  white-space: nowrap; cursor: pointer; user-select: none;
}
th:hover { color: var(--text-1); }
th.sorted { color: var(--brand); }
td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg-2); }
.cb-col { width: 36px; }
td input[type="checkbox"], th input[type="checkbox"] { width: 14px; height: 14px; accent-color: var(--brand); cursor: pointer; }
.td-name button {
  background: none; border: none; cursor: pointer;
  color: var(--text-1); font-size: 13px; font-weight: 600;
  font-family: var(--font); text-align: left; padding: 0;
  transition: color .13s;
}
.td-name button:hover { color: var(--brand); }
.td-muted { color: var(--text-2); font-size: 12.5px; }
.td-actions { display: flex; align-items: center; gap: 4px; }
.sort-icon { margin-left: 4px; opacity: .5; font-size: 10px; }

/* ── Empty state ───────────────────────────────────────────── */
.empty {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: 60px 24px; gap: 10px; text-align: center;
}
.empty i { font-size: 32px; color: var(--brand-4); }
.empty h3 { font-size: 16px; font-weight: 600; color: var(--text-1); }
.empty p { font-size: 13px; color: var(--text-2); }

/* ── Badges ────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px; border-radius: 20px;
  font-size: 11.5px; font-weight: 600; white-space: nowrap;
}
.badge-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.badge-active   { background: rgba(127,191,96,.12); color: #3d7a25; border: 1px solid rgba(127,191,96,.25); }
.badge-draft    { background: rgba(154,182,224,.12); color: #3d5d8a; border: 1px solid rgba(154,182,224,.3); }
.badge-review   { background: rgba(245,197,24,.1);  color: #8a6c00; border: 1px solid rgba(245,197,24,.3); }
.badge-expired  { background: rgba(242,141,133,.12); color: #8a2e2e; border: 1px solid rgba(242,141,133,.3); }
.badge-archived { background: var(--bg-3); color: var(--text-3); border: 1px solid var(--border); }
.badge-section  { background: var(--brand-6); color: var(--brand-dark); border: 1px solid var(--brand-5); }
.badge-version  {
  background: var(--bg-3); color: var(--text-2); border: 1px solid var(--border);
  font-family: var(--font-mono); cursor: pointer;
  transition: border-color .13s, color .13s;
}
.badge-version:hover { border-color: var(--brand); color: var(--brand); }

/* ── Editor ────────────────────────────────────────────────── */
.ed-topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 20px;
  background: var(--bg); border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.ed-back {
  background: none; border: 1px solid var(--border); cursor: pointer;
  color: var(--text-2); font-size: 13px; font-family: var(--font);
  padding: 6px 12px; border-radius: var(--r); display: flex; align-items: center; gap: 6px;
  transition: all .13s;
}
.ed-back:hover { border-color: var(--brand); color: var(--brand); }
.ed-title-input {
  flex: 1; min-width: 200px; padding: 7px 10px;
  border: 1px solid transparent; border-radius: var(--r);
  background: var(--bg-2); color: var(--text-1);
  font-size: 15px; font-weight: 700; font-family: var(--font); outline: none;
  transition: border-color .15s;
}
.ed-title-input:focus { border-color: var(--brand); background: var(--bg); }
.ed-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.ed-body-wrap { padding: 20px 24px; max-width: 960px; margin: 0 auto; }

/* Meta grid */
.meta-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 12px; margin-bottom: 16px;
}
.meta-field label { display: block; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); margin-bottom: 4px; }
.meta-field input, .meta-field select {
  width: 100%; padding: 7px 10px;
  border: 1px solid var(--border); border-radius: var(--rs);
  background: var(--bg); color: var(--text-1);
  font-size: 13px; font-family: var(--font); outline: none;
  transition: border-color .15s;
}
.meta-field input:focus, .meta-field select:focus { border-color: var(--brand); }

/* Props toggle */
.props-toggle {
  display: flex; align-items: center; gap: 8px;
  width: 100%; padding: 8px 10px;
  background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--rs);
  color: var(--text-2); font-size: 13px; font-weight: 500; font-family: var(--font);
  cursor: pointer; transition: all .13s; margin-bottom: 8px;
}
.props-toggle:hover { border-color: var(--brand); color: var(--brand); }
.props-toggle .chevron { margin-left: auto; transition: transform .2s; font-size: 11px; }
.props-toggle.open .chevron { transform: rotate(180deg); }
.ed-props { display: none; }
.ed-props.open { display: block; }
.ed-props-inner {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px; padding: 14px;
  background: var(--bg-2); border: 1px solid var(--border); border-top: none;
  border-radius: 0 0 var(--rs) var(--rs); margin-bottom: 14px;
}
.ed-props-inner .fw { grid-column: 1 / -1; }
.ed-props-inner label { display: block; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--text-3); margin-bottom: 4px; }
.ed-props-inner input, .ed-props-inner textarea {
  width: 100%; padding: 7px 10px;
  border: 1px solid var(--border); border-radius: var(--rs);
  background: var(--bg); color: var(--text-1);
  font-size: 13px; font-family: var(--font); outline: none; resize: vertical;
  transition: border-color .15s;
}
.ed-props-inner input:focus, .ed-props-inner textarea:focus { border-color: var(--brand); }

/* Editor tabs */
.ed-tabs {
  display: flex; gap: 2px;
  border-bottom: 1px solid var(--border); margin-bottom: 0;
}
.ed-tab {
  padding: 8px 14px; background: none; border: none; cursor: pointer;
  font-size: 13px; font-weight: 500; font-family: var(--font);
  color: var(--text-2); border-bottom: 2px solid transparent;
  display: flex; align-items: center; gap: 6px;
  transition: color .13s, border-color .13s;
  margin-bottom: -1px;
}
.ed-tab i { font-size: 12px; }
.ed-tab.active { color: var(--brand); border-bottom-color: var(--brand); }
.ed-tab:hover { color: var(--brand); }
.ed-content-area {
  border: 1px solid var(--border); border-top: none; border-radius: 0 0 var(--r) var(--r);
}
.ed-panel { display: none; }
.ed-panel.active { display: block; }

/* Markdown toolbar */
.md-toolbar {
  display: flex; gap: 2px; flex-wrap: wrap;
  padding: 8px 10px; background: var(--bg-2);
  border-bottom: 1px solid var(--border);
}
.fmt-btn {
  background: none; border: none; cursor: pointer;
  color: var(--text-2); font-size: 13px; padding: 4px 8px;
  border-radius: var(--rx); display: flex; align-items: center; justify-content: center;
  min-width: 28px; height: 26px; font-family: var(--font); font-weight: 600;
  transition: color .13s, background .13s;
}
.fmt-btn:hover { color: var(--brand); background: var(--brand-6); }
.fmt-btn .sep { width: 1px; height: 16px; background: var(--border); }
.md-toolbar .sep { width: 1px; height: 24px; background: var(--border); margin: 0 2px; align-self: center; }

/* Visual editor toolbar */
.visual-toolbar {
  display: flex; gap: 2px; flex-wrap: wrap;
  padding: 8px 10px; background: var(--bg-2);
  border-bottom: 1px solid var(--border);
}
.vfmt-btn {
  background: none; border: none; cursor: pointer;
  color: var(--text-2); font-size: 13px; padding: 4px 8px;
  border-radius: var(--rx);
  min-width: 28px; height: 26px; font-family: var(--font); font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center;
  transition: color .13s, background .13s;
}
.vfmt-btn:hover { color: var(--brand); background: var(--brand-6); }
.vfmt-btn.active { color: var(--brand); background: var(--brand-6); }
.visual-toolbar .sep { width: 1px; height: 24px; background: var(--border); margin: 0 2px; align-self: center; }

.ed-textarea {
  width: 100%; min-height: 480px; padding: 16px;
  border: none; outline: none; resize: none;
  background: var(--bg); color: var(--text-1);
  font-size: 14px; font-family: var(--font-mono); line-height: 1.7;
}
.ed-visual {
  width: 100%; min-height: 480px; padding: 20px 24px;
  outline: none;
  background: var(--bg); color: var(--text-1);
  font-size: 14.5px; font-family: var(--font); line-height: 1.75;
}
.ed-visual:focus { outline: none; }
.ed-visual h1 { font-size: 1.6em; margin: 1em 0 .5em; }
.ed-visual h2 { font-size: 1.3em; margin: 1em 0 .4em; }
.ed-visual h3 { font-size: 1.1em; margin: .8em 0 .3em; }
.ed-visual p  { margin-bottom: .8em; }
.ed-visual ul, .ed-visual ol { padding-left: 1.6em; margin-bottom: .8em; }
.ed-visual li { margin-bottom: .25em; }
.ed-visual strong { font-weight: 700; }
.ed-visual em { font-style: italic; }
.ed-visual a { color: var(--brand); }
.ed-visual blockquote { border-left: 3px solid var(--brand-4); padding-left: 12px; color: var(--text-2); }
.ed-visual table { border-collapse: collapse; width: 100%; margin-bottom: 1em; }
.ed-visual table th, .ed-visual table td { border: 1px solid var(--border); padding: 6px 10px; font-size: 13px; }
.ed-visual table th { background: var(--bg-2); font-weight: 600; }
.ed-visual hr { border: none; border-top: 2px solid var(--border); margin: 1.5em 0; }
.ed-visual code { background: var(--bg-3); padding: 2px 5px; border-radius: 3px; font-family: var(--font-mono); font-size: .9em; }
.ed-visual pre { background: var(--bg-3); padding: 12px; border-radius: var(--rs); overflow-x: auto; margin-bottom: 1em; }

/* ── Markdown preview / prose ──────────────────────────────── */
.prose { font-size: 14.5px; color: var(--text-1); line-height: 1.75; }
.prose h1 { font-size: 1.6em; margin: 1em 0 .5em; font-weight: 800; }
.prose h2 { font-size: 1.3em; margin: 1em 0 .4em; font-weight: 700; border-bottom: 1px solid var(--border); padding-bottom: 4px; }
.prose h3 { font-size: 1.1em; margin: .8em 0 .3em; font-weight: 600; }
.prose p  { margin-bottom: .8em; }
.prose ul, .prose ol { padding-left: 1.6em; margin-bottom: .8em; }
.prose li { margin-bottom: .25em; }
.prose strong { font-weight: 700; }
.prose em { font-style: italic; }
.prose a { color: var(--brand); text-decoration: underline; }
.prose blockquote { border-left: 3px solid var(--brand-4); padding-left: 12px; color: var(--text-2); }
.prose table { border-collapse: collapse; width: 100%; margin-bottom: 1em; }
.prose table th, .prose table td { border: 1px solid var(--border); padding: 6px 10px; font-size: 13px; }
.prose table th { background: var(--bg-2); font-weight: 600; }
.prose hr { border: none; border-top: 2px solid var(--border); margin: 1.5em 0; }
.prose code { background: var(--bg-3); padding: 2px 5px; border-radius: 3px; font-family: var(--font-mono); font-size: .9em; }
.prose pre { background: var(--bg-3); padding: 12px; border-radius: var(--rs); overflow-x: auto; margin-bottom: 1em; }

/* ── Document preview ──────────────────────────────────────── */
.doc-preview {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--r); overflow: hidden; font-size: 13px;
}
.doc-header-bar {
  background: var(--brand); color: #fff;
  padding: 12px 20px;
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 4px;
}
.doc-header-bar h3 { font-size: 14px; font-weight: 700; }
.doc-header-bar span { font-size: 11px; opacity: .8; }
.doc-meta-block { padding: 16px 20px; border-bottom: 1px solid var(--border); }
.doc-policy-title { font-size: 18px; font-weight: 800; color: var(--text-1); margin-bottom: 12px; }
.doc-meta-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.doc-meta-table td { padding: 5px 8px; border: 1px solid var(--border); vertical-align: top; }
.doc-meta-table td:first-child { font-weight: 600; color: var(--text-2); background: var(--bg-2); width: 160px; }
.doc-ver-table { width: 100%; border-collapse: collapse; font-size: 11px; }
.doc-ver-table th { background: var(--brand); color: #fff; padding: 4px 8px; }
.doc-ver-table td { border: 1px solid var(--border); padding: 4px 8px; }
.doc-content-area { padding: 20px; }
.doc-footer { padding: 10px 20px; background: var(--bg-2); border-top: 1px solid var(--border); font-size: 11px; color: var(--text-3); text-align: center; }

/* ── Version timeline ──────────────────────────────────────── */
.vt { display: flex; flex-direction: column; gap: 0; }
.vt-item {
  padding: 10px 12px; border-left: 2px solid var(--border);
  margin-left: 8px; position: relative;
}
.vt-item:first-child { border-color: var(--brand); }
.vt-item::before {
  content: ''; position: absolute; left: -5px; top: 14px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--border); border: 2px solid var(--bg);
}
.vt-item:first-child::before { background: var(--brand); }
.vt-ver { font-weight: 700; font-size: 13px; color: var(--text-1); margin-right: 8px; font-family: var(--font-mono); }
.vt-date { font-size: 12px; color: var(--text-3); }
.vt-author { font-size: 12px; color: var(--text-2); margin-top: 2px; }
.vt-changes { font-size: 12px; color: var(--text-2); margin-top: 2px; font-style: italic; }

/* ── Review log stats ──────────────────────────────────────── */
.review-stats {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px; margin-bottom: 20px;
}
.review-stat {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--r); padding: 14px 16px; text-align: center;
}
.rs-val { font-size: 28px; font-weight: 800; color: var(--brand); }
.rs-lbl { font-size: 12px; color: var(--text-2); margin-top: 2px; }

/* ── Modal ─────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; padding: 16px;
}
.modal-box {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 12px; width: 100%; max-width: 520px;
  max-height: 90vh; overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: slide-up .18s ease;
}
.modal-box.wide { max-width: 720px; }
@keyframes slide-up {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px 14px; border-bottom: 1px solid var(--border);
}
.modal-head h2 { font-size: 16px; font-weight: 700; }
.modal-body { padding: 18px 20px; }
.modal-foot {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 12px 20px; border-top: 1px solid var(--border);
  background: var(--bg-2);
}

/* Form fields inside modals */
.form-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}
.form-field { display: flex; flex-direction: column; gap: 4px; }
.form-field.fw { grid-column: 1 / -1; }
.form-field label { font-size: 12px; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: .04em; }
.form-field input, .form-field select, .form-field textarea {
  padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--rs);
  background: var(--bg); color: var(--text-1);
  font-size: 13px; font-family: var(--font); outline: none; resize: vertical;
  transition: border-color .15s, box-shadow .15s;
}
.form-field input:focus, .form-field select:focus, .form-field textarea:focus {
  border-color: var(--brand); box-shadow: 0 0 0 3px rgba(0,136,154,.08);
}

/* Confirm modal */
.confirm-body { text-align: center; padding: 32px 24px; }
.confirm-icon { font-size: 32px; margin-bottom: 12px; }
.confirm-body p { font-size: 15px; color: var(--text-1); margin-bottom: 20px; }
.confirm-actions { display: flex; gap: 10px; justify-content: center; }

/* ── Toast ─────────────────────────────────────────────────── */
#toasts {
  position: fixed; bottom: 20px; right: 20px; z-index: 9999;
  display: flex; flex-direction: column; gap: 8px; align-items: flex-end;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; border-radius: var(--r);
  background: var(--text-1); color: var(--bg);
  font-size: 13px; font-weight: 500; max-width: 340px;
  box-shadow: var(--shadow-md);
  opacity: 0; transform: translateX(16px); transition: all .25s;
}
.toast.in { opacity: 1; transform: none; }
.toast-ok  i { color: var(--green); }
.toast-err { background: #2c1515; color: #fca5a5; }
.toast-err i { color: var(--red); }
.toast-info i { color: var(--brand-3); }

/* ── Users view ────────────────────────────────────────────── */
.user-role-badge { padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; }
.user-role-badge.admin { background: var(--brand-6); color: var(--brand-dark); border: 1px solid var(--brand-5); }
.user-role-badge.user  { background: var(--bg-3); color: var(--text-2); border: 1px solid var(--border); }

/* ── Responsive ────────────────────────────────────────────── */
@media(max-width:1100px) {
  .stats-grid { grid-template-columns: repeat(3, 1fr); }
}
@media(max-width:768px) {
  #sidebar {
    position: fixed; left: 0; top: 0; bottom: 0;
    transform: translateX(-100%);
  }
  body.sb-open #sidebar { transform: translateX(0); }
  body.sb-open .sb-overlay { display: block; }
  .topbar { display: flex; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .section-cards { grid-template-columns: 1fr 1fr; }
  .meta-grid { grid-template-columns: 1fr 1fr; }
  .wrap { padding: 16px; }
  .login-card { width: 100%; padding: 32px 24px; min-height: 100dvh; }
  .login-bg { display: none; }
}
@media(max-width:480px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .pg-hdr { flex-direction: column; align-items: flex-start; }
  .ed-topbar { flex-wrap: wrap; }
  .login-card { padding: 24px 16px; }
}

/* ── Settings page ─────────────────────────────────────────── */
.settings-tabs {
  display: flex; gap: 2px;
  border-bottom: 1px solid var(--border); margin-bottom: 24px;
}
.settings-tab {
  padding: 9px 16px; background: none; border: none; cursor: pointer;
  font-size: 13px; font-weight: 500; font-family: var(--font);
  color: var(--text-2); border-bottom: 2px solid transparent;
  display: flex; align-items: center; gap: 7px;
  transition: color .13s, border-color .13s; margin-bottom: -1px;
}
.settings-tab i { font-size: 12px; }
.settings-tab.active { color: var(--brand); border-bottom-color: var(--brand); }
.settings-tab:hover  { color: var(--brand); }
.settings-panel { display: none; }
.settings-panel.active { display: block; }
.settings-section {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--r); margin-bottom: 16px; overflow: hidden;
}
.settings-section-head {
  padding: 14px 18px; border-bottom: 1px solid var(--border);
  background: var(--bg-2);
}
.settings-section-head h3 { font-size: 13.5px; font-weight: 700; color: var(--text-1); }
.settings-section-head p  { font-size: 12px; color: var(--text-2); margin-top: 2px; }
.settings-section-body { padding: 18px; }
.settings-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px;
}
.settings-grid.cols-2 { grid-template-columns: 1fr 1fr; }
.settings-field { display: flex; flex-direction: column; gap: 5px; }
.settings-field.fw { grid-column: 1 / -1; }
.settings-field label {
  font-size: 11.5px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .04em; color: var(--text-2);
}
.settings-field label .hint { font-weight: 400; text-transform: none; letter-spacing: 0; margin-left: 5px; color: var(--text-3); }
.settings-field input, .settings-field select, .settings-field textarea {
  padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--rs);
  background: var(--bg); color: var(--text-1);
  font-size: 13px; font-family: var(--font); outline: none; resize: vertical;
  transition: border-color .15s, box-shadow .15s;
}
.settings-field input:focus, .settings-field select:focus, .settings-field textarea:focus {
  border-color: var(--brand); box-shadow: 0 0 0 3px rgba(0,136,154,.08);
}
.settings-field input[type="color"] { padding: 3px; height: 36px; cursor: pointer; }
.settings-field input[type="checkbox"] {
  width: 16px; height: 16px; accent-color: var(--brand);
  cursor: pointer; margin-top: 2px;
}
.settings-check-row {
  display: flex; align-items: center; gap: 10px; padding: 6px 0;
}
.settings-check-row label { font-size: 13px; font-weight: 500; color: var(--text-1); cursor: pointer; }
.settings-actions {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  padding-top: 16px; border-top: 1px solid var(--border); margin-top: 16px;
}
.smtp-status {
  font-size: 12px; font-weight: 600; padding: 4px 10px;
  border-radius: 10px; display: inline-flex; align-items: center; gap: 5px;
}
.smtp-status.ok  { background: rgba(127,191,96,.1); color: #3d7a25; }
.smtp-status.err { background: rgba(242,141,133,.1); color: #8a2e2e; }

/* Notification days pills */
.notif-days { display: flex; gap: 8px; flex-wrap: wrap; }
.notif-day-pill {
  display: flex; align-items: center; gap: 6px;
  background: var(--bg-3); border: 1px solid var(--border);
  border-radius: 20px; padding: 4px 10px; font-size: 12px;
}
.notif-day-pill input { width: 48px; border: none; background: none; font-family: var(--font); font-size: 12px; color: var(--text-1); outline: none; }
