/* ============================================================
   IT Realm — Staff Admin UI
   Combined: Super Admin + Technician
   Tokens: Navy #1B2A4A · Teal #2A7F8F · Gold #C9A84C
   Body: DM Sans · Heading: Sora · Mono: DM Mono
   ============================================================ */

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
  font-family: 'DM Sans', sans-serif;
  background: #F4F5F8;
  color: #1B2A4A;
  min-height: 100vh;
}
a { text-decoration: none; color: inherit; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }

/* ── Design tokens ── */
:root {
  --navy:    #1B2A4A;
  --navy-2:  #243A63;
  --navy-3:  #0D1625;
  --gold:    #C9A84C;
  --gold-2:  #B8943A;
  --teal:    #2A7F8F;
  --teal-2:  #226A79;
  --green:   #1D9E75;
  --green-2: #0F6E56;
  --red:     #E24B4A;
  --red-2:   #A32D2D;
  --amber:   #EF9F27;
  --amber-2: #854F0B;
  --blue:    #378ADD;

  --bg:      #F4F5F8;
  --surface: #FFFFFF;
  --border:  #E2E5EE;
  --border-2:#F0F2F7;
  --border-3:#F4F5F8;

  --text-1:  #1B2A4A;
  --text-2:  #4A5672;
  --text-3:  #8A9BB8;
  --text-4:  #B0B9CC;

  --radius-sm: 6px;
  --radius:    8px;
  --radius-md: 10px;
  --radius-lg: 12px;

  --shadow-sm: 0 1px 4px rgba(0,0,0,0.06);
  --shadow:    0 4px 16px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
  --shadow-xl: 0 20px 60px rgba(0,0,0,0.18);
}

/* ============================================================
   LAYOUT
   ============================================================ */

.page { display: flex; min-height: 100vh; }

/* ── Sidebar ── */
.sidebar {
  width: 216px;
  background: var(--navy);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: sticky;
  top: 0;
  z-index: 40;
  overflow-y: auto;
  overflow-x: hidden;
}

.sb-logo {
  padding: 18px 16px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.sb-mark {
  width: 30px; height: 30px;
  background: var(--gold);
  border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.sb-mark i { font-size: 16px; color: var(--navy); }
.sb-brand {
  font-family: 'Sora', sans-serif;
  font-size: 13.5px; font-weight: 600;
  color: #F7F8FA;
}
.sb-brand span { color: var(--gold); }

/* Technician role chip */
.sb-role-chip {
  margin-left: auto;
  font-size: 9.5px; font-weight: 500;
  background: rgba(42,127,143,0.25);
  color: #9FE1CB;
  padding: 2px 8px; border-radius: 10px;
  letter-spacing: 0.04em; white-space: nowrap;
}

/* Queue depth bar (technician only) */
.sb-queue-bar {
  margin: 0 6px 6px;
  background: rgba(255,255,255,0.05);
  border-radius: 8px; padding: 9px 12px;
}
.sqb-label { font-size: 10.5px; color: rgba(255,255,255,0.35); margin-bottom: 6px; display: flex; justify-content: space-between; }
.sqb-track { height: 4px; background: rgba(255,255,255,0.1); border-radius: 2px; overflow: hidden; }
.sqb-fill  { height: 100%; border-radius: 2px; background: var(--teal); }
.sqb-stats { display: flex; justify-content: space-between; margin-top: 5px; font-size: 10.5px; }
.sqb-stat  { color: rgba(255,255,255,0.4); }
.sqb-stat strong { color: rgba(255,255,255,0.75); font-weight: 500; }

.sb-section {
  padding: 16px 12px 5px;
  font-size: 10px; font-weight: 500;
  color: rgba(255,255,255,0.28);
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.sb-divider { height: 0.5px; background: rgba(255,255,255,0.07); margin: 6px 12px; }

.sb-item {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 12px;
  border-radius: 7px;
  margin: 1px 6px;
  font-size: 13px;
  color: rgba(255,255,255,0.5);
  transition: background 0.15s, color 0.15s;
  cursor: pointer;
  position: relative;
}
.sb-item i { font-size: 16px; flex-shrink: 0; }
.sb-item:hover { background: rgba(255,255,255,0.06); color: rgba(255,255,255,0.85); }

/* Super Admin active: gold */
.sb-item.active { background: rgba(201,168,76,0.15); color: var(--gold); }

/* Technician active: teal */
[data-role="technician"] .sb-item.active { background: rgba(42,127,143,0.2); color: #9FE1CB; }

.sb-item .sb-badge {
  margin-left: auto;
  background: rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.55);
  font-size: 10px; padding: 1px 7px;
  border-radius: 10px;
}
.sb-item .sb-badge.alert   { background: var(--red); color: #fff; }
.sb-item .sb-badge.urgent  { background: var(--red); color: #fff; }
.sb-item .sb-badge.new     { background: var(--teal); color: #fff; }

.sb-bottom {
  margin-top: auto;
  padding: 12px 10px;
  border-top: 1px solid rgba(255,255,255,0.07);
  flex-shrink: 0;
}
.sb-user {
  display: flex; align-items: center; gap: 9px;
  padding: 8px; border-radius: 7px; cursor: pointer;
}
.sb-user:hover { background: rgba(255,255,255,0.05); }
.sb-av {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--teal);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 500; color: #fff;
  flex-shrink: 0;
}
.sb-un { font-size: 12px; font-weight: 500; color: #E8EBF2; }
.sb-ur { font-size: 10.5px; color: rgba(255,255,255,0.35); }

/* ── Main ── */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.topbar {
  background: var(--surface);
  border-bottom: 0.5px solid var(--border);
  padding: 0 24px;
  height: 54px;
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
  position: sticky; top: 0; z-index: 30;
  gap: 12px;
}
.topbar-left { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
.topbar-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.page-title {
  font-family: 'Sora', sans-serif;
  font-size: 15px; font-weight: 600;
  color: var(--text-1);
}
.page-breadcrumb {
  display: flex; align-items: center; gap: 6px;
  font-size: 12.5px;
}
.page-breadcrumb a { color: var(--teal); cursor: pointer; }
.page-breadcrumb span { color: var(--text-4); }
.page-breadcrumb strong { color: var(--text-1); font-weight: 500; }

.view { padding: 20px 24px; display: flex; flex-direction: column; gap: 16px; }

/* Hamburger toggle — hidden on desktop, shown via media query on mobile/tablet */
.sb-toggle {
  display: none;
  align-items: center; justify-content: center;
  width: 36px; height: 36px; flex-shrink: 0;
  border: none; background: none;
  color: var(--text-2); font-size: 20px; cursor: pointer;
  border-radius: var(--radius);
  transition: background 0.15s;
}
.sb-toggle:hover { background: var(--border-2); }

/* Overlay backdrop — hidden until .show is added via Alpine */
.sb-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 99;
}
.sb-overlay.show { display: block; }

/* Livewire root wrapper — matches .view gap so sections breathe consistently */
.page-body { display: flex; flex-direction: column; gap: 16px; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 13px;
  border-radius: var(--radius);
  border: 0.5px solid var(--border);
  background: var(--surface);
  font-size: 12.5px; font-weight: 500;
  color: var(--text-2);
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.btn:hover { background: #F7F8FA; }
.btn i { font-size: 14px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.sm { padding: 5px 10px; font-size: 12px; }
.btn.sm i { font-size: 13px; }
.btn.primary  { background: var(--navy); color: #fff; border-color: var(--navy); }
.btn.primary:hover { background: var(--navy-2); }
.btn.teal     { background: var(--teal); color: #fff; border-color: var(--teal); }
.btn.teal:hover    { background: var(--teal-2); }
.btn.green    { background: var(--green); color: #fff; border-color: var(--green); }
.btn.green:hover   { background: var(--green-2); }
.btn.danger   { background: var(--red); color: #fff; border-color: var(--red); }
.btn.danger:hover  { background: var(--red-2); }
.btn.ghost-danger  { background: #FCEBEB; color: #791F1F; border-color: #F7C1C1; }
.btn.ghost-danger:hover { background: #F7C1C1; }
.btn.warn     { background: #FAEEDA; color: #633806; border-color: #FAC775; }
.btn.warn:hover    { background: #FAC775; }
.btn.gold     { background: var(--gold); color: var(--navy); border-color: var(--gold); font-weight: 600; }
.btn.gold:hover    { background: var(--gold-2); }
.btn.icon-only { padding: 7px 9px; }
.btn-group { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }

/* Claim button — prominent teal CTA (technician) */
.btn-claim {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px; border-radius: var(--radius);
  background: var(--teal); color: #fff;
  font-size: 12px; font-weight: 600;
  border: none; transition: background 0.15s, transform 0.1s;
  white-space: nowrap;
}
.btn-claim:hover { background: var(--teal-2); transform: translateY(-1px); }
.btn-claim:active { transform: translateY(0); }
.btn-claim i { font-size: 13px; }

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.card-head {
  padding: 12px 16px;
  border-bottom: 0.5px solid var(--border-2);
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; flex-wrap: wrap;
}
.card-title {
  font-size: 13px; font-weight: 500;
  color: var(--text-1);
  display: flex; align-items: center; gap: 7px;
}
.card-title i { font-size: 15px; color: var(--teal); }
.card-sub { font-size: 11.5px; color: var(--text-3); margin-top: 2px; }
.card-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }

/* ============================================================
   METRICS / KPI CARDS
   ============================================================ */
.metrics-grid { display: grid; gap: 10px; }
.metrics-grid.cols-4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.metrics-grid.cols-5 { grid-template-columns: repeat(5, minmax(0,1fr)); }

.metric-card {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 13px 15px;
  position: relative; overflow: hidden;
}
.metric-card::before {
  content: '';
  position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
}
.metric-card.navy::before  { background: var(--navy); }
.metric-card.teal::before  { background: var(--teal); }
.metric-card.gold::before  { background: var(--gold); }
.metric-card.red::before   { background: var(--red); }
.metric-card.green::before { background: var(--green); }
.metric-card.amber::before { background: var(--amber); }

.metric-label {
  font-size: 11px; color: var(--text-3);
  margin-bottom: 7px;
  display: flex; align-items: center; gap: 4px;
}
.metric-label i { font-size: 13px; }
.metric-value {
  font-family: 'Sora', sans-serif;
  font-size: 24px; font-weight: 600;
  color: var(--text-1);
  line-height: 1; margin-bottom: 5px;
}
.metric-value sup { font-size: 14px; color: var(--text-3); margin-left: 2px; }
.metric-trend { font-size: 11px; display: flex; align-items: center; gap: 3px; }
.metric-trend.up      { color: var(--green-2); }
.metric-trend.down    { color: var(--red-2); }
.metric-trend.neutral { color: var(--text-3); }
.metric-trend i { font-size: 12px; }

/* ============================================================
   TABLES
   ============================================================ */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th {
  font-size: 11px; font-weight: 500;
  color: var(--text-3);
  text-transform: uppercase; letter-spacing: 0.06em;
  padding: 9px 14px;
  text-align: left;
  border-bottom: 0.5px solid var(--border-2);
  background: #FAFBFC;
  white-space: nowrap;
}
tbody td {
  font-size: 12.5px; color: var(--text-2);
  padding: 0;
  border-bottom: 0.5px solid var(--border-3);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr.clickable:hover td { background: #FAFBFC; cursor: pointer; }
.td-p { padding: 10px 14px; }
.td-p.tight { padding: 7px 14px; }

/* ============================================================
   BADGES
   ============================================================ */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10.5px; font-weight: 500;
  padding: 2px 9px;
  border-radius: 20px;
  white-space: nowrap;
}
.badge i { font-size: 11px; }
/* ticket status */
.badge.open      { background: #E6F1FB; color: #0C447C; }
.badge.inprog    { background: #E1F5EE; color: #085041; }
.badge.pending   { background: #FAEEDA; color: #633806; }
.badge.resolved  { background: #E1F5EE; color: #085041; }
.badge.closed    { background: #F1EFE8; color: #444441; }
.badge.breach    { background: #FCEBEB; color: #791F1F; border: 0.5px solid #F7C1C1; }
/* priority */
.badge.urgent    { background: #FCEBEB; color: #791F1F; }
.badge.high      { background: #FAEEDA; color: #633806; }
.badge.medium    { background: #E6F1FB; color: #0C447C; }
.badge.low       { background: #F1EFE8; color: #5F5E5A; }
/* roles */
.badge.superadmin { background: var(--navy); color: var(--gold); }
.badge.technician { background: #E1F5EE; color: #085041; }
.badge.orgadmin   { background: #FAEEDA; color: #633806; }
.badge.enduser    { background: #E6F1FB; color: #0C447C; }
/* system */
.badge.active    { background: #E1F5EE; color: #085041; }
.badge.inactive  { background: #F1EFE8; color: #5F5E5A; }
.badge.suspended { background: #FCEBEB; color: #791F1F; }
.badge.internal  { background: #FFFDF5; color: #854F0B; border: 0.5px solid #FAD87A; }

/* dot status */
.dot-status { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 500; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.dot.ok   { background: var(--green); }
.dot.warn { background: var(--amber); }
.dot.err  { background: var(--red); animation: pulse 1.5s infinite; }
.dot.off  { background: #B4B2A9; }

/* priority dot */
.p-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; display: inline-block; }
.p-dot.urgent { background: var(--red); }
.p-dot.high   { background: var(--amber); }
.p-dot.medium { background: var(--blue); }
.p-dot.low    { background: #888780; }

/* SLA chips */
.sla-chip { display: inline-flex; align-items: center; gap: 4px; font-size: 10.5px; font-weight: 500; padding: 3px 8px; border-radius: 7px; white-space: nowrap; }
.sla-chip i { font-size: 12px; }
.sla-chip.ok      { background: #E1F5EE; color: #085041; }
.sla-chip.warn    { background: #FAEEDA; color: #633806; }
.sla-chip.breach  { background: #FCEBEB; color: #791F1F; border: 0.5px solid #F7C1C1; }
.sla-chip.pending { background: #F1EFE8; color: #444441; }

/* ============================================================
   FORM ELEMENTS
   ============================================================ */
.field { display: flex; flex-direction: column; gap: 5px; }
.field-label { font-size: 12.5px; font-weight: 500; color: var(--text-2); }
.field-label .req  { color: var(--red); margin-left: 2px; }
.field-label .hint { font-size: 11.5px; color: var(--text-4); font-weight: 400; margin-left: 4px; }
.inp {
  width: 100%;
  padding: 8px 11px;
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--text-1);
  background: var(--surface);
  outline: none;
  transition: border-color 0.18s, box-shadow 0.18s;
}
.inp:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(42,127,143,0.1); }
.inp.mono  { font-family: 'DM Mono', monospace; font-size: 12.5px; }
.inp.err   { border-color: var(--red); }
.inp.ok    { border-color: var(--green); }
.sel {
  width: 100%;
  padding: 8px 28px 8px 11px;
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px; font-family: 'DM Sans', sans-serif;
  color: var(--text-1);
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='11' height='11' viewBox='0 0 24 24' fill='none' stroke='%238A9BB8' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 9px center;
  appearance: none; outline: none; cursor: pointer;
  transition: border-color 0.18s;
}
.sel:focus { border-color: var(--teal); }
.ta {
  width: 100%;
  padding: 9px 11px;
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px; font-family: 'DM Sans', sans-serif;
  color: var(--text-1);
  background: var(--surface);
  outline: none; resize: vertical;
  transition: border-color 0.18s;
  line-height: 1.6;
}
.ta:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(42,127,143,0.1); }
.field-err  { font-size: 11.5px; color: var(--red-2); display: flex; align-items: center; gap: 4px; margin-top: 3px; }
.field-err i { font-size: 13px; }
.field-ok   { font-size: 11.5px; color: var(--green-2); display: flex; align-items: center; gap: 4px; margin-top: 3px; }
.field-hint { font-size: 11.5px; color: var(--text-3); margin-top: 3px; }

/* toggle */
.toggle { width: 38px; height: 21px; border-radius: 11px; cursor: pointer; position: relative; flex-shrink: 0; transition: background 0.2s; }
.toggle.on  { background: var(--teal); }
.toggle.off { background: var(--border); }
.toggle-knob { width: 17px; height: 17px; border-radius: 50%; background: #fff; position: absolute; top: 2px; transition: left 0.2s; box-shadow: 0 1px 3px rgba(0,0,0,0.15); }
.toggle.on  .toggle-knob { left: 19px; }
.toggle.off .toggle-knob { left: 2px; }

/* search */
.search-wrap { position: relative; }
.search-wrap .si { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); font-size: 15px; color: var(--text-4); pointer-events: none; }
.search-wrap .inp { padding-left: 32px; }

/* ============================================================
   FILTER BAR
   ============================================================ */
.filter-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.fp {
  font-size: 11.5px; padding: 5px 12px;
  border-radius: 20px;
  border: 0.5px solid var(--border);
  color: var(--text-3); cursor: pointer;
  transition: all 0.15s; white-space: nowrap;
}
.fp:hover { border-color: var(--text-3); color: var(--text-2); }
.fp.active { background: var(--navy); color: #fff; border-color: var(--navy); }

/* ============================================================
   ALERT BANNERS
   ============================================================ */
.alert { display: flex; align-items: flex-start; gap: 12px; padding: 12px 16px; border-radius: var(--radius-md); }
.alert-icon  { font-size: 18px; flex-shrink: 0; margin-top: 1px; }
.alert-body  { flex: 1; font-family: 'DM Sans', sans-serif; font-size: 13px; font-weight: 500; line-height: 1.5; }
.alert-title { font-size: 13px; font-weight: 500; margin-bottom: 2px; }
.alert-sub   { font-size: 12.5px; line-height: 1.5; }
.alert-close { font-size: 16px; opacity: 0.5; cursor: pointer; flex-shrink: 0; }
.alert-close:hover { opacity: 1; }
.alert-action { font-size: 12.5px; font-weight: 500; cursor: pointer; text-decoration: underline; }
.alert.info    { background: #E6F1FB; border: 0.5px solid #B5D4F4; color: #0C447C; }
.alert.success { background: #E1F5EE; border: 0.5px solid #9FE1CB; color: #085041; }
.alert.warning { background: #FAEEDA; border: 0.5px solid #FAC775; color: #633806; }
.alert.error   { background: #FCEBEB; border: 0.5px solid #F7C1C1; color: #791F1F; }
.alert.navy    { background: var(--navy); border: 0.5px solid var(--navy-2); color: rgba(255,255,255,0.8); }

/* ============================================================
   TOAST
   ============================================================ */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 200; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; border-radius: var(--radius-md);
  font-size: 13px; font-weight: 500;
  box-shadow: var(--shadow-lg);
  max-width: 360px; min-width: 260px;
  transform: translateX(120%); opacity: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
  pointer-events: all;
}
.toast.show  { transform: translateX(0); opacity: 1; }
.toast-icon  { font-size: 17px; flex-shrink: 0; }
.toast-text  { flex: 1; }
.toast-text small { display: block; font-size: 11.5px; font-weight: 400; opacity: 0.7; margin-top: 2px; }
.toast-x     { font-size: 15px; opacity: 0.5; cursor: pointer; }
.toast-x:hover { opacity: 1; }
.toast.t-success { background: var(--navy); color: #F7F8FA; }
.toast.t-success .toast-icon { color: var(--green); }
.toast.t-error   { background: var(--red-2); color: #fff; }
.toast.t-error   .toast-icon { color: #FAD87A; }
.toast.t-warning { background: var(--navy); color: #F7F8FA; }
.toast.t-warning .toast-icon { color: var(--amber); }
.toast.t-info    { background: var(--navy); color: #F7F8FA; }
.toast.t-info    .toast-icon { color: #85B7EB; }

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(27,42,74,0.5);
  z-index: 100;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  width: 100%; max-width: 460px;
  transform: translateY(12px) scale(0.98);
  transition: transform 0.2s;
  overflow: hidden;
}
.modal-overlay.open .modal { transform: translateY(0) scale(1); }
.modal-head { padding: 18px 20px 14px; border-bottom: 0.5px solid var(--border-2); display: flex; align-items: flex-start; gap: 12px; }
.modal-icon { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 20px; }
.modal-icon.danger  { background: #FCEBEB; color: var(--red-2); }
.modal-icon.info    { background: #E6F1FB; color: #185FA5; }
.modal-icon.success { background: #E1F5EE; color: var(--green-2); }
.modal-icon.warning { background: #FAEEDA; color: var(--amber-2); }
.modal-title { font-family: 'Sora', sans-serif; font-size: 15px; font-weight: 600; color: var(--text-1); margin-bottom: 3px; }
.modal-sub   { font-size: 12.5px; color: var(--text-3); line-height: 1.5; }
.modal-x     { font-size: 18px; color: var(--text-4); cursor: pointer; margin-left: auto; flex-shrink: 0; }
.modal-x:hover { color: var(--text-2); }
.modal-body  { padding: 16px 20px; font-size: 13px; color: var(--text-2); line-height: 1.6; }
.modal-body strong { color: var(--text-1); font-weight: 500; }
.modal-footer { padding: 14px 20px; border-top: 0.5px solid var(--border-2); display: flex; gap: 8px; justify-content: flex-end; }

/* ============================================================
   SLIDE-IN PANEL
   ============================================================ */
.panel-overlay { position: fixed; inset: 0; background: rgba(27,42,74,0.35); z-index: 90; opacity: 0; pointer-events: none; transition: opacity 0.25s; }
.panel-overlay.open { opacity: 1; pointer-events: all; }
.slide-panel {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: 780px; max-width: calc(100vw - 220px);
  background: var(--surface);
  box-shadow: -4px 0 40px rgba(0,0,0,0.15);
  z-index: 91;
  display: flex; flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}
.slide-panel.open { transform: translateX(0); }
.sp-topbar { padding: 0 20px; height: 54px; flex-shrink: 0; border-bottom: 0.5px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--surface); }
.sp-close { width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; border-radius: 7px; cursor: pointer; color: var(--text-3); transition: background 0.15s; }
.sp-close:hover { background: var(--bg); color: var(--text-1); }
.sp-body { flex: 1; overflow-y: auto; }

/* ── Ticket header (navy card) ── */
.ticket-header { background: var(--navy); padding: 16px 20px; }
.th-title { font-family: 'Sora', sans-serif; font-size: 15px; font-weight: 600; color: #F7F8FA; margin-bottom: 10px; line-height: 1.3; }
.th-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.th-meta { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12px; color: rgba(255,255,255,0.5); }
.th-meta-item { display: flex; align-items: center; gap: 4px; }
.th-meta-item strong { color: rgba(255,255,255,0.8); font-weight: 500; }

/* Thread / composer */
.ticket-panel-body { display: flex; }
.thread-area { flex: 1; padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; min-width: 0; border-right: 0.5px solid var(--border-2); }
.ticket-meta-col { width: 210px; flex-shrink: 0; padding: 14px 16px; display: flex; flex-direction: column; gap: 16px; background: #FAFBFC; }
.thread-msg { border: 0.5px solid var(--border); border-radius: var(--radius-md); overflow: hidden; }
.msg-head { display: flex; align-items: center; gap: 8px; padding: 9px 13px; border-bottom: 0.5px solid var(--border-2); }
.msg-head.internal-head { background: #FFFDF0; border-bottom-color: #FAF0C0; }
.msg-av { width: 26px; height: 26px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 600; flex-shrink: 0; background: #E2E5EE; color: #4A5672; }
.msg-av.staff  { background: rgba(27,42,74,0.12); color: var(--navy); }
.msg-av.tech   { background: rgba(10,176,147,0.12); color: #0A8A7A; }
.msg-av.client { background: #EEF0F6; color: #6B7A99; }
.msg-name { font-size: 12.5px; font-weight: 500; color: var(--text-1); }
.msg-role-badge { font-size: 10px; font-weight: 500; padding: 1px 7px; border-radius: 5px; white-space: nowrap; }
.msg-role-badge.badge-superadmin { background: rgba(27,42,74,0.1);  color: var(--navy); }
.msg-role-badge.badge-tech       { background: rgba(10,176,147,0.1); color: #0A8A7A; }
.msg-role-badge.badge-client     { background: #EEF0F6; color: #6B7A99; }
.msg-time { font-size: 11px; color: var(--text-4); margin-left: auto; }
.internal-label { font-size: 10.5px; padding: 2px 8px; border-radius: 8px; background: #FFF3C4; color: #854F0B; border: 0.5px solid #FAD87A; display: flex; align-items: center; gap: 3px; }
.msg-body { padding: 11px 13px; font-size: 13px; font-family: 'DM Sans', sans-serif; color: var(--text-2); line-height: 1.65; }
.msg-body.internal-body { background: #FFFDF5; }
.status-divider { display: flex; align-items: center; gap: 8px; }
.sd-line { flex: 1; height: 0.5px; background: var(--border-2); }
.sd-pill { font-size: 11px; color: var(--text-3); background: var(--bg); padding: 2px 10px; border-radius: 10px; white-space: nowrap; }
.composer { border: 0.5px solid var(--border); border-radius: var(--radius-md); overflow: hidden; }
.composer-tabs { display: flex; gap: 2px; }
.ctab { padding: 6px 12px; font-size: 12.5px; font-weight: 500; cursor: pointer; color: var(--text-3); border: none; background: none; border-radius: 6px; transition: color 0.15s, background 0.15s; }
.ctab:hover { color: var(--text-2); background: var(--bg); }
.ctab.active.pub { color: var(--teal); background: rgba(10,176,147,0.07); }
.ctab.active.int { color: #854F0B; background: rgba(239,159,39,0.1); }
.composer-body { padding: 10px 12px; }
.composer-body textarea { width: 100%; border: none; outline: none; font-size: 13px; font-family: 'DM Sans', sans-serif; resize: none; background: transparent; line-height: 1.6; color: var(--text-1); }
.composer-footer { padding: 8px 12px; display: flex; align-items: center; justify-content: space-between; }
.meta-section { display: flex; flex-direction: column; gap: 6px; }
.meta-heading { font-size: 10px; font-weight: 500; color: var(--text-4); letter-spacing: 0.07em; text-transform: uppercase; margin-bottom: 2px; }
.meta-kv { display: flex; justify-content: space-between; align-items: center; padding: 3px 0; }
.meta-key { font-size: 12px; color: var(--text-3); }
.meta-val { font-size: 12px; font-weight: 500; color: var(--text-1); text-align: right; }
.meta-val.teal { color: var(--teal); }
.meta-val.red  { color: var(--red-2); }
.assignee-box { display: flex; align-items: center; gap: 7px; background: var(--bg); border: 0.5px solid var(--border); border-radius: 8px; padding: 8px 10px; }
.assignee-box .name { font-size: 12.5px; font-weight: 500; color: var(--text-1); flex: 1; }
.audit-item { display: flex; align-items: flex-start; gap: 7px; margin-bottom: 8px; }
.audit-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--border); flex-shrink: 0; margin-top: 4px; }
.audit-dot.teal { background: var(--teal); }
.audit-dot.gold { background: var(--gold); }
.audit-dot.navy { background: var(--navy); }
.audit-dot.red  { background: var(--red); }
.audit-text { font-size: 11.5px; color: var(--text-3); line-height: 1.5; }
.audit-text strong { color: var(--text-1); font-weight: 500; }
.audit-time { font-size: 10.5px; color: var(--text-4); margin-top: 1px; }

/* ============================================================
   SLA BAR
   ============================================================ */
.sla-bar-row { display: flex; align-items: center; gap: 8px; margin-top: 10px; padding-top: 10px; border-top: 0.5px solid rgba(255,255,255,0.1); }
.sla-track { flex: 1; height: 5px; background: rgba(255,255,255,0.15); border-radius: 3px; overflow: hidden; }
.sla-fill  { height: 100%; border-radius: 3px; }
.sla-fill.ok     { background: var(--green); }
.sla-fill.warn   { background: var(--amber); }
.sla-fill.breach { background: var(--red); }
.sla-label { font-size: 11px; color: rgba(255,255,255,0.5); white-space: nowrap; }
.sla-val   { font-size: 11px; font-weight: 500; white-space: nowrap; }
.sla-val.ok     { color: #9FE1CB; }
.sla-val.warn   { color: #FAD87A; }
.sla-val.breach { color: #F7C1C1; }

/* ============================================================
   NOTIFICATION PANEL
   ============================================================ */
.notif-panel {
  position: absolute; top: 54px; right: 0;
  width: 340px;
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  z-index: 50;
}
.np-head { padding: 12px 16px; border-bottom: 0.5px solid var(--border-2); display: flex; align-items: center; justify-content: space-between; }
.np-title { font-size: 13px; font-weight: 500; color: var(--text-1); display: flex; align-items: center; gap: 7px; }
.np-badge { background: var(--red); color: #fff; font-size: 10px; font-weight: 500; padding: 1px 6px; border-radius: 10px; }
.np-mark  { font-size: 12px; color: var(--teal); cursor: pointer; font-weight: 500; }
.np-mark:hover { text-decoration: underline; }
.notif-item { display: flex; align-items: flex-start; gap: 10px; padding: 10px 16px; border-bottom: 0.5px solid var(--border-3); cursor: pointer; transition: background 0.12s; }
.notif-item:hover { background: #F7FDFB; }
.notif-item.unread { border-left: 2px solid var(--teal); padding-left: 14px; }
.ni-icon { width: 30px; height: 30px; border-radius: 7px; display: flex; align-items: center; justify-content: center; font-size: 15px; flex-shrink: 0; }
.ni-icon.alert   { background: #FCEBEB; color: var(--red-2); }
.ni-icon.ticket  { background: #E6F1FB; color: #185FA5; }
.ni-icon.success { background: #E1F5EE; color: var(--green-2); }
.ni-icon.warn    { background: #FAEEDA; color: var(--amber-2); }
.ni-body  { flex: 1; min-width: 0; }
.ni-title { font-size: 12.5px; font-weight: 500; color: var(--text-1); margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ni-sub   { font-size: 12px; color: var(--text-3); line-height: 1.4; }
.ni-time  { font-size: 11px; color: var(--text-4); margin-top: 3px; }
.ni-dot   { width: 7px; height: 7px; border-radius: 50%; background: var(--teal); flex-shrink: 0; margin-top: 4px; }
.np-footer { padding: 9px 16px; border-top: 0.5px solid var(--border-2); text-align: center; }
.np-footer a { font-size: 12.5px; color: var(--teal); cursor: pointer; font-weight: 500; }

/* ============================================================
   LOADING / EMPTY STATES
   ============================================================ */
.spinner { width: 24px; height: 24px; border: 2.5px solid var(--border); border-top-color: var(--teal); border-radius: 50%; animation: spin 0.8s linear infinite; flex-shrink: 0; }
.spinner.sm { width: 16px; height: 16px; border-width: 2px; }
.spinner.lg { width: 40px; height: 40px; border-width: 3px; }
.skeleton { background: linear-gradient(90deg, #E8EBF2 25%, #F4F5F8 50%, #E8EBF2 75%); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: 6px; }
.empty-state { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 48px 24px; }
.es-icon { width: 52px; height: 52px; border-radius: 50%; display: flex; align-items: center; justify-content: center; margin-bottom: 14px; font-size: 24px; }
.es-icon.default { background: var(--bg); color: var(--text-4); }
.es-icon.info    { background: #E6F1FB; color: #185FA5; }
.es-title { font-family: 'Sora', sans-serif; font-size: 14px; font-weight: 600; color: var(--text-1); margin-bottom: 5px; }
.es-sub   { font-size: 12.5px; color: var(--text-3); line-height: 1.6; max-width: 280px; margin-bottom: 16px; }

/* ============================================================
   TABS
   ============================================================ */
.tab-bar { display: flex; border-bottom: 0.5px solid var(--border); padding: 0 16px; background: var(--surface); }
.tab { padding: 10px 14px; font-size: 13px; font-weight: 500; color: var(--text-3); cursor: pointer; border: none; background: none; border-bottom: 2px solid transparent; margin-bottom: -0.5px; white-space: nowrap; transition: color 0.18s ease, border-bottom-color 0.18s ease; }
.tab:hover { color: var(--text-2); }
.tab.active { color: var(--navy); border-bottom-color: var(--navy); }

/* ============================================================
   TWO-COLUMN LAYOUT HELPERS
   ============================================================ */
.two-col { display: grid; gap: 14px; }
.two-col.r60-40 { grid-template-columns: minmax(0,1.5fr) minmax(0,1fr); }
.two-col.r50-50 { grid-template-columns: 1fr 1fr; }
.two-col.r40-60 { grid-template-columns: minmax(0,1fr) minmax(0,1.5fr); }
.three-col { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 14px; }

/* ============================================================
   PROGRESS BAR
   ============================================================ */
.progress-wrap { background: var(--border-2); border-radius: 20px; overflow: hidden; height: 7px; }
.progress-fill { height: 100%; border-radius: 20px; background: var(--teal); transition: width 0.3s ease; }

/* ============================================================
   SETTING ROW
   ============================================================ */
.setting-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 11px 16px; border-bottom: 0.5px solid var(--border-3); }
.setting-row:last-child { border-bottom: none; }
.s-label { font-size: 13px; font-weight: 500; color: var(--text-1); margin-bottom: 2px; }
.s-desc  { font-size: 11.5px; color: var(--text-3); line-height: 1.4; }

/* ============================================================
   ORG AVATAR
   ============================================================ */
.org-av { display: flex; align-items: center; justify-content: center; font-weight: 500; border-radius: 8px; flex-shrink: 0; }

/* ============================================================
   DANGER ZONE
   ============================================================ */
.danger-zone { border: 0.5px solid #F7C1C1; border-radius: var(--radius-md); overflow: hidden; }
.dz-head { padding: 11px 16px; display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500; color: #791F1F; border-bottom: 0.5px solid #F7C1C1; background: #FFFBFB; }
.dz-head i { font-size: 15px; color: var(--red); }
.dz-item { padding: 10px 16px; border-bottom: 0.5px solid #FDE8E8; display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--surface); }
.dz-item:last-child { border-bottom: none; }
.dz-label { font-size: 12.5px; color: var(--text-2); }
.dz-sub   { font-size: 11.5px; color: var(--text-3); margin-top: 2px; }

/* ============================================================
   LOG VIEWER / STACK TRACE
   ============================================================ */
.log-viewer { background: var(--navy); border-radius: 0 0 var(--radius-md) var(--radius-md); padding: 12px 14px; font-family: 'DM Mono', monospace; font-size: 11.5px; line-height: 1.8; max-height: 280px; overflow-y: auto; }
.log-line { display: flex; gap: 10px; align-items: flex-start; }
.log-ts   { color: rgba(255,255,255,0.3); flex-shrink: 0; white-space: nowrap; }
.log-lvl  { flex-shrink: 0; font-weight: 500; width: 60px; }
.log-lvl.error   { color: #F7C1C1; }
.log-lvl.warning { color: #FAD87A; }
.log-lvl.info    { color: #85B7EB; }
.log-lvl.debug   { color: rgba(255,255,255,0.35); }
.log-msg { color: #E8EBF2; word-break: break-all; }
.stack-trace { background: var(--navy); border-radius: var(--radius); padding: 12px 14px; font-family: 'DM Mono', monospace; font-size: 11.5px; color: #9FE1CB; line-height: 1.7; overflow-x: auto; }
.stack-trace .t-err  { color: #F7C1C1; }
.stack-trace .t-highlight { color: #FAD87A; display: block; border-left: 2px solid var(--gold); padding-left: 8px; }
.stack-trace .t-file { color: #85B7EB; }
.stack-trace .t-dim  { color: rgba(255,255,255,0.35); }

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes spin    { to { transform: rotate(360deg); } }
@keyframes shimmer { 0%{ background-position: 200% 0; } 100%{ background-position: -200% 0; } }
@keyframes pulse   { 0%,100%{ opacity:1; } 50%{ opacity:0.3; } }
@keyframes slideIn { from{ transform:translateX(100%); } to{ transform:translateX(0); } }
@keyframes fadeIn  { from{ opacity:0; } to{ opacity:1; } }
@keyframes ir-spin { to { transform: rotate(360deg); } }

/* ============================================================
   SCROLLBAR
   ============================================================ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-4); }

/* Alpine x-cloak */
[x-cloak] { display: none !important; }

/* ============================================================
   UTILITY
   ============================================================ */
.mono { font-family: 'DM Mono', monospace; }
.sora { font-family: 'Sora', sans-serif; }
.text-1 { color: var(--text-1); }
.text-2 { color: var(--text-2); }
.text-3 { color: var(--text-3); }
.text-4 { color: var(--text-4); }
.text-teal  { color: var(--teal); }
.text-gold  { color: var(--gold); }
.text-red   { color: var(--red-2); }
.text-green { color: var(--green-2); }
.flex         { display: flex; }
.flex-1       { flex: 1; min-width: 0; }
.truncate     { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fw-500       { font-weight: 500; }
.fs-11        { font-size: 11px; }
.fs-12        { font-size: 12px; }
.fs-13        { font-size: 13px; }
.items-center { align-items: center; }
.gap-4  { gap: 4px; }
.gap-6  { gap: 6px; }
.gap-8  { gap: 8px; }
.gap-10 { gap: 10px; }

/* ============================================================
   STAFF AUTH (Login page)
   ============================================================ */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 24px;
}
.auth-card {
  width: 100%; max-width: 380px;
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 32px 28px;
}
.auth-logo {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 28px;
}
.auth-mark {
  width: 34px; height: 34px;
  background: var(--gold); border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
}
.auth-mark i { font-size: 18px; color: var(--navy); }
.auth-brand { font-family: 'Sora', sans-serif; font-size: 15px; font-weight: 600; color: var(--text-1); }
.auth-brand span { color: var(--teal); }
.auth-title { font-family: 'Sora', sans-serif; font-size: 18px; font-weight: 600; color: var(--text-1); margin-bottom: 4px; }
.auth-sub   { font-size: 13px; color: var(--text-3); margin-bottom: 24px; }
.auth-form  { display: flex; flex-direction: column; gap: 14px; }
.auth-btn {
  width: 100%;
  padding: 10px 16px;
  background: var(--navy); color: #fff;
  border: none; border-radius: var(--radius);
  font-size: 13.5px; font-weight: 500;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer; transition: background 0.15s;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.auth-btn:hover { background: var(--navy-2); }
.auth-btn:disabled { opacity: 0.6; cursor: not-allowed; }
.auth-err { font-size: 11.5px; color: var(--red-2); margin-top: 2px; }

/* ============================================================
   DASHBOARD — Queue tickets & Activity feed
   ============================================================ */
.queue-ticket { display: flex; align-items: flex-start; gap: 12px; padding: 12px 16px; border-bottom: 0.5px solid var(--border-3); transition: background 0.12s; }
.queue-ticket:last-child { border-bottom: none; }
.queue-ticket:hover { background: var(--bg); }
.qt-body  { flex: 1; min-width: 0; }
.qt-title { font-size: 13px; font-weight: 500; color: var(--text-1); margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.qt-title:hover { color: var(--teal); }
.qt-meta  { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 11.5px; color: var(--text-3); }
.qt-meta-sep { color: var(--border); }

.activity-feed { display: flex; flex-direction: column; }
.activity-item { display: flex; align-items: flex-start; gap: 10px; padding: 11px 16px; border-bottom: 0.5px solid var(--border-3); transition: background 0.12s; }
.activity-item:last-child { border-bottom: none; }
.ac-icon { width: 30px; height: 30px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 14px; flex-shrink: 0; margin-top: 1px; }
.ac-icon.ticket  { background: #E6F1FB; color: #185FA5; }
.ac-icon.reply   { background: #E1F5EE; color: var(--green-2); }
.ac-icon.claim   { background: rgba(42,127,143,0.12); color: var(--teal); }
.ac-icon.resolve { background: #E1F5EE; color: var(--green-2); }
.ac-icon.breach  { background: #FCEBEB; color: var(--red-2); }
.ac-icon.note    { background: #FFFDF5; color: #854F0B; }
.ac-body  { flex: 1; min-width: 0; }
.ac-title { font-size: 12.5px; color: var(--text-1); line-height: 1.4; margin-bottom: 2px; }
.ac-sub   { font-size: 11.5px; color: var(--text-3); }
.ac-time  { font-size: 11px; color: var(--text-4); white-space: nowrap; margin-top: 2px; flex-shrink: 0; }

/* ============================================================
   DASHBOARD — Org row & CSAT row
   ============================================================ */
.org-row { display: flex; align-items: center; gap: 10px; padding: 9px 14px; border-bottom: 0.5px solid var(--border-3); cursor: pointer; transition: background 0.12s; }
.org-row:last-child { border-bottom: none; }
.org-row:hover { background: var(--bg); }
.csat-row { display: flex; align-items: center; gap: 8px; padding: 9px 14px; border-bottom: 0.5px solid var(--border-3); }
.csat-row:last-child { border-bottom: none; }
.csat-av { width: 26px; height: 26px; border-radius: 50%; background: var(--teal); color: #fff; font-size: 9px; font-weight: 600; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.csat-stars { display: inline-flex; align-items: center; font-size: 14px; letter-spacing: -1px; }
.csat-star-filled { color: var(--gold); }
.csat-star-empty  { color: var(--border); }
.csat-footer { padding: 9px 14px; display: flex; justify-content: space-between; font-size: 12px; border-top: 0.5px solid var(--border-3); }

/* ============================================================
   PHASE 3 ADDITIONS
   ============================================================ */
/* (phase 3 classes below) */
.nowrap { white-space: nowrap; }
.mt-4   { margin-top: 4px; }
.mb-4   { margin-bottom: 4px; }
.pagination-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 0.5px solid var(--border-2);
  padding: 10px 14px;
}

/* ============================================================
   PHASE 4 ADDITIONS — Management pages
   ============================================================ */

/* Form validation */
.field-error { font-size: 11.5px; color: var(--red-2); margin-top: 3px; }
.inp.border-red { border-color: var(--red-2) !important; }

/* Selected table row */
.tr-selected { background: #EEF2FF; }
.tr-selected:hover { background: #E5EAFF !important; }

/* Setting key display */
.s-key { font-size: 10.5px; font-family: 'DM Mono', monospace; color: var(--text-4); margin-top: 3px; }

/* Canned response list items */
.canned-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 0.5px solid var(--border-3);
  cursor: pointer;
  transition: background 0.12s;
}
.canned-item:last-child { border-bottom: none; }
.canned-item:hover { background: var(--bg); }
.canned-item.selected { background: #EEF2FF; }
.ci-icon {
  width: 30px; height: 30px;
  border-radius: 8px;
  background: rgba(42,127,143,0.10);
  color: var(--teal);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}
.ci-body { flex: 1; min-width: 0; }
.ci-name    { font-size: 12.5px; font-weight: 500; color: var(--text-1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ci-preview { font-size: 11.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.ci-cat     { font-size: 11px; font-weight: 500; flex-shrink: 0; white-space: nowrap; }

/* ============================================================
   RESPONSIVE — Mobile-First
   Breakpoints: 767px (mobile) | 768-1023px (tablet) | 1024px+ (desktop) | 1440px+ (large)
   ============================================================ */

/* ── Mobile (up to 767px) ── */
@media (max-width: 767px) {
  /* Sidebar: slide off-screen, becomes a drawer */
  .sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    transform: translateX(-216px);
    transition: transform 0.25s ease;
    z-index: 100;
  }
  .sidebar.open { transform: translateX(0); }

  /* Show hamburger */
  .sb-toggle { display: flex !important; }

  /* Topbar */
  .topbar { padding: 0 12px; gap: 8px; }
  .page-title { font-size: 13.5px; }
  .topbar-right .btn:not(.icon-only) { padding: 6px 10px; font-size: 12px; }

  /* Content */
  .view { padding: 12px; gap: 12px; }

  /* Metric grids: 2 columns */
  .metrics-grid.cols-4,
  .metrics-grid.cols-5 { grid-template-columns: repeat(2, 1fr); }

  /* Two-col layouts: stack vertically */
  .two-col { grid-template-columns: 1fr !important; }

  /* Ticket detail: hide meta sidebar, remove thread border */
  .ticket-meta-col { display: none; }
  .thread-area { border-right: none; }

  /* Composer footer: allow wrapping */
  .composer-footer { flex-wrap: wrap; gap: 6px; }

  /* Setting rows: label above control */
  .setting-row { flex-direction: column; gap: 6px; align-items: flex-start; }
  .setting-row .toggle { align-self: flex-start; }

  /* Tab bar: horizontal scroll, no page overflow */
  .tab-bar { overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; }
  .tab-bar::-webkit-scrollbar { display: none; }

  /* Filter bar: wrap pills */
  .filter-bar { flex-wrap: wrap; }
  .filter-bar .inp,
  .filter-bar .sel { min-width: 0 !important; }

  /* Notification panel: near full-width */
  .notif-panel { width: calc(100vw - 24px); right: 0; left: auto; }

  /* Slide panel: full width */
  .slide-panel { width: 100vw !important; max-width: 100vw !important; }

  /* Modals: near full-screen */
  .modal { width: calc(100vw - 24px) !important; max-width: calc(100vw - 24px) !important; }

  /* Card head: wrap */
  .card-head { flex-wrap: wrap; gap: 8px; }
  .card-actions { flex-wrap: wrap; }

  /* Pagination */
  .pagination-footer { flex-direction: column; gap: 8px; align-items: center; }

  /* Log viewer: reduce max-height on small screens */
  .log-viewer { max-height: 220px; }

  /* Metric card value: slightly smaller on tiny screens */
  .metric-value { font-size: 20px; }
}

/* ── Tablet (768px – 1023px) ── */
@media (min-width: 768px) and (max-width: 1023px) {
  /* Sidebar: fixed drawer */
  .sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    transform: translateX(-216px);
    transition: transform 0.25s ease;
    z-index: 100;
  }
  .sidebar.open { transform: translateX(0); }

  /* Show hamburger */
  .sb-toggle { display: flex !important; }

  /* Content */
  .view { padding: 16px 20px; }

  /* Metric grids: 3 cols for cols-5, 2 cols for cols-4 */
  .metrics-grid.cols-5 { grid-template-columns: repeat(3, 1fr); }
  .metrics-grid.cols-4 { grid-template-columns: repeat(2, 1fr); }

  /* Two-col layouts: stack */
  .two-col { grid-template-columns: 1fr !important; }

  /* Ticket meta col: horizontal strip above thread on tablet */
  .ticket-panel-body { flex-direction: column; }
  .ticket-meta-col {
    width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 12px;
    padding: 12px 16px;
    border-right: none;
    border-bottom: 0.5px solid var(--border-2);
  }
  .meta-section { flex: 1; min-width: 140px; }
  .thread-area { border-right: none; }

  /* Tab bar: horizontal scroll */
  .tab-bar { overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; }
  .tab-bar::-webkit-scrollbar { display: none; }

  /* Filter bar: wrap */
  .filter-bar { flex-wrap: wrap; }
}

/* ── Desktop (1024px+) ── */
@media (min-width: 1024px) {
  /* Sidebar: always visible, sticky */
  .sidebar { position: sticky; transform: none !important; transition: none; }
  .sb-toggle { display: none !important; }
  .sb-overlay { display: none !important; }
}

/* Create-ticket two-column: stacked on mobile, side-by-side at 900px+ */
.create-ticket-grid { grid-template-columns: 1fr; }
@media (min-width: 900px) {
  .create-ticket-grid { grid-template-columns: minmax(0,1.5fr) minmax(0,1fr); }
}

/* ── Large Desktop (1440px+) ── */
@media (min-width: 1440px) {
  .view { padding: 24px 32px; }
  .metrics-grid { gap: 14px; }
}

/* ── Tiptap rich text editor ── */
.tiptap-wrap { border: 1px solid #D8DCE8; border-radius: 8px; overflow: hidden; background: #fff; }
.tiptap-wrap.err { border-color: #E24B4A; }
.tiptap-toolbar {
  display: flex; align-items: center; gap: 2px; padding: 6px 8px;
  border-bottom: 1px solid #EEF0F5; background: #F8F9FB; flex-wrap: wrap;
}
.tiptap-toolbar button {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 5px; border: none; background: transparent;
  color: #4A5672; font-size: 14px; cursor: pointer; transition: background 0.12s, color 0.12s;
}
.tiptap-toolbar button:hover { background: #E8EBF5; color: #1B2A4A; }
.tiptap-toolbar button.active { background: #1B2A4A; color: #fff; }
.tiptap-sep { width: 1px; height: 18px; background: #D8DCE8; margin: 0 3px; }
.tb-div { width: 1px; height: 18px; background: #D8DCE8; margin: 0 3px; display: inline-block; }
.tiptap-body { padding: 10px 12px; min-height: 90px; }
.tiptap-body:focus-within { outline: none; }
.tiptap-reply { min-height: 60px; }
.tiptap-prose { outline: none; font-size: 13px; color: #2D3748; line-height: 1.6; }
.tiptap-prose p { margin: 0 0 6px; }
.tiptap-prose p:last-child { margin-bottom: 0; }
.tiptap-prose strong { font-weight: 600; }
.tiptap-prose em { font-style: italic; }
.tiptap-prose s { text-decoration: line-through; }
.tiptap-prose code { font-family: monospace; background: #F0F2F7; padding: 1px 5px; border-radius: 3px; font-size: 12px; }
.tiptap-prose pre { background: #1B2A4A; color: #E8EBF5; border-radius: 6px; padding: 10px 14px; font-size: 12px; overflow-x: auto; margin: 6px 0; }
.tiptap-prose pre code { background: none; padding: 0; color: inherit; }
.tiptap-prose ul, .tiptap-prose ol { padding-left: 20px; margin: 4px 0 6px; }
.tiptap-prose li { margin-bottom: 2px; }
.tiptap-prose blockquote { border-left: 3px solid #D8DCE8; margin: 6px 0; padding: 4px 12px; color: #6B7A99; }
.tiptap-prose hr { border: none; border-top: 1px solid #E2E5EE; margin: 10px 0; }
.tiptap-prose .is-editor-empty:before {
  content: attr(data-placeholder); float: left; color: #B0B9CC; pointer-events: none; height: 0;
}

/* prose-content: for rendering saved Tiptap HTML in thread */
.prose-content { font-size: 13px; font-family: 'DM Sans', sans-serif; color: #2D3748; line-height: 1.6; }
.prose-content p { margin: 0 0 6px; }
.prose-content p:last-child { margin-bottom: 0; }
.prose-content strong { font-weight: 600; }
.prose-content em { font-style: italic; }
.prose-content s { text-decoration: line-through; }
.prose-content code { font-family: monospace; background: #F0F2F7; padding: 1px 5px; border-radius: 3px; font-size: 12px; }
.prose-content pre { background: #1B2A4A; color: #E8EBF5; border-radius: 6px; padding: 10px 14px; font-size: 12px; overflow-x: auto; margin: 6px 0; }
.prose-content pre code { background: none; padding: 0; color: inherit; }
.prose-content ul, .prose-content ol { padding-left: 20px; margin: 4px 0 6px; }
.prose-content li { margin-bottom: 2px; }
.prose-content blockquote { border-left: 3px solid #D8DCE8; margin: 6px 0; padding: 4px 12px; color: #6B7A99; }
.prose-content hr { border: none; border-top: 1px solid #E2E5EE; margin: 10px 0; }

/* ── Attachment chips ── */
.attach-chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; color: #1B2A4A; background: #F4F5F8;
  border: 1px solid #E2E5EE; border-radius: 6px; padding: 3px 10px;
  text-decoration: none; transition: background 0.12s;
}
.attach-chip:hover { background: #E8EBF5; }
.msg-attachments { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }

/* ── File upload chips (queue) ── */
.file-chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; background: #F4F5F8; border: 1px solid #E2E5EE;
  border-radius: 6px; padding: 4px 8px; max-width: 220px;
}
.file-chip .type-icon { color: #8A9BB8; font-size: 13px; flex-shrink: 0; }
.file-chip .file-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #2D3748; }
.file-chip .file-size { color: #B0B9CC; flex-shrink: 0; }
.file-chip .file-x { border: none; background: none; cursor: pointer; color: #8A9BB8; font-size: 12px; padding: 0; flex-shrink: 0; }
.file-chip .file-x:hover { color: #E24B4A; }

/* ── Dropzone (compact) ── */
.dropzone-sm {
  display: flex; align-items: center; gap: 8px;
  border: 1px dashed #D8DCE8; border-radius: 6px;
  padding: 8px 12px; cursor: pointer; transition: border-color 0.12s, background 0.12s;
}
.dropzone-sm:hover { border-color: #00b8a9; background: #F0FFFE; }
.dropzone-sm input[type=file] { display: none; }

/* ── Reply edit button & form ── */
.tk-edit-btn-staff {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 5px; font-size: 12px;
  border: none; background: transparent;
  color: #8A9BB8; opacity: 0.45; transition: opacity 0.15s, background 0.15s, color 0.15s;
  cursor: pointer; margin-left: 4px;
}
.tk-edit-btn-staff:hover,
.tk-edit-btn-staff:focus { opacity: 1; background: #F4F5F8; color: #1B2A4A; }
.tk-edited-badge { font-style: italic; font-size: 11px; color: #8A9BB8; margin-left: 4px; }
.tk-edit-form-staff { margin-top: 8px; }
.tk-edit-actions-staff { display: flex; gap: 8px; justify-content: flex-end; margin-top: 8px; }

/* ── Collaborator suggestions dropdown ── */
.collab-suggestions-staff {
  border: 1px solid #E2E5EE; border-radius: 8px; background: #fff;
  box-shadow: 0 4px 16px rgba(0,0,0,0.08); overflow: hidden; margin-top: 4px;
}
.collab-option-staff {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border: none; background: transparent;
  width: 100%; text-align: left; cursor: pointer;
  border-bottom: 1px solid #F4F5F8; transition: background 0.1s;
}
.collab-option-staff:last-child { border-bottom: none; }
.collab-option-staff:hover { background: #F4F5F8; }

/* ── Ticket description block (top of thread area) ── */
.ticket-desc-block {
  background: #F8F9FC;
  border: 0.5px solid #E2E5EE;
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 4px;
}
.ticket-desc-label {
  display: flex; align-items: center; gap: 5px;
  font-size: 10.5px; font-weight: 600; color: #8A9BB8;
  text-transform: uppercase; letter-spacing: 0.06em;
  margin-bottom: 10px;
}
.ticket-desc-label i { font-size: 13px; }
.ticket-desc-meta {
  display: flex; flex-wrap: wrap; gap: 5px 14px;
  font-size: 11.5px; color: #6B7A99; margin-bottom: 10px;
}
.ticket-desc-meta span { display: flex; align-items: center; gap: 4px; }
.ticket-desc-meta i { font-size: 12px; }

/* ── Sticky reply composer ── */
.staff-composer {
  position: sticky;
  bottom: 0;
  z-index: 20;
  background: #fff;
  border-top: 0.5px solid #E2E5EE;
  box-shadow: 0 -2px 12px rgba(27,42,74,0.06);
}
.staff-composer-inner {
  padding: 12px 16px 14px;
}
.staff-composer-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
  flex-wrap: wrap;
  gap: 8px;
}

/* ── System Banners ── */
.system-banner-bar { display: flex; flex-direction: column; gap: 0; }
.sys-banner {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 16px;
    font-size: 13px;
    line-height: 1.5;
    border-bottom: 1px solid rgba(0,0,0,0.06);
}
.sys-banner-inner { display: flex; align-items: flex-start; gap: 10px; flex: 1; min-width: 0; }
.sys-banner-icon  { font-size: 15px; flex-shrink: 0; margin-top: 1px; }
.sys-banner-body  { flex: 1; min-width: 0; }
.sys-banner-title { font-weight: 600; margin-right: 6px; }
.sys-banner-dismiss {
    flex-shrink: 0;
    background: none;
    border: none;
    cursor: pointer;
    opacity: 0.5;
    padding: 2px 4px;
    border-radius: 4px;
    font-size: 13px;
    line-height: 1;
    transition: opacity 0.15s;
}
.sys-banner-dismiss:hover { opacity: 1; }

.sys-banner--info    { background: #EFF6FF; color: #1E40AF; }
.sys-banner--info    .sys-banner-dismiss { color: #1E40AF; }
.sys-banner--warning { background: #FFFBEB; color: #78350F; }
.sys-banner--warning .sys-banner-dismiss { color: #78350F; }
.sys-banner--danger  { background: #FEF2F2; color: #991B1B; }
.sys-banner--danger  .sys-banner-dismiss { color: #991B1B; }
.sys-banner--success { background: #F0FDF4; color: #14532D; }
.sys-banner--success .sys-banner-dismiss { color: #14532D; }
