:root {
  --bg: #f4f1ea; --card: #fffdf8; --ink: #1f2328; --muted: #6b6f76; --line: #e3ddd0;
  --brand: #e8590c; --brand-ink: #fff; --accent: #1c7ed6; --ok: #2b8a3e; --warn: #f08c00; --bad: #e03131;
  --radius: 14px; --shadow: 0 1px 2px rgba(0,0,0,.05), 0 6px 24px rgba(0,0,0,.06);
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #16181c; --card: #1f2227; --ink: #e9e7e2; --muted: #9aa0a8; --line: #30343b; --shadow: none; }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); }
main { max-width: 860px; margin: 0 auto; padding: 0 16px 40px; }
body.admin main { max-width: 1200px; }
h1 { font-size: 1.7rem; line-height: 1.2; margin: .2em 0 .4em; }
h2 { font-size: 1.1rem; margin: 1.4em 0 .6em; }
.card h2:first-child { margin-top: 0; }

/* header / footer */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  max-width: 1200px; margin: 0 auto; padding: 14px 16px; }
.logo { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink); font-size: 1.35rem; }
.logo b { color: var(--brand); }
.logo small { font-size: .7em; color: var(--muted); font-weight: 400; }
.logo-mark { display: inline-block; transition: transform .3s; }
.logo:hover .logo-mark { transform: rotate(-20deg); }
.top nav { display: flex; gap: 14px; }
.top nav a { color: var(--ink); text-decoration: none; font-weight: 500; }
.top nav a:hover { color: var(--brand); }
.logo-tip { position: fixed; top: 58px; left: 16px; background: var(--ink); color: var(--bg); padding: 6px 12px;
  border-radius: 8px; font-size: .9rem; z-index: 10; }
.foot { text-align: center; color: var(--muted); font-size: .85rem; padding: 24px 16px 40px; }
.foot p { margin: .3em 0; }
.chili { background: none; border: 0; cursor: pointer; opacity: .25; font-size: 1rem; padding: 0 4px; transition: opacity .2s, transform .2s; }
.chili:hover { opacity: .8; transform: scale(1.2); }
body.spicy-mode .chili { opacity: 1; }

/* spicy mode swaps copy */
.spicy { display: none; }
body.spicy-mode .spicy { display: inline; }
body.spicy-mode .mild { display: none; }

/* cards & layout */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px;
  margin: 0 0 18px; box-shadow: var(--shadow); }
.center { text-align: center; }
.hero { padding: 16px 0 10px; }
.hero h1 { font-size: 2.1rem; }
.lede { color: var(--muted); font-size: 1.05rem; margin: 0 0 14px; }
.statusbar { display: flex; flex-wrap: wrap; gap: 8px 18px; padding: 10px 14px; border: 1px dashed var(--line);
  border-radius: 10px; font-size: .95rem; margin-bottom: 18px; }
.alert { background: #fff4e6; border: 1px solid #ffc078; color: #7a3e00; padding: 12px 16px; border-radius: 10px; margin: 0 0 16px; }
.alert.ok { background: #ebfbee; border-color: #8ce99a; color: #1b5e20; }
@media (prefers-color-scheme: dark) {
  .alert { background: #3a2a14; color: #ffd8a8; border-color: #7a4b12; }
  .alert.ok { background: #16301d; color: #b2f2bb; border-color: #2b6a3a; }
}

/* forms */
label { display: block; font-weight: 600; font-size: .95rem; margin: 0 0 12px; }
label small { font-weight: 400; color: var(--muted); }
label.inline { display: flex; align-items: center; gap: 8px; font-weight: 400; }
input[type=text], input[type=email], input[type=tel], input:not([type]), textarea, select {
  display: block; width: 100%; margin-top: 5px; padding: 10px 12px; font: inherit; color: var(--ink);
  background: var(--bg); border: 1px solid var(--line); border-radius: 10px; }
input[type=file] { margin-top: 6px; font: inherit; font-size: .9rem; max-width: 100%; }
textarea { resize: vertical; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--brand); outline-offset: 1px; }
.req { color: var(--bad); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
@media (max-width: 640px) { .grid2 { grid-template-columns: 1fr; } }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; }
.cf-turnstile { margin: 16px 0; }

.choices { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; margin-bottom: 8px; }
.choices.pay { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.choice { position: relative; margin: 0; cursor: pointer; }
.choice input { position: absolute; opacity: 0; }
.choice > span { display: block; height: 100%; padding: 12px 14px; border: 2px solid var(--line); border-radius: 12px;
  font-weight: 500; transition: border-color .15s, background .15s; }
.choice > span small { display: block; color: var(--muted); font-weight: 400; margin-top: 2px; }
.choice input:checked + span { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 8%, transparent); }
.choice input:focus-visible + span { outline: 2px solid var(--accent); }
.choice.pri-1 input:checked + span { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 10%, transparent); }

.btn { display: inline-block; padding: 10px 18px; border-radius: 10px; border: 1px solid var(--line); background: var(--card);
  color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.primary:hover { filter: brightness(1.07); }
.btn.big { width: 100%; padding: 14px; font-size: 1.1rem; }
.btn.ghost { background: transparent; color: var(--muted); }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.row select { width: auto; margin: 0; }
.row label.inline { margin: 0; }
.stack button { margin-top: 4px; }
.fine { color: var(--muted); font-size: .85rem; }

/* pills & chips */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 12px; }
.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; background: var(--bg); border: 1px solid var(--line);
  font-size: .85rem; white-space: nowrap; }
.pill.pri-1 { background: var(--bad); color: #fff; border-color: var(--bad); }
.pill.pri-2 { background: var(--warn); color: #fff; border-color: var(--warn); }
.pill.st-new { border-color: var(--accent); color: var(--accent); }
.pill.st-resolved, .pill.st-closed { border-color: var(--ok); color: var(--ok); }
.pill.out-sent { color: var(--ok); } .pill.out-failed { color: var(--bad); } .pill.out-skipped { color: var(--muted); }
.tag { font-size: .72rem; padding: 1px 6px; border-radius: 6px; background: var(--line); color: var(--muted); font-weight: 500; }
.badge { display: inline-block; background: #fff3bf; color: #5c4400; padding: 4px 12px; border-radius: 8px; font-weight: 600; margin-bottom: 8px; }

/* ticket */
.ticket-no { color: var(--muted); font-size: .9rem; font-weight: 600; }
.steps { display: flex; list-style: none; padding: 0; margin: 10px 0; gap: 6px; flex-wrap: wrap; }
.steps li { flex: 1; min-width: 110px; text-align: center; padding: 8px; border-radius: 8px; background: var(--bg);
  color: var(--muted); font-size: .85rem; }
.steps li.done { background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ink); font-weight: 600; }
.thread { list-style: none; padding: 0; margin: 0 0 16px; }
.msg { padding: 12px 14px; border-radius: 12px; margin-bottom: 10px; background: var(--bg); border: 1px solid var(--line); }
.msg.andrew { background: color-mix(in srgb, var(--brand) 9%, var(--card)); border-color: color-mix(in srgb, var(--brand) 30%, var(--line)); }
.msg.system { background: transparent; border-style: dashed; font-size: .92rem; }
.msg.internal { background: #fff9db; border-color: #ffe066; }
@media (prefers-color-scheme: dark) { .msg.internal { background: #3b3410; border-color: #6b5b10; } }
.meta { display: flex; gap: 8px; align-items: baseline; font-size: .85rem; margin-bottom: 4px; flex-wrap: wrap; }
.meta time { color: var(--muted); margin-left: auto; }
.body { white-space: pre-wrap; overflow-wrap: anywhere; }
.photos { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.photos img { width: 120px; height: 120px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.reply { border-top: 1px solid var(--line); padding-top: 14px; }
.escalate { margin-top: 8px; }

/* CSAT */
.stars { font-size: 1.8rem; color: #f59f00; margin: 0; letter-spacing: 2px; }
.star-pick { display: inline-flex; flex-direction: row-reverse; font-size: 2.2rem; margin-bottom: 10px; }
.star-pick input { position: absolute; opacity: 0; }
.star-pick label { cursor: pointer; color: var(--line); margin: 0; font-weight: 400; padding: 0 2px; }
.star-pick label:hover, .star-pick label:hover ~ label, .star-pick input:checked ~ label { color: #f59f00; }
blockquote { margin: 8px 0; padding: 8px 14px; border-left: 3px solid var(--line); color: var(--muted); }

/* stats / status */
.health { font-size: 1.2rem; font-weight: 600; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin: 14px 0; }
.stats > div { background: var(--bg); border-radius: 10px; padding: 12px; text-align: center; }
.stats > div > b { display: block; font-size: 1.6rem; }
.stats span { color: var(--muted); font-size: .85rem; }
.stats.small > div > b { font-size: 1.3rem; }
.sla { width: 100%; border-collapse: collapse; }
.sla th, .sla td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.bigcode { font-size: 4rem; font-weight: 800; color: var(--brand); line-height: 1; }

/* admin */
.inbox-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; }
.inbox-head .me label { margin: 0; }
.tabs { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 10px 0; }
.tab { padding: 6px 12px; border-radius: 8px; text-decoration: none; color: var(--ink); background: var(--bg); }
.tab.on { background: var(--brand); color: #fff; }
.search { margin-left: auto; min-width: 200px; }
.search input { margin: 0; }
.inbox { width: 100%; border-collapse: collapse; font-size: .93rem; }
.inbox th { text-align: left; color: var(--muted); font-weight: 600; padding: 8px; border-bottom: 2px solid var(--line); }
.inbox td { padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.inbox tbody tr { cursor: pointer; }
.inbox tbody tr:hover { background: var(--bg); }
.inbox tr.unread td { font-weight: 700; }
.inbox tr.pri-row-1 td:first-child { box-shadow: inset 4px 0 var(--bad); }
.inbox a { color: var(--ink); text-decoration: none; }
.inbox pre { white-space: pre-wrap; font-size: .85rem; }
@media (max-width: 700px) {
  .inbox th:nth-child(4), .inbox td:nth-child(4), .inbox th:nth-child(6), .inbox td:nth-child(6) { display: none; }
}
.admin-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
@media (max-width: 900px) { .admin-grid { grid-template-columns: 1fr; } }
.mini { padding-left: 18px; margin: 6px 0; font-size: .9rem; }
.mini small { color: var(--muted); }

/* ===== Konami code: Windows 95 helpdesk mode ===== */
body.win95 { background: #008080 !important; font-family: "MS Sans Serif", Tahoma, Geneva, sans-serif !important; color: #000 !important; }
body.win95 .card { background: #c0c0c0; border-radius: 0; border: 2px solid; border-color: #fff #000 #000 #fff; box-shadow: none; color: #000; }
body.win95 .card::before { content: "Bother Andrew Help Desk.exe"; display: block; margin: -22px -22px 14px; padding: 3px 8px;
  background: linear-gradient(90deg, #000080, #1084d0); color: #fff; font-weight: 700; font-size: .85rem; }
body.win95 .btn, body.win95 .choice > span, body.win95 input, body.win95 textarea, body.win95 select {
  border-radius: 0 !important; background: #c0c0c0 !important; color: #000 !important; border: 2px solid; border-color: #fff #000 #000 #fff !important; }
body.win95 input, body.win95 textarea, body.win95 select { background: #fff !important; border-color: #000 #fff #fff #000 !important; }
body.win95 .pill, body.win95 .msg, body.win95 .statusbar, body.win95 .steps li, body.win95 .stats > div { border-radius: 0; background: #fff; color: #000; }
body.win95 .top, body.win95 .foot, body.win95 .top nav a, body.win95 .logo, body.win95 .lede, body.win95 h1 { color: #fff; }
body.win95 .card h1, body.win95 .card .lede { color: #000; }
body.win95 .logo b { color: #ff0; }
.clippy { position: fixed; right: 16px; bottom: 16px; max-width: 260px; background: #ffffe1; color: #000; border: 1px solid #000;
  border-radius: 10px; padding: 12px 14px; font-size: .9rem; z-index: 20; box-shadow: 3px 3px 0 rgba(0,0,0,.4); }
.clippy b { font-size: 1.6rem; float: left; margin-right: 8px; }
.clippy button { display: block; margin-top: 8px; }
