:root {
  color-scheme: light;
  --paper: #f6f4ee;
  --white: #fffefa;
  --ink: #262a24;
  --muted: #5d6358;
  --line: #dcded1;
  --forest: #2a492e;
  --fern: #e7eddb;
  --warm: #ede7d8;
  --danger: #943833;
  font-family: system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 300px; color: var(--ink); background: var(--paper); }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid #668061; outline-offset: 3px; }
button, select, input, textarea { font: inherit; color: inherit; }
button, .button { cursor: pointer; }
a { color: var(--forest); overflow-wrap: anywhere; }
h1, h2 { font-family: Georgia, 'Times New Roman', serif; letter-spacing: -.035em; font-weight: 500; line-height: 1.06; margin: 0; }
h1 { font-size: clamp(2.5rem, 6vw, 4.5rem); }
h2 { font-size: 1.75rem; }
h3 { margin: 0 0 .5rem; font-size: 1.03rem; }
p { margin: .5rem 0; }
button, .button { border: 1px solid var(--line); border-radius: .55rem; background: var(--white); padding: .55rem .85rem; text-decoration: none; min-height: 40px; }
button:hover, .button:hover { border-color: #85937d; }
button:disabled { opacity: .55; cursor: wait; }
.primary { background: var(--forest); border-color: var(--forest); color: #fff; }
.primary:hover { background: #385738; }
.tertiary { background: transparent; border-color: transparent; }
.danger { color: var(--danger); }
.muted { color: var(--muted); }
.login { min-height: 100dvh; display: grid; place-items: center; padding: 2rem 1rem; }
.login-box { width: min(100%, 440px); background: var(--white); border: 1px solid var(--line); padding: clamp(1.35rem, 5vw, 3rem); border-radius: 1.4rem; }
.login-box h1 { margin: 1.25rem 0 .8rem; }
.login-box form { display: grid; gap: .65rem; margin-top: 1.5rem; }
.login-box .symbol { width: 48px; height: 48px; font-size: 1.7rem; }
#login-error { min-height: 1.5rem; color: var(--danger); }
.shell { display: grid; grid-template-columns: 245px minmax(0, 1fr); min-height: 100dvh; }
.sidebar { height: 100dvh; position: sticky; top: 0; display: flex; flex-direction: column; padding: 1.6rem .9rem .7rem; border-right: 1px solid var(--line); overflow: auto; }
.brand { display: flex; align-items: center; gap: .8rem; padding: 0 .55rem 1.6rem; font-family: Georgia, serif; font-size: 1.15rem; line-height: 1.02; }
.symbol { display: inline-grid; place-items: center; flex: none; width: 36px; height: 36px; border-radius: 50%; background: var(--forest); color: #f2f0e5; }
#nav { display: grid; gap: .26rem; }
#nav button { text-align: left; font-size: .91rem; border: 0; padding: .48rem .72rem; min-height: 36px; }
#nav button:hover { background: var(--warm); }
#nav button[aria-current] { background: var(--fern); color: var(--forest); font-weight: 650; }
.sidebar-foot { margin-top: auto; padding: 1.3rem .55rem .3rem; color: var(--muted); font-size: .71rem; letter-spacing: .12em; }
.privacy-dot { display: inline-block; width: .56rem; height: .56rem; background: #6a875a; border-radius: 50%; margin-right: .32rem; }
.topbar { display: flex; justify-content: space-between; align-items: center; padding: .65rem clamp(1rem, 4vw, 3.5rem); height: 66px; border-bottom: 1px solid var(--line); color: var(--muted); }
.menu { display: none; }
.view { padding: clamp(1.15rem, 4vw, 3.5rem); max-width: 1240px; margin: auto; outline: none; }
.lead { margin: .8rem 0 1.7rem; color: var(--muted); max-width: 65ch; font-size: 1.04rem; }
.page-title { display: flex; gap: 1rem; align-items: end; justify-content: space-between; flex-wrap: wrap; margin-bottom: 1rem; }
.grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(100%,290px),1fr)); gap: .85rem; }
.stack { display: grid; gap: .85rem; }
.card { border: 1px solid var(--line); background: var(--white); border-radius: .8rem; padding: 1rem 1.1rem; min-width: 0; overflow-wrap: anywhere; }
.card header { display: flex; align-items: baseline; flex-wrap: wrap; gap: .65rem; justify-content: space-between; }
.card > p { white-space: pre-wrap; }
.chip { border-radius: 1rem; padding: .12rem .55rem; background: var(--fern); color: var(--forest); font-size: .8rem; }
.actions { display: flex; flex-wrap: wrap; gap: .45rem; margin-top: .9rem; }
input:not([type=checkbox]), select, textarea { width: 100%; background: var(--white); border: 1px solid var(--line); border-radius: .55rem; padding: .65rem .75rem; }
input[type=checkbox] { inline-size: 1.05rem; block-size: 1.05rem; vertical-align: middle; }
label { font-size: .9rem; font-weight: 600; display: block; }
.field { display: grid; gap: .27rem; }
textarea { min-height: 6rem; resize: vertical; }
.chat-tools { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, .65fr) auto; gap: .6rem; align-items: end; }
.messages { margin: 1.1rem 0; padding: .2rem; display: grid; gap: .8rem; }
.message { max-width: min(84%, 650px); }
.message.user { justify-self: end; background: var(--fern); }
.message.assistant { justify-self: start; }
.message p { margin-bottom: 0; }
.composer { display: grid; gap: .55rem; margin-top: 1rem; }
.composer .actions { margin-top: 0; }
.notice { margin: 1rem clamp(1rem,4vw,3.5rem) 0; border: 1px solid var(--line); color: var(--forest); border-radius: .6rem; padding: .7rem .9rem; background: var(--fern); }
.notice.error { color: var(--danger); background: #fbebe6; }
dialog { max-height: 86dvh; width: min(590px, calc(100% - 1.5rem)); overflow: auto; background: var(--white); color: var(--ink); border: 1px solid var(--line); border-radius: 1rem; padding: 1.35rem; }
dialog::backdrop { background: #1d281e88; }
dialog form { display: grid; gap: .8rem; }
dialog h2 { margin-bottom: .25rem; }
.empty { border: 1px dashed #acb39f; border-radius: .8rem; padding: 1rem; color: var(--muted); }
details { margin-top: .7rem; overflow-wrap: anywhere; }
summary { cursor: pointer; }
@media (max-width: 760px) {
  .shell { display: block; }
  .sidebar { display: none; }
  .sidebar.open { display: flex; height: auto; max-height: calc(100dvh - 66px); position: fixed; top: 66px; left: 0; right: 0; z-index: 2; background: var(--paper); border-bottom: 1px solid var(--line); }
  .sidebar.open .brand { display: none; }
  .topbar { position: sticky; top: 0; background: var(--paper); z-index: 1; }
  .menu { display: inline-block; }
  .message { max-width: 92%; }
  .chat-tools { grid-template-columns: 1fr 1fr; }
  .chat-tools > button { justify-self: start; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }

.recovery-original { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 48vh; overflow: auto; }
