:root {
  --gold: #b98a35;
  --gold-2: #d5b56e;
  --gold-soft: #b98a35;
  --ink: #17231f;
  --ink-2: #183c31;
  --panel: #fffdf7;
  --line: rgba(23, 35, 31, .16);
  --cream: #17231f;
  --cream-dim: #65716b;
  --paper: #f3efe5;
  --paper-2: #e8e1d2;
  --forest: #183c31;
  --forest-deep: #0e2a22;
  --white: #fffdf7;
}

html { background: var(--paper); }
body {
  background: var(--paper);
  color: var(--ink);
  overflow: hidden;
}
a { color: var(--gold); }
.wrap { max-width: none; padding: 0; }

/* App header */
header.top {
  min-height: 76px; padding: 10px 22px; gap: 13px;
  background: var(--forest-deep); color: var(--white);
  border-bottom: 1px solid rgba(255,255,255,.16);
}
.crest { width: 48px; height: 48px; filter: none; }
.brand h1 { color: var(--white); font-size: 24px; font-weight: 600; letter-spacing: .01em; }
.brand p { color: var(--gold-2); font-size: 10px; font-weight: 500; letter-spacing: .12em; text-transform: uppercase; }
header.top button, header.top select {
  min-height: 38px; border-radius: 0; border-color: rgba(255,255,255,.2);
  background: rgba(255,255,255,.05); color: rgba(255,255,255,.82);
}
header.top button:hover, header.top select:hover { border-color: var(--gold-2); }
header.top select option { background: var(--forest-deep); color: white; }

button, select {
  border-radius: 0; border-color: var(--line); background: var(--white); color: var(--ink);
  min-height: 38px; transition: border-color .18s, background .18s, transform .18s;
}
button:hover, select:hover { border-color: var(--gold); }
button:focus-visible, select:focus-visible, input:focus-visible, textarea:focus-visible, a:focus-visible {
  outline: 2px solid var(--gold); outline-offset: 2px;
}
.btn-gold {
  background: var(--gold); color: var(--forest-deep); border: 1px solid var(--gold);
  border-radius: 0; font-weight: 600;
}
.btn-gold:hover { filter: none; background: var(--gold-2); transform: translateY(-1px); }

/* Three-pane workspace */
.main {
  grid-template-columns: 300px minmax(420px, 1fr) 280px; gap: 0; padding: 0;
  background: var(--white);
}
aside {
  border: 0; border-radius: 0; background: var(--paper-2); color: var(--ink);
}
aside.vault { border-right: 1px solid var(--line); }
aside.history { border-left: 1px solid var(--line); background: var(--paper); }
aside h2 {
  min-height: 58px; padding: 16px 16px 10px; color: var(--ink);
  font-size: 19px; font-weight: 600; border-bottom: 1px solid var(--line);
}
aside h2::before { content: ""; width: 28px; height: 1px; background: var(--gold); }
aside h2 button { margin-left: auto; }

/* Vault */
.search { padding: 12px; }
.search input {
  background: var(--white); color: var(--ink); border-color: var(--line);
  border-radius: 0; min-height: 41px; padding: 9px 11px;
}
.search input::placeholder { color: #818b86; }
.filelist { padding: 0 8px 12px; }
.filelist .grp { padding: 13px 8px 5px; color: var(--gold); font-weight: 600; letter-spacing: .12em; }
.filelist a { padding: 7px 8px; border-radius: 0; color: var(--cream-dim); }
.filelist a:hover, .filelist a.active { background: var(--forest); color: white; }
.asidefoot { border-top-color: var(--line); color: var(--cream-dim); background: rgba(255,255,255,.3); }

/* Chat */
.chatcol { padding: 0 24px; background: var(--white); }
.messages { padding: 26px 4px 18px; }
.msg { max-width: 900px; margin: 0 auto 24px; gap: 13px; }
.msg .who {
  width: 34px; height: 34px; border-radius: 0; border-color: var(--line);
  background: var(--paper); color: var(--forest);
}
.msg.asst .who { color: var(--forest); border-color: var(--gold); background: #f3ead5; }
.bubble .name { color: var(--gold); font-weight: 600; letter-spacing: .12em; }
.content { color: var(--ink); font-size: 15px; line-height: 1.68; }
.content h1, .content h2, .content h3 { color: var(--forest); font-weight: 600; }
.content code, .content pre { background: var(--paper); border-color: var(--line); border-radius: 0; }
.content blockquote { color: var(--cream-dim); border-left-color: var(--gold); }
.content th, .content td { border-color: var(--line); }
.approve { border-color: var(--gold); border-radius: 0; background: #f6ecd4; }
.cursor::after { color: var(--gold); }

.empty {
  max-width: 650px; margin: 12vh auto 0; color: var(--cream-dim); line-height: 1.75;
}
.empty .big {
  margin-bottom: 14px; color: var(--forest); font-size: clamp(29px, 3vw, 43px);
  line-height: 1.03; font-weight: 600;
}
.empty .big::after {
  content: ""; display: block; width: 54px; height: 2px; margin: 18px auto 0; background: var(--gold);
}

/* History */
.histlist { padding: 9px; }
.histitem { border-radius: 0; padding: 10px 9px; border-bottom: 1px solid var(--line); }
.histitem:hover { background: rgba(255,255,255,.55); }
.histitem.active { background: var(--forest); color: white; border: 0; }
.histitem .when { color: var(--cream-dim); }
.histitem.active .when { color: rgba(255,255,255,.6); }

/* Composer */
.composer {
  padding: 13px 0 15px; border-top-color: var(--line); background: var(--white);
}
.composer .box { gap: 9px; }
textarea {
  min-height: 52px; border-radius: 0; border-color: var(--line); background: var(--paper);
  color: var(--ink); padding: 13px 14px;
}
textarea::placeholder { color: #7d8782; }
textarea:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(185,138,53,.12); }
.composer #send { min-width: 88px; min-height: 52px; }
.hint { color: var(--cream-dim); }
.presets { gap: 6px; }
.presets button {
  border-radius: 999px; min-height: 32px; padding: 5px 12px; background: transparent;
  color: var(--cream-dim);
}
.presets button:hover { background: var(--paper); color: var(--ink); }

/* Reader */
#reader { background: rgba(14,42,34,.68); }
#reader .sheet { background: var(--white); color: var(--ink); border-left-color: var(--gold); }
#reader .rhead { border-bottom-color: var(--line); background: var(--forest-deep); }
#reader .rhead .rt { color: var(--gold-2); }
#reader .rhead button { border-color: rgba(255,255,255,.2); background: transparent; color: white; }
#reader .rbody { background: var(--white); }

/* Login */
#gate {
  background: linear-gradient(90deg, rgba(14,42,34,.98), rgba(14,42,34,.88)),
    radial-gradient(circle at 70% 20%, rgba(185,138,53,.22), transparent 42%) !important;
}
#loginForm {
  width: min(430px, calc(100vw - 32px)) !important; padding: 42px 38px !important;
  background: var(--white); border-top: 5px solid var(--gold); box-shadow: 0 30px 90px rgba(0,0,0,.3);
}
#loginForm img { width: 82px !important; height: 82px !important; margin-bottom: 18px !important; }
#loginForm h1 { color: var(--forest) !important; font-size: 38px !important; font-weight: 600 !important; }
#loginForm p { color: var(--cream-dim) !important; margin-bottom: 27px !important; }
#loginForm input {
  min-height: 48px; border-radius: 0 !important; border-color: var(--line) !important;
  background: var(--paper) !important; color: var(--ink) !important;
}
#loginForm input::placeholder { color: #7e8883; }
#loginForm .btn-gold { min-height: 48px; }

@media (max-width: 1200px) {
  .main { grid-template-columns: 280px minmax(0, 1fr); }
}
@media (max-width: 920px) {
  header.top { padding-inline: 14px; }
  header.top .brand p { display: none; }
  header.top select { max-width: 120px; }
  .main { grid-template-columns: 1fr; }
  .chatcol { padding-inline: 16px; }
}
@media (max-width: 620px) {
  header.top { min-height: 66px; gap: 7px; }
  .crest { width: 40px; height: 40px; }
  .brand h1 { font-size: 21px; }
  header.top #effort { display: none; }
  header.top select { max-width: 90px; padding-inline: 7px; }
  .chatcol { padding-inline: 11px; }
  .messages { padding-top: 18px; }
  .empty { margin-top: 8vh; }
  .presets { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 3px; }
  .presets button { flex: none; }
  #loginForm { padding: 34px 22px !important; }
}

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