:root {
  --ink: #24332e;
  --muted: #576a61;
  --white: #fff;
  --border: #dbe5dc;
  --paper: #f5f7f2;
  --green: #1d5644;
  --dark: #153b31;
  --light: #e8f2e9;
  --sand: #e4bb83;
  --note: #fbf1df;
  color: var(--ink);
  background: var(--paper);
  font-family: "Segoe UI", system-ui, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
small { color: var(--muted); }
button, input, textarea, select { font: inherit; }
button, input, textarea, select { border: 1px solid var(--border); border-radius: 8px; padding: 9px 12px; background: var(--white); color: var(--ink); }
button { cursor: pointer; min-height: 42px; }
button:not(:disabled):hover { border-color: #7d9d8b; }
button:disabled { opacity: .5; cursor: default; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 3px solid #3a876f; outline-offset: 2px; }
button.primary { background: var(--green); border-color: var(--green); color: var(--white); font-weight: 650; }
h1, h2, p, ul { margin: 0; }
h1 { font: 500 clamp(2rem, 4vw, 3.25rem)/1.05 Georgia, serif; letter-spacing: -.035em; }
h2 { font-size: 1.15rem; }
p { line-height: 1.5; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--dark); color: var(--white); padding: 14px max(16px, calc((100vw - 1160px) / 2)); }
.brand, .account, .actions { display: flex; align-items: center; gap: 10px; }
.brand { flex-shrink: 0; }
.mark { height: 38px; width: 38px; display: grid; place-items: center; border-radius: 50% 50% 50% 16%; background: var(--sand); color: var(--dark); font: bold 25px Georgia, serif; }
.account { min-width: 0; text-align: right; }
.account strong, .account small { display: block; overflow-wrap: anywhere; }
.account small { color: #c7dbd1; }
.account button { color: var(--white); background: transparent; border-color: #729486; }
.actions { flex-wrap: wrap; }
main { max-width: 1200px; margin: auto; padding: 18px 20px 40px; }
.status:not(:empty) { padding: 11px 14px; margin-bottom: 14px; background: var(--note); border-radius: 8px; }
.card { min-width: 0; background: var(--white); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 12px 24px #253b2b08; }
.login { max-width: 430px; margin: 6vh auto 0; padding: clamp(18px, 5vw, 30px); }
.login h1 { margin-bottom: 21px; }
form, label { display: grid; gap: 8px; }
form { gap: 14px; }
label { min-width: 0; font-weight: 600; }
input, textarea, select { width: 100%; min-width: 0; }
textarea { resize: vertical; }
.page-heading { display: flex; align-items: end; justify-content: space-between; flex-wrap: wrap; gap: 16px; margin: 12px 0 18px; }
.inbox { display: grid; grid-template-columns: minmax(220px, .75fr) minmax(0, 1.65fr); gap: 14px; align-items: start; }
.pane-heading { padding: 16px; border-bottom: 1px solid var(--border); }
.pane-heading small { display: block; margin-top: 5px; }
.pane-heading h2, .entry p, .conversation-list button { overflow-wrap: anywhere; }
.conversation-list { list-style: none; padding: 6px; display: grid; gap: 4px; max-height: 72vh; overflow: auto; }
.conversation-list button { width: 100%; display: grid; gap: 5px; text-align: left; border-color: transparent; }
.conversation-list button[aria-pressed="true"] { background: var(--light); border-color: #a6c0b2; }
.conversation-list small { justify-self: start; }
.pagination { justify-content: center; border-top: 1px solid var(--border); padding: 9px; }
.conversation .actions, .message-form { padding: 12px 16px; }
.entries { display: grid; gap: 10px; padding: 14px 16px; min-height: 115px; max-height: 460px; overflow-y: auto; background: var(--paper); }
.entry { padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--white); }
.entry.note { background: var(--note); }
.entry p { white-space: pre-wrap; }
.entry button { margin-top: 8px; min-height: 36px; }
.empty { padding: 18px 16px; color: var(--muted); }
dialog { width: min(calc(100% - 30px), 550px); max-height: calc(100dvh - 30px); overflow: auto; border: 1px solid var(--border); border-radius: 12px; padding: 22px; color: var(--ink); }
dialog::backdrop { background: #153b3177; }
.workspace-nav { margin: 5px 0 16px; }
.workspace-nav button[aria-current="page"] { background: var(--light); color: var(--dark); font-weight: 650; border-color: #a6c0b2; }
.rules-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); align-items: start; gap: 14px; }
.rules-card { padding: 16px; display: grid; gap: 14px; }
.rules-list { display: grid; gap: 10px; list-style: none; padding: 0; }
.rule-row { display: grid; gap: 8px; border: 1px solid var(--border); border-radius: 8px; padding: 12px; overflow-wrap: anywhere; }
.rule-row button { min-height: 36px; }
.rule-selection { display: flex; align-items: center; gap: 8px; }
.rule-selection input { min-height: auto; width: auto; }
.rule-meta { color: var(--muted); font-size: .9rem; }
.simulation-result:not(:empty) { padding: 12px; background: var(--light); display: grid; gap: 7px; border-radius: 8px; overflow-wrap: anywhere; }
@media (max-width: 680px) {
  .inbox, .rules-grid { grid-template-columns: 1fr; }
  .conversation-list { max-height: 240px; }
  main { padding-inline: 12px; }
}
