/* ─── RISD HELP DESK ──────────────────────────────────────────────────────────
   Same structure and component classes as the Evaluation app (navbar, cards,
   tables, badges, forms), dressed in the Russellville Panthers palette.
   ─────────────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Panthers palette */
  --gold: #D3BC8D;
  --gold-dark: #a8925f;
  --gold-light: #f6f1e6;
  --black: #000000;
  --dark-gray: #565249;
  --light-gray: #B0AEA8;

  --primary: #1a1a1a;
  --primary-dark: #000000;

  --success: #16a34a; --success-light: #f0fdf4;
  --warning: #d97706; --warning-light: #fffbeb;
  --danger:  #dc2626; --danger-light:  #fef2f2;
  --info:    #2563eb; --info-light:    #eff6ff;

  --gray-50: #fafaf9;  --gray-100: #f2f1ef; --gray-200: #e3e1dd; --gray-300: #cfccc6;
  --gray-400: #a29f98; --gray-500: #78756e; --gray-600: #565249; --gray-700: #3a3833;
  --gray-800: #23221f; --gray-900: #111110;

  /* Surfaces & semantic inks (light) — dark values live in the THEMES section */
  --bg: #ecebe8;
  --surface: #ffffff;
  --field: #ffffff;
  --accent-ink: #000000;
  --btn-bg: #1a1a1a; --btn-fg: #ffffff; --btn-bg-hover: #000000; --btn-fg-hover: var(--gold);
  --info-ink: #1d4ed8; --purple-light: #ede9fe; --purple-ink: #6d28d9;
  --warning-ink: #b45309; --success-ink: #15803d; --danger-ink: #b91c1c;
  --danger-border: #fca5a5; --success-border: #6ee7b7;
  --note-bg: #fffbeb; --note-border: #fcd34d;

  --font: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --radius: 6px;
  --radius-sm: 3px;
  --shadow: 0 1px 3px rgba(0,0,0,.10), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 10px rgba(0,0,0,.10), 0 2px 4px rgba(0,0,0,.06);
  --nav-height: 4.3rem;
}

html { font-size: 14px; -webkit-text-size-adjust: 100%; color-scheme: light; }
body {
  font-family: var(--font); font-size: 1rem; line-height: 1.5;
  color: var(--gray-800); background: var(--bg); min-height: 100vh;
  display: flex; flex-direction: column;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; color: var(--primary-dark); }
.muted { color: var(--gray-500); }
.small { font-size: 0.8929rem; }
.nowrap { white-space: nowrap; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.mt-1 { margin-top: .5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 1.5rem; }
.mb-2 { margin-bottom: 1rem; }
.hidden { display: none !important; }
.show-sm { display: none; }

/* ─── NAVBAR ────────────────────────────────────────────────────────────────── */
.navbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: var(--nav-height); background: var(--black);
  border-bottom: 3px solid var(--gold);
  display: flex; align-items: center; padding: 0 1.5rem;
  box-shadow: 0 2px 6px rgba(0,0,0,.3);
}
.navbar-brand { margin-right: 1.75rem; flex-shrink: 0; }
.brand-link { display: flex; align-items: center; gap: .6rem; text-decoration: none; }
.brand-link:hover { text-decoration: none; }
.brand-logo-img { height: 2.7rem; width: auto; flex-shrink: 0; }
.brand-text { font-weight: 800; font-size: 1.071rem; color: var(--gold); letter-spacing: .08em; text-transform: uppercase; }
.brand-district { font-size: 0.7857rem; color: rgba(255,255,255,.55); margin-left: .15rem; }

.navbar-menu { display: flex; align-items: center; gap: .2rem; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.navbar-menu::-webkit-scrollbar { display: none; }
.nav-link {
  display: flex; align-items: center; gap: .4rem; white-space: nowrap; flex-shrink: 0;
  padding: .4rem .8rem; border-radius: 4px;
  color: rgba(255,255,255,.82); font-size: 0.9643rem; font-weight: 500; transition: all .15s;
}
.nav-link:hover { background: #222; color: #fff; text-decoration: none; }
.nav-link.active { background: #2b2a27; color: var(--gold); }
.nav-icon { width: 1.15rem; height: 1.15rem; flex-shrink: 0; }
.nav-count { background: var(--gold); color: #000; border-radius: 999px; font-size: 0.7857rem; font-weight: 700; padding: 0 .4rem; line-height: 1.5; }

.navbar-user { display: flex; align-items: center; gap: .7rem; margin-left: 1rem; flex-shrink: 0; }
.user-name { font-size: 0.9286rem; font-weight: 500; color: rgba(255,255,255,.85); }
.btn-logout {
  border: 1px solid rgba(255,255,255,.3); background: transparent; color: rgba(255,255,255,.8);
  padding: .3rem .75rem; border-radius: 4px; font-size: 0.8929rem; cursor: pointer; font-family: var(--font); transition: all .15s;
}
.btn-logout:hover { background: rgba(255,255,255,.1); color: #fff; border-color: rgba(255,255,255,.6); text-decoration: none; }

/* ─── PAGE LAYOUT ───────────────────────────────────────────────────────────── */
main { flex: 1; }
.page-container { max-width: 1240px; margin: 0 auto; padding: calc(var(--nav-height) + 1.5rem) 1.5rem 2rem; }
.page-narrow { max-width: 54rem; }
.page-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 1.5rem; gap: 1rem; }
.page-title { font-size: 1.571rem; font-weight: 700; color: var(--gray-900); }
.page-subtitle { font-size: 0.9286rem; color: var(--gray-500); margin-top: .2rem; }
.page-actions { display: flex; gap: .5rem; flex-shrink: 0; flex-wrap: wrap; }
.breadcrumb { font-size: 0.8571rem; color: var(--gray-500); display: inline-block; margin-bottom: .4rem; }
.breadcrumb:hover { color: var(--primary); }

.footer { text-align: center; padding: 1.25rem; font-size: 0.8571rem; color: var(--gray-500); }

/* ─── CARDS ─────────────────────────────────────────────────────────────────── */
.card { background: var(--surface); border-radius: var(--radius); border: 1px solid var(--gray-200); box-shadow: var(--shadow); overflow: hidden; }
.card + .card { margin-top: 1.25rem; }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .8rem 1.25rem; border-bottom: 1px solid var(--gray-200); background: var(--gray-50); }
.card-title { font-size: 1rem; font-weight: 700; color: var(--gray-800); }
.card-body { padding: 1.1rem 1.25rem; }
.card-footer { padding: .7rem 1.25rem; border-top: 1px solid var(--gray-200); font-size: 0.9286rem; background: var(--gray-50); }
.card-accent { border-top: 3px solid var(--gold); }

/* ─── BUTTONS ───────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .35rem;
  padding: .48rem 1rem; border-radius: var(--radius-sm); font-size: 0.9643rem; font-weight: 600;
  cursor: pointer; border: 1px solid transparent; transition: all .15s; white-space: nowrap; font-family: var(--font);
  text-decoration: none; line-height: 1.3;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--btn-bg); color: var(--btn-fg); border-color: var(--btn-bg); }
.btn-primary:hover { background: var(--btn-bg-hover); border-color: var(--btn-bg-hover); color: var(--btn-fg-hover); }
.btn-gold { background: var(--gold); color: #000; border-color: var(--gold); }
.btn-gold:hover { background: var(--gold-dark); border-color: var(--gold-dark); color: #000; }
.btn-outline { background: var(--surface); color: var(--gray-700); border-color: var(--gray-400); }
.btn-outline:hover { background: var(--gray-100); color: var(--gray-900); border-color: var(--gray-700); }
.btn-ghost { background: transparent; color: var(--gray-600); }
.btn-ghost:hover { background: var(--gray-100); color: var(--gray-800); }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger-outline { background: var(--surface); color: var(--danger); border-color: var(--danger-border); }
.btn-danger-outline:hover { background: var(--danger-light); color: var(--danger); }
.btn-success { background: var(--success); color: #fff; border-color: var(--success); }
.btn-success:hover { background: #15803d; color: #fff; }
.btn-full { width: 100%; }
.btn-sm { padding: .3rem .75rem; font-size: 0.8929rem; }
.btn-xs { padding: .18rem .5rem; font-size: 0.8571rem; }

/* ─── FORMS ─────────────────────────────────────────────────────────────────── */
.form-control {
  display: block; width: 100%; padding: .5rem .75rem;
  border: 1px solid var(--gray-300); border-radius: var(--radius-sm);
  font-size: 1rem; font-family: var(--font); color: var(--gray-800); background: var(--field);
  transition: border-color .15s, box-shadow .15s;
}
.form-control:focus { outline: none; border-color: var(--gold-dark); box-shadow: 0 0 0 3px rgba(211,188,141,.35); }
textarea.form-control { resize: vertical; min-height: 110px; line-height: 1.5; }
select.form-control { padding-right: 2rem; }
.form-group { margin-bottom: 1rem; }
.form-group label, .label { display: block; font-size: 0.9286rem; font-weight: 600; color: var(--gray-700); margin-bottom: .35rem; }
.form-hint { font-size: 0.8571rem; color: var(--gray-500); margin-top: .3rem; }
.required { color: var(--danger); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1rem; }
.form-actions { display: flex; gap: .5rem; align-items: center; padding: 1rem 1.25rem; border-top: 1px solid var(--gray-200); background: var(--gray-50); }
.checkbox-label { display: inline-flex; align-items: center; gap: .45rem; cursor: pointer; font-size: 0.9643rem; font-weight: 500; }
.checkbox-label input { width: 1.1rem; height: 1.1rem; accent-color: var(--accent-ink); }
.inline-form { display: inline; }

.filter-bar { display: flex; gap: .5rem; margin-bottom: 1rem; flex-wrap: wrap; align-items: center; }
.filter-bar .form-control { width: auto; min-width: 140px; font-size: 0.9286rem; padding: .4rem .6rem; }
.filter-bar .filter-search { flex: 1; min-width: 200px; }

/* ─── TABS (queue views) ────────────────────────────────────────────────────── */
.tabs { display: flex; gap: .25rem; border-bottom: 2px solid var(--gray-200); margin-bottom: 1rem; overflow-x: auto; }
.tab { padding: .55rem .95rem; font-size: 0.9643rem; font-weight: 600; color: var(--gray-500); border-bottom: 3px solid transparent; margin-bottom: -2px; white-space: nowrap; }
.tab:hover { color: var(--gray-800); text-decoration: none; }
.tab.active { color: var(--gray-900); border-bottom-color: var(--gold); }

/* ─── TABLES ────────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { padding: .6rem 1rem; text-align: left; font-size: 0.8214rem; font-weight: 700; color: var(--gray-600); text-transform: uppercase; letter-spacing: .05em; background: var(--gray-100); border-bottom: 1px solid var(--gray-200); white-space: nowrap; }
.table td { padding: .65rem 1rem; font-size: 0.9643rem; border-bottom: 1px solid var(--gray-100); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: none; }
.table-hover tbody tr:hover { background: var(--gold-light); }
.table-sm th, .table-sm td { padding: .4rem .75rem; font-size: 0.8929rem; }
.table-link { color: var(--gray-900); font-weight: 600; }
.table-link:hover { color: var(--gray-900); text-decoration: underline; }
.row-urgent td:first-child { box-shadow: inset 3px 0 0 var(--danger); }
.row-high td:first-child { box-shadow: inset 3px 0 0 var(--warning); }
.ticket-num { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.8929rem; color: var(--gray-500); }
.sub-line { font-size: 0.8571rem; color: var(--gray-500); margin-top: .1rem; }

/* ─── BADGES / CHIPS ────────────────────────────────────────────────────────── */
.badge { display: inline-flex; align-items: center; gap: .3rem; padding: .18rem .55rem; border-radius: 999px; font-size: 0.7857rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; }
.status-new         { background: var(--gold); color: #000; }
.status-open        { background: var(--info-light); color: var(--info-ink); }
.status-in_progress { background: var(--purple-light); color: var(--purple-ink); }
.status-waiting     { background: var(--warning-light); color: var(--warning-ink); }
.status-resolved    { background: var(--success-light); color: var(--success-ink); }
.status-closed      { background: var(--gray-100); color: var(--gray-500); }

.prio { display: inline-flex; align-items: center; gap: .3rem; font-size: 0.8571rem; font-weight: 600; white-space: nowrap; }
.prio::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--gray-300); }
.prio-low::before    { background: var(--gray-300); }
.prio-normal::before { background: var(--gray-500); }
.prio-high           { color: var(--warning-ink); } .prio-high::before { background: var(--warning); }
.prio-urgent         { color: var(--danger-ink); } .prio-urgent::before { background: var(--danger); box-shadow: 0 0 0 3px rgba(220,38,38,.18); }

.dept-chip { display: inline-flex; align-items: center; gap: .35rem; padding: .15rem .55rem; border-radius: 3px; font-size: 0.8571rem; font-weight: 600; white-space: nowrap; background: var(--gray-100); color: var(--gray-800); }
.dept-chip::before { content: ''; width: 8px; height: 8px; border-radius: 2px; background: var(--dept, var(--gray-500)); }
.role-badge { display: inline-flex; padding: .12rem .45rem; border-radius: 3px; font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.role-admin { background: var(--gold); color: #000; }
.role-tech  { background: #2b2a27; color: var(--gold); border: 1px solid #4a4842; }
.role-user  { background: #333; color: #ddd; }
.tag { display: inline-flex; padding: .15rem .5rem; background: var(--gray-100); color: var(--gray-700); border-radius: 3px; font-size: 0.8571rem; font-weight: 500; }
.avatar { width: 2.15rem; height: 2.15rem; border-radius: 50%; background: #2b2a27; color: var(--gold); display: inline-flex; align-items: center; justify-content: center; font-size: 0.8214rem; font-weight: 700; flex-shrink: 0; }
.avatar-staff { background: #000; }
.avatar-req { background: var(--gold); color: #000; }

/* Response waiting */
.new-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); margin-right: .4rem; vertical-align: middle; }
.table-link.is-unread { font-weight: 800; }
.badge-waiting { background: var(--danger-light); color: var(--danger); font-size: 0.7143rem; padding: .1rem .45rem; vertical-align: middle; }
.waiting-card { border-top: 3px solid var(--danger); }
.msg-new .msg-bubble { box-shadow: 0 0 0 2px var(--gold), var(--shadow); }
.new-flag { font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: #000; background: var(--gold); padding: .05rem .4rem; border-radius: 3px; margin-left: .35rem; }

/* ─── ALERTS ────────────────────────────────────────────────────────────────── */
.alert { padding: .75rem 1rem; border-radius: 4px; margin-bottom: 1rem; font-size: 0.9643rem; }
.alert-error   { background: var(--danger-light); color: var(--danger-ink); border: 1px solid var(--danger-border); }
.alert-success { background: var(--success-light); color: var(--success-ink); border: 1px solid var(--success-border); }
.alert-info    { background: var(--gold-light); color: var(--gray-800); border: 1px solid var(--gold); }

/* ─── DASHBOARD ─────────────────────────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card { background: var(--surface); border-radius: var(--radius); border: 1px solid var(--gray-200); padding: 1.1rem 1.25rem; box-shadow: var(--shadow); border-left: 4px solid var(--gold); display: block; color: inherit; }
a.stat-card:hover { text-decoration: none; box-shadow: var(--shadow-md); transform: translateY(-1px); }
.stat-card-dark { border-left-color: var(--accent-ink); }
.stat-card-warn { border-left-color: var(--warning); }
.stat-card-ok   { border-left-color: var(--success); }
.stat-value { font-size: 2rem; font-weight: 800; color: var(--gray-900); line-height: 1; }
.stat-label { font-size: 0.8929rem; color: var(--gray-500); margin-top: .4rem; font-weight: 600; }

.dashboard-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.dashboard-grid .card + .card { margin-top: 0; }
.span-2 { grid-column: 1 / -1; }

.dept-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(15.5rem, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.dept-card { background: var(--surface); border: 1px solid var(--gray-200); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem 1.25rem; border-top: 4px solid var(--dept); }
.dept-card h3 { font-size: 1.071rem; font-weight: 700; margin-bottom: .5rem; }
.dept-card-stats { display: flex; gap: 1.25rem; }
.dept-card-stats a { color: inherit; }
.dept-card-stats .n { font-size: 1.429rem; font-weight: 800; display: block; line-height: 1.1; }
.dept-card-stats .l { font-size: 0.8214rem; color: var(--gray-500); font-weight: 600; }

.empty-state { padding: 2.25rem 1.5rem; text-align: center; color: var(--gray-400); font-size: 1rem; }
.empty-state strong { display: block; color: var(--gray-600); margin-bottom: .25rem; }

/* ─── SERVICE PICKER (new ticket) ───────────────────────────────────────────── */
.service-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.service-card { position: relative; display: block; background: var(--surface); border: 2px solid var(--gray-200); border-radius: 8px; padding: 1.25rem; cursor: pointer; transition: all .15s; color: inherit; }
.service-card:hover { border-color: var(--dept); box-shadow: var(--shadow-md); text-decoration: none; transform: translateY(-1px); }
.service-card input { position: absolute; opacity: 0; pointer-events: none; }
.service-card.selected, .service-card:has(input:checked) { border-color: var(--dept); box-shadow: 0 0 0 3px color-mix(in srgb, var(--dept) 25%, transparent); }
.service-icon { width: 3.15rem; height: 3.15rem; border-radius: 10px; display: flex; align-items: center; justify-content: center; background: var(--dept); color: #fff; margin-bottom: .75rem; }
.service-icon svg { width: 1.7rem; height: 1.7rem; }
.service-name { font-size: 1.143rem; font-weight: 800; margin-bottom: .25rem; }
.service-desc { font-size: 0.8929rem; color: var(--gray-500); line-height: 1.45; }
.service-check { position: absolute; top: .8rem; right: .8rem; width: 1.55rem; height: 1.55rem; border-radius: 50%; border: 2px solid var(--gray-300); }
.service-card:has(input:checked) .service-check { background: var(--dept); border-color: var(--dept); box-shadow: inset 0 0 0 3px var(--surface); }

.prio-picker { display: flex; gap: .4rem; flex-wrap: wrap; }
.prio-picker label { margin: 0; }
.prio-picker input { display: none; }
.prio-picker span { display: inline-block; padding: .4rem .9rem; border: 1px solid var(--gray-300); border-radius: 999px; font-size: 0.9286rem; font-weight: 600; cursor: pointer; background: var(--surface); }
.prio-picker input:checked + span { background: var(--btn-bg); color: var(--btn-fg); border-color: var(--btn-bg); }
.prio-picker input[value=urgent]:checked + span { background: var(--danger); color: #fff; border-color: var(--danger); }

.file-drop { display: block; border: 2px dashed var(--gray-300); border-radius: 6px; padding: .9rem; text-align: center; color: var(--gray-500); font-size: 0.9286rem; background: var(--gray-50); cursor: pointer; }
.file-drop:hover, .file-drop.drag { border-color: var(--gold-dark); background: var(--gold-light); }
.file-drop input { display: none; }
.file-list { list-style: none; margin-top: .4rem; font-size: 0.8929rem; color: var(--gray-600); }

/* ─── TICKET DETAIL ─────────────────────────────────────────────────────────── */
.ticket-layout { display: grid; grid-template-columns: minmax(0, 1fr) 24.5rem; gap: 1.25rem; align-items: start; }
.ticket-side .card + .card { margin-top: 1rem; }
.ticket-head { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-top: .5rem; }

.thread { display: flex; flex-direction: column; gap: 1rem; }
.msg { display: flex; gap: .75rem; }
.msg-bubble { flex: 1; min-width: 0; background: var(--surface); border: 1px solid var(--gray-200); border-radius: var(--radius); box-shadow: var(--shadow); }
.msg-head { display: flex; justify-content: space-between; gap: .5rem; padding: .55rem 1rem; border-bottom: 1px solid var(--gray-100); font-size: 0.8929rem; color: var(--gray-500); }
.msg-head strong { color: var(--gray-800); font-size: 0.9286rem; }
.msg-body { padding: .85rem 1rem; white-space: pre-wrap; word-wrap: break-word; font-size: 1rem; }
.msg-original .msg-bubble { border-top: 3px solid var(--gold); }
.msg-note .msg-bubble { background: var(--note-bg); border-color: var(--note-border); }
.msg-note .msg-head { border-bottom-color: var(--note-border); }
.note-flag { font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--warning-ink); background: var(--warning-light); padding: .05rem .4rem; border-radius: 3px; margin-left: .35rem; }
.msg-files { display: flex; flex-wrap: wrap; gap: .5rem; padding: 0 1rem .85rem; }
.file-chip { display: inline-flex; align-items: center; gap: .35rem; border: 1px solid var(--gray-200); border-radius: 4px; padding: .3rem .55rem; font-size: 0.8929rem; background: var(--gray-50); color: var(--gray-700); max-width: 260px; }
.file-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-thumb { display: block; width: 8.5rem; height: 6.4rem; object-fit: cover; border-radius: 4px; border: 1px solid var(--gray-200); }

.sys-event { display: flex; align-items: center; gap: .55rem; padding: .1rem 0 .1rem .6rem; margin-left: 15px; border-left: 2px solid var(--gray-200); font-size: 0.8929rem; color: var(--gray-500); }
.sys-event b { color: var(--gray-700); font-weight: 600; }
.sys-event .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--gray-300); margin-left: -1.05rem; flex-shrink: 0; border: 2px solid var(--bg); box-sizing: content-box; }
.sys-transfer { display: block; margin-left: 15px; padding: .7rem 1rem; border: 1px solid var(--gold); background: var(--gold-light); border-radius: var(--radius); font-size: 0.9286rem; }
.sys-transfer .why { margin-top: .35rem; white-space: pre-wrap; color: var(--gray-700); }

.reply-box { margin-top: 1.25rem; }
.reply-tabs { display: flex; gap: 0; border-bottom: 1px solid var(--gray-200); background: var(--gray-50); }
.reply-tabs label { padding: .6rem 1.1rem; font-size: 0.9286rem; font-weight: 600; color: var(--gray-500); cursor: pointer; border-bottom: 3px solid transparent; }
.reply-tabs input { display: none; }
.reply-tabs label:has(input:checked) { color: var(--gray-900); border-bottom-color: var(--gold); background: var(--surface); }
.reply-tabs label.note-tab:has(input:checked) { border-bottom-color: var(--warning); background: var(--note-bg); }
.reply-box.is-note textarea { background: var(--note-bg); border-color: var(--note-border); }
.reply-foot { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; justify-content: space-between; padding: .75rem 1.25rem; border-top: 1px solid var(--gray-200); background: var(--gray-50); }
.reply-foot .form-control { width: auto; font-size: 0.9286rem; padding: .35rem .5rem; }

.detail-list { padding: .25rem 0; }
.detail-row { display: flex; gap: .75rem; padding: .45rem 1.25rem; font-size: 0.9286rem; }
.detail-row dt { width: 6.8rem; flex-shrink: 0; color: var(--gray-500); font-weight: 600; font-size: 0.8571rem; text-transform: uppercase; letter-spacing: .03em; padding-top: .1rem; }
.detail-row dd { flex: 1; min-width: 0; color: var(--gray-800); word-wrap: break-word; }

.transfer-card { border-top: 3px solid var(--gold); }
.transfer-card .card-body p { font-size: 0.8929rem; color: var(--gray-500); margin-bottom: .75rem; }

/* ─── LOGIN ─────────────────────────────────────────────────────────────────── */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1.5rem;
  background: radial-gradient(ellipse at top, #2b2a27 0%, #000 70%); }
.login-card { background: var(--surface); border-radius: 8px; padding: 2.25rem 2.25rem 2rem; width: 100%; max-width: 30rem; box-shadow: 0 20px 60px rgba(0,0,0,.5); border-top: 5px solid var(--gold); }
.login-header { text-align: center; margin-bottom: 1.75rem; }
.login-logo-img { height: 5.6rem; width: auto; margin-bottom: .6rem; }
.login-header h1 { font-size: 1.429rem; font-weight: 800; color: var(--gray-900); letter-spacing: .02em; }
.login-subtitle { font-size: 0.9286rem; color: var(--gold-dark); font-weight: 700; text-transform: uppercase; letter-spacing: .14em; margin-top: .2rem; }
.sso-btn { background: #1a73e8; border-color: #1a73e8; margin-bottom: 1rem; color: #fff; }
.sso-btn:hover { background: #1558b3; border-color: #1558b3; color: #fff; }
.login-divider { display: flex; align-items: center; gap: .75rem; margin: 1.1rem 0; color: var(--gray-400); font-size: 0.8571rem; text-transform: uppercase; letter-spacing: .04em; }
.login-divider::before, .login-divider::after { content: ''; flex: 1; height: 1px; background: var(--gray-200); }

/* ─── ERROR PAGE ────────────────────────────────────────────────────────────── */
.error-page { text-align: center; padding: 4rem 2rem; }
.error-icon { font-size: 3.143rem; margin-bottom: 1rem; }
.error-title { font-size: 1.571rem; font-weight: 700; margin-bottom: .75rem; }
.error-message { color: var(--gray-500); margin-bottom: 1.5rem; max-width: 520px; margin-left: auto; margin-right: auto; }

/* ─── ADMIN ─────────────────────────────────────────────────────────────────── */
.admin-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.admin-card { background: var(--surface); border-radius: var(--radius); border: 1px solid var(--gray-200); padding: 1.4rem; box-shadow: var(--shadow); display: block; color: inherit; transition: all .2s; border-top: 3px solid transparent; }
.admin-card:hover { border-top-color: var(--gold); box-shadow: var(--shadow-md); transform: translateY(-1px); text-decoration: none; }
.admin-card-icon { font-size: 1.857rem; margin-bottom: .6rem; }
.admin-card-title { font-size: 1.071rem; font-weight: 700; color: var(--gray-800); margin-bottom: .25rem; }
.admin-card-stat { font-size: 0.8929rem; color: var(--gold-dark); font-weight: 700; margin-bottom: .25rem; }
.admin-card-desc { font-size: 0.8929rem; color: var(--gray-500); }

.member-table td { vertical-align: middle; }
.dept-check { border: 1px solid var(--gray-200); border-radius: 6px; padding: .65rem .8rem; margin-bottom: .5rem; display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; }
.dept-check .opts { display: flex; gap: 1rem; margin-left: auto; }
.color-input { width: 52px; height: 36px; padding: 2px; border: 1px solid var(--gray-300); border-radius: 3px; background: var(--field); }

/* ─── REPORTS ───────────────────────────────────────────────────────────────── */
.bar-row { display: flex; align-items: center; gap: .75rem; padding: .35rem 1.25rem; }
.bar-label { width: 15rem; font-size: 0.8929rem; color: var(--gray-700); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex-shrink: 0; }
.bar-track { flex: 1; background: var(--gray-100); border-radius: 3px; height: 12px; overflow: hidden; display: flex; }
.bar-fill { height: 100%; background: var(--dept, var(--gray-700)); }
.bar-count { width: 34px; text-align: right; font-size: 0.8929rem; font-weight: 700; color: var(--gray-700); flex-shrink: 0; }

/* ─── USER MENU (display settings, password, sign out) ──────────────────────── */
.user-menu { position: relative; }
.user-menu > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: .5rem; padding: .3rem .55rem .3rem .3rem; border-radius: 999px; border: 1px solid rgba(255,255,255,.25); color: rgba(255,255,255,.9); font-size: .9286rem; font-weight: 500; }
.user-menu > summary::-webkit-details-marker { display: none; }
.user-menu > summary:hover, .user-menu[open] > summary { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.5); }
.user-menu .avatar { width: 1.9rem; height: 1.9rem; font-size: .75rem; }
.user-menu .caret { font-size: .7rem; opacity: .7; }
.menu-panel { position: absolute; right: 0; top: calc(100% + 8px); width: 19rem; max-width: calc(100vw - 1.5rem); background: var(--surface); color: var(--gray-800); border: 1px solid var(--gray-200); border-radius: 8px; box-shadow: 0 10px 30px rgba(0,0,0,.25); padding: .5rem; z-index: 300; }
.menu-head { padding: .5rem .6rem .6rem; border-bottom: 1px solid var(--gray-100); margin-bottom: .4rem; }
.menu-head b { display: block; color: var(--gray-900); }
.menu-section { padding: .4rem .6rem .6rem; }
.menu-label { font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--gray-500); margin-bottom: .4rem; }
.seg { display: flex; border: 1px solid var(--gray-300); border-radius: 6px; overflow: hidden; }
.seg button { flex: 1; border: 0; background: var(--surface); color: var(--gray-700); font-family: var(--font); font-weight: 600; font-size: .9rem; padding: .55rem .3rem; cursor: pointer; min-height: 2.6rem; }
.seg button + button { border-left: 1px solid var(--gray-300); }
.seg button:hover { background: var(--gray-100); }
.seg button.on { background: var(--btn-bg); color: var(--btn-fg); }
.seg .size-a { line-height: 1; }
.seg .size-a.s1 { font-size: .9rem; } .seg .size-a.s2 { font-size: 1.1rem; } .seg .size-a.s3 { font-size: 1.35rem; }
.menu-link { display: flex; align-items: center; gap: .5rem; width: 100%; padding: .6rem .6rem; border-radius: 5px; color: var(--gray-800); font-weight: 500; font-size: 1rem; background: none; border: 0; font-family: var(--font); cursor: pointer; text-align: left; }
.menu-link:hover { background: var(--gray-100); text-decoration: none; color: var(--gray-900); }
.menu-sep { height: 1px; background: var(--gray-100); margin: .35rem 0; }
.display-strip { margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid var(--gray-200); }
.display-strip .menu-label { text-align: center; }

/* Works-at picker on the user page */
.works-at { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--gray-100); }
.seg-opt { flex: 1; display: flex; align-items: center; justify-content: center; gap: .4rem; padding: .55rem .5rem; font-weight: 600; font-size: .95rem; cursor: pointer; background: var(--surface); color: var(--gray-700); min-height: 2.6rem; }
.seg-opt + .seg-opt { border-left: 1px solid var(--gray-300); }
.seg-opt:has(input:checked) { background: var(--btn-bg); color: var(--btn-fg); }
.seg-opt input { display: none; }
.works-at-blds { display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; margin-top: .75rem; }

/* ─── THEMES ────────────────────────────────────────────────────────────────
   Light is the default (:root). Dark applies when the person picks Dark, or picks
   Auto and their device is in dark mode. The gray scale is flipped so every
   component that uses it follows automatically. */
html.theme-dark { color-scheme: dark;
  --bg: #0e0e0d; --surface: #1a1917; --field: #121211;
  --gray-50: #201f1d; --gray-100: #282725; --gray-200: #353430; --gray-300: #4a4843;
  --gray-400: #6d6a63; --gray-500: #9b988f; --gray-600: #b9b6ae; --gray-700: #d3d0c9;
  --gray-800: #e9e7e2; --gray-900: #f7f6f3;
  --primary: var(--gold); --primary-dark: #e9dcbf; --accent-ink: var(--gold);
  --gold-light: #2a251a; --gold-dark: #c9b07a;
  --btn-bg: var(--gold); --btn-fg: #000; --btn-bg-hover: #e2cfa6; --btn-fg-hover: #000;
  --info-light: #172554; --info-ink: #93c5fd; --purple-light: #2e1065; --purple-ink: #c4b5fd;
  --warning-light: #3a2a0c; --warning-ink: #fbbf24; --success-light: #0b2e1a; --success-ink: #6ee7a0;
  --danger-light: #3b1212; --danger-ink: #fca5a5; --danger-border: #7f1d1d; --success-border: #166534;
  --note-bg: #2c2410; --note-border: #7c5f13;
  --shadow: 0 1px 3px rgba(0,0,0,.5); --shadow-md: 0 4px 12px rgba(0,0,0,.55);
}
@media (prefers-color-scheme: dark) {
  html.theme-auto { color-scheme: dark;
    --bg: #0e0e0d; --surface: #1a1917; --field: #121211;
    --gray-50: #201f1d; --gray-100: #282725; --gray-200: #353430; --gray-300: #4a4843;
    --gray-400: #6d6a63; --gray-500: #9b988f; --gray-600: #b9b6ae; --gray-700: #d3d0c9;
    --gray-800: #e9e7e2; --gray-900: #f7f6f3;
    --primary: var(--gold); --primary-dark: #e9dcbf; --accent-ink: var(--gold);
    --gold-light: #2a251a; --gold-dark: #c9b07a;
    --btn-bg: var(--gold); --btn-fg: #000; --btn-bg-hover: #e2cfa6; --btn-fg-hover: #000;
    --info-light: #172554; --info-ink: #93c5fd; --purple-light: #2e1065; --purple-ink: #c4b5fd;
    --warning-light: #3a2a0c; --warning-ink: #fbbf24; --success-light: #0b2e1a; --success-ink: #6ee7a0;
    --danger-light: #3b1212; --danger-ink: #fca5a5; --danger-border: #7f1d1d; --success-border: #166534;
    --note-bg: #2c2410; --note-border: #7c5f13;
    --shadow: 0 1px 3px rgba(0,0,0,.5); --shadow-md: 0 4px 12px rgba(0,0,0,.55);
  }
}
/* A few dark-mode touches the tokens can't express */
html.theme-dark .navbar { border-bottom-color: #8f7d55; }
html.theme-dark .login-page { background: radial-gradient(ellipse at top, #1f1d19 0%, #000 70%); }
html.theme-dark .dept-chip { background: var(--gray-100); }
html.theme-dark .avatar-staff { background: #33312c; }
@media (prefers-color-scheme: dark) {
  html.theme-auto .navbar { border-bottom-color: #8f7d55; }
  html.theme-auto .dept-chip { background: var(--gray-100); }
  html.theme-auto .avatar-staff { background: #33312c; }
}

/* ─── TEXT SIZE ─────────────────────────────────────────────────────────────
   Every size in this file is in rem, so changing the root size scales text,
   spacing, icons and the nav together. */
html.text-large  { font-size: 16.5px; }
html.text-xlarge { font-size: 19px; }

/* Bigger text needs room: switch to the stacked/compact layouts earlier. */
@media (max-width: 1500px) {
  html.text-xlarge .ticket-layout, html.text-xlarge .dashboard-grid { grid-template-columns: 1fr; }
}
@media (max-width: 1300px) {
  html.text-large .ticket-layout, html.text-large .dashboard-grid { grid-template-columns: 1fr; }
}
@media (max-width: 1350px) {
  html.text-xlarge .brand-text, html.text-xlarge .brand-district,
  html.text-xlarge .user-menu .user-label { display: none; }
}
@media (max-width: 1200px) {
  html.text-xlarge .hide-sm { display: none; }
  html.text-xlarge .show-sm { display: inline; }
  html.text-xlarge .stats-grid { grid-template-columns: repeat(2, 1fr); }
  html.text-xlarge .form-row-3 { grid-template-columns: 1fr; }
  html.text-xlarge .nav-link .nav-label { display: none; }
  html.text-xlarge .nav-link { padding: .45rem .6rem; }
}
@media (max-width: 1000px) {
  html.text-large .hide-sm { display: none; }
  html.text-large .show-sm { display: inline; }
  html.text-large .form-row, html.text-large .form-row-3, html.text-xlarge .form-row { grid-template-columns: 1fr; }
  html.text-large .brand-text, html.text-large .user-menu .user-label { display: none; }
}

/* ─── RESPONSIVE ────────────────────────────────────────────────────────────── */
@media (max-width: 1000px) {
  .ticket-layout { grid-template-columns: 1fr; }
  .dashboard-grid { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .admin-grid { grid-template-columns: 1fr 1fr; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .user-name, .brand-district { display: none; }
  .hide-sm { display: none; }
  .show-sm { display: inline; }
}
@media (max-width: 640px) {
  .form-control { font-size: max(16px, 1rem); }
  .btn { min-height: 2.6rem; }
  .btn-xs { min-height: 2.2rem; }
  .user-menu .user-label { display: none; }
  .service-grid { gap: .6rem; }
  .service-card { display: grid; grid-template-columns: auto 1fr; column-gap: .9rem; align-items: start; padding: .9rem 2.6rem .9rem .9rem; }
  .service-card .service-icon { grid-row: span 2; margin-bottom: 0; }
  .navbar { padding: 0 .75rem; }
  .navbar-brand { margin-right: .75rem; }
  .brand-text { display: none; }
  .nav-link { padding: .4rem .55rem; }
  .nav-link .nav-label { display: none; }
  .page-container { padding-left: 1rem; padding-right: 1rem; }
  .page-header { flex-direction: column; }
  .admin-grid { grid-template-columns: 1fr; }
  .bar-label { width: 120px; }
}
@media print {
  .navbar, .page-actions, .btn, .filter-bar, .reply-box, .ticket-side form, .footer { display: none !important; }
  .page-container { padding-top: 1rem; max-width: 100%; }
  .ticket-layout { grid-template-columns: 1fr; }
  .card { box-shadow: none; }
}

/* ── Building-admin approval ───────────────────────────────────────────── */
.badge-approval { background: #fff3cd; color: #7a5200; border: 1px solid #e6c36a; }
html.theme-dark .badge-approval { background: #3a2f10; color: #f1d58a; border-color: #7a6320; }
.approve-card { border-left: 4px solid var(--gold, #D3BC8D); margin-bottom: 1rem; }
.approve-form { display: flex; flex-wrap: wrap; gap: .75rem 1.25rem; align-items: center; justify-content: space-between; padding: 1rem 1.25rem; }
.approve-text { display: flex; flex-direction: column; gap: .15rem; min-width: 14rem; flex: 1 1 14rem; }
.approve-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.approve-actions .form-control { width: auto; min-width: 12rem; }
.approve-list { list-style: none; margin: 0; padding: 0; }
.approve-list li { display: flex; gap: 1rem; align-items: center; justify-content: space-between; padding: .75rem 1.25rem; border-top: 1px solid var(--border, #ddd); }
.approve-list li:first-child { border-top: 0; }
.approve-info { min-width: 0; flex: 1; }
@media (max-width: 600px) { .approve-actions, .approve-actions .form-control, .approve-actions .btn { width: 100%; } .approve-list li { flex-wrap: wrap; } .approve-list .btn { width: 100%; } }
