/* Aptum support portal — support.aptum.co.za
   Brand: the charcoal behind the Aptum logo, the logo's gold, and the fonts the
   aptum.co.za website already uses (Montserrat headings, Nunito Sans text). */

:root {
  --charcoal: #2a2e30;
  --charcoal-2: #3a3f42;
  --gold: #a8894e;
  --gold-ink: #8a6f37;
  --gold-wash: #f6f1e6;
  --ground: #f4f3f0;
  --surface: #ffffff;
  --ink: #1f2328;
  --ink-2: #4b5157;
  --ink-3: #767c82;
  --line: #e3e0d9;
  --line-2: #d2cec5;

  --s-open: #2f5f8a;        --s-open-bg: #e8f0f7;
  --s-progress: #8a6111;    --s-progress-bg: #fbf1dc;
  --s-waiting: #a33a2c;     --s-waiting-bg: #fbeae7;
  --s-resolved: #2f6f4f;    --s-resolved-bg: #e5f2ea;
  --s-closed: #5d6267;      --s-closed-bg: #eceae6;

  --sev-critical: #a33a2c;
  --sev-high: #b5651d;
  --sev-medium: #8a6111;
  --sev-low: #5d6267;

  --radius: 6px;
  --head: "Montserrat", "Segoe UI", system-ui, sans-serif;
  --body: "Nunito Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--ground); color: var(--ink);
  font-family: var(--body); font-size: 16px; line-height: 1.55;
  min-height: 100vh; display: flex; flex-direction: column;
}
a { color: var(--gold-ink); }
a:hover { color: var(--ink); }
:focus-visible { outline: 3px solid rgba(168, 137, 78, .55); outline-offset: 2px; }
h1, h2, h3 { font-family: var(--head); color: var(--ink); text-wrap: balance; }
h1 { font-size: clamp(1.5rem, 3.6vw, 2rem); font-weight: 800; letter-spacing: -.01em; margin: 0; line-height: 1.2; }
h2 { font-size: 1.1rem; font-weight: 700; margin: 0 0 12px; }

/* ---- top bar ---- */
.bar { background: var(--charcoal); color: #fff; }
.bar-inner {
  max-width: 1040px; margin: 0 auto; padding-inline: 20px; padding-block: 10px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: #fff; }
.brand img { height: 38px; width: auto; display: block; }
.brand span {
  font-family: var(--head); font-weight: 600; font-size: 13px; letter-spacing: .14em;
  text-transform: uppercase; color: var(--gold); border-left: 1px solid #555b5e; padding-left: 12px;
}
.who { display: flex; align-items: center; gap: 14px; font-size: 14px; color: #c9cbcc; }
.who strong { color: #fff; font-weight: 600; }
.linkbtn {
  background: none; border: 1px solid #5b6164; color: #fff; border-radius: 4px;
  padding: 6px 12px; font: inherit; font-size: 13px; cursor: pointer;
}
.linkbtn:hover { border-color: var(--gold); color: var(--gold); }

/* ---- page ---- */
main { flex: 1; width: 100%; max-width: 1040px; margin: 0 auto; padding-inline: 20px; padding-block: 32px 56px; }
.pagehead { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.pagehead p { margin: 6px 0 0; color: var(--ink-2); }
.crumb { font-size: 14px; margin-bottom: 10px; display: inline-block; text-decoration: none; }
.crumb::before { content: "← "; }

.btn {
  display: inline-flex; align-items: center; gap: 8px; border: 0; border-radius: 4px;
  background: var(--charcoal); color: #fff; font: 600 15px var(--body);
  padding: 11px 20px; cursor: pointer; text-decoration: none;
}
.btn:hover { background: var(--gold); color: #fff; }
.btn.secondary { background: var(--surface); color: var(--ink); border: 1px solid var(--line-2); }
.btn.secondary:hover { border-color: var(--gold); color: var(--gold-ink); }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }

/* ---- tabs + search ---- */
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.tabs { display: flex; gap: 4px; background: #e9e6df; padding: 4px; border-radius: 6px; }
.tabs a {
  text-decoration: none; color: var(--ink-2); padding: 7px 14px; border-radius: 4px;
  font-weight: 600; font-size: 14px; display: inline-flex; gap: 8px; align-items: center;
}
.tabs a.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.tabs .n { font-variant-numeric: tabular-nums; color: var(--ink-3); font-weight: 600; }
.search { display: flex; gap: 6px; }
.search input { width: 220px; max-width: 100%; }

/* ---- ticket list ---- */
.tickets { list-style: none; margin: 0; padding: 0; }
.tickets li + li { border-top: 1px solid var(--line); }
.tickets a.row {
  display: grid; grid-template-columns: 96px minmax(0, 1fr) 140px 190px; gap: 4px 18px;
  align-items: center; padding: 14px 18px; text-decoration: none; color: inherit;
}
.tickets a.row:hover { background: #faf8f4; }
.num { font-family: var(--head); font-weight: 700; font-size: 13.5px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.subj { font-weight: 700; color: var(--ink); overflow-wrap: anywhere; }
.meta { font-size: 13.5px; color: var(--ink-3); }
.when { font-size: 13px; color: var(--ink-3); text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.empty { padding: 44px 18px; text-align: center; color: var(--ink-2); }
.empty strong { display: block; font-family: var(--head); color: var(--ink); margin-bottom: 4px; font-size: 1.05rem; }
@media (max-width: 720px) {
  .tickets a.row { grid-template-columns: minmax(0, 1fr) auto; }
  .tickets .num { grid-column: 1; }
  .tickets .pillcell { grid-column: 2; grid-row: 1; justify-self: end; }
  .tickets .subjcell { grid-column: 1 / -1; }
  .tickets .when { grid-column: 1 / -1; text-align: left; }
  .search input { width: 100%; }
  .search { flex: 1 1 100%; }
  .tabs { flex: 1 1 100%; }
  .tabs a { flex: 1; justify-content: center; }
}

/* ---- status pill + severity ---- */
.pill {
  display: inline-block; font-size: 12.5px; font-weight: 700; letter-spacing: .02em;
  padding: 3px 10px; border-radius: 999px; white-space: nowrap;
}
.pill.open { color: var(--s-open); background: var(--s-open-bg); }
.pill.in_progress { color: var(--s-progress); background: var(--s-progress-bg); }
.pill.waiting_on_you { color: var(--s-waiting); background: var(--s-waiting-bg); }
.pill.resolved { color: var(--s-resolved); background: var(--s-resolved-bg); }
.pill.closed { color: var(--s-closed); background: var(--s-closed-bg); }
.sev { font-weight: 700; }
.sev::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; background: currentColor; }
.sev.critical { color: var(--sev-critical); }
.sev.high { color: var(--sev-high); }
.sev.medium { color: var(--sev-medium); }
.sev.low { color: var(--sev-low); }

/* ---- forms ---- */
.form { padding: 24px; display: grid; gap: 18px; }
.field label { display: block; font-weight: 700; font-size: 14px; margin-bottom: 6px; }
.field .help { font-size: 13.5px; color: var(--ink-3); margin-top: 5px; }
.field .err, .errorlist { color: var(--s-waiting); font-size: 13.5px; margin: 6px 0 0; padding: 0; list-style: none; }
input[type=text], input[type=email], input[type=password], input[type=search], select, textarea {
  width: 100%; max-width: 100%; font: 15px var(--body); color: var(--ink);
  background: #fff; border: 1px solid var(--line-2); border-radius: 4px; padding: 10px 12px;
}
textarea { resize: vertical; min-height: 120px; line-height: 1.5; }
select { height: 44px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(168,137,78,.2); }
input[type=file] { font-size: 14px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 640px) { .two { grid-template-columns: 1fr; } }
.actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.alert { border-radius: var(--radius); padding: 12px 16px; margin-bottom: 18px; font-size: 15px; }
.alert.bad { background: var(--s-waiting-bg); color: #7a2a20; border: 1px solid #f0cfc9; }
.alert.good { background: var(--s-resolved-bg); color: #1f4f37; border: 1px solid #c6e2d2; }
.alert.note { background: var(--gold-wash); color: #5c4a22; border: 1px solid #ead9b6; }

/* ---- sign in ---- */
.signin { flex: 1; display: grid; place-items: center; padding-inline: 16px; padding-block: 40px; }
.signin-card { width: 100%; max-width: 420px; }
.signin-top { background: var(--charcoal); border-radius: var(--radius) var(--radius) 0 0; padding: 22px 26px; }
.signin-top img { height: 44px; display: block; }
.signin-body { background: var(--surface); border: 1px solid var(--line); border-top: 0; border-radius: 0 0 var(--radius) var(--radius); padding: 26px; display: grid; gap: 16px; }
.signin-body h1 { font-size: 1.35rem; }
.signin-body .lead { margin: 4px 0 0; color: var(--ink-2); font-size: 15px; }
.signin-body .btn { width: 100%; justify-content: center; }
.small { font-size: 13.5px; color: var(--ink-3); }
.small p { margin: 0 0 6px; }

/* ---- ticket detail ---- */
.detail { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 22px; align-items: start; }
@media (max-width: 860px) { .detail { grid-template-columns: minmax(0, 1fr); } }
.facts { padding: 18px 20px; display: grid; gap: 0; }
.facts div { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14.5px; }
.facts div:last-child { border-bottom: 0; }
.facts dt { color: var(--ink-3); }
.facts dd { margin: 0; text-align: right; font-weight: 600; }
.desc { padding: 20px 22px; }
.desc h2 { font-size: .8rem; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }
.text { white-space: normal; overflow-wrap: anywhere; }

.thread { list-style: none; padding: 0; margin: 22px 0 0; display: grid; gap: 12px; }
.msg { padding: 14px 18px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); }
.msg.staff { border-left: 3px solid var(--gold); }
.msg.customer { background: #f9f8f5; }
.msg header { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; font-size: 13.5px; }
.msg header strong { color: var(--ink); }
.msg header time { color: var(--ink-3); font-variant-numeric: tabular-nums; }
.reply { margin-top: 22px; }
.files { list-style: none; margin: 0; padding: 0 20px 16px; font-size: 14px; }
.files li { padding: 4px 0; overflow-wrap: anywhere; }
.files li::before { content: "📎 "; }
.section-label { font-family: var(--head); font-size: .8rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); padding: 16px 20px 6px; }

/* ---- footer ---- */
.foot { border-top: 1px solid var(--line); color: var(--ink-3); font-size: 13.5px; }
.foot-inner { max-width: 1040px; margin: 0 auto; padding-inline: 20px; padding-block: 18px; display: flex; gap: 6px 24px; flex-wrap: wrap; justify-content: space-between; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
