:root {
  --bg: #f6f7f9;
  --card: #ffffff;
  --ink: #1c2733;
  --muted: #5b6b7b;
  --line: #e3e8ee;
  --accent: #1f5eff;
  --accent-ink: #ffffff;
  --done: #11602a;
  --done-bg: #e8f6ec;
  --progress: #0b5468;
  --progress-bg: #e3f4f8;
  --blocked: #9f1414;
  --blocked-bg: #fdecec;
  --todo: #475569;
  --todo-bg: #eef1f5;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
}
.topbar {
  background: var(--card);
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .35rem 1.5rem;
  padding: .65rem 1.5rem;
}
.topbar .brand { font-weight: 700; }
.topbar nav {
  display: flex;
  gap: 1rem;
  order: 3;
  flex-basis: 100%;
  overflow-x: auto;
  padding: 4px; /* room for focus outlines inside the scroll area */
}
.topbar a { color: var(--ink); text-decoration: none; font-size: .92rem; padding: .25rem .5rem; border-radius: 6px; white-space: nowrap; }
.topbar a:hover { background: var(--bg); }
.topbar a.active { color: var(--accent); font-weight: 600; background: #e7eeff; }
.topbar .who { color: var(--muted); font-size: .85rem; margin-left: auto; }
.wrap { max-width: 960px; margin: 0 auto; padding: 1.75rem 1.5rem 4rem; }
@media (max-width: 720px) {
  .topbar { padding: .5rem .75rem; gap: .35rem .75rem; }
  .wrap { padding: 1.25rem .75rem 3rem; }
}
.skip-link {
  position: absolute;
  left: -999px;
  top: .5rem;
  background: var(--accent);
  color: var(--accent-ink);
  padding: .5rem 1rem;
  border-radius: 8px;
  z-index: 1000;
  text-decoration: none;
  font-size: .92rem;
}
.skip-link:focus { left: .5rem; }
h1 { font-size: 1.45rem; margin: 0 0 .25rem; }
h2 { font-size: 1.05rem; margin: 1.75rem 0 .6rem; }
.sub { color: var(--muted); margin: 0 0 1.25rem; font-size: .95rem; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1rem 1.25rem;
  margin: .75rem 0;
  overflow-x: auto;
}
details.card > summary { cursor: pointer; }
details.card[open] summary { margin-bottom: .6rem; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: .75rem; }
.stat { text-align: left; }
.stat .num { font-size: 1.6rem; font-weight: 700; }
.stat .lbl { color: var(--muted); font-size: .85rem; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th { text-align: left; color: var(--muted); font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
th, td { padding: .55rem .6rem; border-bottom: 1px solid var(--line); }
tr:last-child td { border-bottom: none; }
a { color: var(--accent); }
.tasklist { list-style: none; margin: 0; padding: 0; }
.tasklist li {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: .75rem;
  padding: .65rem .25rem;
  border-bottom: 1px solid var(--line);
}
.tasklist li:last-child { border-bottom: none; }
.tasklist .t-body { flex: 1 1 14rem; min-width: 0; }
.tasklist .t-title { font-weight: 600; font-size: .95rem; }
.tasklist li[data-status="done"] .t-title { text-decoration: line-through; color: var(--muted); }
.tasklist .t-desc { color: var(--muted); font-size: .85rem; }
.badge {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  border-radius: 999px;
  padding: .12rem .55rem;
  white-space: nowrap;
}
.badge.done { color: var(--done); background: var(--done-bg); }
.badge.in_progress { color: var(--progress); background: var(--progress-bg); }
.badge.blocked { color: var(--blocked); background: var(--blocked-bg); }
.badge.todo { color: var(--todo); background: var(--todo-bg); }
.badge.onboarding { color: #8a4a07; background: #fdf3e3; }
.badge.live { color: var(--done); background: var(--done-bg); }
.badge.churned { color: var(--todo); background: var(--todo-bg); }
.t-actions { display: flex; gap: .35rem; }
.t-actions form { display: inline; }
.tasklist .t-actions { margin-left: auto; }
button, .btn {
  font: inherit;
  font-size: .82rem;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  border-radius: 7px;
  padding: .3rem .7rem;
  min-height: 2.25rem;
  cursor: pointer;
}
a.btn { display: inline-flex; align-items: center; }
@media (pointer: coarse) {
  button, .btn { padding: .5rem .9rem; }
}
button:hover, .btn:hover { border-color: var(--accent); color: var(--accent); }
button.primary, .btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
button.primary:hover { opacity: .9; color: var(--accent-ink); }
.progress { background: var(--todo-bg); border-radius: 999px; height: 10px; overflow: hidden; }
.progress > div { background: var(--accent); height: 100%; border-radius: 999px; }
form.stack { display: flex; flex-direction: column; gap: .65rem; max-width: 26rem; }
.row { display: flex; gap: .5rem; flex-wrap: wrap; align-items: flex-end; }
label { font-size: .82rem; font-weight: 600; color: var(--muted); display: block; }
input, select, textarea {
  font: inherit;
  font-size: .92rem;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: .45rem .6rem;
  width: 100%;
  background: var(--card);
}
.row input, .row select { width: auto; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.field { display: flex; flex-direction: column; gap: .2rem; }
.notice { background: var(--progress-bg); color: var(--progress); border-radius: 8px; padding: .65rem 1rem; font-size: .92rem; margin: .75rem 0; }
.error { background: var(--blocked-bg); color: var(--blocked); border-radius: 8px; padding: .65rem 1rem; font-size: .92rem; margin: .75rem 0; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.login-box { max-width: 24rem; margin: 5rem auto; }
.login-box h1 { margin-bottom: 1rem; }
.section-head { display: flex; align-items: baseline; gap: .75rem; }
.section-head h2 { flex: 1; }
.section-head h1 { flex: 1; }

/* tickets */
.badge.open { color: #8a4a07; background: #fdf3e3; }
.badge.waiting_customer { color: #4c1d95; background: #f1eafd; }
.badge.resolved { color: var(--done); background: var(--done-bg); }
.badge.closed { color: var(--todo); background: var(--todo-bg); }
.badge.internal-note { color: #7a5008; background: #fdf3d7; }
.comment {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: .75rem 1rem;
  margin: .6rem 0;
}
.comment.internal { background: #fffbeb; border-color: #f3d27a; }
.comment-meta { color: var(--muted); font-size: .82rem; margin-bottom: .35rem; }
.comment-body { white-space: pre-wrap; }
.attach { margin-top: .5rem; display: flex; flex-direction: column; gap: .2rem; font-size: .88rem; }
textarea { resize: vertical; }
