/* Stafferton Support — brand: teal #009AB9, navy #063955, Plus Jakarta Sans / DM Sans */

@font-face { font-family: 'Plus Jakarta Sans'; src: url('/fonts/plus-jakarta-sans-latin-400-normal.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Plus Jakarta Sans'; src: url('/fonts/plus-jakarta-sans-latin-500-normal.woff2') format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Plus Jakarta Sans'; src: url('/fonts/plus-jakarta-sans-latin-600-normal.woff2') format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Plus Jakarta Sans'; src: url('/fonts/plus-jakarta-sans-latin-700-normal.woff2') format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Plus Jakarta Sans'; src: url('/fonts/plus-jakarta-sans-latin-800-normal.woff2') format('woff2'); font-weight: 800; font-display: swap; }
@font-face { font-family: 'DM Sans'; src: url('/fonts/dm-sans-latin-400-normal.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'DM Sans'; src: url('/fonts/dm-sans-latin-500-normal.woff2') format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'DM Sans'; src: url('/fonts/dm-sans-latin-700-normal.woff2') format('woff2'); font-weight: 700; font-display: swap; }

:root {
  --teal: #009AB9;
  --teal-dark: #007E98;
  --teal-tint: #E6F5F8;
  --navy: #063955;
  --navy-deep: #042A40;
  --paper: #F5F8F9;
  --surface: #FFFFFF;
  --ink: #20313B;
  --muted: #65767F;
  --line: #DEE7EA;
  --critical: #D64545;
  --high: #DE8500;
  --medium: #009AB9;
  --low: #8A98A0;
  --good: #2E9E5B;
  --warn-bg: #FDF3E7;
  --crit-bg: #FBEAEA;
  --radius: 10px;
  --display: 'Plus Jakarta Sans', system-ui, sans-serif;
  --body: 'DM Sans', system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body { font-family: var(--body); font-size: 14.5px; color: var(--ink); background: var(--paper); }
h1, h2, h3, h4, .btn, .nav a, .tag, .badge, th { font-family: var(--display); }
a { color: var(--teal-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: var(--ink); border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; background: #fff; width: 100%; }
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 2px solid var(--teal); outline-offset: 1px; border-color: var(--teal); }
textarea { resize: vertical; min-height: 90px; }
label { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); margin: 12px 0 5px; font-family: var(--display); letter-spacing: .01em; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.sidebar { background: var(--navy); color: #CFE3EC; padding: 22px 14px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 10px 20px; }
.brand .mark { width: 30px; height: 30px; flex: none; }
.brand .word { font-family: var(--display); font-weight: 800; font-size: 15px; color: #fff; letter-spacing: .02em; }
.brand .word em { color: var(--teal); font-style: normal; }
.nav a { display: flex; align-items: center; gap: 10px; color: #BBD3DF; padding: 9px 12px; border-radius: 8px; font-weight: 600; font-size: 13.5px; }
.nav a:hover { background: rgba(255,255,255,.06); text-decoration: none; color: #fff; }
.nav a.active { background: var(--teal); color: #fff; }
.nav svg { width: 16px; height: 16px; flex: none; }
.sidebar .foot { margin-top: auto; padding: 10px 12px; font-size: 12.5px; color: #8FB0BF; }
.sidebar .foot button { background: none; border: none; color: #8FB0BF; padding: 0; font-size: 12.5px; }
.sidebar .foot button:hover { color: #fff; }

.main { padding: 26px 30px 60px; max-width: 1240px; width: 100%; }
.pagehead { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.pagehead h1 { font-size: 21px; font-weight: 800; color: var(--navy); }
.pagehead .sub { color: var(--muted); font-size: 13px; margin-top: 3px; }

/* ---------- components ---------- */
.btn { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line); background: #fff; color: var(--ink); padding: 8px 14px; border-radius: 8px; font-weight: 700; font-size: 13px; }
.btn:hover { border-color: var(--teal); color: var(--teal-dark); }
.btn.primary { background: var(--teal); border-color: var(--teal); color: #fff; }
.btn.primary:hover { background: var(--teal-dark); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--teal-dark); }
.btn.danger { color: var(--critical); }
.btn.sm { padding: 5px 10px; font-size: 12px; }
.btn[disabled] { opacity: .5; cursor: default; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.grid { display: grid; gap: 14px; }
.grid.cols4 { grid-template-columns: repeat(4, 1fr); }
.grid.cols3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols2 { grid-template-columns: repeat(2, 1fr); }

.stat { padding: 16px 18px; }
.stat .n { font-family: var(--display); font-weight: 800; font-size: 26px; color: var(--navy); }
.stat .l { font-size: 12.5px; color: var(--muted); font-weight: 600; margin-top: 2px; }
.stat.alert .n { color: var(--critical); }
.stat.warn .n { color: var(--high); }

table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); }
td { padding: 11px 10px; border-bottom: 1px solid #ECF1F3; vertical-align: top; }
tr.rowlink { cursor: pointer; }
tr.rowlink:hover td { background: var(--teal-tint); }

.badge { display: inline-block; font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 99px; letter-spacing: .02em; }
.badge.critical { background: var(--crit-bg); color: var(--critical); }
.badge.high { background: var(--warn-bg); color: var(--high); }
.badge.medium { background: var(--teal-tint); color: var(--teal-dark); }
.badge.low { background: #EEF1F3; color: var(--low); }
.badge.status-new { background: var(--teal); color: #fff; }
.badge.status-open, .badge.status-in_progress { background: var(--teal-tint); color: var(--teal-dark); }
.badge.status-awaiting_client, .badge.status-awaiting_third_party, .badge.status-scheduled { background: var(--warn-bg); color: var(--high); }
.badge.status-resolved, .badge.status-closed { background: #E9F5EE; color: var(--good); }
.tag { display: inline-block; font-size: 11px; background: #EEF1F3; color: var(--muted); padding: 2px 8px; border-radius: 5px; margin-right: 4px; font-weight: 600; }

.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.filters select, .filters input { width: auto; min-width: 130px; padding: 7px 10px; font-size: 13px; }
.filters input[type=search] { min-width: 220px; }

.toast { position: fixed; bottom: 22px; right: 22px; background: var(--navy); color: #fff; padding: 12px 18px; border-radius: 10px; font-weight: 600; font-size: 13.5px; z-index: 60; box-shadow: 0 8px 24px rgba(4,42,64,.3); }
.toast.error { background: var(--critical); }

.empty { text-align: center; color: var(--muted); padding: 40px 10px; font-size: 13.5px; }

/* ---------- ticket detail ---------- */
.ticketwrap { display: grid; grid-template-columns: 1fr 330px; gap: 18px; align-items: start; }
.thread { display: flex; flex-direction: column; gap: 10px; margin: 14px 0; }
.msg { border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.msg .mhead { display: flex; justify-content: space-between; gap: 10px; padding: 9px 14px; border-bottom: 1px solid #ECF1F3; font-size: 12.5px; color: var(--muted); }
.msg .mhead b { color: var(--ink); font-family: var(--display); }
.msg .mbody { padding: 13px 16px; white-space: pre-wrap; line-height: 1.55; }
.msg.client { border-left: 3px solid var(--navy); }
.msg.agent { border-left: 3px solid var(--teal); }
.msg.internal { background: #FFFBEF; border-left: 3px solid var(--high); }
.msg.internal .mhead::after { content: 'Internal note'; color: var(--high); font-weight: 700; }

.replybox { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.replybox .actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; align-items: center; }

/* Signature element: the Context Engine panel */
.context { border: 1px solid var(--line); border-top: 3px solid var(--teal); border-radius: var(--radius); background: #fff; overflow: hidden; }
.context .chead { display: flex; align-items: center; gap: 8px; padding: 13px 16px 11px; font-family: var(--display); font-weight: 800; font-size: 13px; color: var(--navy); letter-spacing: .03em; text-transform: uppercase; }
.context .chead .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--teal); }
.context .csec { padding: 11px 16px; border-top: 1px solid #ECF1F3; font-size: 13px; }
.context .csec h4 { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 6px; }
.context .csec ul { padding-left: 16px; }
.context .csec li { margin: 3px 0; line-height: 1.45; }
.context .kv { display: flex; justify-content: space-between; gap: 8px; padding: 3px 0; }
.context .kv span:first-child { color: var(--muted); }

.riskmeter { height: 6px; background: #EEF1F3; border-radius: 99px; overflow: hidden; margin-top: 6px; }
.riskmeter i { display: block; height: 100%; background: linear-gradient(90deg, var(--good), var(--high), var(--critical)); border-radius: 99px; }

.aibar { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }
.aibar .btn { border-color: var(--teal-tint); background: var(--teal-tint); color: var(--teal-dark); }
.aibar .btn:hover { background: var(--teal); color: #fff; }

.sla { font-size: 12px; color: var(--muted); }
.sla.breach { color: var(--critical); font-weight: 700; }

/* ---------- auth ---------- */
.authwrap { min-height: 100vh; display: grid; place-items: center; background: var(--navy); }
.authcard { width: 380px; background: #fff; border-radius: 14px; padding: 34px 32px; }
.authcard .brandline { display: flex; align-items: center; gap: 10px; margin-bottom: 22px; }
.authcard h1 { font-size: 18px; color: var(--navy); font-weight: 800; }
.authcard .btn { width: 100%; justify-content: center; margin-top: 18px; padding: 11px; }
.autherr { color: var(--critical); font-size: 13px; margin-top: 10px; font-weight: 600; }

/* ---------- modal ---------- */
.overlay { position: fixed; inset: 0; background: rgba(4,42,64,.45); display: grid; place-items: center; z-index: 50; padding: 20px; }
.modal { background: #fff; border-radius: 14px; padding: 24px 26px; width: 100%; max-width: 520px; max-height: 90vh; overflow: auto; }
.modal h2 { font-size: 16px; color: var(--navy); margin-bottom: 6px; }
.modal .actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; }

.timerpill { display: inline-flex; align-items: center; gap: 8px; background: var(--navy); color: #fff; border-radius: 99px; padding: 6px 14px; font-family: var(--display); font-weight: 700; font-size: 13px; }
.timerpill .dot { width: 8px; height: 8px; border-radius: 50%; background: #6FE3A5; animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .timerpill .dot { animation: none; } }

@media (max-width: 980px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; align-items: center; overflow-x: auto; }
  .sidebar .foot { margin: 0 0 0 auto; }
  .ticketwrap { grid-template-columns: 1fr; }
  .grid.cols4 { grid-template-columns: repeat(2, 1fr); }
  .grid.cols3, .grid.cols2 { grid-template-columns: 1fr; }
  .main { padding: 18px 14px 50px; }
}
