/* UITC Helpdesk: styled after the TUPC website (tup-maroon #800000, Inter, slate neutrals, soft rounded cards).
   Light by default, follows the visitor's system theme, and has a manual toggle (html.dark). */

:root {
  --maroon: #800000;
  --black: #1a1a1a;
  --red-50: #fef2f2;
  --red-100: #fee2e2;
  --btn: #991b1b;          /* red-800: primary buttons, focus ring */
  --btn-hover: #7f1d1d;    /* red-900 */

  --bg: #f8fafb;
  --surface: #ffffff;
  --surface-2: #f8fafb;    /* inputs, table headers */
  --text: #2d2d2d;
  --heading: #0f172a;      /* slate-900 */
  --muted: #64748b;        /* slate-500 */
  --faint: #94a3b8;        /* slate-400 */
  --border: #e2e8f0;       /* slate-200 */
  --border-soft: #f1f5f9;  /* slate-100 */
  --hover: #fdf2f2;        /* row / menu hover */
  --link: var(--maroon);
  --nav-bg: rgba(255, 255, 255, .95);
  --glow-a: rgba(128, 0, 0, .03);
  --glow-b: rgba(0, 0, 0, .03);

  --radius-card: 1.5rem;
  --radius-inner: 1rem;
  --shadow: 0 1px 2px rgba(15, 23, 42, .05);
  --shadow-lift: 0 10px 25px -10px rgba(15, 23, 42, .18);

  font-family: 'Inter', 'Inter Fallback', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color-scheme: light;
}

html.dark {
  --bg: #0f172a;
  --surface: #1e293b;     /* slate-800 */
  --surface-2: #0f172a;
  --text: #e2e8f0;
  --heading: #ffffff;
  --muted: #94a3b8;
  --faint: #64748b;
  --border: #334155;      /* slate-700 */
  --border-soft: #273449;
  --hover: rgba(255, 255, 255, .04);
  --link: #fbbf24;        /* amber-400, as on the TUPC site's dark mode */
  --nav-bg: rgba(15, 23, 42, .95);
  --glow-a: rgba(128, 0, 0, .10);
  --glow-b: rgba(255, 255, 255, .02);
  --red-50: rgba(153, 27, 27, .18);
  --red-100: rgba(153, 27, 27, .35);
  --shadow: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-lift: 0 10px 25px -10px rgba(0, 0, 0, .6);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background-color: var(--bg);
  background-image:
    radial-gradient(at 0% 0%, var(--glow-a) 0px, transparent 50%),
    radial-gradient(at 100% 100%, var(--glow-b) 0px, transparent 50%);
  background-attachment: fixed;
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background-color .3s, color .3s;
}
main.container { flex: 1; padding-top: 32px; padding-bottom: 48px; animation: fade-in .4s ease-out both; }
@keyframes fade-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { main.container { animation: none; } * { transition: none !important; } }

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.75rem; font-weight: 900; letter-spacing: -.02em; color: var(--heading); margin: 0 0 4px; line-height: 1.2; }
h2 { font-size: 1.05rem; font-weight: 800; color: var(--heading); margin: 0 0 14px; }
h3 { font-size: .9rem; font-weight: 800; color: var(--heading); margin: 18px 0 6px; }
.container { width: 100%; max-width: 1280px; margin: 0 auto; padding: 0 24px; }
.muted { color: var(--muted); }
.center { text-align: center; }
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .88em; white-space: nowrap; }
.inline { display: inline; }

/* ---- header (frosted white bar like the TUPC site) ---- */
.topbar { background: var(--nav-bg); backdrop-filter: blur(15px); -webkit-backdrop-filter: blur(15px);
  border-bottom: 1px solid var(--border-soft); box-shadow: var(--shadow); position: sticky; top: 0; z-index: 40; transition: background-color .3s; }
.topbar-inner { display: flex; align-items: center; gap: 18px; min-height: 68px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 12px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-logo { height: 42px; width: auto; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 1.05rem; font-weight: 800; text-transform: uppercase; letter-spacing: .01em; color: var(--heading); }
.brand-text strong span { color: var(--maroon); }
html.dark .brand-text strong span { color: #f87171; }
.brand-text small { color: var(--muted); font-size: .62rem; font-weight: 700; text-transform: uppercase; letter-spacing: .12em; }

.nav { display: flex; align-items: center; gap: 2px; flex: 1; flex-wrap: nowrap; justify-content: flex-start; min-width: 0; }
.nav a { color: var(--black); font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  padding: 26px 11px 22px; border-bottom: 3px solid transparent; transition: color .2s, border-color .2s; }
html.dark .nav a { color: #fff; }
.nav a:hover { color: var(--maroon); border-bottom-color: var(--maroon); text-decoration: none; }
html.dark .nav a:hover { color: #fbbf24; border-bottom-color: #fbbf24; }
.nav a.active { color: var(--maroon); border-bottom-color: var(--maroon); }
html.dark .nav a.active { color: #fbbf24; border-bottom-color: #fbbf24; }
.nav-spacer { flex: 1; }
.nav a { white-space: nowrap; }
/* dropdown menus (Admin, account): opened by click / keyboard in app.js */
.nav-menu { position: relative; }
.nav-menu-btn { display: inline-flex; align-items: center; gap: 6px; background: none; border: 0; cursor: pointer; font: inherit; color: var(--black);
  font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; padding: 26px 11px 22px; border-bottom: 3px solid transparent;
  transition: color .2s, border-color .2s; }
html.dark .nav-menu-btn { color: #fff; }
.nav-menu-btn .caret { font-size: .75em; transition: transform .2s; }
.nav-menu.open .caret { transform: rotate(180deg); }
.nav-menu-btn:hover, .nav-menu.open .nav-menu-btn, .nav-menu.active .nav-menu-btn { color: var(--maroon); border-bottom-color: var(--maroon); }
html.dark .nav-menu-btn:hover, html.dark .nav-menu.open .nav-menu-btn, html.dark .nav-menu.active .nav-menu-btn { color: #fbbf24; border-bottom-color: #fbbf24; }
.nav-menu-btn:focus-visible, .nav a:focus-visible, .nav-menu-item:focus-visible { outline: 2px solid var(--btn); outline-offset: -2px; border-radius: 8px; }
.nav-menu-list { position: absolute; top: calc(100% - 4px); left: 0; width: 290px; background: var(--surface); border: 1px solid var(--border-soft);
  border-radius: 1rem; box-shadow: var(--shadow-lift); padding: 8px; display: none; z-index: 50;
  max-height: calc(100vh - 84px); overflow-y: auto; overscroll-behavior: contain; }   /* a long menu scrolls on a short screen instead of running off it */
html.dark .nav-menu-list { border-color: var(--border); }
.nav-menu.open .nav-menu-list { display: block; }
.nav-menu-right { left: auto; right: 0; width: 240px; }
.nav .nav-menu-list a, .nav-menu-item { display: block; width: 100%; text-align: left; padding: 9px 12px; border: 0; border-radius: 10px; background: none; cursor: pointer;
  font: inherit; font-size: .84rem; font-weight: 700; text-transform: none; letter-spacing: 0; color: var(--text); white-space: normal; }
html.dark .nav .nav-menu-list a { color: var(--text); }
.nav .nav-menu-list a small { display: block; margin-top: 1px; font-size: .72rem; font-weight: 500; color: var(--muted); }
.nav .nav-menu-list a:hover, .nav-menu-item:hover, .nav .nav-menu-list a.active { background: var(--hover); color: var(--maroon); text-decoration: none; }
html.dark .nav .nav-menu-list a:hover, html.dark .nav .nav-menu-list a.active, html.dark .nav-menu-item:hover { color: #fbbf24; }
.nav-menu-right form { margin: 4px 0 0; padding-top: 4px; border-top: 1px solid var(--border-soft); }
.nav-group { margin: 10px 12px 4px; font-size: .6rem; font-weight: 800; text-transform: uppercase; letter-spacing: .12em; color: var(--faint); }
.nav-group:first-child { margin-top: 4px; }

/* "+ New ticket" call to action */
.nav a.nav-cta { background: var(--btn); color: #fff; border: 0; border-radius: 999px; padding: 9px 16px; margin: 0 4px; box-shadow: var(--shadow); white-space: nowrap; }
.nav a.nav-cta:hover, .nav a.nav-cta.active, html.dark .nav a.nav-cta, html.dark .nav a.nav-cta:hover, html.dark .nav a.nav-cta.active { background: var(--btn-hover); color: #fff; }

/* account chip */
.nav-user-btn { text-transform: none; letter-spacing: 0; padding: 5px 10px 5px 5px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); gap: 8px; }
.nav-user-btn:hover, .nav-account.open .nav-user-btn { border-color: var(--maroon); border-bottom-color: var(--maroon); background: var(--hover); }
.nav-account.active .nav-user-btn { border-bottom-color: var(--maroon); }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--btn); color: #fff; display: inline-grid; place-items: center; font-size: .72rem; font-weight: 800; letter-spacing: .02em; flex: none; }
.nav-user-name { display: flex; flex-direction: column; text-align: left; font-size: .78rem; font-weight: 700; line-height: 1.15; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--heading); }
.nav-user-name small { font-size: .56rem; font-weight: 800; text-transform: uppercase; letter-spacing: .12em; color: var(--maroon); }
html.dark .nav-user-name small { color: #f87171; }
.nav-toggle, .theme-toggle { background: none; border: 1px solid var(--border); color: var(--text); border-radius: 12px; font-size: 1.05rem;
  width: 40px; height: 40px; cursor: pointer; display: inline-grid; place-items: center; transition: background-color .2s, border-color .2s; }
.nav-toggle:hover, .theme-toggle:hover { background: var(--hover); border-color: var(--maroon); }
.nav-toggle { display: none; }
.theme-toggle { margin-left: auto; }
.theme-toggle .sun { display: none; }
html.dark .theme-toggle .sun { display: inline; }
html.dark .theme-toggle .moon { display: none; }
.footer { background: var(--surface); border-top: 1px solid var(--border-soft); padding: 40px 0 26px; margin-top: 20px; transition: background-color .3s; }
.footer-inner { display: grid; gap: 18px; justify-items: center; text-align: center; }
.footer-brand { display: flex; align-items: center; gap: 12px; font-weight: 800; text-transform: uppercase; font-size: 1.05rem; color: var(--heading); }
.footer-brand img { height: 40px; }
.footer-brand { flex-wrap: wrap; justify-content: center; }
.footer-sep { width: 1px; height: 34px; background: var(--border); margin: 0 6px; }
.footer-brand .footer-oit { height: 44px; width: 44px; }
.footer-brand span { color: var(--maroon); }
html.dark .footer-brand span { color: #f87171; }
.footer-contact { color: var(--muted); font-size: .85rem; margin: 0; }
.footer-copy { margin: 0; padding-top: 18px; border-top: 1px solid var(--border-soft); width: 100%; font-size: .68rem; font-weight: 700;
  color: var(--faint); text-transform: uppercase; letter-spacing: .14em; }

/* ---- layout pieces ---- */
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head p { margin: 2px 0; }
.pill { display: inline-flex; align-items: center; gap: 8px; padding: 5px 16px; background: var(--red-50); color: var(--btn);
  border: 1px solid var(--red-100); border-radius: 999px; font-size: .62rem; font-weight: 900; text-transform: uppercase; letter-spacing: .26em; }
html.dark .pill { color: #fca5a5; }
.card { background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius-card); box-shadow: var(--shadow);
  padding: 24px; margin-bottom: 20px; transition: background-color .3s, border-color .3s; }
html.dark .card { border-color: var(--border); }
.card.flush { padding: 0; overflow: hidden; }
.card.narrow, .narrow { max-width: 540px; margin-left: auto; margin-right: auto; }
.card.narrow { padding: 32px; }
input.otp { text-align: center; font-size: 1.8rem; font-weight: 800; letter-spacing: .5em; padding: 14px 8px 14px calc(8px + .5em);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.otp-actions { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border-soft); }
html.dark .otp-actions { border-top-color: var(--border); }
.auth-head { display: grid; gap: 10px; justify-items: center; margin-top: 12px; margin-bottom: 20px; }
.auth-head h1 { font-size: 2rem; margin: 0; }
.auth-head p { margin: 0; font-size: .875rem; font-weight: 500; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; }
.card-head a { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.error-code { font-size: 4rem; font-weight: 900; color: var(--maroon); margin: 0; letter-spacing: -.04em; }
html.dark .error-code { color: #f87171; }

/* ---- flash messages ---- */
.flashes { margin-bottom: 18px; display: grid; gap: 8px; }
.flash { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-radius: 12px; border: 1px solid;
  font-size: .875rem; font-weight: 700; }
.flash.success { background: #f0fdf4; border-color: #bbf7d0; color: #15803d; }
.flash.error { background: #fef2f2; border-color: #fecaca; color: #b91c1c; }
.flash.info { background: #eff6ff; border-color: #bfdbfe; color: #1d4ed8; }
html.dark .flash.success { background: rgba(21, 128, 61, .15); border-color: rgba(34, 197, 94, .35); color: #86efac; }
html.dark .flash.error { background: rgba(185, 28, 28, .18); border-color: rgba(248, 113, 113, .35); color: #fca5a5; }
html.dark .flash.info { background: rgba(29, 78, 216, .18); border-color: rgba(96, 165, 250, .35); color: #93c5fd; }
.flash .close { background: none; border: 0; font-size: 1.3rem; line-height: 1; cursor: pointer; color: inherit; }

/* ---- forms ---- */
.form { display: grid; gap: 16px; }
.form label { display: grid; gap: 6px; font-size: .72rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.form label.check { display: flex; align-items: center; gap: 8px; font-weight: 500; text-transform: none; letter-spacing: 0; font-size: .85rem; color: var(--text); }
.form input[type=checkbox] { accent-color: var(--btn); width: 16px; height: 16px; }
[hidden] { display: none !important; }
.optional, .hint { font-weight: 500; color: var(--faint); font-size: .72rem; text-transform: none; letter-spacing: 0; }
input[type=text], input[type=email], input[type=password], input[type=tel], input[type=search], input[type=number], input[type=date], input[type=time], select, textarea {
  width: 100%; padding: 11px 14px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); font: inherit;
  font-size: .875rem; font-weight: 500; color: var(--text); text-transform: none; letter-spacing: 0; transition: border-color .2s, box-shadow .2s;
}
input::placeholder, textarea::placeholder { color: var(--faint); }
input:disabled { background: var(--border-soft); color: var(--muted); }
html.dark input:disabled { background: #0b1220; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--btn); box-shadow: 0 0 0 1px var(--btn); }
input[type=file] { font-weight: 500; font-size: .8rem; padding: 8px 0; border: 0; background: none; color: var(--muted); }
input[type=file]::file-selector-button { margin-right: 12px; padding: 8px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface);
  color: var(--text); font: inherit; font-size: .7rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; cursor: pointer; }
fieldset { border: 1px solid var(--border); border-radius: var(--radius-inner); padding: 14px 16px 16px; display: grid; gap: 14px; margin: 0; }
legend { font-weight: 800; padding: 0 8px; font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--heading); }
.pw-wrap { position: relative; display: block; }
.pw-wrap input { padding-right: 70px; }
.pw-toggle { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); background: none; border: 0; color: var(--link);
  font-size: .68rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; cursor: pointer; padding: 4px 8px; }
.counter { text-align: right; }
.inline-label { display: inline-flex !important; align-items: center; gap: 8px; }
.inline-label input[type=date] { width: auto; }
input.num { width: 78px; }

/* ---- buttons ---- */
.btn { display: inline-block; padding: 10px 18px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font: inherit; font-size: .7rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; cursor: pointer; text-align: center;
  transition: background-color .2s, border-color .2s, box-shadow .2s, transform .2s; }
.btn:hover { background: var(--hover); border-color: var(--maroon); text-decoration: none; }
.btn-primary { background: var(--btn); border-color: var(--btn); color: #fff; font-weight: 900; box-shadow: 0 8px 18px -8px rgba(127, 29, 29, .55); }
.btn-primary:hover { background: var(--btn-hover); border-color: var(--btn-hover); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-sm { padding: 6px 12px; font-size: .62rem; border-radius: 10px; }
.btn-block { display: block; width: 100%; padding: 13px 18px; }
.btn[disabled] { opacity: .6; cursor: wait; }
.nav .btn-ghost { color: var(--muted); }

/* ---- filters ---- */
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; padding: 14px 16px; }
.filters input[type=search], .filters input[type=text] { flex: 1 1 240px; width: auto; }
.filters select { width: auto; flex: 0 1 auto; }

/* ---- stat tiles ---- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat { background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius-card); box-shadow: var(--shadow);
  padding: 18px 20px; color: var(--text); display: flex; flex-direction: column; transition: transform .3s, box-shadow .3s, border-color .3s; }
html.dark .stat { border-color: var(--border); }
a.stat:hover { text-decoration: none; border-color: var(--maroon); transform: translateY(-3px); box-shadow: var(--shadow-lift); }
.stat-n { font-size: 2rem; font-weight: 900; line-height: 1.1; color: var(--heading); letter-spacing: -.02em; }
.stat-l { color: var(--muted); font-size: .66rem; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; margin-top: 4px; }
.stat-alert { border-color: var(--red-100); background: linear-gradient(135deg, var(--red-50), var(--surface) 70%); }
.stat-alert .stat-n { color: var(--maroon); }
html.dark .stat-alert .stat-n { color: #f87171; }

/* ---- tables ---- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 13px 16px; text-align: left; border-bottom: 1px solid var(--border-soft); vertical-align: middle; font-size: .875rem; }
html.dark .table th, html.dark .table td { border-bottom-color: var(--border); }
.table th { font-size: .62rem; font-weight: 800; text-transform: uppercase; letter-spacing: .12em; color: var(--faint); background: var(--surface-2); white-space: nowrap; }
.table tbody tr { transition: background-color .15s; }
.table tbody tr:hover { background: var(--hover); }
.table tbody tr:last-child td { border-bottom: 0; }
.table .subject { max-width: 340px; }
.table .subject a { color: var(--heading); font-weight: 700; }
.table .subject a:hover { color: var(--link); }
.empty { text-align: center !important; color: var(--muted); padding: 32px !important; }
.row-actions { white-space: nowrap; }
.card-pad { padding: 22px 24px 8px; align-items: center; gap: 12px; flex-wrap: wrap; }
.card-pad h2 { margin: 0; }
time.running { font-variant-numeric: tabular-nums; font-weight: 800; color: var(--heading); white-space: nowrap; }
.row-overdue { background: var(--red-50); }
.row-overdue td:first-child { box-shadow: inset 3px 0 0 var(--btn); }
.row-overdue time.running { color: var(--btn); }
html.dark .row-overdue time.running { color: #fca5a5; }
html.dark .row-overdue:hover { background: var(--red-100); }
.table input[type=text] { min-width: 180px; }
.pagination { display: flex; justify-content: center; align-items: center; gap: 16px; color: var(--muted); font-size: .8rem; font-weight: 600; }

/* ---- badges ---- */
.badge { display: inline-block; padding: 3px 11px; border-radius: 999px; font-size: .64rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em;
  white-space: nowrap; background: #f1f5f9; color: #334155; }
.status-open { background: #e0f2fe; color: #075985; }
.status-in-progress { background: #fef3c7; color: #92400e; }
.status-on-hold { background: #ede9fe; color: #5b21b6; }
.status-resolved { background: #dcfce7; color: #166534; }
.status-closed { background: #e2e8f0; color: #475569; }
.prio-low { background: #f1f5f9; color: #475569; }
.prio-normal { background: #e0e7ff; color: #3730a3; }
.prio-high { background: #ffedd5; color: #9a3412; }
.prio-urgent { background: #fee2e2; color: #991b1b; }
.sla-wait { background: #f1f5f9; color: #64748b; }
html.dark .sla-wait { background: rgba(148, 163, 184, .16); color: #94a3b8; }
.sla-ok { background: #e0f2fe; color: #075985; }
.sla-met { background: #dcfce7; color: #166534; }
.sla-breached, .sla-overdue { background: #fee2e2; color: #991b1b; }
.email-confirmed { background: #dcfce7; color: #166534; }
.email-unconfirmed { background: #fef3c7; color: #92400e; }
.email-failed { background: #fee2e2; color: #991b1b; }
.email-delayed { background: #ffedd5; color: #9a3412; }
html.dark .email-delayed { background: rgba(251, 146, 60, .18); color: #fdba74; }
html.dark .email-confirmed { background: rgba(74, 222, 128, .16); color: #86efac; }
html.dark .email-unconfirmed { background: rgba(251, 191, 36, .16); color: #fcd34d; }
html.dark .email-failed { background: rgba(248, 113, 113, .18); color: #fca5a5; }
.role-admin { background: var(--red-50); color: var(--maroon); }
.role-staff { background: #e0f2fe; color: #075985; }
html.dark .badge { background: rgba(148, 163, 184, .16); color: #cbd5e1; }
html.dark .status-open, html.dark .sla-ok, html.dark .role-staff { background: rgba(56, 189, 248, .16); color: #7dd3fc; }
html.dark .status-in-progress { background: rgba(251, 191, 36, .16); color: #fcd34d; }
html.dark .status-on-hold { background: rgba(167, 139, 250, .18); color: #c4b5fd; }
html.dark .status-resolved, html.dark .sla-met { background: rgba(74, 222, 128, .16); color: #86efac; }
html.dark .status-closed, html.dark .prio-low { background: rgba(148, 163, 184, .16); color: #cbd5e1; }
html.dark .prio-normal { background: rgba(129, 140, 248, .18); color: #a5b4fc; }
html.dark .prio-high { background: rgba(251, 146, 60, .18); color: #fdba74; }
html.dark .prio-urgent, html.dark .sla-breached, html.dark .sla-overdue { background: rgba(248, 113, 113, .18); color: #fca5a5; }
html.dark .role-admin { color: #fca5a5; }
.tag { font-size: .6rem; font-weight: 900; text-transform: uppercase; letter-spacing: .1em; background: var(--red-50); color: var(--maroon); border-radius: 6px; padding: 2px 8px; }
html.dark .tag { color: #fca5a5; }
.tag-internal { background: #fef3c7; color: #92400e; }
html.dark .tag-internal { background: rgba(251, 191, 36, .16); color: #fcd34d; }

/* ---- ticket detail ---- */
.detail-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.detail-main .card:last-child, .detail-side .card:last-child { margin-bottom: 0; }
.crumb { margin: 0 0 6px; font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 8px 0 0; }
.prose { white-space: pre-wrap; overflow-wrap: anywhere; }
.files { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.files small { margin-left: 6px; }
.comment { border: 1px solid var(--border); border-radius: var(--radius-inner); padding: 14px 16px; margin-bottom: 12px; background: var(--surface-2); }
.comment.by-staff { border-left: 4px solid var(--maroon); background: var(--surface); }
.comment.internal { background: #fffbeb; border-color: #fde68a; border-left-color: #f59e0b; }
html.dark .comment.internal { background: rgba(251, 191, 36, .08); border-color: rgba(251, 191, 36, .3); border-left-color: #f59e0b; }
.comment header { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.comment time { margin-left: auto; font-size: .75rem; }
.reply-form { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--border-soft); }
html.dark .reply-form { border-top-color: var(--border); }
.notice { background: var(--surface-2); border: 1px solid var(--border-soft); border-radius: 12px; padding: 12px 16px; color: var(--muted); margin: 10px 0 0; font-weight: 600; font-size: .85rem; }
.kv { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 10px 14px; }
.kv dt { color: var(--faint); font-size: .62rem; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; padding-top: 3px; }
.kv dd { margin: 0; overflow-wrap: anywhere; font-size: .875rem; font-weight: 500; }
.timeline { list-style: none; margin: 0; padding: 0 0 0 16px; border-left: 2px solid var(--border); display: grid; gap: 14px; }
.timeline li { position: relative; display: grid; font-size: .85rem; }
.timeline li::before { content: ""; position: absolute; left: -22px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--maroon); box-shadow: 0 0 0 3px var(--surface); }

/* ---- OIT repair form card ---- */
details > summary { cursor: pointer; list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
details > summary::-webkit-details-marker { display: none; }
details > summary h2 { margin: 0; }
details > summary::after { content: "\25BE"; color: var(--muted); font-size: 1.1rem; transition: transform .2s; }
details[open] > summary::after { transform: rotate(180deg); }
details > .notice, details > p, details > form { margin-top: 16px; }
.small { font-size: .78rem; line-height: 1.5; }
.parts { display: grid; gap: 8px; }
.parts-head, .parts-row { display: grid; grid-template-columns: minmax(0, 1fr) 80px 80px 110px; gap: 8px; align-items: center; }
.parts-head span { font-size: .62rem; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; color: var(--faint); }
.parts-row .check { font-size: .78rem; white-space: nowrap; }
@media (max-width: 640px) {
  .parts-head { display: none; }
  .parts-row { grid-template-columns: 1fr 1fr; padding-bottom: 8px; border-bottom: 1px dashed var(--border); }
  .parts-row input:first-child { grid-column: 1 / -1; }
}

/* ---- borrowing ---- */
.subnav { display: flex; gap: 6px; flex-wrap: wrap; margin: -4px 0 18px; }
.subnav a { padding: 8px 16px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font-size: .68rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; transition: border-color .2s, background-color .2s; }
.subnav a:hover { border-color: var(--maroon); text-decoration: none; }
.subnav a.active { background: var(--btn); border-color: var(--btn); color: #fff; }
.borrow-layout { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 20px; align-items: start; }
.borrow-panel { position: sticky; top: 84px; margin-bottom: 0; }
.item-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: 14px; }
.item { background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius-card); box-shadow: var(--shadow);
  padding: 16px 18px; display: grid; gap: 8px; align-content: start; transition: transform .25s, box-shadow .25s, border-color .25s; }
html.dark .item { border-color: var(--border); }
.item:not(.out):hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); border-color: var(--maroon); }
.item.out { opacity: .55; filter: grayscale(.6); cursor: not-allowed; }
.item-photo { margin: -16px -18px 2px; aspect-ratio: 4 / 3; overflow: hidden; background: var(--surface-2);
  border-radius: var(--radius-card) var(--radius-card) 0 0; display: grid; place-items: center; }
.item-photo.empty { aspect-ratio: 16 / 5; }
.item-photo.empty span { font-size: 1.6rem; }
.item-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.item-photo span { font-size: 2.4rem; font-weight: 900; color: var(--faint); opacity: .6; }
.item-thumb { width: 72px; height: 54px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); display: block; margin-bottom: 6px; }
.thumb-empty { display: grid; place-items: center; font-size: .6rem; font-weight: 700; color: var(--faint); background: var(--surface-2); }
.items-table th, .items-table td { padding: 10px 8px; }
.items-table input[type=text] { min-width: 0; width: 100%; }
.items-table td:nth-child(2) { min-width: 130px; }
.items-table td:nth-child(3) { min-width: 130px; }
.items-table input.num { width: 64px; }
.pic-cell { width: 150px; }
.pic-cell input[type=file] { max-width: 150px; font-size: .68rem; }
.pic-cell .check { font-size: .72rem; }
.item-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.item-top strong { color: var(--heading); font-size: .92rem; line-height: 1.25; }
.item p { margin: 0; }
.stock { white-space: nowrap; border-radius: 999px; padding: 2px 10px; font-size: .6rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.stock-ok { background: #dcfce7; color: #166534; }
.stock-low { background: #fef3c7; color: #92400e; }
.stock-out { background: #fee2e2; color: #991b1b; }
html.dark .stock-ok { background: rgba(74, 222, 128, .16); color: #86efac; }
html.dark .stock-low { background: rgba(251, 191, 36, .16); color: #fcd34d; }
html.dark .stock-out { background: rgba(248, 113, 113, .18); color: #fca5a5; }
.stepper { display: inline-grid; grid-template-columns: 38px 64px 38px; gap: 6px; align-items: center; }
.stepper input { text-align: center; padding: 8px 4px; font-weight: 800; -moz-appearance: textfield; }
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.step-btn { height: 38px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font-size: 1.1rem; font-weight: 800; cursor: pointer; transition: background-color .2s, border-color .2s; }
.step-btn:hover:not(:disabled) { background: var(--hover); border-color: var(--maroon); }
.step-btn:disabled, .stepper input:disabled { cursor: not-allowed; opacity: .5; }
.picked { list-style: none; margin: 0 0 14px; padding: 10px 14px; background: var(--surface-2); border: 1px solid var(--border-soft);
  border-radius: 12px; display: grid; gap: 4px; font-size: .88rem; font-weight: 600; }
.radios { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.radios legend { margin-bottom: 4px; }
.bstatus-pending { background: #fef3c7; color: #92400e; }
.bstatus-approved { background: #e0f2fe; color: #075985; }
.bstatus-borrowed { background: #ede9fe; color: #5b21b6; }
.bstatus-returned { background: #dcfce7; color: #166534; }
.bstatus-rejected, .bstatus-cancelled { background: #e2e8f0; color: #475569; }
html.dark .bstatus-pending { background: rgba(251, 191, 36, .16); color: #fcd34d; }
html.dark .bstatus-approved { background: rgba(56, 189, 248, .16); color: #7dd3fc; }
html.dark .bstatus-borrowed { background: rgba(167, 139, 250, .18); color: #c4b5fd; }
html.dark .bstatus-returned { background: rgba(74, 222, 128, .16); color: #86efac; }
html.dark .bstatus-rejected, html.dark .bstatus-cancelled { background: rgba(148, 163, 184, .16); color: #cbd5e1; }
@media (max-width: 960px) {
  .borrow-layout { grid-template-columns: 1fr; }
  .borrow-panel { position: static; }
}

/* ---- reports ---- */
.reports { gap: 20px; }
.reports .card { margin-bottom: 0; }
.bars { display: flex; align-items: flex-end; gap: 6px; height: 180px; padding-top: 8px; }
.bar-col { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 3px; }
.bar { width: 100%; background: linear-gradient(180deg, #991b1b, var(--maroon)); border-radius: 6px 6px 0 0; min-height: 2px; }
.bar-n, .bar-l { font-size: .66rem; font-weight: 700; color: var(--faint); }
.bar-n { height: 14px; }
.hbars { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.hbars li { display: grid; grid-template-columns: 150px 1fr 34px; align-items: center; gap: 12px; font-size: .85rem; font-weight: 600; }
.hb-track { background: var(--border-soft); border-radius: 999px; height: 10px; overflow: hidden; }
html.dark .hb-track { background: var(--border); }
.hb-fill { display: block; height: 100%; background: linear-gradient(90deg, #991b1b, var(--maroon)); border-radius: 999px; }
.hb-n { text-align: right; font-weight: 800; color: var(--heading); }

/* ---- responsive ---- */
@media (max-width: 960px) {
  .detail-layout { grid-template-columns: 1fr; }
  .container { padding: 0 16px; }
  .grid-2 { grid-template-columns: 1fr; }
  .hbars li { grid-template-columns: 110px 1fr 28px; }
  .card.narrow { padding: 24px; }

  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tr { padding: 12px 16px; border-bottom: 1px solid var(--border-soft); }
  .table td { border: 0; padding: 4px 0; display: flex; justify-content: space-between; gap: 12px; text-align: right; }
  .table td::before { content: attr(data-label); color: var(--faint); font-size: .62rem; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; text-align: left; padding-top: 3px; }
  .table td:not([data-label])::before { content: none; }
  .table .subject { max-width: none; }
}
/* Below this width the menu folds into the hamburger. The Admin and account menus expand in place (tap to open). */
@media (max-width: 1180px) {
  .topbar-inner { gap: 10px; min-height: 64px; }
  .theme-toggle { order: 1; margin-left: auto; }
  .nav-toggle { display: inline-grid; order: 2; }
  .nav { order: 3; display: none; flex: 1 1 100%; width: 100%; flex-direction: column; align-items: stretch; flex-wrap: wrap; padding-bottom: 12px; }
  .nav.open { display: flex; }
  .nav a { padding: 12px 10px; border-bottom: 1px solid var(--border-soft); }
  .nav a.active, .nav a:hover { border-bottom-color: var(--maroon); }
  .nav-spacer { display: none; }
  .nav a.nav-cta { margin: 12px 0 4px; text-align: center; border-bottom: 0; padding: 12px 16px; }
  .nav-menu { border-bottom: 1px solid var(--border-soft); }
  .nav-menu-btn { width: 100%; justify-content: space-between; padding: 12px 10px; border-bottom: 0; }
  .nav-menu-btn:hover, .nav-menu.open .nav-menu-btn, .nav-menu.active .nav-menu-btn { border-bottom-color: transparent; }
  .nav-menu-list, .nav-menu-right { position: static; width: auto; background: none; border: 0; box-shadow: none; padding: 0 0 8px 12px; max-height: none; overflow: visible; }
  .nav .nav-menu-list a { border-bottom: 0; padding: 10px 12px; }
  .nav .nav-menu-list a small { display: none; }
  .nav-user-btn { width: 100%; border: 0; border-radius: 0; background: none; padding: 10px 10px; }
  .nav-user-btn .caret { margin-left: auto; }
  .nav-user-name { max-width: none; }
  .nav-account { border-top: 1px solid var(--border-soft); margin-top: 8px; border-bottom: 0; }
}

/* ---- privacy consent (registration) and the Privacy Notice page ---- */
.consent { display: grid; gap: 10px; padding: 14px 16px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); }
.consent p { margin: 0; font-size: .8rem; color: var(--muted); line-height: 1.5; }
.form label.consent-check { align-items: flex-start; }
.consent-check input[type=checkbox] { margin-top: 3px; flex: none; }
.consent-check span { line-height: 1.45; }
.consent a, .legal a, .footer-copy a { color: var(--btn); font-weight: 700; }
.card.legal { max-width: 760px; margin: 0 auto; padding: 32px; line-height: 1.6; font-size: .92rem; }
.legal h2 { font-size: 1rem; margin: 24px 0 8px; }
.legal ul { padding-left: 20px; display: grid; gap: 6px; }
.legal-back { margin-top: 24px; }
@media (max-width: 640px) { .card.legal { padding: 22px; } }

/* ---- customer satisfaction survey ---- */
.stars { letter-spacing: 1px; white-space: nowrap; }
.stars .on { color: #f59e0b; }
.stars .off { color: var(--border); }
.stat-n small { font-size: .9rem; font-weight: 700; color: var(--muted); }
.survey-prompt { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 20px;
  border-color: var(--red-100); background: linear-gradient(135deg, var(--red-50), var(--surface) 70%); }
.survey-comment { color: var(--text); font-style: italic; }
.card.survey { max-width: 760px; margin: 0 auto; padding: 32px; }
.survey fieldset { border: 0; margin: 0; padding: 0; min-width: 0; display: grid; gap: 12px; }
.survey legend { padding: 0; margin-bottom: 4px; font-weight: 800; color: var(--heading); font-size: .95rem; text-transform: none; letter-spacing: 0; }
.survey .req { color: var(--btn); font-size: .7rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; margin-left: 6px; }
.rate-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.rate-opt, .rate-mini label { position: relative; cursor: pointer; }
.rate-opt input, .rate-mini input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.rate-box { display: grid; justify-items: center; gap: 2px; padding: 12px 6px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2);
  text-align: center; transition: border-color .15s, background-color .15s, transform .15s; }
.rate-face { font-size: 1.7rem; line-height: 1.1; }
.rate-num { font-weight: 900; color: var(--heading); }
.rate-label { font-size: .62rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.rate-opt:hover .rate-box { border-color: var(--btn); }
.rate-opt input:checked + .rate-box { border-color: var(--btn); background: var(--red-50); box-shadow: 0 0 0 1px var(--btn); transform: translateY(-2px); }
.rate-opt input:focus-visible + .rate-box, .rate-mini input:focus-visible + span { outline: 2px solid var(--btn); outline-offset: 2px; }
.aspects { margin-top: 8px; }
.aspect { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 0; border-top: 1px solid var(--border-soft); }
.aspect-text { display: grid; gap: 2px; font-size: .85rem; }
.aspect-text .muted { font-size: .75rem; }
.rate-mini { display: flex; gap: 6px; }
.rate-mini span { display: inline-block; min-width: 38px; padding: 7px 10px; text-align: center; border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface-2); font-size: .8rem; font-weight: 800; color: var(--muted); }
.rate-mini label:hover span { border-color: var(--btn); }
.rate-mini input:checked + span { background: var(--btn); border-color: var(--btn); color: #fff; }
@media (max-width: 640px) { .card.survey { padding: 22px; } .rate-label { display: none; } .rate-row { gap: 6px; } }

/* ---- document printing ---- */
.pstatus-submitted { background: #fef3c7; color: #92400e; }
.pstatus-needs-revision { background: #ffedd5; color: #9a3412; }
.pstatus-approved { background: #e0f2fe; color: #075985; }
.pstatus-paid { background: #ede9fe; color: #5b21b6; }
.pstatus-ready { background: #dcfce7; color: #166534; }
.pstatus-claimed { background: #e2e8f0; color: #334155; }
.pstatus-rejected, .pstatus-cancelled, .pstatus-expired { background: #fee2e2; color: #991b1b; }
html.dark .pstatus-submitted { background: rgba(251, 191, 36, .16); color: #fcd34d; }
html.dark .pstatus-needs-revision { background: rgba(251, 146, 60, .18); color: #fdba74; }
html.dark .pstatus-approved { background: rgba(56, 189, 248, .16); color: #7dd3fc; }
html.dark .pstatus-paid { background: rgba(167, 139, 250, .18); color: #c4b5fd; }
html.dark .pstatus-ready { background: rgba(74, 222, 128, .16); color: #86efac; }
html.dark .pstatus-claimed { background: rgba(148, 163, 184, .16); color: #cbd5e1; }
html.dark .pstatus-rejected, html.dark .pstatus-cancelled, html.dark .pstatus-expired { background: rgba(248, 113, 113, .16); color: #fca5a5; }
.choice { border: 0; margin: 0; padding: 0; min-width: 0; display: grid; gap: 8px; }
.choice legend { padding: 0; margin-bottom: 4px; font-size: .72rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.choice .hint { display: block; }
.prices-table td { padding: 8px 0; border-bottom: 1px solid var(--border-soft); font-size: .88rem; }
.num-cell { text-align: right; white-space: nowrap; }
.how { margin: 0 0 8px; padding-left: 20px; display: grid; gap: 6px; font-size: .88rem; }
.note-box { margin-top: 14px; padding: 12px 14px; border: 1px solid var(--border); border-left: 4px solid var(--btn); border-radius: 10px; background: var(--surface-2); }
.lines-table select { min-width: 280px; }
.total-row td { border-top: 2px solid var(--border); font-size: 1rem; }
.row-active { background: var(--surface-2); box-shadow: inset 3px 0 0 var(--btn); }
.flash.plain { display: block; font-weight: 600; }
.card-head form.inline { display: flex; gap: 8px; align-items: center; }
.card-head form.inline input[type=date] { width: auto; }
.amount-table td { padding: 6px 0; font-size: .88rem; }

/* ---- guest printing (no sign-in) ---- */
.hp { position: absolute; left: -9999px; top: auto; width: 1px; height: 1px; overflow: hidden; }
.guest-card { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 16px;
  border-color: var(--red-100); background: linear-gradient(135deg, var(--red-50), var(--surface) 70%); }
.guest-card > div { display: grid; gap: 2px; font-size: .9rem; }
.guest-card .muted { font-size: .8rem; }

/* ---- account help ---- */
.astatus-new, .astatus-open { background: #fef3c7; color: #92400e; }
.astatus-verified { background: #e0f2fe; color: #075985; }
.astatus-done, .astatus-resolved { background: #dcfce7; color: #166534; }
.astatus-rejected, .astatus-cancelled, .astatus-closed { background: #e2e8f0; color: #475569; }
html.dark .astatus-new, html.dark .astatus-open { background: rgba(251, 191, 36, .16); color: #fcd34d; }
html.dark .astatus-verified { background: rgba(56, 189, 248, .16); color: #7dd3fc; }
html.dark .astatus-done, html.dark .astatus-resolved { background: rgba(74, 222, 128, .16); color: #86efac; }
html.dark .astatus-rejected, html.dark .astatus-cancelled, html.dark .astatus-closed { background: rgba(148, 163, 184, .16); color: #cbd5e1; }
.forgot-line { margin: 0; font-size: .85rem; }
.note-box + form { margin-top: 18px; }

/* ---- sign-in page: the login on the left, the two no-sign-in requests on the right ---- */
.login-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 32px; max-width: 1040px; margin: 0 auto; align-items: start; }
.login-col { display: grid; gap: 16px; align-content: start; }
.login-col .auth-head { margin-bottom: 4px; }
.login-col .card { margin: 0; }
.login-card { padding: 32px; }
.quick-card { display: grid; gap: 14px; padding: 24px; border-color: var(--red-100); background: linear-gradient(135deg, var(--red-50), var(--surface) 70%); }
.quick-card > div { display: grid; gap: 4px; font-size: .95rem; }
.quick-card .muted { font-size: .84rem; line-height: 1.5; }
.quick-card .btn { justify-self: start; }
@media (max-width: 860px) { .login-split { grid-template-columns: 1fr; max-width: 540px; gap: 8px; } .login-card { padding: 24px; } }
.stack > * + * { margin-top: 14px; }
.stack .grid-2 { gap: 16px; }
.radio-row { display: flex; gap: 22px; }

/* ---- print: several files per request ---- */
.filepick { border: 2px dashed var(--border); border-radius: var(--radius-inner); padding: 14px; display: grid; gap: 8px; transition: border-color .2s, background-color .2s; }
.filepick.drag { border-color: var(--maroon); background: var(--hover); }
.filepick-hint { margin: 0; font-size: .8rem; color: var(--muted); }
.filepick-list, .filelist { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.filepick-list:empty { display: none; }
.filepick-list li, .filelist li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 12px;
  border: 1px solid var(--border-soft); border-radius: 12px; background: var(--surface-2); }
.filepick-name { flex: 1; min-width: 0; font-weight: 700; overflow-wrap: anywhere; }
.filepick-total { margin: 0; font-size: .8rem; font-weight: 700; color: var(--muted); }
.filepick-msg { margin: 0; padding: 8px 12px; border-radius: 10px; background: var(--red-50); color: #991b1b; font-size: .82rem; }
html.dark .filepick-msg { color: #fca5a5; }
.filelist li > div { display: grid; min-width: 0; }
.filelist strong { overflow-wrap: anywhere; }
.filelist + dl, .filelist + p { margin-top: 14px; }

/* ---- manuals (page-turning viewer) ---- */
.flipbook { padding: 16px; }
.flip-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; margin-bottom: 12px; }
.flip-status { min-width: 150px; text-align: center; font-weight: 700; font-size: .85rem; color: var(--heading); }
.flip-jump { display: inline-flex; align-items: center; gap: 6px; font-size: .75rem; font-weight: 700; color: var(--muted); }
.flip-jump input { width: 64px; padding: 5px 8px; }
.flip-progress { height: 4px; border-radius: 4px; overflow: hidden; background: var(--border-soft); margin-bottom: 10px; }
.flip-progress span { display: block; height: 100%; width: 40%; background: var(--btn); border-radius: 4px; animation: flip-load 1.1s ease-in-out infinite; }
@keyframes flip-load { from { margin-left: -40%; } to { margin-left: 100%; } }
.flip-stage { width: 100%; max-width: 1400px; margin: 0 auto; min-height: 320px; background: var(--surface-2); border-radius: 14px; }
.flip-page { background: #fff; overflow: hidden; }
.flip-page canvas { display: block; width: 100%; height: 100%; }
.flip-wait { display: grid; place-items: center; width: 100%; height: 100%; color: #94a3b8; font-size: .85rem; font-weight: 700; }
.flip-hint { text-align: center; margin: 12px 0 0; }
.flipbook.flip-failed .flip-stage, .flipbook.flip-failed .flip-toolbar button:not([data-status]), .flipbook.flip-failed .flip-jump { display: none; }
.flipbook:fullscreen { background: var(--bg); padding: 24px; overflow: auto; display: flex; flex-direction: column; justify-content: center; }
@media (prefers-reduced-motion: reduce) { .flip-progress span { animation: none; margin-left: 0; width: 100%; } }
@media (max-width: 640px) {
  .flipbook { padding: 10px; }
  .flip-toolbar { gap: 6px; }
  .flip-status { flex: 1 0 100%; order: -1; min-width: 0; }      /* "Page 3 of 36" on its own line, buttons below */
  .flip-lbl { display: none; }                                    /* arrows only: â€¹ â€º Â« Â» */
  .flip-toolbar .btn-sm { min-width: 42px; }
}

/* ---- lab / room availability ---- */
.rooms-check { margin-bottom: 8px; }
.rooms-asof { margin: 6px 2px 16px; color: var(--text); }
.room-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(290px, 100%), 1fr)); gap: 14px; margin-bottom: 16px; }
.room-card { display: grid; gap: 6px; align-content: start; margin: 0; color: var(--text); border-left: 5px solid var(--border); transition: transform .15s, box-shadow .15s; }
.room-card:hover { text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow-lift); }
.room-card.room-busy { border-left-color: var(--btn); }
.room-card.room-free { border-left-color: #16a34a; }
.room-card.room-closed { border-left-color: #94a3b8; }
.room-card.room-unavailable { border-left-color: #f59e0b; }
.room-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.room-top strong { font-size: 1.02rem; color: var(--heading); }
.room-status { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 8px; margin-top: 4px; }
.room-who { font-weight: 700; color: var(--heading); overflow-wrap: anywhere; }
.room-next { color: var(--muted); }
.room-pill { display: inline-block; padding: 2px 11px; border-radius: 999px; font-size: .72rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; white-space: nowrap; }
.pill-free { background: #dcfce7; color: #166534; }
.pill-busy { background: var(--red-100); color: #991b1b; }
.pill-closed { background: #e2e8f0; color: #475569; }
.pill-unavailable { background: #fef3c7; color: #92400e; }
html.dark .pill-free { background: rgba(34, 197, 94, .18); color: #86efac; }
html.dark .pill-busy { color: #fca5a5; }
html.dark .pill-closed { background: rgba(148, 163, 184, .2); color: #cbd5e1; }
html.dark .pill-unavailable { background: rgba(245, 158, 11, .2); color: #fcd34d; }
.room-now { padding: 12px 16px; border-radius: var(--radius-inner); border: 1px solid var(--border); background: var(--surface); margin-bottom: 14px; }
.room-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 14px; }
.room-nav form { display: inline-flex; gap: 6px; align-items: center; }
.room-nav input[type=date] { width: auto; padding: 5px 8px; }
.room-nav-gap { flex: 1; }
.timeline-rooms { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.timeline-rooms li { display: grid; grid-template-columns: 170px 1fr auto; align-items: center; gap: 12px; padding: 10px 14px; border: 1px solid var(--border-soft); border-radius: 12px; background: var(--surface-2); }
.timeline-rooms li.tl-busy { border-left: 4px solid var(--btn); }
.timeline-rooms li.tl-free { border-left: 4px solid #16a34a; }
.timeline-rooms li.tl-skipped { opacity: .75; border-style: dashed; }
.tl-time { font-weight: 700; font-size: .85rem; color: var(--muted); white-space: nowrap; }
.tl-what { overflow-wrap: anywhere; }
.tl-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.skip-form { display: inline-flex; gap: 6px; align-items: center; }
.skip-form input[type=text] { width: 150px; padding: 5px 8px; font-size: .8rem; }
.week-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(230px, 100%), 1fr)); gap: 12px; margin-bottom: 16px; }
.week-day { margin: 0; padding: 14px 16px; }
.week-day h3 { margin: 0 0 8px; }
.week-day.is-today { border-color: var(--maroon); }
.week-day ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; font-size: .88rem; }
.week-day li { display: grid; gap: 2px; padding-bottom: 8px; border-bottom: 1px solid var(--border-soft); }
.week-day li:last-child { border-bottom: 0; padding-bottom: 0; }
.card-title { padding: 16px 20px 0; margin: 0; }
@media (max-width: 640px) {
  .timeline-rooms li { grid-template-columns: 1fr; gap: 4px; }
  .tl-actions { justify-content: flex-start; }
  .skip-form { flex-wrap: wrap; }
}
.rooms-check input[type=date], .rooms-check input[type=time] { width: auto; min-width: 0; }
.rooms-check input[type=search] { flex: 1 1 200px; min-width: 0; }
@media (max-width: 640px) {
  .rooms-check .inline-label { flex: 1 1 100%; justify-content: space-between; }
  .rooms-check select, .rooms-check input[type=search], .rooms-check .btn { flex: 1 1 100%; width: 100%; }
}

/* ---- room schedule import / export ---- */
.stat-ok .stat-n { color: #16a34a; }
.pad { padding: 0 20px; }
.how-details { margin-top: 16px; }
.how-details summary { cursor: pointer; font-weight: 700; color: var(--heading); }
.how-details table { margin-top: 10px; }
.how-details th { white-space: nowrap; text-transform: none; letter-spacing: 0; vertical-align: top; width: 1%; }
code { background: var(--surface-2); border: 1px solid var(--border-soft); border-radius: 6px; padding: 1px 6px; font-size: .85em; }
.col-help { margin-top: 10px; }
.col-help dd { margin: 0; overflow-wrap: anywhere; }
.col-help dt { font-weight: 700; color: var(--heading); }
code { overflow-wrap: anywhere; }
@media (max-width: 640px) { .col-help { grid-template-columns: 1fr; gap: 2px 0; } .col-help dd { margin-bottom: 8px; } }

/* form columns may shrink below the width of their widest control (a file input is ~240px wide on its own) */
.form { grid-template-columns: minmax(0, 1fr); }
input[type=file] { max-width: 100%; min-width: 0; }

/* ---- borrow: who is returning the items ---- */
.returnee-fields[hidden] { display: none; }
.returnee { margin: 0; }

/* ---- idle timeout warning ---- */
.idle-modal { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: 16px; background: rgba(15, 23, 42, .55); }
.idle-box { width: 100%; max-width: 420px; padding: 28px; border-radius: 16px; background: var(--surface); border: 1px solid var(--border);
  box-shadow: 0 24px 60px -20px rgba(0, 0, 0, .5); display: grid; gap: 12px; }
.idle-box h2 { margin: 0; font-size: 1.2rem; }
.idle-box p { margin: 0; color: var(--muted); font-size: .92rem; line-height: 1.5; }
.idle-box strong { color: var(--btn); font-size: 1.05rem; }
.idle-box .actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 4px; }

/* Details card: the time to take a ticket nobody has taken yet, one item per line */
.kv dd.pickup { display: flex; flex-direction: column; align-items: flex-start; gap: .3rem; }
.kv dd.pickup small { line-height: 1.35; }

/* ---- Profile: choosing the look of the helpdesk ---- */
.theme-opts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-top: 6px; }
.theme-opt { display: block; cursor: pointer; }
.theme-opt input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.theme-card { display: grid; gap: 4px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); height: 100%; }
.theme-card strong { text-transform: none; letter-spacing: normal; }
.theme-card small { color: var(--muted); font-size: .72rem; line-height: 1.35; font-weight: 500; text-transform: none; letter-spacing: normal; }
.theme-opt:hover .theme-card { border-color: var(--maroon); }
.theme-opt input:checked + .theme-card { border-color: var(--btn); box-shadow: 0 0 0 1px var(--btn); background: var(--red-50); }
.theme-opt input:focus-visible + .theme-card { outline: 2px solid var(--btn); outline-offset: 2px; }
.theme-sw { display: block; height: 26px; border-radius: 8px; border: 1px solid rgba(15, 23, 42, .12); }
.theme-sw-device { background: linear-gradient(90deg, #ffffff 50%, #1e293b 50%); }
.theme-sw-light { background: linear-gradient(90deg, #ffffff 60%, #800000 60%); }
.theme-sw-emerald { background: linear-gradient(90deg, #ecfdf5 40%, #059669 40%, #064e3b); }
.theme-sw-dark { background: linear-gradient(90deg, #0f172a 60%, #fbbf24 60%); }
.theme-sw-futuristic { background: linear-gradient(90deg, #070b1a 55%, #e0364a 55%, #fbbf24); }

/* ---- /login: the requests that need no sign-in are tiles with their own big button ---- */
.login-split { grid-template-columns: minmax(300px, 400px) minmax(0, 1fr); max-width: 1180px; gap: 40px; }
.quick-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.quick-tile { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 22px; color: var(--text); text-decoration: none;
  border: 1px solid var(--red-100); border-radius: var(--radius-card); background: linear-gradient(135deg, var(--red-50), var(--surface) 70%); box-shadow: var(--shadow);
  transition: transform .2s, box-shadow .2s, border-color .2s; }
.quick-tile:hover { text-decoration: none; transform: translateY(-3px); box-shadow: var(--shadow-lift); border-color: var(--btn); }
.quick-tile:focus-visible { outline: 2px solid var(--btn); outline-offset: 3px; }
.quick-tile strong { font-size: 1rem; font-weight: 800; color: var(--heading); line-height: 1.3; }
.quick-tile .muted { font-size: .83rem; line-height: 1.5; }
.quick-tile .btn { margin-top: auto; align-self: stretch; justify-content: center; text-align: center; }
.quick-tile .muted { margin-bottom: 6px; }
.quick-ico { width: 48px; height: 48px; border-radius: 14px; background: var(--btn); color: #fff; display: inline-grid; place-items: center; margin-bottom: 4px; }
.quick-jump { display: none; font-size: .8rem; font-weight: 700; }
@media (max-width: 860px) { .login-split { grid-template-columns: 1fr; max-width: 560px; gap: 8px; } .quick-jump { display: inline; } }
@media (max-width: 520px) { .quick-grid { grid-template-columns: 1fr; } }

.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 860px) { .grid-3 { grid-template-columns: 1fr; } }

.close-note { width: 190px; max-width: 100%; margin-right: 6px; }
.notes-list li > span { white-space: pre-wrap; }

/* the release code of a self-service print request */
.release-code { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; padding: 16px 12px; margin: 0 0 14px; border: 2px dashed var(--maroon, #800000); border-radius: 14px; background: var(--surface, #fff); }
.release-label { font-size: .72rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--muted, #64748b); }
.release-value { font-family: ui-monospace, Consolas, monospace; font-size: 2.2rem; letter-spacing: .12em; color: var(--maroon, #800000); }
.release-help { max-width: 520px; font-size: .9rem; color: var(--muted, #64748b); }
.release-inline { font-size: 1.2rem; letter-spacing: .08em; }

/* "Download the Android app" (/android) */
.android-page { max-width: 760px; margin: 0 auto; }
.android-page .card { margin-bottom: 16px; }
.android-page .sha { display: block; margin-top: 4px; overflow-wrap: anywhere; font-size: .78rem; }
.btn-lg { padding: 14px 22px; font-size: 1.1rem; }

/* ticket evidence photos (app/evidence.py) */
.ev-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin: 12px 0; }
.ev-item { margin: 0; border: 1px solid var(--border); border-radius: var(--radius-inner, 10px); overflow: hidden; background: var(--surface); }
.ev-item img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: #e2e8f0; }
.ev-item figcaption { display: flex; flex-direction: column; gap: 3px; padding: 8px 10px; font-size: .85rem; }
.ev-after { border-color: #16a34a; }
.ev-before { border-color: #d97706; }

/* "Where will it be printed?": two big cards instead of small radio buttons */
.print-where { border: 0; padding: 0; margin: 0 0 14px; }
.print-where legend { font-weight: 800; font-size: 1.05rem; padding: 0; margin-bottom: 8px; }
.where-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.where-card { position: relative; display: block; cursor: pointer; }
.where-card input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.where-body { display: flex; flex-direction: column; gap: 6px; height: 100%; padding: 16px 16px 14px; border: 2px solid var(--border); border-radius: 14px; background: var(--surface); transition: border-color .15s, box-shadow .15s, background .15s; }
.where-body strong { font-size: 1.1rem; }
.where-body span, .where-body small { color: var(--muted, #64748b); font-size: .92rem; line-height: 1.35; }
.where-icon { color: var(--maroon); }
.where-card:hover .where-body { border-color: var(--maroon); }
.where-card input:checked + .where-body { border-color: var(--maroon); background: color-mix(in srgb, var(--maroon) 8%, var(--surface)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--maroon) 22%, transparent); }
.where-card input:checked + .where-body::after { content: "\2713"; position: absolute; top: 10px; right: 12px; width: 26px; height: 26px; border-radius: 50%; background: var(--maroon); color: #fff; font-weight: 800; display: flex; align-items: center; justify-content: center; }
.where-card input:focus-visible + .where-body { outline: 3px solid var(--maroon); outline-offset: 2px; }
@media (max-width: 560px) { .where-grid { grid-template-columns: 1fr; } }

/* the global label style (small capitals) must not apply inside the cards */
.print-where .where-card { text-transform: none; letter-spacing: normal; font-weight: 400; font-size: 1rem; color: var(--text, inherit); }
.print-where .where-body strong { font-size: 1.15rem; font-weight: 800; color: var(--text, inherit); text-transform: none; letter-spacing: normal; }
.print-where .where-body span, .print-where .where-body small { text-transform: none; letter-spacing: normal; font-weight: 400; }
.print-where .where-body b { font-weight: 800; color: var(--maroon); }

/* a label next to a taller one (an email with a long hint) keeps its box at the normal height instead of stretching it */
.form label { align-content: start; }

/* New ticket: the box only staff see (who the ticket is for, how the request reached us) */
.staff-box { border: 1px dashed var(--border); border-radius: var(--radius-inner, 10px); padding: 12px 14px 4px; margin: 0 0 16px; }
.staff-box legend { font-size: .72rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 0 6px; }
.staff-box > * + * { margin-top: 12px; }

/* Change calculator at the payment boxes (static/js/changecalc.js) */
.change-calc { margin: 12px 0 6px; padding: 12px 14px; border: 1px dashed var(--border); border-radius: var(--radius-inner, 10px); background: var(--surface); display: grid; gap: 10px; }
.change-calc .cash-quick { display: flex; flex-wrap: wrap; gap: 6px; }
.change-out { margin: 0; font-size: 1.05rem; font-weight: 600; color: var(--muted); }
.change-out strong { font-size: 1.7rem; color: #166534; }
.change-out.ok { color: #166534; }
.change-out.short { color: #b91c1c; }
html.dark .change-out strong, html.dark .change-out.ok { color: #86efac; }
html.dark .change-out.short { color: #fca5a5; }
