/* Skin Studio Systems: deep green sidebar, warm cream workspace, soft cards. */
@font-face {
  font-family: "DM Sans";
  src: url("/static/fonts/dm-sans.woff2") format("woff2");
  font-weight: 100 1000;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #f6f3ec;
  --surface: #fdfcf9;
  --surface-2: #f1ede4;
  --text: #1f2a24;
  --muted: #6b7068;
  --line: #e6e1d6;
  --green-900: #1f3a2e;
  --green-800: #284638;
  --green-700: #335745;
  --green-600: #3f6b55;
  --green-100: #e3ece5;
  --accent: #335745;
  --accent-text: #ffffff;
  --warn: #b5583b;
  --warn-bg: #f8e6dd;
  --sand: #f4ebe1;
  --sand-line: #eadccc;
  --ok-bg: #e7f0e8; --ok-line: #b9d2be;
  --err-bg: #f9e8e3; --err-line: #e8b9aa;
  /* status pills */
  --s-new-bg: #e2ece4; --s-new-fg: #2f5a43;
  --s-prog-bg: #e1edf3; --s-prog-fg: #2d5b74;
  --s-work-bg: #f6ead2; --s-work-fg: #80591a;
  --s-done-bg: #ebe9e4; --s-done-fg: #57554f;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(31, 42, 36, .04), 0 1px 1px rgba(31, 42, 36, .03);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #151b18; --surface: #1c2420; --surface-2: #222c27; --text: #e9ece6; --muted: #9ba39b; --line: #2e3a33;
    --green-900: #0f1d16; --green-800: #16271e; --green-700: #3f6b55; --green-600: #4f7f66; --green-100: #23332a;
    --accent: #6f9e83; --accent-text: #0f1d16; --warn: #e08b6e; --warn-bg: #3a2620;
    --sand: #2a251f; --sand-line: #3d352c;
    --ok-bg: #1f3027; --ok-line: #3c5e4a; --err-bg: #3a2420; --err-line: #6e3d32;
    --s-new-bg: #24382c; --s-new-fg: #a9d1b5; --s-prog-bg: #1f3340; --s-prog-fg: #9cc6de;
    --s-work-bg: #3a2f1b; --s-work-fg: #e3c27f; --s-done-bg: #2c2d2a; --s-done-fg: #b9b7b0;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.55 "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--accent); }
h1 { font-size: 1.75rem; line-height: 1.2; letter-spacing: -.02em; margin: 0 0 .5rem; font-weight: 650; }
h2 { font-size: 1.05rem; margin: 0 0 .6rem; font-weight: 650; letter-spacing: -.01em; }
h3 { font-size: .95rem; margin: 1.25rem 0 .5rem; font-weight: 650; }
p { margin: 0 0 .75rem; }
code { background: var(--surface-2); padding: .1rem .35rem; border-radius: 5px; font-size: .95rem; }
.icon { width: 18px; height: 18px; flex: none; }

/* ---------- App shell ---------- */
.app { display: grid; grid-template-columns: 252px minmax(0, 1fr); min-height: 100vh; background: linear-gradient(to right, var(--green-900) 252px, transparent 252px); }
.sidebar { background: var(--green-900); color: #dfe7e1; display: flex; flex-direction: column; padding: 1.25rem .9rem; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: .7rem; text-decoration: none; color: #fff; padding: .25rem .5rem 1.25rem; }
.brand-mark { width: 34px; height: 34px; border-radius: 9px; border: 1px solid rgba(255,255,255,.25); display: grid; place-items: center; font-weight: 700; font-size: .95rem; background: rgba(255,255,255,.06); }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.brand-text strong { font-size: .95rem; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand-text small { color: #9fb3a6; font-size: .75rem; }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; }
.nav-label { font-size: .68rem; letter-spacing: .12em; text-transform: uppercase; color: #8aa093; margin: 1rem .6rem .35rem; }
.sidebar nav a { display: flex; align-items: center; gap: .65rem; padding: .5rem .65rem; border-radius: 9px; color: #d3ddd6; text-decoration: none; font-size: .9rem; border: 1px solid transparent; }
.sidebar nav a span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar nav a.active { background: rgba(255,255,255,.1); border-color: rgba(214, 196, 150, .55); color: #fff; }
.sidebar nav a .icon { width: 16px; height: 16px; opacity: .85; }
.sidebar nav a.nav-empty { color: #a9bbb0; border: 1px dashed rgba(255,255,255,.18); }
.nav-hint { font-size: .8rem; color: #8aa093; margin: 0 .65rem; }
.sidebar-note { margin-top: auto; padding: 1.25rem .6rem .25rem; border-top: 1px solid rgba(255,255,255,.08); font-size: .78rem; color: #a9bbb0; }
.sidebar-note strong { color: #e8efe9; display: block; margin-bottom: .3rem; font-size: .8rem; }
.sidebar-note p { margin: 0; }

.app-main { display: flex; flex-direction: column; min-width: 0; }
.topbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem 1rem; padding: .85rem 2rem; border-bottom: 1px solid var(--line); background: var(--bg); }
.topbar-title { font-size: .85rem; color: var(--text); font-weight: 600; }
.topbar-title span { color: var(--muted); font-weight: 400; }
.logout { display: flex; align-items: center; gap: .9rem; font-size: .85rem; }
.who { color: var(--muted); display: inline-flex; align-items: center; gap: .45rem; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green-600); }

main { width: 100%; max-width: 1240px; margin: 0 auto; padding: 1.75rem 2rem 4rem; }
body.bare main { max-width: 720px; padding-top: 2.5rem; }

/* ---------- Page heads ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; }
.page-head h1 { margin: 0; }
.page-head .lede { margin: .35rem 0 0; color: var(--muted); max-width: 640px; }
.eyebrow { font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin: 0 0 .4rem; }
.crumbs { font-size: .85rem; color: var(--muted); margin-bottom: .35rem; }
.crumbs a { color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.empty { color: var(--muted); padding: 1rem 0; }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.35rem; margin-bottom: 1rem; box-shadow: var(--shadow); }
.card.narrow { max-width: 520px; margin: 2rem auto; }
.card.embed { border: 0; margin: 0; padding: .5rem; background: transparent; box-shadow: none; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: .9rem; }
.card-head h2 { margin: 0; }
.card-head p { margin: .15rem 0 0; color: var(--muted); font-size: .85rem; }
.card-head a { font-size: .85rem; font-weight: 600; text-decoration: none; white-space: nowrap; }
.hero { text-align: center; padding: 2.5rem 1.5rem; }
.hero .button { align-self: center; }
.staff-link { margin: 1.5rem 0 0; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.stat { display: block; text-decoration: none; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.25rem; box-shadow: var(--shadow); position: relative; }
.stat:hover { border-color: var(--green-600); }
.stat .label { font-size: .82rem; color: var(--muted); }
.stat .value { font-size: 2.1rem; font-weight: 650; letter-spacing: -.02em; line-height: 1.1; margin: .55rem 0 .3rem; }
.stat .hint { font-size: .78rem; color: var(--muted); }
.stat .badge-icon { position: absolute; top: .9rem; right: .9rem; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); }
.stat .badge-icon .icon { width: 15px; height: 15px; }
.stat.primary { background: var(--green-700); border-color: var(--green-700); color: #fff; }
.stat.primary .label, .stat.primary .hint { color: #cfe0d5; }
.stat.primary .badge-icon { background: rgba(255,255,255,.14); color: #fff; }
.stat.alert .badge-icon { background: var(--warn-bg); color: var(--warn); }

.grid-2 { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(280px, 1fr); gap: 1rem; align-items: start; }
.grid-2 > .card { margin-bottom: 0; }
.mt { margin-top: 1rem; }

.notice { display: flex; gap: .8rem; align-items: flex-start; background: var(--sand); border: 1px solid var(--sand-line); border-radius: var(--radius); padding: .9rem 1.1rem; margin-top: 1rem; font-size: .85rem; }
.notice .icon { margin-top: .1rem; color: var(--muted); }
.notice strong { display: block; margin-bottom: .1rem; }
.notice p { margin: 0; color: var(--muted); }
.tip { background: var(--surface-2); border-radius: 10px; padding: .75rem .9rem; font-size: .8rem; color: var(--muted); margin-top: .9rem; }

/* recent list */
.recent { list-style: none; margin: 0; padding: 0; }
.recent li { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .75rem 0; border-bottom: 1px solid var(--line); }
.recent li:last-child { border-bottom: 0; }
.recent .who-line { font-weight: 600; text-decoration: none; color: var(--text); }
.recent .meta { font-size: .8rem; color: var(--muted); }
.recent .right { display: flex; flex-direction: column; align-items: flex-end; gap: .25rem; flex: none; }
.empty-box { border: 1px dashed var(--line); border-radius: 12px; padding: 2rem 1rem; text-align: center; color: var(--muted); font-size: .88rem; }

/* status breakdown */
.status-rows { list-style: none; margin: 0; padding: 0; }
.status-rows li { border-bottom: 1px solid var(--line); }
.status-rows li:last-child { border-bottom: 0; }
.status-rows a { display: flex; justify-content: space-between; align-items: center; padding: .6rem 0; text-decoration: none; color: var(--text); font-weight: 600; }

/* ---------- Forms ---------- */
label { display: flex; flex-direction: column; gap: .3rem; font-weight: 600; font-size: .88rem; }
label.check { flex-direction: row; align-items: center; font-weight: 500; }
input, select, textarea { font: inherit; color: inherit; background: var(--surface); border: 1px solid var(--line); border-radius: 9px; padding: .55rem .7rem; width: 100%; }
label.check input { width: auto; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--green-600); outline-offset: 1px; }
.stack { display: flex; flex-direction: column; gap: .85rem; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: .85rem; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.copy { font-family: ui-monospace, monospace; font-size: .85rem; }

button, .button { font: inherit; font-weight: 600; font-size: .9rem; cursor: pointer; border: 1px solid var(--accent); background: var(--accent); color: var(--accent-text); padding: .55rem 1.05rem; border-radius: 9px; text-decoration: none; display: inline-flex; align-items: center; gap: .45rem; align-self: flex-start; }
.button .icon { width: 16px; height: 16px; }
button:hover, .button:hover { filter: brightness(1.08); }
button.secondary, .button.secondary { background: transparent; color: var(--accent); }
button.warn { background: transparent; color: var(--warn); border-color: var(--warn); }
button.small { padding: .25rem .6rem; font-size: .78rem; border-radius: 7px; }
button.link { background: none; border: 0; color: var(--accent); padding: 0; font-weight: 600; }
form.inline { display: inline; }

.filters { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: 1rem; }
.filters select, .filters input[type=search] { width: auto; min-width: 150px; }
.filters.inline { margin: 0; }

.flash { padding: .7rem 1rem; border-radius: 10px; margin-bottom: 1rem; border: 1px solid; }
.flash.ok { background: var(--ok-bg); border-color: var(--ok-line); }
.flash.error { background: var(--err-bg); border-color: var(--err-line); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 1rem; box-shadow: var(--shadow); }
.card .table-wrap { border: 0; box-shadow: none; margin: 0 -.35rem; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .7rem .85rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; background: var(--surface-2); }
tr:last-child td { border-bottom: 0; }
tr.inactive td { color: var(--muted); }
td a { font-weight: 600; text-decoration: none; }
table.categories td details form { min-width: 320px; margin-top: .5rem; }

/* ---------- Pills ---------- */
.pill { display: inline-block; font-size: .74rem; font-weight: 600; padding: .16rem .6rem; border-radius: 999px; white-space: nowrap; }
.pill.s-submitted { background: var(--s-new-bg); color: var(--s-new-fg); }
.pill.s-in_progress { background: var(--s-prog-bg); color: var(--s-prog-fg); }
.pill.s-working { background: var(--s-work-bg); color: var(--s-work-fg); }
.pill.s-completed { background: var(--s-done-bg); color: var(--s-done-fg); }
.pill.esc { background: var(--warn-bg); color: var(--warn); }
.pill.neutral { background: var(--surface-2); color: var(--muted); }
.esc-text { color: var(--warn); }

/* ---------- Status board ---------- */
.legend { display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; font-size: .8rem; color: var(--muted); margin-bottom: 1rem; }
.board { display: grid; grid-template-columns: repeat(4, minmax(230px, 1fr)); gap: 1rem; overflow-x: auto; align-items: start; padding-bottom: .5rem; }
.column { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); padding: .85rem; min-height: 220px; }
.column h2 { display: flex; justify-content: space-between; align-items: center; font-size: .95rem; }
.count { color: var(--muted); font-weight: 600; font-size: .85rem; background: var(--surface); border-radius: 999px; padding: .05rem .55rem; }
.board-card { border: 1px solid var(--line); border-radius: 11px; padding: .7rem .8rem; margin-bottom: .6rem; background: var(--surface); display: flex; flex-direction: column; gap: .3rem; box-shadow: var(--shadow); }
.board-card.is-escalated { border-left: 4px solid var(--warn); }
.board-card .title { font-weight: 650; text-decoration: none; color: var(--text); }
.board-card .meta { font-size: .8rem; color: var(--muted); }

/* ---------- Complaint detail ---------- */
.detail { display: grid; grid-template-columns: minmax(0, 2fr) minmax(270px, 1fr); gap: 1rem; align-items: start; }
.accounts { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.accounts .card { margin-bottom: 0; }
.detail .accounts { margin-bottom: 1rem; }
.facts { display: grid; grid-template-columns: 130px 1fr; gap: .45rem 1rem; margin: 0; }
.facts dt { color: var(--muted); font-size: .86rem; }
.facts dd { margin: 0; }
.timeline { list-style: none; padding: 0; margin: 0 0 1rem; }
.timeline li { border-left: 2px solid var(--line); padding: 0 0 .8rem 1rem; }
.timeline .when { font-size: .8rem; color: var(--muted); margin-bottom: .2rem; }
.timeline p { margin-bottom: .3rem; }
ul.plain { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .45rem; }
details summary { cursor: pointer; color: var(--accent); font-weight: 600; font-size: .88rem; margin: .5rem 0; }

/* ---------- Guest submissions ---------- */
.submission { padding: 1.25rem 1.35rem; }
.submission-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem 1rem; align-items: flex-start; margin-bottom: .75rem; }
.submission-head h2 { margin: 0; }
.submission-head h2 a { color: var(--text); text-decoration: none; }
.submission .facts { grid-template-columns: 110px 1fr; margin-bottom: .9rem; font-size: .9rem; }
.quote { border-left: 3px solid var(--green-100); background: var(--surface-2); border-radius: 0 10px 10px 0; padding: .8rem 1rem; margin-bottom: .6rem; }
.quote h3 { margin: 0 0 .35rem; font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.quote p:last-child { margin-bottom: 0; }

/* ---------- Location page ---------- */
.loc-meta { display: flex; flex-wrap: wrap; gap: .4rem 1.25rem; color: var(--muted); font-size: .88rem; margin-top: .35rem; }

/* ---------- Public pages ---------- */
body.bare { background: var(--bg); }
body.bare .card.narrow h1 { font-size: 1.5rem; }

/* ---------- Responsive ---------- */
@media (max-width: 1000px) {
  .grid-2, .detail, .accounts { grid-template-columns: 1fr; }
  .board { grid-template-columns: repeat(4, 260px); }
}
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; background: none; }
  .sidebar { position: static; height: auto; padding: .9rem .75rem; }
  .brand { padding-bottom: .6rem; }
  .sidebar nav { flex-direction: row; flex-wrap: nowrap; overflow-x: auto; gap: .25rem; padding-bottom: .25rem; }
  .sidebar nav a { flex: none; }
  .nav-label, .sidebar-note { display: none; }
  .topbar { padding: .7rem 1rem; }
  main { padding: 1.25rem 1rem 3rem; }
}
@media (max-width: 600px) {
  .facts, .submission .facts { grid-template-columns: 1fr; }
  .facts dd { margin-bottom: .5rem; }
  h1 { font-size: 1.45rem; }
}

/* ---------- Print (guest submissions as a record) ---------- */
@media print {
  .sidebar, .topbar, .filters, .no-print { display: none !important; }
  .app { display: block; }
  body { background: #fff; }
  .card { box-shadow: none; break-inside: avoid; }
}
