/*
 * Donkie — SCANOSS support platform.
 *
 * Structure follows key.scanoss.dev (panels, pills, gradient accents, the same
 * type scale) so the two SCANOSS tools feel related. The palette is sampled
 * directly from the Donkie mascot:
 *   violet #6C4CF5 (body) · light violet #AA8EFC (muzzle)
 *   deep indigo #241C4D (outlines) · orange #F1803C (hooves & mane)
 *   off-white #FCFCFA · grey #D9D8DE
 *
 * Deliberate rule: mascot orange is a BRAND accent only. Ticket status and
 * urgency use the separate --st-* ramp below, because Shark reserves red for
 * Urgent and a brand colour doubling as a status colour makes both ambiguous.
 */

:root {
  /* ---- Brand, from the mascot ---- */
  --violet: #6c4cf5;
  --violet-light: #aa8efc;
  --violet-deep: #4731a1;
  --ink: #241c4d;
  --orange: #f1803c;
  --paper: #fcfcfa;
  --grey: #d9d8de;

  /* ---- Dark surfaces, derived from the mascot's outline indigo ---- */
  --bg: #14102b;
  --bg2: #1d1740;
  --panel: rgba(255, 255, 255, 0.04);
  --panel-border: rgba(170, 142, 252, 0.16);
  --panel-hover: rgba(255, 255, 255, 0.07);
  --text: #ecebf8;
  --text-dim: #c6c1e2;
  --muted: #9791b8;

  --grad: linear-gradient(105deg, #6c4cf5 0%, #8b6bff 55%, #aa8efc 110%);
  --grad-warm: linear-gradient(105deg, #6c4cf5 0%, #f1803c 130%);

  /* ---- Semantic status ramp: independent of the brand palette ---- */
  --st-onteam: #7d5cff;   /* Open / Pending — the ball is with us */
  --st-offteam: #4a9fd5;  /* Waiting on Customer / Third Party */
  --st-hold: #8e88ab;     /* On Hold / Under Development */
  --st-done: #35c88a;     /* Resolved / Closed */
  --st-urgent: #e4443c;   /* Urgent only, per Shark's colour rules */
  --warn: #e8a33d;

  --radius: 16px;
  --radius-sm: 10px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

/* Ambient glow, echoing keydrop but in Donkie's violets with a warm hoof-orange
   accent at the bottom. */
.bg-glow {
  position: fixed; inset: 0; z-index: -1; overflow: hidden;
  background:
    radial-gradient(60% 50% at 12% 0%, rgba(108, 76, 245, 0.28), transparent 70%),
    radial-gradient(55% 45% at 92% 8%, rgba(170, 142, 252, 0.16), transparent 70%),
    radial-gradient(45% 55% at 50% 112%, rgba(241, 128, 60, 0.10), transparent 70%),
    var(--bg);
}

a { color: var(--violet-light); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.15; letter-spacing: -0.02em; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.mono { font-family: var(--mono); }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }
.grad {
  background: var(--grad); -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}

/* ---- Header / footer ---- */
.site-header {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 28px; max-width: 1440px; margin: 0 auto; width: 100%;
  border-bottom: 1px solid var(--panel-border);
}
.brand { display: flex; align-items: center; gap: 11px; font-weight: 700; font-size: 1.15rem; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand img { display: block; height: 38px; width: auto; }
.brand .sub { font-weight: 400; font-size: .82rem; color: var(--muted); letter-spacing: .04em; }
.nav { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.nav a.navlink {
  color: var(--text-dim); padding: 7px 13px; border-radius: 9px; font-size: .93rem; font-weight: 500;
}
.nav a.navlink:hover { background: var(--panel-hover); text-decoration: none; color: var(--text); }
.nav a.navlink.active { background: rgba(108, 76, 245, .22); color: #fff; }
.who { color: var(--muted); font-size: .88rem; }
.inline { display: inline; margin: 0; }
.site-main { flex: 1; width: 100%; max-width: 1440px; margin: 0 auto; padding: 22px 28px 60px; }
.site-footer {
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  max-width: 1440px; margin: 0 auto; width: 100%; padding: 20px 28px;
  border-top: 1px solid var(--panel-border); color: var(--muted); font-size: .84rem;
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  font: inherit; font-weight: 600; cursor: pointer; border: 0;
  padding: 10px 17px; border-radius: var(--radius-sm); color: #fff;
  transition: transform .08s ease, filter .15s ease, background .15s;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .55; cursor: default; }
.btn-primary { background: var(--grad); box-shadow: 0 6px 22px rgba(108, 76, 245, .34); }
.btn-primary:hover { filter: brightness(1.09); }
/* Orange reserved for the single most important action on a page. */
.btn-accent { background: var(--orange); box-shadow: 0 6px 22px rgba(241, 128, 60, .3); }
.btn-accent:hover { filter: brightness(1.07); }
.btn-ghost { background: rgba(255,255,255,.06); border: 1px solid var(--panel-border); }
.btn-ghost:hover { background: var(--panel-hover); }
.btn-lg { padding: 14px 26px; font-size: 1.05rem; }
.btn-sm { padding: 6px 12px; font-size: .85rem; }

.pill {
  display: inline-block; font-size: .72rem; letter-spacing: .12em; text-transform: uppercase;
  color: var(--violet-light); background: rgba(108, 76, 245, .13);
  border: 1px solid rgba(170, 142, 252, .3);
  padding: 5px 12px; border-radius: 999px; font-weight: 600;
}

/* ---- Panels ---- */
.panel {
  background: var(--panel); border: 1px solid var(--panel-border);
  border-radius: var(--radius); padding: 22px; backdrop-filter: blur(6px);
}
.panel > h2 { margin: 0 0 14px; font-size: 1.15rem; }
.panel-tight { padding: 0; overflow: hidden; }
.panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 16px 22px; border-bottom: 1px solid var(--panel-border); flex-wrap: wrap;
}
.panel-head h2 { margin: 0; font-size: 1.1rem; }

.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }

/* ---- Stat tiles ---- */
.stats { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.stat {
  background: var(--panel); border: 1px solid var(--panel-border);
  border-radius: var(--radius-sm); padding: 16px 18px;
}
.stat .n { font-size: 1.9rem; font-weight: 700; line-height: 1.1; letter-spacing: -.02em; }
.stat .k { font-size: .8rem; color: var(--muted); text-transform: uppercase; letter-spacing: .07em; margin-top: 3px; }
.stat.is-urgent .n { color: var(--st-urgent); }
.stat.is-onteam .n { color: var(--st-onteam); }
.stat.is-offteam .n { color: var(--st-offteam); }

/* ---- Tables ---- */
.table-wrap { overflow-x: auto; }
table.tickets { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.tickets th {
  text-align: left; color: var(--muted); font-weight: 600; font-size: .74rem;
  text-transform: uppercase; letter-spacing: .07em; padding: 10px 14px;
  border-bottom: 1px solid var(--panel-border); white-space: nowrap;
}
table.tickets td { padding: 11px 14px; border-bottom: 1px solid rgba(255,255,255,.05); vertical-align: top; }
table.tickets tbody tr:hover { background: rgba(255,255,255,.035); }
table.tickets td.id { font-family: var(--mono); font-size: .86rem; white-space: nowrap; }
table.tickets td.subj { min-width: 260px; max-width: 460px; }
table.tickets td.subj a { color: var(--text); font-weight: 600; }
table.tickets td.subj a:hover { color: var(--violet-light); }
table.tickets td.subj .meta { color: var(--muted); font-size: .82rem; margin-top: 2px; }
.empty { color: var(--muted); padding: 26px 22px; text-align: center; }

/* ---- Status indicators ----
   A square swatch mirrors Shark's status square so the web view and the Teams
   report are read the same way. */
.sq { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 7px; vertical-align: baseline; }
.sq-onteam { background: var(--st-onteam); }
.sq-offteam { background: var(--st-offteam); }
.sq-hold { background: var(--st-hold); }
.sq-done { background: var(--st-done); }
.sq-urgent { background: var(--st-urgent); box-shadow: 0 0 8px rgba(228,68,60,.7); }

.badge {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: .76rem; font-weight: 600; white-space: nowrap;
}
.badge-onteam { background: rgba(125,92,255,.16); color: #b9a5ff; border: 1px solid rgba(125,92,255,.34); }
.badge-offteam { background: rgba(74,159,213,.15); color: #8fd0f2; border: 1px solid rgba(74,159,213,.34); }
.badge-hold { background: rgba(142,136,171,.15); color: #b6b1ca; border: 1px solid rgba(142,136,171,.3); }
.badge-done { background: rgba(53,200,138,.14); color: #6fdcaa; border: 1px solid rgba(53,200,138,.32); }
.badge-urgent { background: rgba(228,68,60,.16); color: #ff9a94; border: 1px solid rgba(228,68,60,.4); }
.badge-approx {
  background: rgba(232,163,61,.13); color: var(--warn); border: 1px solid rgba(232,163,61,.32);
}

/* ---- Filter bar ---- */
.filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.filters .tab {
  padding: 7px 14px; border-radius: 999px; font-size: .88rem; font-weight: 600;
  color: var(--text-dim); border: 1px solid var(--panel-border); background: transparent;
}
.filters .tab:hover { background: var(--panel-hover); text-decoration: none; }
.filters .tab.active { background: var(--grad); color: #fff; border-color: transparent; }

input[type=text], input[type=search], textarea, select {
  width: 100%; font: inherit; color: var(--text);
  background: rgba(0,0,0,.3); border: 1px solid var(--panel-border);
  border-radius: var(--radius-sm); padding: 10px 13px; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--violet); box-shadow: 0 0 0 3px rgba(108,76,245,.22);
}
.search-form { display: flex; gap: 8px; min-width: 260px; flex: 1; max-width: 420px; }

/* ---- Landing / sign-in ----
   The mascot sits beside the sign-in form as part of the card, so Donkie is
   the first thing you meet rather than a banner above the real content. */
.login-wrap { max-width: 900px; margin: 0 auto; padding: 34px 0; }
.login-card {
  display: flex; align-items: center; gap: 36px; flex-wrap: wrap;
  justify-content: center; text-align: left;
  background: var(--panel); border: 1px solid var(--panel-border);
  border-radius: 22px; padding: 38px 40px; backdrop-filter: blur(6px);
}
.login-mascot {
  width: 210px; height: auto; flex: 0 0 auto;
  filter: drop-shadow(0 16px 40px rgba(108, 76, 245, .5));
}
.login-form { flex: 1; min-width: 280px; }
.login-form h1 { font-size: clamp(1.8rem, 4.4vw, 2.7rem); margin: 12px 0 12px; }
.login-btn { margin-top: 6px; }
.login-note { margin: 12px 0 0; }
.login-features { max-width: 620px; margin: 30px auto 0; }
.lede { font-size: 1.06rem; color: var(--text-dim); margin: 0 0 22px; }

@media (max-width: 720px) {
  .login-card { flex-direction: column; text-align: center; gap: 20px; padding: 30px 24px; }
  .login-mascot { width: 148px; }
  .login-features { text-align: left; }
}
.features { list-style: none; padding: 0; margin: 32px 0 0; display: grid; gap: 11px; text-align: left; }
.features li { padding-left: 26px; position: relative; color: var(--text-dim); }
.features li::before { content: "✓"; position: absolute; left: 0; color: var(--violet-light); font-weight: 700; }

/* ---- Ticket detail ---- */
.ticket-head { display: flex; justify-content: space-between; gap: 18px; flex-wrap: wrap; align-items: flex-start; }
.ticket-head h1 { font-size: 1.5rem; margin: 0 0 8px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 7px 16px; font-size: .9rem; align-items: baseline; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

.thread { display: grid; gap: 14px; }
.msg { border: 1px solid var(--panel-border); border-radius: var(--radius-sm); padding: 14px 16px; background: var(--panel); }
/* Private notes are visually unmistakable — sending one to a customer by
   mistake is the expensive error in a support tool. */
.msg.is-private { background: rgba(232,163,61,.06); border-color: rgba(232,163,61,.3); border-left: 3px solid var(--warn); }
.msg.is-incoming { border-left: 3px solid var(--st-offteam); }
.msg.is-outgoing { border-left: 3px solid var(--violet); }
.msg-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: .86rem; margin-bottom: 9px; }
.msg-who { font-weight: 600; }
.msg-body { font-size: .93rem; overflow-wrap: anywhere; }
.msg-body img { max-width: 100%; height: auto; }
.msg-body blockquote { border-left: 2px solid var(--panel-border); margin-left: 0; padding-left: 12px; color: var(--muted); }

.timeline { list-style: none; padding: 0; margin: 0; font-size: .88rem; }
.timeline li { padding: 7px 0 7px 16px; border-left: 2px solid var(--panel-border); position: relative; }
.timeline li::before {
  content: ""; position: absolute; left: -5px; top: 14px; width: 8px; height: 8px;
  border-radius: 50%; background: var(--violet);
}
.timeline .when { color: var(--muted); }

.notice { margin: 16px 0; padding: 13px 15px; border-radius: var(--radius-sm);
  background: rgba(232,163,61,.08); border: 1px solid rgba(232,163,61,.28); color: var(--warn); font-size: .9rem; }

/* ---- "Donkie says" callouts ----
   The mascot appears throughout the interface, not just at sign-in: alert
   boxes, empty states and inline explanations. Tone drives the accent colour,
   which is why the brand orange is NOT used for warnings — it would collide
   with the status ramp. */
.donkie-says {
  display: flex; align-items: flex-start; gap: 16px;
  padding: 18px 20px; border-radius: var(--radius);
  background: var(--panel); border: 1px solid var(--panel-border);
  border-left: 3px solid var(--violet);
}
.donkie-says-mascot {
  width: 62px; height: auto; flex: 0 0 auto; margin-top: -2px;
  filter: drop-shadow(0 5px 14px rgba(108, 76, 245, .35));
}
.donkie-says.is-small { padding: 13px 15px; gap: 12px; }
.donkie-says.is-small .donkie-says-mascot { width: 40px; }
.donkie-says-body { flex: 1; min-width: 0; font-size: .93rem; color: var(--text-dim); }
.donkie-says-body b { color: var(--text); display: block; margin-bottom: 3px; }
.donkie-says-body p { margin: 0; }
.donkie-says-body p + p { margin-top: 8px; }

.donkie-says.tone-warn {
  border-left-color: var(--warn); background: rgba(232, 163, 61, .07);
  border-color: rgba(232, 163, 61, .26);
}
.donkie-says.tone-urgent {
  border-left-color: var(--st-urgent); background: rgba(228, 68, 60, .07);
  border-color: rgba(228, 68, 60, .28);
}
.donkie-says.tone-success {
  border-left-color: var(--st-done); background: rgba(53, 200, 138, .07);
  border-color: rgba(53, 200, 138, .26);
}

/* Empty states: give the mascot room to be the focus. */
.empty-state { text-align: center; padding: 44px 22px; }
.empty-state img { width: 108px; height: auto; opacity: .92; margin-bottom: 14px;
  filter: drop-shadow(0 10px 26px rgba(108, 76, 245, .35)); }
.empty-state h3 { margin: 0 0 6px; font-size: 1.1rem; }
.empty-state p { margin: 0 auto; color: var(--muted); max-width: 420px; font-size: .93rem; }

/* ---- Responsive ---- */
@media (max-width: 860px) {
  .site-header { padding: 12px 16px; }
  .site-main { padding: 16px 16px 48px; }
  .site-footer { padding: 16px; }
  .brand .sub { display: none; }
  .stat .n { font-size: 1.55rem; }
  /* Hide lower-priority columns rather than letting the table scroll off. */
  table.tickets th.opt, table.tickets td.opt { display: none; }
}
@media (max-width: 560px) {
  .nav a.navlink { padding: 6px 9px; font-size: .88rem; }
  .who { display: none; }
}

/* Respect reduced-motion preferences. */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ---- Shark report blocks ----
   Rendered monospace and preserved verbatim, because the text IS the
   deliverable — what you see is exactly what gets pasted into Teams. */
.shark-block {
  font-family: var(--mono); font-size: .86rem; white-space: pre-wrap;
  overflow-wrap: anywhere; margin: 0 0 14px; padding: 13px 15px;
  background: rgba(0, 0, 0, .26); border: 1px solid var(--panel-border);
  border-left: 3px solid var(--violet); border-radius: var(--radius-sm);
}
.shark-block.is-due { border-left-color: var(--st-urgent); background: rgba(228, 68, 60, .06); }
.shark-raw {
  font-family: var(--mono); font-size: .82rem; white-space: pre-wrap;
  overflow-wrap: anywhere; margin: 0; padding: 15px;
  background: rgba(0, 0, 0, .34); border: 1px solid var(--panel-border);
  border-radius: var(--radius-sm); max-height: 460px; overflow-y: auto;
}
