:root {
  --bg: #f5f6f8;
  --bg-soft: #eef0f3;
  --panel: #ffffff;
  --panel-2: #fafafa;
  --panel-3: #f1f3f5;
  --line: rgba(20,24,31,.10);
  --line-strong: rgba(20,24,31,.17);
  --text: #18191d;
  --muted: #6f737c;
  --muted-2: #9498a1;
  --gold: #c3a048;
  --gold-2: #9a7622;
  --gold-deep: #b38d33;
  --red: #c42032;
  --red-soft: rgba(196,32,50,.08);
  --success: #2f9e62;
  --shadow: 0 24px 70px rgba(17,24,39,.12);
  --shadow-soft: 0 10px 32px rgba(17,24,39,.08);
  --radius-xl: 24px;
  --radius-lg: 18px;
  --radius-md: 14px;
  --radius-sm: 10px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button, .process-card, .doc-card, .letter-btn, .nav-item { transition: .18s ease; }
svg { width: 1em; height: 1em; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.hidden { display: none !important; }

.brand-rail {
  position: fixed;
  z-index: 500;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
}
.brand-rail span:nth-child(1) { background: #050505; }
.brand-rail span:nth-child(2) { background: var(--red); }
.brand-rail span:nth-child(3) { background: var(--gold); }

/* Authentication */
.auth-screen {
  min-height: 100vh;
  display: grid;
  place-items: stretch;
  background:
    radial-gradient(circle at 12% 18%, rgba(201,168,77,.10), transparent 24%),
    radial-gradient(circle at 88% 78%, rgba(196,32,50,.055), transparent 24%),
    #f7f7f6;
}
.auth-layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(460px, .75fr);
}
.auth-layout.single-card { display: grid; place-items: center; padding: 28px; }
.auth-showcase {
  min-width: 0;
  padding: clamp(40px, 5vw, 76px);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  border-right: 1px solid var(--line);
}
.auth-showcase::before {
  content: "";
  position: absolute;
  inset: 8% 6% auto auto;
  width: 430px;
  height: 430px;
  border: 1px solid rgba(201,168,77,.08);
  border-radius: 50%;
  box-shadow: 0 0 0 70px rgba(201,168,77,.018), 0 0 0 140px rgba(201,168,77,.012);
  pointer-events: none;
}
.showcase-topline, .showcase-footer { position: relative; z-index: 1; display: flex; justify-content: space-between; align-items: center; gap: 20px; }
.auth-brand { display: flex; align-items: center; gap: 13px; }
.auth-brand-showcase { margin: 0; }
.security-badge {
  display: inline-flex;
  align-items: center;
  padding: 8px 11px;
  border-radius: 999px;
  border: 1px solid rgba(201,168,77,.18);
  background: rgba(201,168,77,.055);
  color: var(--gold-2);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .11em;
  text-transform: uppercase;
}
.showcase-copy { position: relative; z-index: 1; max-width: 810px; margin: auto 0; padding: 70px 0; }
.showcase-copy h1 {
  margin: 14px 0 22px;
  font-size: clamp(46px, 5.4vw, 82px);
  line-height: .98;
  letter-spacing: -.048em;
  font-weight: 780;
}
.showcase-copy p { max-width: 690px; margin: 0; color: #aaaab2; font-size: 17px; line-height: 1.75; }
.showcase-feature-grid { position: relative; z-index: 1; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; max-width: 760px; margin-bottom: 48px; }
.showcase-feature {
  padding: 18px;
  border: 1px solid var(--line);
  background: rgba(17,24,39,.03);
  border-radius: 16px;
}
.feature-number { display: block; margin-bottom: 20px; color: var(--gold-2); font: 700 10px/1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .12em; }
.showcase-feature strong { font-size: 14px; }
.showcase-feature p { margin: 7px 0 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.showcase-footer { color: var(--muted-2); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }
.auth-form-side { display: grid; place-items: center; padding: clamp(30px, 5vw, 70px); background: rgba(255,255,255,.012); }
.auth-card { width: min(430px, 100%); }
.setup-card {
  width: min(620px, 100%);
  padding: 38px;
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
}
.login-card h2 { margin: 10px 0 10px; font-size: 36px; letter-spacing: -.035em; }
.mobile-auth-brand { display: none; align-items: center; gap: 12px; margin-bottom: 40px; }
.auth-intro, .auth-help { color: var(--muted); line-height: 1.65; }
.auth-intro { margin: 0; }
.auth-help { font-size: 12px; margin: 18px 0 0; }
.login-form { display: grid; gap: 17px; margin-top: 30px; }
.login-form label { display: grid; gap: 8px; }
.login-form label > span, .field label { color: #b4b4bb; font-size: 11px; font-weight: 700; letter-spacing: .01em; }
.input-shell { position: relative; }
.input-shell > svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: #6e6e77; pointer-events: none; }
.login-form input {
  width: 100%;
  height: 50px;
  padding: 0 14px 0 44px;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  color: var(--text);
  background: #ffffff;
  outline: none;
}
.login-form input::placeholder { color: #55555e; }
.login-form input:focus { border-color: rgba(201,168,77,.7); box-shadow: 0 0 0 4px rgba(201,168,77,.08); }
.login-submit { height: 50px; margin-top: 2px; display: flex; align-items: center; justify-content: space-between; padding: 0 18px; }
.form-error { padding: 11px 12px; border: 1px solid rgba(196,32,50,.38); background: var(--red-soft); color: #a61b2b; border-radius: 10px; font-size: 12px; }
.auth-access-note { display: flex; align-items: center; gap: 9px; margin-top: 23px; color: var(--muted-2); font-size: 11px; }
.lock-dot { color: var(--success); font-size: 8px; }
.setup-code { margin-top: 22px; border: 1px solid var(--line); background: #f7f8fa; color: var(--gold-2); padding: 14px 16px; border-radius: 11px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.auth-card code { color: var(--gold-2); }

/* Brand */
.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  color: #111111;
  background: linear-gradient(145deg, #e2c46e, #ad8732);
  font-weight: 900;
  font-size: 18px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.18), 0 8px 22px rgba(201,168,77,.12);
}
.brand-mark.large { width: 48px; height: 48px; border-radius: 15px; font-size: 20px; }
.brand-name { font-size: 18px; font-weight: 800; letter-spacing: -.015em; }
.brand-subtitle { color: var(--muted); font-size: 10px; margin-top: 3px; }
.eyebrow { color: var(--muted-2); text-transform: uppercase; letter-spacing: .145em; font-size: 9px; font-weight: 800; }
.eyebrow.gold { color: var(--gold-2); }

/* Buttons */
.btn {
  min-height: 40px;
  border-radius: 11px;
  border: 1px solid transparent;
  padding: 0 14px;
  font-weight: 760;
  font-size: 12px;
  color: var(--text);
  background: var(--panel-3);
  box-shadow: none;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary { color: #111; background: linear-gradient(135deg, var(--gold-2), var(--gold)); box-shadow: 0 8px 24px rgba(201,168,77,.12); }
.btn-primary:hover { filter: brightness(1.05); }
.btn-secondary { background: #f5f6f8; border-color: var(--line-strong); }
.btn-secondary:hover, .btn-ghost:hover { background: #eceff2; border-color: rgba(201,168,77,.25); }
.btn-ghost { background: transparent; border-color: var(--line); }
.btn-danger-ghost { color: #b42335; background: transparent; border-color: rgba(196,32,50,.28); }
.btn-small { min-height: 32px; padding: 0 10px; border-radius: 9px; font-size: 11px; }
.btn-wide { width: 100%; }
.icon-btn { width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 10px; background: transparent; color: var(--muted); display: grid; place-items: center; padding: 0; }
.icon-btn svg { width: 16px; height: 16px; }
.icon-btn:hover { color: var(--text); background: rgba(17,24,39,.045); }

/* Shell */
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 280px minmax(0,1fr); }
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px 17px 18px;
  border-right: 1px solid var(--line);
  background: #ffffff;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  z-index: 20;
}
.brand-block { display: flex; gap: 12px; align-items: center; padding: 3px 8px 20px; }
.sidebar-divider { height: 1px; background: var(--line); margin: 0 6px 20px; }
.sidebar-label { margin: 0 11px 10px; color: #575760; text-transform: uppercase; letter-spacing: .14em; font-size: 9px; font-weight: 800; }
.nav-list { display: grid; gap: 7px; }
.nav-item {
  width: 100%;
  border: 1px solid transparent;
  color: var(--muted);
  background: transparent;
  padding: 11px;
  border-radius: 13px;
  display: flex;
  align-items: center;
  gap: 11px;
  text-align: left;
}
.nav-item:hover { background: rgba(255,255,255,.032); color: var(--text); }
.nav-item.active { background: linear-gradient(90deg, rgba(201,168,77,.105), rgba(201,168,77,.035)); color: var(--text); border-color: rgba(201,168,77,.16); }
.nav-icon { width: 36px; height: 36px; flex: 0 0 36px; display: grid; place-items: center; border-radius: 10px; background: rgba(255,255,255,.035); color: var(--muted); }
.nav-icon svg { width: 17px; height: 17px; }
.nav-item.active .nav-icon { color: var(--gold-2); background: rgba(201,168,77,.08); }
.nav-copy { min-width: 0; display: grid; gap: 3px; }
.nav-copy strong { font-size: 12px; font-weight: 750; }
.nav-copy small { color: #63636c; font-size: 9px; }
.sidebar-footer { display: grid; gap: 10px; }
.system-status-card { padding: 13px; border: 1px solid var(--line); border-radius: 13px; background: #fafafa; }
.system-status-title { display: flex; align-items: center; gap: 8px; font-size: 10px; font-weight: 750; }
.system-status-copy { color: #61616b; font-size: 9px; line-height: 1.5; margin-top: 6px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 4px rgba(101,211,145,.07); }
.user-card { min-width: 0; display: grid; grid-template-columns: 36px minmax(0,1fr) 34px; gap: 10px; align-items: center; padding: 9px; border: 1px solid var(--line); border-radius: 13px; background: #ffffff; }
.avatar { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: #f4efe2; color: var(--gold-2); border: 1px solid rgba(201,168,77,.14); font-size: 12px; font-weight: 850; }
.user-card-copy { min-width: 0; display: grid; gap: 3px; }
.user-card-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.user-role { color: var(--gold-2); font-size: 9px; text-transform: capitalize; }
.logout-btn { margin: 0; }

.main-area {
  min-width: 0;
  padding: 34px clamp(24px, 3vw, 46px) 70px;
  background:
    radial-gradient(circle at 95% 0%, rgba(201,168,77,.10), transparent 24%),
    var(--bg);
}
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.topbar-title h1 { margin: 5px 0 0; font-size: 28px; letter-spacing: -.035em; }
.topbar-actions { display: flex; align-items: center; gap: 9px; }
.sync-pill { display: inline-flex; align-items: center; gap: 7px; border: 1px solid rgba(101,211,145,.16); background: rgba(101,211,145,.045); color: #8edba9; padding: 9px 11px; border-radius: 999px; font-size: 9px; font-weight: 800; white-space: nowrap; }
.sync-pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--success); }
.sync-pill.warning { border-color: rgba(196,32,50,.25); background: rgba(196,32,50,.05); color: #ffadb6; }
.sync-pill.warning::before { background: #e85c6b; }

/* Main views */
.view { display: none; }
.active-view { display: block; }
.hero-panel {
  min-height: 220px;
  padding: clamp(26px, 3vw, 38px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 36px;
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(201,168,77,.14);
  border-radius: var(--radius-xl);
  background:
    linear-gradient(120deg, rgba(201,168,77,.055), transparent 38%),
    linear-gradient(145deg, #ffffff, #faf9f5 68%);
  box-shadow: var(--shadow-soft);
}
.hero-panel::after {
  content: "";
  position: absolute;
  width: 360px;
  height: 360px;
  right: -190px;
  top: -180px;
  border-radius: 50%;
  border: 1px solid rgba(201,168,77,.07);
  box-shadow: 0 0 0 70px rgba(201,168,77,.018), 0 0 0 140px rgba(201,168,77,.01);
}
.hero-copy { position: relative; z-index: 2; max-width: 760px; }
.hero-copy h2 { margin: 10px 0 14px; font-size: clamp(32px, 3.2vw, 52px); line-height: 1.02; letter-spacing: -.045em; font-weight: 780; }
.hero-copy h2 span { color: #b7b6b0; }
.hero-copy p { color: var(--muted); max-width: 720px; line-height: 1.7; margin: 0; font-size: 13px; }
.hero-visual { width: 260px; height: 160px; flex: 0 0 260px; position: relative; z-index: 2; }
.hero-node { position: absolute; width: 62px; height: 62px; border-radius: 17px; display: grid; place-items: center; border: 1px solid rgba(201,168,77,.25); background: #ffffff; box-shadow: 0 12px 28px rgba(17,24,39,.10); }
.hero-node span { color: var(--gold-2); font-size: 11px; font-weight: 850; }
.hero-node-1 { left: 0; top: 49px; }
.hero-node-2 { left: 99px; top: 0; }
.hero-node-3 { right: 0; bottom: 0; }
.hero-line { position: absolute; height: 1px; background: linear-gradient(90deg, rgba(201,168,77,.15), rgba(201,168,77,.55)); transform-origin: left center; }
.hero-line-1 { width: 83px; left: 56px; top: 61px; transform: rotate(-23deg); }
.hero-line-2 { width: 89px; left: 151px; top: 67px; transform: rotate(36deg); }
.wiki-letter-art { width: 230px; height: 130px; flex: 0 0 230px; position: relative; z-index: 2; display: flex; align-items: center; justify-content: center; gap: 9px; border: 1px solid rgba(201,168,77,.15); border-radius: 22px; background: rgba(201,168,77,.035); }
.wiki-letter-art span { color: var(--gold-2); font-size: 42px; font-weight: 900; letter-spacing: -.08em; }
.wiki-letter-art span:nth-child(2) { color: #4d4b43; font-size: 28px; }

.toolbar { margin: 18px 0; display: flex; gap: 10px; align-items: center; }
.search-wrap { flex: 1; position: relative; }
.search-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: #65656e; }
.search-wrap input, .select-control, .field input, .field select, .field textarea {
  width: 100%;
  color: var(--text);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: none;
}
.search-wrap input { height: 44px; padding: 0 14px 0 42px; }
.search-wrap input::placeholder { color: #5d5d66; }
.select-control { width: 210px; height: 44px; padding: 0 13px; color: #b4b4bc; }
.search-wrap input:focus, .select-control:focus, .field input:focus, .field select:focus, .field textarea:focus { border-color: rgba(201,168,77,.55); box-shadow: 0 0 0 3px rgba(201,168,77,.065); }

.content-grid.process-layout { display: grid; grid-template-columns: minmax(260px, 330px) minmax(0,1fr); gap: 16px; }
.panel { background: rgba(18,18,20,.88); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-soft); }
.process-list-panel { overflow: hidden; }
.panel-heading { display: flex; justify-content: space-between; align-items: center; padding: 18px; border-bottom: 1px solid var(--line); }
.panel-heading h3 { margin: 5px 0 0; font-size: 15px; }
.count-badge { min-width: 31px; height: 27px; padding: 0 9px; border-radius: 999px; display: grid; place-items: center; background: rgba(201,168,77,.07); border: 1px solid rgba(201,168,77,.12); color: var(--gold-2); font-size: 10px; font-weight: 850; }
.process-list { padding: 8px; display: grid; gap: 6px; max-height: 680px; overflow: auto; }
.process-card { width: 100%; color: var(--text); text-align: left; border: 1px solid transparent; border-radius: 12px; padding: 13px; background: transparent; }
.process-card:hover { background: rgba(255,255,255,.025); border-color: var(--line); }
.process-card.active { background: linear-gradient(100deg, rgba(201,168,77,.09), rgba(201,168,77,.025)); border-color: rgba(201,168,77,.18); }
.process-card-top { display: flex; justify-content: space-between; gap: 11px; align-items: flex-start; }
.process-card h4 { margin: 0; font-size: 12px; line-height: 1.4; }
.process-card p { margin: 6px 0 0; color: #777780; font-size: 10px; line-height: 1.5; }
.tag { display: inline-flex; align-items: center; padding: 5px 7px; border-radius: 999px; background: #f1f3f5; color: var(--muted); font-size: 8px; white-space: nowrap; }
.tag.gold { color: var(--gold-2); background: rgba(201,168,77,.06); border: 1px solid rgba(201,168,77,.12); }

.flow-panel { min-height: 560px; padding: 24px; position: relative; overflow: visible; }
.empty-state { text-align: center; color: var(--muted); }
.large-empty { min-height: 510px; display: grid; place-items: center; align-content: center; }
.empty-icon { width: 58px; height: 58px; border-radius: 17px; display: grid; place-items: center; margin: 0 auto 15px; background: #f5f6f8; color: var(--gold-2); border: 1px solid rgba(201,168,77,.12); }
.empty-icon svg { width: 25px; height: 25px; }
.empty-state h3 { color: var(--text); margin: 0 0 7px; font-size: 15px; }
.empty-state p { max-width: 430px; margin: 0 auto 17px; line-height: 1.55; font-size: 11px; }
.flow-header { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; margin-bottom: 28px; padding-bottom: 19px; border-bottom: 1px solid var(--line); }
.flow-header h2 { margin: 6px 0 8px; font-size: 26px; letter-spacing: -.03em; }
.flow-header p { margin: 0; color: var(--muted); max-width: 680px; line-height: 1.55; font-size: 11px; }
.flow-actions { display: flex; gap: 7px; flex-wrap: wrap; }
.flowchart { position: relative; display: grid; gap: 0; padding: 6px 0 30px; }
.flow-step-wrap { position: relative; display: grid; justify-items: center; }
.flow-step-wrap:not(:last-child)::after { content: ""; width: 1px; height: 28px; background: linear-gradient(var(--gold-deep), #343438); margin: 6px 0; }
.flow-step {
  width: min(100%, 650px);
  border: 1px solid var(--line-strong);
  border-radius: 15px;
  background: linear-gradient(145deg, #ffffff, #fbfbfc);
  padding: 15px 16px;
  position: relative;
  cursor: pointer;
}
.flow-step::before { content: ""; position: absolute; left: -1px; top: 17px; bottom: 17px; width: 2px; background: transparent; border-radius: 999px; }
.flow-step:hover { transform: translateY(-2px); border-color: rgba(201,168,77,.35); box-shadow: 0 14px 34px rgba(17,24,39,.12); }
.flow-step:hover::before { background: var(--gold); }
.flow-step-top { display: flex; gap: 12px; align-items: center; }
.flow-step-index { width: 31px; height: 31px; flex: 0 0 31px; border-radius: 10px; display: grid; place-items: center; background: rgba(201,168,77,.09); border: 1px solid rgba(201,168,77,.16); color: var(--gold-2); font-weight: 900; font-size: 9px; }
.flow-step h4 { margin: 0; flex: 1; font-size: 12px; }
.flow-step-type { color: #71717a; font-size: 9px; text-transform: uppercase; letter-spacing: .08em; }
.flow-step-summary { color: #777780; font-size: 10px; line-height: 1.5; margin: 8px 0 0 43px; }
.step-tooltip { position: absolute; z-index: 50; left: calc(100% + 13px); top: -8px; width: 330px; padding: 16px; border-radius: 14px; background: #ffffff; border: 1px solid rgba(201,168,77,.22); box-shadow: var(--shadow); display: none; }
.step-tooltip::before { content: ""; position: absolute; left: -6px; top: 24px; width: 10px; height: 10px; transform: rotate(45deg); background: #ffffff; border-left: 1px solid rgba(201,168,77,.22); border-bottom: 1px solid rgba(201,168,77,.22); }
.flow-step:hover .step-tooltip { display: block; }
.tooltip-title { font-weight: 800; margin-bottom: 13px; font-size: 12px; }
.tooltip-grid { display: grid; grid-template-columns: 104px minmax(0,1fr); gap: 8px 10px; font-size: 10px; }
.tooltip-grid span:nth-child(odd) { color: #6f6f78; }
.tooltip-grid strong { font-weight: 650; color: #d8d7d2; overflow-wrap: anywhere; }
.tooltip-link { margin-top: 13px; padding-top: 11px; border-top: 1px solid var(--line); color: var(--gold-2); font-size: 10px; font-weight: 800; }

/* Wiki */
.alphabet-nav { display: flex; flex-wrap: wrap; gap: 6px; margin: 18px 0; position: sticky; top: 8px; z-index: 10; padding: 10px; border-radius: 13px; background: rgba(255,255,255,.94); backdrop-filter: blur(16px); border: 1px solid var(--line); }
.letter-btn { width: 31px; height: 31px; border-radius: 8px; border: 1px solid var(--line); background: #ffffff; color: #777780; font-weight: 820; font-size: 9px; }
.letter-btn:hover, .letter-btn.active { color: #111; background: var(--gold); border-color: var(--gold); }
.letter-btn.disabled { opacity: .23; pointer-events: none; }
.wiki-index { display: grid; gap: 24px; }
.wiki-letter-section { scroll-margin-top: 84px; }
.wiki-letter-header { display: flex; align-items: center; gap: 12px; margin: 7px 0 11px; }
.wiki-letter-header .letter { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: rgba(201,168,77,.065); border: 1px solid rgba(201,168,77,.13); color: var(--gold-2); font-weight: 900; font-size: 15px; }
.wiki-doc-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 10px; }
.doc-card { border: 1px solid var(--line); background: #ffffff; border-radius: 14px; padding: 15px; min-height: 126px; text-align: left; color: var(--text); width: 100%; cursor: pointer; position: relative; overflow: hidden; }
.doc-card::after { content: "→"; position: absolute; right: 14px; bottom: 12px; color: #55555e; font-size: 13px; transition: .18s ease; }
.doc-card:hover { border-color: rgba(201,168,77,.28); transform: translateY(-2px); background: #ffffff; box-shadow: var(--shadow-soft); }
.doc-card:hover::after { color: var(--gold-2); transform: translateX(2px); }
.doc-card h4 { margin: 0 0 7px; font-size: 12px; padding-right: 18px; }
.doc-card p { color: #777780; margin: 0; font-size: 10px; line-height: 1.5; }
.doc-meta { display: flex; justify-content: space-between; gap: 8px; margin-top: 15px; padding-right: 25px; align-items: center; }
.wiki-empty { padding: 62px 20px; background: #ffffff; border: 1px dashed var(--line-strong); border-radius: var(--radius-lg); }

/* Modals/forms */
.modal-backdrop { position: fixed; inset: 0; background: rgba(246,247,249,.78); backdrop-filter: blur(8px); display: grid; place-items: center; z-index: 100; padding: 24px; }
.modal { width: min(790px,100%); max-height: 90vh; overflow: auto; background: #ffffff; border: 1px solid var(--line-strong); border-radius: 20px; box-shadow: var(--shadow); }
.modal-header { padding: 20px 22px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; }
.modal-header h3 { margin: 5px 0 0; font-size: 19px; }
.modal-close { width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--line); background: #f5f6f8; color: var(--text); }
.modal-body { padding: 22px; }
.modal-footer { padding: 15px 22px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 9px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.field { display: grid; gap: 7px; }
.field.full { grid-column: 1 / -1; }
.field input, .field select, .field textarea { padding: 11px 12px; }
.field textarea { min-height: 105px; resize: vertical; }
.field small { color: #8b9099; font-size: 10px; }
.modal-section-title { margin: 22px 0 12px; font-size: 10px; color: var(--gold-2); text-transform: uppercase; letter-spacing: .1em; }
.article-body { color: #34383f; line-height: 1.75; white-space: pre-wrap; font-size: 12px; }
.article-summary { color: var(--muted); margin-top: 0; }
.article-meta-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 9px; margin-bottom: 20px; }
.meta-box { padding: 11px; border-radius: 11px; background: #f5f6f8; border: 1px solid var(--line); }
.meta-box span { display: block; color: #6f6f78; font-size: 8px; text-transform: uppercase; letter-spacing: .09em; }
.meta-box strong { display: block; margin-top: 5px; font-size: 10px; }
.doc-editor { min-height: 280px !important; }

.toast { position: fixed; right: 24px; bottom: 24px; z-index: 200; background: #f5f6f8; border: 1px solid var(--line-strong); color: var(--text); padding: 12px 15px; border-radius: 11px; box-shadow: var(--shadow); font-size: 11px; }
.toast[data-type="error"] { border-color: rgba(196,32,50,.48); background: #2b1116; color: #ffd2d7; }
.toast[data-type="success"] { border-color: rgba(101,211,145,.28); }
.loading-overlay { position: fixed; inset: 0; z-index: 300; background: rgba(246,247,249,.82); backdrop-filter: blur(7px); display: grid; place-items: center; align-content: center; gap: 14px; color: var(--muted); font-size: 11px; }
.spinner { width: 33px; height: 33px; border-radius: 50%; border: 3px solid #29292e; border-top-color: var(--gold); animation: spin .75s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.compact-empty { padding: 34px 14px; }

/* Scrollbars */
* { scrollbar-width: thin; scrollbar-color: #303036 transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: #303036; border-radius: 99px; }

@media (max-width: 1180px) {
  .app-shell { grid-template-columns: 86px minmax(0,1fr); }
  .brand-copy, .sidebar-label, .nav-copy, .system-status-card, .user-card-copy { display: none; }
  .brand-block { justify-content: center; padding-left: 0; padding-right: 0; }
  .nav-item { justify-content: center; padding: 9px; }
  .nav-icon { margin: 0; }
  .user-card { grid-template-columns: 36px; justify-content: center; }
  .user-card .avatar { display: none; }
  .content-grid.process-layout { grid-template-columns: 1fr; }
  .wiki-doc-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .step-tooltip { left: 50%; top: calc(100% + 10px); transform: translateX(-50%); }
}

@media (max-width: 980px) {
  .auth-layout { grid-template-columns: 1fr; }
  .auth-showcase { display: none; }
  .auth-form-side { min-height: 100vh; }
  .mobile-auth-brand { display: flex; }
}

@media (max-width: 760px) {
  .app-shell { display: block; }
  .sidebar { position: sticky; top: 0; height: auto; flex-direction: row; align-items: center; padding: 10px 12px; border-right: 0; border-bottom: 1px solid var(--line); }
  .sidebar > div:first-child { display: contents; }
  .brand-block { padding: 0; }
  .brand-mark { width: 36px; height: 36px; border-radius: 11px; }
  .sidebar-divider, .sidebar-footer { display: none; }
  .nav-list { display: flex; margin-left: auto; }
  .nav-item { width: 42px; height: 42px; padding: 3px; }
  .nav-icon { width: 34px; height: 34px; }
  .main-area { padding: 22px 14px 44px; }
  .topbar { align-items: flex-start; }
  .topbar-title h1 { font-size: 23px; }
  .topbar-actions { flex-wrap: wrap; justify-content: flex-end; }
  .sync-pill { display: none; }
  .hero-panel { padding: 24px 20px; min-height: 0; }
  .hero-copy h2 { font-size: 34px; }
  .hero-visual, .wiki-letter-art { display: none; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .select-control { width: 100%; }
  .wiki-doc-grid { grid-template-columns: 1fr; }
  .form-grid, .article-meta-grid { grid-template-columns: 1fr; }
  .flow-header { flex-direction: column; }
  .flow-panel { padding: 18px; }
  .step-tooltip { width: min(300px,88vw); }
  .alphabet-nav { position: static; }
  .auth-form-side { padding: 28px 20px; }
  .login-card h2 { font-size: 31px; }
}


/* White theme final polish */
body { background: var(--bg); color: var(--text); }
.auth-screen { background: radial-gradient(circle at 12% 18%, rgba(201,168,77,.14), transparent 24%), radial-gradient(circle at 88% 78%, rgba(196,32,50,.05), transparent 24%), #f7f7f6; }
.auth-showcase { background: #fbfbfa; }
.auth-form-side { background: #ffffff; }
.showcase-feature { background: #ffffff; box-shadow: 0 8px 24px rgba(17,24,39,.05); }
.login-form input, .search-wrap input, .select-control, .field input, .field select, .field textarea { background: #ffffff; color: var(--text); }
.login-form input::placeholder, .search-wrap input::placeholder { color: #a5a9b1; }
.sidebar { background: #ffffff; box-shadow: 8px 0 28px rgba(17,24,39,.035); }
.nav-item.active { background: linear-gradient(90deg, rgba(201,168,77,.14), rgba(201,168,77,.05)); }
.user-card, .system-status-card { background: #fafafa; }
.hero-panel { background: linear-gradient(120deg, rgba(201,168,77,.10), transparent 38%), linear-gradient(145deg, #ffffff, #faf9f5 68%); }
.hero-node { background: #ffffff; box-shadow: 0 10px 26px rgba(17,24,39,.08); }
.panel { background: #ffffff; }
.process-card:hover { background: #f8f9fa; }
.process-card.active { background: linear-gradient(100deg, rgba(201,168,77,.15), rgba(201,168,77,.055)); }
.flow-step { background: linear-gradient(145deg, #ffffff, #fbfbfc); }
.step-tooltip { background: #ffffff; }
.step-tooltip::before { background: #ffffff; }
.alphabet-nav { background: rgba(255,255,255,.94); box-shadow: 0 8px 24px rgba(17,24,39,.06); }
.letter-btn { background: #ffffff; color: #737881; }
.doc-card { background: #ffffff; }
.doc-card:hover { background: #ffffff; }
.wiki-empty { background: #ffffff; }
.modal { background: #ffffff; }
.modal-close { background: #f5f6f8; }
.meta-box { background: #f7f8fa; }
.toast { background: #ffffff; }
.loading-overlay { color: #6f737c; }
@media (max-width: 760px) { .sidebar { background: #ffffff; } }
