:root {
  --bg:#111111;
  --panel:#171717;
  --text:#f2efe8;
  --muted:#8e8b84;
  --line:#2b2b2b;
  --accent:#d9d3c6;
  --danger:#c27d7d;
  --shadow: rgba(0,0,0,.18);
}

html[data-theme="obsidian"] {
  --bg:#101010; --panel:#171717; --text:#f2efe8; --muted:#8f8b84; --line:#292929; --accent:#ded8cc;
}
html[data-theme="midnight"] {
  --bg:#09111d; --panel:#0d1726; --text:#edf1f7; --muted:#7d8ba0; --line:#1d2c42; --accent:#9fb7d6;
}
html[data-theme="forest"] {
  --bg:#0d1511; --panel:#121d17; --text:#ecefe6; --muted:#899487; --line:#26372d; --accent:#a9b99d;
}
html[data-theme="burgundy"] {
  --bg:#1b0d12; --panel:#241117; --text:#f3ebe7; --muted:#a28b90; --line:#3d2029; --accent:#d5a4a6;
}
html[data-theme="graphite"] {
  --bg:#171819; --panel:#1d1f21; --text:#efefec; --muted:#949699; --line:#303336; --accent:#c7c9cc;
}
html[data-theme="sepia-night"] {
  --bg:#17120d; --panel:#201911; --text:#f1e7d5; --muted:#9d8d74; --line:#382d20; --accent:#d4b98a;
}
html[data-theme="plum"] {
  --bg:#17101a; --panel:#211624; --text:#f2ebf1; --muted:#988b9d; --line:#39283d; --accent:#c0a4c4;
}
html[data-theme="petrol"] {
  --bg:#081719; --panel:#0d2022; --text:#e7f0ee; --muted:#809695; --line:#1f393b; --accent:#91b9b5;
}
html[data-theme="ink"] {
  --bg:#0b0e14; --panel:#111621; --text:#f4f0e7; --muted:#89909d; --line:#252d3b; --accent:#c6c0b4;
}
html[data-theme="charcoal-rose"] {
  --bg:#161315; --panel:#201a1d; --text:#f3eeec; --muted:#9b8d92; --line:#382c31; --accent:#d0a6ad;
}

* { box-sizing:border-box; }
body {
  margin:0; background:var(--bg); color:var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  transition: background .2s ease, color .2s ease;
  position: relative;
}
.page-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at top left, rgba(255,255,255,.03), transparent 30%),
    radial-gradient(circle at bottom right, rgba(255,255,255,.02), transparent 30%);
}
body.has-custom-bg .page-bg {
  background-image:
    linear-gradient(rgba(8,8,8,.72), rgba(8,8,8,.78)),
    var(--custom-bg);
  background-position: center center;
  background-repeat: no-repeat;
  background-size: cover;
  filter: saturate(.95);
}

a { color:inherit; text-decoration:none; }
button, input, textarea, select { font:inherit; }
button, select, input, textarea {
  background:rgba(0,0,0,.12);
  color:var(--text); border:1px solid var(--line);
  border-radius:12px;
  backdrop-filter: blur(4px);
}
button { cursor:pointer; padding:.75rem 1rem; }
button:hover, a:hover { opacity:.78; }
input, textarea, select { width:100%; padding:.8rem .9rem; }
textarea { resize:vertical; }

.shell { min-height:100vh; display:grid; grid-template-columns:220px minmax(0,1fr); position: relative; z-index: 1; }
.sidebar {
  position:sticky; top:0; height:100vh; padding:28px 22px;
  border-right:1px solid var(--line); display:flex; flex-direction:column; gap:32px;
  background: rgba(0,0,0,.08);
  backdrop-filter: blur(8px);
}
.brand { font-size:1.08rem; font-weight:700; letter-spacing:-.03em; }
.brand span { color:var(--accent); }
.brand.large { font-size:2rem; }
.sidebar nav { display:flex; flex-direction:column; gap:12px; }
.sidebar nav a, .logout { color:var(--muted); }
.theme-picker { margin-top:auto; }
.theme-picker label { display:block; font-size:.72rem; color:var(--muted); margin-bottom:7px; text-transform:uppercase; letter-spacing:.12em; }
.theme-picker select { text-transform:capitalize; }
.logout { font-size:.9rem; }

.content { width:min(980px, calc(100% - 48px)); margin:0 auto; padding:64px 0 80px; }
.page-head { display:flex; justify-content:space-between; align-items:flex-end; margin-bottom:28px; }
.eyebrow { color:var(--muted); text-transform:uppercase; letter-spacing:.16em; font-size:.7rem; margin:0 0 8px; }
h1 { margin:0; font-size:clamp(2.2rem, 6vw, 4.6rem); letter-spacing:-.065em; line-height:.95; font-weight:650; }
h2 { margin:0; font-size:1rem; font-weight:650; letter-spacing:-.02em; }
.intro { color:var(--muted); font-size:1.08rem; max-width:560px; margin:0 0 36px; }
.panel {
  border:1px solid var(--line); background:rgba(0,0,0,.16); border-radius:18px; padding:20px;
  box-shadow:0 20px 50px var(--shadow); backdrop-filter: blur(8px);
}
.grid.two { display:grid; grid-template-columns:1fr 1fr; gap:18px; }
.panel-head { display:flex; align-items:center; justify-content:space-between; gap:18px; margin-bottom:14px; }
.panel-head a, .panel-head span { color:var(--muted); font-size:.84rem; }
.item, .file-row {
  display:flex; justify-content:space-between; gap:20px; padding:13px 0; border-top:1px solid var(--line);
}
.item:first-of-type, .file-row:first-of-type { border-top:0; }
.item span, .file-row span { display:block; color:var(--muted); font-size:.78rem; margin-top:4px; }
.stack { display:grid; gap:16px; margin-top:18px; }
.compose form, .upload-panel form { display:grid; gap:12px; }
.note-body { white-space:pre-wrap; line-height:1.65; color:var(--text); }
.actions { display:flex; align-items:center; gap:12px; }
.actions a { color:var(--accent); font-size:.9rem; }
.ghost { padding:.45rem .65rem; background:transparent; border-color:transparent; }
.danger { color:var(--danger); }
.muted { color:var(--muted); }
.flash-stack { margin-bottom:20px; }
.flash { border:1px solid var(--line); background:rgba(0,0,0,.18); padding:12px 14px; border-radius:12px; color:var(--muted); }
.bg-preview-wrap { margin-bottom:12px; }
.bg-preview { width:100%; max-width:460px; height:180px; object-fit: cover; border-radius:14px; border:1px solid var(--line); display:block; }

.login-page {
  min-height:100vh; display:grid; place-items:center; padding:24px;
}
.login-card {
  width:min(380px, 100%); border:1px solid var(--line); background:rgba(0,0,0,.16);
  border-radius:22px; padding:30px; backdrop-filter: blur(8px);
}
.login-card form { display:grid; gap:12px; margin-top:22px; }

@media (max-width: 760px) {
  .shell { grid-template-columns:1fr; }
  .sidebar {
    position:static; height:auto; border-right:0; border-bottom:1px solid var(--line);
    padding:18px; display:grid; grid-template-columns:1fr auto; gap:16px;
  }
  .sidebar nav { grid-column:1 / -1; flex-direction:row; flex-wrap:wrap; }
  .theme-picker { margin:0; min-width:150px; }
  .logout { grid-column:1 / -1; }
  .content { width:min(100% - 28px, 980px); padding:36px 0 60px; }
  .grid.two { grid-template-columns:1fr; }
  .file-row { flex-direction:column; }
}
