@font-face { font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap; src: url("vendor/fonts/inter-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap; src: url("vendor/fonts/inter-latin-ext.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Inter Tight"; font-style: normal; font-weight: 100 900; font-display: swap; src: url("vendor/fonts/inter-tight-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Inter Tight"; font-style: normal; font-weight: 100 900; font-display: swap; src: url("vendor/fonts/inter-tight-latin-ext.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

/* ---------- Tokens ---------- */
:root {
  --bg: #f5f8fb;
  --surface: #ffffff;
  --surface-2: #eef4f9;
  --surface-3: #e3edf6;
  --text: #0b2230;
  --text-2: #33495a;
  --muted: #5f7688;
  --border: #dde7ef;
  --brand: #2e6c94;
  --brand-strong: #1e5578;
  --brand-light: #57aceb;
  --brand-deep: #0a3245;
  --brand-tint: #e6f2fc;
  --danger: #b4232f;
  --on-brand: #ffffff;
  --shadow-sm: 0 1px 2px rgba(10, 50, 69, .06), 0 1px 3px rgba(10, 50, 69, .05);
  --shadow: 0 8px 28px -10px rgba(10, 50, 69, .18), 0 2px 6px rgba(10, 50, 69, .05);
  --radius: 14px;
  --radius-sm: 10px;
  --sidebar-w: 272px;
  --topbar-h: 64px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Inter Tight", "Inter", system-ui, sans-serif;
  --hero-grad: radial-gradient(120% 140% at 100% 0%, #1e6488 0%, #0f3f58 45%, #0a3245 70%, #071f2c 100%);
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #07141c;
  --surface: #0c1d28;
  --surface-2: #112634;
  --surface-3: #173244;
  --text: #e5eff6;
  --text-2: #c2d3df;
  --muted: #8ea6b7;
  --border: #1d3647;
  --brand: #6ab8f0;
  --brand-strong: #8ccaf5;
  --brand-light: #57aceb;
  --brand-tint: #12304a;
  --danger: #ff7a84;
  --on-brand: #04131c;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow: 0 10px 30px -12px rgba(0, 0, 0, .6);
  --hero-grad: radial-gradient(120% 140% at 100% 0%, #184f6d 0%, #0c3448 45%, #082634 70%, #051620 100%);
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { font-family: var(--font-display); letter-spacing: -.02em; line-height: 1.15; margin: 0; }
:focus-visible { outline: 2px solid var(--brand-light); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.boot { min-height: 100vh; display: grid; place-items: center; }
.boot img { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; transform: scale(.94); } }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface);
  font-weight: 600; font-size: 14px; cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.btn-primary:hover { background: var(--brand-strong); border-color: var(--brand-strong); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { color: var(--danger); }
.btn-sm { height: 34px; padding: 0 12px; font-size: 13px; }
.btn[disabled] { opacity: .55; cursor: default; }
.icon-btn {
  width: 40px; height: 40px; display: inline-grid; place-items: center; border-radius: 999px;
  border: 1px solid transparent; background: transparent; cursor: pointer; color: var(--text-2);
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn svg { width: 20px; height: 20px; }

/* ---------- Shell ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30; height: var(--topbar-h);
  display: flex; align-items: center; gap: 12px; padding: 0 20px;
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  backdrop-filter: saturate(160%) blur(12px); -webkit-backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-family: var(--font-display); font-weight: 700; font-size: 18px; letter-spacing: -.02em; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand img { width: 30px; height: 31px; }
.menu-btn { display: none; }
.search { position: relative; flex: 1; max-width: 560px; margin: 0 auto; }
.search input {
  width: 100%; height: 42px; padding: 0 44px 0 42px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface-2); outline: none;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.search input::placeholder { color: var(--muted); }
.search input:focus { background: var(--surface); border-color: var(--brand-light); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand-light) 22%, transparent); }
.search > svg { position: absolute; left: 14px; top: 11px; width: 20px; height: 20px; color: var(--muted); pointer-events: none; }
.search kbd { position: absolute; right: 12px; top: 10px; font: 600 11px/20px var(--font); padding: 0 6px; border-radius: 6px; border: 1px solid var(--border); color: var(--muted); background: var(--surface); }
.search-results {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0; z-index: 40;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 6px; max-height: min(70vh, 480px); overflow: auto;
}
.search-results[hidden] { display: none; }
.sr-item { display: block; padding: 10px 12px; border-radius: 10px; color: var(--text); }
.sr-item:hover, .sr-item.active { background: var(--surface-2); text-decoration: none; }
.sr-item b { display: block; font-weight: 600; }
.sr-item small { color: var(--muted); display: block; font-size: 13px; line-height: 1.45; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-empty { padding: 14px 12px; color: var(--muted); font-size: 14px; }
.top-actions { display: flex; align-items: center; gap: 4px; }
.avatar { width: 34px; height: 34px; border-radius: 999px; object-fit: cover; background: var(--brand-tint); color: var(--brand); display: grid; place-items: center; font-weight: 700; font-size: 14px; }
.user-menu { position: relative; }
.user-menu button { padding: 0; border: 0; background: none; cursor: pointer; border-radius: 999px; }
.dropdown {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 240px; z-index: 50;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 6px;
}
.dropdown[hidden] { display: none; }
.dropdown .who { padding: 10px 12px 12px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.dropdown .who b { display: block; font-size: 14px; }
.dropdown .who small { color: var(--muted); font-size: 13px; }
.dropdown a, .dropdown button.item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px; border-radius: 8px; color: var(--text); background: none; border: 0; cursor: pointer; font-size: 14px; text-align: left; }
.dropdown a:hover, .dropdown button.item:hover { background: var(--surface-2); text-decoration: none; }
.dropdown svg { width: 18px; height: 18px; color: var(--muted); }

.layout { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: calc(100vh - var(--topbar-h)); }
.sidebar {
  position: sticky; top: var(--topbar-h); height: calc(100vh - var(--topbar-h)); overflow-y: auto;
  padding: 20px 14px 32px; border-right: 1px solid var(--border); background: var(--surface);
}
.nav-link {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 9px;
  color: var(--text-2); font-size: 14.5px; font-weight: 500; line-height: 1.35;
}
.nav-link:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav-link.active { background: var(--brand-tint); color: var(--brand); font-weight: 600; }
.nav-link svg { width: 18px; height: 18px; flex: none; }
.nav-section { margin-top: 18px; }
.nav-head { display: flex; align-items: center; gap: 2px; border-radius: 9px; }
.nav-head a {
  flex: 1; min-width: 0; padding: 7px 10px; border-radius: 9px;
  font: 700 12px/1.3 var(--font); text-transform: uppercase; letter-spacing: .07em; color: var(--muted);
}
.nav-head a:hover { color: var(--text); text-decoration: none; background: var(--surface-2); }
.nav-head.active a { color: var(--brand); background: var(--brand-tint); }
.nav-head button { width: 28px; height: 28px; flex: none; display: grid; place-items: center; border: 0; background: none; border-radius: 8px; cursor: pointer; color: var(--muted); }
.nav-head button:hover { background: var(--surface-2); color: var(--text); }
.nav-head svg { width: 16px; height: 16px; transition: transform .2s; }
.nav-head button[aria-expanded="false"] svg { transform: rotate(-90deg); }
.nav-list { list-style: none; margin: 4px 0 0; padding: 0; }
.nav-list[hidden] { display: none; }
.nav-sub { margin: 2px 0 2px 12px; padding-left: 8px; border-left: 1px solid var(--border); }
.nav-sub .nav-head a { text-transform: none; letter-spacing: 0; font-size: 14.5px; font-weight: 600; color: var(--text-2); padding: 8px 10px; }
.nav-empty { padding: 4px 10px 6px; font-size: 13px; color: var(--muted); font-style: italic; }
.sidebar-foot { margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--border); display: grid; gap: 4px; }
.scrim { display: none; }

.main { min-width: 0; padding: 32px clamp(16px, 4vw, 56px) 80px; }
.container { max-width: 1080px; margin: 0 auto; }
.narrow { max-width: 780px; margin: 0 auto; }

/* ---------- Home ---------- */
.hero {
  position: relative; overflow: hidden; border-radius: 22px; color: #fff;
  background: var(--hero-grad); padding: clamp(28px, 5vw, 56px);
  display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: clamp(24px, 4vw, 48px); align-items: center;
  box-shadow: var(--shadow);
}
.hero-lines { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; opacity: .55; }
.hero > *:not(.hero-lines) { position: relative; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: #9fd2f7; }
.eyebrow img { width: 18px; height: 18px; }
.hero h1 { font-size: clamp(34px, 5vw, 56px); font-weight: 800; margin: 14px 0 14px; letter-spacing: -.035em; }
.hero h1 span { background: linear-gradient(90deg, #8fd0ff, #57aceb); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { margin: 0; font-size: clamp(16px, 1.6vw, 18px); color: #d4e6f3; max-width: 46ch; white-space: pre-line; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
.hero .btn { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.22); color: #fff; }
.hero .btn:hover { background: rgba(255,255,255,.18); }
.hero .btn-primary { background: #57aceb; border-color: #57aceb; color: #04131c; }
.hero .btn-primary:hover { background: #7cc0f1; }
.hero-photo { border-radius: 16px; overflow: hidden; aspect-ratio: 3 / 2; box-shadow: 0 20px 50px -20px rgba(0,0,0,.6); border: 1px solid rgba(255,255,255,.12); }
.hero-photo img { width: 100%; height: 100%; object-fit: cover; }

.section { margin-top: 44px; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.section-head h2 { font-size: 22px; font-weight: 700; }
.section-head p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.card {
  display: flex; flex-direction: column; gap: 10px; padding: 22px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm); color: var(--text);
  transition: transform .15s, box-shadow .15s, border-color .15s;
}
a.card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--brand-light) 45%, var(--border)); text-decoration: none; }
.card-icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--brand-tint); color: var(--brand); }
.card-icon svg { width: 22px; height: 22px; }
.card h3 { font-size: 18px; font-weight: 700; }
.card p { margin: 0; color: var(--muted); font-size: 14px; }
.card .count { margin-top: auto; font-size: 13px; font-weight: 600; color: var(--brand); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: 12.5px; font-weight: 500; padding: 3px 10px; border-radius: 999px; background: var(--surface-2); color: var(--text-2); }

.list { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden; }
.list-item { display: flex; align-items: center; gap: 16px; padding: 16px 20px; color: var(--text); border-top: 1px solid var(--border); }
.list-item:first-child { border-top: 0; }
.list-item:hover { background: var(--surface-2); text-decoration: none; }
.list-item .li-body { min-width: 0; flex: 1; }
.list-item b { display: block; font-weight: 600; }
.list-item small { display: block; color: var(--muted); font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-item .li-meta { color: var(--muted); font-size: 13px; white-space: nowrap; }
.list-item .li-icon { width: 36px; height: 36px; border-radius: 10px; background: var(--surface-2); color: var(--muted); display: grid; place-items: center; flex: none; }
.list-item .li-icon svg { width: 18px; height: 18px; }

.empty {
  text-align: center; padding: 44px 24px; border: 1.5px dashed var(--border); border-radius: var(--radius);
  color: var(--muted); background: color-mix(in srgb, var(--surface) 60%, transparent);
}
.empty svg { width: 34px; height: 34px; color: var(--brand-light); margin: 0 auto 10px; display: block; }
.empty b { display: block; color: var(--text); font-size: 16px; margin-bottom: 4px; }
.empty .btn { margin-top: 16px; }

/* ---------- Category & article ---------- */
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 13.5px; color: var(--muted); margin-bottom: 14px; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--brand); }
.crumbs svg { width: 14px; height: 14px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head h1 { font-size: clamp(30px, 4vw, 42px); font-weight: 800; letter-spacing: -.03em; }
.page-head .sub { margin: 8px 0 0; color: var(--muted); font-size: 14px; }
.subcats { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 24px; }

.article { background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: clamp(22px, 5vw, 52px); box-shadow: var(--shadow-sm); }
.prose { font-size: 17px; line-height: 1.72; color: var(--text-2); overflow-wrap: anywhere; }
.prose > :first-child { margin-top: 0; }
.prose h1, .prose h2, .prose h3 { color: var(--text); margin: 1.8em 0 .55em; }
.prose h1 { font-size: 30px; } .prose h2 { font-size: 25px; } .prose h3 { font-size: 20px; }
.prose p { margin: 0 0 1em; }
.prose ul, .prose ol { padding-left: 1.4em; margin: 0 0 1em; }
.prose li { margin: .25em 0; }
.prose li::marker { color: var(--brand-light); }
.prose img { border-radius: 12px; margin: 1.2em 0; height: auto; box-shadow: var(--shadow-sm); }
.prose a { font-weight: 500; text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--brand) 40%, transparent); text-underline-offset: 3px; }
.prose a.file-link, .prose a[href*="download="] {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; margin: 2px 0; border-radius: 10px;
  background: var(--brand-tint); text-decoration: none; font-weight: 600; font-size: 15px;
}
.prose blockquote { margin: 1.2em 0; padding: 14px 20px; border-left: 4px solid var(--brand-light); background: var(--surface-2); border-radius: 0 12px 12px 0; color: var(--text); }
.prose pre { background: var(--brand-deep); color: #d6ebfa; padding: 16px 18px; border-radius: 12px; overflow-x: auto; font-size: 14px; }
.prose code { font-size: .9em; }
.prose iframe, .prose .ql-video { width: 100%; aspect-ratio: 16 / 9; height: auto; border: 0; border-radius: 12px; margin: 1.2em 0; display: block; background: #000; }
.prose hr { border: 0; border-top: 1px solid var(--border); margin: 2em 0; }
.prose table { border-collapse: collapse; width: 100%; }
.prose td, .prose th { border: 1px solid var(--border); padding: 8px 10px; }
.meta { display: flex; flex-wrap: wrap; gap: 6px 16px; color: var(--muted); font-size: 13.5px; margin-top: 10px; }
.meta span { display: inline-flex; align-items: center; gap: 6px; }
.meta svg { width: 15px; height: 15px; }

/* ---------- Forms / editor ---------- */
.field { display: grid; gap: 6px; margin-bottom: 16px; }
.field label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.input, select.input, textarea.input {
  width: 100%; min-height: 44px; padding: 10px 14px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); outline: none;
}
textarea.input { min-height: 120px; resize: vertical; line-height: 1.55; }
.input:focus { border-color: var(--brand-light); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand-light) 20%, transparent); }
.title-input { font-family: var(--font-display); font-size: clamp(26px, 4vw, 36px); font-weight: 800; letter-spacing: -.03em; border: 0; padding: 4px 0; min-height: 0; background: transparent; box-shadow: none !important; }
.editor-bar {
  position: sticky; top: var(--topbar-h); z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 0; margin-bottom: 8px; background: var(--bg);
}
.editor-bar .status { color: var(--muted); font-size: 13px; }
.editor-card { background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: clamp(18px, 4vw, 40px); box-shadow: var(--shadow-sm); }
.editor-card .ql-toolbar.ql-snow {
  position: sticky; top: calc(var(--topbar-h) + 64px); z-index: 10; background: var(--surface);
  border: 1px solid var(--border); border-radius: 12px; padding: 8px; margin: 12px 0 0; display: flex; flex-wrap: wrap; gap: 2px;
}
.editor-card .ql-container.ql-snow { border: 0; font: inherit; }
.editor-card .ql-editor { min-height: 380px; padding: 24px 0 0; font-size: 17px; line-height: 1.72; color: var(--text-2); }
.editor-card .ql-editor.ql-blank::before { left: 0; right: 0; color: var(--muted); font-style: normal; }
.editor-card .ql-editor img { border-radius: 12px; display: inline-block; }
.editor-card .ql-editor .ql-video { width: 100%; aspect-ratio: 16 / 9; height: auto; border-radius: 12px; }
.editor-card .ql-editor h2 { font-size: 25px; } .editor-card .ql-editor h3 { font-size: 20px; }
.ql-snow .ql-stroke { stroke: var(--text-2); }
.ql-snow .ql-fill { fill: var(--text-2); }
.ql-snow .ql-picker { color: var(--text-2); }
.ql-snow.ql-toolbar button:hover .ql-stroke, .ql-snow.ql-toolbar button.ql-active .ql-stroke, .ql-snow .ql-picker-label:hover .ql-stroke { stroke: var(--brand); }
.ql-snow.ql-toolbar button:hover .ql-fill, .ql-snow.ql-toolbar button.ql-active .ql-fill { fill: var(--brand); }
.ql-snow.ql-toolbar button:hover, .ql-snow.ql-toolbar button.ql-active, .ql-snow .ql-picker-label:hover, .ql-snow .ql-picker-label.ql-active { color: var(--brand); }
.ql-snow .ql-picker-options { background: var(--surface); border-color: var(--border) !important; border-radius: 10px; box-shadow: var(--shadow); }
.ql-snow .ql-tooltip { background: var(--surface); color: var(--text); border-color: var(--border); border-radius: 10px; box-shadow: var(--shadow); z-index: 30; }
.ql-snow .ql-tooltip input[type=text] { background: var(--surface-2); color: var(--text); border-color: var(--border); border-radius: 6px; }
.ql-toolbar .ql-attach svg { width: 18px; height: 18px; }
.ql-toolbar button { width: 32px !important; height: 32px !important; border-radius: 8px; }
.ql-toolbar .ql-formats { margin-right: 8px !important; }

/* ---------- Dialog ---------- */
dialog {
  width: min(520px, calc(100vw - 32px)); border: 1px solid var(--border); border-radius: 18px; padding: 0;
  background: var(--surface); color: var(--text); box-shadow: 0 30px 80px -20px rgba(0,0,0,.4);
}
dialog::backdrop { background: rgba(7, 20, 28, .5); backdrop-filter: blur(3px); }
.dlg { padding: 24px; }
.dlg h2 { font-size: 20px; margin-bottom: 6px; }
.dlg p.hint { margin: 0 0 16px; color: var(--muted); font-size: 14px; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; flex-wrap: wrap; }

/* ---------- Manage ---------- */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow-sm); margin-bottom: 20px; }
.panel h2 { font-size: 19px; margin-bottom: 4px; }
.panel > p { margin: 0 0 16px; color: var(--muted); font-size: 14px; }
.row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--border); }
.row:first-of-type { border-top: 0; }
.row .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.row.child .grow { padding-left: 22px; }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.inline-form .input { flex: 1 1 200px; }
.tag { font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--brand-tint); color: var(--brand); font-weight: 600; }

/* ---------- Toast ---------- */
#toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; z-index: 100;
  background: var(--brand-deep); color: #fff; padding: 12px 18px; border-radius: 12px; font-size: 14px; font-weight: 500;
  box-shadow: var(--shadow); transition: opacity .2s, transform .2s; max-width: calc(100vw - 32px);
}
:root[data-theme="dark"] #toast { background: #e5eff6; color: #07141c; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }

.skeleton { background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 10px; }
@keyframes sk { to { background-position: -200% 0; } }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .search kbd { display: none; }
}
@media (max-width: 900px) {
  :root { --topbar-h: 60px; }
  .layout { grid-template-columns: minmax(0, 1fr); }
  .menu-btn { display: inline-grid; margin-left: -8px; }
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; height: 100%; width: min(86vw, 320px); z-index: 60;
    transform: translateX(-102%); transition: transform .25s ease; box-shadow: var(--shadow); padding-top: 16px;
  }
  .sidebar.open { transform: none; }
  .scrim { display: block; position: fixed; inset: 0; z-index: 55; background: rgba(7,20,28,.45); opacity: 0; pointer-events: none; transition: opacity .2s; }
  .scrim.open { opacity: 1; pointer-events: auto; }
  .hero { grid-template-columns: 1fr; }
  .hero-photo { order: -1; }
}
@media (max-width: 640px) {
  .topbar { padding: 0 12px; gap: 6px; }
  .topbar .brand span { display: none; }
  .search input { height: 40px; }
  .main { padding: 20px 16px 64px; }
  .hero { border-radius: 18px; padding: 22px 18px 26px; }
  .hero-photo { border-radius: 12px; }
  .section { margin-top: 32px; }
  .list-item { padding: 14px 16px; gap: 12px; }
  .list-item .li-meta { display: none; }
  .article { border-radius: 16px; padding: 20px 18px; }
  .prose { font-size: 16px; }
  .editor-bar { top: var(--topbar-h); }
  .editor-card .ql-toolbar.ql-snow { top: calc(var(--topbar-h) + 60px); }
  .editor-card .ql-toolbar .ql-formats { margin-right: 2px !important; }
  .page-head .btn { width: auto; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
.search input:focus ~ kbd, .search input:not(:placeholder-shown) ~ kbd { display: none; }
.user-chip {
  display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; padding: 4px 10px 4px 4px; border-radius: 999px; white-space: nowrap;
  background: var(--brand-tint); color: var(--brand); border: 1px solid color-mix(in srgb, var(--brand-light) 35%, transparent); max-width: 220px;
}
.user-chip img { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; }
.user-chip svg { width: 22px; height: 22px; }
.user-chip span { overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 640px) { .user-chip span { display: none; } .user-chip { padding: 4px; } }
.login { max-width: 440px; padding: 36px 32px; text-align: center; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: 0 10px 40px rgba(4, 19, 28, .08); margin: 16px; }
.login h1 { font-size: 24px; margin: 12px 0 8px; }
.login p { color: var(--muted); margin: 0 0 18px; }
.login .btn-google { display: inline-flex; align-items: center; gap: 10px; padding: 10px 18px; font-size: 15px; }
.login .hint { margin: 14px 0 0; font-size: 12px; }
.login-error { color: #b42318; background: #fef3f2; border: 1px solid #fecdca; border-radius: 10px; padding: 10px 12px; font-size: 14px; }
.login code { font-size: 13px; }
.role-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.role-row:last-child { border-bottom: 0; }
.super-panel { border-color: color-mix(in srgb, var(--brand-light) 55%, transparent); }
.super-panel h3 { font-size: 15px; margin: 16px 0 6px; }
.super-panel .ok { color: #157347; } .super-panel .bad { color: #b42318; } .super-panel .warn { color: #9a5b00; }
.sr-item b { display: flex; align-items: center; gap: 6px; }
.sr-icon { width: 15px; height: 15px; color: var(--muted); flex: none; }

/* ---------- Org chart ---------- */
.org-tools { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.org-filter { position: relative; }
.org-filter svg { position: absolute; left: 12px; top: 11px; width: 18px; height: 18px; color: var(--muted); pointer-events: none; }
.org-filter input { height: 40px; width: 260px; max-width: 100%; padding: 0 14px 0 38px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); outline: none; }
.org-filter input:focus { border-color: var(--brand-light); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand-light) 20%, transparent); }
.org-hint {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px 12px 16px; margin-bottom: 18px; border-radius: 14px;
  background: var(--brand-tint); color: var(--text-2); font-size: 14px; border: 1px solid color-mix(in srgb, var(--brand-light) 30%, transparent);
}
.org-hint > svg { width: 18px; height: 18px; color: var(--brand); flex: none; }
.org-hint span { flex: 1; }
.org-grid { columns: 330px; column-gap: 18px; }
.org-wide .dept.wide { margin-bottom: 18px; }
.dept.wide { container-type: inline-size; }
.dept.wide .plist { display: grid; grid-template-columns: repeat(2, 1fr); column-gap: 18px; }
@container (min-width: 900px) { .dept.wide .plist { grid-template-columns: repeat(4, 1fr); } }
.dept.wide .plist-empty { grid-column: 1 / -1; }
.dept {
  break-inside: avoid; margin: 0 0 18px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden; border-top: 4px solid var(--c);
}
.dept-head { display: flex; align-items: center; gap: 10px; padding: 16px 16px 8px 18px; }
.dept-head h2 { font-size: 18px; font-weight: 700; flex: 1; min-width: 0; }
.dept-dot { width: 10px; height: 10px; border-radius: 999px; background: var(--c); flex: none; }
.dept-count { font-size: 12px; font-weight: 600; color: var(--muted); background: var(--surface-2); padding: 2px 8px; border-radius: 999px; }
.team-menu { width: 32px; height: 32px; }
.team-menu svg { width: 18px; height: 18px; }
.subteam { border-top: 1px solid var(--border); margin-top: 4px; }
.subteam h3 {
  display: flex; align-items: center; gap: 8px; padding: 12px 16px 4px 18px;
  font: 700 12px/1.3 var(--font); text-transform: uppercase; letter-spacing: .07em; color: var(--muted);
}
.subteam h3 > span:first-child { flex: 1; }
.plist { list-style: none; margin: 0; padding: 4px 8px 10px; min-height: 8px; border-radius: 10px; transition: background .15s; }
.plist.drop-target { background: color-mix(in srgb, var(--c) 10%, transparent); outline: 2px dashed color-mix(in srgb, var(--c) 55%, transparent); outline-offset: -4px; }
.plist-empty { padding: 10px; font-size: 13px; color: var(--muted); font-style: italic; text-align: center; }
.person {
  display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 10px; cursor: pointer;
  transition: background .12s, opacity .15s;
}
.person:hover, .person:focus-visible { background: var(--surface-2); }
.person.dim { opacity: .28; }
.person.flash { animation: flash 1.8s ease; }
@keyframes flash { 0%, 40% { background: color-mix(in srgb, var(--brand-light) 28%, transparent); } }
.pav {
  width: 36px; height: 36px; border-radius: 999px; flex: none; display: grid; place-items: center;
  background: var(--c); color: #fff; font: 700 13px/1 var(--font-display); letter-spacing: .02em;
}
.pav { overflow: hidden; }
.pav img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pcard .pav-big { width: 92px; height: 92px; margin: 0 auto 12px; font-size: 30px; background: var(--c, var(--brand)); }
.pinfo { min-width: 0; flex: 1; }
.pinfo b { display: block; font-size: 14.5px; font-weight: 600; line-height: 1.3; }
.pinfo small { display: block; font-size: 13px; color: var(--muted); line-height: 1.35; }
.lead-tag { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 700; color: #b7791f; background: color-mix(in srgb, #f59e0b 14%, transparent); padding: 3px 8px; border-radius: 999px; flex: none; }
:root[data-theme="dark"] .lead-tag { color: #fbbf24; }
.lead-tag svg { width: 12px; height: 12px; }
.grip { width: 22px; height: 30px; flex: none; display: grid; place-items: center; color: var(--muted); cursor: grab; touch-action: none; border-radius: 6px; margin-left: -4px; }
.grip:hover { background: var(--surface-3); color: var(--text); }
.grip svg { width: 16px; height: 16px; }
.editing .person { cursor: pointer; }
.person.dragging { opacity: .35; }
.person.ghost {
  position: fixed; z-index: 200; pointer-events: none; background: var(--surface); box-shadow: 0 16px 40px -10px rgba(10,50,69,.4);
  border: 1px solid var(--border); transform: rotate(-1.5deg); cursor: grabbing;
}
.dept-actions { display: flex; gap: 4px; padding: 4px 10px 12px; border-top: 1px dashed var(--border); }

/* person sheet */
dialog.sheet { width: min(440px, calc(100vw - 32px)); }
.sheet-top { display: flex; justify-content: flex-end; margin: -10px -10px 0 0; }
.pcard { text-align: center; padding: 0 4px 8px; }
.pav-lg { width: 76px; height: 76px; font-size: 26px; margin: 0 auto 14px; }
.pcard h2 { font-size: 24px; margin-bottom: 4px; }
.ptitle { margin: 0 0 12px; color: var(--muted); }
.lead-chip { display: inline-flex; align-items: center; gap: 4px; color: #b7791f; background: color-mix(in srgb, #f59e0b 14%, transparent); }
.lead-chip svg { width: 12px; height: 12px; }
.pcontacts { display: grid; gap: 8px; margin-top: 18px; }
.pcontacts .btn { justify-content: flex-start; height: 44px; border-radius: 12px; overflow: hidden; }
.pcontacts .btn span { overflow: hidden; text-overflow: ellipsis; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; margin: 4px 0 16px; cursor: pointer; }
.check span { color: var(--muted); font-weight: 400; }
.check input { width: 18px; height: 18px; accent-color: var(--brand); }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch input { position: absolute; opacity: 0; pointer-events: none; }
.swatch span { display: block; width: 30px; height: 30px; border-radius: 999px; background: var(--c); cursor: pointer; box-shadow: inset 0 0 0 2px rgba(255,255,255,.25); }
.swatch input:checked + span { outline: 3px solid var(--c); outline-offset: 3px; }
.swatch input:focus-visible + span { outline: 3px solid var(--brand-light); outline-offset: 3px; }

@media (max-width: 640px) { .dept.wide .plist { display: block; } }
@media (max-width: 640px) {
  .org-tools { width: 100%; }
  .org-filter { flex: 1; }
  .org-filter input { width: 100%; }
  .org-hint { flex-wrap: wrap; }
  .field-row { grid-template-columns: 1fr; gap: 0; }
  dialog.sheet { margin: auto 0 0; width: 100vw; max-width: 100vw; border-radius: 20px 20px 0 0; border-bottom: 0; }
}
.flag { font-size: 17px; line-height: 1; letter-spacing: 0; vertical-align: -2px; margin-right: 4px; }
.team-chip { display: inline-flex; align-items: center; gap: 6px; }
.team-chip::before { content: ""; width: 8px; height: 8px; border-radius: 999px; background: var(--c); flex: none; }
.pcard { padding-top: 6px; }

/* ---------- Story page (e.g. Company History) ---------- */
.story {
  background: var(--surface); border: 1px solid var(--border); border-radius: 20px;
  padding: clamp(18px, 4vw, 44px); box-shadow: var(--shadow-sm); display: grid; gap: 28px;
}
.story .story-text { max-width: 760px; width: 100%; margin: 0 auto; }
.story-pics { display: grid; gap: 16px; }
.story-pics.count-2 { grid-template-columns: 1fr 1fr; }
.story-pics.count-2 .story-pic img { aspect-ratio: 3 / 2; object-fit: cover; }
.story-pics.count-1 .story-pic img, .layout-split .story-pic img { max-height: 520px; object-fit: cover; }
.story-pic { margin: 0; }
.story-pic img { width: 100%; height: auto; display: block; border-radius: 14px; box-shadow: var(--shadow-sm); }
.story-pic figcaption { margin-top: 8px; font-size: 13.5px; color: var(--muted); }
.layout-split .story-pic { max-width: 900px; width: 100%; margin: 0 auto; }
.seg { display: flex; flex-wrap: wrap; gap: 8px; }
.seg label { cursor: pointer; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: inline-block; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--border); font-size: 14px; font-weight: 600; color: var(--text-2); background: var(--surface); }
.seg input:checked + span { background: var(--brand-tint); border-color: var(--brand-light); color: var(--brand); }
.seg input:focus-visible + span { outline: 2px solid var(--brand-light); outline-offset: 2px; }
.story-edit-title { font-size: clamp(26px, 4vw, 34px); font-weight: 800; letter-spacing: -.03em; }
.pic-slots { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 8px; }
.pic-slot { display: grid; gap: 8px; align-content: start; }
.pic-add {
  aspect-ratio: 4 / 3; border: 1.5px dashed var(--border); border-radius: 14px; background: var(--surface-2);
  display: grid; place-content: center; justify-items: center; gap: 6px; color: var(--muted); font-weight: 600; font-size: 14px; cursor: pointer;
}
.pic-add:hover { border-color: var(--brand-light); color: var(--brand); }
.pic-add svg { width: 24px; height: 24px; }
.pic-preview { aspect-ratio: 4 / 3; border-radius: 14px; overflow: hidden; background: var(--surface-2); }
.pic-preview img { width: 100%; height: 100%; object-fit: cover; }
.pic-actions { display: flex; gap: 6px; }
@media (max-width: 560px) { .story-pics.count-2 { grid-template-columns: 1fr; } }
@media (max-width: 480px) { .pic-slots { grid-template-columns: 1fr; } }

/* ---------- Values page ---------- */
.v-hero {
  position: relative; overflow: hidden; border-radius: 24px; color: #fff; background: var(--hero-grad);
  padding: clamp(28px, 5vw, 60px); box-shadow: var(--shadow); isolation: isolate;
}
.v-hero { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 32px; }
.v-hero-in { position: relative; z-index: 1; max-width: 620px; }
.v-hero h2 { font-size: clamp(28px, 4.2vw, 46px); font-weight: 800; letter-spacing: -.035em; line-height: 1.08; margin: 0 0 18px; }
.v-hero p { margin: 0 0 10px; font-size: clamp(16px, 1.6vw, 18px); color: #cfe3f1; line-height: 1.6; }
.v-hero .v-closing { margin-top: 18px; font-size: clamp(18px, 2vw, 21px); font-weight: 700; color: #fff; }
.v-mark { grid-column: 2; grid-row: 1; position: relative; z-index: 0; width: clamp(150px, 20vw, 250px); height: auto; margin-right: clamp(0px, 2vw, 24px); transform: rotate(-8deg); filter: drop-shadow(0 24px 40px rgba(0,0,0,.4)); }
.v-hero > .v-hero-in { grid-column: 1; grid-row: 1; }
.v-float { position: absolute; z-index: 0; opacity: .55; }
.v-f1 { width: 38px; top: 28px; right: clamp(200px, 26vw, 330px); transform: rotate(18deg); }
.v-f2 { width: 22px; bottom: 30px; right: clamp(40px, 5vw, 70px); transform: rotate(-30deg); opacity: .45; }
.v-grid { list-style: none; padding: 0; margin: 26px 0 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.v-card {
  position: relative; overflow: hidden; background: var(--surface); border: 1px solid var(--border); border-radius: 20px;
  padding: 24px 26px 26px; box-shadow: var(--shadow-sm); transition: transform .18s, box-shadow .18s, border-color .18s;
}
.v-card::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 4px;
  background: linear-gradient(90deg, #57aceb, #2e6c94 60%, #0a3245); transform: scaleX(0); transform-origin: left; transition: transform .3s ease;
}
.v-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--brand-light) 40%, var(--border)); }
.v-card:hover::after { transform: scaleX(1); }
.v-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.v-num {
  font: 800 42px/1 var(--font-display); letter-spacing: -.05em;
  background: linear-gradient(135deg, #57aceb, #2e6c94 55%, #0a3245); -webkit-background-clip: text; background-clip: text; color: transparent;
}
:root[data-theme="dark"] .v-num { background-image: linear-gradient(135deg, #9fd2f7, #57aceb 60%, #2e6c94); }
.v-num.small { font-size: 22px; }
.v-shape { width: 34px; height: 34px; flex: none; }
.v-card:nth-child(4n + 2) .v-shape { transform: rotate(90deg); }
.v-card:nth-child(4n + 3) .v-shape { transform: rotate(-90deg); }
.v-card:nth-child(4n + 4) .v-shape { transform: rotate(180deg); }
.v-card h3 { font-size: 19px; font-weight: 700; line-height: 1.3; letter-spacing: -.015em; margin: 0 0 8px; }
.v-card p { margin: 0; font-size: 15.5px; line-height: 1.62; color: var(--text-2); }
.v-edit-list { display: grid; gap: 12px; margin-top: 6px; }
.v-edit { display: grid; gap: 8px; padding: 14px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface-2); }
.v-edit-head { display: flex; align-items: center; gap: 2px; }
.v-edit-head .icon-btn { width: 32px; height: 32px; }
.v-edit-head .icon-btn svg { width: 17px; height: 17px; }
.hint-small { color: var(--muted); font-size: 12.5px; }
@media (max-width: 760px) {
  .v-grid { grid-template-columns: minmax(0, 1fr); }
  .v-hero { grid-template-columns: minmax(0, 1fr); }
  .v-mark { position: absolute; width: 130px; right: -26px; top: -18px; opacity: .3; margin: 0; }
  .v-f1, .v-f2 { display: none; }
}

/* ---------- Timeline page ---------- */
.tl-intro p { margin: 10px 0 0; font-size: 18px; color: var(--muted); font-style: italic; }
.tl-pics { margin-bottom: 8px; }
.tl { list-style: none; margin: 34px 0 0; padding: 30px 0; position: relative; }
.tl::before { /* the soft track */
  content: ""; position: absolute; top: 0; bottom: 0; left: 50%; width: 46px; transform: translateX(-50%);
  border-radius: 23px; background: linear-gradient(180deg, color-mix(in srgb, #57aceb 26%, transparent), color-mix(in srgb, #2e6c94 22%, transparent));
}
.tl::after { /* the thin centre line with dashed ends */
  content: ""; position: absolute; top: -26px; bottom: -26px; left: 50%; width: 2px; transform: translateX(-50%);
  background: linear-gradient(180deg, transparent 0, var(--brand-deep) 26px, var(--brand-deep) calc(100% - 26px), transparent 100%);
}
:root[data-theme="dark"] .tl::after { background: linear-gradient(180deg, transparent 0, #8ccaf5 26px, #8ccaf5 calc(100% - 26px), transparent 100%); }
.tl-cap { height: 0; }
.tl-item {
  position: relative; z-index: 1; display: grid; grid-template-columns: minmax(0, 1fr) 136px 46px 136px minmax(0, 1fr);
  align-items: center; min-height: 170px;
}
.tl-item + .tl-item { margin-top: -46px; }
.tl-dot { grid-column: 3; justify-self: center; width: 14px; height: 14px; border-radius: 999px; background: var(--surface); border: 3px solid var(--ring); position: relative; box-shadow: 0 0 0 4px color-mix(in srgb, var(--ring) 18%, transparent); }
.tl-dot::before { content: ""; position: absolute; top: 50%; height: 2px; width: 30px; background: var(--brand-deep); transform: translateY(-50%); }
:root[data-theme="dark"] .tl-dot::before { background: #8ccaf5; }
.tl-item.left .tl-dot::before { right: 100%; }
.tl-item.right .tl-dot::before { left: 100%; }
.tl-ring {
  width: 124px; height: 124px; border-radius: 999px; padding: 10px; justify-self: center;
  background: linear-gradient(145deg, var(--ring), color-mix(in srgb, var(--ring) 60%, #0a3245));
  box-shadow: 0 14px 30px -12px color-mix(in srgb, var(--ring) 70%, transparent);
}
.tl-ring span { width: 100%; height: 100%; border-radius: 999px; background: var(--surface); display: grid; place-items: center; box-shadow: inset 0 3px 10px rgba(10,50,69,.12); }
.tl-ring svg { width: 42px; height: 42px; }
.tl-year { font: 800 44px/1 var(--font-display); letter-spacing: -.03em; color: var(--brand-deep); }
:root[data-theme="dark"] .tl-year { color: #e5eff6; }
.tl-content h3 { font: 800 15px/1.3 var(--font); text-transform: uppercase; letter-spacing: .07em; color: var(--ring); margin: 0 0 8px; }
:root[data-theme="dark"] .tl-content h3 { color: color-mix(in srgb, var(--ring) 70%, #fff); }
.tl-content p { margin: 0 0 8px; font-size: 15.5px; line-height: 1.62; color: var(--text-2); }
.tl-year-sm { display: none; }
.tl-item.left .tl-content { grid-column: 1; text-align: right; padding-right: 8px; }
.tl-item.left .tl-ring { grid-column: 2; }
.tl-item.left .tl-year { grid-column: 4; justify-self: start; padding-left: 14px; }
.tl-item.right .tl-year { grid-column: 2; justify-self: end; padding-right: 14px; }
.tl-item.right .tl-ring { grid-column: 4; }
.tl-item.right .tl-content { grid-column: 5; padding-left: 8px; }
.tl-item > * { grid-row: 1; }
.tl-end { position: relative; z-index: 1; display: flex; justify-content: center; padding-top: 22px; }
.tl-end img { width: 44px; height: auto; filter: drop-shadow(0 8px 16px rgba(10,50,69,.25)); }
.tl-endpic { max-width: 900px; margin: 30px auto 0; }
.tl-edit-row { display: flex; gap: 8px; }
.tl-icons { display: flex; flex-wrap: wrap; gap: 6px; }
.tl-icons input { position: absolute; opacity: 0; pointer-events: none; }
.tl-icons span { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; border: 1px solid var(--border); background: var(--surface); color: var(--muted); cursor: pointer; }
.tl-icons span svg { width: 20px; height: 20px; }
.tl-icons input:checked + span { color: var(--brand); border-color: var(--brand-light); background: var(--brand-tint); }
.tl-icons input:focus-visible + span { outline: 2px solid var(--brand-light); outline-offset: 2px; }
@media (max-width: 860px) {
  .tl::before { left: 34px; width: 30px; }
  .tl::after { left: 34px; }
  .tl-item { grid-template-columns: 68px minmax(0, 1fr); min-height: 0; padding: 14px 0; align-items: start; }
  .tl-item + .tl-item { margin-top: 0; }
  .tl-item .tl-ring, .tl-item.right .tl-ring, .tl-item.left .tl-ring { grid-column: 1; width: 64px; height: 64px; padding: 6px; justify-self: center; }
  .tl-ring svg { width: 24px; height: 24px; }
  .tl-item .tl-content, .tl-item.left .tl-content, .tl-item.right .tl-content { grid-column: 2; text-align: left; padding: 4px 0 0 12px; }
  .tl-dot, .tl-year { display: none; }
  .tl-year-sm { display: block; font: 800 24px/1.1 var(--font-display); color: var(--brand-deep); margin-bottom: 4px; letter-spacing: -.02em; }
  :root[data-theme="dark"] .tl-year-sm { color: #e5eff6; }
  .tl-end { justify-content: flex-start; padding-left: 12px; }
}
.tl-letter { font: 800 50px/1 var(--font-display); letter-spacing: -.02em; }
.tl-letter-opt { font: 800 14px/1 var(--font-display); }
.tl-letter-in { width: 64px; min-height: 36px; padding: 6px 10px; text-align: center; font-weight: 800; }
@media (max-width: 860px) { .tl-letter { font-size: 28px; } }

/* ---------- File previews ---------- */
.file-card { margin: 1.6em 0; border: 1px solid var(--border); border-radius: 16px; overflow: hidden; background: var(--surface); box-shadow: var(--shadow-sm); }
.fc-head { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--border); background: var(--surface-2); flex-wrap: wrap; }
.fc-badge { flex: none; min-width: 44px; height: 44px; padding: 0 6px; border-radius: 10px; display: grid; place-items: center; background: var(--fc); color: #fff; font: 800 12px/1 var(--font-display); letter-spacing: .04em; }
.fc-name { flex: 1; min-width: 160px; }
.fc-name b { display: block; font-size: 15px; color: var(--text); overflow-wrap: anywhere; }
.fc-name small { color: var(--muted); font-size: 13px; }
.fc-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.prose .fc-actions a { text-decoration: none; font-weight: 600; }
.fc-body { background: var(--surface); }
.fc-pdf { display: block; width: 100%; height: min(85vh, 1100px); border: 0; margin: 0; border-radius: 0; background: #525659; aspect-ratio: auto; }
.prose .fc-pdf { aspect-ratio: auto; height: min(85vh, 1100px); }
.fc-img { display: block; width: 100%; height: auto; margin: 0 !important; border-radius: 0 !important; box-shadow: none !important; }
.fc-video { display: block; width: 100%; max-height: 80vh; background: #000; }
.fc-audio { display: block; width: calc(100% - 28px); margin: 16px 14px; }
.fc-text { margin: 0; padding: 18px 20px; max-height: 70vh; overflow: auto; font-size: 14px; line-height: 1.55; white-space: pre-wrap; background: var(--surface) !important; color: var(--text-2) !important; border-radius: 0 !important; }
.fc-doc-wrap { background: var(--surface-3); padding: clamp(10px, 3vw, 28px); max-height: 85vh; overflow: auto; }
.fc-doc { background: #fff; color: #1b2733; max-width: 820px; margin: 0 auto; padding: clamp(22px, 5vw, 56px); border-radius: 6px; box-shadow: 0 6px 24px -8px rgba(10,50,69,.25); font-size: 16px; }
.fc-doc h1, .fc-doc h2, .fc-doc h3 { color: #0b2230; }
.fc-doc table { border-collapse: collapse; }
.fc-doc td, .fc-doc th { border: 1px solid #d5dee6; padding: 6px 8px; }
.fc-tabs { display: flex; gap: 4px; padding: 8px 10px 0; background: var(--surface-2); overflow-x: auto; border-bottom: 1px solid var(--border); }
.fc-tab { border: 1px solid transparent; border-bottom: 0; background: none; padding: 7px 12px; border-radius: 8px 8px 0 0; font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer; white-space: nowrap; }
.fc-tab.on { background: var(--surface); border-color: var(--border); color: var(--text); }
.fc-sheet { max-height: 75vh; overflow: auto; }
.fc-sheet table { border-collapse: separate; border-spacing: 0; font-size: 14px; min-width: 100%; }
.fc-sheet td, .fc-sheet th { border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 7px 10px; white-space: nowrap; color: var(--text-2); }
.fc-sheet tr:first-child td { position: sticky; top: 0; background: var(--surface-2); font-weight: 700; color: var(--text); z-index: 1; }
.fc-sheet tr:nth-child(even) td { background: color-mix(in srgb, var(--surface-2) 45%, transparent); }
.fc-note { padding: 22px 20px; color: var(--muted); font-size: 14.5px; }
.file-card:fullscreen { border-radius: 0; display: flex; flex-direction: column; }
.file-card:fullscreen .fc-body { flex: 1; overflow: auto; }
.file-card:fullscreen .fc-pdf, .file-card:fullscreen .fc-doc-wrap, .file-card:fullscreen .fc-sheet, .file-card:fullscreen .fc-text { height: 100%; max-height: none; }
.file-card:fullscreen .fc-img, .file-card:fullscreen .fc-video { max-height: 100%; object-fit: contain; }
@media (max-width: 640px) { .fc-pdf, .prose .fc-pdf { height: 75vh; } .fc-actions { width: 100%; } }

/* ---------- Rotating section photo ---------- */
.section-photo { position: relative; margin: 28px 0 0; }
.section-photo img { display: block; width: 100%; max-height: 520px; object-fit: cover; border-radius: 20px; box-shadow: var(--shadow); animation: photoIn .5s ease; }
@keyframes photoIn { from { opacity: 0; transform: scale(.985); } }
.section-photo-edit { position: absolute; right: 14px; bottom: 14px; background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(6px); }
.section-photo:not(:has(img)) .section-photo-edit { position: static; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; margin-bottom: 8px; }
.photo-th { position: relative; aspect-ratio: 4 / 3; border-radius: 10px; overflow: hidden; background: var(--surface-2); }
.photo-th img { width: 100%; height: 100%; object-fit: cover; }
.photo-th.off img { opacity: .35; filter: grayscale(1); }
.photo-on { position: absolute; left: 6px; bottom: 6px; display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; padding: 3px 8px; border-radius: 999px; background: rgba(255,255,255,.92); color: #10242f; cursor: pointer; }
.photo-on input { margin: 0; }
.photo-builtin { position: absolute; right: 6px; top: 6px; font-size: 11px; padding: 2px 7px; border-radius: 999px; background: rgba(0,0,0,.55); color: #fff; }
.hero.no-photo { grid-template-columns: 1fr; }
/* media library */
.lib-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 10px; }
.lib-tags .chip { cursor: pointer; border: 1px solid var(--border); background: var(--surface); }
.lib-tags .chip.on { background: var(--brand); color: var(--on-brand); border-color: var(--brand); }
.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; max-height: 50vh; overflow: auto; padding: 2px; }
.lib-item { display: block; padding: 0; border: 2px solid transparent; border-radius: 10px; background: var(--surface-2); overflow: hidden; cursor: pointer; text-align: left; font: inherit; color: inherit; }
.lib-item img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; }
.lib-item span { display: block; font-size: 12px; padding: 5px 7px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lib-item.on { border-color: var(--brand-light); box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand-light) 35%, transparent); }
.lib-page-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.lib-card { border: 1px solid var(--border); border-radius: 12px; background: var(--surface); padding: 10px; display: grid; gap: 6px; }
.lib-thumb { aspect-ratio: 4 / 3; border-radius: 8px; overflow: hidden; background: var(--surface-2); }
.lib-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.lib-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 28px; }
.choose-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 6px 0 4px; }
.choose-card { display: grid; justify-items: center; gap: 6px; padding: 18px 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); cursor: pointer; font: inherit; color: inherit; text-align: center; }
.choose-card:hover { background: var(--surface-2); border-color: var(--brand-light); }
.choose-card svg { width: 26px; height: 26px; color: var(--brand); }
.choose-card b { font-size: 15px; } .choose-card span { font-size: 12.5px; color: var(--muted); }
@media (max-width: 520px) { .choose-grid { grid-template-columns: 1fr; } }
.photo-th .icon-btn { position: absolute; top: 4px; right: 4px; width: 28px; height: 28px; background: rgba(7,20,28,.6); color: #fff; }
.photo-th .icon-btn svg { width: 14px; height: 14px; }
