/* ============================================================================
   support365 helpdesk — visual system
   ----------------------------------------------------------------------------
   Bright, high-contrast, and deliberately energetic. Every colour is a hex
   value declared once here, so the whole interface can be re-themed from the
   :root block without touching a single component.

   Written direction-agnostic throughout: logical properties (inline-start,
   margin-inline, padding-inline) do the work, so the entire layout mirrors for
   Arabic with no second stylesheet and no per-element overrides.

   Motion is used to explain change — a row arriving, a ticket landing, a value
   saving — never for decoration alone, and all of it yields to
   prefers-reduced-motion at the bottom of this file.
   ========================================================================= */

:root {
  /* ---- brand ---------------------------------------------------------- */
  --indigo:        #4f46e5;
  --indigo-deep:   #4338ca;
  --violet:        #7c3aed;
  --sky:           #0ea5e9;
  --cyan:          #06b6d4;

  --grad-brand:    linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  --grad-brand-hi: linear-gradient(135deg, #4338ca 0%, #6d28d9 100%);
  --grad-sky:      linear-gradient(135deg, #0ea5e9 0%, #6366f1 100%);
  --grad-warm:     linear-gradient(135deg, #f97316 0%, #ef4444 100%);
  --grad-mint:     linear-gradient(135deg, #10b981 0%, #06b6d4 100%);

  /* ---- status --------------------------------------------------------- */
  --blue:          #2563eb;  --blue-wash:   #eff6ff;
  --amber:         #d97706;  --amber-wash:  #fffbeb;
  --green:         #059669;  --green-wash:  #ecfdf5;
  --red:           #dc2626;  --red-wash:    #fef2f2;
  --slate:         #64748b;  --slate-wash:  #f1f5f9;
  --orange:        #ea580c;  --orange-wash: #fff7ed;

  /* ---- surfaces ------------------------------------------------------- */
  --bg:            #f6f7fc;
  --surface:       #ffffff;
  --surface-2:     #fafbff;
  --surface-3:     #f3f4fb;
  --border:        #e6e8f3;
  --border-firm:   #cdd2e6;

  /* ---- ink ------------------------------------------------------------ */
  --text:          #14162b;
  --text-soft:     #4a5070;
  --text-faint:    #8b91b0;

  /* ---- shape ---------------------------------------------------------- */
  --r-sm:  9px;
  --r:     14px;
  --r-lg:  20px;
  --r-pill: 999px;

  /* ---- depth: layered rather than one flat blur ----------------------- */
  --sh-1: 0 1px 2px rgba(20,22,43,.05), 0 1px 3px rgba(20,22,43,.04);
  --sh-2: 0 2px 4px rgba(20,22,43,.05), 0 8px 20px rgba(20,22,43,.06);
  --sh-3: 0 4px 8px rgba(20,22,43,.06), 0 18px 40px rgba(20,22,43,.10);
  --sh-brand: 0 4px 14px rgba(79,70,229,.28), 0 2px 4px rgba(79,70,229,.18);

  --ease: cubic-bezier(.4, 0, .2, 1);
  --ease-out-back: cubic-bezier(.34, 1.56, .64, 1);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;   /* wide content scrolls inside its own box, never the page */
  color: var(--text);
  background: var(--bg);
  font: 15px/1.65 system-ui, -apple-system, "Segoe UI", Tahoma, "Noto Naskh Arabic", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* A pair of soft colour washes behind everything. Fixed, so they never move
   while scrolling and never cost a repaint. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(58rem 30rem at 82% -8%, rgba(124,58,237,.10), transparent 60%),
    radial-gradient(48rem 26rem at 6% 4%,  rgba(14,165,233,.10), transparent 62%);
  pointer-events: none;
}

a { color: var(--indigo); text-decoration: none; transition: color .15s var(--ease); }
a:hover { color: var(--violet); }

::selection { background: rgba(124,58,237,.18); }

/* ============================================================ animations */

@keyframes rise      { from { opacity:0; transform: translateY(10px); } to { opacity:1; transform:none; } }
@keyframes fade      { from { opacity:0; } to { opacity:1; } }
@keyframes pop       { 0% { transform: scale(.7); opacity:0; } 60% { transform: scale(1.12); } 100% { transform: scale(1); opacity:1; } }
@keyframes slideEnd  { from { opacity:0; transform: translateX(24px); } to { opacity:1; transform:none; } }
@keyframes glowRing  { 0%,100% { box-shadow: 0 0 0 0 rgba(79,70,229,.34); } 50% { box-shadow: 0 0 0 8px rgba(79,70,229,0); } }
@keyframes shimmer   { from { background-position: -420px 0; } to { background-position: 420px 0; } }
@keyframes sweep     { from { transform: translateX(-130%) skewX(-18deg); } to { transform: translateX(230%) skewX(-18deg); } }
@keyframes spin      { to { transform: rotate(360deg); } }
@keyframes bellRing  { 0%,100% { transform: rotate(0); } 15% { transform: rotate(13deg); } 30% { transform: rotate(-11deg); } 45% { transform: rotate(7deg); } 60% { transform: rotate(-5deg); } }

/* ================================================================ topbar */

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255,255,255,.86);
  backdrop-filter: saturate(1.7) blur(14px);
  -webkit-backdrop-filter: saturate(1.7) blur(14px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 22px;
  height: 64px;
  display: flex;
  align-items: center;
  gap: 20px;
}

.brand { display: flex; align-items: center; gap: 11px; font-weight: 750; font-size: 16px; color: var(--text); white-space: nowrap; }
.brand:hover { color: var(--text); }
.brand-mark {
  width: 34px; height: 34px;
  border-radius: 11px;
  box-shadow: var(--sh-brand);
  display: block;
  object-fit: cover;
  transition: transform .35s var(--ease-out-back);
}
.brand:hover .brand-mark { transform: rotate(-8deg) scale(1.06); }

.topbar nav { display: flex; gap: 3px; }
.topbar nav a {
  position: relative;
  padding: 8px 15px;
  border-radius: var(--r-sm);
  color: var(--text-soft);
  font-weight: 550;
  transition: color .18s var(--ease), background .18s var(--ease);
}
.topbar nav a:hover { color: var(--indigo); background: var(--surface-3); }
.topbar nav a.active { color: var(--indigo); background: var(--blue-wash); }
.topbar nav a.active::after {
  content: "";
  position: absolute;
  inset-inline: 15px;
  bottom: 3px;
  height: 2px;
  border-radius: 2px;
  background: var(--grad-brand);
  animation: fade .3s var(--ease);
}
.topbar .spacer { flex: 1; }

.wrap { max-width: 1200px; margin: 0 auto; padding: 26px 22px 72px; animation: rise .4s var(--ease) both; }

.page-head { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; flex-wrap: wrap; }
/* Solid, not a gradient. A gradient across a short heading reads as a glitch
   rather than an effect - and worse in Arabic, where the gradient runs in
   physical space and so cuts against the direction the word is read in. */
.page-head h1 {
  margin: 0;
  font-size: 24px;
  font-weight: 780;
  letter-spacing: -.02em;
  color: var(--text);
}
.count-chip {
  padding: 3px 11px;
  border-radius: var(--r-pill);
  background: var(--blue-wash);
  color: var(--indigo);
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* ================================================================= cards */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: var(--sh-1);
  transition: box-shadow .25s var(--ease), transform .25s var(--ease);
}
.card:hover { box-shadow: var(--sh-2); }
.card-pad { padding: 20px 22px; }
.card + .card { margin-top: 16px; }

/* ================================================================= forms */

label { display: block; font-weight: 620; font-size: 13px; margin-bottom: 7px; color: var(--text-soft); }
.hint { font-size: 12.5px; color: var(--text-faint); margin-top: 6px; line-height: 1.5; }

input[type=text], input[type=tel], input[type=email], input[type=password],
input[type=number], input[type=color], select, textarea {
  width: 100%;
  padding: 11px 13px;
  border: 1.5px solid var(--border-firm);
  border-radius: var(--r-sm);
  background: var(--surface);
  font: inherit;
  color: var(--text);
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease), background .18s var(--ease);
}
input:hover:not(:focus), select:hover:not(:focus), textarea:hover:not(:focus) { border-color: #aeb5d4; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--indigo);
  background: var(--surface);
  box-shadow: 0 0 0 4px rgba(79,70,229,.13);
}
input[readonly] { background: var(--surface-3); cursor: pointer; }
textarea { resize: vertical; min-height: 118px; line-height: 1.6; }

input[type=checkbox] {
  width: 17px; height: 17px;
  accent-color: var(--indigo);
  vertical-align: -3px;
  cursor: pointer;
}

.field { margin-bottom: 16px; }
.row { display: flex; gap: 14px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 170px; }

/* =============================================================== buttons */

.btn {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 19px;
  border: 0;
  border-radius: var(--r-sm);
  background: var(--grad-brand);
  color: #fff;
  font: inherit;
  font-weight: 640;
  cursor: pointer;
  box-shadow: var(--sh-brand);
  transition: transform .18s var(--ease), box-shadow .22s var(--ease), filter .18s var(--ease);
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(79,70,229,.36); filter: saturate(1.08); }
.btn:active { transform: translateY(0) scale(.985); }

/* A light sweeps across the button on hover. Purely a polish detail, and it
   sits behind the label so it can never obscure the text. */
.btn::after {
  content: "";
  position: absolute;
  top: 0; bottom: 0; left: 0;
  width: 45%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.4), transparent);
  transform: translateX(-130%) skewX(-18deg);
  pointer-events: none;
}
.btn:hover::after { animation: sweep .75s var(--ease); }

.btn[disabled] { opacity: .6; cursor: not-allowed; transform: none; box-shadow: var(--sh-1); }
.btn[disabled]::after { animation: none; }

.btn-ghost {
  background: var(--surface);
  color: var(--text-soft);
  border: 1.5px solid var(--border-firm);
  box-shadow: var(--sh-1);
}
.btn-ghost:hover { color: var(--indigo); border-color: var(--indigo); background: var(--blue-wash); box-shadow: var(--sh-2); }

.btn-danger { background: var(--grad-warm); box-shadow: 0 4px 14px rgba(239,68,68,.3); }
.btn-danger:hover { box-shadow: 0 8px 22px rgba(239,68,68,.38); }

.btn-sm { padding: 7px 13px; font-size: 13.5px; border-radius: 8px; }
.btn-block { width: 100%; }

/* ================================================================= pills */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  border-radius: var(--r-pill);
  font-size: 12.5px;
  font-weight: 650;
  line-height: 1.6;
  white-space: nowrap;
  border: 1px solid transparent;
}
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.pill .dot { box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 18%, transparent); }

.pill-trash {
  background: var(--red-wash);
  color: var(--red);
  border-color: #fca5a5;
  font-size: 11.5px;
  padding: 2px 9px;
  margin-inline-start: 6px;
  vertical-align: middle;
}

.pill-hidden {
  background: var(--slate-wash);
  color: var(--slate);
  border-color: var(--border-firm);
  font-size: 11.5px;
  padding: 2px 9px;
  margin-inline-start: 6px;
  vertical-align: middle;
}

/* ================================================== selection & hiding */

.sel-cell { width: 44px; text-align: center; padding-inline: 0 !important; }

.sel-cell input {
  width: 17px;
  height: 17px;
  accent-color: var(--indigo);
  cursor: pointer;
  vertical-align: middle;
}

/* A hidden ticket is still perfectly readable for the admin looking at it -
   dimmed enough to read as "not part of the queue", not so far that the text
   becomes hard work. The stripe carries the meaning; the fade only supports it. */
.is-hidden-ticket > td { background: repeating-linear-gradient(
    135deg, transparent 0 9px, rgba(100,116,139,.055) 9px 18px); }
.is-hidden-ticket .subject-cell > *:first-child,
.is-hidden-ticket .ref-cell { opacity: .68; }

.bulk-bar {
  position: sticky;
  bottom: 16px;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  padding: 11px 16px;
  border-radius: var(--r-pill);
  background: var(--surface);
  border: 1px solid var(--border-firm);
  box-shadow: var(--sh-3, var(--sh-2));
  animation: bulk-rise .18s ease-out;
}
.bulk-bar[hidden] { display: none; }

.bulk-count { font-weight: 700; font-size: 14px; color: var(--text); }

/* ============================================================== the credit */

.site-credit {
  text-align: center;
  padding: 26px 16px 34px;
  font-size: 12.5px;
  letter-spacing: .01em;
  color: var(--text-faint);
}

/* Legible on hover without ever demanding attention. */
.site-credit:hover { color: var(--text-soft); }

/* ================================================== ageing, unfinished work */

/* Overrides .muted on the same cell, which is the point: an old ticket should
   stop looking like quiet background information. */
.table td.age-warn { color: var(--amber); font-weight: 700; }
.table td.age-late { color: var(--red);   font-weight: 700; }

.age-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  margin-inline-end: 6px;
  vertical-align: middle;
  box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 18%, transparent);
}

/* Only the oldest pulse, so the animation means "this one" rather than
   decorating the whole column. */
.table td.age-late .age-dot { animation: age-pulse 2.4s ease-in-out infinite; }

@keyframes age-pulse {
  0%, 100% { box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 18%, transparent); }
  50%      { box-shadow: 0 0 0 6px color-mix(in srgb, currentColor 6%, transparent); }
}

@keyframes bulk-rise {
  from { transform: translateY(10px); opacity: 0; }
  to   { transform: none; opacity: 1; }
}

/* ================================================================ tables */

.table { width: 100%; border-collapse: separate; border-spacing: 0; }
.table th {
  /* Sticks to the top of .table-scroll, which is its containing scroll box.
     It must be 0 and not the topbar's height: an offset here is measured from
     that container, not the viewport, so any other value opens a gap above the
     header and hides the first row behind it. */
  position: sticky; top: 0;
  text-align: start;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-faint);
  font-weight: 720;
  padding: 12px 16px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  z-index: 2;
}
.table td { padding: 14px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }

.table tbody tr {
  transition: background .16s var(--ease), transform .16s var(--ease);
  animation: rise .38s var(--ease) both;
}
.table tbody tr:hover { background: linear-gradient(90deg, var(--blue-wash), transparent); }
.table tbody tr:hover .subject-cell { color: var(--indigo); }

/* Staggered entrance. Capped at a dozen rows: beyond that the delay would be
   longer than anyone is willing to wait to read their own queue. */
.table tbody tr:nth-child(1)  { animation-delay: .02s }
.table tbody tr:nth-child(2)  { animation-delay: .05s }
.table tbody tr:nth-child(3)  { animation-delay: .08s }
.table tbody tr:nth-child(4)  { animation-delay: .11s }
.table tbody tr:nth-child(5)  { animation-delay: .14s }
.table tbody tr:nth-child(6)  { animation-delay: .17s }
.table tbody tr:nth-child(7)  { animation-delay: .20s }
.table tbody tr:nth-child(8)  { animation-delay: .23s }
.table tbody tr:nth-child(9)  { animation-delay: .26s }
.table tbody tr:nth-child(10) { animation-delay: .29s }
.table tbody tr:nth-child(n+11) { animation-delay: .32s }

.table-scroll { overflow-x: auto; border-radius: var(--r); }

.subject-cell { font-weight: 640; transition: color .16s var(--ease); }
.subject-cell small { display: block; font-weight: 400; color: var(--text-faint); font-size: 12.5px; margin-top: 3px; }
.ref-cell { font-variant-numeric: tabular-nums; color: var(--text-faint); font-weight: 680; }

/* A ticket that landed in the last few minutes, so the eye finds it first. */
tr.is-fresh { background: linear-gradient(90deg, rgba(79,70,229,.07), transparent 70%); }
tr.is-fresh .ref-cell { color: var(--indigo); }
.fresh-dot {
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--grad-brand);
  margin-inline-end: 7px;
  vertical-align: 1px;
  animation: glowRing 2.4s var(--ease) infinite;
}

/* ================================================================== tabs */

.tabs {
  display: inline-flex;
  gap: 3px;
  padding: 4px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: 11px;
}
.tabs a, .tabs button {
  padding: 7px 15px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-soft);
  font: inherit;
  font-weight: 570;
  cursor: pointer;
  transition: all .18s var(--ease);
}
.tabs a:hover, .tabs button:hover { color: var(--indigo); background: rgba(255,255,255,.75); }
.tabs a.active, .tabs button.active {
  background: var(--grad-brand);
  color: #fff;
  font-weight: 650;
  box-shadow: var(--sh-brand);
}

/* ================================================================ thread */

.msg {
  border: 1px solid var(--border);
  border-radius: var(--r);
  margin-bottom: 15px;
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--sh-1);
  animation: rise .4s var(--ease) both;
  transition: box-shadow .25s var(--ease);
}
.msg:hover { box-shadow: var(--sh-2); }
.msg-head {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 17px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
  flex-wrap: wrap;
}
.msg-who { font-weight: 700; }
.msg-when { color: var(--text-faint); font-size: 12.5px; }
.msg-body { padding: 17px; overflow-x: auto; }
.msg-body pre { white-space: pre-wrap; word-wrap: break-word; font: inherit; margin: 0; }
.msg-body img { max-width: 100%; height: auto; border-radius: 10px; }
.msg-body table { max-width: 100%; }
.msg-body a { text-decoration: underline; }

.msg.internal { border-color: #fcd77d; background: var(--amber-wash); }
.msg.internal .msg-head { background: #fef3c7; border-bottom-color: #fcd77d; }
.msg.system { border-style: dashed; background: transparent; box-shadow: none; }
.msg.system .msg-body { color: var(--text-faint); font-size: 13px; padding: 10px 17px; }

.attach-list { display: flex; flex-wrap: wrap; gap: 9px; padding: 0 17px 16px; }
.attach {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 13px;
  border: 1.5px solid var(--border-firm);
  border-radius: var(--r-sm);
  background: var(--surface);
  font-size: 13px;
  color: var(--text-soft);
  transition: all .18s var(--ease);
}
.attach:hover {
  border-color: var(--indigo);
  color: var(--indigo);
  background: var(--blue-wash);
  transform: translateY(-2px);
  box-shadow: var(--sh-2);
}
.attach b { font-weight: 620; }
.attach small { color: var(--text-faint); }

/* =============================================================== sidebar */

.split { display: grid; grid-template-columns: minmax(0,1fr) 312px; gap: 18px; align-items: start; }

/* minmax(0,1fr), never a bare 1fr. A grid item's default min-width is auto, so
   a plain 1fr lets a wide table push the whole page sideways instead of
   shrinking - the body must never scroll horizontally. */
@media (max-width: 940px) { .split { grid-template-columns: minmax(0,1fr); } }
.split > * { min-width: 0; }

.meta-row {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
}
.meta-row:last-child { border-bottom: 0; }
.meta-row span:first-child { color: var(--text-faint); }
.meta-row span:last-child { font-weight: 620; text-align: end; }

/* ================================================================ alerts */

.alert {
  padding: 13px 16px;
  border-radius: var(--r-sm);
  margin-bottom: 17px;
  font-size: 14px;
  border: 1px solid;
  border-inline-start-width: 4px;
  animation: rise .32s var(--ease) both;
}
.alert-ok   { background: var(--green-wash); border-color: #6ee7b7; color: #047857; }
.alert-err  { background: var(--red-wash);   border-color: #fca5a5; color: #b91c1c; }
.alert-info { background: var(--blue-wash);  border-color: #93c5fd; color: var(--indigo-deep); }

.empty { text-align: center; padding: 56px 22px 64px; color: var(--text-faint); animation: fade .5s var(--ease) both; }
.empty svg { opacity: .3; margin-bottom: 14px; }
.empty-art {
  width: 190px; height: 190px;
  margin: 0 auto 6px;
  display: block;
  object-fit: contain;
  animation: rise .5s var(--ease) both;
}
.empty-title { font-size: 15.5px; font-weight: 640; color: var(--text-soft); margin-bottom: 4px; }

/* ========================================================= notifications */

.bell {
  position: relative;
  display: grid; place-items: center;
  width: 40px; height: 40px;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text-soft);
  cursor: pointer;
  transition: background .18s var(--ease), color .18s var(--ease);
}
.bell:hover { background: var(--surface-3); color: var(--indigo); }
.bell.has-new svg { animation: bellRing 1s var(--ease) 2; transform-origin: 50% 8%; }
.bell-count {
  position: absolute; top: 4px; inset-inline-end: 4px;
  min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: var(--r-pill);
  background: var(--grad-warm);
  color: #fff;
  font-size: 10.5px; font-weight: 750;
  display: grid; place-items: center;
  border: 2px solid var(--surface);
  animation: pop .3s var(--ease-out-back);
}
/* An author `display` beats the browser's own [hidden] rule, so without this
   the badge can never hide and sits there reading "0". */
.bell-count[hidden] { display: none; }

.dropdown {
  position: absolute; top: 56px; inset-inline-end: 22px;
  width: 358px; max-height: 440px; overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: var(--sh-3);
  z-index: 60;
  animation: rise .22s var(--ease) both;
}
.dropdown-head {
  position: sticky; top: 0;
  display: flex; justify-content: space-between; align-items: center;
  padding: 13px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  font-weight: 700; font-size: 14px;
}
.notif { display: block; padding: 13px 16px; border-bottom: 1px solid var(--border); color: var(--text); transition: background .16s var(--ease); }
.notif:last-child { border-bottom: 0; }
.notif:hover { background: var(--surface-2); color: var(--text); }
.notif.unread { background: linear-gradient(90deg, var(--blue-wash), transparent); border-inline-start: 3px solid var(--indigo); }
.notif b { display: block; font-size: 13.5px; margin-bottom: 3px; }
.notif p { margin: 0; font-size: 12.5px; color: var(--text-soft); white-space: pre-line; }
.notif time { font-size: 11.5px; color: var(--text-faint); }

/* ================================================== live arrival toast */

.toast-stack {
  position: fixed;
  bottom: 24px; inset-inline-end: 24px;
  z-index: 90;
  display: flex; flex-direction: column; gap: 10px;
  max-width: min(380px, calc(100vw - 48px));
}
.toast {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 14px 16px;
  border-radius: var(--r);
  background: var(--surface);
  border: 1px solid var(--border);
  border-inline-start: 4px solid transparent;
  border-image: var(--grad-brand) 1;
  box-shadow: var(--sh-3);
  animation: slideEnd .4s var(--ease-out-back) both;
  cursor: pointer;
}
.toast.leaving { animation: fade .3s var(--ease) reverse both; }
.toast-icon {
  flex: none;
  width: 36px; height: 36px;
  border-radius: 11px;
  background: var(--grad-brand);
  color: #fff;
  display: grid; place-items: center;
  box-shadow: var(--sh-brand);
}
.toast-body { min-width: 0; }
.toast-body b { display: block; font-size: 13.5px; font-weight: 700; margin-bottom: 2px; }
.toast-body span { display: block; font-size: 12.5px; color: var(--text-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ================================================================= login */

/* The artwork is layered UNDER the same gradients that were here before, so if
   the image ever fails to load the screen still looks deliberate rather than
   blank. It is 43 KB, which is the only reason it is allowed on a login page. */
.login-shell {
  min-height: 100vh;
  display: grid; place-items: center;
  padding: 24px;
  background:
    radial-gradient(46rem 26rem at 78% 6%,  rgba(124,58,237,.14), transparent 62%),
    radial-gradient(42rem 24rem at 12% 92%, rgba(14,165,233,.14), transparent 62%),
    url("img/login-bg.jpg") center / cover no-repeat,
    #f6f7fc;
}
.login-card {
  width: 100%; max-width: 412px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-3);
  padding: 36px 30px;
  animation: rise .45s var(--ease-out-back) both;
}
.login-card h1 { font-size: 22px; margin: 0 0 7px; text-align: center; font-weight: 760; letter-spacing: -.015em; }
.login-card .sub { text-align: center; color: var(--text-soft); font-size: 14px; margin: 0 0 26px; }
.login-logo {
  width: 64px; height: 64px;
  border-radius: 20px;
  display: block;
  object-fit: cover;
  margin: 0 auto 18px;
  box-shadow: var(--sh-brand);
  animation: pop .5s var(--ease-out-back) both;
}
.code-input {
  text-align: center;
  font-size: 28px;
  letter-spacing: .55em;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  text-indent: .55em;
  padding-block: 14px;
}
.login-foot { text-align: center; margin-top: 20px; font-size: 13.5px; }
.login-foot a { color: var(--text-soft); }
.login-foot a:hover { color: var(--indigo); }

/* =============================================================== reports */

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.kpi {
  position: relative;
  overflow: hidden;
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: var(--sh-1);
  animation: rise .4s var(--ease) both;
  transition: box-shadow .25s var(--ease), transform .25s var(--ease);
}
.kpi:hover { box-shadow: var(--sh-2); transform: translateY(-2px); }
.kpi:nth-child(2) { animation-delay: .05s }
.kpi:nth-child(3) { animation-delay: .10s }
.kpi:nth-child(4) { animation-delay: .15s }
.kpi:nth-child(5) { animation-delay: .20s }

/* The coloured edge is what separates the five figures at a glance. */
.kpi-accent { position: absolute; inset-block: 0; inset-inline-start: 0; width: 4px; }
.kpi-label  { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-faint); margin-bottom: 7px; }
.kpi-value  { display: block; font-size: 24px; font-weight: 760; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }

.bar-row { display: flex; align-items: center; gap: 11px; margin-bottom: 11px; font-size: 13.5px; }
.bar-row:last-child { margin-bottom: 0; }
.bar-label { flex: 0 0 34%; color: var(--text-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track {
  flex: 1;
  height: 9px;
  border-radius: var(--r-pill);
  background: var(--surface-3);
  overflow: hidden;
}
.bar-fill {
  display: block;
  height: 100%;
  border-radius: var(--r-pill);
  transform-origin: inline-start;
  animation: growBar .6s var(--ease) both;
}
@keyframes growBar { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.bar-value { flex: 0 0 auto; font-weight: 680; font-variant-numeric: tabular-nums; min-width: 26px; text-align: end; }

/* ================================================================= misc */

.lang-switch { display: flex; gap: 2px; padding: 3px; background: var(--surface-3); border: 1px solid var(--border); border-radius: 9px; }
.lang-switch a { padding: 5px 10px; border-radius: 6px; font-size: 12.5px; font-weight: 650; color: var(--text-faint); transition: all .18s var(--ease); }
.lang-switch a:hover { color: var(--indigo); }
.lang-switch a.active { background: var(--grad-brand); color: #fff; box-shadow: var(--sh-brand); }
.lang-switch a.active:hover { color: #fff; }

.muted { color: var(--text-faint); }
.nowrap { white-space: nowrap; }
.mt0 { margin-top: 0; } .mb0 { margin-bottom: 0; }
.flex { display: flex; align-items: center; gap: 10px; }
.flex-wrap { flex-wrap: wrap; }
.grow { flex: 1; }
.pagination { display: flex; gap: 9px; justify-content: center; margin-top: 24px; }

/* Loading shimmer, for anything waiting on the network. */
.skeleton {
  background: linear-gradient(90deg, var(--surface-3) 25%, #e9ebf6 50%, var(--surface-3) 75%);
  background-size: 420px 100%;
  animation: shimmer 1.3s linear infinite;
  border-radius: 6px;
  color: transparent !important;
}

.spinner {
  width: 15px; height: 15px;
  border: 2px solid rgba(255,255,255,.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .65s linear infinite;
}

/* Focus visible for keyboard users, without ringing every mouse click. */
:focus-visible { outline: 3px solid rgba(79,70,229,.45); outline-offset: 2px; border-radius: 4px; }

/* =========================================================== small screens */

@media (max-width: 720px) {
  .topbar-inner { height: 58px; padding: 0 14px; gap: 12px; }
  .brand span:last-child { display: none; }
  .wrap { padding: 20px 14px 56px; }
  .page-head h1 { font-size: 20px; }
  .dropdown { inset-inline: 12px auto; width: calc(100vw - 24px); }
  .toast-stack { inset-inline: 12px; bottom: 12px; max-width: none; }
}

/* ======================================== phones and iPad in portrait

   The ticket table is around 835px wide. On a phone that hides more than half
   of every row behind a sideways scroll, and the columns it hides - status,
   who owns it, how old it is - are exactly the ones someone checks on a phone.

   So below this width the table stops being a table: each row becomes a card
   with everything visible and nothing to scroll. 860px catches iPad portrait
   too, where the table would otherwise overflow by a little, which is worse
   than a lot because it looks like a rendering fault rather than a scroll.
   ========================================================================= */

@media (max-width: 860px) {

  /* Nothing may push the page sideways. */
  body { overflow-x: hidden; }
  .table-scroll { overflow-x: visible; }

  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table thead { display: none; }

  .table tr {
    position: relative;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
  }
  .table tr:last-child { border-bottom: 0; }

  .table td {
    padding: 0;
    border: 0;
    white-space: normal;
  }

  /* The reference sits above the subject rather than beside it. */
  .ref-cell {
    font-size: 12.5px;
    color: var(--text-faint);
    margin-bottom: 2px;
  }

  .subject-cell { font-size: 15.5px; line-height: 1.45; }
  .subject-cell small { display: block; margin-top: 3px; }

  /* Status, priority, category, owner and age flow onto one wrapping line
     beneath the subject - readable at a glance, no column alignment needed. */
  .table td:not(.ref-cell):not(.subject-cell):not(.sel-cell) {
    display: inline-block;
    width: auto;
    margin: 8px 0 0;
    margin-inline-end: 10px;
    font-size: 13px;
    vertical-align: middle;
  }

  /* The select box moves to the corner so it never squeezes the subject. */
  .sel-cell {
    position: absolute;
    inset-block-start: 12px;
    inset-inline-end: 12px;
    width: auto;
  }
  .table tr:has(.sel-cell) .subject-cell { padding-inline-end: 34px; }

  /* Touch targets. A 17px checkbox is a miss waiting to happen. */
  .sel-cell input, input[type="checkbox"] { width: 22px; height: 22px; }
  .btn { min-height: 44px; }
  /* Small buttons stay small in the top bar, where the header would otherwise
     grow tall for no gain. Everywhere else - Back, the bulk actions - they are
     real targets a thumb has to hit. */
  .btn-sm { min-height: 44px; }
  .topbar .btn-sm { min-height: 36px; }
  /* Five or six tabs need more than a phone is wide. Wrapping keeps every one
     of them visible and tappable; a sideways scroll here hides the Hidden and
     Recycle bin tabs behind a gesture nobody knows to make. */
  .tabs { flex-wrap: wrap; width: 100%; }
  .tabs a, .tabs button { padding: 10px 14px; flex: 1 1 auto; text-align: center; }

  /* The head stacks, so the title and the tabs are not fighting for one line. */
  .page-head { flex-wrap: wrap; gap: 10px; }
  .page-head .grow { display: none; }

  /* Filters and forms stack rather than squeeze. */
  .row { flex-direction: column; gap: 0; }
  .row > * { width: 100%; }

  /* The selection bar spans the screen and its buttons stay reachable. */
  .bulk-bar { flex-wrap: wrap; border-radius: var(--r); padding: 12px; }
  .bulk-bar .grow { display: none; }
  .bulk-bar .btn { flex: 1 1 auto; }

  /* The ticket page: message bodies and long addresses must not stretch it. */
  .msg-body, .subject-cell small { overflow-wrap: anywhere; }
  pre, code { white-space: pre-wrap; word-break: break-word; }
  img { max-width: 100%; height: auto; }
}

/* iPad landscape keeps the table, just with a little less padding so every
   column fits without scrolling. */
@media (min-width: 861px) and (max-width: 1100px) {
  .table th, .table td { padding-inline: 10px; }
  .table { font-size: 13.5px; }
}

/* ==================================================== requester history */

/* The panel on a ticket page. Compact on purpose: it is context for the reply
   being written, not a second queue to read. */

.hist-list { display: flex; flex-direction: column; gap: 2px; }

.hist-item {
  display: block;
  padding: 8px 10px;
  border-radius: var(--r-sm, 8px);
  color: inherit;
  text-decoration: none;
  transition: background .12s;
}

.hist-item:hover, .hist-item:focus-visible { background: var(--surface-2); }

.hist-subject {
  display: block;
  font-size: 13.5px;
  font-weight: 560;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hist-meta {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  color: var(--text-faint);
}

@media (max-width: 860px) {
  .hist-item { padding: 11px 10px; }
  .hist-subject { white-space: normal; }
}

/* ================================================= chosen attachments */

/* One chip per file that will actually be sent. The list is the only feedback
   there is once files are stacked across several picks, because the input's own
   "3 files selected" text stops matching what the form is carrying. */

.file-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-top: 8px;
}

.file-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 5px 6px 5px 10px;
  border: 1px solid var(--border-firm);
  border-radius: 999px;
  background: var(--surface-2);
  font-size: 12.5px;
  line-height: 1.3;
}

.file-chip > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-drop {
  flex: none;
  width: 20px;
  height: 20px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}

.file-drop:hover, .file-drop:focus-visible {
  background: var(--danger, #d92d20);
  color: #fff;
}

.file-total {
  color: var(--muted);
  font-size: 12.5px;
}

/* A 20px × is fine with a mouse and a miss with a thumb. */
@media (max-width: 860px) {
  .file-chip { padding-block: 8px; font-size: 13px; }
  .file-drop { width: 28px; height: 28px; font-size: 18px; }
}

/* ================================================ subscription warning */

/* Amber, not red: nothing has gone wrong yet, and a red bar every day for a
   week trains people to stop reading bars. */

.grace-bar {
  position: sticky;
  top: 0;
  z-index: 90;
  padding: 9px 18px;
  background: #fef3c7;
  color: #78350f;
  font-size: 13.5px;
  font-weight: 550;
  text-align: center;
  border-bottom: 1px solid #fcd34d;
}

/* Ahead of the date nothing is wrong yet, so it reads as information. Amber
   is kept for the week when access is actually at risk. */
.grace-bar.soft {
  background: #eff6ff;
  color: #1e40af;
  border-bottom-color: #bfdbfe;
}

.grace-bar ~ .topbar { top: 38px; }

/* ============================================== operator impersonation */

/* Deliberately loud, and in a colour the product never uses elsewhere, so it
   cannot be mistaken for part of the customer's own interface. */

.imp-bar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 14px;
  padding: 9px 18px;
  background: #7c2d12;
  color: #ffedd5;
  font-size: 13.5px;
  font-weight: 500;
}

.imp-bar b { color: #fff; }

.imp-bar form { margin: 0; }

.imp-bar button {
  border: 1px solid rgba(255,255,255,.45);
  background: transparent;
  color: #fff;
  border-radius: 999px;
  padding: 5px 16px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.imp-bar button:hover { background: rgba(255,255,255,.16); }

/* The top bar sticks too; while the banner is up it sits below it. */
.imp-bar ~ .topbar { top: 40px; }

/* ============================================ usage meters and plan chips */

.meter {
  height: 7px;
  border-radius: 4px;
  background: var(--surface-3);
  overflow: hidden;
  margin-top: 7px;
}

.meter span { display: block; height: 100%; background: var(--indigo); border-radius: 4px; }
.meter.warn span { background: var(--amber); }
.meter.full span { background: var(--red); }

.usage-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }

.usage-n {
  font-size: 22px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.usage-l { font-size: 13px; color: var(--text-faint); }

/* ====================================================== reduced motion */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}
