@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@300;400;500&family=DM+Sans:wght@300;400;500&family=Josefin+Sans:wght@200;300&display=swap');

[x-cloak] { display: none !important; }

/* ── LOGIN SCREEN ── */
.login-screen {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #080705;
  font-family: 'DM Sans', sans-serif;
}

.login-grain {
  position: absolute;
  inset: 0;
  opacity: 0.03;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='g'%3E%3CfeTurbulence baseFrequency='0.65' type='fractalNoise'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)'/%3E%3C/svg%3E");
  pointer-events: none;
}

.login-bracket {
  position: absolute;
  width: 60px;
  height: 60px;
  border-color: rgba(184,151,90,0.2);
  border-style: solid;
  border-width: 0;
}
.login-bracket-tl { top: 40px; right: 40px; border-top-width: 1px; border-right-width: 1px; }
.login-bracket-br { bottom: 40px; left: 40px; border-bottom-width: 1px; border-left-width: 1px; }

.login-container {
  position: relative;
  text-align: center;
  max-width: 380px;
  width: 100%;
  padding: 0 24px;
  animation: loginFadeIn 0.8s ease-out;
}

@keyframes loginFadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.login-eyebrow {
  font-family: 'Josefin Sans', sans-serif;
  font-size: 10px;
  font-weight: 200;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: rgba(248,245,238,0.35);
  margin-bottom: 20px;
}

.login-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(36px, 5vw, 48px);
  font-weight: 300;
  color: #F8F5EE;
  line-height: 1.15;
  margin-bottom: 24px;
}
.login-title em {
  font-style: italic;
  color: #B8975A;
}

.login-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 24px;
}
.login-divider::before,
.login-divider::after {
  content: '';
  width: 40px;
  height: 1px;
  background: rgba(184,151,90,0.3);
}
.login-divider span {
  font-size: 14px;
  color: #B8975A;
  opacity: 0.5;
}

.login-subtitle {
  font-size: 13px;
  font-weight: 300;
  color: rgba(248,245,238,0.45);
  margin-bottom: 36px;
  line-height: 1.6;
}

.login-form {
  text-align: left;
}

.login-field {
  margin-bottom: 18px;
}

.login-field label {
  display: block;
  font-family: 'Josefin Sans', sans-serif;
  font-size: 9px;
  font-weight: 200;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(248,245,238,0.4);
  margin-bottom: 8px;
}

.login-field input {
  width: 100%;
  padding: 12px 16px;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 300;
  color: #F8F5EE;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(184,151,90,0.2);
  border-radius: 2px;
  outline: none;
  transition: border-color 0.2s;
}

.login-field input:focus {
  border-color: #B8975A;
}

.login-field input::placeholder {
  color: rgba(248,245,238,0.2);
}

.login-error {
  color: #c0392b;
  font-size: 12px;
  text-align: center;
  margin-bottom: 16px;
}

.login-form button {
  width: 100%;
  padding: 14px;
  font-family: 'Josefin Sans', sans-serif;
  font-size: 11px;
  font-weight: 300;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #080705;
  background: #B8975A;
  border: none;
  border-radius: 2px;
  cursor: pointer;
  transition: background 0.2s;
  margin-top: 8px;
}

.login-form button:hover {
  background: #D4B878;
}

.login-form button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

:root {
  --encre:   #080705;
  --bronze:  #6D5434;
  --or:      #B8975A;
  --or-light:#D4B878;
  --cream:   #F8F5EE;
  --charcoal:#1A1A1A;
  --border:  #E2DDD5;
  --muted:   #999;
  --red:     #c0392b;
  --green:   #27ae60;
}

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

body {
  font-family: 'DM Sans', sans-serif;
  font-weight: 300;
  font-size: 14px;
  color: var(--charcoal);
  background: var(--cream);
  min-height: 100vh;
  display: flex;
}

/* ── SIDEBAR ── */
.sidebar {
  width: 220px;
  min-height: 100vh;
  background: var(--encre);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: fixed;
  top: 0; left: 0; bottom: 0;
}

.sidebar-logo {
  padding: 28px 24px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-logo-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 20px;
  font-weight: 300;
  color: var(--or);
  letter-spacing: 0.05em;
}

.sidebar-logo-sub {
  font-family: 'Josefin Sans', sans-serif;
  font-size: 9px;
  font-weight: 200;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.35);
  margin-top: 3px;
}

.sidebar-nav {
  padding: 16px 0;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 24px;
  font-size: 13px;
  font-weight: 300;
  color: rgba(255,255,255,0.55);
  cursor: pointer;
  transition: all 0.15s;
  border-left: 2px solid transparent;
  user-select: none;
}

.nav-item:hover { color: rgba(255,255,255,0.9); background: rgba(255,255,255,0.04); }
.nav-item.active { color: var(--or); border-left-color: var(--or); background: rgba(184,151,90,0.08); }

.nav-icon { font-size: 15px; width: 20px; text-align: center; }

.sidebar-footer {
  padding: 16px 24px;
  border-top: 1px solid rgba(255,255,255,0.08);
  font-size: 10px;
  color: rgba(255,255,255,0.2);
  line-height: 1.6;
}

/* ── MAIN CONTENT ── */
.main {
  margin-left: 220px;
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 16px 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.page-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 26px;
  font-weight: 300;
  color: var(--encre);
}

.content {
  padding: 32px 36px;
  flex: 1;
}

/* ── BUTTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 400;
  border: none;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
  border-radius: 2px;
}

.btn-primary { background: var(--encre); color: #fff; }
.btn-primary:hover { background: #2a2a2a; }

.btn-bronze { background: var(--bronze); color: #fff; }
.btn-bronze:hover { background: #5a4328; }

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--charcoal);
}
.btn-outline:hover { border-color: var(--bronze); color: var(--bronze); }

.btn-ghost { background: transparent; color: var(--muted); padding: 6px 10px; }
.btn-ghost:hover { color: var(--red); }

.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 12px 28px; font-size: 14px; }

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

/* ── CARDS ── */
.card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 24px;
}

.card-title {
  font-family: 'Josefin Sans', sans-serif;
  font-weight: 300;
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 16px;
}

/* ── FORMS ── */
.form-group { margin-bottom: 16px; }

.form-label {
  display: block;
  font-size: 11px;
  font-weight: 400;
  color: var(--muted);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 9px 12px;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 300;
  color: var(--charcoal);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 2px;
  outline: none;
  transition: border-color 0.15s;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--or);
}

.form-textarea { resize: vertical; min-height: 70px; }

.form-row { display: grid; gap: 16px; }
.form-row-2 { grid-template-columns: 1fr 1fr; }
.form-row-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-row-4 { grid-template-columns: 2fr 1fr 1fr 1fr; }

/* ── TABLES ── */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

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

table.data-table th {
  font-family: 'Josefin Sans', sans-serif;
  font-weight: 300;
  font-size: 10px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

table.data-table td {
  padding: 12px 14px;
  font-size: 13px;
  border-bottom: 1px solid #f0ece4;
  vertical-align: middle;
}

table.data-table tr:last-child td { border-bottom: none; }
table.data-table tr:hover td { background: #faf8f4; }

.td-right { text-align: right; }
table.data-table th.th-right { text-align: right; }
.td-muted { color: var(--muted); font-size: 12px; }
.td-sub { font-size: 11px; color: var(--muted); margin-top: 2px; }
.td-notes { max-width: 220px; }
.notes-preview {
  font-size: 12px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-height: 1.4;
}

/* ── BADGES ── */
.badge {
  display: inline-block;
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 400;
  border-radius: 2px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.badge-draft    { background: #f0f0f0; color: #888; }
.badge-sent     { background: #fff3cd; color: #856404; }
.badge-accepted { background: #d1e7dd; color: #0a3622; }
.badge-paid     { background: #d1e7dd; color: #0a3622; }
.badge-rejected { background: #f8d7da; color: #842029; }
.badge-archived { background: #e8e8e8; color: #666; }

/* ── WIZARD ── */
.wizard-steps {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 32px;
}

.wizard-step {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 300;
  color: var(--muted);
}

.wizard-step.active { color: var(--encre); font-weight: 400; }
.wizard-step.done { color: var(--bronze); }

.step-num {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 500;
  border: 1.5px solid var(--border);
  color: var(--muted);
  background: #fff;
  flex-shrink: 0;
}

.wizard-step.active .step-num { border-color: var(--encre); color: var(--encre); }
.wizard-step.done .step-num { border-color: var(--bronze); background: var(--bronze); color: #fff; }

.step-divider { flex: 1; height: 1px; background: var(--border); min-width: 20px; }

/* ── CATALOG SEARCH ── */
.catalog-search-wrap { position: relative; }

.catalog-results {
  position: absolute;
  top: 100%;
  left: 0; right: 0;
  background: #fff;
  border: 1px solid var(--border);
  border-top: none;
  z-index: 100;
  max-height: 280px;
  overflow-y: auto;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.catalog-result-item {
  padding: 10px 14px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
  border-bottom: 1px solid #f5f2ec;
  transition: background 0.1s;
}

.catalog-result-item:hover { background: var(--cream); }
.catalog-result-item:last-child { border-bottom: none; }

.result-name { font-size: 13px; font-weight: 400; }
.result-detail { font-size: 11px; color: var(--muted); margin-left: 6px; }
.result-price { font-size: 12px; color: var(--bronze); font-weight: 500; display: block; }
.result-tier { font-size: 9px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; display: block; text-align: right; }

/* ── LINE ITEMS ── */
.lines-table { width: 100%; border-collapse: collapse; margin-top: 12px; }

.lines-table th {
  font-size: 10px;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  padding: 6px 10px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.lines-table td {
  padding: 8px 10px;
  font-size: 13px;
  border-bottom: 1px solid #f0ece4;
  vertical-align: middle;
}

.lines-table td input {
  border: 1px solid var(--border);
  background: #fff;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 300;
  color: var(--charcoal);
  width: 100%;
  outline: none;
  padding: 5px 8px;
  border-radius: 3px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.lines-table td input:focus {
  border-color: var(--or);
  box-shadow: 0 0 0 2px rgba(184,151,90,0.15);
}
.lines-table td input::placeholder {
  color: var(--or);
  opacity: 0.6;
  font-style: italic;
}
.lines-table td input.qty-empty {
  border-color: var(--or);
  background: rgba(184,151,90,0.06);
}
.lines-table .td-r { text-align: right; }
.lines-table .td-num { width: 100px; }
.lines-table .td-unit { width: 70px; }
.lines-table .td-price { width: 100px; }
.lines-table .td-total { width: 90px; font-weight: 400; }
.lines-table .td-del { width: 36px; text-align: center; }

.margin-note { font-size: 10px; color: var(--muted); font-style: italic; }

/* ── SUMMARY ── */
.summary-box {
  background: var(--cream);
  border: 1px solid var(--border);
  border-radius: 2px;
  overflow: hidden;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  padding: 10px 16px;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
}

.summary-row:last-child { border-bottom: none; }
.summary-label { color: var(--bronze); }
.summary-amount { font-weight: 400; }

.total-row {
  background: var(--encre);
  color: #fff;
  display: flex;
  justify-content: space-between;
  padding: 12px 16px;
  font-size: 15px;
  font-weight: 500;
}

/* ── ALERTS ── */
.alert {
  padding: 12px 16px;
  border-radius: 2px;
  font-size: 13px;
  margin-bottom: 16px;
}
.alert-success { background: #d1e7dd; color: #0a3622; border-left: 3px solid var(--green); }
.alert-error   { background: #f8d7da; color: #842029; border-left: 3px solid var(--red); }

/* ── CLIENT CARD ── */
.client-selected {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: #fff;
  border: 1px solid var(--or);
  border-radius: 2px;
  margin-bottom: 12px;
}
.client-selected-name { font-weight: 500; font-size: 14px; }
.client-selected-detail { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ── MISC ── */
.divider { height: 1px; background: var(--border); margin: 24px 0; }
.section-title {
  font-family: 'Josefin Sans', sans-serif;
  font-size: 10px;
  font-weight: 300;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 14px;
}
.text-muted { color: var(--muted); }
.text-bronze { color: var(--bronze); }
.text-right { text-align: right; }
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8  { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.flex  { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-end { display: flex; justify-content: flex-end; gap: 10px; }
.gap-10 { gap: 10px; }
.gap-16 { gap: 16px; }
.empty-state { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty-state-icon { font-size: 36px; margin-bottom: 12px; }
.spinner { display: inline-block; width: 16px; height: 16px; border: 2px solid rgba(255,255,255,0.3); border-top-color: #fff; border-radius: 50%; animation: spin 0.6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── PAGINATION ── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  padding: 14px 4px 4px;
}
.page-btn {
  min-width: 30px;
  height: 30px;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  font-weight: 400;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--charcoal);
  cursor: pointer;
  border-radius: 2px;
  transition: all 0.15s;
}
.page-btn:hover:not(:disabled) { border-color: var(--bronze); color: var(--bronze); }
.page-btn.active { background: var(--encre); color: #fff; border-color: var(--encre); }
.page-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.page-info { font-size: 11px; color: var(--muted); margin-right: 8px; }

/* ── SIDEBAR SECTIONS ── */
.nav-section-label {
  font-family: 'Josefin Sans', sans-serif;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.55);
  padding: 18px 24px 8px;
}

.nav-item-bottom {
  border-top: 1px solid rgba(255,255,255,0.06);
  margin-top: auto;
  color: rgba(255,255,255,0.35);
  font-size: 12px;
}
.nav-item-bottom:hover { color: rgba(255,255,255,0.65); }
.nav-item-bottom.active { color: var(--or); border-left-color: var(--or); background: rgba(184,151,90,0.08); }

.nav-divider {
  height: 1px;
  background: rgba(255,255,255,0.06);
  margin: 10px 20px;
}
.nav-item-accent {
  color: var(--or-light);
}
.nav-item-accent:hover { color: #fff; }

/* ── DASHBOARD SPLIT ── */
.dash-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start;
}
@media (max-width: 1000px) {
  .dash-split { grid-template-columns: 1fr; }
}
.dash-col { display: flex; flex-direction: column; }
.dash-section-title {
  font-family: 'Josefin Sans', sans-serif;
  font-size: 9px;
  font-weight: 200;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 12px;
}

/* Dashboard list items (compact, no table) */
.dash-list { display: flex; flex-direction: column; }
.dash-list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid #f0ece4;
  gap: 12px;
}
.dash-list-item:last-child { border-bottom: none; }
.dash-list-main { flex: 1; min-width: 0; }
.dash-list-title { font-size: 13px; color: var(--encre); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash-list-sub { color: var(--muted); font-weight: 300; }
.dash-list-meta { font-size: 11px; color: var(--muted); margin-top: 2px; }
.dash-list-right { text-align: right; flex-shrink: 0; }
.dash-list-amount { font-size: 13px; font-weight: 500; color: var(--encre); margin-bottom: 2px; }

.card-footer {
  border-top: 1px solid #f0ece4;
  padding: 10px 0 0;
  margin-top: 8px;
  text-align: center;
}
.card-footer-link {
  font-size: 11px;
  color: var(--bronze);
  text-decoration: none;
  letter-spacing: 0.04em;
}
.card-footer-link:hover { color: var(--or); }

/* ── ENHANCED CARDS ── */
.card {
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

/* ── KPI CARD ── */
.kpi-grid { display: grid; gap: 16px; margin-bottom: 28px; }
.kpi-grid-4 { grid-template-columns: repeat(4, 1fr); }
.kpi-grid-3 { grid-template-columns: repeat(3, 1fr); }

.kpi-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 22px 20px;
  text-align: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.kpi-value {
  font-family: 'DM Sans', sans-serif;
  font-size: 26px;
  font-weight: 500;
  line-height: 1.2;
}

.kpi-label {
  font-family: 'Josefin Sans', sans-serif;
  font-size: 9px;
  font-weight: 300;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 6px;
}

/* ── TABLE IMPROVEMENTS ── */
table.data-table tr:nth-child(even) td { background: #fdfcfa; }
table.data-table tr:hover td { background: #f5f2ec; }

table.data-table td { padding: 13px 14px; }

/* ── ACTION CELL ── */
.actions-cell {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
}

.actions-cell .btn { white-space: nowrap; }

/* ── ACTION DROPDOWNS ── */
.action-dropdown {
  position: relative;
}
.action-dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  z-index: 50;
  min-width: 140px;
  margin-top: 4px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,.1);
  padding: 4px 0;
}
.action-dropdown-menu button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 14px;
  font-size: 13px;
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
}
.action-dropdown-menu button:hover:not(:disabled) {
  background: var(--bronze);
  color: #fff !important;
}
.action-dropdown-green { color: var(--green) !important; }
.action-dropdown-danger { color: var(--red) !important; }
.action-dropdown-active {
  font-weight: 600;
  background: var(--bg-alt) !important;
  cursor: default;
  opacity: .5;
}

/* ── DETAIL GRID ── */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 24px;
}

.info-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 18px;
  font-size: 13px;
}

.info-grid .label { color: var(--muted); font-size: 12px; }
.info-grid .value { font-weight: 400; }

/* ── FILTER BAR ── */
.filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}

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

.search-input {
  max-width: 260px;
  width: 100%;
}

/* ── TOPBAR IMPROVEMENTS ── */
.topbar { min-height: 60px; }

/* ── MODAL OVERLAY ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(8,7,5,0.5);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(2px);
}

.modal-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 4px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.15);
  width: 520px;
  max-width: 95vw;
  max-height: 90vh;
  overflow-y: auto;
  padding: 32px;
}

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

.modal-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 20px;
  font-weight: 300;
  color: var(--encre);
}

.modal-close {
  background: none;
  border: none;
  font-size: 18px;
  color: var(--muted);
  cursor: pointer;
  padding: 4px 8px;
  transition: color 0.15s;
}
.modal-close:hover { color: var(--charcoal); }

/* ── CONFIRM MODAL ── */
.confirm-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 4px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.15);
  width: 380px;
  padding: 32px;
  text-align: center;
  animation: confirmIn 0.15s ease-out;
}
@keyframes confirmIn {
  from { opacity: 0; transform: scale(0.95) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.confirm-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 20px;
  font-weight: 400;
  color: var(--encre);
  margin-bottom: 10px;
}
.confirm-message {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
  margin-bottom: 28px;
}
.confirm-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}
.confirm-actions .btn { min-width: 110px; }
.btn-danger {
  background: var(--red);
  color: #fff;
  border-color: var(--red);
}
.btn-danger:hover {
  background: #a93226;
  border-color: #a93226;
}

/* ── EMPTY STATE IMPROVEMENTS ── */
.empty-state {
  padding: 52px 20px;
}

.empty-state-icon {
  font-size: 32px;
  margin-bottom: 10px;
  opacity: 0.5;
}

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

/* ── SECTION CARD SPACING ── */
.content > .card + .card,
.content > .card + .section-title { margin-top: 20px; }

/* ── STATUS COLORS ON KPIs ── */
.text-encre { color: var(--encre); }
.text-green { color: var(--green); }
.text-red { color: var(--red); }
.text-bronze { color: var(--bronze); }

/* ── PIPELINE BOARD ── */
.pipeline-board {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 12px;
}
.pipeline-column {
  min-width: 160px;
  flex: 1;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
}
.pipeline-column-header {
  padding: 10px 12px;
  font-family: 'Josefin Sans', sans-serif;
  font-size: 10px;
  font-weight: 300;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--cream);
}
.pipeline-count {
  background: var(--encre);
  color: #fff;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-family: 'DM Sans', sans-serif;
}
.pipeline-cards { padding: 8px; display: flex; flex-direction: column; gap: 8px; min-height: 60px; }
.pipeline-card {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: #fff;
  cursor: pointer;
  transition: box-shadow 0.15s;
}
.pipeline-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.08); }
.pipeline-card-name { font-size: 13px; font-weight: 500; color: var(--encre); }
.pipeline-card-detail { font-size: 11px; color: var(--muted); margin-top: 2px; }
.pipeline-card-value { font-size: 12px; font-weight: 500; color: var(--bronze); margin-top: 4px; }
.pipeline-empty { text-align: center; color: var(--border); font-size: 18px; padding: 12px; }

/* ── FUNNEL BAR (dashboard) ── */
.funnel-bar {
  display: flex;
  gap: 2px;
}
.funnel-stage {
  flex: 1;
  padding: 12px 10px;
  text-align: center;
  background: var(--cream);
  border-radius: 2px;
}
.funnel-count { font-size: 20px; font-weight: 500; color: var(--encre); }
.funnel-label { font-size: 9px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); margin-top: 2px; }

/* ── CONTACT DETAIL ── */
.contact-grid {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 20px;
  align-items: start;
}
@media (max-width: 900px) {
  .contact-grid { grid-template-columns: 1fr; }
}
.info-grid { display: flex; flex-direction: column; gap: 0; }
.info-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 8px 0;
  border-bottom: 1px solid #f0ece4;
}
.info-row:last-child { border-bottom: none; }
.info-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  flex-shrink: 0;
}
.info-value { font-size: 13px; color: var(--encre); text-align: right; }
.pipeline-badge {
  display: inline-block;
  padding: 2px 8px 2px 10px;
  font-size: 11px;
  font-weight: 400;
}
.contact-notes { font-size: 13px; color: var(--charcoal); line-height: 1.6; white-space: pre-wrap; }

/* ── TIMELINE ── */
.timeline { display: flex; flex-direction: column; gap: 0; }
.timeline-item {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid #f0ece4;
}
.timeline-item:last-child { border-bottom: none; }
.timeline-icon { font-size: 16px; flex-shrink: 0; margin-top: 2px; }
.timeline-body { flex: 1; min-width: 0; }
.timeline-title { font-size: 13px; font-weight: 500; color: var(--encre); }
.timeline-desc { font-size: 12px; color: var(--muted); margin-top: 3px; line-height: 1.5; }
.timeline-outcome { font-size: 12px; color: var(--bronze); margin-top: 3px; font-style: italic; }
.timeline-date { font-size: 10px; color: var(--muted); margin-top: 4px; }

/* ── TASKS ── */
.task-list { display: flex; flex-direction: column; gap: 0; }
.task-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid #f0ece4;
}
.task-item:last-child { border-bottom: none; }
.task-check {
  background: none;
  border: none;
  font-size: 16px;
  cursor: pointer;
  color: var(--muted);
  padding: 0;
  margin-top: 1px;
  transition: color 0.15s;
}
.task-check:hover { color: var(--green); }
.task-content { flex: 1; min-width: 0; }
.task-title { font-size: 13px; color: var(--encre); }
.task-meta { font-size: 11px; color: var(--muted); margin-top: 2px; }
.task-completed .task-title { text-decoration: line-through; color: var(--muted); }
.task-overdue .task-meta { color: var(--red); }
.task-priority { font-size: 12px; font-weight: 600; flex-shrink: 0; }
.priority-high { color: var(--red); }
.priority-low { color: var(--muted); }

/* ── RECENT CLIENTS ── */
.recent-clients-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.recent-client-chip {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--cream);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.recent-client-chip:hover {
  border-color: var(--bronze);
  background: #fff;
}
.recent-client-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--encre);
}
.recent-client-detail {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

/* ── LABOR PRESETS ── */
.labor-presets {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

/* ── CATALOG RESULTS SCROLL ── */
.catalog-results-scroll {
  max-height: 320px;
  overflow-y: auto;
}

/* ── WIZARD STEP CLICKABLE ── */
.wizard-step.done:hover .step-num {
  transform: scale(1.1);
  transition: transform 0.15s;
}

/* ── TOASTS ── */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 4px 16px rgba(0,0,0,.15);
  pointer-events: auto;
  max-width: 400px;
}
.toast-error { background: #c0392b; color: #fff; }
.toast-success { background: #27ae60; color: #fff; }
.toast-info { background: var(--encre); color: #fff; }

/* ── HAMBURGER BUTTON ── */
.hamburger-btn {
  display: none;
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 1001;
  width: 40px;
  height: 40px;
  background: var(--encre);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.hamburger-btn span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--or);
  border-radius: 1px;
  transition: all 0.2s;
}

/* ── SIDEBAR OVERLAY ── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(8,7,5,0.5);
  z-index: 999;
  backdrop-filter: blur(2px);
}

/* ── TOPBAR HELPERS ── */
.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.topbar-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}
.topbar-search {
  width: 200px;
  margin: 0;
}
.contact-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.success-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* ── RESPONSIVE VISIBILITY ── */
.show-mobile { display: none !important; }

/* ── TABLET ≤1024px ── */
@media (max-width: 1024px) {
  /* Sidebar hidden, hamburger visible */
  .sidebar {
    position: fixed;
    left: -260px;
    z-index: 1000;
    transition: left 0.3s ease;
  }
  .sidebar.open { left: 0; }
  .sidebar-overlay { display: block; }
  .hamburger-btn { display: flex; }
  .main { margin-left: 0; }

  /* Topbar: add left padding for hamburger */
  .topbar { padding: 14px 20px 14px 64px; }

  /* Content padding */
  .content { padding: 24px 20px; }

  /* Table columns */
  .hide-tablet { display: none !important; }

  /* KPI grids */
  .kpi-grid-4 { grid-template-columns: repeat(2, 1fr); }
  .kpi-grid-3 { grid-template-columns: repeat(3, 1fr); }

  /* Contact grid */
  .contact-grid { grid-template-columns: 1fr; }

  /* Topbar search */
  .topbar-search { width: 160px; }

  /* Pipeline board scroll */
  .pipeline-column { min-width: 140px; }

  /* Touch targets */
  .btn-sm { padding: 9px 14px; }
  .btn-ghost { padding: 9px 12px; }
  .page-btn { min-width: 36px; height: 36px; }
  .modal-close { padding: 8px 12px; font-size: 20px; }
  .action-dropdown-menu button { padding: 11px 14px; }
  .nav-item { padding: 14px 24px; }
  .pipeline-card { padding: 14px 16px; }
  .task-check { font-size: 20px; padding: 4px; }

  /* Wizard steps compact */
  .wizard-steps { gap: 0; }
  .step-divider { min-width: 12px; }
}

/* ── MOBILE ≤768px ── */
@media (max-width: 768px) {
  .topbar { padding: 12px 16px 12px 60px; flex-wrap: wrap; gap: 8px; }
  .content { padding: 20px 16px; }

  /* Table columns */
  .hide-mobile { display: none !important; }
  .show-mobile { display: inline !important; }

  /* Form grids */
  .form-row-2, .form-row-3, .form-row-4 { grid-template-columns: 1fr; }

  /* Detail grid */
  .detail-grid { grid-template-columns: 1fr; }

  /* Filter bar */
  .filter-bar { flex-direction: column; align-items: stretch; gap: 8px; }
  .filter-pills { overflow-x: auto; -webkit-overflow-scrolling: touch; flex-wrap: nowrap; padding-bottom: 4px; }
  .filter-pills::-webkit-scrollbar { height: 0; }
  .search-input { max-width: 100%; }

  /* Pipeline board vertical */
  .pipeline-board { flex-direction: column; gap: 12px; }
  .pipeline-column { min-width: 100%; }

  /* Funnel bar */
  .funnel-bar { flex-wrap: wrap; }
  .funnel-stage { flex: 0 0 calc(33.33% - 2px); }

  /* Wizard steps: hide labels */
  .wizard-step span:not(.step-num) { display: none; }
  .step-num { width: 28px; height: 28px; font-size: 12px; }
  .step-divider { min-width: 16px; }

  /* Modal */
  .modal-card { width: 95vw; max-width: 95vw; padding: 24px; }
  .confirm-card { width: 90vw; padding: 24px; }

  /* Contact actions */
  .contact-actions { gap: 6px; }
  .topbar-contact { flex-wrap: wrap; }

  /* Topbar search */
  .topbar-search { width: 100%; min-width: 0; }
  .topbar-actions { flex-wrap: wrap; width: 100%; }

  /* Page title */
  .page-title { font-size: 22px; }

  /* Success actions stack */
  .success-actions { flex-direction: column; align-items: stretch; }
  .success-actions .btn { text-align: center; }

  /* Cards */
  .card { padding: 18px; }

  /* Toast full width */
  .toast-container { right: 12px; left: 12px; }
  .toast { max-width: 100%; }

  /* Dashboard split */
  .dash-split { grid-template-columns: 1fr; }

  /* Actions cell: wrap */
  .actions-cell { flex-wrap: wrap; gap: 4px; }

  /* Catalog category pills scroll */
  .labor-presets { overflow-x: auto; -webkit-overflow-scrolling: touch; flex-wrap: nowrap; }
}

/* ── SMALL MOBILE ≤480px ── */
@media (max-width: 480px) {
  .topbar { padding: 10px 12px 10px 56px; }
  .content { padding: 16px 12px; }

  .page-title { font-size: 18px; }

  .kpi-grid-3 { grid-template-columns: repeat(2, 1fr); }

  .card { padding: 14px; }
  .modal-card { padding: 18px; }

  .funnel-stage { flex: 0 0 calc(50% - 2px); }
  .funnel-count { font-size: 18px; }
  .funnel-label { font-size: 10px; }

  /* Smaller buttons */
  .btn-lg { padding: 10px 20px; font-size: 13px; }

  /* Table cells tighter */
  table.data-table td { padding: 10px 8px; font-size: 12px; }
  table.data-table th { padding: 8px; font-size: 9px; }

  /* Sidebar footer hide */
  .sidebar-footer { display: none; }

  /* KPI values smaller */
  .kpi-value { font-size: 22px; }
  .kpi-label { font-size: 8px; }
}

