/* ============================================================
   Red Cross StarConnect Kit Plan Tracker — Stylesheet
   ============================================================ */

:root {
  --red-primary:   #ED1B2E;
  --red-dark:      #B5121B;
  --white:         #FFFFFF;
  --bg-light:      #F7F7F7;
  --border-grey:   #DDDDDD;
  --text-dark:     #333333;
  --text-muted:    #666666;
  --notice-bg:     #FFF8E1;
  --notice-border: #F9A825;
  --notice-text:   #5D4037;
  --error-bg:      #FEECEC;
  --error-border:  #ED1B2E;
  --error-text:    #B5121B;
  --success-bg:    #E8F5E9;
  --success-border:#2E7D32;
  --success-text:  #1B5E20;

  --radius: 6px;
  --shadow: 0 1px 4px rgba(0,0,0,0.10);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg-light);
  color: var(--text-dark);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.hidden { display: none !important; }

.container {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 16px;
}

/* ══════════════════════════════════════
   AUTH SCREENS
══════════════════════════════════════ */
.auth-screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background: var(--bg-light);
}
.auth-card {
  background: var(--white);
  border: 1.5px solid var(--border-grey);
  border-radius: 10px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.10);
  padding: 36px 32px;
  width: 100%;
  max-width: 420px;
  text-align: center;
}
.auth-cross { margin: 0 auto 20px; }
.auth-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-dark);
  line-height: 1.35;
  margin-bottom: 8px;
}
.auth-subtitle {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 20px;
}
.auth-notice {
  background: var(--notice-bg);
  border: 1px solid var(--notice-border);
  color: var(--notice-text);
  font-size: 0.80rem;
  font-weight: 500;
  border-radius: var(--radius);
  padding: 10px 14px;
  margin-bottom: 24px;
  text-align: left;
}
.auth-form {
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.auth-footer {
  margin-top: 24px;
  font-size: 0.76rem;
  color: var(--text-muted);
  text-align: center;
  max-width: 420px;
}

/* ── FORM ELEMENTS ── */
.form-label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-dark);
  display: block;
  margin-bottom: 5px;
}
.req { color: var(--red-primary); }
.form-input {
  width: 100%;
  padding: 11px 13px;
  font-size: 0.95rem;
  border: 1.5px solid var(--border-grey);
  border-radius: var(--radius);
  background: var(--white);
  color: var(--text-dark);
  outline: none;
  transition: border-color 0.15s;
  font-family: inherit;
}
.form-input:focus {
  border-color: var(--red-primary);
  box-shadow: 0 0 0 3px rgba(237,27,46,0.12);
}
.form-textarea { resize: vertical; min-height: 64px; }
.form-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 4px;
}
.pin-input {
  text-align: center;
  font-size: 1.5rem;
  letter-spacing: 0.25em;
}
.form-error {
  background: var(--error-bg);
  border: 1px solid var(--error-border);
  color: var(--error-text);
  font-size: 0.85rem;
  font-weight: 500;
  border-radius: var(--radius);
  padding: 10px 14px;
}

/* ── FORM GRID ── */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.form-group { display: flex; flex-direction: column; }
.form-group-full { grid-column: 1 / -1; }

/* ══════════════════════════════════════
   MAIN APP LAYOUT
══════════════════════════════════════ */
#view-app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── HEADER ── */
.site-header {
  background: var(--red-primary);
  color: var(--white);
  box-shadow: 0 2px 6px rgba(0,0,0,0.18);
}
.header-inner {
  max-width: 1440px;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.header-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
  min-width: 0;
}
.header-titles { min-width: 0; }
.header-title {
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.header-subtitle { font-size: 0.75rem; opacity: 0.85; margin-top: 2px; }
.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  flex-wrap: wrap;
}
.user-info { display: flex; align-items: center; gap: 5px; font-size: 0.82rem; white-space: nowrap; }
.user-label { opacity: 0.80; }
.user-name { font-weight: 700; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.btn-header-secondary,
.btn-logout {
  background: rgba(255,255,255,0.15);
  color: var(--white);
  border: 1.5px solid rgba(255,255,255,0.45);
  border-radius: var(--radius);
  padding: 6px 12px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
}
.btn-header-secondary:hover,
.btn-logout:hover { background: rgba(255,255,255,0.27); }

/* ── LOGOS ── */
.auth-logo {
  display: block;
  width: 190px;
  height: auto;
  margin: 0 auto 22px;
}
.header-logo {
  display: block;
  height: 48px;
  width: auto;
  background: var(--white);
  border-radius: 4px;
  padding: 5px 10px;
  flex-shrink: 0;
}

/* ── NOTICE BANNER ── */
.notice-banner {
  background: var(--notice-bg);
  border-bottom: 2px solid var(--notice-border);
  color: var(--notice-text);
  font-size: 0.85rem;
  font-weight: 500;
  padding: 9px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
}

/* ── MAIN ── */
.main-content { flex: 1; padding: 24px 0 48px; }

/* ══════════════════════════════════════
   SUCCESS TOAST
══════════════════════════════════════ */
.success-toast {
  background: var(--success-bg);
  border: 1.5px solid var(--success-border);
  color: var(--success-text);
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: var(--radius);
  padding: 12px 18px;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.success-toast::before { content: "✓"; font-size: 1rem; }

/* ══════════════════════════════════════
   SUMMARY STATS
══════════════════════════════════════ */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--white);
  border: 1.5px solid var(--border-grey);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 20px;
  text-align: center;
}
.stat-card.stat-active  { border-top: 4px solid #2E7D32; }
.stat-card.stat-standby { border-top: 4px solid #1565C0; }
.stat-card.stat-fault   { border-top: 4px solid var(--red-primary); }
.stat-value { font-size: 2rem; font-weight: 800; color: var(--text-dark); line-height: 1; margin-bottom: 6px; }
.stat-label { font-size: 0.82rem; color: var(--text-muted); font-weight: 500; text-transform: uppercase; letter-spacing: 0.04em; }

/* ══════════════════════════════════════
   TOOLBAR
══════════════════════════════════════ */
.toolbar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.search-wrap { flex: 1; min-width: 200px; }
.search-input, .filter-select {
  width: 100%;
  padding: 10px 13px;
  font-size: 0.95rem;
  border: 1.5px solid var(--border-grey);
  border-radius: var(--radius);
  background: var(--white);
  color: var(--text-dark);
  outline: none;
  transition: border-color 0.15s;
}
.search-input:focus, .filter-select:focus {
  border-color: var(--red-primary);
  box-shadow: 0 0 0 3px rgba(237,27,46,0.12);
}
.filter-wrap { min-width: 170px; }
.results-meta { font-size: 0.83rem; color: var(--text-muted); margin-bottom: 12px; min-height: 1.2em; }

/* ══════════════════════════════════════
   DESKTOP TABLE
══════════════════════════════════════ */
.table-wrap {
  background: var(--white);
  border: 1.5px solid var(--border-grey);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow-x: auto;
  overflow-y: auto;
  max-height: calc(100vh - 280px);
}
.kits-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.kits-table thead { background: #F0F0F0; }
.kits-table thead th { position: sticky; top: 0; z-index: 2; background: #F0F0F0; }
.kits-table th {
  text-align: left;
  padding: 11px 8px;
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border-grey);
  white-space: nowrap;
}
.kits-table td { padding: 11px 8px; border-bottom: 1px solid #EEEEEE; vertical-align: middle; }
.kits-table tbody tr:last-child td { border-bottom: none; }
.kits-table tbody tr:hover { background: #FAFAFA; }
.kits-table .col-kit { font-weight: 700; white-space: nowrap; }
.kits-table .col-plan { min-width: 130px; }
.kits-table .col-billing-day  { white-space: nowrap; min-width: 90px; }
.kits-table .col-deployed-area { min-width: 120px; }
.billing-day-edit-btn { background: none; border: none; cursor: pointer; color: var(--text-muted); font-size: 0.85rem; padding: 0 2px; margin-left: 4px; opacity: 0.5; }
.billing-day-edit-btn:hover { opacity: 1; color: var(--primary); }
.billing-day-form { display: inline-flex; align-items: center; gap: 4px; }
.billing-day-input { width: 52px; padding: 3px 6px; border: 1px solid var(--border-grey); border-radius: 4px; font-size: 0.85rem; }
.inline-edit-btn { background: none; border: none; cursor: pointer; color: var(--text-muted); font-size: 0.85rem; padding: 0 2px; margin-left: 4px; opacity: 0.5; }
.inline-edit-btn:hover { opacity: 1; color: var(--primary); }
.inline-edit-form { display: inline-flex; align-items: center; gap: 4px; }
.inline-edit-input { width: 130px; padding: 3px 6px; border: 1px solid var(--border-grey); border-radius: 4px; font-size: 0.85rem; }
.btn-xs { padding: 2px 8px; font-size: 0.78rem; }
.kits-table .col-changed-by { color: var(--text-muted); font-size: 0.85rem; }
.kits-table .col-changed-at { color: var(--text-muted); font-size: 0.82rem; white-space: nowrap; }
.kits-table .col-notes { position: relative; overflow: visible; color: var(--text-muted); font-size: 0.85rem; max-width: 180px; }
.notes-popup {
  position: absolute;
  top: 50%;
  left: 0;
  transform: translateY(-50%);
  z-index: 30;
  background: #fff;
  border: 1.5px solid var(--border-grey);
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.13);
  padding: 8px 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  min-width: 420px;
}
.notes-edit-input { flex: 1; min-width: 200px; padding: 4px 8px; border: 1px solid var(--border-grey); border-radius: 4px; font-size: 0.85rem; }
.kits-table .col-actions { white-space: nowrap; text-align: right; }
th.col-actions { text-align: right; }
.table-loading { text-align: center; padding: 56px 16px; color: var(--text-muted); }
.table-loading .spinner { margin: 0 auto 12px; }
.table-empty { text-align: center; padding: 56px 16px; color: var(--text-muted); }

/* ══════════════════════════════════════
   MOBILE CARDS
══════════════════════════════════════ */
.kits-mobile-list { display: none; flex-direction: column; gap: 12px; }
.kit-card {
  background: var(--white);
  border: 1.5px solid var(--border-grey);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.kit-card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.kit-card-number { font-size: 1.05rem; font-weight: 700; color: var(--text-dark); }
.kit-card-badges { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.kit-card-row { display: flex; align-items: baseline; gap: 6px; font-size: 0.85rem; }
.kit-card-row-label { font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); white-space: nowrap; min-width: 82px; }
.kit-card-row-value { color: var(--text-dark); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kit-card-notes { font-size: 0.83rem; color: var(--text-muted); font-style: italic; word-break: break-word; }
.kit-card-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ══════════════════════════════════════
   BADGES
══════════════════════════════════════ */
.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  white-space: nowrap;
}
.badge-plan          { background: #E3F2FD; color: #1565C0; border: 1px solid #90CAF9; }
.badge-plan-standby   { background: #E3F2FD; color: #1565C0; border: 1px solid #90CAF9; }
.badge-plan-paid      { background: #FEECEC; color: #B5121B; border: 1px solid #F5A0A6; }
.badge-plan-suspended { background: #F5F5F5; color: #757575; border: 1px solid #BDBDBD; }
.badge-standby { background: #F5F5F5; color: #616161; border: 1px solid #E0E0E0; }
.badge-active  { background: #E8F5E9; color: #2E7D32; border: 1px solid #A5D6A7; }
.badge-fault   { background: #FEECEC; color: #B5121B; border: 1px solid #F5A0A6; }

/* ══════════════════════════════════════
   BUTTONS
══════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  font-size: 0.92rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s, transform 0.08s;
}
.btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn-primary { background: var(--red-primary); color: var(--white); }
.btn-primary:hover:not(:disabled) { background: var(--red-dark); }
.btn-secondary { background: var(--white); color: var(--text-dark); border: 1.5px solid var(--border-grey); }
.btn-secondary:hover:not(:disabled) { background: var(--bg-light); }
.btn-block { width: 100%; }
.btn-sm { padding: 5px 12px; font-size: 0.80rem; }
.btn-danger-outline { background: transparent; color: var(--red-dark); border: 1.5px solid var(--red-dark); }
.btn-danger-outline:hover:not(:disabled) { background: var(--error-bg); }

/* ── LOADING / SPINNER ── */
.spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--border-grey);
  border-top-color: var(--red-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ══════════════════════════════════════
   MODAL
══════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 1000;
  overflow-y: auto;
}
.modal-card {
  background: var(--white);
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
  width: 100%;
  max-width: 460px;
  overflow: hidden;
  margin: auto;
}
.modal-card-lg { max-width: 560px; }
.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-grey);
  gap: 12px;
}
.modal-title { font-size: 1.05rem; font-weight: 700; color: var(--text-dark); }
.modal-kit-label { font-size: 0.82rem; color: var(--text-muted); margin-top: 2px; }
.modal-close {
  background: none; border: none; font-size: 1.4rem; color: var(--text-muted);
  cursor: pointer; padding: 2px 6px; border-radius: 4px; line-height: 1; flex-shrink: 0;
}
.modal-close:hover { background: var(--bg-light); }
.modal-body { padding: 20px; }
.modal-desc { font-size: 0.86rem; color: var(--text-muted); margin-bottom: 16px; line-height: 1.5; }
.modal-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
.modal-actions-row { flex-direction: row; gap: 10px; }

/* Change Plan current row */
.cp-current-row {
  display: flex;
  gap: 16px;
  background: var(--bg-light);
  border: 1px solid var(--border-grey);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.cp-current-item { display: flex; flex-direction: column; gap: 3px; }
.cp-current-label { font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); }
.cp-current-value { font-size: 0.9rem; font-weight: 600; color: var(--text-dark); }

.cp-current-row--standby  { background: #E3F2FD; border-color: #90CAF9; }
.cp-current-row--standby  .cp-current-label,
.cp-current-row--standby  .cp-current-value { color: #1565C0; }

.cp-current-row--paid     { background: #FEECEC; border-color: #F5A0A6; }
.cp-current-row--paid     .cp-current-label,
.cp-current-row--paid     .cp-current-value { color: #B5121B; }

.cp-current-row--suspended { background: #F5F5F5; border-color: #BDBDBD; }
.cp-current-row--suspended .cp-current-label,
.cp-current-row--suspended .cp-current-value { color: #757575; }

/* ══════════════════════════════════════
   APP NAVIGATION
══════════════════════════════════════ */
.header-user {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: rgba(255,255,255,0.85);
  flex-shrink: 0;
}

.app-nav {
  background: var(--white);
  border-bottom: 2px solid var(--border-grey);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 3px rgba(0,0,0,0.07);
}
.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: 44px;
}
.nav-pages {
  display: flex;
  align-items: stretch;
  height: 100%;
  gap: 0;
}
.nav-link {
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  padding: 0 16px;
  margin-bottom: -2px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.nav-link:hover { color: var(--text-dark); }
.nav-link.nav-active {
  color: var(--red-primary);
  border-bottom-color: var(--red-primary);
}
.nav-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}
.nav-action-btn {
  background: none;
  border: none;
  padding: 5px 10px;
  border-radius: var(--radius);
  font-size: 0.825rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.nav-action-btn:hover {
  background: var(--bg-light);
  color: var(--text-dark);
}
.nav-logout-btn { color: var(--red-primary); }
.nav-logout-btn:hover { background: #FEECEC; color: var(--red-dark); }

/* ══════════════════════════════════════
   PLAN MANAGEMENT PAGE
══════════════════════════════════════ */
.page-section-header {
  padding: 20px 0 16px;
  border-bottom: 1px solid var(--border-grey);
  margin-bottom: 18px;
}
.page-section-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 4px;
}
.page-section-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  max-width: 680px;
  line-height: 1.5;
}

/* Plans table */
.plans-table-wrap {
  overflow-x: auto;
  border: 1.5px solid var(--border-grey);
  border-radius: var(--radius);
  margin-bottom: 18px;
  box-shadow: var(--shadow);
}
.plans-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--white);
  font-size: 0.88rem;
}
.plans-table thead { background: #F5F5F5; }
.plans-table th {
  text-align: left;
  padding: 10px 14px;
  font-size: 0.73rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border-grey);
  white-space: nowrap;
}
.plans-table td {
  padding: 11px 14px;
  border-bottom: 1px solid #EEEEEE;
  vertical-align: middle;
}
.plans-table tbody tr:last-child td { border-bottom: none; }
.plans-table tbody tr:hover { background: #FAFAFA; }
.plans-table .col-desc { color: var(--text-muted); font-size: 0.84rem; max-width: 260px; }
.plans-table .col-kits { text-align: center; font-weight: 600; color: var(--text-muted); }
.plans-table .col-actions { width: 160px; white-space: nowrap; }

/* Plan status badges */
.badge-plan-active   { background: #E8F5E9; color: #1B5E20; border: 1px solid #A5D6A7; }
.badge-plan-inactive { background: #F5F5F5; color: #777777; border: 1px solid #CCCCCC; }

/* Plans mobile cards */
.plans-mobile-list { display: none; flex-direction: column; gap: 10px; margin-bottom: 18px; }
.plan-card {
  background: var(--white);
  border: 1.5px solid var(--border-grey);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
}
.plan-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 6px;
}
.plan-card-name { font-weight: 700; font-size: 0.95rem; }
.plan-card-desc { font-size: 0.83rem; color: var(--text-muted); margin-bottom: 8px; }
.plan-card-meta { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 10px; }
.plan-card-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Add New Plan card */
.add-plan-card {
  background: var(--white);
  border: 1.5px solid var(--border-grey);
  border-radius: var(--radius);
  padding: 20px 24px 24px;
  box-shadow: var(--shadow);
  margin-bottom: 32px;
}
.add-plan-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-grey);
}
.add-plan-actions {
  margin-top: 16px;
  display: flex;
  gap: 10px;
  align-items: center;
}

/* Checkbox label */
.form-check-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  color: var(--text-dark);
  cursor: pointer;
}
.form-check {
  width: 16px;
  height: 16px;
  accent-color: var(--red-primary);
  cursor: pointer;
  flex-shrink: 0;
}

/* ══════════════════════════════════════
   HISTORY MODAL
══════════════════════════════════════ */
.modal-card-xl { max-width: 860px; }

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border-grey);
  display: flex;
  justify-content: flex-end;
}

.hist-loading {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 32px 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.hist-empty {
  text-align: center;
  padding: 40px 16px;
  color: var(--text-muted);
  font-size: 0.9rem;
  border: 1.5px dashed var(--border-grey);
  border-radius: var(--radius);
}

/* History table — desktop */
.hist-table-wrap {
  overflow-x: auto;
  border: 1.5px solid var(--border-grey);
  border-radius: var(--radius);
}
.hist-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}
.hist-table thead { background: #F0F0F0; }
.hist-table th {
  text-align: left;
  padding: 9px 12px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border-grey);
  white-space: nowrap;
}
.hist-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #EEEEEE;
  vertical-align: top;
}
.hist-table tbody tr:last-child td { border-bottom: none; }
.hist-table tbody tr:hover { background: #FAFAFA; }
.hist-table .col-date { white-space: nowrap; color: var(--text-muted); font-size: 0.82rem; }
.hist-table .col-notes { color: var(--text-muted); font-style: italic; max-width: 160px; word-break: break-word; }
.hist-table .col-by { white-space: nowrap; }

/* History arrow — "From → To" cells */
.hist-change {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.hist-arrow { color: var(--text-muted); font-size: 0.8rem; }

/* History cards — mobile */
.hist-card-list { display: none; flex-direction: column; gap: 10px; }
.hist-card {
  background: var(--bg-light);
  border: 1.5px solid var(--border-grey);
  border-radius: var(--radius);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.hist-card-date { font-size: 0.78rem; color: var(--text-muted); }
.hist-card-by   { font-size: 0.82rem; font-weight: 600; }
.hist-card-row  { font-size: 0.83rem; display: flex; gap: 6px; align-items: baseline; flex-wrap: wrap; }
.hist-card-label { font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); white-space: nowrap; min-width: 52px; }
.hist-card-notes { font-size: 0.82rem; color: var(--text-muted); font-style: italic; }

/* ── FOOTER ── */
.site-footer {
  background: var(--text-dark);
  color: rgba(255,255,255,0.65);
  font-size: 0.8rem;
  padding: 14px 16px;
  text-align: center;
}

/* ══════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════ */
@media (max-width: 860px) {
  .stats-row { grid-template-columns: repeat(2, 1fr); }
}

/* Nav: stack into two rows on narrow viewports */
@media (max-width: 640px) {
  .nav-inner {
    height: auto;
    flex-wrap: wrap;
    padding: 0;
    align-items: stretch;
  }
  .nav-pages {
    width: 100%;
    height: 40px;
    border-bottom: 1px solid #EEEEEE;
  }
  .nav-actions {
    width: 100%;
    padding: 4px 0;
    justify-content: flex-end;
  }
  .nav-action-btn {
    font-size: 0.78rem;
    padding: 4px 8px;
  }
}

@media (max-width: 700px) {
  .table-wrap  { display: none; }
  .kits-mobile-list { display: flex; }
  .plans-table-wrap { display: none; }
  .plans-mobile-list { display: flex; }
  .hist-table-wrap { display: none; }
  .hist-card-list  { display: flex; }
  .header-subtitle { display: none; }
  .rc-cross { width: 32px; height: 32px; }
  .user-info { display: none; }
  .toolbar { flex-direction: column; }
  .filter-wrap { min-width: unset; }
  .auth-card { padding: 28px 20px; }
  .form-grid { grid-template-columns: 1fr; }
  .modal-actions-row { flex-direction: column; }
}
@media (max-width: 480px) {
  .stats-row { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .btn-header-secondary { display: none; }
}
