/* ==========================================================================
   WORKFLOW ZERO IT — CLEAN LIGHT MODE UI
   ========================================================================== */

:root {
  --bg: #F8FAFC;
  --surface: #FFFFFF;
  --surface-subtle: #F1F5F9;
  --surface-hover: #F8FAFC;

  --border: #E2E8F0;
  --border-strong: #CBD5E1;

  --text: #0F172A;
  --text-secondary: #475569;
  --text-muted: #64748B;

  /* Workflow Zero Logo Palette (Clean Light Mode Cyan & Teal) */
  --primary: #0284C7;
  --primary-hover: #0369A1;
  --primary-soft: #E0F2FE;

  --teal: #0D9488;
  --teal-soft: #CCFBF1;

  --amber: #D97706;
  --amber-soft: #FEF3C7;

  --danger: #DC2626;
  --danger-soft: #FEE2E2;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-display: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --radius-sm: 6px;
  --radius: 8px;
  --radius-lg: 10px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.hidden {
  display: none !important;
}

/* ==========================================================================
   TOPBAR & NAVIGATION
   ========================================================================== */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: 60px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 28px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
}

.brand-img {
  height: 34px;
  width: auto;
  object-fit: contain;
  display: block;
}

.brand-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.02em;
}

.brand-accent {
  color: var(--primary);
}

.nav-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.nav-tab:hover {
  background: var(--surface-subtle);
  color: var(--text);
}

.nav-tab.active {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 600;
}

.tab-count {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(2, 132, 199, 0.12);
  color: var(--primary);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Header Compact Timer */
.header-timer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  border-radius: var(--radius);
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  font-size: 12.5px;
}

.header-timer.running {
  background: var(--teal-soft);
  border-color: #5EEAD4;
}

.timer-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #94A3B8;
}

.header-timer.running .timer-dot {
  background: var(--teal);
}

.timer-ticket {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--primary);
  cursor: pointer;
}

.timer-readout {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text);
  min-width: 62px;
}

.timer-btn {
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
}

.timer-btn:hover:not(:disabled) {
  border-color: var(--primary);
  color: var(--primary);
}

.timer-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.timer-btn-log {
  background: var(--teal);
  color: #FFFFFF;
  border-color: var(--teal);
}

.timer-btn-log:hover:not(:disabled) {
  background: #0F766E;
  color: #FFFFFF;
}

/* ==========================================================================
   MAIN CONTAINER & PAGE LAYOUT (MAXIMIZED FULL-WIDTH DESKTOP CANVAS)
   ========================================================================== */

.container {
  max-width: 1720px;
  width: 96%;
  margin: 0 auto;
  padding: 24px 20px 48px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

h1 {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}

h2 {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

h3 {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}

.text-muted {
  color: var(--text-muted);
  font-size: 13px;
}

/* ==========================================================================
   PANELS, STATS & GRIDS
   ========================================================================== */

.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  margin-bottom: 22px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  box-shadow: var(--shadow-sm);
}

.stat-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
}

.stat-value {
  font-family: var(--font-display);
  font-size: 25px;
  font-weight: 700;
  color: var(--text);
  margin-top: 4px;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1.45fr 1fr;
  gap: 24px;
  align-items: start;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
}

.panel.flush {
  padding: 0;
  overflow: hidden;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.panel-header h2, .panel-header h3 {
  margin-bottom: 0;
}

/* ==========================================================================
   CLEAN LIST TABLES (TICKETS, CLIENTS, KB)
   ========================================================================== */

.clean-list-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.clean-list-table th {
  background: var(--surface-subtle);
  color: var(--text-secondary);
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
}

.clean-list-table td {
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
  color: var(--text);
  vertical-align: middle;
}

.clean-list-table tbody tr:last-child td {
  border-bottom: none;
}

.clean-list-table tbody tr.clickable-row {
  cursor: pointer;
  transition: background 0.1s ease;
}

.clean-list-table tbody tr.clickable-row:hover {
  background: #F1F5F9;
}

.clean-list-table tbody tr.selected-row {
  background: var(--primary-soft);
}

.mono-id {
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--primary);
}

/* Simple List Rows on Dashboard */
.list-container {
  display: flex;
  flex-direction: column;
}

.simple-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}

.simple-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.simple-row:hover .row-title {
  color: var(--primary);
}

.row-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.row-title {
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.row-sub {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ==========================================================================
   BADGES, BUTTONS & CONTROLS
   ========================================================================== */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-high {
  background: var(--danger-soft);
  color: var(--danger);
}

.badge-medium {
  background: var(--amber-soft);
  color: var(--amber);
}

.badge-low {
  background: var(--surface-subtle);
  color: var(--text-secondary);
}

.badge-open {
  background: var(--primary-soft);
  color: var(--primary);
}

.badge-progress {
  background: var(--teal-soft);
  color: var(--teal);
}

.badge-waiting {
  background: var(--amber-soft);
  color: var(--amber);
}

.badge-resolved {
  background: var(--surface-subtle);
  color: var(--text-muted);
}

.badge-teal {
  background: var(--teal-soft);
  color: var(--teal);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
}

.btn-primary {
  background: var(--primary);
  color: #FFFFFF;
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border-strong);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--surface-subtle);
}

.btn-secondary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
}

.btn-link {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

.btn-link:hover {
  text-decoration: underline;
}

.full-width {
  width: 100%;
}

/* Filter Bar & Inputs */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.input, .select, .textarea {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 7px 12px;
  font-family: var(--font-sans);
  font-size: 13.5px;
  color: var(--text);
  outline: none;
}

.input:focus, .select:focus, .textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.15);
}

.search-input {
  width: 280px;
}

.textarea {
  width: 100%;
  resize: vertical;
}

.segmented-control {
  display: inline-flex;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 2px;
}

.seg-btn {
  padding: 5px 11px;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
}

.seg-btn.active {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 600;
}

/* ==========================================================================
   TICKET DETAIL VIEW
   ========================================================================== */

.detail-nav {
  margin-bottom: 12px;
}

.ticket-header-panel {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.ticket-meta-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.ticket-title {
  font-size: 19px;
  margin-bottom: 4px;
}

.ticket-client-line {
  font-size: 13px;
  color: var(--text-secondary);
}

.ticket-header-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.field-inline label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 3px;
}

.clickable-link {
  cursor: pointer;
  color: var(--primary);
  text-decoration: none;
}

.clickable-link:hover {
  text-decoration: underline;
}

.ticket-detail-grid {
  display: grid;
  grid-template-columns: 1.65fr 1fr;
  gap: 24px;
  align-items: start;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.stack-sm {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.description-text {
  color: var(--text-secondary);
  font-size: 13.5px;
  line-height: 1.6;
}

.note-actions-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
  gap: 12px;
  flex-wrap: wrap;
}

.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
}

.notes-history {
  margin-top: 16px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.note-item {
  background: var(--surface-subtle);
  border-radius: var(--radius);
  padding: 10px 12px;
  font-size: 13px;
}

.note-item-top {
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
  font-size: 12px;
  color: var(--text-muted);
}

/* Timer Card inside Ticket View */
.timer-card {
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 14px;
}

.timer-card.timer-active {
  background: var(--teal-soft);
  border-color: #5EEAD4;
}

.timer-card-top {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
}

.mono-cost {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--teal);
}

.timer-big-clock {
  font-family: var(--font-mono);
  font-size: 26px;
  font-weight: 600;
  color: var(--text);
  margin: 4px 0 10px;
}

.timer-card-buttons {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 8px;
}

.manual-time-box {
  border-top: 1px solid var(--border);
  padding-top: 12px;
  margin-bottom: 12px;
}

.section-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.manual-row {
  display: flex;
  gap: 8px;
}

.time-log-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.time-log-row {
  display: flex;
  justify-content: space-between;
  font-size: 12.5px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}

.time-log-row:last-child {
  border-bottom: none;
}

.schedule-status {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.schedule-form {
  display: flex;
  gap: 8px;
}

/* ==========================================================================
   DISPATCH CALENDAR BOARD
   ========================================================================== */

.dispatch-layout {
  display: grid;
  grid-template-columns: 330px 1fr;
  gap: 24px;
  align-items: start;
}

.unscheduled-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.unscheduled-item {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-subtle);
  cursor: grab;
}

.unscheduled-item:hover {
  border-color: var(--primary);
}

.calendar-grid {
  display: grid;
  grid-template-columns: 72px repeat(5, 1fr);
}

.cal-head {
  background: var(--surface-subtle);
  padding: 10px;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
}

.cal-head.today {
  background: var(--primary-soft);
  color: var(--primary);
}

.cal-time {
  padding: 10px 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  background: var(--surface-subtle);
}

.cal-slot {
  min-height: 58px;
  padding: 4px;
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  cursor: pointer;
}

.cal-slot:hover {
  background: var(--surface-hover);
}

.cal-slot.drag-over {
  background: var(--primary-soft);
}

.cal-event {
  background: var(--primary-soft);
  border-left: 3px solid var(--primary);
  border-radius: 4px;
  padding: 5px 7px;
  font-size: 11.5px;
  margin-bottom: 3px;
  cursor: pointer;
}

.cal-event-title {
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ==========================================================================
   CLIENT KNOWLEDGE BASE (PER CLIENT)
   ========================================================================== */

.client-pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.client-pill {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
}

.client-pill.active {
  background: var(--primary);
  color: #FFFFFF;
  border-color: var(--primary);
}

.kb-layout {
  display: grid;
  grid-template-columns: 460px 1fr;
  gap: 24px;
  align-items: start;
}

/* ==========================================================================
   MSP CLIENT DOSSIER & PROFILE STYLES
   ========================================================================== */

.client-hero-panel {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
  flex-wrap: wrap;
  background: linear-gradient(to right, #FFFFFF, #F8FAFC);
  border-left: 4px solid var(--primary);
}

.client-hero-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.client-hero-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
}

.client-hero-meta-grid {
  display: flex;
  gap: 24px;
  margin-top: 10px;
  font-size: 13px;
  color: var(--text-secondary);
  flex-wrap: wrap;
}

.msp-dossier-grid {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 24px;
  align-items: start;
}

.info-table-wrap {
  overflow-x: auto;
}

.key-value-table {
  width: 100%;
  border-collapse: collapse;
}

.key-value-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  vertical-align: middle;
}

.key-value-table td:first-child {
  width: 180px;
  font-weight: 600;
  color: var(--text-muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.key-value-table td:last-child {
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 12.5px;
}

.key-value-table tr:last-child td {
  border-bottom: none;
}

.subnets-table th {
  font-size: 11px;
}

.subnets-table td {
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 8px 12px;
}

.assets-metric-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.asset-pill-box {
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  text-align: center;
}

.asset-pill-val {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  color: var(--primary);
}

.asset-pill-lbl {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-top: 3px;
}

.compact-ticket-list, .compact-article-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.compact-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-subtle);
  cursor: pointer;
  font-size: 13px;
  transition: all 0.12s ease;
}

.compact-item-row:hover {
  background: var(--surface);
  border-color: var(--primary);
}

/* ==========================================================================
   CLIENT CARD EDITING STYLES (EDIT EVERY CARD IN CLIENT PROFILE)
   ========================================================================== */

.card-edit-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.edit-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.edit-grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-group label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.card-edit-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.subnets-edit-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.subnets-edit-row {
  display: grid;
  grid-template-columns: 75px 1.2fr 1.2fr 1fr 34px;
  gap: 8px;
  align-items: center;
}

.btn-icon-del {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  border: 1px solid #FCA5A5;
  background: var(--danger-soft);
  color: var(--danger);
  cursor: pointer;
  font-size: 14px;
  font-weight: bold;
  transition: all 0.15s ease;
}

.btn-icon-del:hover {
  background: #FEE2E2;
  border-color: var(--danger);
}

.kb-pre {
  background: #0F172A;
  color: #F8FAFC;
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 12px 14px;
  border-radius: var(--radius);
  overflow-x: auto;
  margin-top: 10px;
}

/* ==========================================================================
   MODALS & TOASTS
   ========================================================================== */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(15, 23, 42, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  width: 100%;
  max-width: 480px;
  padding: 20px;
  box-shadow: 0 20px 25px -5px rgba(15, 23, 42, 0.12);
}

.modal.modal-lg {
  max-width: 680px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.modal-close {
  background: none;
  border: none;
  font-size: 22px;
  color: var(--text-muted);
  cursor: pointer;
}

.label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 14px;
}

.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: #0F172A;
  color: #FFFFFF;
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.15);
}

@media (max-width: 1024px) {
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .grid-2, .ticket-detail-grid, .dispatch-layout, .kb-layout { grid-template-columns: 1fr; }
}

/* ==========================================================================
   FIREBASE AUTHENTICATION, CLOUD STATUS & EMPTY STATES
   ========================================================================== */

/* Auth Screen (Login / Register Portal) */
.auth-screen {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: linear-gradient(135deg, #F8FAFC 0%, #E0F2FE 50%, #F0FDFA 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow-y: auto;
}

.auth-screen.hidden {
  display: none !important;
}

.auth-card {
  width: 100%;
  max-width: 440px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 32px 28px;
  box-shadow: 0 20px 25px -5px rgba(15, 23, 42, 0.08), 0 8px 10px -6px rgba(15, 23, 42, 0.04);
}

.auth-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-bottom: 24px;
}

.auth-logo-img {
  height: 52px;
  width: auto;
  object-fit: contain;
  margin-bottom: 12px;
}

.auth-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}

.auth-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

.auth-security-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #F0FDF4;
  border: 1px solid #BBF7D0;
  color: #166534;
  padding: 4px 12px;
  border-radius: 9999px;
  font-size: 11.5px;
  font-weight: 600;
  margin: 0 auto 18px auto;
  letter-spacing: 0.02em;
}

.auth-restricted-note {
  font-size: 11.5px;
  color: var(--text-muted);
  line-height: 1.45;
  text-align: center;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 12px;
  margin-top: 14px;
}

.auth-error {
  background: var(--danger-soft);
  color: var(--danger);
  border: 1px solid #FECACA;
  padding: 10px 12px;
  border-radius: var(--radius);
  font-size: 12.5px;
  margin-bottom: 14px;
  display: none;
  line-height: 1.4;
}

.auth-error.visible {
  display: block;
}

.auth-footer {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
  font-size: 12px;
  color: var(--text-muted);
}

.auth-cloud-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 9999px;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  font-size: 11.5px;
  cursor: pointer;
}

/* Cloud Status & User Pill in Topbar */
.cloud-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 9999px;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.cloud-status-pill:hover {
  background: #E2E8F0;
}

.cloud-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #94A3B8;
  display: inline-block;
}

.cloud-status-dot.connected {
  background: #10B981;
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.5);
}

.cloud-status-dot.setup {
  background: #F59E0B;
}

.user-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 3px 8px 3px 4px;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: 9999px;
}

.user-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--primary);
  color: #FFFFFF;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.user-meta {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.user-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}

.user-email {
  font-size: 10.5px;
  color: var(--text-muted);
}

/* Empty State Containers */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}

.empty-icon {
  font-size: 32px;
  margin-bottom: 12px;
  opacity: 0.8;
}

.empty-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.empty-desc {
  font-size: 13px;
  color: var(--text-muted);
  max-width: 400px;
  margin-bottom: 16px;
  line-height: 1.5;
}

.config-code-box {
  background: #0F172A;
  color: #F8FAFC;
  padding: 12px;
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.5;
  overflow-x: auto;
  margin-bottom: 14px;
}
