/* ================= NeoGlass v3 — Consolidated =================
   Single :root, wider reading rail, sticky/drawer TOC, fixed tables
   ---------------------------------------------------------------- */

/* ---- Design Tokens ---- */
:root{
  /* Brand (buttons/accents only) — Purple scale in light theme */
  --primary-50:#F5F3FF; --primary-100:#EDE9FE; --primary-200:#DDD6FE;
  --primary-300:#C4B5FD; --primary-400:#A78BFA; --primary-500:#8B5CF6;
  --primary-600:#7C3AED; --primary-700:#6D28D9; --primary-800:#5B21B6; --primary-900:#4C1D95;

  /* Neutral */
  --text:#0f172a;
  --muted:#64748b;
  --line:#e5e7eb;
  --bg:#f6f7fb;
  --surface:#ffffff;
  --surface-2:#f8fafc;

  /* Status */
  --success:#16a34a; --warn:#f59e0b; --danger:#ef4444;

  /* Sizing & Motion */
  --radius:16px; --radius-md:12px; --radius-sm:10px;
  --ring:2px; --ring-color:color-mix(in srgb, var(--primary-500) 55%, transparent);
  --shadow-sm:0 1px 2px rgba(2,6,23,.05);
  --shadow:0 6px 18px rgba(2,6,23,.08);
  --shadow-lg:0 18px 40px rgba(2,6,23,.12);
  --transition:150ms cubic-bezier(.22,.61,.36,1);

  /* Layout (edit these) */
  --sidebar-w:260px;
  --rail-w: 1440px;  /* main reading width */
  --aux-w:   300px;  /* outline width */

  /* Optional shared */
  --panel:#ffffff;
  --surfaceElevated: var(--surface);
  --border: var(--line);
  --cardShadow: var(--shadow);
}

/* Reset / base */
*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family:Inter,-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Helvetica,Arial,sans-serif;
  color:var(--text); background:var(--bg); line-height:1.6;
  background-image:
    radial-gradient(60rem 60rem at 70% -10%, var(--primary-50), transparent),
    radial-gradient(40rem 40rem at -10% 20%, #e2e8f0, transparent);
}
a{color:var(--primary-600); text-decoration:none}
a:hover{color:var(--primary-700)}

/* App shell */
.app-shell{display:grid;grid-template-columns:var(--sidebar-w) 1fr;min-height:100vh;transition:grid-template-columns var(--transition)}
.app-shell.sidebar-collapsed{grid-template-columns:70px 1fr}
.app-sidebar{position:sticky;top:0;height:100svh;border-right:1px solid var(--line);background:var(--panel);transition:width var(--transition);overflow:hidden;z-index:60}
.app-main{padding:20px 28px}

/* Sidebar */
.sidebar-inner{height:100%;display:flex;flex-direction:column;gap:12px;padding:14px}
.brand{display:flex;align-items:center;gap:10px;font-weight:800;font-size:18px;text-decoration:none;color:var(--text);white-space:nowrap;overflow:hidden}
.logo-dot{width:10px;height:10px;border-radius:50%;background:linear-gradient(135deg,var(--primary-500),var(--primary-400));box-shadow:0 0 12px var(--primary-300);flex-shrink:0}
.sidebar-collapse-btn{width:100%;display:flex;align-items:center;justify-content:center;gap:8px;padding:6px;border:1px solid var(--line);border-radius:8px;background:var(--surface);color:var(--text);cursor:pointer;font-size:14px;transition:all var(--transition)}
.sidebar-collapse-btn:hover{background:var(--surface-2)}
.sidebar-collapse-btn i{transition:transform var(--transition)}
.sidebar-collapsed .sidebar-collapse-btn i{transform:rotate(180deg)}
.side-nav{display:flex;flex-direction:column;gap:6px;margin-top:6px;overflow:auto}
.nav-link{display:flex;align-items:center;gap:10px;padding:9px 10px;border-radius:10px;color:var(--text);text-decoration:none;white-space:nowrap;overflow:hidden;transition:all var(--transition)}
.nav-link:hover{background:color-mix(in oklab,var(--primary-500) 12%, transparent)}
.nav-link.active{background:color-mix(in oklab,var(--primary-500) 18%, transparent);font-weight:600}
.nav-link i{width:18px;text-align:center;opacity:.9;flex-shrink:0}
.nav-link span{overflow:hidden;text-overflow:ellipsis}
.sidebar-collapsed .nav-link span,.sidebar-collapsed .brand span,.sidebar-collapsed .sidebar-collapse-btn span{opacity:0;width:0;overflow:hidden}
.sidebar-collapsed .nav-link{justify-content:center}
.sidebar-footer{margin-top:auto;display:flex;flex-direction:column;gap:10px;padding-top:10px;border-top:1px dashed var(--line)}
.theme-switch{display:flex;align-items:center;gap:10px;padding:8px 10px;border:1px solid var(--line);border-radius:12px;background:var(--surface);cursor:pointer}
.theme-switch .knob{width:30px;height:16px;border-radius:999px;background:var(--panel);border:1px solid var(--line)}
.theme-switch[aria-pressed="true"] .knob{background:color-mix(in oklab,var(--primary-500) 40%, var(--panel))}
.logout{width:100%;padding:9px 10px;border-radius:12px;border:1px solid color-mix(in oklab,var(--danger) 40%, var(--line));background:color-mix(in oklab,var(--danger) 6%, var(--surface));color:var(--danger);font-weight:600}
.logout:hover{background:color-mix(in oklab,var(--danger) 12%, var(--surface))}

/* Center rail + optional aux pane */
.center-rail{max-width:var(--rail-w);margin:0 auto}
.with-aux{display:grid;grid-template-columns:var(--aux-w) minmax(0,1fr);gap:18px}
.aux{position:sticky;top:16px;height:fit-content}

/* Cards */
.ng-card{
  background:var(--surface);
  border:1px solid var(--line);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
  overflow:hidden;
}
.ng-card-header{padding:16px 18px; border-bottom:1px solid var(--line); background:linear-gradient(180deg, rgba(255,255,255,.65), transparent)}
.ng-card-body{padding:18px}
.ng-card-footer{padding:14px 18px; border-top:1px solid var(--line); background:linear-gradient(0deg, rgba(255,255,255,.65), transparent)}
/* top “footer” bar to match bottom */
.ng-card-topbar{border-top:0;border-bottom:1px solid var(--line);background:linear-gradient(180deg, rgba(255,255,255,.65), transparent)}


/* ---- Unified media card ---- */
.card-grid{ display:grid; grid-template-columns:repeat(auto-fit, minmax(320px, 1fr)); gap:16px; }
.card{ /* always on top of .ng-card */
  --title-size: 18px;
}
.card .card-top{
  display:flex; align-items:flex-start; justify-content:space-between; gap:10px; margin-bottom:8px;
}
.card .card-title{ font-size:var(--title-size); font-weight:800; margin:0; line-height:1.2; }
.card .card-title a{ color:inherit; text-decoration:none; }
.card .card-title a:hover{ color:var(--primary-700); }

.card .card-chip{ display:inline-flex; align-items:center; gap:6px; padding:4px 8px;
  border:1px solid var(--line); border-radius:999px; font-weight:600; font-size:12px;
  background:var(--surface-2);
}
.card .card-meta{
  display:flex; align-items:center; justify-content:space-between; gap:10px; margin-top:8px;
}
.card .card-actions{ display:flex; gap:8px; }

/* subtle lift on hover */
.card.clickable{ transition:transform .15s ease, box-shadow .15s ease; }
.card.clickable:hover{ transform:translateY(-2px); box-shadow:var(--shadow-lg); }

/* Title color accents: projects vs content */
.card--project .card-title a{ color:var(--text); }    /* neutral */
.card--doc .card-title a{ color:var(--primary-600); } /* accent */

/* Non-red delete, as requested (avoid CSS Modules 'composes') */
.card .btn-delete{
  background: color-mix(in oklab, var(--danger) 6%, var(--surface));
  border:1px solid color-mix(in oklab, var(--danger) 40%, var(--line));
  color: var(--danger);
  font-weight:600;
}
.card .btn-delete:hover{ background: color-mix(in oklab, var(--danger) 12%, var(--surface)); }

/* Make small date text consistent */
.card small.muted{ font-size:12px; }


/* --- Subscription CTA styles --- */
.sub-cta{
  display:block; width:100%;
  padding:10px 12px; border-radius:12px;
  background: color-mix(in oklab, var(--primary-500) 14%, var(--surface));
  border:1px solid color-mix(in oklab, var(--primary-500) 35%, var(--line));
  color: var(--text); font-weight:700; text-align:center;
}
.sub-cta:hover{ background: color-mix(in oklab, var(--primary-500) 20%, var(--surface)); }

.pill-plan{
  display:inline-block; padding:4px 8px; border-radius:999px;
  background: color-mix(in oklab, var(--primary-500) 12%, transparent);
  border:1px solid color-mix(in oklab, var(--primary-500) 32%, var(--line));
  font-weight:600; font-size:12px;
}
.plan-line{ display:flex; align-items:center; gap:8px; }

.row{ display:flex; align-items:center; }
.g-8{ gap:8px; }
.w-100{ width:100%; }

.danger-ghost{
  background: color-mix(in oklab, var(--danger) 6%, var(--surface));
  border:1px solid color-mix(in oklab, var(--danger) 40%, var(--line));
  color: var(--danger); font-weight:600;
}
.danger-ghost:hover{ background: color-mix(in oklab, var(--danger) 12%, var(--surface)); }

/* tiny tweak so the footer block breathes */
.sidebar-footer .sub-block{ display:grid; gap:8px; }

/* --- ChatGPT-like account block (sidebar bottom) --- */
/* Replaced by dropup — keep avatar utility */
.avatar{ width:26px; height:26px; border-radius:50%; background: var(--primary-100); display:flex; align-items:center; justify-content:center; font-weight:800; color: var(--primary-700); box-shadow:var(--shadow-sm); font-size:12px; }
.dark .avatar{ background: color-mix(in oklab, var(--primary-600) 35%, #000); color:#fff; }

/* Dropup container */
.dropup{ position: relative; display: flex; flex-direction: column; }
.acct-btn{
  width:100%; display:flex; align-items:center; gap:6px; justify-content:space-between;
  padding:6px 8px; border:1px solid var(--line); border-radius:8px; background:var(--surface);
  cursor:pointer; font-weight:700; font-size:13px; color: var(--text);
}
.acct-btn:hover{ background: color-mix(in oklab, var(--surface-2) 55%, var(--surface)); }
.acct-btn .acct-meta{ display:flex; flex-direction:column; align-items:flex-start; gap:2px; min-width:0; flex:1; }
.acct-btn .acct-name{ white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.acct-btn .caret{ transition: transform .15s ease; }
.acct-btn[aria-expanded="true"] .caret{ transform: rotate(180deg); }

.dropup-menu{
  position:fixed; left:auto; bottom: auto;
  min-width: 240px; width: max-content; max-width: 300px;
  background:var(--surfaceElevated); 
  border:1px solid color-mix(in oklab, var(--line) 60%, transparent); 
  border-radius:12px; 
  box-shadow: 0 8px 32px rgba(0,0,0,.15), 0 0 0 1px color-mix(in oklab, var(--line) 30%, transparent);
  padding:8px; 
  display:flex; 
  flex-direction:column; 
  gap:2px; 
  z-index:999999; 
  font-size:14px;
  backdrop-filter: blur(12px);
}
.dropup-menu[hidden]{ display:none !important; }
.menu-section{ display:flex; flex-direction:column; gap:2px; padding:0; }
.menu-section + .menu-section{ margin-top:6px; padding-top:6px; border-top:1px solid color-mix(in oklab, var(--line) 40%, transparent); }
.menu-section.subtle{ background: color-mix(in oklab, var(--surface-2) 45%, transparent); padding:6px; border-radius:8px; }
.menu-row{ 
  display:flex; 
  align-items:center; 
  gap:10px; 
  padding:10px 12px; 
  border-radius:8px; 
  color:var(--text); 
  text-decoration:none; 
  border:1px solid transparent; 
  background:transparent; 
  cursor:pointer; 
  width:100%; 
  text-align:left; 
  font-size:14px;
  font-weight:500;
  transition: all 0.15s ease;
}
.menu-row i{ font-size:15px; width:16px; text-align:center; color:var(--muted); }
.menu-row:hover{ 
  background: color-mix(in oklab, var(--primary-500) 8%, transparent); 
  border-color: transparent;
  transform: translateX(2px);
}
.menu-row.danger{ color: var(--danger); }
.menu-row.danger:hover{ background: color-mix(in oklab, var(--danger) 8%, transparent); }
.menu-note{ font-size:12px; color:var(--muted); display:flex; align-items:center; gap:8px; padding:6px 8px; }

/* Switch (theme) */
.switch{ gap:12px; cursor:pointer; }
.switch input{ display:none; }
.switch .label{ font-size:14px; font-weight:500; }
.switch .switch-ui{ 
  width:40px; 
  height:22px; 
  border-radius:999px; 
  background:var(--surface-2); 
  border:1px solid var(--line); 
  position:relative;
  transition: all 0.2s ease;
  box-shadow: inset 0 1px 3px rgba(0,0,0,.1);
}
.switch .switch-ui::after{ 
  content:""; 
  position:absolute; 
  top:2px; 
  left:2px; 
  width:16px; 
  height:16px; 
  border-radius:50%; 
  background:var(--panel); 
  transition: all .2s ease;
  box-shadow: 0 2px 4px rgba(0,0,0,.2);
}
.switch input:checked + .switch-ui{ 
  background: var(--primary-600); 
  border-color: var(--primary-600);
  box-shadow: inset 0 1px 3px rgba(0,0,0,.2), 0 0 8px color-mix(in oklab, var(--primary-600) 30%, transparent);
}
.switch input:checked + .switch-ui::after{ 
  left:20px; 
  background:#ffffff;
}



/* Buttons */
.ng-btn{
  display:inline-flex; align-items:center; justify-content:center; gap:8px;
  padding:10px 16px; font-weight:700; border-radius:12px; border:1px solid transparent;
  cursor:pointer; transition:var(--transition);
}
.ng-btn:disabled,.ng-btn[disabled]{opacity:.55; cursor:not-allowed}
.ng-btn-lg{padding:12px 18px; font-size:15px}
.ng-btn-sm{padding:8px 12px; font-size:14px}
.ng-btn-primary{background:var(--primary-600); color:#fff}
.ng-btn-primary:hover{background:var(--primary-700); box-shadow:var(--shadow-lg); transform:translateY(-1px)}
.ng-btn-outline{background:transparent; border-color:var(--line); color:var(--text)}
.ng-btn-outline:hover{background:#fff; box-shadow:var(--shadow-sm)}
.ng-btn-danger{background:var(--danger); color:#fff}

/* Forms */
label{font-weight:600; font-size:14px; display:block; margin-bottom:8px}
.ng-field{margin-bottom:14px}
input[type="text"],input[type="number"],input[type="email"],input[type="password"],select,textarea{
  width:100%; background:var(--surface-2);
  border:1px solid var(--line); border-radius:12px;
  padding:10px 12px; min-height:44px; font-size:15px;
  outline:none; transition:var(--transition);
}
textarea{min-height:120px; resize:vertical}
input:focus,select:focus,textarea:focus{
  border-color:var(--primary-400);
  box-shadow:0 0 0 var(--ring) var(--ring-color);
  background:#fff;
}

/* Prose (rendered markdown) */
.prose h1{font-size:26px; margin:14px 0 8px}
.prose h2{font-size:22px; margin:12px 0 6px}
.prose h3{font-size:18px; margin:10px 0 4px}
.prose h4{font-size:16px; margin:10px 0 4px}
.prose h5{font-size:15px; margin:10px 0 4px}
.prose h6{font-size:14px; margin:10px 0 4px; font-weight:600}
.prose p{margin:.7rem 0}
.prose ul, .prose ol{margin:.7rem 0 .7rem 1.2rem}

/* Tables — fixed & responsive */
.prose table{
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  font-size: 14px;
  margin:.9rem 0;
}
.prose th, .prose td{
  padding: 10px 12px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  text-align: left;
}
.prose tr > *:last-child{ border-right: 0; }
.prose tbody tr:last-child > *{ border-bottom: 0; }
.prose thead th{ background: var(--surface-2); font-weight:700; position:sticky; top:0; z-index:1; }
.prose table:not(:has(thead)) tr:first-child > th,
.prose table:not(:has(thead)) tr:first-child > td{ background: var(--surface-2); font-weight:700; }
.prose tbody tr:nth-child(even) td{ background: color-mix(in oklab, var(--surface-2) 55%, transparent); }
@media (max-width:900px){
  .prose table{ display:block; overflow-x:auto; -webkit-overflow-scrolling:touch; white-space:nowrap; }
  .prose thead th{ position: static; }
}

/* Segmented tabs */
.seg-tabs{
  position: sticky;
  top: 10px;
  z-index: 9;
  display:flex; gap:12px; padding:10px 14px; border:1px solid var(--line); border-radius:14px;
  background:var(--panel); width:100%; max-width:none; margin:12px auto 16px; box-shadow:var(--cardShadow);
  overflow:auto;
  justify-content:center;
  flex-wrap:wrap;
  backdrop-filter: blur(6px);
}
.seg-tab{
  appearance:none; border:none; background:transparent; color:var(--text);
  padding:10px 16px; border-radius:999px; font-weight:600; cursor:pointer; transition:var(--transition);
}
.seg-tab:hover{background:var(--surface-2)}
.seg-tab.active, .seg-tab[aria-selected="true"]{background:var(--primary-600); color:#fff; box-shadow:var(--shadow)}

/* Toast */
.toast{
  position:fixed; right:18px; bottom:18px; background:var(--surface); border:1px solid var(--line);
  border-radius:12px; padding:12px 14px; box-shadow:var(--shadow); z-index:60; opacity:0; transform:translateY(8px);
  transition:var(--transition);
}
.toast.show{opacity:1; transform:none}

/* Utilities / rhythm */
.container{max-width:min(1280px, 100% - 24px); margin:0 auto; padding:24px}
.rail{ max-width: var(--rail-w); margin: 0 auto; }
.grid-2{display:grid; grid-template-columns:minmax(0,1fr) 600px; gap:18px}
@media (max-width:1100px){ .grid-2{grid-template-columns:1fr} }
.sticky{position:sticky; top:18px}
.muted{color:var(--muted)} .mt-2{margin-top:8px} .mt-3{margin-top:14px} .mb-2{margin-bottom:8px} .mb-3{margin-bottom:14px}
.w-100{width:100%}
.header-row{display:flex;justify-content:space-between;align-items:center;gap:12px;margin:0 0 12px}

/* TOC (outline) */
.aux .ng-card-body{ font-size:13px; line-height:1.45; }
.aux .ng-card-body strong{ font-size:13px; }
.toc{ margin:0; padding-left:1.0rem; list-style:decimal; }
.toc-items{ margin:.2rem 0 .6rem; padding-left:0.9rem; }
.toc-link{ display:inline-block; padding:4px 6px; border-radius:6px; text-decoration:none; color:var(--text); font-size:13px; }
.toc-link:hover{ background: color-mix(in oklab, var(--primary-500) 10%, transparent); }
.toc-link.active{ font-weight:700; background: color-mix(in oklab, var(--primary-500) 16%, transparent); border: 1px solid color-mix(in oklab, var(--primary-500) 35%, var(--line)); }

/* Responsive shell + TOC drawer */
.nav-toggle{position:fixed;left:12px;top:12px;z-index:50;display:none}
@media (max-width:1100px){
  .app-shell{grid-template-columns:1fr}
  .app-main{padding:14px}
  .app-sidebar{position:fixed;inset:0 auto 0 0;width:var(--sidebar-w);transform:translateX(-100%);transition:transform .22s ease;z-index:40}
  .app-sidebar[aria-expanded="true"]{transform:none}
  .nav-toggle{display:inline-flex}
  .with-aux{grid-template-columns:1fr}
}

/* ---------- AUX DRAWER (mobile) ---------- */
.toc-toggle{ display:none; }
.toc-close{ display:none; }
.aux-scrim{
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  opacity: 0; pointer-events: none;
  transition: opacity .2s ease;
  z-index: 48;
}
@media (max-width:1100px){
  .toc-toggle{ display:inline-flex; }
  .toc-close{ display:inline-flex; }
  .with-aux{ grid-template-columns: 1fr; }
  .aux{
    position: fixed; inset: 0 auto 0 0; width: min(88vw, 380px); max-width: 380px; height: 100dvh;
    transform: translateX(-102%); transition: transform .22s ease; z-index: 49;
    border-right: 1px solid var(--line); box-shadow: var(--shadow-lg); overflow: auto;
  }
  .aux[aria-expanded="true"]{ transform: none; }
  .aux .ng-card-header{ position: sticky; top: 0; z-index: 1; backdrop-filter: blur(6px); }
  .aux[aria-expanded="true"] ~ .aux-scrim{ opacity: 1; pointer-events: auto; }
}


/* Panel wrapper used on listing pages */
.page-panel { padding: 12px; }

/* 3-up responsive grid like All Content */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
}

/* Unified card layout */
.content-card {
  display: flex;
  flex-direction: column;
  min-height: 164px;       /* same visual height baseline */
}
.content-card .card-main { flex: 1; }

/* Titles & descriptions */
.card-title {
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: 800;
}
.project-card .card-title { color: var(--text); } /* keep projects readable */

.card-desc {
  margin: 0 0 10px;
  font-size: 14px;
  line-height: 1.45;
  color: var(--muted);
  display: -webkit-box;
  line-clamp: 2;            /* standard property for supporting browsers */
  -webkit-line-clamp: 2;   /* clamp long descriptions */
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Sticky footer row with meta on left and actions on right */
.card-footer {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.card-footer .meta { display: flex; gap: 12px; flex-wrap: wrap; }
.card-footer .muted { font-size: 12px; color: var(--muted); }

/* Delete button to match All Content */
.btn-delete {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: 10px;
}
.dark .btn-delete { background: var(--surface-2); }


/* --- Projects page: make cards identical to All Content cards --- */

/* same “white sheet” look as All Content */
.page--projects .page-panel{
  background: var(--panel);
  border-radius: 16px;
  padding: 12px;
  box-shadow: var(--shadow-md);
}

/* 3-up grid, responsive like All Content */
.page--projects .card-grid{
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
@media (max-width:1200px){
  .page--projects .card-grid{ grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width:720px){
  .page--projects .card-grid{ grid-template-columns: 1fr; }
}

/* card internals identical to document cards */
.page--projects .project-card{
  display: flex;
  flex-direction: column;
  min-height: 150px;                 /* reduce tall empty space */
}

.page--projects .project-card .card-main{
  flex: 1 1 auto;
  padding: 16px 18px 8px;
}

.page--projects .project-card .card-title{
  margin: 0 0 6px;
  line-height: 1.25;
}

.page--projects .project-card .card-desc{
  margin: 0;
  font-size: .95rem;
  line-height: 1.45;
  color: var(--muted-900);
}

.page--projects .project-card .card-footer{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 18px 14px;
  border-top: 1px solid var(--border-soft);
  margin-top: auto;                  /* pin footer to bottom */
}

.page--projects .project-card .meta{
  display: flex;
  align-items: center;
  gap: 12px;
}
.page--projects .project-card .meta .muted{ font-size: .9rem; }


/* === Unified cards & grids (All Content / Projects / Dashboard / Project page) === */
.card-grid{
  display:grid;
  gap:14px;
  grid-template-columns: repeat(3, minmax(0,1fr));
}
@media (max-width: 1200px){ .card-grid{ grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (max-width: 720px){ .card-grid{ grid-template-columns: 1fr; } }

.ng-card.card .ng-card-body,
.card-body{
  display:flex;
  flex-direction:column;
  min-height:170px;           /* same height target as All Content */
}

.card-title{ margin:0 0 2px; line-height:1.25; font-weight:800; font-size:18px; }
.card-title a{ color:var(--primary-700); text-decoration:none; }
.card-title a:hover{ color:var(--primary-800); }

.card-sub{ margin:2px 0 6px; color:var(--muted); }
.flex-spacer{ flex:1 1 auto; }

.card-meta{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:10px;
  margin-top:10px;
}
.card-actions{ display:flex; gap:8px; }

.page-panel{ border-radius:16px; }


/* ------------------------------ PAGE HERO (Unified headers) ------------------------------ */
.page-hero{
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px;
  box-shadow: var(--cardShadow);
  margin-bottom: 14px;
}
.page-hero__title{ margin: 0 0 6px; font-size: 32px; font-weight: 800; }
.page-hero__sub{ margin: 6px 0 0; color: var(--muted); }


/* ------------------------------ DARK MODE ------------------------------ */
/* ChatGPT-like dark palette */
html.dark{
  /* Core palette approximating ChatGPT */
  --text:#ECECF1;          /* near-white text */
  --muted:#B5BAC1;         /* subdued text */
  --bg:#343541;            /* main background */
  --surface:#444654;       /* cards/panels */
  --surface-2:#3E3F4B;     /* inputs/secondary */
  --line:#565869;          /* borders/separators */
  --panel:#202123;         /* sidebar background */
  --surfaceElevated: var(--surface);
  --cardShadow: 0 12px 28px rgba(0,0,0,.45);

  /* Accent: Purple brand in dark mode */
  --primary-600:#7C3AED;  /* purple-600 */
  --primary-700:#6D28D9;  /* purple-700 */
}

/* Solid background everywhere; remove light gradients */
.dark body{ color:var(--text); background:var(--bg); background-image:none; }
.dark .app-main,.dark .app-sidebar{ color:var(--text); }

/* Links use accent green like ChatGPT */
.dark a{ color:#ffffff; text-decoration: underline dotted transparent; }
.dark a:hover{ color:#ffffff; text-decoration-color: currentColor; opacity:.9; }

/* Sidebar */
.dark .app-sidebar{ background: var(--panel); border-right:1px solid var(--line); box-shadow:none; }
.dark .nav-link{ color:#C7CBD1; }
.dark .nav-link:hover{ background:#2A2B32; color:var(--text); }
.dark .nav-link.active{ background:#2A2B32; color:#FFFFFF; border:1px solid #3E414D; }

/* Purple logo in dark mode */
.dark .logo-dot{
  background: linear-gradient(135deg, #7C3AED, #A78BFA);
  box-shadow: 0 0 12px rgba(167,139,250,0.8);
}

/* Cards/panels */
.dark .ng-card,.dark .panel,.dark .page-hero{ background: var(--surface); border:1px solid var(--line); box-shadow: var(--cardShadow); }
.dark .ng-card:hover{ background:#4A4C5A; }

/* Card header/footer surfaces in dark: remove light gradients */
.dark .ng-card-header{ background: var(--surface-2) !important; border-bottom:1px solid var(--line); }
.dark .ng-card-footer{ background: var(--surface-2) !important; border-top:1px solid var(--line); }
.dark .ng-card-topbar{ background: var(--surface-2) !important; border-bottom:1px solid var(--line); }

/* Buttons */
.dark .ng-btn{ color:var(--text); border:1px solid var(--line); background:var(--surface); }
.dark .ng-btn:hover{ background:#2A2B32; border-color:#3E414D; }
.dark .ng-btn-primary{ background:var(--primary-600); color:#fff; border:1px solid transparent; }
.dark .ng-btn-primary:hover{ background:var(--primary-700); }

/* Forms */
.dark input, .dark textarea, .dark select{ background:#40414F; border:1px solid var(--line); color:var(--text); }
.dark input::placeholder,.dark textarea::placeholder{ color:#8E93A1; }

/* Segmented tabs */
.dark .seg-tabs{ background: var(--panel); border:1px solid var(--line); }
.dark .seg-tab{ color:var(--text); }
.dark .seg-tab[aria-selected="true"]{ background: var(--surface); box-shadow:none; color:var(--text); }

/* remove decorative gradients in dark */
.dark .ng-card::before,.dark .ng-card::after{ content:none !important; }

.bp-toc .ng-card-body { font-size: 13px; line-height: 1.45; }
.bp-toc .bp-toc-list { margin: 0; padding-left: 1.0rem; }
.bp-toc .bp-toc-list > li { margin: .25rem 0; }
.bp-toc .bp-toc-list ul { margin: .25rem 0 .5rem 0; padding-left: .9rem; }
.bp-toc a { text-decoration: none; }
.bp-toc a:hover { text-decoration: underline; }