/* Surf Support Center — one stylesheet, no build step, no CDN (the box is
   locked down to 443 and the WAF, so everything must be self-contained). */

:root {
  --bg: #0d1117;
  --panel: #151b24;
  --panel-2: #1b2330;
  --line: #26303d;
  --text: #e6edf3;
  --muted: #8b98a9;
  --accent: #3ba9ff;
  --accent-dim: #1c5f92;
  --ok: #3fb950;
  --warn: #d29922;
  --crit: #f85149;
  --radius: 10px;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── chrome ─────────────────────────────────────────────────────────────── */
.topbar {
  display: flex; align-items: center; gap: 18px;
  padding: 12px 22px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.brand { font-weight: 650; color: var(--text); display: flex; align-items: center; gap: 9px; }
.brand:hover { text-decoration: none; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent);
       box-shadow: 0 0 12px var(--accent); }
.topbar nav { margin-left: auto; display: flex; align-items: center; gap: 18px; font-size: 14px; }
.topbar nav a { color: var(--muted); }
.topbar nav a:hover { color: var(--text); text-decoration: none; }
.topbar .who { color: var(--muted); font-size: 13px; }
.topbar .ghost { border: 1px solid var(--line); padding: 5px 12px; border-radius: 7px; }

.wrap { max-width: 940px; margin: 0 auto; padding: 30px 22px 60px; }
.wide { max-width: 1500px; margin: 0 auto; padding: 22px 22px 60px; }
.foot { color: var(--muted); font-size: 12px; text-align: center; padding: 24px; }

h1 { font-size: 25px; margin: 0 0 6px; letter-spacing: -0.01em; }
h2 { font-size: 18px; margin: 28px 0 12px; }
.lede { color: var(--muted); margin: 0 0 26px; }

/* ── flashes ────────────────────────────────────────────────────────────── */
.flash {
  padding: 11px 15px; border-radius: var(--radius); margin-bottom: 18px;
  border: 1px solid var(--line); background: var(--panel-2); white-space: pre-wrap;
}
.flash.ok { border-color: #1f6f36; background: #0f2a17; }
.flash.error { border-color: #7d2b26; background: #2c1211; }

/* ── forms ──────────────────────────────────────────────────────────────── */
.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 22px;
}
.field { margin-bottom: 18px; }
.field label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.field .hint { color: var(--muted); font-size: 12.5px; margin: -2px 0 7px; }
.req { color: var(--crit); }

input[type=text], input[type=email], input[type=tel], input[type=password],
input[type=datetime-local], input[type=file], select, textarea {
  width: 100%; padding: 10px 12px;
  background: var(--panel-2); color: var(--text);
  border: 1px solid var(--line); border-radius: 8px;
  font: inherit;
}
textarea { min-height: 110px; resize: vertical; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent-dim); box-shadow: 0 0 0 3px rgba(59,169,255,.13);
}
.field.missing input, .field.missing select, .field.missing textarea { border-color: var(--crit); }
.row { display: flex; gap: 16px; }
.row > * { flex: 1; }

button, .btn {
  background: var(--accent); color: #04121f; border: 0;
  padding: 10px 18px; border-radius: 8px; font: inherit; font-weight: 640;
  cursor: pointer;
}
button:hover, .btn:hover { filter: brightness(1.08); text-decoration: none; }
button.secondary, .btn.secondary {
  background: transparent; color: var(--text); border: 1px solid var(--line);
}
button.danger { background: var(--crit); color: #fff; }
button:disabled { opacity: .5; cursor: not-allowed; }

/* ── board ──────────────────────────────────────────────────────────────── */
.stats { display: flex; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.stat {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 18px; min-width: 118px;
}
.stat b { display: block; font-size: 23px; line-height: 1.2; }
.stat span { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }

.filters { display: flex; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; }
.filters input, .filters select { width: auto; min-width: 170px; }

/* Columns share the available width so all six statuses (incl. Closed) are
   visible without horizontal scrolling; they shrink to a floor then scroll. */
.board { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 14px; align-items: flex-start; }
.col { flex: 1 1 200px; min-width: 190px; background: var(--panel); border: 1px solid var(--line);
       border-radius: var(--radius); padding: 12px; }
.col h3 { margin: 0 0 11px; font-size: 13px; text-transform: uppercase;
          letter-spacing: .07em; color: var(--muted); display: flex; justify-content: space-between; }
.col h3 em { font-style: normal; background: var(--panel-2); border-radius: 20px;
             padding: 1px 9px; color: var(--text); }

.tk {
  display: block; background: var(--panel-2); border: 1px solid var(--line);
  border-left: 3px solid var(--muted); border-radius: 8px;
  padding: 11px 12px; margin-bottom: 10px; color: var(--text);
}
.tk:hover { border-color: var(--accent-dim); text-decoration: none; }
.tk .ref { font-family: var(--mono); font-size: 11.5px; color: var(--muted); }
.tk .title { font-weight: 600; margin: 3px 0 6px; font-size: 14px; }
.tk .meta { color: var(--muted); font-size: 12px; display: flex; gap: 8px; flex-wrap: wrap; }
.tk.p-Critical { border-left-color: var(--crit); }
.tk.p-High { border-left-color: #f0883e; }
.tk.p-Medium { border-left-color: var(--warn); }
.tk.p-Low { border-left-color: var(--ok); }
.tk.late { box-shadow: inset 0 0 0 1px rgba(248,81,73,.35); }

/* drag-and-drop */
.tk { cursor: grab; }
.tk:active { cursor: grabbing; }
.tk.dragging { opacity: .45; }
.col-drop { min-height: 40px; }
.col.drop-hover { outline: 2px dashed var(--accent); outline-offset: -2px; background: rgba(59,169,255,.06); }
#dragHint { align-self: center; }
@media (hover: none) { #dragHint { display: none; } }

.pill { font-size: 11px; padding: 2px 8px; border-radius: 20px; border: 1px solid var(--line);
        background: var(--panel); color: var(--muted); }
.pill.Critical { color: var(--crit); border-color: #5a2320; }
.pill.High { color: #f0883e; border-color: #5c3218; }
.pill.Medium { color: var(--warn); border-color: #5a4517; }
.pill.Low { color: var(--ok); border-color: #1f4d29; }
.pill.late { color: var(--crit); border-color: #5a2320; }

/* ── tables ─────────────────────────────────────────────────────────────── */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
tbody tr:hover { background: var(--panel); }

/* ── ticket detail ──────────────────────────────────────────────────────── */
.split { display: grid; grid-template-columns: minmax(0,1fr) 330px; gap: 20px; align-items: start; }
@media (max-width: 1000px) { .split { grid-template-columns: 1fr; } }

.kv { display: grid; grid-template-columns: 128px 1fr; gap: 7px 12px; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-word; }

.thread { display: flex; flex-direction: column; gap: 12px; }
.msg { border: 1px solid var(--line); border-radius: var(--radius); padding: 13px 15px;
       background: var(--panel); }
.msg .head { display: flex; gap: 9px; align-items: center; font-size: 12.5px;
             color: var(--muted); margin-bottom: 7px; }
.msg .body { white-space: pre-wrap; word-wrap: break-word; }
.msg.client { border-left: 3px solid var(--accent); }
.msg.agent { border-left: 3px solid var(--ok); }
.msg.note { border-left: 3px solid var(--warn); background: #1d1a10; }
.msg.system { border-left: 3px solid var(--line); color: var(--muted); font-size: 13px; }

.tabs { display: flex; gap: 6px; margin-bottom: 12px; }
.tabs button { background: var(--panel-2); color: var(--muted); border: 1px solid var(--line); }
.tabs button.on { background: var(--accent); color: #04121f; border-color: var(--accent); }

.timeline { list-style: none; margin: 0; padding: 0; font-size: 12.5px; color: var(--muted); }
.timeline li { padding: 5px 0; border-bottom: 1px dashed var(--line); }

.files { list-style: none; padding: 0; margin: 0; }
.files li { padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }

/* ── devtools ───────────────────────────────────────────────────────────── */
pre.term {
  background: #05090e; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; overflow: auto; max-height: 460px;
  font-family: var(--mono); font-size: 12.5px; line-height: 1.5; white-space: pre-wrap;
}
pre.diff { max-height: 520px; }
pre.diff .add { color: var(--ok); }
.badge { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.warnbox { border: 1px solid #5a4517; background: #201a0c; border-radius: var(--radius);
           padding: 13px 16px; margin-bottom: 18px; font-size: 13.5px; }

/* ── responsive / mobile ────────────────────────────────────────────────────
   The client-facing pages (submit, track, tokenised ticket view) are used on
   phones, so everything reflows to a single column below ~640px. */
img, video, iframe { max-width: 100%; height: auto; }

@media (max-width: 820px) {
  .split { grid-template-columns: 1fr; }         /* ticket detail stacks */
  .wide { padding: 18px 16px 48px; }
}

@media (max-width: 640px) {
  html { -webkit-text-size-adjust: 100%; }
  .topbar { padding: 10px 14px; gap: 10px 14px; flex-wrap: wrap; }
  .topbar nav { margin-left: 0; width: 100%; gap: 14px; flex-wrap: wrap; font-size: 13px; }
  .topbar .brand { font-size: 15px; }

  .wrap, .wide { padding: 16px 14px 44px; }
  h1 { font-size: 21px; }
  h2 { font-size: 16px; }
  .lede { font-size: 14px; margin-bottom: 18px; }
  .card { padding: 15px; }

  /* side-by-side form fields stack */
  .row { flex-direction: column; gap: 0; }
  .row > * { width: 100%; }

  /* inputs comfortable to tap; 16px avoids iOS zoom-on-focus */
  input[type=text], input[type=email], input[type=tel], input[type=password],
  input[type=datetime-local], input[type=date], input[type=file], select, textarea {
    font-size: 16px; padding: 12px;
  }
  button, .btn { width: 100%; padding: 13px 18px; }        /* full-width, easy to tap */
  .filters { flex-direction: column; align-items: stretch; }
  .filters input, .filters select, .filters .btn { width: 100%; min-width: 0; }

  /* stat tiles two-up */
  .stats { gap: 8px; }
  .stat { flex: 1 1 44%; min-width: 0; }

  /* board becomes a single vertical column of stacked status groups */
  .board { flex-direction: column; }
  .col { flex: 1 1 auto; width: 100%; }

  /* intake key/value list stacks label over value */
  .kv { grid-template-columns: 1fr; gap: 2px 0; }
  .kv dt { color: var(--muted); margin-top: 8px; }

  /* wide tables scroll inside their own box instead of breaking the layout */
  table { font-size: 13px; }
}

/* Let any table scroll horizontally rather than overflow the page */
.wrap, .wide { overflow-x: hidden; }
table { display: block; overflow-x: auto; white-space: nowrap; }
@media (min-width: 641px) { table { display: table; white-space: normal; } }
