/* Globatics Help Desk. Brand chrome from globatics.com (burgundy cloth, pink print),
   on a light working surface so long queues stay easy to read. */
:root {
  --burgundy: oklch(31% 0.105 2);
  --burgundy-2: oklch(27% 0.095 2);
  --burgundy-3: oklch(38% 0.115 2);
  --pink: oklch(81% 0.105 350);
  --pink-soft: oklch(95.5% 0.025 350);
  --pink-line: oklch(88% 0.05 350);
  --on-burgundy: oklch(95% 0.022 350);
  --on-burgundy-muted: oklch(82% 0.05 352);

  --paper: oklch(98.4% 0.005 350);
  --card: #fff;
  --sunk: oklch(96% 0.008 350);
  --rule: oklch(91% 0.014 350);
  --rule-strong: oklch(84% 0.02 350);
  --ink: oklch(24% 0.035 2);
  --ink-2: oklch(38% 0.035 2);
  --muted: oklch(50% 0.03 2);
  --focus: oklch(62% 0.17 255);

  --urgent: oklch(54% 0.19 25);
  --urgent-bg: oklch(95.5% 0.03 25);
  --high: oklch(58% 0.14 55);
  --high-bg: oklch(96% 0.035 70);
  --medium: oklch(52% 0.11 250);
  --medium-bg: oklch(96% 0.02 250);
  --low: oklch(52% 0.02 2);
  --low-bg: oklch(95.5% 0.006 2);
  --ok: oklch(50% 0.12 150);
  --ok-bg: oklch(95.5% 0.035 150);
  --note-bg: oklch(97% 0.035 90);
  --note-line: oklch(86% 0.08 90);

  --font-display: "Archivo", ui-sans-serif, system-ui, sans-serif;
  --font-body: "Onest", ui-sans-serif, system-ui, sans-serif;
  --r: 8px;
  --r-lg: 12px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--paper); color: var(--ink); font: 15px/1.5 var(--font-body); -webkit-font-smoothing: antialiased; min-height: 100vh; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
h1, h2, h3, p { margin: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- top bar */
.bar { background: var(--burgundy); color: var(--on-burgundy); position: sticky; top: 0; z-index: 20; }
.bar__inner { display: flex; align-items: center; gap: 24px; height: 60px; padding: 0 24px; max-width: 1480px; margin: 0 auto; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--pink); flex-shrink: 0; }
.brand img { width: 28px; height: 28px; }
.brand b { font: 800 1.15rem/1 var(--font-display); font-stretch: 78%; text-transform: uppercase; letter-spacing: -0.01em; }
.brand span { font-size: 0.8rem; color: var(--on-burgundy-muted); border-left: 1px solid var(--burgundy-3); padding-left: 10px; }
.nav { display: flex; gap: 2px; list-style: none; margin: 0; padding: 0; }
.nav a { display: block; padding: 7px 12px; border-radius: 999px; text-decoration: none; color: var(--on-burgundy-muted); font-weight: 500; font-size: 0.9rem; transition: background-color 160ms var(--ease), color 160ms var(--ease); }
.nav a:hover { background: var(--burgundy-3); color: var(--on-burgundy); }
.nav a[aria-current="page"] { background: var(--burgundy-2); color: var(--pink); }
.bar__end { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.who { display: flex; align-items: center; gap: 8px; font-size: 0.85rem; color: var(--on-burgundy-muted); }
.signout { background: none; border: 0; color: var(--on-burgundy-muted); cursor: pointer; padding: 6px 8px; border-radius: 6px; font-size: 0.85rem; }
.signout:hover { color: var(--on-burgundy); background: var(--burgundy-3); }

/* ---------- buttons and inputs */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 38px; padding: 0 16px; border-radius: 999px; border: 1px solid transparent; font-weight: 600; font-size: 0.9rem; cursor: pointer; text-decoration: none; white-space: nowrap; transition: background-color 160ms var(--ease), border-color 160ms var(--ease), transform 100ms var(--ease); }
.btn:active { transform: scale(0.97); }
.btn--primary { background: var(--burgundy); color: var(--on-burgundy); }
.btn--primary:hover { background: var(--burgundy-3); }
.btn--pink { background: var(--pink); color: var(--burgundy-2); }
.btn--pink:hover { background: var(--on-burgundy); }
.btn--ghost { background: var(--card); border-color: var(--rule-strong); color: var(--ink); }
.btn--ghost:hover { border-color: var(--ink-2); }
.btn--danger { background: var(--card); border-color: var(--urgent); color: var(--urgent); }
.btn--danger:hover { background: var(--urgent-bg); }
.btn--sm { min-height: 32px; padding: 0 12px; font-size: 0.85rem; }
.btn[disabled] { opacity: 0.55; cursor: progress; }

.field { display: grid; gap: 6px; }
.field > span, .label { font-weight: 600; font-size: 0.85rem; color: var(--ink-2); }
.field small { color: var(--muted); font-size: 0.8rem; }
.input, .select, .textarea { width: 100%; border: 1px solid var(--rule-strong); background: var(--card); border-radius: var(--r); padding: 9px 12px; transition: border-color 160ms var(--ease), box-shadow 160ms var(--ease); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--ink-2); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px oklch(62% 0.17 255 / 0.18); }
.textarea { resize: vertical; min-height: 120px; line-height: 1.5; }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23764' stroke-width='1.6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 34px; cursor: pointer; }
.select--sm { padding: 6px 30px 6px 10px; font-size: 0.85rem; }
.error { color: var(--urgent); font-size: 0.875rem; font-weight: 500; }
.error:empty { display: none; }

/* ---------- page layout */
.page { max-width: 1480px; margin: 0 auto; padding: 32px 24px 80px; }
.page--narrow { max-width: 1120px; }
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.head h1 { font: 800 2rem/1 var(--font-display); font-stretch: 78%; text-transform: uppercase; letter-spacing: -0.02em; color: var(--burgundy); }
.head p { color: var(--muted); margin-top: 6px; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 18px; }
.toolbar .input { width: 240px; padding: 7px 12px; font-size: 0.9rem; }
.seg { display: inline-flex; border: 1px solid var(--rule-strong); border-radius: 999px; padding: 2px; background: var(--card); }
.seg button { border: 0; background: none; padding: 5px 12px; border-radius: 999px; font-size: 0.85rem; font-weight: 500; color: var(--ink-2); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--burgundy); color: var(--on-burgundy); }
.spacer { flex: 1; }
.count { color: var(--muted); font-size: 0.85rem; }

/* ---------- pills */
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 0.78rem; font-weight: 600; white-space: nowrap; line-height: 1.6; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.p-urgent { color: var(--urgent); background: var(--urgent-bg); }
.p-high { color: var(--high); background: var(--high-bg); }
.p-medium { color: var(--medium); background: var(--medium-bg); }
.p-low { color: var(--low); background: var(--low-bg); }
.s { background: var(--sunk); color: var(--ink-2); }
.s::before { display: none; }
.s-new { background: var(--pink-soft); color: var(--burgundy); }
.s-escalated { background: var(--urgent-bg); color: var(--urgent); }
.s-in_progress { background: var(--medium-bg); color: var(--medium); }
.s-waiting { background: var(--high-bg); color: var(--high); }
.s-resolved, .s-closed { background: var(--ok-bg); color: var(--ok); }
.key { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--muted); font-size: 0.8rem; letter-spacing: 0.01em; }

/* ---------- ticket list */
.table { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--rule); border-radius: var(--r-lg); overflow: hidden; }
.table th { text-align: left; font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); padding: 10px 14px; background: var(--sunk); border-bottom: 1px solid var(--rule); }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--rule); vertical-align: middle; font-size: 0.9rem; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { cursor: pointer; transition: background-color 120ms; }
.table tbody tr:hover { background: var(--paper); }
.table .title { font-weight: 600; color: var(--ink); text-decoration: none; }
.table .title:hover { text-decoration: underline; }
.muted { color: var(--muted); }
.table-wrap { overflow-x: auto; }

/* ---------- board */
.board { display: grid; grid-template-columns: repeat(5, minmax(240px, 1fr)); gap: 14px; overflow-x: auto; padding-bottom: 8px; align-items: start; }
.col { background: var(--sunk); border-radius: var(--r-lg); padding: 10px; min-height: 200px; transition: background-color 160ms var(--ease), box-shadow 160ms var(--ease); }
.col.is-over { background: var(--pink-soft); box-shadow: inset 0 0 0 2px var(--pink); }
.col__head { display: flex; align-items: center; justify-content: space-between; padding: 4px 6px 10px; }
.col__head h2 { font-size: 0.78rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-2); }
.col__head span { font-size: 0.78rem; color: var(--muted); background: var(--card); border-radius: 999px; padding: 0 8px; }
.cards { display: grid; gap: 8px; }
.card { display: block; background: var(--card); border: 1px solid var(--rule); border-radius: var(--r); padding: 11px 12px; text-decoration: none; cursor: grab; transition: border-color 160ms var(--ease), box-shadow 160ms var(--ease), transform 160ms var(--ease); }
.card:hover { border-color: var(--rule-strong); box-shadow: 0 4px 14px -8px oklch(30% 0.08 2 / 0.35); }
.card.is-dragging { opacity: 0.45; }
.card__title { font-weight: 600; font-size: 0.9rem; line-height: 1.35; margin: 4px 0 10px; color: var(--ink); }
.card__meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 0.78rem; color: var(--muted); }
.card__foot { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; font-size: 0.78rem; color: var(--muted); }
.avatar { width: 24px; height: 24px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 0.68rem; font-weight: 600; background: var(--pink-soft); color: var(--burgundy); flex-shrink: 0; }
.avatar--lg { width: 34px; height: 34px; font-size: 0.8rem; }
.avatar--pam { background: var(--burgundy); overflow: hidden; }
.avatar--pam img { width: 100%; height: 100%; object-fit: cover; }
.col__empty { font-size: 0.82rem; color: var(--muted); text-align: center; padding: 18px 8px; border: 1px dashed var(--rule-strong); border-radius: var(--r); }

/* ---------- empty state */
.empty { background: var(--card); border: 1px solid var(--rule); border-radius: var(--r-lg); padding: 56px 24px; text-align: center; display: grid; justify-items: center; gap: 10px; }
.empty img { width: 64px; height: 64px; border-radius: 50%; }
.empty h2 { font-size: 1.1rem; }
.empty p { color: var(--muted); max-width: 40ch; }

/* ---------- new ticket */
.split { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 28px; align-items: start; }
.panel { background: var(--card); border: 1px solid var(--rule); border-radius: var(--r-lg); padding: 24px; }
.form { display: grid; gap: 20px; }
.prio { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.prio label { position: relative; display: grid; gap: 2px; padding: 10px 12px; border: 1px solid var(--rule-strong); border-radius: var(--r); cursor: pointer; transition: border-color 160ms var(--ease), background-color 160ms var(--ease); }
.prio label:hover { border-color: var(--ink-2); }
.prio input { position: absolute; opacity: 0; pointer-events: none; }
.prio b { font-size: 0.9rem; }
.prio small { font-size: 0.76rem; color: var(--muted); line-height: 1.3; }
.prio label:has(input:checked) { border-color: var(--burgundy); background: var(--pink-soft); box-shadow: inset 0 0 0 1px var(--burgundy); }
.prio label:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
.actions { display: flex; gap: 10px; align-items: center; }

.pam-card { background: var(--burgundy); color: var(--on-burgundy); border-radius: var(--r-lg); padding: 22px; display: grid; gap: 12px; }
.pam-card__head { display: flex; align-items: center; gap: 12px; }
.pam-card__head img { width: 44px; height: 44px; border-radius: 50%; }
.pam-card h2 { font: 800 1.35rem/1 var(--font-display); font-stretch: 78%; text-transform: uppercase; color: var(--pink); }
.pam-card p { color: var(--on-burgundy-muted); font-size: 0.88rem; }
.waits { list-style: none; margin: 4px 0 0; padding: 0; display: grid; border-top: 1px solid var(--burgundy-3); }
.waits li { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--burgundy-3); font-size: 0.86rem; }
.waits li span:last-child { color: var(--pink); font-weight: 600; white-space: nowrap; }
.waits-note { font-size: 0.76rem !important; }

/* ---------- ticket detail */
.crumbs { display: flex; gap: 8px; align-items: center; font-size: 0.85rem; color: var(--muted); margin-bottom: 10px; }
.crumbs a { text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }
.ticket-title { font-size: 1.65rem; line-height: 1.2; font-weight: 600; letter-spacing: -0.01em; margin-bottom: 14px; text-wrap: balance; }
.detail { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 28px; align-items: start; }
.desc { background: var(--card); border: 1px solid var(--rule); border-radius: var(--r-lg); padding: 18px 20px; white-space: pre-wrap; overflow-wrap: anywhere; }
.section-label { font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin: 28px 0 12px; }
.feed { display: grid; gap: 14px; }
.msg { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 12px; }
.msg__body { background: var(--card); border: 1px solid var(--rule); border-radius: var(--r-lg); padding: 12px 16px; }
.msg__head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; font-size: 0.85rem; }
.msg__head b { font-weight: 600; }
.msg__head time { color: var(--muted); font-size: 0.8rem; }
.msg__text { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 0.93rem; }
.tag { font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; padding: 1px 7px; border-radius: 4px; background: var(--sunk); color: var(--ink-2); }
.msg--pam .msg__body { background: var(--pink-soft); border-color: var(--pink-line); }
.msg--pam .tag { background: var(--burgundy); color: var(--pink); }
.msg--internal .msg__body { background: var(--note-bg); border-color: var(--note-line); }
.event { display: flex; align-items: flex-start; gap: 10px; font-size: 0.84rem; color: var(--muted); padding: 0 0 0 11px; }
.event::before { content: ""; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--rule-strong); background: var(--paper); margin-top: 3px; flex-shrink: 0; }
.event time { white-space: nowrap; }
.waiting-pam { display: flex; align-items: center; gap: 12px; padding: 14px 16px; background: var(--pink-soft); border: 1px dashed var(--pink); border-radius: var(--r-lg); font-size: 0.9rem; color: var(--burgundy); }
.waiting-pam img { width: 34px; height: 34px; border-radius: 50%; animation: bob 1.6s var(--ease) infinite alternate; }
@keyframes bob { to { transform: translateY(-3px) rotate(-4deg); } }

.reply { margin-top: 20px; background: var(--card); border: 1px solid var(--rule); border-radius: var(--r-lg); padding: 14px; display: grid; gap: 10px; }
.reply .textarea { min-height: 90px; border-color: var(--rule); }
.reply.is-internal { background: var(--note-bg); border-color: var(--note-line); }
.reply__foot { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.check { display: inline-flex; align-items: center; gap: 7px; font-size: 0.86rem; color: var(--ink-2); cursor: pointer; }
.check input { accent-color: var(--burgundy); width: 16px; height: 16px; }

.side { display: grid; gap: 14px; position: sticky; top: 80px; }
.props { background: var(--card); border: 1px solid var(--rule); border-radius: var(--r-lg); padding: 6px 16px; }
.prop { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--rule); font-size: 0.88rem; }
.prop:last-child { border-bottom: 0; }
.prop dt { color: var(--muted); font-size: 0.82rem; }
.prop dd { margin: 0; min-width: 0; }
.prop .select { padding: 5px 28px 5px 9px; font-size: 0.86rem; background-position: right 9px center; }
.why { font-size: 0.78rem; color: var(--muted); margin-top: 4px; line-height: 1.35; }
.wait-box { background: var(--burgundy); color: var(--on-burgundy); border-radius: var(--r-lg); padding: 14px 16px; display: flex; gap: 12px; align-items: center; }
.wait-box img { width: 36px; height: 36px; border-radius: 50%; }
.wait-box b { color: var(--pink); display: block; font-size: 1.05rem; }
.wait-box span { font-size: 0.8rem; color: var(--on-burgundy-muted); }
.side-actions { display: grid; gap: 8px; }
.escalate { background: var(--card); border: 1px solid var(--urgent); border-radius: var(--r-lg); padding: 14px; display: grid; gap: 10px; }
.escalate .textarea { min-height: 70px; }

/* ---------- auth */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(380px, 1fr); }
.auth__brand { background: var(--burgundy); color: var(--on-burgundy); padding: 48px; display: flex; flex-direction: column; justify-content: space-between; gap: 40px; position: relative; overflow: hidden; }
.auth__brand .brand b { font-size: 1.4rem; }
.auth__brand h1 { font: 800 clamp(3rem, 6vw, 5.5rem)/0.92 var(--font-display); font-stretch: 78%; text-transform: uppercase; letter-spacing: -0.025em; color: var(--pink); max-width: 9ch; }
.auth__brand p { color: var(--on-burgundy-muted); font-size: 1.05rem; max-width: 34ch; margin-top: 18px; }
.auth__pam { display: flex; gap: 14px; align-items: center; font-size: 0.9rem; color: var(--on-burgundy-muted); }
.auth__pam img { width: 52px; height: 52px; border-radius: 50%; }
.auth__pam b { color: var(--on-burgundy); display: block; }
.auth__form { display: grid; place-items: center; padding: 48px 24px; }
.auth__form form { width: min(380px, 100%); display: grid; gap: 18px; }
.auth__form h2 { font-size: 1.5rem; font-weight: 600; letter-spacing: -0.01em; }
.auth__form .sub { color: var(--muted); margin-top: -10px; }
.auth__form .btn { min-height: 44px; }
.switch { font-size: 0.9rem; color: var(--muted); text-align: center; }
.switch a { color: var(--burgundy); font-weight: 600; }

/* ---------- admin */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--rule); margin-bottom: 20px; }
.tabs button { background: none; border: 0; padding: 10px 14px; font-weight: 500; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button[aria-selected="true"] { color: var(--burgundy); border-bottom-color: var(--burgundy); }
.types { display: grid; gap: 14px; }
.type-edit { display: grid; gap: 12px; }
.type-edit__row { display: grid; grid-template-columns: 1.2fr 1fr 0.8fr; gap: 12px; }
.type-edit h3 { font-size: 1rem; }
.type-edit .textarea { font-size: 0.86rem; min-height: 170px; }
.hint { font-size: 0.8rem; color: var(--muted); }
.hint code { background: var(--sunk); padding: 1px 5px; border-radius: 4px; font-size: 0.78rem; }

/* ---------- toast */
#toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 999px; font-size: 0.9rem; z-index: 50; box-shadow: 0 10px 30px -10px oklch(20% 0.05 2 / 0.5); animation: rise 240ms var(--ease); }
#toast.is-error { background: var(--urgent); }
@keyframes rise { from { opacity: 0; transform: translate(-50%, 8px); } }

.loading { padding: 80px 24px; text-align: center; color: var(--muted); }

@media (max-width: 1000px) {
  .split, .detail { grid-template-columns: 1fr; }
  .side { position: static; }
  .auth { grid-template-columns: 1fr; }
  .auth__brand { padding: 32px 24px; }
  .auth__brand h1 { font-size: 3rem; }
}
@media (max-width: 700px) {
  .bar__inner { gap: 12px; padding: 0 14px; }
  .brand span, .who span { display: none; }
  .nav a { padding: 7px 9px; }
  .prio { grid-template-columns: repeat(2, 1fr); }
  .type-edit__row { grid-template-columns: 1fr; }
  .page { padding: 22px 14px 64px; }
  .table .hide-sm { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
