@font-face {
  font-family: "Atkinson Hyperlegible";
  src: url("fonts/atkinson-hyperlegible-latin-400-normal.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Atkinson Hyperlegible";
  src: url("fonts/atkinson-hyperlegible-latin-700-normal.woff2") format("woff2");
  font-weight: 700; font-style: normal; font-display: swap;
}

:root {
  color-scheme: light;
  --paper: #EEF2F1;
  --surface: #FFFFFF;
  --ink: #1E2B2A;
  --muted: #5B6B69;
  --rule: #CFD8D6;
  --action: #2F5D8A;
  --action-ink: #FFFFFF;
  --open: #2F5D8A;
  --progress: #6A4C9C;
  --waiting: #9A6412;
  --done: #2E7255;
  --danger: #A83434;
  --focus: #2F5D8A;
  --radius-slate: 14px;
  --radius-row: 8px;
  --font: "Atkinson Hyperlegible", "Segoe UI", system-ui, -apple-system, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --paper: #141C1B;
    --surface: #1C2625;
    --ink: #E4ECEA;
    --muted: #9CAEAB;
    --rule: #33413F;
    --action: #7FAEDB;
    --action-ink: #0E1A26;
    --open: #7FAEDB;
    --progress: #B9A2E3;
    --waiting: #E2B15C;
    --done: #74C4A0;
    --danger: #EE8C8C;
    --focus: #7FAEDB;
  }
}

* { box-sizing: border-box; }
html { font-size: 106.25%; }   /* 17px base */
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--font); line-height: 1.5;
}
a { color: var(--action); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }

.top {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  max-width: 46rem; margin: 0 auto; padding: 1rem 1.25rem 0;
}
.brand { font-weight: 700; font-size: 1.05rem; text-decoration: none; color: var(--ink); }
.brand span { color: var(--muted); font-weight: 400; }
.top nav { display: flex; gap: .75rem; align-items: center; font-size: .9rem; color: var(--muted); }
.top nav form { margin: 0; }

main { max-width: 46rem; margin: 0 auto; padding: 1.25rem 1.25rem 4rem; }
h1 { font-size: 1.65rem; line-height: 1.2; margin: 0 0 .75rem; }
h2 { font-size: 1.2rem; line-height: 1.3; margin: 0 0 .6rem; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }

/* Box 1: the slate */
.slate {
  background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius-slate);
  padding: 1rem 1rem .85rem;
}
.slate label { display: block; font-weight: 700; margin-bottom: .4rem; }
.slate textarea {
  width: 100%; min-height: 6.5rem; resize: vertical; border: 0; padding: .25rem 0;
  font: inherit; font-size: 1.2rem; line-height: 1.45; color: var(--ink); background: transparent;
}
.slate textarea:focus-visible { outline: none; }
.slate:focus-within { border-color: var(--focus); box-shadow: 0 0 0 2px var(--focus); }
.slate-bar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem;
  border-top: 1px solid var(--rule); padding-top: .75rem; margin-top: .5rem;
}
.keys { display: flex; gap: .5rem; }
.key {
  display: inline-flex; align-items: baseline; gap: .4rem;
  border: 1px solid var(--rule); border-bottom-width: 3px; border-radius: 9px;
  background: var(--paper); color: var(--ink); font: inherit; font-size: .88rem;
  padding: .3rem .6rem; cursor: pointer;
}
.key b { font-size: 1.15rem; line-height: 1; }
.key:hover { border-color: var(--action); }
.key:active { border-bottom-width: 1px; transform: translateY(2px); }
.teams { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .75rem; }
.team-chip {
  font: inherit; font-size: .85rem; border: 1px solid var(--rule); border-radius: 999px;
  padding: .15rem .6rem; background: transparent; color: var(--muted); cursor: pointer;
}
.team-chip:hover { color: var(--ink); border-color: var(--action); }
.box1-msg:empty { display: none; }
.box1-msg { margin-top: .6rem; color: var(--danger); font-size: .95rem; }

button.primary, .primary {
  font: inherit; font-weight: 700; border: 0; border-radius: 9px; padding: .5rem 1rem;
  background: var(--action); color: var(--action-ink); cursor: pointer;
}
button.quiet {
  font: inherit; border: 1px solid var(--rule); border-radius: 9px; padding: .45rem .85rem;
  background: var(--surface); color: var(--ink); cursor: pointer;
}
button.link { font: inherit; border: 0; background: none; color: var(--action); padding: 0; cursor: pointer; text-decoration: underline; }

/* Box 2 */
.box2 { margin-top: 1.75rem; }
.box2-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; }
.flash { background: var(--surface); border-left: 4px solid var(--done); padding: .5rem .75rem; margin: 0 0 .75rem; border-radius: 4px; }
.error { background: var(--surface); border-left: 4px solid var(--danger); padding: .5rem .75rem; margin: 0 0 .75rem; border-radius: 4px; }
.rows { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.row {
  display: grid; grid-template-columns: auto 1fr auto; gap: .25rem .85rem; align-items: start;
  background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius-row);
  padding: .7rem .85rem; text-decoration: none; color: inherit;
}
.row:hover { border-color: var(--action); }
.row .num { font-weight: 700; color: var(--muted); min-width: 2.5rem; }
.row .title { font-weight: 700; }
.row .meta { grid-column: 2 / 4; color: var(--muted); font-size: .88rem; display: flex; flex-wrap: wrap; gap: .25rem 1rem; }
.empty { background: var(--surface); border: 1px dashed var(--rule); border-radius: var(--radius-row); padding: 1rem; }

.status { font-size: .82rem; font-weight: 700; white-space: nowrap; padding: .1rem .5rem; border-radius: 999px; border: 1.5px solid currentColor; }
.status-open { color: var(--open); }
.status-in_progress { color: var(--progress); }
.status-waiting { color: var(--waiting); }
.status-resolved, .status-closed { color: var(--done); }

/* Ticket view */
.ticket { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius-row); padding: 1rem; }
.ticket-head { display: flex; justify-content: space-between; gap: 1rem; align-items: start; }
.ticket-head h2 { margin: 0; }
.original { white-space: pre-wrap; margin: .75rem 0 1rem; color: var(--muted); }
.where { display: grid; grid-template-columns: repeat(3, 1fr); gap: .75rem; margin: 0 0 1rem; padding: .75rem 0; border-block: 1px solid var(--rule); }
.where dt { font-size: .82rem; color: var(--muted); }
.where dd { margin: 0; font-weight: 700; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: 1rem; }
.actions form { margin: 0; display: flex; gap: .4rem; align-items: center; }
.actions select { font: inherit; padding: .4rem; border-radius: 8px; border: 1px solid var(--rule); background: var(--surface); color: var(--ink); }
.timeline { list-style: none; margin: 0; padding: 0 0 0 1rem; border-left: 2px solid var(--rule); }
.timeline li { position: relative; padding: 0 0 .7rem .5rem; }
.timeline li::before { content: ""; position: absolute; left: -1.42rem; top: .45rem; width: .65rem; height: .65rem; border-radius: 50%; background: var(--surface); border: 2px solid var(--action); }
.timeline time { color: var(--muted); font-size: .85rem; }
.back { margin-top: .75rem; }

/* Forms and admin */
.card { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius-row); padding: 1rem; margin-bottom: 1.25rem; }
.narrow { max-width: 26rem; margin: 3rem auto; }
.field { display: grid; gap: .25rem; margin-bottom: .85rem; }
.field label { font-weight: 700; font-size: .92rem; }
.field input, .field select {
  font: inherit; padding: .5rem .6rem; border: 1px solid var(--rule); border-radius: 8px;
  background: var(--surface); color: var(--ink);
}
.inline-form { display: flex; flex-wrap: wrap; gap: .6rem; align-items: end; }
.inline-form .field { margin: 0; }
table { width: 100%; border-collapse: collapse; font-size: .93rem; }
th, td { text-align: left; padding: .45rem .5rem; border-bottom: 1px solid var(--rule); vertical-align: top; }
th { font-size: .82rem; color: var(--muted); font-weight: 700; }
td form { margin: 0; display: flex; gap: .35rem; }
td select { font: inherit; font-size: .88rem; padding: .25rem; border-radius: 6px; border: 1px solid var(--rule); background: var(--surface); color: var(--ink); }
.secret { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 1.05rem; background: var(--paper); padding: .1rem .4rem; border-radius: 4px; }
.table-wrap { overflow-x: auto; }

@media (max-width: 34rem) {
  .where { grid-template-columns: 1fr; }
  .slate textarea { font-size: 1.08rem; }
  .key span { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .key:active { transform: none; }
}
.spaced { margin-top: .75rem; }
@media (max-width: 34rem) {
  .top nav > span { display: none; }
  .brand span { display: none; }
}

/* v0.2 */
.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; }
.icon { width: 1.05em; height: 1.05em; vertical-align: -0.17em; margin-right: .35em; flex: none; }
.views { display: flex; gap: .9rem; flex-wrap: wrap; font-size: .92rem; }
.views .current { color: var(--ink); text-decoration: none; font-weight: 700; }
.rows.needs { margin-bottom: .5rem; }
.row-need { border-left: 4px solid var(--action); }
.need-approval { border-left-color: var(--waiting); }
.need-fyi { border-left-color: var(--rule); }
.tag { font-size: .8rem; font-weight: 700; white-space: nowrap; color: var(--action); }
.tag-approval { color: var(--waiting); }
.tag-fyi { color: var(--muted); }
.sla { font-weight: 700; }
.sla-ok { color: var(--done); }
.sla-warning { color: var(--waiting); }
.sla-breached { color: var(--danger); }
.sla-paused { color: var(--muted); }
.status-approval { color: var(--waiting); }
.facts { display: flex; flex-wrap: wrap; gap: .25rem 1rem; color: var(--muted); margin: -.25rem 0 1rem; }
.actions button, .quiet-btn { display: inline-flex; align-items: center; }
details.act { position: relative; }
details.act > summary { list-style: none; }
details.act > summary::-webkit-details-marker { display: none; }
.quiet-btn {
  font: inherit; border: 1px solid var(--rule); border-radius: 9px; padding: .45rem .85rem;
  background: var(--surface); color: var(--ink); cursor: pointer;
}
details.act[open] > summary { border-color: var(--action); }
.act-form { display: flex; gap: .4rem; margin-top: .4rem; flex-wrap: wrap; }
.act-form input, .act-form select { font: inherit; padding: .4rem .5rem; border: 1px solid var(--rule); border-radius: 8px; background: var(--surface); color: var(--ink); min-width: 14rem; }
.reply { border-top: 1px solid var(--rule); padding-top: .85rem; margin: 0 0 1rem; }
.reply label { font-weight: 700; display: block; margin-bottom: .3rem; }
.reply textarea { width: 100%; font: inherit; padding: .5rem .6rem; border: 1px solid var(--rule); border-radius: 8px; background: var(--surface); color: var(--ink); resize: vertical; }
.reply-bar { display: flex; justify-content: space-between; align-items: center; gap: .75rem; flex-wrap: wrap; margin-top: .4rem; }
.comment { white-space: pre-wrap; margin: .3rem 0 .1rem; padding: .5rem .7rem; background: var(--paper); border-radius: 8px; }
.timeline li.is-comment::before { border-color: var(--progress); }

.settings-table th[scope="row"] { font-size: .93rem; color: var(--ink); white-space: nowrap; }
details.act[open] { flex-basis: 100%; }
.settings-table select { min-width: 0; width: 100%; font-size: .88rem; }
.settings-table { table-layout: fixed; }
.settings-table th:first-child { width: 8.5rem; }

.changed { display: flex; gap: .75rem; align-items: center; justify-content: space-between; background: var(--paper);
  border-left: 4px solid var(--action); padding: .45rem .75rem; margin: 0 0 .75rem; border-radius: 4px; }
.changed[hidden] { display: none; }
.row-closed { opacity: .8; }
