:root {
  --ink: #151a18;
  --muted: #6e7771;
  --line: #d9ded7;
  --paper: #f4f6f1;
  --panel: #fbfcf9;
  --lime: #d8ff52;
  --lime-deep: #aecf1e;
  --coral: #ed765c;
  --blue: #b9c9ff;
  --soft-ink: #29322d;
  --shadow: 0 16px 38px rgba(21, 26, 24, 0.07);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  letter-spacing: 0;
}

button, input, textarea, select { font: inherit; }
button { cursor: pointer; }

.app-shell { min-height: 100vh; }

.auth-gate { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--paper); }
.auth-panel { width: min(420px, 100%); padding: 34px; border: 1px solid var(--line); background: var(--panel); box-shadow: var(--shadow); }
.auth-panel h1 { margin-top: 9px; font-size: 29px; letter-spacing: -.03em; }
.auth-panel p { margin: 10px 0 25px; color: var(--muted); line-height: 1.6; }
.auth-panel .primary-button { width: 100%; }

.topbar {
  height: 76px;
  padding: 0 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #f6f8f3;
  background: var(--ink);
}

.brand-lockup, .topbar-meta, .brand-mark, .node-card-head, .form-row, .preview-top, .online-badge { display: flex; align-items: center; }
.brand-lockup { gap: 13px; }
.brand-mark { width: 29px; height: 29px; gap: 3px; align-items: end; }
.brand-mark span { width: 7px; display: block; background: var(--lime); }
.brand-mark span:nth-child(1) { height: 12px; opacity: .66; }
.brand-mark span:nth-child(2) { height: 20px; }
.brand-mark span:nth-child(3) { height: 27px; opacity: .82; }
.brand-name { font-size: 14px; font-weight: 800; letter-spacing: .12em; }
.brand-subtitle { margin-top: 4px; color: #8d978f; font-size: 9px; letter-spacing: .16em; }
.topbar-meta { gap: 11px; color: #c2c9c1; font-size: 11px; letter-spacing: .04em; }
.topbar-meta strong { color: var(--lime); font-size: 10px; letter-spacing: .11em; }
.topbar-logout { margin-left: 7px; padding: 4px 8px; border: 1px solid #48534b; color: #d7ded5; background: transparent; font-size: 10px; }
.topbar-logout:hover { border-color: var(--lime); color: var(--lime); }
.meta-divider { width: 1px; height: 14px; background: #4a544d; }
.secure-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--lime); box-shadow: 0 0 0 3px rgba(216,255,82,.13); }

.workspace { display: grid; grid-template-columns: 224px minmax(0, 1fr); min-height: calc(100vh - 76px); }
.sidebar { padding: 37px 22px 25px; display: flex; flex-direction: column; background: #e8ede6; border-right: 1px solid var(--line); }
.sidebar-label, .eyebrow, .section-kicker, .aside-label, .status-label, .field-label { color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .14em; }
.main-nav { margin-top: 21px; display: grid; gap: 5px; }
.nav-item { width: 100%; padding: 11px 11px; display: flex; align-items: center; gap: 12px; border: 0; color: #607066; background: transparent; text-align: left; }
.nav-item:hover { color: var(--ink); background: rgba(255,255,255,.48); }
.nav-item.active { color: var(--ink); background: var(--lime); font-weight: 700; }
.nav-index { width: 23px; color: #87928a; font: 700 10px/1 "Segoe UI", sans-serif; }
.nav-item.active .nav-index { color: var(--ink); }
.sidebar-bottom { margin-top: auto; }
.node-card { padding: 15px; border: 1px solid #d2d9d0; background: rgba(251,252,249,.55); }
.node-card-head { justify-content: space-between; color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .12em; }
.pulse { color: #5f8412; }
.node-address { margin: 17px 0 18px; font-family: Consolas, monospace; font-size: 12px; }
.node-line { padding-top: 10px; display: flex; justify-content: space-between; border-top: 1px solid #d7ddd5; color: var(--muted); font-size: 10px; }
.node-line + .node-line { margin-top: 9px; }
.node-line strong { color: #4b564e; font-size: 9px; letter-spacing: .06em; }
.node-line strong.muted { color: #9aa49c; }
.sidebar-footnote { margin-top: 16px; color: #919a92; font-size: 9px; letter-spacing: .1em; }

.content { width: min(1260px, 100%); margin: 0 auto; padding: 53px 55px 70px; }
.page-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; }
.eyebrow { margin-bottom: 15px; color: #6c7c70; }
h1, h2, p { margin: 0; }
h1 { max-width: 550px; font-size: clamp(26px, 3.1vw, 42px); line-height: 1.12; letter-spacing: -.03em; font-weight: 760; }
.page-heading p { margin-top: 13px; color: var(--muted); line-height: 1.6; }
.quiet-button { padding: 10px 15px; border: 1px solid #cdd4cb; color: var(--soft-ink); background: transparent; }
.quiet-button:hover { border-color: var(--ink); background: #fff; }
.status-strip { margin-top: 38px; display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--ink); border-bottom: 1px solid var(--line); }
.status-cell { min-height: 91px; padding: 17px 18px; display: grid; align-content: center; gap: 6px; border-right: 1px solid var(--line); }
.status-cell:first-child { padding-left: 0; }
.status-cell:last-child { border-right: 0; }
.status-cell strong { font-size: 20px; line-height: 1; letter-spacing: -.02em; }
.status-note { color: var(--muted); font-size: 11px; }

.view-panel { display: none; margin-top: 44px; }
.view-panel.active { display: block; animation: arrive .22s ease-out; }
@keyframes arrive { from { opacity: .3; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin-bottom: 18px; }
.section-kicker { display: block; margin-bottom: 10px; color: #768278; }
h2 { font-size: 23px; line-height: 1.2; letter-spacing: -.02em; }
.section-code { color: #9aa39d; font: 700 10px/1 Consolas, monospace; letter-spacing: .12em; }
.online-badge { gap: 8px; color: #607066; font-size: 11px; }

.thread-layout, .message-desk-layout, .release-layout { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(240px, .75fr); gap: 22px; }
.thread-preview { min-height: 390px; padding: 28px; border: 1px solid var(--line); background: var(--panel); box-shadow: var(--shadow); }
.message-row { max-width: 76%; margin-bottom: 22px; }
.message-row.mine { margin-left: auto; }
.message-meta { display: flex; gap: 9px; align-items: baseline; color: var(--muted); font-size: 10px; }
.message-row.mine .message-meta { justify-content: end; }
.message-meta strong { color: var(--ink); font-size: 11px; }
.message-bubble { margin-top: 7px; padding: 13px 15px; color: #28312b; background: #edf1ea; line-height: 1.6; }
.message-row.mine .message-bubble { color: var(--ink); background: var(--lime); }
.message-row.system { max-width: 100%; display: flex; align-items: center; gap: 11px; }
.message-row.system .message-meta { order: 2; }
.message-row.system .message-bubble { margin: 0; padding: 8px 11px; color: #69776d; background: #f1f3ef; font-size: 11px; }
.empty-state { height: 330px; display: grid; place-items: center; color: var(--muted); }
.thread-aside, .delivery-panel, .release-preview { padding: 23px; border: 1px solid var(--line); background: rgba(251,252,249,.7); }
.member-stack { margin-top: 21px; display: grid; gap: 14px; }
.member-item { display: flex; align-items: center; gap: 11px; }
.avatar { width: 29px; height: 29px; display: grid; place-items: center; font: 800 9px/1 Consolas, monospace; }
.avatar.lime { background: var(--lime); }
.avatar.blue { background: var(--blue); }
.member-copy { display: grid; gap: 3px; }
.member-copy strong { font-size: 12px; }
.member-copy span { color: var(--muted); font-size: 10px; }
.aside-rule { height: 1px; margin: 24px 0 17px; background: var(--line); }
.aside-stat { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 11px; }
.aside-stat + .aside-stat { margin-top: 12px; }
.aside-stat strong { color: var(--ink); font-size: 11px; }

.message-desk-layout { align-items: start; }
.compose-panel { padding: 28px; border: 1px solid var(--line); background: var(--panel); box-shadow: var(--shadow); }
.field-label { display: block; margin-bottom: 9px; }
textarea, input, select { width: 100%; border: 1px solid #ced6cd; border-radius: 0; outline: 0; color: var(--ink); background: #fff; }
textarea, input { padding: 12px 13px; resize: vertical; }
textarea:focus, input:focus, select:focus { border-color: #829480; box-shadow: 0 0 0 3px rgba(130,148,128,.14); }
select { padding: 11px 12px; }
.form-row { align-items: stretch; gap: 13px; margin-top: 19px; }
.form-row > * { flex: 1; }
.select-wrap { display: block; }
.primary-button { min-height: 43px; margin-top: 24px; padding: 0 16px; display: inline-flex; align-items: center; justify-content: space-between; gap: 22px; border: 1px solid var(--ink); color: var(--ink); background: var(--lime); font-weight: 750; }
.primary-button:hover { background: #c9f046; }
.form-hint { min-height: 16px; margin-top: 12px; color: var(--muted); font-size: 11px; }
.delivery-panel { min-height: 298px; }
.delivery-step { display: flex; gap: 12px; align-items: center; }
.delivery-step strong, .delivery-step span { display: block; }
.delivery-step strong { font-size: 12px; }
.delivery-step div span { margin-top: 4px; color: var(--muted); font-size: 10px; }
.step-dot { width: 10px; height: 10px; border: 2px solid #bbc5bb; border-radius: 50%; }
.step-dot.done { border-color: var(--lime-deep); background: var(--lime); }
.delivery-connector { width: 1px; height: 24px; margin: 5px 0 5px 4px; background: #cfd6ce; }

.release-layout { align-items: start; }
.release-form { padding: 28px; border: 1px solid var(--line); background: var(--panel); box-shadow: var(--shadow); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; margin-bottom: 19px; }
.release-form .select-wrap + .select-wrap { margin-top: 19px; }
.toggle-row { margin-top: 21px; display: flex; gap: 11px; align-items: flex-start; cursor: pointer; }
.toggle-row input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.toggle-visual { width: 32px; height: 18px; flex: 0 0 auto; margin-top: 1px; padding: 2px; background: #cad2ca; }
.toggle-visual::after { content: ""; width: 14px; height: 14px; display: block; background: #fff; transition: transform .18s ease; }
.toggle-row input:checked + .toggle-visual { background: var(--lime-deep); }
.toggle-row input:checked + .toggle-visual::after { transform: translateX(14px); }
.toggle-row strong, .toggle-row small { display: block; }
.toggle-row strong { font-size: 12px; }
.toggle-row small { margin-top: 4px; color: var(--muted); font-size: 10px; line-height: 1.5; }
.release-preview { min-height: 300px; }
.preview-top { justify-content: space-between; gap: 14px; }
.preview-chip { padding: 5px 7px; color: #516612; background: var(--lime); font: 800 9px/1 Consolas, monospace; letter-spacing: .06em; }
.preview-version { margin-top: 34px; font: 800 42px/1 "Segoe UI", sans-serif; letter-spacing: -.05em; }
.preview-notes { min-height: 48px; margin-top: 13px; color: var(--muted); line-height: 1.6; }

.toast { position: fixed; right: 25px; bottom: 24px; max-width: 320px; padding: 12px 15px; color: #f5f8f2; background: var(--ink); box-shadow: var(--shadow); opacity: 0; pointer-events: none; transform: translateY(8px); transition: .18s ease; }
.toast.show { opacity: 1; transform: translateY(0); }

@media (max-width: 900px) {
  .topbar { padding: 0 22px; }
  .topbar-meta { display: none; }
  .workspace { grid-template-columns: 1fr; }
  .sidebar { padding: 16px 20px; border-right: 0; border-bottom: 1px solid var(--line); }
  .main-nav { margin-top: 12px; display: flex; gap: 4px; overflow-x: auto; }
  .nav-item { width: auto; min-width: 100px; }
  .sidebar-bottom { display: none; }
  .content { padding: 37px 22px 55px; }
  .thread-layout, .message-desk-layout, .release-layout { grid-template-columns: 1fr; }
  .thread-aside, .delivery-panel, .release-preview { min-height: 0; }
}

@media (max-width: 600px) {
  .topbar { height: 68px; }
  .workspace { min-height: calc(100vh - 68px); }
  .content { padding: 29px 16px 45px; }
  .page-heading { align-items: start; flex-direction: column; }
  h1 { font-size: 31px; }
  .quiet-button { width: 100%; }
  .status-strip { grid-template-columns: repeat(2, 1fr); }
  .status-cell, .status-cell:first-child { padding: 14px 12px; border-bottom: 1px solid var(--line); }
  .status-cell:nth-child(2) { border-right: 0; }
  .status-cell:nth-child(3), .status-cell:nth-child(4) { border-bottom: 0; }
  .status-cell strong { font-size: 17px; }
  .thread-preview, .compose-panel, .release-form { padding: 20px; }
  .message-row { max-width: 90%; }
  .form-row, .form-grid { grid-template-columns: 1fr; flex-direction: column; }
  .form-grid { display: grid; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
