/* ─────────────────────────────────────────────────────────────────────────────
   Camp Hill Handyman — Admin Panel Stylesheet
   ───────────────────────────────────────────────────────────────────────────── */

:root {
  --adm-sidebar-w: 252px;
  --adm-topbar-h: 58px;
  --adm-sidebar-bg: #0c1322;
  --adm-sidebar-border: rgba(255,255,255,0.07);
  --adm-accent: #fbbf24;
  --adm-accent-dim: rgba(251,191,36,0.1);
  --adm-blue: #1e3a8a;
  --adm-blue-mid: #2563eb;
  --adm-surface: #f1f5f9;
  --adm-card: #ffffff;
  --adm-border: #e2e8f0;
  --adm-text: #0f172a;
  --adm-muted: #64748b;
  --adm-faint: #94a3b8;
}

/* ── Base ──────────────────────────────────────────────────────────────────── */
html, body { height: 100%; }
body {
  margin: 0;
  font-family: 'Inter', ui-sans-serif, system-ui, sans-serif;
  background: var(--adm-surface);
  color: var(--adm-text);
  -webkit-font-smoothing: antialiased;
}

/* ── Shell ─────────────────────────────────────────────────────────────────── */
.adm-shell {
  display: flex;
  min-height: 100vh;
}

/* ─────────────────────────────────────────────────────────────────────────────
   SIDEBAR
   ───────────────────────────────────────────────────────────────────────────── */
.adm-sidebar {
  width: var(--adm-sidebar-w);
  background: var(--adm-sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  overflow-y: auto;
  overflow-x: hidden;
  transition: transform 0.26s cubic-bezier(0.4,0,0.2,1);
  scrollbar-width: none;
}
.adm-sidebar::-webkit-scrollbar { display: none; }

/* Logo */
.adm-logo-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 16px 16px;
  border-bottom: 1px solid var(--adm-sidebar-border);
  flex-shrink: 0;
}
.adm-logo-row a { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.adm-logo-row img {
  height: 30px;
  width: auto;
  filter: brightness(0) invert(1);
  opacity: 0.85;
}
.adm-admin-chip {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--adm-accent);
  background: rgba(251,191,36,0.12);
  border: 1px solid rgba(251,191,36,0.2);
  padding: 3px 8px;
  border-radius: 5px;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Nav */
.adm-nav { padding: 10px 0 8px; flex: 1; }

.adm-nav-group-label {
  padding: 14px 18px 5px;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.22);
}

.adm-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  margin: 1px 8px;
  border-radius: 9px;
  text-decoration: none;
  color: rgba(255,255,255,0.5);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  background: transparent;
  width: calc(100% - 16px);
  text-align: left;
  transition: background 0.14s, color 0.14s;
  line-height: 1.4;
}
.adm-nav-item .ni-icon {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: rgba(255,255,255,0.05);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
  transition: background 0.14s;
}
.adm-nav-item .ni-label { flex: 1; }
.adm-nav-item .ni-badge {
  background: rgba(255,255,255,0.09);
  color: rgba(255,255,255,0.45);
  font-size: 10px;
  font-weight: 700;
  padding: 1px 8px;
  border-radius: 20px;
  min-width: 22px;
  text-align: center;
  line-height: 17px;
}

.adm-nav-item:hover {
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.8);
}
.adm-nav-item:hover .ni-icon { background: rgba(255,255,255,0.1); }

.adm-nav-item.active {
  background: var(--adm-accent-dim);
  color: var(--adm-accent);
}
.adm-nav-item.active .ni-icon {
  background: rgba(251,191,36,0.15);
  color: var(--adm-accent);
}

.adm-nav-divider {
  border: none;
  border-top: 1px solid var(--adm-sidebar-border);
  margin: 10px 16px;
}

/* Sidebar footer */
.adm-sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--adm-sidebar-border);
  flex-shrink: 0;
}
.adm-sidebar-date {
  font-size: 10.5px;
  color: rgba(255,255,255,0.2);
  font-weight: 500;
  padding: 0 4px 10px;
}
.adm-sidebar-logout {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 12px;
  border-radius: 9px;
  color: rgba(255,255,255,0.35);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.14s, color 0.14s;
  text-decoration: none;
  width: 100%;
  border: none;
  background: transparent;
  text-align: left;
}
.adm-sidebar-logout .ni-icon {
  width: 30px; height: 30px;
  border-radius: 8px;
  background: rgba(255,255,255,0.04);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  transition: background 0.14s;
}
.adm-sidebar-logout:hover { background: rgba(239,68,68,0.1); color: #f87171; }
.adm-sidebar-logout:hover .ni-icon { background: rgba(239,68,68,0.15); }

/* Mobile overlay */
.adm-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 90;
  backdrop-filter: blur(2px);
}
.adm-overlay.open { display: block; }

/* ─────────────────────────────────────────────────────────────────────────────
   MAIN AREA
   ───────────────────────────────────────────────────────────────────────────── */
.adm-main {
  flex: 1;
  margin-left: var(--adm-sidebar-w);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;
}

/* ── Topbar ────────────────────────────────────────────────────────────────── */
.adm-topbar {
  height: var(--adm-topbar-h);
  background: #fff;
  border-bottom: 1px solid var(--adm-border);
  position: sticky;
  top: 0; z-index: 50;
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 10px;
}
.adm-hamburger {
  display: none;
  background: none; border: none;
  width: 34px; height: 34px;
  border-radius: 8px;
  align-items: center; justify-content: center;
  color: #64748b; cursor: pointer; font-size: 15px;
  transition: background 0.14s;
}
.adm-hamburger:hover { background: #f1f5f9; }
.adm-topbar-breadcrumb {
  flex: 1;
  display: flex; align-items: center; gap: 6px;
  font-size: 13.5px; font-weight: 700; color: #0f172a;
}
.adm-topbar-breadcrumb .tb-sep { color: #cbd5e1; font-weight: 400; }
.adm-topbar-breadcrumb .tb-sub { font-size: 12.5px; font-weight: 400; color: #94a3b8; }
.adm-topbar-actions { display: flex; align-items: center; gap: 8px; }
.adm-tb-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px;
  font-size: 12px; font-weight: 600;
  border-radius: 8px;
  border: 1px solid var(--adm-border);
  background: #fff; color: #475569;
  text-decoration: none; cursor: pointer;
  transition: all 0.14s;
  white-space: nowrap;
}
.adm-tb-btn:hover { background: #f8fafc; border-color: #cbd5e1; color: #1e293b; }
.adm-tb-btn.tb-primary { background: var(--adm-blue); border-color: var(--adm-blue); color: #fff; }
.adm-tb-btn.tb-primary:hover { background: #1e40af; border-color: #1e40af; }

/* ── Page Content ──────────────────────────────────────────────────────────── */
.adm-content { padding: 28px 24px 40px; flex: 1; }
.adm-content-inner { max-width: 1300px; }

/* ── Page Header ───────────────────────────────────────────────────────────── */
.adm-page-hero {
  margin-bottom: 24px;
}
.adm-page-hero h1 {
  font-size: 22px;
  font-weight: 800;
  color: #0f172a;
  font-family: 'Oswald', sans-serif;
  margin: 0 0 3px;
}
.adm-page-hero p {
  font-size: 13px;
  color: #64748b;
  margin: 0;
}

/* ─────────────────────────────────────────────────────────────────────────────
   STAT CARDS
   ───────────────────────────────────────────────────────────────────────────── */
.adm-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.adm-stat {
  background: #fff;
  border: 1px solid var(--adm-border);
  border-radius: 14px;
  padding: 20px 20px 16px;
  position: relative;
  overflow: hidden;
  cursor: default;
  transition: transform 0.14s, box-shadow 0.14s;
}
.adm-stat::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--stat-color, #e2e8f0);
}
.adm-stat:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 32px rgba(0,0,0,0.08);
}
.adm-stat-top {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 14px;
}
.adm-stat-icon {
  width: 42px; height: 42px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 17px;
  background: var(--stat-bg, #f1f5f9);
  color: var(--stat-color, #64748b);
}
.adm-stat-delta {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 20px;
}
.adm-stat-delta.up { background: #f0fdf4; color: #16a34a; }
.adm-stat-delta.neutral { background: #f8fafc; color: #94a3b8; }
.adm-stat-delta.down { background: #fef2f2; color: #dc2626; }
.adm-stat-value {
  font-size: 30px;
  font-weight: 800;
  line-height: 1;
  color: var(--stat-color, #0f172a);
  font-family: 'Oswald', sans-serif;
  margin-bottom: 4px;
}
.adm-stat-label {
  font-size: 11.5px;
  font-weight: 600;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* Color themes */
.adm-stat.blue  { --stat-color: #3b82f6; --stat-bg: #eff6ff; }
.adm-stat.green { --stat-color: #22c55e; --stat-bg: #f0fdf4; }
.adm-stat.red   { --stat-color: #ef4444; --stat-bg: #fef2f2; }
.adm-stat.amber { --stat-color: #f59e0b; --stat-bg: #fffbeb; }

/* ─────────────────────────────────────────────────────────────────────────────
   SECTION CARD
   ───────────────────────────────────────────────────────────────────────────── */
.adm-card {
  background: #fff;
  border: 1px solid var(--adm-border);
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 20px;
}
.adm-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--adm-border);
  gap: 12px;
}
.adm-card-title {
  display: flex; align-items: center; gap: 10px;
  font-size: 14.5px; font-weight: 700; color: #0f172a;
}
.adm-card-icon {
  width: 32px; height: 32px;
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
}
.adm-card-icon.blue  { background: #eff6ff; color: #3b82f6; }
.adm-card-icon.green { background: #f0fdf4; color: #22c55e; }
.adm-card-icon.amber { background: #fffbeb; color: #f59e0b; }
.adm-card-icon.slate { background: #f8fafc; color: #64748b; }
.adm-card-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

/* ─────────────────────────────────────────────────────────────────────────────
   TOOLBAR
   ───────────────────────────────────────────────────────────────────────────── */
.adm-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; flex-wrap: wrap;
}
.adm-toolbar-l, .adm-toolbar-r { display: flex; align-items: center; gap: 8px; }
.adm-count-chip {
  font-size: 11.5px; font-weight: 600; color: #64748b;
  background: #f1f5f9;
  border: 1px solid var(--adm-border);
  padding: 4px 12px;
  border-radius: 20px;
}

/* Select wrapper */
.adm-sel-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.adm-sel-wrap .adm-sel-l { position: absolute; left: 10px; color: #94a3b8; font-size: 12px; pointer-events: none; z-index: 1; }
.adm-sel-wrap .adm-sel-r { position: absolute; right: 9px; color: #94a3b8; font-size: 10px; pointer-events: none; }
.adm-sel {
  appearance: none;
  background: #fff;
  border: 1px solid var(--adm-border);
  border-radius: 9px;
  padding: 7px 30px 7px 30px;
  font-size: 12.5px; font-weight: 500;
  color: #374151;
  cursor: pointer;
  outline: none;
  transition: border-color 0.14s, box-shadow 0.14s;
  font-family: 'Inter', sans-serif;
  min-width: 140px;
}
.adm-sel:focus { border-color: #93c5fd; box-shadow: 0 0 0 3px rgba(59,130,246,0.1); }

/* ─────────────────────────────────────────────────────────────────────────────
   TABLE
   ───────────────────────────────────────────────────────────────────────────── */
.adm-tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.adm-tbl thead tr { background: #f8fafc; border-bottom: 1px solid var(--adm-border); }
.adm-tbl thead th {
  padding: 10px 14px;
  text-align: left;
  font-size: 10.5px; font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  white-space: nowrap;
}
.adm-tbl thead th:first-child { padding-left: 20px; width: 44px; }
.adm-tbl thead th:last-child { padding-right: 20px; }

.adm-tbl tbody tr {
  border-bottom: 1px solid #f1f5f9;
  transition: background 0.1s;
}
.adm-tbl tbody tr:last-child { border-bottom: none; }
.adm-tbl tbody tr:hover { background: #f8fafc; }
.adm-tbl tbody tr.tr-dnh { background: #fff5f5; }
.adm-tbl tbody tr.tr-dnh:hover { background: #fee2e2; }

.adm-tbl td { padding: 12px 14px; vertical-align: middle; }
.adm-tbl td:first-child { padding-left: 20px; }
.adm-tbl td:last-child { padding-right: 20px; }

/* Avatar */
.adm-av {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #fff;
  flex-shrink: 0;
}

/* Badges */
.adm-pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px;
  border-radius: 6px;
  font-size: 11px; font-weight: 600;
  white-space: nowrap; line-height: 1.4;
}
.adm-pill.trade { background: #eff6ff; color: #2563eb; }
.adm-pill.active { background: #f0fdf4; color: #16a34a; }
.adm-pill.dnh { background: #fef2f2; color: #dc2626; }
.adm-pill.doc-pdf { background: #fef2f2; color: #dc2626; text-decoration: none; }
.adm-pill.doc-coi { background: #eff6ff; color: #1d4ed8; text-decoration: none; }
.adm-pill.doc-lic { background: #f0fdf4; color: #15803d; text-decoration: none; }
.adm-pill.doc-missing { background: #fff7ed; color: #c2410c; }
.adm-pill.doc-pdf:hover { background: #fee2e2; }
.adm-pill.doc-coi:hover { background: #dbeafe; }
.adm-pill.doc-lic:hover { background: #dcfce7; }
.adm-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; display: inline-block; }

/* ─────────────────────────────────────────────────────────────────────────────
   DISPATCH PANEL
   ───────────────────────────────────────────────────────────────────────────── */
.adm-dtabs {
  display: flex;
  border-bottom: 1px solid var(--adm-border);
  background: #f8fafc;
  padding: 0 20px;
}
.adm-dtab {
  display: flex; align-items: center; gap: 7px;
  padding: 12px 14px;
  font-size: 13px; font-weight: 600;
  color: #94a3b8;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.14s, border-color 0.14s;
  background: transparent; border-top: none; border-left: none; border-right: none;
  white-space: nowrap;
}
.adm-dtab:hover { color: #475569; }
.adm-dtab.active { color: var(--adm-blue); border-bottom-color: var(--adm-blue); }
.adm-dtab .dt-count {
  background: var(--adm-blue); color: #fff;
  font-size: 10px; font-weight: 700;
  padding: 1px 6px; border-radius: 20px;
  min-width: 18px; text-align: center; line-height: 16px;
}
.adm-dtab .dt-on {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10.5px; font-weight: 700; color: #22c55e;
}
.adm-dtab .dt-on .adm-dot { width: 5px; height: 5px; }

/* ─────────────────────────────────────────────────────────────────────────────
   FORM ELEMENTS
   ───────────────────────────────────────────────────────────────────────────── */
.adm-field-label {
  display: block;
  font-size: 11px; font-weight: 700; color: #64748b;
  text-transform: uppercase; letter-spacing: 0.07em;
  margin-bottom: 6px;
}
.adm-field-label .req { color: #ef4444; margin-left: 2px; }
.adm-input, .adm-textarea {
  width: 100%;
  padding: 9px 13px;
  font-size: 13.5px;
  font-family: 'Inter', sans-serif;
  background: #f8fafc;
  border: 1px solid var(--adm-border);
  border-radius: 9px;
  color: #0f172a;
  outline: none;
  transition: border-color 0.14s, background 0.14s, box-shadow 0.14s;
  box-sizing: border-box;
}
.adm-input:focus, .adm-textarea:focus {
  background: #fff;
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}
.adm-textarea { resize: vertical; line-height: 1.55; }

/* Recipient list */
.adm-rcpt-list {
  border: 1px solid var(--adm-border);
  border-radius: 10px; overflow: hidden;
  max-height: 210px; overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #e2e8f0 transparent;
}
.adm-rcpt-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 14px;
  cursor: pointer; border-bottom: 1px solid #f1f5f9;
  transition: background 0.1s;
}
.adm-rcpt-item:last-child { border-bottom: none; }
.adm-rcpt-item:hover { background: #f8fafc; }
.adm-rcpt-item input[type="checkbox"] {
  accent-color: var(--adm-blue);
  width: 14px; height: 14px; flex-shrink: 0; cursor: pointer;
}
.adm-rcpt-name { font-size: 13px; font-weight: 600; color: #1e293b; flex: 1; }
.adm-rcpt-phone { font-size: 11.5px; color: #94a3b8; }

/* ─────────────────────────────────────────────────────────────────────────────
   BUTTONS
   ───────────────────────────────────────────────────────────────────────────── */
.adm-btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 20px;
  font-size: 13px; font-weight: 700;
  border-radius: 9px; border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.14s;
  text-decoration: none;
  font-family: 'Inter', sans-serif;
  line-height: 1;
}
.adm-btn:disabled { opacity: 0.45; cursor: not-allowed; pointer-events: none; }
.adm-btn.sm { padding: 6px 13px; font-size: 11.5px; border-radius: 7px; }

.adm-btn.blue  { background: var(--adm-blue);  color: #fff; border-color: var(--adm-blue); }
.adm-btn.blue:hover  { background: #1e40af; border-color: #1e40af; }
.adm-btn.green { background: #16a34a; color: #fff; border-color: #16a34a; }
.adm-btn.green:hover { background: #15803d; border-color: #15803d; }
.adm-btn.red-ol {
  background: transparent; color: #dc2626;
  border-color: #fecaca;
}
.adm-btn.red-ol:hover { background: #dc2626; color: #fff; border-color: #dc2626; }
.adm-btn.green-ol {
  background: transparent; color: #16a34a;
  border-color: #bbf7d0;
}
.adm-btn.green-ol:hover { background: #16a34a; color: #fff; border-color: #16a34a; }

/* ─────────────────────────────────────────────────────────────────────────────
   ALERTS
   ───────────────────────────────────────────────────────────────────────────── */
.adm-alert {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 16px;
  border-radius: 10px; border: 1px solid transparent;
  font-size: 13.5px; font-weight: 500;
  margin-bottom: 16px;
  line-height: 1.5;
}
.adm-alert i { margin-top: 2px; flex-shrink: 0; }
.adm-alert.ok      { background: #f0fdf4; color: #15803d;  border-color: #bbf7d0; }
.adm-alert.err     { background: #fef2f2; color: #b91c1c;  border-color: #fecaca; }
.adm-alert.warn    { background: #fffbeb; color: #92400e;  border-color: #fde68a; }
.adm-alert pre {
  background: rgba(0,0,0,0.06);
  border-radius: 6px;
  padding: 8px 12px;
  margin: 8px 0 0;
  font-size: 12px;
  white-space: pre-wrap;
  word-break: break-all;
  font-family: ui-monospace, monospace;
  color: inherit;
}

/* ── Empty State ───────────────────────────────────────────────────────────── */
.adm-empty {
  padding: 56px 24px; text-align: center;
}
.adm-empty-icon {
  width: 54px; height: 54px;
  border-radius: 14px;
  background: #f1f5f9;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; color: #cbd5e1;
  margin: 0 auto 14px;
}

/* ── Utility ───────────────────────────────────────────────────────────────── */
.hidden { display: none !important; }

/* ── Footer ────────────────────────────────────────────────────────────────── */
.adm-footer {
  padding: 14px 24px;
  font-size: 12px; color: #94a3b8;
  border-top: 1px solid var(--adm-border);
  background: #fff;
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px;
}

/* ─────────────────────────────────────────────────────────────────────────────
   RESPONSIVE
   ───────────────────────────────────────────────────────────────────────────── */
@media (max-width: 1023px) {
  .adm-sidebar { transform: translateX(-100%); box-shadow: 8px 0 32px rgba(0,0,0,0.4); }
  .adm-sidebar.open { transform: translateX(0); }
  .adm-main { margin-left: 0; }
  .adm-hamburger { display: flex; }
  .adm-stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .adm-content { padding: 16px 14px 32px; }
  .adm-topbar { padding: 0 14px; }
  .adm-stats { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .adm-stat { padding: 14px 14px 12px; }
  .adm-stat-value { font-size: 24px; }
  .adm-card-head { padding: 14px 16px; }
  .adm-tbl td, .adm-tbl thead th { padding: 10px 10px; }
  .adm-tbl td:first-child, .adm-tbl thead th:first-child { padding-left: 14px; }
  .adm-tbl td:last-child, .adm-tbl thead th:last-child { padding-right: 14px; }
  .adm-footer { flex-direction: column; gap: 4px; text-align: center; }
}
@media (max-width: 480px) {
  .adm-stats { grid-template-columns: 1fr 1fr; }
}