:root {
  --paper: #F3EEE4;
  --paper-raised: #FBF8F1;
  --paper-deep: #E9E1D4;
  --ink: #171410;
  --ink-soft: #4F483E;
  --ink-muted: #7C7264;
  --rule: #D8CEBF;
  --rule-strong: #BFB3A2;
  --mark: #C8452A;
  --mark-deep: #A6331D;
  --mark-wash: #F3DED6;
  --resolved: #2D5A4C;
  --resolved-wash: #DCE8E1;
  --attention: #9A6518;
  --attention-wash: #F2E5CC;
  --white: #FFFFFF;
  --shadow-paper: 0 1px 0 rgba(23, 20, 16, .04);
  --shadow-float: 0 24px 80px rgba(23, 20, 16, .20), 0 2px 8px rgba(23, 20, 16, .08);
  --ease: cubic-bezier(.2, .7, .2, 1);
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-ui: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
img, svg { display: block; }
::selection { background: var(--mark-wash); color: var(--ink); }

:focus-visible {
  outline: 2px solid var(--mark);
  outline-offset: 2px;
}

.micro {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.serif { font-family: var(--font-display); font-weight: 500; letter-spacing: -.02em; }

/* --------------------------------------------------------------------------
   Boot / login
   -------------------------------------------------------------------------- */
.boot, .login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 20px;
  background:
    radial-gradient(circle at 78% 18%, rgba(200, 69, 42, .055), transparent 32%),
    var(--paper);
}

.boot { text-align: center; gap: 14px; }
.boot p { margin: 0; color: var(--ink-muted); }
.boot-mark {
  width: 44px; height: 52px; border: 1px solid var(--ink); border-radius: 2px;
  position: relative; margin: 0 auto 8px; background: var(--paper-raised);
  transform: rotate(-2deg); box-shadow: 3px 3px 0 var(--rule);
}
.boot-mark::after {
  content: ""; position: absolute; width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid var(--mark); right: -5px; bottom: 9px; background: var(--paper);
}

.login__grid {
  width: min(1040px, 100%);
  display: grid;
  grid-template-columns: 1.15fr .85fr;
  gap: 0;
  border: 1px solid var(--rule);
  background: var(--paper-raised);
  box-shadow: var(--shadow-paper);
}

.login__story {
  padding: 56px;
  border-right: 1px solid var(--rule);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 560px;
  background:
    linear-gradient(0deg, rgba(200, 69, 42, .03), rgba(200, 69, 42, .03)),
    var(--paper-raised);
}
.login__story h1 {
  font-family: var(--font-display);
  font-size: clamp(40px, 5vw, 64px);
  line-height: 1.02;
  letter-spacing: -.035em;
  font-weight: 500;
  margin: 24px 0 20px;
  max-width: 9ch;
}
.login__story p {
  max-width: 42ch;
  color: var(--ink-soft);
  font-size: 15px;
  line-height: 1.6;
}
.login__folio {
  display: flex; align-items: center; gap: 12px;
  font-family: var(--font-mono); font-size: 10px; letter-spacing: .1em;
  text-transform: uppercase; color: var(--ink-muted);
}
.login__folio::before { content: ""; width: 32px; height: 1px; background: var(--mark); }

.login__form {
  padding: 56px 48px;
  display: flex; flex-direction: column; justify-content: center;
}
.login__form h2 {
  font-family: var(--font-display); font-weight: 500; font-size: 26px;
  letter-spacing: -.02em; margin: 0 0 8px;
}
.login__form > p { margin: 0 0 28px; color: var(--ink-muted); }
.login__privacy {
  margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--rule);
  font-size: 12px; color: var(--ink-muted); line-height: 1.55;
}

.brand-mark {
  width: 30px; height: 36px; border: 1.5px solid var(--ink); border-radius: 2px;
  position: relative; background: var(--paper-raised); flex: none;
  transform: rotate(-1.5deg);
  box-shadow: 2px 2px 0 var(--rule);
}
.brand-mark::before {
  content: ""; position: absolute; left: 6px; top: 8px; width: 12px; height: 1.5px;
  background: var(--ink); box-shadow: 0 6px 0 var(--ink), 0 12px 0 var(--rule-strong);
}
.brand-mark::after {
  content: ""; position: absolute; right: -5px; bottom: 5px; width: 11px; height: 11px;
  border-radius: 50%; border: 2px solid var(--mark); background: var(--paper-raised);
}

/* --------------------------------------------------------------------------
   Shell
   -------------------------------------------------------------------------- */
.shell { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }

.rail {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 28px;
  padding: 24px 18px 20px;
  border-right: 1px solid var(--rule);
  background: rgba(251, 248, 241, .62);
  backdrop-filter: blur(8px);
}

.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.brand__name {
  font-family: var(--font-display); font-size: 22px; font-weight: 600;
  letter-spacing: -.03em; line-height: 1;
}
.brand__sub {
  display: block; margin-top: 4px; font-family: var(--font-mono);
  font-size: 8.5px; letter-spacing: .12em; color: var(--ink-muted); text-transform: uppercase;
}

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav__link {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 9px; border-radius: 4px; text-decoration: none;
  color: var(--ink-soft); font-size: 13px; font-weight: 500;
  transition: background .15s var(--ease), color .15s var(--ease);
}
.nav__link svg { width: 16px; height: 16px; opacity: .72; }
.nav__link:hover { background: var(--paper-deep); color: var(--ink); }
.nav__link.is-active { background: var(--white); color: var(--ink); box-shadow: var(--shadow-paper); }
.nav__link.is-active svg { color: var(--mark); opacity: 1; }

.rail__spacer { flex: 1; }

.server-card {
  border-top: 1px solid var(--rule);
  padding-top: 16px;
  display: flex; flex-direction: column; gap: 7px;
}
.server-card__row { display: flex; align-items: center; gap: 7px; }
.server-card__dot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--resolved);
  box-shadow: 0 0 0 3px var(--resolved-wash);
}
.server-card__url {
  font-family: var(--font-mono); font-size: 9.5px; color: var(--ink-muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.rail__user { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-top: 12px; }
.rail__user .micro { font-size: 9px; }
.icon-btn {
  width: 30px; height: 30px; border: 1px solid transparent; border-radius: 5px;
  background: transparent; color: var(--ink-muted);
  display: inline-grid; place-items: center; flex: none;
  transition: background .15s var(--ease), color .15s var(--ease), border-color .15s var(--ease);
}
.icon-btn:hover { background: var(--paper-deep); color: var(--ink); border-color: var(--rule); }
.icon-btn svg { width: 16px; height: 16px; }

.main {
  width: 100%;
  max-width: 1220px;
  margin: 0 auto;
  padding: 34px 40px 80px;
}

.topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 26px; }
.topbar h1 {
  font-family: var(--font-display); font-weight: 500; font-size: clamp(30px, 3.4vw, 44px);
  line-height: 1.03; letter-spacing: -.035em; margin: 4px 0 0;
}
.topbar__meta { display: flex; align-items: center; gap: 10px; margin-top: 10px; color: var(--ink-muted); font-size: 12px; flex-wrap: wrap; }
.topbar__meta a { color: var(--ink-soft); text-decoration: none; border-bottom: 1px solid var(--rule-strong); display: inline-flex; align-items: center; gap: 4px; }
.topbar__meta svg { width: 12px; height: 12px; display: inline-block; vertical-align: -1px; }
.topbar__actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }

.backlink {
  display: inline-flex; align-items: center; gap: 6px; text-decoration: none;
  font-family: var(--font-mono); font-size: 10px; letter-spacing: .06em;
  text-transform: uppercase; color: var(--ink-muted); margin-bottom: 14px;
}
.backlink:hover { color: var(--mark); }
.backlink svg { width: 12px; height: 12px; }

/* --------------------------------------------------------------------------
   Buttons / inputs
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 36px; padding: 0 13px; border-radius: 6px;
  border: 1px solid var(--rule-strong); background: var(--paper-raised);
  color: var(--ink); font-size: 12.5px; font-weight: 600;
  text-decoration: none; white-space: nowrap;
  transition: background .15s var(--ease), border-color .15s var(--ease), color .15s var(--ease), transform .1s var(--ease);
}
.btn:hover { background: var(--white); border-color: var(--ink-muted); }
.btn:active { transform: translateY(1px); }
.btn svg { width: 14px; height: 14px; }
.btn--primary { background: var(--mark); border-color: var(--mark); color: var(--white); }
.btn--primary:hover { background: var(--mark-deep); border-color: var(--mark-deep); color: var(--white); }
.btn--ghost { background: transparent; border-color: transparent; color: var(--ink-muted); }
.btn--ghost:hover { background: var(--paper-deep); color: var(--ink); border-color: transparent; }
.btn--danger { color: var(--mark-deep); }
.btn--small { height: 30px; padding: 0 10px; font-size: 11px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field > label { font-family: var(--font-mono); font-size: 9.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-muted); }
.input, .textarea, .select {
  width: 100%; border: 1px solid var(--rule); border-radius: 4px;
  background: var(--white); padding: 9px 10px; outline: none;
  font-size: 13.5px; color: var(--ink);
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.input { height: 38px; }
.textarea { min-height: 82px; resize: vertical; line-height: 1.5; }
.input:focus, .textarea:focus, .select:focus {
  border-color: var(--ink); box-shadow: 0 0 0 3px var(--mark-wash);
}
.input::placeholder, .textarea::placeholder { color: #A99C8B; }
.field__hint { font-size: 11px; color: var(--ink-muted); line-height: 1.45; }
.field--inline { flex-direction: row; align-items: center; gap: 8px; }
.checkbox { width: 15px; height: 15px; accent-color: var(--mark); }

/* --------------------------------------------------------------------------
   Stats
   -------------------------------------------------------------------------- */
.stats {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid var(--ink); border-bottom: 1px solid var(--rule);
  margin: 22px 0 28px;
}
.stat { padding: 14px 16px 15px; border-right: 1px solid var(--rule); }
.stat:last-child { border-right: 0; }
.stat__n {
  font-family: var(--font-display); font-size: 28px; line-height: 1;
  letter-spacing: -.03em; font-variant-numeric: tabular-nums;
}
.stat__l { margin-top: 5px; font-family: var(--font-mono); font-size: 9px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-muted); }

/* --------------------------------------------------------------------------
   Review list
   -------------------------------------------------------------------------- */
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.section-head h2 { font-family: var(--font-display); font-size: 18px; font-weight: 500; letter-spacing: -.02em; margin: 0; }
.section-head .micro { letter-spacing: .08em; }

.review-list { border-top: 1px solid var(--ink); }
.review-row {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) 110px 92px 94px 86px;
  gap: 14px; align-items: center;
  padding: 16px 6px 16px 0;
  border-bottom: 1px solid var(--rule);
  text-decoration: none;
  transition: background .15s var(--ease), padding .15s var(--ease);
}
.review-row:hover { background: rgba(251, 248, 241, .72); padding-left: 8px; padding-right: 0; }
.review-row__name {
  font-family: var(--font-display); font-size: 20px; font-weight: 500;
  letter-spacing: -.025em; line-height: 1.15;
}
.review-row__url {
  margin-top: 4px; font-family: var(--font-mono); font-size: 9.5px;
  color: var(--ink-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.review-row__num {
  font-family: var(--font-display); font-size: 20px; letter-spacing: -.02em;
  font-variant-numeric: tabular-nums; line-height: 1;
}
.review-row__num span { display: block; margin-top: 4px; font-family: var(--font-mono); font-size: 8.5px; letter-spacing: .08em; color: var(--ink-muted); }
.review-row__time { font-family: var(--font-mono); font-size: 9.5px; color: var(--ink-muted); text-align: right; }

.stamp {
  display: inline-flex; align-items: center; gap: 5px;
  border: 1px solid var(--rule-strong); background: transparent;
  padding: 3px 7px; border-radius: 2px;
  font-family: var(--font-mono); font-size: 8.5px; font-weight: 600;
  letter-spacing: .08em; text-transform: uppercase; color: var(--ink-muted);
  white-space: nowrap;
}
.stamp--open { color: var(--mark-deep); border-color: rgba(200, 69, 42, .38); background: var(--mark-wash); }
.stamp--closed { color: var(--ink-muted); }
.stamp--resolved { color: var(--white); border-color: var(--resolved); background: var(--resolved); }
.stamp--resolved::before { content: "✓"; font-size: 9px; line-height: 1; }
.stamp--progress { color: var(--attention); border-color: rgba(154, 101, 24, .3); background: var(--attention-wash); }

.empty {
  border: 1px dashed var(--rule-strong); background: rgba(251, 248, 241, .55);
  padding: 42px 28px; text-align: center;
}
.empty h3 { font-family: var(--font-display); font-weight: 500; font-size: 24px; letter-spacing: -.025em; margin: 0 0 6px; }
.empty p { margin: 0 auto; max-width: 44ch; color: var(--ink-muted); font-size: 13px; }

.skeleton { height: 66px; border-bottom: 1px solid var(--rule); background: linear-gradient(90deg, transparent, rgba(255,255,255,.55), transparent); background-size: 220% 100%; animation: shimmer 1.6s linear infinite; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -20% 0; } }

/* --------------------------------------------------------------------------
   Review detail
   -------------------------------------------------------------------------- */
.detail-grid { display: grid; grid-template-columns: 246px minmax(0, 1fr); gap: 32px; align-items: start; margin-top: 26px; }

.page-index { border-top: 1px solid var(--ink); position: sticky; top: 24px; }
.page-index__head { display: flex; align-items: center; justify-content: space-between; padding: 12px 2px 9px; border-bottom: 1px solid var(--rule); }
.page-item {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center;
  width: 100%; text-align: left; border: 0; border-bottom: 1px solid var(--rule);
  background: transparent; padding: 11px 4px; color: var(--ink);
  transition: background .15s var(--ease), padding .15s var(--ease);
}
.page-item:hover { background: rgba(251, 248, 241, .7); padding-left: 8px; }
.page-item.is-active { background: var(--white); padding-left: 8px; box-shadow: inset 2px 0 0 var(--mark); }
.page-item__label { font-size: 12.5px; font-weight: 500; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.page-item__key { margin-top: 3px; font-family: var(--font-mono); font-size: 8.5px; color: var(--ink-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.page-item__n { font-family: var(--font-mono); font-size: 9px; color: var(--ink-muted); border: 1px solid var(--rule); padding: 1px 5px; border-radius: 2px; }
.page-item.is-active .page-item__n { color: var(--mark-deep); border-color: rgba(200, 69, 42, .35); background: var(--mark-wash); }
.page-item.is-done .page-item__label { color: var(--ink-muted); }
.page-item.is-done .page-item__key { opacity: .6; }
.page-item__n--done { color: var(--resolved); border-color: rgba(45, 90, 76, .3); background: var(--resolved-wash); }
.page-item.is-active .page-item__n--done { color: var(--resolved); border-color: rgba(45, 90, 76, .45); background: var(--resolved-wash); }
.page-index__all { width: 100%; border: 0; background: transparent; padding: 10px 4px; text-align: left; font-family: var(--font-mono); font-size: 9px; letter-spacing: .06em; text-transform: uppercase; color: var(--mark); }
.page-index__all:hover { background: var(--mark-wash); }

.comments-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--rule); padding-bottom: 10px; margin-bottom: 4px; }
.comments-head h2 { font-family: var(--font-display); font-size: 20px; font-weight: 500; letter-spacing: -.025em; margin: 0; }
.comments-head .micro { white-space: nowrap; }
.filters { display: flex; gap: 4px; }
.filter {
  border: 1px solid transparent; background: transparent; border-radius: 3px;
  padding: 4px 8px; font-family: var(--font-mono); font-size: 8.5px;
  letter-spacing: .06em; text-transform: uppercase; color: var(--ink-muted);
}
.filter:hover { background: var(--paper-deep); color: var(--ink); }
.filter.is-active { border-color: var(--rule); background: var(--white); color: var(--ink); }
.filter[data-filter="resolved"].is-active { color: var(--resolved); border-color: rgba(45, 90, 76, .4); background: var(--resolved-wash); }
.filter__n { margin-left: 3px; opacity: .58; font-variant-numeric: tabular-nums; }
.filter.is-active .filter__n { opacity: .9; }
.filter__n--done { color: var(--resolved); opacity: .9; }

.comment-list { border-top: 1px solid var(--ink); margin-top: 12px; }
.comment {
  display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 12px;
  padding: 18px 2px 18px 0; border-bottom: 1px solid var(--rule);
}
.avatar {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  color: var(--white); font-family: var(--font-ui); font-size: 10px; font-weight: 600;
  letter-spacing: .01em; flex: none;
}
.comment__meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.comment__author { font-size: 12.5px; font-weight: 600; }
.comment__page {
  font-family: var(--font-mono); font-size: 8.5px; color: var(--mark-deep);
  border-left: 2px solid var(--mark); background: var(--mark-wash);
  padding: 2px 6px; text-transform: uppercase; letter-spacing: .04em;
}
.comment__time { margin-left: auto; font-family: var(--font-mono); font-size: 9px; color: var(--ink-muted); }
.comment__content { min-width: 0; }
.comment__layout { display: grid; grid-template-columns: minmax(0, 1fr) 248px; gap: 20px; align-items: start; }
.comment__body { min-width: 0; }
.comment__text { margin-top: 7px; font-size: 13.5px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.comment__shot {
  position: relative; display: block; width: 100%; aspect-ratio: 1440 / 1000;
  overflow: hidden; border: 1px solid var(--rule-strong); background: var(--paper-deep);
  transition: border-color .15s ease;
}
.comment__shot:hover { border-color: var(--mark); }
.comment__shot::before {
  content: "Rendering preview…"; position: absolute; inset: 0; display: grid; place-items: center;
  padding: 12px; text-align: center; font-family: var(--font-mono); font-size: 8.5px;
  letter-spacing: .04em; text-transform: uppercase; color: var(--ink-muted);
}
.comment__shot.is-ready::before { display: none; }
.comment__shot.is-missing { display: none; }
.comment__shot--empty {
  display: grid; place-items: center; padding: 12px; text-align: center;
  border-style: dashed; background: transparent;
  font-family: var(--font-mono); font-size: 8px; letter-spacing: .04em;
  text-transform: uppercase; color: var(--ink-muted);
}
.comment__shot--empty::before { display: none; }
.comment__shot__img { display: block; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .2s ease; }
.comment__shot.is-ready .comment__shot__img { opacity: 1; }
.comment__shot__label {
  position: absolute; right: 7px; bottom: 7px; padding: 3px 6px;
  background: rgba(20, 18, 16, .78); color: var(--white); font-family: var(--font-mono);
  font-size: 8px; letter-spacing: .06em; text-transform: uppercase;
  opacity: 0; transition: opacity .15s ease;
}
.comment__shot.is-ready .comment__shot__label { opacity: 1; }
.comment__replies { margin-top: 11px; border-left: 1px solid var(--rule-strong); padding-left: 12px; display: flex; flex-direction: column; gap: 8px; }
.reply { font-size: 12.5px; line-height: 1.45; color: var(--ink-soft); }
.reply b { color: var(--ink); font-weight: 600; }
.reply time { margin-left: 6px; font-family: var(--font-mono); font-size: 8.5px; color: var(--ink-muted); }
.comment__tools { display: flex; gap: 4px; margin-top: 10px; }
.comment__tools .btn { height: 26px; font-size: 10.5px; padding: 0 8px; }
.comment--resolved {
  position: relative;
  background: linear-gradient(90deg, rgba(45, 90, 76, .075), rgba(45, 90, 76, .02) 62%, transparent);
}
.comment--resolved::before {
  content: ""; position: absolute; left: -12px; top: 0; bottom: 0;
  width: 3px; background: var(--resolved);
}
.comment--resolved .comment__text { color: var(--ink-soft); }
.comment--resolved .comment__shot { opacity: .74; }
.comment--resolved .comment__shot:hover { opacity: 1; border-color: var(--resolved); }
.comment--resolved .comment__shot::after {
  content: "✓"; position: absolute; top: 8px; right: 8px; z-index: 2;
  width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;
  background: var(--resolved); color: var(--white); font-family: var(--font-ui);
  font-size: 13px; font-weight: 700; box-shadow: 0 1px 4px rgba(0, 0, 0, .28);
}
.comment--resolved .comment__shot--empty::after { display: none; }
.comment--resolved .comment__tools .btn { opacity: .72; }
.comment--resolved .comment__tools .btn:hover { opacity: 1; }

.thread-empty { padding: 48px 20px; text-align: center; border-bottom: 1px solid var(--rule); }
.thread-empty h3 { font-family: var(--font-display); font-size: 22px; font-weight: 500; letter-spacing: -.02em; margin: 0 0 6px; }
.thread-empty p { margin: 0; color: var(--ink-muted); font-size: 12.5px; }

.invite-strip { display: flex; gap: 24px; flex-wrap: wrap; margin-top: 18px; }
.invite-strip__item { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ink-soft); }
.invite-strip__item .stamp { text-transform: none; letter-spacing: 0; font-family: var(--font-ui); font-size: 10px; font-weight: 500; }

/* --------------------------------------------------------------------------
   Modal
   -------------------------------------------------------------------------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100; background: rgba(23, 20, 16, .46);
  display: flex; align-items: center; justify-content: center; padding: 24px;
  animation: fade-in .16s var(--ease);
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.modal {
  width: min(520px, 100%); max-height: min(86vh, 760px); overflow: auto;
  background: var(--paper-raised); border: 1px solid var(--rule-strong);
  box-shadow: var(--shadow-float); padding: 26px 26px 22px;
  animation: modal-in .22s var(--ease);
}
@keyframes modal-in { from { opacity: 0; transform: translateY(8px) scale(.99); } to { opacity: 1; transform: none; } }
.modal--wide { width: min(680px, 100%); }
.modal__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.modal__head h2 { font-family: var(--font-display); font-size: 26px; font-weight: 500; letter-spacing: -.03em; margin: 0; }
.modal__head p { margin: 4px 0 0; color: var(--ink-muted); font-size: 12px; }
.modal__x { border: 0; background: transparent; color: var(--ink-muted); padding: 2px; }
.modal__x:hover { color: var(--ink); }
.modal__foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 22px; padding-top: 14px; border-top: 1px solid var(--rule); }
.modal__note { font-size: 11.5px; color: var(--ink-muted); line-height: 1.5; }

.copybox {
  display: flex; gap: 6px; align-items: flex-start;
  border: 1px solid var(--rule); background: var(--white); padding: 4px;
}
.copybox code {
  flex: 1; min-width: 0; padding: 7px 7px; font-family: var(--font-mono);
  font-size: 10px; line-height: 1.55; overflow: hidden; white-space: pre-wrap;
  word-break: break-all; color: var(--ink-soft);
}
.copybox .btn { flex: none; border-radius: 3px; }

.invite-result { margin-top: 18px; }
.invite-result:first-of-type { margin-top: 0; }
.invite-result h3 { font-family: var(--font-mono); font-size: 9px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-muted); margin: 0 0 6px; }
.invite-result p { margin: 0 0 8px; font-size: 12px; color: var(--ink-soft); }
.export-status { display: flex; align-items: center; gap: 7px; margin: 9px 0 0; font-family: var(--font-mono); font-size: 9.5px; line-height: 1.5; color: var(--ink-muted); }
.export-status::before { content: ""; width: 6px; height: 6px; flex: none; border-radius: 50%; background: var(--mark); animation: export-pulse 1.2s ease-in-out infinite; }
@keyframes export-pulse { 0%, 100% { opacity: .25; } 50% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .export-status::before { animation: none; opacity: 1; } }

.invite-list { margin-top: 18px; border-top: 1px solid var(--rule); }
.invite-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--rule); }
.invite-row__name { font-size: 12.5px; font-weight: 500; }
.invite-row__meta { font-family: var(--font-mono); font-size: 8.5px; color: var(--ink-muted); margin-top: 2px; }
.invite-row__actions { margin-left: auto; }
.invite-row__actions .btn { height: 24px; font-size: 10px; padding: 0 7px; }

/* --------------------------------------------------------------------------
   Settings
   -------------------------------------------------------------------------- */
.settings-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, .75fr); gap: 32px; margin-top: 28px; }
.panel { border: 1px solid var(--rule); background: var(--paper-raised); padding: 22px; box-shadow: var(--shadow-paper); }
.panel h2 { font-family: var(--font-display); font-weight: 500; font-size: 21px; letter-spacing: -.02em; margin: 0 0 4px; }
.panel > .micro { display: block; margin-bottom: 16px; }
.panel p { font-size: 12.5px; color: var(--ink-soft); line-height: 1.55; }
.codeblock {
  background: var(--ink); color: #EDE7DB; padding: 14px; overflow: auto;
  font-family: var(--font-mono); font-size: 10px; line-height: 1.6; white-space: pre;
  border-radius: 3px;
}
.codeblock .accent { color: #E8A08E; }
.settings-list { display: flex; flex-direction: column; gap: 14px; margin-top: 14px; }
.settings-item { padding-bottom: 13px; border-bottom: 1px solid var(--rule); }
.settings-item:last-child { border-bottom: 0; padding-bottom: 0; }
.settings-item h3 { font-family: var(--font-mono); font-size: 9px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-muted); margin: 0 0 5px; }
.settings-item p { margin: 0; }

/* --------------------------------------------------------------------------
   Toasts
   -------------------------------------------------------------------------- */
#toasts { position: fixed; right: 20px; bottom: 20px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--ink); color: var(--paper); padding: 10px 14px;
  border-radius: 4px; box-shadow: var(--shadow-float); font-size: 12px;
  animation: toast-in .2s var(--ease);
  max-width: 340px;
}
.toast--error { background: var(--mark-deep); }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* --------------------------------------------------------------------------
   Utilities / responsive
   -------------------------------------------------------------------------- */
.hidden { display: none !important; }
.muted { color: var(--ink-muted); }
.mono { font-family: var(--font-mono); }
.nowrap { white-space: nowrap; }
.spacer { flex: 1; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

@media (max-width: 980px) {
  .shell { grid-template-columns: 1fr; }
  .rail {
    position: static; height: auto; flex-direction: row; align-items: center;
    gap: 18px; padding: 12px 18px; border-right: 0; border-bottom: 1px solid var(--rule);
    backdrop-filter: none;
  }
  .brand__sub, .server-card, .rail__user .micro { display: none; }
  .nav { flex-direction: row; margin-left: auto; }
  .nav__link span { display: none; }
  .rail__spacer { display: none; }
  .main { padding: 24px 20px 64px; }
  .detail-grid { grid-template-columns: 1fr; gap: 22px; }
  .page-index { position: static; }
  .page-index__items { display: flex; gap: 4px; overflow-x: auto; padding-bottom: 4px; }
  .page-item { min-width: 150px; border: 1px solid var(--rule); border-bottom: 1px solid var(--rule); padding: 8px; }
  .page-item.is-active { box-shadow: inset 0 2px 0 var(--mark); padding-left: 8px; }
  .page-index__all { display: none; }
  .settings-grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .login__grid { grid-template-columns: 1fr; }
  .login__story { min-height: 0; padding: 32px 26px; border-right: 0; border-bottom: 1px solid var(--rule); }
  .login__story h1 { font-size: 38px; }
  .login__form { padding: 32px 26px; }
  .review-row { grid-template-columns: minmax(0, 1fr) auto; gap: 8px 14px; }
  .review-row__num, .review-row__time { display: none; }
  .review-row .stamp { justify-self: end; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stat:nth-child(2) { border-right: 0; }
  .stat:nth-child(1), .stat:nth-child(2) { border-bottom: 1px solid var(--rule); }
  .topbar { flex-direction: column; }
  .topbar__actions { justify-content: flex-start; }
  .comments-head { flex-wrap: wrap; }
  .comment__time { margin-left: 0; width: 100%; }
  .comment__layout { grid-template-columns: 1fr; }
  .comment__shot { max-width: 340px; }
}

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