:root {
  --bg: #050814;
  --panel: rgba(14, 22, 39, .88);
  --panel-2: rgba(8, 13, 26, .80);
  --line: rgba(176, 214, 255, .14);
  --line-2: rgba(255, 255, 255, .09);
  --ink: #edf6ff;
  --muted: #8fa2c0;
  --soft: #b9c8dd;
  --cyan: #49e6ff;
  --blue: #7b6cff;
  --green: #79f2b1;
  --amber: #ffcc70;
  --violet: #c2a6ff;
  --red: #ff8585;
  --radius: 28px;
  --shadow: 0 28px 90px rgba(0,0,0,.42), inset 0 1px 0 rgba(255,255,255,.05);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { min-height: 100%; }
body {
  margin: 0;
  color: var(--ink);
  font-family: "Avenir Next", "PingFang SC", "Hiragino Sans GB", sans-serif;
  background:
    linear-gradient(180deg, rgba(2,6,14,.10), rgba(2,6,14,.34)),
    url('assets/pandian_sop_background_v5.svg') center / cover fixed no-repeat,
    linear-gradient(135deg, #07101f, #050814 52%, #081c24);
  overflow: auto;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255,255,255,.026) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.026) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: linear-gradient(#000, transparent 94%);
}
body::after {
  content: "";
  position: fixed;
  inset: auto 4vw 2vh auto;
  width: 460px;
  height: 460px;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 50%, rgba(73,230,255,.14), transparent 58%),
    conic-gradient(from 140deg, rgba(73,230,255,.10), rgba(123,108,255,.08), rgba(121,242,177,.10), rgba(73,230,255,.10));
  filter: blur(18px);
  opacity: .7;
  border-radius: 999px;
}
button, input, textarea, select { font: inherit; }
button { border: 0; cursor: pointer; white-space: nowrap; }
.app-shell {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  height: auto;
  padding: 22px;
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr);
  gap: 18px;
}
.card {
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px);
  position: relative;
}
.rail {
  border-radius: 30px;
  padding: 16px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.logo {
  width: 50px;
  height: 50px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  color: #04101d;
  font-weight: 1000;
  font-size: 20px;
  background: linear-gradient(135deg, var(--cyan), var(--blue));
}
.nav-item {
  width: 58px;
  min-height: 44px;
  padding: 0 6px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  color: #8fa5c5;
  font-weight: 900;
  background: rgba(255,255,255,.055);
  border: 1px solid rgba(255,255,255,.10);
  transition: transform .18s ease, background .18s ease, color .18s ease;
}
.nav-item:hover { transform: translateY(-1px); color: var(--ink); }
.nav-item.active { background: #edf6ff; color: #07101f; }
.nav-spacer { flex: 1; }
.main {
  min-width: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 16px;
}
.topbar {
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  overflow: hidden;
}
.topbar::after {
  content: "";
  position: absolute;
  right: 18%;
  top: -80px;
  width: 260px;
  height: 160px;
  background: radial-gradient(circle, rgba(73,230,255,.16), transparent 70%);
  pointer-events: none;
}
.brand { position: relative; z-index: 1; }
.brand-kicker {
  color: #69f0ff;
  font-size: 11px;
  letter-spacing: .16em;
  text-transform: uppercase;
  font-weight: 1000;
  margin-bottom: 6px;
}
.brand h1 { margin: 0; font-size: 30px; letter-spacing: -.045em; line-height: 1; }
.top-sop-menu {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px;
  border-radius: 999px;
  background: rgba(255,255,255,.045);
  border: 1px solid rgba(255,255,255,.08);
}
.sop-tab {
  border-radius: 999px;
  padding: 9px 13px;
  color: #a8bad5;
  background: transparent;
  font-size: 13px;
  font-weight: 950;
}
.sop-tab.active {
  color: #06111f;
  background: linear-gradient(135deg, var(--cyan), #d8fbff);
}
.sop-tab.disabled { opacity: .55; cursor: not-allowed; }
.actions { display: flex; align-items: center; gap: 10px; }
.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 900;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.055);
  color: #9fb3d1;
  white-space: nowrap;
}
.tag.cyan { background: rgba(69,230,255,.13); color: #72efff; border-color: rgba(114,239,255,.25); }
.tag.green { background: rgba(34,197,94,.13); color: #88f8b8; border-color: rgba(136,248,184,.25); }
.tag.amber { background: rgba(245,158,11,.13); color: #ffd28a; border-color: rgba(255,210,138,.25); }
.tag.violet { background: rgba(124,108,255,.15); color: #c9c4ff; border-color: rgba(201,196,255,.25); }
.tag.red { background: rgba(255,110,110,.12); color: #ffb3b3; border-color: rgba(255,150,150,.25); }
.btn {
  border-radius: 15px;
  padding: 12px 16px;
  background: linear-gradient(135deg, var(--cyan), var(--blue));
  color: #06111f;
  font-weight: 950;
  box-shadow: 0 18px 45px rgba(69,230,255,.18);
}
.btn.ghost {
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.12);
  color: #dceaff;
  box-shadow: none;
}
.btn.small { padding: 9px 12px; border-radius: 12px; font-size: 13px; }
.btn.danger { background: rgba(255,110,110,.12); color: #ffb3b3; border: 1px solid rgba(255,150,150,.22); box-shadow: none; }
.muted { color: var(--muted); }
.micro { font-size: 12px; color: #8295b3; line-height: 1.55; }
.page { min-height: 0; display: none; }
.page.active { display: block; min-height: 0; }
.field {
  border-radius: 18px;
  background: rgba(5,10,20,.62);
  border: 1px solid rgba(176,214,255,.13);
  padding: 14px;
  color: #d9e8ff;
  outline: none;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.035);
}
.field label {
  display: block;
  color: #91a6c7;
  font-size: 12px;
  font-weight: 900;
  margin-bottom: 8px;
}
input.field, textarea.field, select.field { width: 100%; }
textarea.field { resize: none; line-height: 1.68; min-height: 260px; }
.field:focus, [contenteditable="true"]:focus { border-color: rgba(73,230,255,.42); box-shadow: 0 0 0 4px rgba(73,230,255,.08); }
.hint {
  border-radius: 18px;
  background: rgba(69,230,255,.08);
  border: 1px solid rgba(114,239,255,.18);
  padding: 12px;
  color: #9fb8da;
  line-height: 1.5;
}
.login-screen {
  position: fixed;
  z-index: 10;
  inset: 0;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 20% 10%, rgba(73,230,255,.15), transparent 360px),
    radial-gradient(circle at 80% 14%, rgba(124,108,255,.16), transparent 380px),
    rgba(5,8,20,.92);
  backdrop-filter: blur(14px);
}
.login-card {
  width: min(720px, calc(100vw - 44px));
  border-radius: 34px;
  padding: 28px;
}
.login-grid { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 14px; margin-top: 20px; align-items: center; }
.admin-login-row { display: none; grid-template-columns: minmax(0, 1fr) auto; gap: 14px; margin-top: 12px; align-items: center; }
.login-card.admin-mode .admin-login-row { display: grid; }
.login-card.admin-mode #adminToggleBtn { color: #72efff; border-color: rgba(114,239,255,.25); }
.login-card h1 { margin: 0; font-size: 34px; letter-spacing: -.04em; }
.login-card p { color: var(--muted); line-height: 1.65; }
.login-title { margin-top: 18px !important; }
.login-actions { margin-top: 12px; }
.error { color: #ffb3b3; font-size: 13px; min-height: 20px; }
.rewrite-layout {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  min-height: 0;
}
.history-pane, .write-pane, .editor-pane, .history-page, .admin-page {
  border-radius: 32px;
  padding: 20px;
  min-height: 0;
}
.history-pane { display: grid; grid-template-rows: auto auto minmax(0,1fr); gap: 12px; }
.record-list { display: grid; gap: 10px; overflow: auto; padding-right: 4px; }
.record-card {
  border-radius: 18px;
  background: rgba(255,255,255,.045);
  border: 1px solid rgba(255,255,255,.085);
  padding: 13px;
  cursor: pointer;
}
.record-card:hover, .record-card.active { background: rgba(69,230,255,.08); border-color: rgba(114,239,255,.22); }
.write-pane {
  min-height: calc(100vh - 142px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 22px;
  padding: 28px;
  overflow: hidden;
  background:
    radial-gradient(circle at 18% 18%, rgba(73,230,255,.14), transparent 34%),
    radial-gradient(circle at 94% 88%, rgba(121,242,177,.12), transparent 40%),
    linear-gradient(135deg, rgba(6,12,28,.64), rgba(6,12,28,.32));
  border-color: rgba(255,255,255,.075);
}
.write-pane::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(90deg, rgba(255,255,255,.05), transparent 28%, rgba(73,230,255,.04));
  opacity: .58;
}
.write-head {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 18px;
}
.write-head h2 { margin: 0; font-size: 36px; letter-spacing: -.055em; }
.write-head p { margin: 8px 0 0; color: #9fb2d0; }
.sop-row { display: flex; gap: 9px; flex-wrap: wrap; justify-content: flex-end; }
.sop-workspace {
  position: relative;
  z-index: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(330px, .9fr);
  gap: 22px;
  align-items: stretch;
}
.pandian-input-card {
  position: relative;
  min-height: 640px;
  border-radius: 30px;
  padding: 24px;
  overflow: hidden;
  background: linear-gradient(145deg, rgba(13,28,49,.68), rgba(10,15,34,.46));
  border: 1px solid rgba(118,237,255,.18);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08), 0 30px 90px rgba(0,0,0,.24);
}
.pandian-input-card::after {
  content: "盘点";
  position: absolute;
  right: 24px;
  top: 18px;
  color: rgba(255,255,255,.045);
  font-size: 86px;
  font-weight: 1000;
  letter-spacing: -.08em;
  pointer-events: none;
}
.input-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  padding: 8px 12px;
  color: #adf8ff;
  background: rgba(94,237,255,.12);
  border: 1px solid rgba(94,237,255,.20);
  font-size: 13px;
  font-weight: 950;
}
.input-title { margin: 18px 0 8px; font-size: 23px; font-weight: 1000; }
.source-input {
  position: absolute;
  left: 24px;
  right: 24px;
  top: 120px;
  bottom: 92px;
  width: calc(100% - 48px);
  height: auto;
  min-height: 0;
  resize: none;
  border-radius: 25px;
  background: rgba(3,8,19,.42);
  border: 1px solid rgba(255,255,255,.075);
  padding: 22px;
  color: #d9e8ff;
  font-size: 18px;
  line-height: 1.85;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.025);
}
.input-note {
  position: absolute;
  left: 30px;
  bottom: 32px;
  max-width: calc(100% - 230px);
  color: #8194b2;
  font-size: 12px;
  line-height: 1.55;
}
.input-generate-btn {
  position: absolute;
  right: 28px;
  bottom: 26px;
  border-radius: 18px;
  padding: 16px 24px;
  font-size: 16px;
  box-shadow: 0 18px 45px rgba(94,237,255,.25);
}
.sop-side {
  min-height: 0;
  display: grid;
  grid-template-rows: repeat(3, minmax(136px, auto)) auto;
  gap: 16px;
  align-content: start;
}
.sop-card {
  position: relative;
  min-height: 136px;
  overflow: hidden;
  border-radius: 26px;
  padding: 22px;
  color: #a8bad5;
  background: linear-gradient(145deg, rgba(255,255,255,.07), rgba(255,255,255,.025));
  border: 1px solid rgba(255,255,255,.08);
  box-shadow: 0 22px 70px rgba(0,0,0,.18);
}
.sop-card::before {
  content: "";
  position: absolute;
  right: -40px;
  top: -60px;
  width: 210px;
  height: 210px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(94,237,255,.13), transparent 68%);
  pointer-events: none;
}
.sop-card strong { display: block; color: #e9f4ff; margin-bottom: 8px; font-size: 23px; }
.sop-card span { color: #94a8c8; font-size: 14px; line-height: 1.6; }
.sop-card .sop-state { position: absolute; right: 18px; bottom: 16px; color: #7589a8; font-size: 12px; font-weight: 900; }
.sop-card.future { opacity: .72; }
.preview-note {
  border-radius: 24px;
  padding: 18px;
  color: #9eb4d2;
  background: rgba(0,0,0,.18);
  border: 1px solid rgba(255,255,255,.06);
  font-size: 13px;
  line-height: 1.7;
}
.policy-note {
  border-radius: 18px;
  padding: 12px 14px;
  color: #9eb4d2;
  background: rgba(94,237,255,.065);
  border: 1px solid rgba(94,237,255,.13);
  font-size: 12px;
  line-height: 1.65;
}
.modal-back {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
  place-items: center;
  background: rgba(0,0,0,.52);
  backdrop-filter: blur(9px);
}
.modal-back.active { display: grid; }
.modal {
  width: min(680px, calc(100vw - 44px));
  border-radius: 30px;
  padding: 24px;
  background: linear-gradient(180deg, rgba(16,25,45,.97), rgba(8,13,26,.97));
  border: 1px solid rgba(176,214,255,.20);
  box-shadow: 0 30px 100px rgba(0,0,0,.55);
}
.modal h2 { margin: 0 0 8px; font-size: 26px; }
.modal p { margin: 0 0 18px; color: var(--muted); }
.modal-form { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.generation-progress {
  display: none;
  margin-top: 16px;
  padding: 14px;
  border: 1px solid rgba(132, 246, 255, .18);
  background: rgba(8, 16, 31, .72);
  border-radius: 18px;
}
.generation-progress.active { display: block; }
.progress-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.progress-head b { color: var(--text); font-size: 15px; }
.progress-head b.error { color: #ffb3b3; }
.progress-head span { color: var(--muted); font-size: 12px; white-space: nowrap; }
.progress-track {
  height: 8px;
  margin: 12px 0;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.08);
}
.progress-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--cyan), var(--violet));
  transition: width .35s ease;
}
.progress-fill.progress-0 { width: 0%; }
.progress-fill.progress-5 { width: 5%; }
.progress-fill.progress-10 { width: 10%; }
.progress-fill.progress-15 { width: 15%; }
.progress-fill.progress-20 { width: 20%; }
.progress-fill.progress-25 { width: 25%; }
.progress-fill.progress-30 { width: 30%; }
.progress-fill.progress-35 { width: 35%; }
.progress-fill.progress-40 { width: 40%; }
.progress-fill.progress-45 { width: 45%; }
.progress-fill.progress-50 { width: 50%; }
.progress-fill.progress-55 { width: 55%; }
.progress-fill.progress-60 { width: 60%; }
.progress-fill.progress-65 { width: 65%; }
.progress-fill.progress-70 { width: 70%; }
.progress-fill.progress-75 { width: 75%; }
.progress-fill.progress-80 { width: 80%; }
.progress-fill.progress-85 { width: 85%; }
.progress-fill.progress-90 { width: 90%; }
.progress-fill.progress-95 { width: 95%; }
.progress-fill.progress-100 { width: 100%; }
.progress-steps { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.progress-step {
  min-height: 42px;
  padding: 8px 6px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.08);
  background: rgba(255,255,255,.035);
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}
.progress-step.done { color: #92f7bd; border-color: rgba(146,247,189,.28); background: rgba(34,197,94,.10); }
.progress-step.active { color: #0b1224; border-color: rgba(132,246,255,.55); background: linear-gradient(135deg, var(--cyan), #a5f3ff); font-weight: 1000; }
.progress-step.error { color: #ffb3b3; border-color: rgba(255,150,150,.36); background: rgba(255,110,110,.10); }
.progress-hint { margin: 10px 0 0 !important; font-size: 13px; color: var(--muted); }
.editor-pane { display: grid; grid-template-rows: auto auto auto auto auto auto; gap: 14px; min-height: calc(100vh - 142px); }
.editor-head { display: flex; justify-content: space-between; gap: 16px; align-items: start; }
.editor-head h2 { margin: 0; font-size: 28px; letter-spacing: -.03em; }
.editor-meta { margin: 6px 0 0; }
.metrics { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.metric { min-height: 78px; }
.metric b { font-size: 25px; }
.metric span { display: block; margin-top: 2px; }
.quality-ribbon {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-radius: 16px;
  padding: 8px 11px;
  background: rgba(5,10,20,.34);
  border: 1px solid rgba(176,214,255,.10);
  color: #9fb2d0;
  font-size: 12px;
  box-shadow: none;
}
.quality-ribbon b {
  color: #b8c9e4;
  font-size: 12px;
  font-weight: 950;
}
.quality-ribbon .micro { color: #8194b2; }
.quality-ribbon.warning {
  background: rgba(42,30,18,.32);
  border-color: rgba(255,204,112,.20);
  color: #d9bd82;
}
.quality-ribbon.warning b { color: #ffd28a; }
.version-strip {
  display: grid;
  grid-template-columns: minmax(0, auto) minmax(260px, 1fr);
  gap: 10px;
  align-items: stretch;
}
.version-tabs {
  display: flex;
  gap: 8px;
  padding: 6px;
  border-radius: 18px;
  background: rgba(5,10,20,.42);
  border: 1px solid rgba(176,214,255,.11);
  overflow-x: auto;
}
.version-tab {
  flex: 0 0 auto;
  border-radius: 14px;
  padding: 10px 13px;
  color: #a9bbd7;
  background: rgba(255,255,255,.045);
  border: 1px solid rgba(255,255,255,.08);
  font-size: 13px;
  font-weight: 950;
}
.version-tab.active {
  color: #06111f;
  background: linear-gradient(135deg, var(--cyan), #d8fbff);
  border-color: rgba(114,239,255,.5);
  box-shadow: 0 14px 38px rgba(73,230,255,.14);
}
.version-badge { display: block; color: inherit; opacity: .72; }
.version-contract {
  border-radius: 18px;
  padding: 11px 13px;
  background: rgba(255,255,255,.045);
  border: 1px solid rgba(255,255,255,.08);
  color: #9fb2d0;
  font-size: 12px;
  line-height: 1.6;
}
.version-contract b { color: #e5f2ff; }
.section-map {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
}
.map-label {
  flex: 0 0 auto;
  color: #8fa6c8;
  font-size: 12px;
  font-weight: 950;
  padding: 0 3px;
}
.section-chip {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 9px 12px;
  color: #b7c8e4;
  background: rgba(255,255,255,.045);
  border: 1px solid rgba(255,255,255,.09);
  font-size: 12px;
  font-weight: 900;
}
.section-chip.active {
  color: #06111f;
  background: linear-gradient(135deg, var(--cyan), #c7f9ff);
  border-color: rgba(73,230,255,.45);
}
.edit-module {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1.34fr) minmax(330px, .66fr);
  gap: 14px;
  align-items: start;
}
.draft-column, .notes-column {
  min-height: 0;
  overflow: visible;
  border-radius: 26px;
  background: rgba(5,10,20,.50);
  border: 1px solid rgba(176,214,255,.12);
  padding: 14px;
}
.legend { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.legend span { font-size: 12px; color: #9fb3d1; }
.dot { width: 9px; height: 9px; border-radius: 99px; display: inline-block; margin-right: 5px; }
.d1 { background: var(--cyan); }
.d2 { background: var(--amber); }
.d3 { background: var(--violet); }
.draft-sections, .note-list { display: grid; gap: 10px; }
.draft-section { line-height: 1.72; font-size: 16px; scroll-margin-top: 18px; }
.draft-section {
  background:
    linear-gradient(180deg, rgba(255,255,255,.045), rgba(255,255,255,.018)),
    rgba(5,10,20,.62);
}
.draft-section label, .note-card label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 7px;
  color: #a9bde0;
  font-size: 12px;
  font-weight: 950;
  letter-spacing: .03em;
}
.draft-section p { margin: 0 0 8px; }
.draft-section p:last-child { margin-bottom: 0; }
.section-tools {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
  flex-wrap: wrap;
  margin: -2px 0 9px;
  user-select: none;
}
.tool-btn {
  border-radius: 999px;
  padding: 6px 9px;
  color: #a9bad6;
  background: rgba(255,255,255,.055);
  border: 1px solid rgba(255,255,255,.09);
  font-size: 11px;
  font-weight: 900;
  box-shadow: none;
}
.tool-btn:hover { color: #eff8ff; border-color: rgba(114,239,255,.25); }
.tool-btn.locked {
  color: #06111f;
  background: linear-gradient(135deg, var(--amber), #fff0bd);
  border-color: rgba(255,210,138,.48);
}
.draft-section.level-1 { border-color: rgba(73,230,255,.24); background: radial-gradient(circle at 100% 0%, rgba(73,230,255,.12), transparent 44%), rgba(5,10,20,.66); }
.draft-section.level-2 { margin-left: 16px; border-color: rgba(255,204,112,.22); background: rgba(255,255,255,.038); }
.draft-section.level-3 { margin-left: 36px; border-color: rgba(121,242,177,.20); background: rgba(255,255,255,.028); }
.note-card.level-2 { margin-left: 10px; }
.note-card.level-3 { margin-left: 22px; }
.node-pill { display: inline-flex; align-items: center; justify-content: center; min-width: 32px; height: 24px; padding: 0 8px; border-radius: 999px; color: #06111f; background: linear-gradient(135deg, var(--cyan), #d8fbff); font-size: 11px; font-weight: 1000; }
.node-title { color: #dceaff; }
.item-block { margin-top: 8px; padding: 8px 10px; border-radius: 14px; background: rgba(255,255,255,.035); border: 1px solid rgba(255,255,255,.07); }
.script-meta {
  display: inline-flex;
  max-width: 100%;
  margin-bottom: 2px;
  color: #dbe9ff;
  font-size: 13px;
  background: rgba(255,255,255,.055);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 999px;
  padding: 3px 8px;
}
.item-block:first-of-type { margin-top: 0; }
.change, .move, .rewrite, .diff-change {
  color: inherit;
  font: inherit;
  line-height: inherit;
  border: 0;
  border-radius: 4px;
  padding: 0 2px;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}
.change {
  background: linear-gradient(180deg, transparent 54%, rgba(73,230,255,.24) 54%, rgba(73,230,255,.24) 92%, transparent 92%);
  box-shadow: inset 0 -1px 0 rgba(73,230,255,.58);
}
.move {
  background: linear-gradient(180deg, transparent 54%, rgba(255,202,92,.24) 54%, rgba(255,202,92,.24) 92%, transparent 92%);
  box-shadow: inset 0 -1px 0 rgba(255,202,92,.58);
}
.rewrite {
  background: linear-gradient(180deg, transparent 54%, rgba(168,85,247,.24) 54%, rgba(168,85,247,.24) 92%, transparent 92%);
  box-shadow: inset 0 -1px 0 rgba(190,140,255,.58);
}
.diff-change {
  position: relative;
  cursor: help;
  background: linear-gradient(180deg, transparent 52%, rgba(73,230,255,.28) 52%, rgba(73,230,255,.28) 92%, transparent 92%);
  box-shadow: inset 0 -1px 0 rgba(73,230,255,.70);
}
.diff-change::after {
  content: attr(data-original);
  position: absolute;
  left: 0;
  bottom: calc(100% + 8px);
  z-index: 20;
  min-width: 180px;
  max-width: min(420px, 70vw);
  padding: 10px 12px;
  border-radius: 12px;
  color: #eaf3ff;
  background: rgba(5, 12, 24, .96);
  border: 1px solid rgba(117, 231, 255, .34);
  box-shadow: 0 16px 44px rgba(0,0,0,.42);
  font-size: 12px;
  line-height: 1.55;
  white-space: normal;
  opacity: 0;
  pointer-events: none;
  transform: translateY(4px);
  transition: opacity .12s ease, transform .12s ease;
}
.diff-change:hover::after {
  opacity: 1;
  transform: translateY(0);
}
.note-card { position: relative; line-height: 1.52; padding-left: 18px; }
.notes-title { margin: 0 0 10px; font-size: 20px; }
.note-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 14px;
  bottom: 14px;
  width: 4px;
  border-radius: 999px;
  background: linear-gradient(var(--cyan), var(--blue));
  opacity: .72;
}
.note-card p { margin: 8px 0 0; color: #9fb2d0; font-size: 13px; }
.note-meta {
  display: grid;
  gap: 7px;
  margin-top: 9px;
  color: #8ea4c2;
  font-size: 12px;
  line-height: 1.55;
}
.note-meta span {
  display: block;
  border-radius: 12px;
  padding: 8px 10px;
  background: rgba(255,255,255,.035);
  border: 1px solid rgba(255,255,255,.065);
}
.admin-standards {
  display: grid;
  gap: 10px;
}
.admin-standard-card {
  border-radius: 18px;
  padding: 13px;
  background: rgba(255,255,255,.045);
  border: 1px solid rgba(255,255,255,.08);
  color: #9fb2d0;
  line-height: 1.62;
  font-size: 13px;
}
.admin-standard-card b { display:block; color:#e9f4ff; margin-bottom:4px; }
.footer-status { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.history-page { display: grid; grid-template-rows: auto auto minmax(0,1fr); gap: 16px; }
.page-title-row { display: flex; justify-content: space-between; align-items: end; gap: 16px; }
.page-title { margin: 0; font-size: 30px; }
.page-subtitle { margin: 6px 0 0; }
.history-filters { display: grid; grid-template-columns: minmax(0, 1fr) 170px 170px 170px; gap: 10px; }
.history-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; align-content: start; overflow: auto; padding-right: 4px; }
.history-card { min-height: 190px; display: flex; flex-direction: column; gap: 10px; }
.history-card {
  background:
    radial-gradient(circle at 90% 0%, rgba(73,230,255,.10), transparent 38%),
    rgba(5,10,20,.60);
}
.history-card h3 { margin: 0; font-size: 20px; }
.history-actions { margin-top: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.admin-page { display: grid; grid-template-rows: auto auto minmax(0,1fr); gap: 16px; }
.scroll-field { overflow: auto; }
.flush-top { margin-top: 0; }
.compact-form { margin-top: 8px; }
.inline-action-row { display: flex; gap: 8px; margin-top: 10px; align-items: center; flex-wrap: wrap; }
.team-user-list { margin-top: 10px; }
.modal-tag-row { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.admin-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.admin-panels { display: grid; grid-template-columns: 1.1fr .9fr; gap: 14px; min-height: 0; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { border-bottom: 1px solid rgba(255,255,255,.08); padding: 10px 8px; text-align: left; color: #c9d7ef; font-size: 13px; }
.empty { display: grid; place-items: center; color: var(--muted); border: 1px dashed rgba(255,255,255,.16); border-radius: 22px; min-height: 180px; }
@media (max-width: 1100px) {
  body { overflow: auto; }
  .app-shell { height: auto; min-height: 100vh; grid-template-columns: 1fr; padding: 12px; gap: 12px; }
  .rail { flex-direction: row; position: sticky; top: 8px; z-index: 5; overflow-x: auto; justify-content: flex-start; }
  .nav-spacer { display: none; }
  .topbar, .editor-head, .write-head, .footer-status { flex-direction: column; align-items: flex-start; }
  .topbar .actions, .editor-head .actions, .write-head .sop-row, .footer-status, .top-sop-menu { width: 100%; justify-content: flex-start; flex-wrap: wrap; }
  .brand h1, .editor-head h2 { line-height: 1.08; word-break: keep-all; overflow-wrap: normal; }
  .brand h1 { font-size: 28px; }
  .editor-head h2 { font-size: 30px; }
  .history-pane { display: none; }
  .main, .rewrite-layout, .edit-module, .sop-workspace, .history-filters, .history-grid, .admin-panels, .command-strip, .sop-catalog { grid-template-columns: 1fr; }
  .main { grid-template-rows: auto auto; }
  .editor-pane { height: auto; overflow: visible; }
  .version-strip { grid-template-columns: 1fr; }
  .write-pane { min-height: auto; overflow: visible; }
  .pandian-input-card { min-height: 600px; }
  .sop-side { grid-template-rows: none; }
  .draft-column, .notes-column { overflow: visible; }
  .metrics, .admin-grid { grid-template-columns: 1fr 1fr; }
  .login-grid, .admin-login-row { grid-template-columns: 1fr; }
  .modal-form { grid-template-columns: 1fr; }
  .progress-head { display: block; }
  .progress-head span { display: block; margin-top: 4px; white-space: normal; }
  .progress-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 520px) {
  .app-shell { padding: 10px; }
  .topbar, .history-page, .write-pane, .editor-pane, .admin-page { padding: 16px; border-radius: 24px; }
  .brand h1 { font-size: 25px; }
  .editor-head h2 { font-size: 27px; }
  .metrics, .admin-grid { grid-template-columns: 1fr; }
  .actions { gap: 8px; }
  .btn { padding: 10px 13px; }
  .btn.small { padding: 9px 11px; }
  .tag { padding: 7px 10px; }
  textarea.field { min-height: 220px; }
  .source-input { top: 112px; bottom: 112px; font-size: 15px; }
  .input-note { left: 22px; right: 22px; bottom: 78px; max-width: none; }
  .input-generate-btn { left: 22px; right: 22px; bottom: 20px; width: auto; }
  .pandian-input-card::after { font-size: 58px; right: 16px; top: 24px; }
}
