/* Zain OS — Obsidian Dark Theme */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700&family=IBM+Plex+Sans+Arabic:wght@400;500;600;700&display=swap');

:root {
  --white: #252220; --bg: #1C1917; --sidebar-bg: #141211;
  --blue: #E8613A; --blue-light: rgba(232,97,58,0.12); --blue-hover: #D4562F;
  --green: #E8613A; --green-light: rgba(232,97,58,0.12);
  --amber: #E8613A; --amber-light: rgba(232,97,58,0.12);
  --red: #E8613A; --red-light: rgba(232,97,58,0.12);
  --purple: #E8613A; --purple-light: rgba(232,97,58,0.12);
  --text: #E8E0D8; --text-secondary: #6B6058; --text-tertiary: #4A4038;
  --border: #332F2B; --border-light: #2A2725;
  --table-header: #201D1A; --hover: #2C2926;
  --shadow: none; --shadow-md: 0 4px 12px rgba(0,0,0,0.3);
  --radius: 8px; --radius-lg: 12px;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; color: #E8E0D8; background: #1C1917; line-height: 1.5; font-size: 14px; overflow-x: hidden; }
h1, h2, h3, h4 { line-height: 1.3; color: #E8E0D8; }
a { color: #E8613A; text-decoration: none; }

/* Scrollbar */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: #1C1917; }
::-webkit-scrollbar-thumb { background: #332F2B; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #4A4038; }

/* Layout */
.app-layout { display: flex; min-height: 100vh; }
.sidebar { width: 240px; background: #141211; border-right: 1px solid #2A2725; position: fixed; top: 0; left: 0; bottom: 0; display: flex; flex-direction: column; padding: 0 12px; z-index: 50; }
.sidebar-logo { font-size: 18px; font-weight: 700; padding: 20px 12px; color: #E8E0D8; border-bottom: 1px solid #2A2725; margin-bottom: 12px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 6px; cursor: pointer; font-size: 14px; color: #8A7D72; transition: all 150ms ease; margin-bottom: 2px; border-left: 3px solid transparent; }
.nav-item:hover { color: #E8E0D8; background: #2C2926; }
.nav-item .nav-icon { color: #8A7D72; transition: color 150ms ease; }
.nav-item:hover .nav-icon { color: #E8E0D8; }
.nav-item.active { color: #E8613A; font-weight: 600; border-left: 3px solid #E8613A; background: rgba(232,97,58,0.1); }
.nav-item.active .nav-icon { color: #E8613A; }
.nav-icon { font-size: 16px; width: 20px; text-align: center; }
.main-content { flex: 1; margin-left: 240px; padding: 32px; max-width: 1400px; }

/* Search */
.search-wrapper { position: relative; flex: 1; max-width: 400px; }
.search-bar { width: 100%; padding: 8px 12px 8px 36px; border: 1px solid #332F2B; border-radius: 6px; font-size: 14px; background: #252220; color: #E8E0D8; outline: none; height: 38px; transition: border-color 150ms ease, box-shadow 150ms ease; }
.search-bar::placeholder { color: #4A4038; }
.search-bar:focus { border-color: #E8613A; box-shadow: 0 0 0 3px rgba(232,97,58,0.15); }
.search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: #6B6058; }
#search-results { position: absolute; top: 100%; left: 0; right: 0; background: #2C2926; border: 1px solid #332F2B; border-radius: var(--radius); box-shadow: var(--shadow-md); z-index: 100; display: none; max-height: 300px; overflow-y: auto; }
.search-group { padding: 8px 0; }
.search-group-label { padding: 4px 16px; font-size: 11px; font-weight: 600; text-transform: uppercase; color: var(--text-tertiary); }
.search-item { padding: 8px 16px; cursor: pointer; font-size: 13px; }
.search-item:hover { background: var(--hover); }
.search-empty { padding: 16px; text-align: center; color: var(--text-tertiary); font-size: 13px; }

/* Top bar */
.top-bar { display: flex; align-items: center; justify-content: space-between; padding: 0 0 24px; border-bottom: 1px solid #2A2725; margin-bottom: 24px; }

/* Alert banner */
#alert-banner { display: none; align-items: center; justify-content: space-between; padding: 10px 16px; border-radius: var(--radius); font-size: 13px; font-weight: 500; margin-bottom: 20px; }
.alert-banner { padding: 10px 16px; border-radius: var(--radius); font-size: 13px; margin-bottom: 12px; }
.alert-blue, #alert-banner { background: rgba(232,97,58,0.1); color: #E8613A; border: 1px solid rgba(232,97,58,0.2); }
.alert-amber { background: rgba(232,97,58,0.1); color: #E8613A; border: 1px solid rgba(232,97,58,0.2); }
.alert-red { background: rgba(232,97,58,0.1); color: #E8613A; border: 1px solid rgba(232,97,58,0.2); }
.banner-close { background: none; border: none; font-size: 18px; cursor: pointer; color: inherit; padding: 0 4px; }

/* Page header */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; flex-wrap: wrap; gap: 12px; }
.page-header h1 { font-size: 24px; font-weight: 600; }
.header-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.header-actions .btn { height: 36px; }
.quick-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.quick-actions .btn { height: 36px; }

/* Metrics */
.metrics-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 16px; }
.metric-card { background: #252220; border: 0.5px solid #332F2B; border-radius: var(--radius); padding: 16px 20px; }
.metric-card.small { padding: 12px 16px; }
.metric-label { font-size: 12px; color: var(--text-secondary); font-weight: 500; margin-bottom: 4px; }
.metric-value { font-size: 22px; font-weight: 700; }
.metric-sub { font-size: 12px; color: var(--text-tertiary); margin-top: 2px; }
.revenue-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 16px; }

/* Chart */
.chart-card { display: flex; flex-direction: column; }
.mini-chart { display: flex; align-items: flex-end; gap: 8px; height: 80px; padding-top: 8px; }
.bar-col { display: flex; flex-direction: column; align-items: center; flex: 1; }
.bar { background: var(--blue); border-radius: 3px 3px 0 0; width: 100%; min-height: 2px; transition: height 300ms ease; }
.bar-label { font-size: 10px; color: var(--text-tertiary); margin-top: 4px; }

/* Cards */
.card { background: #252220; border: 0.5px solid #332F2B; border-radius: 12px; margin-bottom: 16px; overflow: hidden; border-left: 3px solid #E8613A; }
.card-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 24px; border-bottom: 1px solid #2A2725; }
.card-header h3 { font-size: 16px; font-weight: 600; color: #E8E0D8; }

/* Section cards (gray bg, no border — used in Settings and detail pages) */
.section-card {
  background: #252220;
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 16px;
  border: 0.5px solid #332F2B;
  border-left: 3px solid #E8613A;
}
.section-card table { background: transparent; }
.section-card thead th { background: #1C1917; }
.section-title { font-size: 16px; font-weight: 600; margin-bottom: 16px; color: #E8E0D8; }
.section-helper { font-size: 13px; color: var(--text-secondary); margin-bottom: 16px; line-height: 1.5; }
.field-helper { display: block; font-size: 12px; color: var(--text-tertiary); margin-top: 4px; line-height: 1.4; }

/* Section card inputs stay white to contrast with gray bg */
.section-card input, .section-card select, .section-card textarea {
  background: #1C1917;
}

/* Three column layout */
.three-col { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 16px; }
.three-col > .card { margin-bottom: 0; }

/* Tables */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th { text-align: left; padding: 10px 16px; background: #201D1A; color: #6B6058; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; border-bottom: 1px solid #2A2725; }
tbody td { padding: 12px 16px; border-bottom: 1px solid #2A2725; vertical-align: middle; color: #E8E0D8; }
tfoot td { padding: 10px 16px; border-top: 2px solid #332F2B; vertical-align: middle; color: #E8E0D8; }
tbody tr:hover td { background: #2C2926; }
tbody tr.row-warning td { background: rgba(232,97,58,0.08); }
.compact-table { font-size: 13px; }
.compact-table td { padding: 8px 12px; }

/* Unit grid */
.unit-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }
.unit-card { padding: 20px; cursor: pointer; transition: all 150ms ease; background: #252220; position: relative; }
.unit-card:hover { transform: translateY(-2px); background: #2C2926; }
.unit-card-header { display: flex; justify-content: space-between; align-items: start; margin-bottom: 8px; }
.unit-card-specs { margin: 8px 0; }
.unit-card-prices { display: flex; gap: 24px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border-light); }
.price-label { font-size: 11px; color: var(--text-tertiary); display: block; }
.price-value { font-size: 15px; font-weight: 600; color: var(--text); }
.badge-group { display: flex; gap: 6px; flex-wrap: wrap; }

/* Drag handle */
.drag-handle { position: absolute; bottom: 10px; right: 10px; width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; cursor: grab; color: #666; font-size: 16px; border-radius: 4px; transition: color 150ms, background 150ms; z-index: 2; opacity: 0; }
.unit-card:hover .drag-handle { opacity: 1; }
.drag-handle:hover { color: #E8E0D8; background: rgba(232,97,58,0.2); }
.drag-handle:active { cursor: grabbing; }
.sortable-ghost { opacity: 0.3; background: rgba(232,97,58,0.08) !important; border: 1px dashed #E8613A !important; }
.sortable-chosen { box-shadow: 0 8px 24px rgba(0,0,0,0.4); transform: scale(1.02); }
.sortable-drag { opacity: 0.9; }

/* Badges */
.badge { display: inline-block; padding: 2px 8px; border-radius: 9999px; font-size: 11px; font-weight: 500; white-space: nowrap; }
.badge-green, .badge-amber, .badge-red, .badge-blue, .badge-purple, .badge-orange {
  background: transparent; color: #E8613A; border: 0.8px solid #E8613A;
}
.badge-gray { background: transparent; color: #888; border: 0.8px solid #555; }

/* Score badge (circle) */
.score-badge { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 50%; font-size: 11px; font-weight: 500; color: #FFFFFF; background: #E8613A; }
.score-high { background: #E8613A; }
.score-mid { background: #E8613A; }
.score-low { background: #E8613A; }
.score-na { background: #555; color: #999; }

/* Buttons — 3 sizes: default (36px), small (28px), inline */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 16px; border-radius: 6px; font-size: 14px; font-weight: 500; cursor: pointer; border: none; transition: all 150ms ease; font-family: inherit; white-space: nowrap; }
.btn:hover { transform: scale(0.98); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--blue); color: white; }
.btn-primary:hover { background: var(--blue-hover); }
.btn-secondary { background: #252220; color: #E8E0D8; border: 1px solid #332F2B; }
.btn-secondary:hover { background: #2C2926; }
.btn-danger { background: #252220; color: #E8613A; border: 1px solid rgba(232,97,58,0.3); }
.btn-danger:hover { background: rgba(232,97,58,0.1); }
.btn-danger-solid { background: #E8613A; color: white; }
.btn-danger-solid:hover { background: #D4562F; }
.btn-ghost { background: transparent; color: #6B6058; border: none; }
.btn-ghost:hover { background: #2C2926; color: #E8E0D8; }
/* Small buttons (tables/actions) — 28px height */
.btn-sm { height: 28px; padding: 0 12px; font-size: 12px; border-radius: 6px; line-height: 28px; }
/* Inline text button */
.btn-inline { background: none; border: none; color: var(--blue); font-size: 12px; cursor: pointer; padding: 0; font-weight: 500; height: auto; }

/* Inputs — unified style for ALL form elements */
input[type="text"], input[type="number"], input[type="email"], input[type="date"],
input[type="time"], input[type="datetime-local"], input[type="tel"], input[type="url"],
input[type="password"], input[type="search"],
.input, select, textarea {
  padding: 8px 12px;
  border: 1px solid #332F2B;
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  color: #E8E0D8;
  background: #1C1917;
  outline: none;
  width: 100%;
  height: 38px;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}
input[type="date"], input[type="time"], input[type="datetime-local"] { color-scheme: dark; }
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator,
input[type="datetime-local"]::-webkit-calendar-picker-indicator { filter: invert(0.6); cursor: pointer; }
select {
  background: #1C1917 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236B6058' d='M2 4l4 4 4-4'/%3E%3C/svg%3E") no-repeat right 12px center;
  padding-right: 32px;
  cursor: pointer;
}
input:focus, select:focus, textarea:focus,
.input:focus {
  border-color: #E8613A;
  box-shadow: 0 0 0 3px rgba(232,97,58,0.15);
}
textarea {
  height: auto;
  min-height: 100px;
  resize: vertical;
  line-height: 1.5;
}
.input-sm, select.input-sm { height: 32px; font-size: 13px; padding: 4px 10px; }
.search-input { flex: 1; }

/* Filter bar — all elements same height (36px) */
.filter-bar { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; align-items: center; }
.date-pair { display: flex; gap: 12px; align-items: flex-end; }
.date-pair > div { flex: 1; }
.date-pair input { width: 100%; }
.filter-bar select, .filter-bar input { width: auto; min-width: 140px; height: 36px; font-size: 14px; }
.filter-bar .search-input { min-width: 200px; }
.filter-bar .btn { height: 36px; }

/* Forms */
.form-field { margin-bottom: 16px; flex: 1; min-width: 0; }
.form-field label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: #6B6058;
  margin-bottom: 4px;
  line-height: 1.3;
}
.form-field input, .form-field select, .form-field textarea { width: 100%; }
/* Checkbox form field — styled to match the form's input aesthetic */
.form-field-checkbox { margin-bottom: 16px; }
.form-field-checkbox > label {
  display: flex !important;
  align-items: center;
  gap: 12px;
  margin-bottom: 0 !important;
  padding: 10px 14px;
  background: #1C1917;
  border: 1px solid #332F2B;
  border-radius: 6px;
  color: var(--text);
  font-size: 14px;
  font-weight: 400;
  cursor: pointer;
  transition: border-color 150ms ease, background 150ms ease;
  user-select: none;
}
.form-field-checkbox > label:hover { border-color: #4A4038; background: #252220; }
.form-field-checkbox > label:has(input:checked) { border-color: #E8613A; background: rgba(232, 97, 58, 0.08); }
/* Hide the native checkbox, draw our own */
.form-field-checkbox input[type=checkbox] {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  margin: 0;
  border: 1.5px solid #4A4038;
  border-radius: 4px;
  background: #141211;
  cursor: pointer;
  position: relative;
  transition: border-color 120ms ease, background 120ms ease;
}
.form-field-checkbox input[type=checkbox]:hover { border-color: #6B6058; }
.form-field-checkbox input[type=checkbox]:checked { background: #E8613A; border-color: #E8613A; }
.form-field-checkbox input[type=checkbox]:checked::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 1px;
  width: 5px;
  height: 10px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.form-field-checkbox input[type=checkbox]:focus-visible { outline: 2px solid rgba(232, 97, 58, 0.4); outline-offset: 2px; }
.form-field-checkbox > label > span { color: var(--text); line-height: 1.3; }
.form-row { display: flex; gap: 16px; }
.form-row + .form-row { margin-top: 0; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; padding-top: 20px; border-top: 1px solid var(--border-light); margin-top: 12px; }

/* Modal */
.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.6); z-index: 9800; display: flex; align-items: center; justify-content: center; backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.modal { background: #252220; border: 0.5px solid #332F2B; border-radius: 12px; max-width: 560px; width: 94%; max-height: 88vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,0.5); position: relative; z-index: 9801; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 24px 32px 16px; border-bottom: none; }
.modal-header h3 { font-size: 18px; font-weight: 600; color: #E8E0D8; }
.modal-close { background: none; border: none; font-size: 24px; cursor: pointer; color: #6B6058; padding: 0 4px; line-height: 1; }
.modal-close:hover { color: #E8E0D8; }
.modal-body { padding: 8px 32px 32px; }

/* Toast — top center */
#toast-container { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 10000; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
#toast-container .toast { pointer-events: auto; }
.toast { padding: 12px 20px; background: #252220; border: 1px solid #332F2B; border-radius: var(--radius); box-shadow: 0 8px 24px rgba(0,0,0,0.4); font-size: 14px; font-weight: 500; color: #E8E0D8; transform: translateY(-20px); opacity: 0; transition: all 300ms ease; min-width: 300px; text-align: center; }
.toast.show { transform: translateY(0); opacity: 1; }
.toast-success { border-left: 4px solid #E8613A; }
.toast-error { border-left: 4px solid #E8613A; }
.toast-info { border-left: 4px solid #888; }

/* Skeleton */
.skeleton-loader { padding: 24px; }
.skeleton-line { height: 16px; background: linear-gradient(90deg, #252220 25%, #2C2926 50%, #252220 75%); background-size: 200% 100%; border-radius: 4px; margin-bottom: 12px; animation: shimmer 1.5s infinite; }
.skeleton-line.short { width: 60%; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* Empty / Error states */
.empty-state { text-align: center; padding: 40px 20px; }
.empty-icon { font-size: 48px; margin-bottom: 12px; opacity: 0.3; }
.empty-state h4 { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.empty-state p { font-size: 13px; color: var(--text-secondary); margin-bottom: 12px; }
.error-state { text-align: center; padding: 60px 20px; }
.error-state .error-icon { font-size: 48px; margin-bottom: 16px; }
.error-state h2 { font-size: 20px; margin-bottom: 8px; }
.error-state p { color: var(--text-secondary); margin-bottom: 8px; }
.error-state code { background: #2C2926; padding: 2px 6px; border-radius: 4px; font-size: 13px; color: #E8E0D8; }

/* Detail pages */
.back-link { font-size: 13px; color: #E8613A; cursor: pointer; margin-bottom: 16px; display: inline-block; }
.back-link:hover { text-decoration: underline; }

/* Detail page header */
.detail-page-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 24px; gap: 16px; flex-wrap: wrap; }
.detail-title-group h1 { font-size: 24px; font-weight: 600; margin-bottom: 4px; }
.detail-subtitle { font-size: 13px; color: var(--text-secondary); margin-bottom: 8px; }
.detail-badges { display: flex; gap: 6px; }
.detail-actions { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }

/* Status select styled */
.status-select {
  height: 36px; padding: 0 32px 0 12px; border-radius: 6px; font-size: 14px; font-weight: 500; color: #E8E0D8;
  border: 2px solid; background: #252220 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236B6058' d='M2 4l4 4 4-4'/%3E%3C/svg%3E") no-repeat right 10px center;
  -webkit-appearance: none; appearance: none; cursor: pointer; outline: none; width: auto;
}
.status-select:focus { box-shadow: 0 0 0 3px rgba(232,97,58,0.1); }

/* Detail action buttons — use standard btn sizing (36px) */
.btn-edit, .btn-archive {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 16px; border-radius: 6px; font-size: 14px; font-weight: 500;
  cursor: pointer; font-family: inherit; transition: all 150ms ease; white-space: nowrap;
}
.btn-edit { border: 1px solid #332F2B; background: #252220; color: #E8E0D8; }
.btn-edit:hover { background: #2C2926; }
.btn-archive { border: 1px solid rgba(232,97,58,0.3); background: #252220; color: #E8613A; }
.btn-archive:hover { background: rgba(232,97,58,0.1); }

/* Inline profit edit */
.profit-edit-icon { background: none; border: none; cursor: pointer; color: #666; padding: 2px; line-height: 0; transition: color 150ms ease; vertical-align: middle; }
.profit-edit-icon:hover { color: #E8613A; }
.profit-display { display: flex; align-items: center; gap: 8px; }
.profit-edit-inline { display: flex; align-items: center; gap: 6px; }
.profit-input { width: 140px; height: 32px; padding: 4px 8px; border: 1px solid #332F2B; border-radius: 6px; font-size: 14px; text-align: right; }

/* Inline installment editing */
.inst-editing td { background: rgba(232,97,58,0.08) !important; }
.inst-edit-input { height: 30px; padding: 2px 6px; font-size: 12px; border: 1px solid #332F2B; border-radius: 4px; width: 100%; background: #1C1917; color: #E8E0D8; }
.inst-edit-input:focus { border-color: #E8613A; outline: none; }
.inst-actions { display: flex; gap: 4px; }

/* Client cards in assigned section */
.client-cards { display: flex; flex-direction: column; gap: 8px; padding: 16px 20px; }
.client-card-row { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; background: #2C2926; border-radius: 8px; border: 0.5px solid #332F2B; }
.client-card-info { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.client-card-info strong { font-weight: 600; }
.specs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0; }
.spec-item { display: flex; justify-content: space-between; padding: 8px 20px; border-bottom: 1px solid #2A2725; font-size: 13px; gap: 12px; }
.spec-item .spec-label { flex-shrink: 0; color: #6B6058; }
.spec-label { color: var(--text-secondary); }

/* Pricing */
.pricing-grid { padding: 0 20px 20px; }
.pricing-line { display: flex; justify-content: space-between; padding: 8px 0; font-size: 14px; }
.pricing-line.highlight { font-size: 15px; }
.pricing-divider { border-top: 1px dashed #332F2B; margin: 8px 0; }

/* Client inline card */
.client-card-inline { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; }
.empty-inline { display: flex; align-items: center; gap: 12px; padding: 16px 20px; }

/* Notes */
.notes-input { display: flex; gap: 8px; padding: 16px 20px 8px; align-items: start; }
.notes-input textarea { flex: 1; }
.note-item { padding: 8px 20px; border-bottom: 1px solid var(--border-light); }
.note-text { font-size: 13px; }
.note-time { font-size: 11px; color: var(--text-tertiary); }

/* Note cards */
.note-card { background: #2C2926; border-radius: 8px; padding: 12px; margin: 8px 20px; border: 0.5px solid #332F2B; }
.note-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.note-card-text { font-size: 13px; white-space: pre-wrap; line-height: 1.5; color: #E8E0D8; }
.note-card-actions { display: flex; gap: 4px; }
.note-icon-btn { background: none; border: none; cursor: pointer; color: #6B6058; font-size: 14px; padding: 2px 4px; border-radius: 4px; transition: all 150ms; }
.note-icon-btn:hover { background: #332F2B; color: #E8E0D8; }
.note-delete-btn:hover { background: rgba(232,97,58,0.1); color: #E8613A; }

/* Activity feed */
.activity-feed { padding: 8px 0; }
.activity-item { display: flex; align-items: center; gap: 12px; padding: 8px 20px; font-size: 13px; }
.activity-icon { font-size: 16px; }
.activity-text { flex: 1; }
.activity-time { font-size: 11px; color: var(--text-tertiary); white-space: nowrap; }

/* Timeline */
.timeline { padding: 8px 0; }
.timeline-item { display: flex; gap: 12px; padding: 6px 0; }
.timeline-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--blue); margin-top: 6px; flex-shrink: 0; }
.timeline-content { flex: 1; }

/* Conversations */
.conversation-list { max-height: 300px; overflow-y: auto; padding: 8px 0; }
.conv-msg { padding: 6px 12px; margin: 4px 0; border-radius: 8px; font-size: 13px; max-width: 80%; }
.conv-inbound, .conv-lead { background: #2C2926; }
.conv-outbound { background: rgba(232,97,58,0.1); margin-left: auto; }
.conv-ai { background: rgba(232,97,58,0.08); margin-left: auto; }
.conv-zain { background: rgba(232,97,58,0.1); margin-left: auto; }
.conv-time { font-size: 10px; color: var(--text-tertiary); margin-top: 2px; }
.conv-sender { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 2px; }
.conv-lead .conv-sender { color: #888; }
.conv-ai .conv-sender { color: #E8613A; }
.conv-zain .conv-sender { color: var(--blue); }
.conv-document { background: rgba(255,255,255,0.04) !important; border: 1px dashed rgba(232,97,58,0.3); }
.conv-document .conv-text { color: #E8613A; font-weight: 500; font-size: 12px; }
.btn-clear-chat { background: none; border: none; color: #E8613A; font-size: 11px; cursor: pointer; padding: 4px 8px; font-family: inherit; opacity: 0.7; }
.btn-clear-chat:hover { opacity: 1; text-decoration: underline; }

/* Tab bar */
.tab-bar { display: flex; gap: 4px; margin-bottom: 16px; }
.tab-btn { padding: 8px 16px; border-radius: 6px; font-size: 13px; font-weight: 500; cursor: pointer; background: transparent; border: none; color: var(--text-secondary); font-family: inherit; }
.tab-btn.active { background: var(--blue-light); color: var(--blue); font-weight: 600; }

/* Health */
.health-grid { display: flex; flex-direction: column; gap: 8px; }
.health-item { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.health-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.dot-green { background: #E8613A; box-shadow: 0 0 6px rgba(232,97,58,0.4); }
.dot-red { background: #555; box-shadow: none; }

/* Lead detail */
.lead-detail { }
.lead-detail-header { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.lead-detail-header .badge { height: 28px; line-height: 24px; padding: 0 12px; font-size: 12px; display: inline-flex; align-items: center; }
.lead-detail-header .score-badge { width: 28px; height: 28px; font-size: 12px; }
.lead-detail-header .btn-edit, .lead-detail-header .btn-archive { height: 28px; padding: 0 12px; font-size: 12px; }
.lead-detail h4, .modal-body h4 { font-size: 14px; font-weight: 600; color: var(--text); margin-top: 16px; margin-bottom: 8px; }

/* Utility */
.text-green { color: #E8613A; } .text-amber { color: #E8613A; } .text-red { color: #E8613A; }
.text-blue { color: #E8613A; } .text-purple { color: #E8613A; }
.text-secondary { color: #6B6058; } .text-tertiary { color: #4A4038; }
.text-sm { font-size: 12px; } .text-xs { font-size: 11px; }
.font-semibold { font-weight: 600; } .font-bold { font-weight: 700; }

/* Global: force sibling alignment in flex rows */
.page-header .btn, .card-header .btn { height: 36px; }
.inst-actions .btn { height: 28px; }
.cursor-pointer { cursor: pointer; }

/* Import dropzone */
.import-dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 40px 20px; border: 2px dashed #332F2B; border-radius: 12px;
  cursor: pointer; transition: all 150ms ease; background: #1C1917;
}
.import-dropzone:hover, .import-dropzone.dragover { border-color: #E8613A; background: rgba(232,97,58,0.05); }
.import-dropzone-icon { font-size: 40px; margin-bottom: 8px; opacity: 0.5; }
.import-dropzone-text { font-size: 14px; color: #888; font-weight: 500; }
.import-dropzone-hint { font-size: 12px; color: #666; margin-top: 4px; }
.import-spinner {
  width: 32px; height: 32px; border: 3px solid #332F2B; border-top-color: #E8613A;
  border-radius: 50%; animation: spin 0.8s linear infinite; margin: 0 auto;
}
@keyframes spin { to { transform: rotate(360deg); } }
/* Import thumbnails */
.import-thumbs { display: flex; gap: 10px; flex-wrap: wrap; padding: 0 4px; }
.import-thumb-item { position: relative; text-align: center; width: 74px; }
.import-thumb-name { font-size: 10px; color: var(--text-tertiary); margin-top: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.import-thumb-remove { position: absolute; top: -6px; right: -6px; width: 20px; height: 20px; border-radius: 50%; background: #E8613A; color: white; border: 2px solid white; font-size: 12px; line-height: 16px; cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 0; }
.import-thumb-remove:hover { background: #D4562F; }

/* Rate cell hover */
.rate-cell:hover { background: #2C2926 !important; }

/* Photo gallery hover */
[onclick*="openLightbox"]:hover .photo-actions { display: block !important; }

#import-preview-table { font-size: 12px; }
#import-preview-table .inst-edit-input { height: 28px; font-size: 12px; padding: 2px 6px; }

/* Paste area */
.paste-area {
  min-height: 200px; max-height: 300px; overflow-y: auto;
  border: 1px solid #332F2B; border-radius: 8px; padding: 12px 16px;
  font-size: 14px; font-family: inherit; color: #E8E0D8; background: #1C1917;
  line-height: 1.6; outline: none; white-space: pre-wrap;
}
.paste-area:focus { border-color: #E8613A; box-shadow: 0 0 0 3px rgba(232,97,58,0.1); }
.paste-area:empty::before {
  content: "Paste text or screenshot here (Cmd+V)...";
  color: #666; pointer-events: none;
}

/* Automation page */
.auto-status-bar { display: flex; flex-wrap: wrap; gap: 16px 32px; align-items: center; }
.auto-status-item { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.status-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.dot-green { background: #E8613A; box-shadow: 0 0 6px rgba(232,97,58,0.4); }
.dot-red { background: #555; }
.dot-amber { background: #888; }
.section-header-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.section-header-row .section-title { margin-bottom: 0; }
.auto-toggles-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 8px; }
.auto-toggle-item { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px; border-radius: 8px; background: var(--bg); border: 1px solid var(--border-light); }
.auto-toggle-label { font-size: 13px; font-weight: 500; color: var(--text); }
.auto-toggle-helper { font-size: 11px; color: var(--text-secondary); margin-top: 1px; }
.text-accent { color: #E8613A; }

/* Toggle switch */
.auto-toggle { position: relative; display: inline-block; width: 40px; height: 22px; flex-shrink: 0; }
.auto-toggle input { opacity: 0; width: 0; height: 0; }
.auto-toggle-slider { position: absolute; cursor: pointer; inset: 0; background: #3A3632; border-radius: 22px; transition: background 0.2s; }
.auto-toggle-slider::before { content: ''; position: absolute; height: 16px; width: 16px; left: 3px; bottom: 3px; background: #6B6058; border-radius: 50%; transition: transform 0.2s, background 0.2s; }
.auto-toggle input:checked + .auto-toggle-slider { background: var(--blue); }
.auto-toggle input:checked + .auto-toggle-slider::before { transform: translateX(18px); background: white; }
.auto-toggle-sm { width: 34px; height: 18px; }
.auto-toggle-sm .auto-toggle-slider::before { height: 12px; width: 12px; }
.auto-toggle-sm input:checked + .auto-toggle-slider::before { transform: translateX(16px); }

/* Section chevron */
.section-chevron { display: inline-block; width: 14px; height: 14px; transition: transform 0.2s ease; cursor: pointer; vertical-align: middle; margin-left: 8px; }
.section-chevron.expanded { transform: rotate(180deg); }

/* Section disabled state */
.section-disabled { opacity: 0.35; pointer-events: none; transition: opacity 0.2s; }

/* Alert history */
.auto-alert-history { max-height: 300px; overflow-y: auto; }
.auto-alert-history table { font-size: 13px; }

/* Lead automation controls */
.lead-auto-controls { display: flex; gap: 20px; padding: 8px 0; margin-bottom: 8px; }
.lead-auto-control { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.lead-auto-control .auto-toggle { margin: 0; }
.ai-paused-notice { font-size: 12px; color: #E8613A; padding: 4px 0; }

/* AI Prompt textarea */
.ai-prompt-textarea {
  width: 100%;
  min-height: 400px;
  background: #1C1917;
  border: 1px solid #332F2B;
  border-radius: var(--radius);
  color: #E8E0D8;
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 13px;
  line-height: 1.6;
  padding: 16px;
  resize: vertical;
  outline: none;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}
.ai-prompt-textarea:focus {
  border-color: #E8613A;
  box-shadow: 0 0 0 3px rgba(232,97,58,0.15);
}
.ai-prompt-textarea::placeholder { color: #4A4038; }

/* Template loading spinner */
.template-loading { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 48px 20px; gap: 12px; }
.template-spinner { width: 32px; height: 32px; border: 3px solid #332F2B; border-top: 3px solid #E8613A; border-radius: 50%; animation: tpl-spin 0.8s linear infinite; }
@keyframes tpl-spin { to { transform: rotate(360deg); } }
.template-loading-text { color: #6B6058; font-size: 13px; }
.template-loading-sub { color: #4A4038; font-size: 11px; }

/* Template cards */
.tpl-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; margin-top: 12px; }
.tpl-card { background: #252220; border: 0.5px solid #332F2B; border-radius: 12px; border-left: 3px solid #E8613A; padding: 20px; display: flex; flex-direction: column; gap: 8px; transition: all 150ms ease; }
.tpl-card:hover { transform: translateY(-2px); background: #2C2926; }
.tpl-card-header { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.tpl-card-unit { font-size: 13px; font-weight: 500; color: #fff; }
.tpl-card-badges { display: flex; gap: 6px; flex-shrink: 0; }
.tpl-badge { font-size: 10px; padding: 2px 8px; border-radius: 10px; border: 1px solid; line-height: 1.4; }
.tpl-badge-lang { color: #6B6058; border-color: #4A4038; }
.tpl-badge-pending { color: #E8613A; border-color: #E8613A; }
.tpl-badge-approved { color: #4ade80; border-color: #4ade80; }
.tpl-badge-declined { color: #6B6058; border-color: #4A4038; opacity: 0.6; }
.tpl-card-content { font-size: 12px; color: #E8E0D8; line-height: 1.5; white-space: pre-wrap; }
.tpl-rtl { direction: rtl; text-align: right; }
.tpl-card-row { display: flex; align-items: center; gap: 8px; margin-top: auto; flex-wrap: wrap; justify-content: space-between; }
.tpl-card-actions { display: flex; align-items: center; gap: 6px; }
.tpl-card-right { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.tpl-card-actions .btn { font-size: 11px; padding: 4px 12px; }
.tpl-card-thumbs { display: flex; gap: 4px; align-items: center; flex-shrink: 0; }
.tpl-thumb-wrap { position: relative; }
.tpl-thumb { width: 32px; height: 32px; border-radius: 4px; object-fit: cover; cursor: pointer; display: block; }
.tpl-thumb-x { position: absolute; top: -4px; right: -4px; width: 14px; height: 14px; border-radius: 50%; background: rgba(0,0,0,0.7); color: #fff; border: none; cursor: pointer; font-size: 9px; display: none; align-items: center; justify-content: center; line-height: 1; padding: 0; }
.tpl-thumb-wrap:hover .tpl-thumb-x { display: flex; }
.tpl-thumb-x:hover { background: #E8613A; }
.tpl-link { font-size: 11px; color: #E8613A; cursor: pointer; background: none; border: none; padding: 0; }
.tpl-link:hover { text-decoration: underline; }
.tpl-link-delete { color: #E8613A; }
.tpl-link-upload { color: #6B6058; }
.tpl-card-edit { font-size: 11px; color: #E8613A; cursor: pointer; background: none; border: none; padding: 0; }
.tpl-card-edit:hover { text-decoration: underline; }
.tpl-card-date { font-size: 10px; color: #555; }
.tpl-filters { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.tpl-filters select { font-size: 12px; padding: 4px 8px; background: #1C1917; border: 1px solid #332F2B; border-radius: 4px; color: #E8E0D8; width: auto; min-width: 120px; }

/* Campaign multi-select */
.campaign-select-box { border: 1px solid #332F2B; border-radius: 6px; max-height: 150px; overflow-y: auto; padding: 6px; background: #1C1917; }
.campaign-select-item { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 4px; cursor: pointer; font-size: 13px; color: #E8E0D8; transition: background 100ms; }
.campaign-select-item:hover { background: #2C2926; }
.campaign-select-item input[type="checkbox"] { appearance: none; -webkit-appearance: none; width: 16px; height: 16px; border: 1.5px solid #4A4038; border-radius: 3px; background: transparent; cursor: pointer; flex-shrink: 0; position: relative; transition: all 150ms; }
.campaign-select-item input[type="checkbox"]:checked { background: #E8613A; border-color: #E8613A; }
.campaign-select-item input[type="checkbox"]:checked::after { content: ''; position: absolute; left: 4.5px; top: 1.5px; width: 4px; height: 8px; border: solid white; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.campaign-select-item .item-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.campaign-select-item .item-sub { color: #6B6058; font-size: 11px; margin-left: auto; flex-shrink: 0; }
.campaign-note { font-size: 12px; color: #6B6058; padding: 8px 12px; background: rgba(232,97,58,0.06); border-left: 2px solid #E8613A; border-radius: 0 4px 4px 0; margin-top: 12px; line-height: 1.5; }

/* Status dashboard */
.status-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; color: #6B6058; margin-bottom: 8px; }
.status-services-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px 16px; }
.dot-green { background: #4CAF50 !important; }
.dot-red { background: #F44336 !important; }
.dot-orange { background: #E8613A !important; }
.dot-gray { background: #4A4038 !important; }
.auto-job-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; flex-wrap: wrap; }
.auto-job-name { font-weight: 500; min-width: 130px; }

/* Activity log */
.activity-log-scroll { max-height: 400px; overflow-y: auto; border: 1px solid #332F2B; border-radius: 6px; }
.log-entry { display: flex; align-items: baseline; gap: 8px; padding: 8px 12px; border-bottom: 1px solid #2A2725; font-size: 13px; }
.log-entry:last-child { border-bottom: none; }
.log-time { color: #6B6058; font-size: 11px; white-space: nowrap; min-width: 70px; }
.log-icon { flex-shrink: 0; }
.log-desc { color: #E8E0D8; }
.log-time-pills { display: flex; gap: 4px; overflow-x: auto; flex-shrink: 0; }
.log-pill { background: transparent !important; border: 1px solid #332F2B !important; color: #6B6058 !important; }
.log-pill.active { border-color: #E8613A !important; color: #E8613A !important; }

/* PDF presentation dropdown chevron */
button.pdf-dropdown-btn { padding: 0 30px 0 16px !important; background: #252220 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236B6058' d='M2 4l4 4 4-4'/%3E%3C/svg%3E") no-repeat right 10px center !important; }
button.pdf-dropdown-btn:hover { background-color: #2C2926 !important; }

/* Export dropdown */
.export-dropdown { position: relative; display: inline-block; }
.export-menu { display: none; position: absolute; right: 0; top: 100%; background: #1C1917; border: 1px solid #332F2B; border-radius: 8px; padding: 4px 0; z-index: 100; min-width: 150px; margin-top: 4px; box-shadow: 0 4px 12px rgba(0,0,0,0.4); }
.export-menu.show { display: block; }
.export-menu button { display: block; width: 100%; text-align: left; padding: 10px 16px; background: none; border: none; color: #E8E0D8; font-size: 14px; cursor: pointer; font-family: inherit; }
.export-menu button:hover { background: #E8613A; color: white; }

/* Auto overview card metrics */
.auto-bar-metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; padding: 20px 0 20px; }
.auto-bar-metric { text-align: center; }
.auto-bar-num { font-size: 20px; font-weight: 700; color: #E8E0D8; }
.auto-bar-lbl { font-size: 12px; color: #6B6058; margin-top: 2px; }

/* Comment reply templates */
.cr-reply-row { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border: 1px solid #332F2B; border-radius: 6px; margin-bottom: 6px; background: #201D1A; }
.cr-reply-text { flex: 1; font-size: 13px; color: #E8E0D8; white-space: pre-line; direction: auto; }
.cr-reply-x { flex-shrink: 0; min-height: 32px; width: 32px; padding: 0; color: #6B6058; font-size: 14px; }
.cr-reply-x:hover { color: #F44336; }

/* Login screen */
.login-screen { position: fixed; inset: 0; background: #1C1917; display: flex; align-items: center; justify-content: center; z-index: 2000; }
.login-box { width: 100%; max-width: 400px; padding: 0 20px; text-align: center; }
.login-logo { margin-bottom: 16px; }
.login-logo-icon { width: 64px; height: 64px; background: #E8613A; border-radius: 16px; display: inline-flex; align-items: center; justify-content: center; color: white; font-weight: 700; font-size: 28px; }
.login-title { font-size: 24px; font-weight: 700; color: #FFFFFF; margin-bottom: 32px; }
.login-title span { color: #FFFFFF; margin-left: 6px; }
.login-input { width: 100%; height: 48px; padding: 0 16px; background: #252220; border: 1px solid #332F2B; border-radius: 8px; color: #E8E0D8; font-size: 16px; font-family: inherit; outline: none; transition: border-color 150ms; }
.login-input:focus { border-color: #E8613A; box-shadow: 0 0 0 3px rgba(232,97,58,0.15); }
.login-input:disabled { opacity: 0.4; cursor: not-allowed; }
.login-btn { width: 100%; height: 48px; margin-top: 12px; background: #E8613A; color: white; border: none; border-radius: 8px; font-size: 16px; font-weight: 600; font-family: inherit; cursor: pointer; transition: background 150ms; }
.login-btn:hover { background: #D4562F; }
.login-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.login-error { margin-top: 12px; font-size: 13px; min-height: 20px; }
.login-error.error-text { color: #E8613A; }
.login-error.lockout-text { color: #E8613A; }
.nav-logout { color: #6B6058 !important; margin-bottom: 12px; }
.nav-logout:hover { color: #E8613A !important; }
@keyframes shake { 0%,100% { transform: translateX(0); } 20%,60% { transform: translateX(-8px); } 40%,80% { transform: translateX(8px); } }
.login-shake { animation: shake 400ms ease; }

/* Mobile nav elements — hidden on desktop */
.hamburger-btn { display: none; position: fixed; top: 16px; left: 12px; z-index: 200; background: transparent; border: none; color: #E8E0D8; font-size: 22px; cursor: pointer; width: 44px; height: 44px; align-items: center; justify-content: center; padding: 0; }
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 90; }
.sidebar-close { display: none; position: absolute; top: 16px; right: 12px; background: transparent; border: none; color: #6B6058; font-size: 24px; cursor: pointer; width: 44px; height: 44px; align-items: center; justify-content: center; padding: 0; }
.sidebar-close:hover { color: #E8E0D8; }

/* Responsive */
@media (max-width: 1024px) {
  .three-col { grid-template-columns: 1fr; }
  .revenue-row { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  /* ── Sidebar → hamburger ── */
  .hamburger-btn { display: flex; }
  .sidebar {
    transform: translateX(-100%);
    transition: transform 300ms ease;
    z-index: 100;
    width: 240px;
    padding: 0 12px;
    overflow-y: auto;
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.active { display: block; }
  .sidebar-close { display: flex; }
  .nav-spacer { display: none; }
  .nav-logout { margin-top: 16px; }
  .main-content { margin-left: 0; padding: 16px; overflow-x: hidden; max-width: 100vw; }

  /* ── Search bar: room for hamburger ── */
  .search-wrapper { margin-left: 50px; max-width: none; }

  /* ── Typography ── */
  .page-header h1 { font-size: 20px; }

  /* ── Cards: reduce padding + contain table overflow ── */
  .card { overflow-x: auto; max-width: 100%; }
  .card-header { padding: 12px 16px; }
  .section-card { padding: 16px; }
  .pricing-grid { padding: 0 12px 12px; }
  .specs-grid { grid-template-columns: repeat(2, 1fr); }
  .spec-item { padding: 8px 12px; }

  /* ── Overview: quick actions 2x2 grid ── */
  .quick-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; width: 100%; }
  .quick-actions .btn { white-space: normal; width: 100%; }

  /* ── Overview: metric cards no truncation ── */
  .metric-card { overflow-wrap: break-word; }
  .metric-value { word-break: break-word; }
  .metric-sub { white-space: normal; }

  /* ── Overview: financial row single column (override inline style) ── */
  .revenue-row { grid-template-columns: 1fr !important; }

  /* ── Grids: stack ── */
  .three-col { grid-template-columns: 1fr; }
  .metrics-row { grid-template-columns: 1fr; }
  .unit-grid { grid-template-columns: 1fr; }
  .tpl-grid { grid-template-columns: 1fr; }
  .auto-toggles-grid { grid-template-columns: 1fr; }

  /* ── Forms: stack rows ── */
  .form-row { flex-direction: column; gap: 0; }

  /* ── Tables: horizontal scroll ── */
  table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; width: 100%; max-width: 100%; }
  thead, tbody, tfoot { display: table; width: 100%; min-width: 600px; }

  /* ── Unit detail: action buttons wrap ── */
  .detail-page-header { flex-direction: column; align-items: flex-start; }
  .detail-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; width: 100%; }
  .detail-actions .status-select,
  .detail-actions .btn-edit,
  .detail-actions .btn-archive { width: 100%; justify-content: center; }
  .detail-actions #pdf-actions { display: contents; }
  .detail-actions #pdf-actions #pdf-upload-btn { width: 100%; justify-content: center; }
  .detail-actions #pdf-actions .export-dropdown { width: 100%; }
  .detail-actions #pdf-actions .export-dropdown > button.pdf-dropdown-btn { width: 100%; justify-content: center; }

  /* ── Page header: stack ── */
  .page-header { flex-direction: column; align-items: flex-start; gap: 12px; }
  .header-actions { width: 100%; display: flex; flex-direction: column; gap: 8px; }
  .header-actions .btn { width: 100%; }
  .header-actions .export-dropdown { width: 100%; }
  .header-actions .export-dropdown > .btn { width: 100%; height: 44px; font-size: 14px; }

  /* ── Follow-ups date pickers: stack on mobile ── */
  .filter-bar .date-pair { width: 100%; }
  .filter-bar .date-pair input { width: 100%; }

  /* ── Filter bar ── */
  .filter-bar select, .filter-bar input { min-width: 0; flex: 1; }
  .filter-bar .search-input { min-width: 0; width: 100%; }
  .filter-bar .export-dropdown { width: 100%; }
  .filter-bar .export-dropdown > .btn { width: 100%; height: 44px; font-size: 14px; }

  /* ── Facebook: tab bar horizontal scroll ── */
  .tab-bar { overflow-x: auto; -webkit-overflow-scrolling: touch; flex-wrap: nowrap; gap: 0; padding-bottom: 4px; }
  .tab-btn { flex-shrink: 0; padding: 8px 14px; }

  /* ── Modals: near-fullscreen ── */
  .modal { width: 95vw !important; max-width: 95vw !important; max-height: 90vh; border-radius: 0; }
  .modal-header { padding: 16px 16px 12px; }
  .modal-body { padding: 8px 16px 16px; }

  /* ── Unit card prices: wrap ── */
  .unit-card-prices { flex-wrap: wrap; gap: 12px; }

  /* ── Card header: allow wrapping ── */
  .card-header { flex-wrap: wrap; gap: 8px; }
  .section-header-row { flex-wrap: wrap; gap: 8px; }

  /* ── Form actions: full width ── */
  .form-actions { flex-wrap: wrap; }
  .form-actions .btn { flex: 1; min-width: 0; }

  /* ── Automation status dashboard ── */
  .auto-status-bar { gap: 8px 16px; }
  .auto-bar-metrics { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .status-services-grid { grid-template-columns: 1fr; }
  .auto-job-row { flex-direction: column; align-items: flex-start; gap: 4px; padding: 8px 0; }
  .auto-job-name { min-width: auto; }
  .activity-log-scroll { max-height: 300px; }
  .log-entry { flex-wrap: wrap; }
  .log-time { min-width: auto; }
  .log-time-pills { overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; }

  /* ── Buttons: allow text wrap on mobile ── */
  .btn, .btn-sm { white-space: normal; }

  /* ── Touch targets: 44px minimum ── */
  .btn { min-height: 44px; }
  .btn-sm { min-height: 44px; }
  .nav-item { min-height: 44px; }
  .tab-btn { min-height: 44px; }
  .auto-toggle { width: 44px; height: 26px; }
  .auto-toggle-slider::before { height: 20px; width: 20px; }
  .auto-toggle input:checked + .auto-toggle-slider::before { transform: translateX(18px); }
  select, input[type="text"], input[type="number"], input[type="email"],
  input[type="date"], input[type="time"], input[type="datetime-local"],
  input[type="tel"], input[type="url"], input[type="password"],
  input[type="search"], .input { min-height: 44px; }
  .search-bar { min-height: 44px; }
  .search-item { min-height: 44px; display: flex; align-items: center; }
  .campaign-select-item input[type="checkbox"] { width: 20px; height: 20px; }

  /* ── Export action sheet ── */
  .export-menu { position: fixed; bottom: 0; left: 0; right: 0; top: auto; border-radius: 12px 12px 0 0; padding: 8px 0; z-index: 1100; }
  .export-menu button { padding: 14px 16px; min-height: 44px; }
}

@media (max-width: 480px) {
  .main-content { padding: 12px; }
  .metrics-row { grid-template-columns: 1fr; }
  .revenue-row { grid-template-columns: 1fr !important; }
  .detail-actions { grid-template-columns: 1fr; }
  .page-header h1 { font-size: 18px; }
  .metric-card { padding: 12px 14px; }
  .metric-value { font-size: 18px; }
  .unit-card { padding: 14px; }
  .drag-handle { display: none !important; }
  .unit-card-prices { flex-direction: column; gap: 8px; }
  .badge-group { flex-wrap: wrap; }
  .filter-bar { flex-direction: column; }
  .filter-bar select, .filter-bar input, .filter-bar .btn { width: 100%; min-width: 0; }
  .header-actions { flex-direction: column; gap: 8px; width: 100%; }
  .header-actions .btn { width: 100%; }
  .test-convo { max-width: 100%; }
}

/* ─── Testing page — Live Chat ─────────────────────────────────────── */

/* Full-screen chat layout — uses Zain OS warm palette */
.tc-page { position: fixed; top: 0; left: 240px; right: 0; bottom: 0; display: flex; flex-direction: column; z-index: 10; background: #1C1917; }

/* Top bar — matches card style */
.tc-topbar { display: flex; justify-content: space-between; align-items: center; padding: 12px 18px; background: #252220; border-bottom: 1px solid #332F2B; flex-shrink: 0; gap: 12px; }
.tc-topbar-left { display: flex; align-items: center; gap: 10px; }
.tc-topbar-right { display: flex; align-items: center; }
.tc-btn-new { padding: 6px 14px; font-size: 13px; border-radius: 6px; }
.tc-phone-badge { font-size: 12px; color: #6B6058; font-family: monospace; background: #2A2725; padding: 4px 10px; border-radius: 4px; border: 1px solid #332F2B; }
#tc-unit-select { background: #1C1917; color: #E8E0D8; border: 1px solid #332F2B; border-radius: 6px; padding: 7px 12px; font-size: 13px; max-width: 280px; outline: none; }
#tc-unit-select:focus { border-color: #E8613A; }

/* Chat area */
.tc-chat-area { flex: 1; overflow-y: auto; padding: 20px 16px; display: flex; flex-direction: column; gap: 6px; }
.tc-chat-area::-webkit-scrollbar { width: 6px; }
.tc-chat-area::-webkit-scrollbar-track { background: #1C1917; }
.tc-chat-area::-webkit-scrollbar-thumb { background: #332F2B; border-radius: 3px; }
.tc-chat-area::-webkit-scrollbar-thumb:hover { background: #4A4038; }

/* Welcome state */
.tc-welcome { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; color: #6B6058; font-size: 15px; }
.tc-welcome-icon { font-size: 56px; opacity: 0.4; }

/* Chat bubbles */
.tc-bubble { max-width: 72%; width: fit-content; padding: 10px 14px; border-radius: 12px; color: #E8E0D8; overflow-wrap: break-word; word-break: break-word; }
.tc-bubble-lead { align-self: flex-end; background: #332F2B; border-bottom-right-radius: 4px; }
.tc-bubble-agent { align-self: flex-start; background: rgba(232,97,58,0.1); border: 1px solid rgba(232,97,58,0.18); border-left: 3px solid #E8613A; border-bottom-left-radius: 4px; }
.tc-bubble-text { font-size: 15px; line-height: 1.6; direction: auto; unicode-bidi: plaintext; white-space: pre-wrap; }
.tc-bubble-time { font-size: 10px; color: #4A4038; text-align: right; margin-top: 4px; }
.tc-mic-tag { font-size: 12px; opacity: 0.6; }

/* System messages */
.tc-system-msg { text-align: center; font-size: 12px; color: #6B6058; padding: 8px 16px; margin: 4px auto; max-width: 80%; }
.tc-suppressed-msg { font-style: italic; color: #6B6058; background: #201D1A; border: 1px solid #2A2725; border-radius: 8px; padding: 10px 16px; }
.tc-show-raw { color: #E8613A; cursor: pointer; font-size: 11px; margin-left: 6px; font-style: normal; }
.tc-show-raw:hover { text-decoration: underline; }
.tc-raw-box { margin-top: 8px; padding: 8px 12px; background: #1C1917; border: 1px solid #2A2725; border-radius: 6px; font-style: normal; font-size: 13px; color: #6B6058; direction: auto; unicode-bidi: plaintext; white-space: pre-wrap; }

/* Indicator badges (handoff, pdf) */
.tc-indicator { text-align: center; font-size: 12px; padding: 6px 14px; margin: 4px auto; width: fit-content; border-radius: 8px; font-weight: 500; }
.tc-indicator-handoff { color: #E8613A; background: rgba(232,97,58,0.1); border: 1px solid rgba(232,97,58,0.2); }
.tc-indicator-pdf { color: #E8613A; background: rgba(232,97,58,0.08); border: 1px solid rgba(232,97,58,0.15); }

/* PDF document bubble — WhatsApp-style */
.tc-pdf-bubble { text-decoration: none; cursor: pointer; padding: 10px 14px; transition: background 0.15s; }
.tc-pdf-bubble:hover { background: rgba(232,97,58,0.16); }
.tc-pdf-file-row { display: flex; align-items: center; gap: 12px; }
.tc-pdf-file-icon { font-size: 32px; flex-shrink: 0; filter: drop-shadow(0 1px 2px rgba(0,0,0,0.3)); }
.tc-pdf-file-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tc-pdf-file-name { font-size: 13px; font-weight: 600; color: #E8E0D8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 240px; }
.tc-pdf-file-meta { font-size: 11px; color: #6B6058; }

/* Typing indicator */
.tc-typing { padding: 14px 20px; background: rgba(232,97,58,0.06); border-left: 3px solid rgba(232,97,58,0.3); }
.tc-dots { display: flex; gap: 5px; }
.tc-dots span { width: 8px; height: 8px; border-radius: 50%; background: #E8613A; opacity: 0.4; animation: tc-dot-bounce 1.4s infinite; }
.tc-dots span:nth-child(2) { animation-delay: 0.2s; }
.tc-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes tc-dot-bounce { 0%,60%,100% { opacity: 0.25; transform: translateY(0); } 30% { opacity: 0.8; transform: translateY(-4px); } }

/* Input bar */
.tc-input-bar { display: flex; align-items: center; padding: 12px 14px; background: #252220; border-top: 1px solid #332F2B; gap: 8px; flex-shrink: 0; }
.tc-text-input { flex: 1; background: #1C1917; border: 1px solid #332F2B; border-radius: 22px; padding: 10px 18px; color: #E8E0D8; font-size: 15px; outline: none; transition: border-color 0.15s; }
.tc-text-input::placeholder { color: #6B6058; }
.tc-text-input:focus { border-color: #E8613A; }
.tc-btn-send { width: 42px; height: 42px; border-radius: 50%; background: #E8613A; border: none; color: #fff; font-size: 18px; cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: background 0.15s; }
.tc-btn-send:hover { background: #D4562F; }
.tc-btn-send:disabled { opacity: 0.5; cursor: default; }
.tc-btn-mic { width: 42px; height: 42px; border-radius: 50%; background: #332F2B; border: none; color: #E8E0D8; font-size: 18px; cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: all 0.15s; }
.tc-btn-mic:hover { background: #4A4038; }
.tc-btn-mic:disabled { opacity: 0.5; cursor: default; }
.tc-btn-mic.recording { background: #EF4444; animation: tc-pulse-rec 1s infinite; }
@keyframes tc-pulse-rec { 0%,100% { box-shadow: 0 0 0 0 rgba(239,68,68,0.4); } 50% { box-shadow: 0 0 0 10px rgba(239,68,68,0); } }

/* Recording state — red dot + timer + stop button */
.tc-rec-bar { flex: 1; display: flex; align-items: center; gap: 10px; padding: 0 12px; }
.tc-rec-dot { width: 10px; height: 10px; border-radius: 50%; background: #EF4444; animation: tc-rec-blink 1s infinite; flex-shrink: 0; }
@keyframes tc-rec-blink { 0%,100% { opacity: 1; } 50% { opacity: 0.3; } }
.tc-rec-timer { font-size: 16px; font-weight: 600; color: #EF4444; font-variant-numeric: tabular-nums; }
.tc-btn-stop { width: 42px; height: 42px; border-radius: 50%; background: #EF4444; border: none; color: #fff; font-size: 16px; cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: background 0.15s; }
.tc-btn-stop:hover { background: #DC2626; }

/* Voice preview state — mic icon + duration + delete/send */
.tc-voice-preview { flex: 1; display: flex; align-items: center; gap: 10px; background: #1C1917; border: 1px solid #332F2B; border-radius: 22px; padding: 8px 16px; }
.tc-preview-icon { font-size: 18px; flex-shrink: 0; }
.tc-preview-dur { font-size: 15px; font-weight: 600; color: #E8E0D8; font-variant-numeric: tabular-nums; }
.tc-preview-label { font-size: 13px; color: #6B6058; }
.tc-btn-discard { width: 42px; height: 42px; border-radius: 50%; background: #332F2B; border: none; color: #EF4444; font-size: 18px; cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: background 0.15s; }
.tc-btn-discard:hover { background: rgba(239,68,68,0.15); }

/* ─── Testing responsive ──────────────────────────────────────────── */
@media (max-width: 768px) {
  .tc-page { left: 0; }
  .tc-topbar { flex-direction: column; align-items: stretch; gap: 8px; padding: 10px 12px; }
  .tc-topbar-left { width: 100%; }
  .tc-topbar-right { justify-content: flex-end; }
  #tc-unit-select { max-width: 100%; flex: 1; }
  .tc-bubble { max-width: 88%; }
  .tc-chat-area { padding: 14px 10px; }
  .tc-input-bar { padding: 10px; }
  .tc-text-input { font-size: 14px; padding: 9px 14px; }
}

/* ─── Presentation mode (standalone HTML template renderer) ─────── */
html.presentation-mode #login-screen,
html.presentation-mode #app-layout,
html.presentation-mode #alert-banner,
html.presentation-mode #toast-container { display: none !important; }
html.presentation-mode #presentation-root { display: block !important; }
html.presentation-mode body { background: #1A1A1A; color: #FFFFFF; font-family: 'Plus Jakarta Sans', sans-serif; margin: 0; }
.presentation-loading { display: flex; min-height: 100vh; align-items: center; justify-content: center; color: #FFFFFF; font-family: 'Plus Jakarta Sans', sans-serif; font-size: 16px; }
.presentation-error { display: flex; min-height: 100vh; align-items: center; justify-content: center; color: #FFFFFF; font-family: 'Plus Jakarta Sans', sans-serif; text-align: center; padding: 40px; }
.presentation-error h2 { color: #E8613A; margin: 0 0 12px 0; font-weight: 600; }
.presentation-error p { color: #888; margin: 0; font-size: 14px; }

/* Live preview niceties — SCREEN-ONLY so they don't affect Playwright's
   PDF output. Playwright switches to print media emulation during
   page.pdf(), so everything inside @media screen is invisible there and
   the PDF lays out edge-to-edge per @page rules as before.

   Without this block the .page elements (each a fixed 297mm × 210mm A4
   landscape block) stack flush-left inside #presentation-root, leaving a
   big dead zone on the right side of wide monitors. With this block we
   flex-center each page in the viewport, add breathing room between
   pages, and drop a subtle drop-shadow so each slide reads as its own
   card against the dark background. */
@media screen {
  html.presentation-mode #presentation-root {
    display: flex !important;
    flex-direction: column;
    align-items: center;
    gap: 40px;
    padding: 40px 24px;
    box-sizing: border-box;
    min-height: 100vh;
  }
  html.presentation-mode .page {
    /* flex-shrink:0 keeps the A4 aspect intact when the viewport is
       narrower than 297mm — the page overflows horizontally (browsers
       show a scrollbar) rather than being squeezed into a distorted box. */
    flex-shrink: 0;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.55), 0 2px 8px rgba(0, 0, 0, 0.4);
  }
}

/* Presentation on phones: tighten padding so the slides aren't dwarfed
   by margin. The A4 page itself stays at fixed dimensions (preserves
   the print-quality design) and the user pinch-zooms / horizontal-scrolls
   to read. Full responsive layout would require changes to each per-unit
   template, which is owned by the zain-pdf-presentation skill. */
@media screen and (max-width: 1024px) {
  html.presentation-mode #presentation-root {
    padding: 16px 12px;
    gap: 20px;
  }
}
