:root {
  color-scheme: light;
  --bg: #f4f7fc;
  --card: #ffffff;
  --border: #d9e2f0;
  --text: #0b1533;
  --dim: #56617a;
  --accent: #0128a3;
  --accent-soft: #e6ecfa;
  --brand-cyan: #4fd9ff;
  --brand-green: #3ef347;
  --brand-line: linear-gradient(90deg, #4fd9ff 0%, #48e2ba 50%, #3ef347 100%);
  --happy: #17824e;
  --happy-soft: #e1f6ea;
  --neutral: #a8700a;
  --neutral-soft: #fbf0d6;
  --sad: #c93636;
  --sad-soft: #fbe6e4;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}
a { color: var(--accent); }
h1, h2, h3 { margin: 0; line-height: 1.25; }
button, select, textarea { font: inherit; color: inherit; }
.hidden { display: none !important; }
.logo { display: block; height: 30px; width: auto; }
.panel .logo { height: 38px; margin: 0 auto 6px; }
.dim { color: var(--dim); }
.btn {
  display: inline-block; padding: 10px 18px; border-radius: 8px; border: 1px solid transparent;
  background: var(--accent); color: #fff; font-weight: 600; cursor: pointer; text-decoration: none;
}
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--text); border-color: var(--border); font-weight: 500; }
.btn:focus-visible, .face:focus-visible, select:focus-visible, textarea:focus-visible, .chip:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}

/* ---------- Survey / landing ---------- */
.center-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.panel {
  width: 100%; max-width: 480px; background: var(--card); border: 1px solid var(--border);
  border-radius: 16px; padding: 32px 28px; text-align: center;
  position: relative; overflow: hidden; box-shadow: 0 6px 24px rgba(1, 40, 163, 0.07);
}
.panel::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 5px; background: var(--brand-line); }
.panel h1 { font-size: 22px; margin: 14px 0 6px; }
.panel p { margin: 0 0 8px; }
.faces { display: flex; justify-content: center; gap: 12px; margin: 22px 0 6px; }
.face {
  flex: 1 1 0; max-width: 120px; padding: 12px 6px 10px; border-radius: 12px; cursor: pointer;
  background: transparent; border: 2px solid var(--border); color: var(--dim);
}
.face svg { width: 52px; height: 52px; display: block; margin: 0 auto 4px; }
.face span { font-size: 13px; font-weight: 600; }
.face[data-rating="happy"]:hover, .face[data-rating="happy"].selected { border-color: var(--happy); background: var(--happy-soft); color: var(--happy); }
.face[data-rating="neutral"]:hover, .face[data-rating="neutral"].selected { border-color: var(--neutral); background: var(--neutral-soft); color: var(--neutral); }
.face[data-rating="sad"]:hover, .face[data-rating="sad"].selected { border-color: var(--sad); background: var(--sad-soft); color: var(--sad); }
.comment-box { margin-top: 20px; text-align: left; }
.comment-box label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.comment-box textarea {
  width: 100%; min-height: 96px; padding: 10px 12px; border-radius: 8px; resize: vertical;
  border: 1px solid var(--border); background: var(--bg);
}
.comment-box .row { display: flex; align-items: center; gap: 12px; margin-top: 10px; }
.status { font-size: 13.5px; min-height: 1.4em; }
.page > .status { margin: 0 0 8px; min-height: 0; }
.page > .status:empty { display: none; }
.status.error { color: var(--sad); }
.status.ok { color: var(--happy); }

/* ---------- Dashboard ---------- */
.topbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 14px 20px;
  background: var(--card); border-bottom: 3px solid transparent;
  border-image: var(--brand-line) 1;
}
.topbar h1 { font-size: 17px; }
.topbar .spacer { flex: 1; }
.topbar select { padding: 7px 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg); }
.page { max-width: 1160px; margin: 0 auto; padding: 20px 16px 48px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.tile { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; }
.tile .label { font-size: 12.5px; color: var(--dim); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.tile .value { font-size: 30px; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; }
.tile .sub { font-size: 12.5px; color: var(--dim); }
.card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 16px; margin-top: 16px; }
.card h2 { font-size: 15px; margin-bottom: 12px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 860px) { .grid2 { grid-template-columns: 1fr; } }
.grid2 .card { margin-top: 16px; min-width: 0; }
.trend { display: flex; align-items: flex-end; gap: 6px; height: 170px; overflow-x: auto; padding-top: 18px; }
.trend .col { flex: 1 0 40px; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; min-width: 40px; }
.trend .stack { width: 100%; max-width: 44px; display: flex; flex-direction: column-reverse; border-radius: 4px 4px 0 0; overflow: hidden; }
.trend .seg.happy { background: var(--happy); }
.trend .seg.neutral { background: var(--neutral); }
.trend .seg.sad { background: var(--sad); }
.trend .pct { font-size: 11px; color: var(--dim); margin-bottom: 3px; font-variant-numeric: tabular-nums; }
.trend .wk { font-size: 10.5px; color: var(--dim); margin-top: 4px; white-space: nowrap; }
.legend { display: flex; gap: 14px; font-size: 12.5px; color: var(--dim); margin-top: 10px; flex-wrap: wrap; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { font-size: 12px; color: var(--dim); font-weight: 600; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.name { white-space: normal; min-width: 140px; }
.bar { display: flex; height: 8px; width: 110px; border-radius: 4px; overflow: hidden; background: var(--border); }
.bar i { display: block; height: 100%; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.chip { padding: 5px 12px; border-radius: 999px; border: 1px solid var(--border); background: transparent; cursor: pointer; font-size: 13px; }
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.feed-item { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.feed-item:last-child { border-bottom: none; }
.feed-item .mark { flex: 0 0 auto; width: 74px; }
.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.pill.happy { background: var(--happy-soft); color: var(--happy); }
.pill.neutral { background: var(--neutral-soft); color: var(--neutral); }
.pill.sad { background: var(--sad-soft); color: var(--sad); }
.pill.pending { background: var(--border); color: var(--dim); }
.feed-item .body { min-width: 0; flex: 1; }
.feed-item .who { font-weight: 600; }
.feed-item .meta { font-size: 12.5px; color: var(--dim); overflow-wrap: anywhere; }
.feed-item .quote { margin-top: 6px; padding: 8px 12px; border-left: 3px solid var(--border); background: var(--bg); border-radius: 0 6px 6px 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.empty { color: var(--dim); padding: 18px 0; text-align: center; }

/* ---------- Settings ---------- */
.page.narrow { max-width: 720px; }
.small { font-size: 13px; }
.card p.small { margin: -6px 0 12px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.notice { background: var(--neutral-soft); border: 1px solid var(--neutral); border-radius: 10px; padding: 10px 14px; margin: 0 0 4px; }
.people { list-style: none; margin: 0 0 12px; padding: 0; }
.people li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--border); overflow-wrap: anywhere; }
.link-btn { background: none; border: none; color: var(--sad); cursor: pointer; padding: 4px 6px; font-size: 13.5px; border-radius: 6px; flex: 0 0 auto; }
.link-btn:hover { text-decoration: underline; }
.link-btn:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.add-row { display: flex; gap: 8px; }
.add-row input { flex: 1; min-width: 0; padding: 9px 12px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg); color: var(--text); font: inherit; }
.check { display: flex; align-items: center; gap: 10px; padding: 6px 0; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.save-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 18px; }
input:disabled, .check input:disabled { opacity: 0.6; cursor: not-allowed; }

/* ---------- Staff corrections ---------- */
.manage { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin-top: 6px; font-size: 13px; }
.link-btn.plain { color: var(--accent); }
