/* =========================================================
   SAHAJ FIRE SAFETY ERP — Design System (Bootstrap 5 layer)
   Fire Safety Industry Palette: Red + Yellow
   ========================================================= */

/* === BRAND TOKENS === */
:root {
  --brand:         #E53935;      /* vivid safety red */
  --brand-dark:    #C62828;
  --brand-light:   #FFEBEE;
  --accent:        #FFC107;      /* safety amber/yellow */
  --accent-dark:   #F9A825;
  --accent-light:  #FFF8E1;
  --sidebar-bg:    #1A1A2E;      /* deep navy-dark */
  --sidebar-w:     250px;
  --topbar-h:      60px;
  --page-bg:       #F4F6F9;
  --surface:       #ffffff;
  --text:          #0f172a;
  --muted:         #64748b;
  --border:        #E2E8F0;

  /* Bootstrap primary → brand red */
  --bs-primary:            #E53935;
  --bs-primary-rgb:        229, 57, 53;
  --bs-link-color:         #E53935;
  --bs-link-color-rgb:     229, 57, 53;
  --bs-link-hover-color:   #C62828;
  --bs-warning:            #FFC107;
  --bs-warning-rgb:        255, 193, 7;
}

/* === BOOTSTRAP COMPONENT OVERRIDES === */
.btn-primary {
  --bs-btn-bg:                  var(--brand);
  --bs-btn-border-color:        var(--brand);
  --bs-btn-hover-bg:            var(--brand-dark);
  --bs-btn-hover-border-color:  var(--brand-dark);
  --bs-btn-active-bg:           var(--brand-dark);
  --bs-btn-active-border-color: var(--brand-dark);
  --bs-btn-focus-shadow-rgb:    229, 57, 53;
  color: #fff !important;
}
.btn-outline-primary {
  --bs-btn-color:              var(--brand);
  --bs-btn-border-color:       var(--brand);
  --bs-btn-hover-bg:           var(--brand);
  --bs-btn-hover-border-color: var(--brand);
  --bs-btn-active-bg:          var(--brand);
  color: var(--brand);
}
/* Accent (yellow) button */
.btn-accent {
  background: var(--accent); border: 1px solid var(--accent-dark);
  color: #1a1a1a !important; font-weight: 700;
}
.btn-accent:hover { background: var(--accent-dark); border-color: var(--accent-dark); color: #1a1a1a !important; }

.bg-primary    { background-color: var(--brand)  !important; }
.text-primary  { color: var(--brand) !important; }
.border-primary{ border-color: var(--brand) !important; }
.badge.bg-primary { background-color: var(--brand) !important; }
.bg-accent     { background-color: var(--accent) !important; }
.text-accent   { color: var(--accent) !important; }

/* Nav tabs — proper spacing + indicator */
.nav-tabs {
  border-bottom: 2px solid var(--border);
  gap: 2px;
}
.nav-tabs .nav-link {
  padding: .65rem 1.4rem;
  font-size: 13px; font-weight: 600;
  color: var(--muted);
  border: none;
  border-bottom: 3px solid transparent;
  border-radius: 8px 8px 0 0;
  margin-bottom: -2px;
  transition: background .15s, color .15s;
  white-space: nowrap;
}
.nav-tabs .nav-link:hover  { background: var(--brand-light); color: var(--brand); }
.nav-tabs .nav-link.active {
  color: var(--brand); border-bottom-color: var(--brand);
  background: transparent; font-weight: 700;
}
.tab-content { background: var(--surface); }

/* Pagination active */
.page-item.active .page-link { background-color: var(--brand); border-color: var(--brand); }
.page-link { color: var(--brand); }
.page-link:hover { color: var(--brand-dark); }

/* Form focus */
.form-control:focus, .form-select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 .2rem rgba(229,57,53,.12);
}
.form-check-input:checked { background-color: var(--brand); border-color: var(--brand); }
.form-switch .form-check-input:checked { background-color: #1E8E3E; border-color: #1E8E3E; }

/* Breadcrumb */
.breadcrumb-item + .breadcrumb-item::before { color: var(--muted); }
.breadcrumb-item a { color: var(--muted); text-decoration: none; }
.breadcrumb-item a:hover { color: var(--text); }

/* =========================================================
   APP SHELL LAYOUT
   ========================================================= */
*, *::before, *::after { box-sizing: border-box; }
body {
  background: var(--page-bg); color: var(--text);
  font-size: 14px;
  font-family: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
}

.app-shell { display: flex; min-height: 100vh; overflow-x: hidden; }

/* === SIDEBAR === */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  position: fixed; top: 0; left: 0; bottom: 0;
  display: flex; flex-direction: column;
  z-index: 200; overflow-y: auto;
  transition: transform .25s ease;
}
.sidebar-header {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  flex-shrink: 0;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none;
}
.sidebar-logo {
  height: 36px; width: auto; object-fit: contain;
  filter: brightness(0) invert(1);
  flex-shrink: 0;
}
.sidebar-brand-name {
  font-size: 13px; font-weight: 700; color: #f8fafc;
  line-height: 1.25; white-space: nowrap; overflow: hidden;
}
.sidebar-nav { padding: 10px 0 24px; flex: 1; }

.nav-group-label {
  font-size: 10px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: #475569;
  padding: 14px 16px 4px;
}
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 16px; color: #94a3b8;
  font-size: 13px; font-weight: 500;
  text-decoration: none;
  transition: background .15s, color .15s;
  border-left: 3px solid transparent;
  border-radius: 0;
}
.nav-item:hover { background: rgba(255,255,255,.05); color: #e2e8f0; }
/* Yellow active — fire safety caution stripe */
.nav-item.active {
  background: rgba(255,193,7,.10);
  color: var(--accent);
  border-left-color: var(--accent);
  font-weight: 600;
}
.nav-icon { font-size: 15px; flex-shrink: 0; }

.sidebar-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.45); z-index: 199;
}
.sidebar-overlay.show { display: block; }

/* === MAIN WRAPPER & TOPBAR === */
.main-wrapper {
  margin-left: var(--sidebar-w);
  display: flex; flex-direction: column;
  min-height: 100vh; flex: 1;
}
.topbar {
  position: sticky; top: 0; z-index: 100;
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 3px solid var(--accent); /* yellow stripe = fire hazard tape */
  display: flex; align-items: center;
  padding: 0 20px; gap: 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
}
.topbar-start { display: flex; align-items: center; gap: 10px; }
.topbar-title  { flex: 1; }
.topbar-end    { display: flex; align-items: center; gap: 6px; }

.hamburger-btn {
  background: none; border: none; color: var(--muted);
  width: 36px; height: 36px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: background .15s;
}
.hamburger-btn:hover { background: var(--page-bg); color: var(--text); }

.brand-logo-sm { height: 30px; width: auto; object-fit: contain; }

.page-title-top { font-size: 14px; font-weight: 600; color: var(--muted); }

.topbar-icon-btn {
  width: 36px; height: 36px; border-radius: 50%;
  background: none; border: none; color: var(--muted);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 16px; transition: background .15s;
  position: relative;
}
.topbar-icon-btn:hover { background: var(--page-bg); color: var(--text); }
.notif-badge {
  position: absolute; top: 4px; right: 4px;
  background: var(--brand); color: #fff;
  font-size: 9px; font-weight: 700;
  border-radius: 10px; min-width: 16px; height: 16px;
  line-height: 16px; text-align: center; padding: 0 3px;
}
.user-menu-btn {
  display: flex; align-items: center; gap: 8px;
  background: none; border: none; cursor: pointer;
  padding: 5px 8px; border-radius: 8px;
  transition: background .15s; color: var(--text);
}
.user-menu-btn:hover { background: var(--page-bg); }
.user-menu-btn::after { display: none; }
.user-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--brand); color: #fff;
  font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.user-name-text { font-size: 13px; font-weight: 500; }

/* Page content */
.page-content { padding: 24px; flex: 1; padding-bottom: 60px; }

/* =========================================================
   PAGE STRUCTURE HELPERS
   ========================================================= */
.page-hdr { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 22px; }
.page-hdr-title { font-size: 20px; font-weight: 800; color: var(--text); margin: 0; }
.page-hdr-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* =========================================================
   ACTION CARDS (Dashboard — top priority)
   ========================================================= */
.action-card {
  border-radius: 14px;
  padding: 20px 22px;
  cursor: pointer;
  text-decoration: none;
  display: block;
  transition: transform .18s, box-shadow .18s;
  border: none;
  position: relative;
  overflow: hidden;
}
.action-card:hover { transform: translateY(-3px); box-shadow: 0 10px 30px rgba(0,0,0,.18); text-decoration: none; }
.action-card-danger {
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
  color: #fff;
}
.action-card-warning {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
  color: #1a1a1a;
}
.action-card-neutral {
  background: linear-gradient(135deg, #334155 0%, #1e293b 100%);
  color: #fff;
}
.action-card-ok {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  color: #fff;
}
.action-card-count {
  font-size: 40px; font-weight: 900; line-height: 1;
  margin-bottom: 4px;
}
.action-card-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; opacity: .85; }
.action-card-desc  { font-size: 13px; margin-top: 8px; opacity: .9; }
.action-card-arrow { position: absolute; bottom: 16px; right: 18px; font-size: 18px; opacity: .6; }

/* Quick action buttons bar */
.quick-actions {
  display: flex; gap: 10px; flex-wrap: wrap;
  padding: 16px 0; margin-bottom: 4px;
}
.quick-action-btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 10px 18px; border-radius: 10px;
  font-size: 13px; font-weight: 700;
  cursor: pointer; border: none;
  transition: transform .15s, box-shadow .15s;
  text-decoration: none;
}
.quick-action-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,.15); text-decoration: none; }
.qab-red    { background: var(--brand); color: #fff; }
.qab-yellow { background: var(--accent); color: #1a1a1a; }
.qab-dark   { background: #1e293b; color: #fff; }
.qab-outline{ background: #fff; color: var(--text); border: 1.5px solid var(--border) !important; }

/* =========================================================
   CARDS
   ========================================================= */
.card { border: 1px solid var(--border); border-radius: 12px !important; box-shadow: 0 1px 4px rgba(0,0,0,.05); }
.card-header { border-radius: 12px 12px 0 0 !important; background: #fff; border-bottom: 1px solid var(--border); padding: 14px 18px; }
.card-header .card-title { font-size: 14px; font-weight: 700; margin: 0; color: var(--text); }
.card-body { padding: 18px; }
.card-footer { background: #fafbfc; border-top: 1px solid var(--border); border-radius: 0 0 12px 12px !important; padding: 10px 18px; }

/* Clickable card */
.card-clickable {
  cursor: pointer; transition: transform .15s, box-shadow .15s;
  text-decoration: none; color: inherit; display: block;
}
.card-clickable:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,.1); color: inherit; text-decoration: none; }

/* Stat cards */
.stat-card {
  background: var(--surface); border-radius: 12px; border: 1px solid var(--border);
  box-shadow: 0 1px 4px rgba(0,0,0,.05); padding: 20px; height: 100%;
  border-left: 4px solid transparent;
  cursor: pointer; transition: transform .15s, box-shadow .15s;
  text-decoration: none; display: block; color: inherit;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,.1); color: inherit; text-decoration: none; }
.stat-card.sc-red    { border-left-color: var(--brand); }
.stat-card.sc-yellow { border-left-color: var(--accent); }
.stat-card.sc-green  { border-left-color: #1E8E3E; }
.stat-card.sc-blue   { border-left-color: #2563EB; }
.stat-card-icon {
  width: 44px; height: 44px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; flex-shrink: 0;
}
.stat-card-icon.red    { background: var(--brand-light);  color: var(--brand); }
.stat-card-icon.yellow { background: var(--accent-light); color: #b45309; }
.stat-card-icon.green  { background: #F0FDF4; color: #1E8E3E; }
.stat-card-icon.blue   { background: #EFF6FF; color: #2563EB; }
.stat-card-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.stat-card-value { font-size: 30px; font-weight: 800; color: var(--text); line-height: 1; margin: 6px 0 4px; }
.stat-card-sub   { font-size: 12px; color: var(--muted); }

/* Section label */
.section-label {
  font-size: 10px; font-weight: 800; text-transform: uppercase;
  letter-spacing: .1em; color: var(--muted);
  margin-bottom: 10px; margin-top: 6px;
  display: flex; align-items: center; gap: 8px;
}
.section-label::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* =========================================================
   TABLES
   ========================================================= */
.table-card .card-body { padding: 0; }
.table > :not(caption) > * > * { padding: .65rem 1rem; }
.table thead th {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .05em; color: var(--muted);
  background: #f8fafc; border-bottom: 1px solid var(--border);
  cursor: pointer; white-space: nowrap; user-select: none;
}
.table thead th:hover { color: var(--text); }
.table thead th.sorted-asc::after  { content: ' ↑'; color: var(--brand); }
.table thead th.sorted-desc::after { content: ' ↓'; color: var(--brand); }
.table tbody tr td { font-size: 13px; vertical-align: middle; border-color: #f1f5f9; }
.table tbody tr:last-child td { border-bottom: none; }
.table-hover tbody tr:hover { background: #fffdf8; } /* warm yellow tint on hover */
.row-actions { display: flex; gap: 5px; flex-shrink: 0; }

/* =========================================================
   FILTER BAR
   ========================================================= */
.filter-bar {
  padding: 12px 18px; background: #fafbfc;
  border-bottom: 1px solid var(--border);
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
  border-radius: 12px 12px 0 0;
}
.filter-search .input-group-text { background: #fff; border-right: none; color: var(--muted); }
.filter-search .form-control { border-left: none; font-size: 13px; padding-left: 4px; }
.filter-search .form-control:focus { box-shadow: none; border-color: #dee2e6; }
.form-select-sm, .form-control-sm { font-size: 13px; }

/* =========================================================
   SEARCHABLE SELECT (custom dropdown)
   ========================================================= */
.ss-wrap {
  position: relative;
  display: inline-flex;
  flex-direction: column;
}
.ss-wrap.ss-full { width: 100%; display: flex; }
/* In filter bars, always auto-width */
.filter-bar .ss-wrap { width: auto !important; display: inline-flex; }
.ss-btn {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; cursor: pointer; text-align: left;
  background: #fff; border: 1px solid var(--border);
  border-radius: 7px; padding: .375rem .75rem;
  font-size: 13px; width: 100%;
  transition: border-color .15s, box-shadow .15s;
  user-select: none; white-space: nowrap;
  min-width: 130px;
}
.ss-btn:hover, .ss-btn:focus { border-color: var(--brand); outline: none; }
.ss-btn.ss-sm { padding: .25rem .6rem; font-size: 12px; border-radius: 6px; }
.ss-btn-text {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  flex: 1; color: var(--muted);
}
.ss-btn-text.has-value { color: var(--text); }
.ss-badge {
  background: var(--brand); color: #fff;
  border-radius: 20px; font-size: 10px; font-weight: 800;
  padding: 1px 7px; flex-shrink: 0;
}
.ss-caret { color: var(--muted); font-size: 10px; flex-shrink: 0; }
.ss-dropdown {
  position: absolute; top: calc(100% + 4px); left: 0; z-index: 1060;
  background: #fff; border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0,0,0,.13);
  min-width: 100%; width: max-content; max-width: 320px;
  display: none;
}
.ss-dropdown.open { display: block; }
.ss-search { padding: 8px 10px; border-bottom: 1px solid var(--border); }
.ss-search input {
  font-size: 12px; border-radius: 6px;
  border: 1px solid var(--border); padding: .3rem .6rem; width: 100%;
}
.ss-search input:focus { outline: none; border-color: var(--brand); }
.ss-options { max-height: 230px; overflow-y: auto; padding: 4px 0; }
.ss-option {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 12px; cursor: pointer; font-size: 13px;
  transition: background .1s; white-space: nowrap;
}
.ss-option:hover { background: var(--brand-light); }
.ss-option.ss-selected-single { background: var(--brand-light); color: var(--brand); font-weight: 600; }
.ss-check {
  width: 16px; height: 16px; border: 1.5px solid #cbd5e1;
  border-radius: 4px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; transition: all .1s;
}
.ss-option.ss-selected-multi .ss-check {
  background: var(--brand); border-color: var(--brand); color: #fff;
}
.ss-empty { padding: 14px 12px; text-align: center; color: var(--muted); font-size: 12px; }

/* =========================================================
   STATUS BADGES
   ========================================================= */
.badge { font-weight: 600; letter-spacing: .02em; font-size: 10.5px; padding: .3em .7em; }

/* =========================================================
   BUTTONS
   ========================================================= */
.btn { font-weight: 600; font-size: 13px; border-radius: 7px; }
.btn-sm { font-size: 12px; padding: .3rem .7rem; border-radius: 6px; }
.btn i { vertical-align: -.1em; }

/* =========================================================
   FORMS
   ========================================================= */
.form-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-bottom: 5px; }
.form-control, .form-select { font-size: 13px; border-color: var(--border); border-radius: 7px; }
.form-control::placeholder { color: #b0bec5; }
.form-text, .form-hint { font-size: 11.5px; color: var(--muted); margin-top: 3px; }

/* =========================================================
   DETAIL HEADER
   ========================================================= */
.detail-hero { display: flex; align-items: flex-start; gap: 16px; }
.detail-icon-wrap {
  width: 52px; height: 52px; border-radius: 12px;
  background: var(--brand-light); display: flex; align-items: center;
  justify-content: center; font-size: 22px; flex-shrink: 0;
}
.detail-title { font-size: 20px; font-weight: 800; margin: 0 0 6px; }
.detail-meta { display: flex; flex-wrap: wrap; gap: 14px; font-size: 13px; color: var(--muted); }
.detail-meta span { display: flex; align-items: center; gap: 4px; }

/* =========================================================
   CHIPS
   ========================================================= */
.tag-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 9px; border-radius: 20px;
  font-size: 11px; font-weight: 700; color: #fff;
}

/* =========================================================
   TIMELINE
   ========================================================= */
.timeline { padding: 4px 0; }
.timeline-item {
  display: flex; gap: 12px; padding-bottom: 22px;
  position: relative;
}
.timeline-item::before {
  content: ''; position: absolute; left: 15px;
  top: 30px; bottom: 0; width: 2px; background: var(--border);
}
.timeline-item:last-child::before { display: none; }
.tl-dot {
  width: 32px; height: 32px; border-radius: 50%;
  background: #f8fafc; border: 2px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; flex-shrink: 0;
}
.tl-body { flex: 1; padding-top: 4px; }
.tl-title { font-weight: 600; font-size: 13px; color: var(--text); }
.tl-meta  { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* =========================================================
   NOTIFICATION / TOGGLE / WA PREVIEW
   ========================================================= */
.wa-preview { background: #ECE5DD; border-radius: 10px; padding: 16px; min-height: 100px; }
.wa-bubble {
  background: #fff; border-radius: 0 10px 10px 10px;
  padding: 10px 14px; max-width: 300px;
  font-size: 13px; box-shadow: 0 1px 2px rgba(0,0,0,.1);
}
.wa-time { font-size: 11px; color: var(--muted); text-align: right; margin-top: 4px; }

/* =========================================================
   LOGIN PAGE
   ========================================================= */
.login-bg {
  min-height: 100vh;
  background: linear-gradient(135deg, #1A1A2E 0%, #16213E 50%, #0f172a 100%);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.login-card {
  background: #fff; border-radius: 16px; padding: 40px;
  width: 100%; max-width: 400px; box-shadow: 0 20px 60px rgba(0,0,0,.35);
  border-top: 4px solid var(--brand);
}
.login-logo-img { height: 64px; width: auto; object-fit: contain; display: block; margin: 0 auto 16px; }
.login-app-name { font-size: 18px; font-weight: 800; color: var(--text); text-align: center; }
.login-app-sub  { font-size: 12px; color: var(--muted); text-align: center; margin-top: 3px; margin-bottom: 28px; }

/* =========================================================
   EMPTY STATE
   ========================================================= */
.empty-state { text-align: center; padding: 48px 24px; }
.empty-state-icon { font-size: 38px; opacity: .35; margin-bottom: 10px; }
.empty-state p { font-size: 13px; color: var(--muted); }

/* =========================================================
   PROTO NOTE
   ========================================================= */
.proto-note {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
  text-align: center; font-size: 11px; color: #94a3b8;
  background: #fff; border-top: 1px solid var(--border);
  padding: 5px;
  /* iOS safe area */
  padding-bottom: calc(5px + env(safe-area-inset-bottom));
}

/* =========================================================
   PHOTO GRID — shared across amc-visit, mockdrill, etc.
   ========================================================= */
.photo-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(130px,1fr)); gap:10px; }
.photo-item { display:flex; flex-direction:column; gap:4px; }
.photo-preview { aspect-ratio:4/3; border-radius:8px; overflow:hidden; border:1px solid #e9ecef; background:#f8f9fa; }
.photo-img { width:100%; height:100%; object-fit:cover; display:block; cursor:zoom-in; }
.photo-actions { display:flex; gap:3px; }
.photo-action-btn { flex:1; padding:4px 2px; font-size:12px; border:1px solid #e9ecef; background:#fff; border-radius:5px; cursor:pointer; color:#6c757d; transition:.15s; }
.photo-action-btn:hover { border-color:var(--brand); color:var(--brand); }
.photo-action-btn.del:hover { border-color:#dc3545; color:#dc3545; background:#fff5f5; }
.photo-caption { font-size:11px; border:1px solid #e9ecef; border-radius:4px; padding:3px 6px; width:100%; }
.photo-add { aspect-ratio:4/3; border:2px dashed #dee2e6; border-radius:8px; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:4px; cursor:pointer; color:#adb5bd; transition:.15s; text-align:center; padding:8px; }
.photo-add:hover { border-color:var(--brand); color:var(--brand); background:var(--brand-light); }
.photo-add-label { font-size:11px; line-height:1.4; }

/* =========================================================
   PRINT
   ========================================================= */
@media print {
  .sidebar, .topbar, .page-hdr .btn, .filter-bar, .proto-note,
  .card-footer, .row-actions { display: none !important; }
  .main-wrapper { margin-left: 0 !important; }
  .card { box-shadow: none !important; border: 1px solid #ddd !important; }
  body { background: #fff; }
}

/* =========================================================
   RESPONSIVE — Three-breakpoint mobile system
   ========================================================= */

/* ── ≤ 991.98px  Tablet: sidebar collapses ──────────────── */
@media (max-width: 991.98px) {
  /* Layout */
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar { -webkit-overflow-scrolling: touch; }
  .main-wrapper { margin-left: 0; }
  .page-content { padding: 16px; padding-bottom: 60px; }

  /* Nav tabs: horizontal scroll instead of wrapping */
  .nav-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 0;
  }
  .nav-tabs::-webkit-scrollbar { display: none; }

  /* Detail hero: action buttons drop to new line */
  .detail-hero { flex-wrap: wrap; }
  .detail-hero > div:last-child { width: 100%; }
}

/* ── ≤ 767.98px  Phone landscape / small tablets ────────── */
@media (max-width: 767.98px) {
  .page-content { padding: 12px; padding-bottom: 60px; }

  /* Topbar */
  .topbar { padding: 0 12px; gap: 8px; }

  /* Page header stacks: title above buttons */
  .page-hdr {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 16px;
  }
  .page-hdr-title { font-size: 18px; }
  .page-hdr > .d-flex { flex-wrap: wrap; gap: 6px !important; }

  /* Cards */
  .card-body   { padding: 14px; }
  .card-header { padding: 11px 14px; }
  .card-footer { padding: 8px 14px; }

  /* Filter bar: tighter, items wrap naturally */
  .filter-bar { padding: 10px 12px; gap: 6px; }
  .filter-bar .input-group { flex: 1 1 180px; }

  /* Stat cards */
  .stat-card       { padding: 14px 12px; }
  .stat-card-value { font-size: 24px; }

  /* Action cards */
  .action-card       { padding: 16px; border-radius: 12px; }
  .action-card-count { font-size: 30px; }
  .action-card-desc  { font-size: 12px; }

  /* Quick actions: horizontal scroll strip */
  .quick-actions {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 4px;
    margin-left: -12px;
    margin-right: -12px;
    padding-left: 12px;
    padding-right: 12px;
    gap: 8px;
  }
  .quick-actions::-webkit-scrollbar { display: none; }
  .quick-action-btn { flex-shrink: 0; font-size: 12px; padding: 8px 14px; }

  /* Nav tabs smaller text */
  .nav-tabs .nav-link { padding: .55rem 1rem; font-size: 12px; }

  /* Tables */
  .table > :not(caption) > * > * { padding: .5rem .75rem; }
  .table tbody tr td { font-size: 12px; }
  .row-actions { gap: 3px; }
  .row-actions .btn-sm { padding: .25rem .5rem; }

  /* Detail hero */
  .detail-title { font-size: 17px; }
  .detail-meta  { font-size: 12px; gap: 8px; }

  /* Photo grid (amc-visit) */
  .photo-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }

  /* Breadcrumb */
  .breadcrumb { font-size: 12px; }

  /* Login */
  .login-card { padding: 28px 24px; }
}

/* ── ≤ 575.98px  Phone portrait ─────────────────────────── */
@media (max-width: 575.98px) {
  .page-content { padding: 10px; padding-bottom: 60px; }

  /* Topbar — tighter */
  .topbar { padding: 0 10px; height: 52px; }

  /* Page header */
  .page-hdr { gap: 8px; margin-bottom: 12px; }
  .page-hdr-title { font-size: 16px; }
  .page-hdr .btn  { font-size: 12px; padding: .3rem .65rem; }

  /* Cards */
  .card { border-radius: 10px !important; }
  .card-body   { padding: 12px; }
  .card-header { padding: 10px 12px; }
  .card-footer { padding: 7px 12px; }

  /* Stat cards */
  .stat-card       { padding: 12px 10px; }
  .stat-card-value { font-size: 22px; }
  .stat-card-label { font-size: 10px; }
  .stat-card-icon  { width: 36px; height: 36px; font-size: 16px; border-radius: 8px; }

  /* Action cards */
  .action-card       { padding: 12px 14px; border-radius: 10px; }
  .action-card-count { font-size: 24px; }
  .action-card-label { font-size: 10px; }
  .action-card-desc  { font-size: 11px; margin-top: 5px; }
  .action-card-arrow { font-size: 13px; bottom: 10px; right: 12px; }

  /* Quick actions — smaller */
  .quick-action-btn { font-size: 11px; padding: 7px 11px; border-radius: 8px; }

  /* Nav tabs */
  .nav-tabs .nav-link { padding: .48rem .8rem; font-size: 11px; }

  /* Section labels */
  .section-label { font-size: 9px; margin-bottom: 8px; }

  /* Tables */
  .table thead th { font-size: 10px; padding: .4rem .6rem; }
  .table tbody tr td { font-size: 11px; padding: .4rem .6rem; }
  .row-actions .btn-sm { padding: .2rem .4rem; font-size: 10px; }

  /* Filter bar: stack + full-width everything */
  .filter-bar { flex-direction: column; align-items: stretch; padding: 10px; }
  .filter-bar .input-group,
  .filter-bar .filter-search  { width: 100% !important; }
  .filter-bar .ss-wrap        { width: 100% !important; display: flex; }
  .filter-bar .form-select    { width: 100% !important; }

  /* Detail hero tighter */
  .detail-icon-wrap { width: 42px; height: 42px; font-size: 17px; border-radius: 9px; }
  .detail-title { font-size: 15px; }
  .detail-meta  { font-size: 11px; gap: 6px; }

  /* Photo grid tighter */
  .photo-grid { grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 6px; }

  /* Forms */
  .form-label { font-size: 11px; }

  /* Modals: full-width on small phones */
  .modal-dialog { margin: 6px; max-width: calc(100vw - 12px); }
  .modal-body   { padding: 14px; }

  /* Breadcrumb */
  .breadcrumb { font-size: 11px; }
  .breadcrumb-item + .breadcrumb-item::before { padding: 0 3px; }

  /* Login */
  .login-card { padding: 24px 16px; }

  /* WA bubble */
  .wa-bubble { max-width: 100%; font-size: 12px; }

  /* Timeline tighter */
  .timeline-item { gap: 8px; padding-bottom: 16px; }
  .tl-dot { width: 28px; height: 28px; font-size: 11px; }
  .tl-title { font-size: 12px; }
  .tl-meta  { font-size: 11px; }
}
