/* ─── Design System (ported from Mologo Mockups) ────────── */
:root {
  --primary: #1A1A1A;
  --primary-hover: #2e2e2e;
  --primary-active: #050505;
  --primary-pale: #F5F4F1;
  --bg: #F5F4F1;
  --white: #FFFFFF;
  --border: #E6E4DF;
  --border-s: #d9d6cf;
  --text: #1A1A1A;
  --tsec: #6B6B6B;
  --tph: #ABABAB;
  --accent: #1A1A1A;
  --green: #c5f3c4;
  --green-dark: #166534;
  --green-strong: #16a34a;
  --success: #166534;
  --success-bg: #c5f3c4;
  --success-border: #b0e0af;
  --amber: #fde68a;
  --amber-strong: #b45309;
  --warning: #854d0e;
  --warning-bg: #fef9c3;
  --warning-border: #f5d98b;
  --danger: #dc2626;
  --danger-hover: #b91c1c;
  --danger-bg: #fef2f2;
  --danger-border: #fecaca;
  --grey-pill: #ECEAE5;
  --grey-pill-text: #4a4a4a;
  --orange: #fe822c;

  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --shadow: rgba(0,0,0,0.06);
}

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

html, body {
  height: 100%;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.hidden { display: none !important; }

.material-symbols-outlined {
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 20;
  font-size: 18px;
  line-height: 1;
  vertical-align: middle;
  text-align: center;
}

/* ─── App Shell ─────────────────────────────────────────── */
.app-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
  position: relative;
}

/* ─── Sidebar ───────────────────────────────────────────── */
.sidebar {
  width: 240px;
  min-width: 240px;
  height: 100vh;
  background: var(--white);
  border-right: 1px solid var(--border);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  z-index: 100;
}

.sidebar-logo {
  font-weight: 700;
  font-size: 22px;
  letter-spacing: -0.02em;
  padding: 0 8px 24px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar-nav {
  flex: 1;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  cursor: pointer;
  color: var(--tsec);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  transition: background 0.12s ease, color 0.12s ease;
  user-select: none;
}

.nav-item .material-symbols-outlined { font-size: 16px; }
.nav-item:hover { background: var(--bg); color: var(--text); }
.nav-item:active { background: #ebe9e3; }
.nav-item.active { background: var(--bg); color: var(--text); font-weight: 600; }
.nav-item.active .material-symbols-outlined { color: var(--text); }

.sidebar-user {
  border-top: 1px solid var(--border);
  margin-top: 8px;
  margin-left: -16px;
  margin-right: -16px;
  padding: 32px 16px 8px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: background 0.12s ease;
}
.sidebar-user:hover { background: none; }
#sidebar-avatar { background: #c5f3c4; }
.sidebar-user .icon-btn { align-self: center; flex-shrink: 0; }

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: var(--green);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11.5px;
  font-weight: 600;
  flex-shrink: 0;
}

.avatar-lg {
  width: 44px;
  height: 44px;
  font-size: 17px;
  font-weight: 700;
  flex-shrink: 0;
}

.user-info { overflow: hidden; min-width: 0; flex: 1; }
.user-name { font-size: 13px; font-weight: 600; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-email { font-size: 11.5px; color: var(--tsec); line-height: 1.2; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ─── Main Content ──────────────────────────────────────── */
.main-content {
  flex: 1;
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.view-panel {
  display: none;
  height: 100%;
  overflow-y: auto;
  padding: 32px 40px;
}
.view-panel.active { display: block; }
#view-compositor.active { display: flex; flex-direction: column; padding: 0; overflow: hidden; }

/* ─── View Headers ──────────────────────────────────────── */
.view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
}
.view-header h1 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.4px;
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--tph);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* ─── Buttons ───────────────────────────────────────────── */
button { font-family: 'Inter', sans-serif; cursor: pointer; border: none; outline: none; }

.btn-primary {
  background: var(--primary);
  color: var(--white);
  border: 1px solid var(--primary);
  border-radius: var(--r-md);
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 500;
  transition: background 0.12s ease, border-color 0.12s ease, transform 0.08s ease;
}
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-primary:active { background: var(--primary-active); transform: translateY(1px); }
.btn-primary:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }

.btn-ghost {
  background: var(--white);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 500;
  transition: background 0.12s ease, border-color 0.12s ease, transform 0.08s ease;
}
.btn-ghost:hover { background: var(--bg); border-color: var(--border-s); }
.btn-ghost:active { background: #ebe9e3; transform: translateY(1px); }

.btn-danger {
  background: var(--danger);
  color: var(--white);
  border: 1px solid var(--danger);
  border-radius: var(--r-md);
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 500;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.btn-danger:hover { background: var(--danger-hover); border-color: var(--danger-hover); }
.btn-danger:active { background: #991b1b; }

.btn-full { width: 100%; }
.btn-sm { padding: 7px 16px; font-size: 13px; }

.btn-danger-outline {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid var(--danger-border);
  border-radius: var(--r-md);
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 500;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}
.btn-danger-outline:hover { background: var(--danger); color: var(--white); border-color: var(--danger); }
.btn-danger-outline:active { background: var(--danger-hover); }

.icon-btn {
  background: var(--white);
  border: 1px solid var(--border);
  padding: 0;
  width: 30px;
  height: 30px;
  border-radius: var(--r-md);
  color: var(--tsec);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}
.icon-btn .material-symbols-outlined { font-size: 14px; }
.icon-btn:hover { background: var(--bg); color: var(--text); border-color: var(--border-s); }
.icon-btn:active { background: #ebe9e3; }
.icon-btn-del:hover { color: #dc2626 !important; background: #fee2e2 !important; border-color: #fecaca !important; }
.icon-btn-del:active { background: #fecaca !important; }

/* ─── Form Elements ─────────────────────────────────────── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.form-group label {
  font-size: 12px;
  font-weight: 500;
  color: var(--tsec);
}
.form-group input,
.form-group select,
.form-group textarea {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 10px 12px;
  font-size: 13.5px;
  font-family: 'Inter', sans-serif;
  color: var(--text);
  transition: border-color 0.15s;
  width: 100%;
  outline: none;
}
.form-group input:hover,
.form-group select:hover,
.form-group textarea:hover { border-color: var(--border-s); }
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
}
.form-group input[readonly] {
  background: var(--bg);
  color: var(--tsec);
}
.form-group input[type="file"] {
  padding: 6px 10px;
}

.search-input {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 8px 12px;
  font-size: 13px;
  font-family: 'Inter', sans-serif;
  color: var(--text);
  min-width: 200px;
  transition: border-color 0.15s;
}
.search-input:hover { border-color: var(--border-s); }
.search-input:focus { outline: none; border-color: var(--primary); }

/* ─── KPI Grid (Dashboard) ──────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
.kpi-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 20px;
}
.kpi-label {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--tsec);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}
.kpi-value {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.kpi-sub {
  font-size: 12px;
  color: var(--tsec);
  margin-top: 4px;
}

/* ─── Table ─────────────────────────────────────────────── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.data-table th {
  text-align: left;
  padding: 12px 16px;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--tsec);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.data-table td {
  padding: 14px 16px;
  font-size: 13.5px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  font-variant-numeric: tabular-nums;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr { transition: background 0.12s ease; }
.data-table tr:hover td { background: var(--bg); }

/* ─── Pills (with status dots) ──────────────────────────── */
.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 500;
  line-height: 1.4;
  white-space: nowrap;
  min-width: 100px;
}
.pill-draft { background: var(--grey-pill); color: var(--grey-pill-text); }
.pill-in-progress { background: var(--amber); color: var(--amber-strong); }
.pill-paid { background: var(--green); color: var(--green-dark); }
.pill-invoice { background: var(--warning-bg); color: var(--warning); }
.pill-quote { background: var(--green); color: var(--green-dark); }

/* Status dropdown */
.status-wrapper { position: relative; display: inline-block; }
.status-dropdown {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: 0 4px 16px var(--shadow);
  min-width: 140px;
  padding: 4px;
}
.status-dropdown button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 12px;
  font-size: 13px;
  background: none;
  border-radius: var(--r-sm);
  color: var(--text);
  transition: background 0.1s;
}
.status-dropdown button:hover { background: var(--bg); }

/* ─── Overlays ──────────────────────────────────────────── */
.overlay-fullscreen {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
}

.overlay-card {
  background: var(--white);
  border-radius: var(--r-lg);
  padding: 40px;
  max-width: 520px;
  width: 90%;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}
.overlay-card h2 { font-size: 22px; font-weight: 700; margin-bottom: 24px; letter-spacing: -0.3px; }

.overlay-logo {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--text);
  letter-spacing: -0.02em;
}

/* Language */
.lang-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
}
.lang-buttons button {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 12px 20px;
  font-size: 15px;
  font-weight: 500;
  transition: background 0.15s, border-color 0.15s;
}
.lang-buttons button:hover { background: var(--border); border-color: var(--border-s); }

/* Auth */
.auth-card {
  background: var(--white);
  border-radius: var(--r-lg);
  padding: 40px;
  max-width: 400px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}
.auth-logo { font-size: 22px; font-weight: 700; margin-bottom: 24px; letter-spacing: -0.02em; }
.auth-card h2 { font-size: 20px; font-weight: 700; margin-bottom: 20px; letter-spacing: -0.3px; }
.auth-card .form-group { margin-bottom: 14px; }
.auth-error {
  background: var(--danger-bg);
  border: 1px solid var(--danger-border);
  color: var(--danger);
  padding: 8px 12px;
  border-radius: var(--r-sm);
  font-size: 13px;
  margin-bottom: 12px;
}
.auth-toggle { text-align: center; margin-top: 16px; font-size: 13px; color: var(--tsec); }
.auth-toggle a { color: var(--text); text-decoration: underline; font-weight: 500; }
.auth-skip { text-align: center; margin-top: 8px; font-size: 12px; color: var(--tsec); }
.auth-skip a { color: var(--tsec); text-decoration: underline; }

/* Onboarding */
.onboarding-card { max-width: 600px; text-align: left; }
.onboarding-check {
  width: 44px;
  height: 44px;
  background: var(--success-bg);
  color: var(--success);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  margin: 0 auto 12px;
}
.onboarding-card h2 { text-align: center; }
.email-pill {
  display: block;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 14px;
  font-size: 12.5px;
  color: var(--tsec);
  margin: 0 auto 20px;
  text-align: center;
  width: fit-content;
}
.onboarding-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 20px;
}
.span-2 { grid-column: span 2; }
.onboarding-actions { display: flex; gap: 12px; }
.onboarding-actions .btn-primary { flex: 1; }
.logo-preview-sm { max-height: 40px; margin-top: 8px; border-radius: 0; }

/* Welcome */
.welcome-card { text-align: center; }
.welcome-card h2 { margin-bottom: 8px; }
.welcome-card p { color: var(--tsec); margin-bottom: 24px; }
.welcome-card .btn-primary { margin-bottom: 10px; min-width: 180px; }
.welcome-icon { font-size: 40px; margin-bottom: 16px; }

/* Confirm */
.confirm-card {
  background: var(--white);
  border-radius: var(--r-lg);
  padding: 32px;
  max-width: 380px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}
.confirm-card h3 { font-size: 17px; font-weight: 700; margin-bottom: 10px; letter-spacing: -0.2px; }
.confirm-card p { font-size: 14px; color: var(--tsec); margin-bottom: 24px; }
.confirm-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* ─── Side Panels ───────────────────────────────────────── */
.side-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 340px;
  height: 100vh;
  background: var(--white);
  border-left: 1px solid var(--border);
  box-shadow: -4px 0 20px var(--shadow);
  z-index: 500;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.22s ease;
}
.side-panel.open { transform: translateX(0); }

.side-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}
.side-panel-header h3 { font-size: 15px; font-weight: 700; letter-spacing: -0.2px; }

.side-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.open-list { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.open-item {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.open-item:hover { background: var(--bg); border-color: var(--border-s); }
.open-item-name { font-size: 13.5px; font-weight: 600; }
.open-item-meta { font-size: 12px; color: var(--tsec); margin-top: 2px; }

/* ─── Profile Modal ─────────────────────────────────────── */
.profile-modal {
  background: var(--white);
  border-radius: var(--r-lg);
  width: 558px;
  max-width: 90vw;
  box-shadow: 0 20px 60px rgba(0,0,0,0.15);
  overflow: hidden;
}
.profile-modal-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
}
.profile-modal-info { flex: 1; min-width: 0; }
.profile-modal-name { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.profile-modal-email { font-size: 12px; color: var(--tsec); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.profile-modal-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.profile-modal-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* ─── Language Picker (settings) ────────────────────────── */
.lang-picker-row {
  display: flex;
  gap: 10px;
}
.lang-pick-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 10px;
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  transition: border-color 0.12s, background 0.12s;
}
.lang-pick-btn:hover { background: var(--bg); border-color: var(--border-s); }
.lang-pick-btn.active { border-color: var(--primary); background: var(--white); }
.lang-pick-flag { font-size: 24px; line-height: 1; }

/* ─── Settings Logo Upload ───────────────────────────────── */
.logo-upload-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.logo-upload-help {
  font-size: 11.5px;
  color: var(--tph);
  margin-top: 4px;
}

/* ─── Tax Inline Row ─────────────────────────────────────── */
.tax-inline-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.tax-inline-row input {
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 10px 12px;
  font-size: 13.5px;
  font-family: 'Inter', sans-serif;
  color: var(--text);
  background: var(--white);
  outline: none;
  transition: border-color 0.15s;
}
.tax-inline-row input:focus { border-color: var(--primary); }
.tax-inline-pct { font-size: 13px; color: var(--tsec); flex-shrink: 0; }

/* ─── Toast ─────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--primary);
  color: var(--white);
  padding: 10px 20px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 500;
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.22s;
  pointer-events: none;
  white-space: nowrap;
}
.toast.show { opacity: 1; }

/* ─── AI Change Bubble ──────────────────────────────────── */
.ai-change-bubble {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface) !important;
  border: 1px solid var(--border) !important;
  border-radius: 8px !important;
  padding: 8px 12px !important;
  font-size: 12.5px;
}
.ai-change-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--primary);
  flex-shrink: 0;
}
.ai-change-text { color: var(--tsec); flex: 1; }
.ai-restore-btn {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
  white-space: nowrap;
}
.ai-restore-btn:hover { opacity: 0.75; }
.ai-restore-btn:disabled { color: var(--tsec); text-decoration: none; cursor: default; }

/* ─── Empty State ───────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--tsec);
}
.empty-state-icon { font-size: 40px; margin-bottom: 12px; }
.empty-state h3 { font-size: 16px; font-weight: 600; margin-bottom: 8px; color: var(--text); }
.empty-state p { font-size: 13.5px; margin-bottom: 20px; }

/* ─── Dashboard recent table ────────────────────────────── */
.recent-table-wrap {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
}

/* ─── Client form ───────────────────────────────────────── */
.client-form {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 20px;
  margin-bottom: 20px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.client-form-actions {
  grid-column: span 2;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* ─── AI Panel ──────────────────────────────────────────── */
.ai-panel {
  width: 340px;
  min-width: 340px;
  max-width: 480px;
  height: 100vh;
  background: var(--white);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  transition: width 0.22s ease;
  overflow: hidden;
  flex-shrink: 0;
  position: relative;
}
.ai-panel.collapsed { width: 0; min-width: 0; border-left: none; }

.ai-panel-inner {
  width: 100%;
  min-width: unset;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.ai-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.ai-header-left { display: flex; align-items: center; gap: 8px; }
.ai-title { font-size: 13.5px; font-weight: 600; }
.ai-dot {
  width: 8px;
  height: 8px;
  background: #22c55e;
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(34,197,94,0.5);
  animation: pulse-dot 2s infinite;
  flex-shrink: 0;
}
@keyframes pulse-dot {
  0%, 100% { box-shadow: 0 0 0 0 rgba(34,197,94,0.5); }
  50% { box-shadow: 0 0 0 6px rgba(34,197,94,0); }
}

.ai-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.ai-bubble {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--r-md);
  font-size: 13px;
  line-height: 1.45;
  white-space: pre-wrap;
}
.ai-bubble.assistant {
  background: var(--bg);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}
.ai-bubble.user {
  background: var(--primary);
  color: var(--white);
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}
.ai-thinking {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 10px 13px;
  background: var(--bg);
  border-radius: var(--r-md);
  align-self: flex-start;
}
.ai-thinking span {
  width: 6px;
  height: 6px;
  background: var(--tsec);
  border-radius: 50%;
  animation: thinking 1.2s infinite;
}
.ai-thinking span:nth-child(2) { animation-delay: 0.2s; }
.ai-thinking span:nth-child(3) { animation-delay: 0.4s; }
@keyframes thinking {
  0%, 100% { opacity: 0.3; transform: translateY(0); }
  50% { opacity: 1; transform: translateY(-3px); }
}

.ai-quick-buttons {
  padding: 10px 14px 6px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  border-top: 1px solid var(--border);
}
.ai-quick-buttons button {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  transition: background 0.12s ease, border-color 0.12s ease, transform 0.08s ease;
  cursor: pointer;
}
.ai-quick-buttons button:hover { background: var(--white); border-color: var(--border-s); }
.ai-quick-buttons button:active { transform: translateY(1px); background: var(--bg); }

.ai-input-row {
  display: flex;
  flex-direction: column;
  margin: 8px 14px 24px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--bg);
  overflow: hidden;
  transition: border-color 0.15s;
}
.ai-input-row:focus-within { border-color: var(--primary); }
.ai-input-row textarea {
  flex: 1;
  background: transparent;
  border: none;
  padding: 12px 12px 8px;
  font-size: 13px;
  font-family: 'Inter', sans-serif;
  color: var(--text);
  resize: none;
  min-height: 80px;
  max-height: 200px;
  overflow-y: auto;
  outline: none;
}
.ai-input-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px;
  border-top: 1px solid var(--border);
}

.ai-send-btn {
  background: var(--primary);
  color: var(--white);
  border: none;
  border-radius: var(--r-md);
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.12s ease, transform 0.08s ease;
  cursor: pointer;
}
.ai-send-btn:hover { background: var(--primary-hover); }
.ai-send-btn:active { background: var(--primary-active); transform: translateY(1px); }
.ai-send-btn .material-symbols-outlined { font-size: 16px; }

/* AI Toggle (absolute on ai-panel left edge, vertically centered) */
.ai-toggle {
  position: absolute;
  left: -20px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 56px;
  background: var(--primary);
  color: var(--white);
  border-radius: 8px 0 0 8px;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 600;
  user-select: none;
  touch-action: none;
  transition: background 0.12s ease;
  padding: 0;
}
.ai-toggle .material-symbols-outlined { font-size: 16px; }
.ai-toggle:hover { background: var(--primary-hover); }
.ai-toggle:active { background: var(--primary-active); }

/* AI resize handle — full-height left border, highlights on hover */
.ai-resize-handle {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 6px;
  z-index: 20;
  cursor: col-resize;
}
.ai-resize-handle::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: transparent;
  transition: background 0.15s;
}
.ai-resize-handle:hover::before { background: var(--border-s); }
.ai-resize-label { display: none; }

/* Profile email readonly override */
#profile-email[readonly] { background: var(--white); color: var(--text); }

/* ─── Mobile Nav ────────────────────────────────────────── */
.mobile-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--white);
  border-top: 1px solid var(--border);
  height: 56px;
  z-index: 400;
  justify-content: space-around;
  align-items: center;
}
.mobile-nav a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  color: var(--tsec);
  cursor: pointer;
}
.mobile-nav a.active { color: var(--text); }

/* ─── Responsive ────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .mobile-nav { display: flex; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .view-panel { padding: 20px 16px 80px; }
  .ai-panel { display: none; }
  .ai-toggle { display: none; }
  .search-input { display: none; }
  #view-compositor.active { zoom: 0.75; }
  #view-projects .recent-table-wrap,
  #view-clients .recent-table-wrap { zoom: 0.82; }
}
@media (max-width: 480px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .onboarding-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: span 1; }
}

/* ─── Scrollbar ─────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-s); border-radius: 999px; }

/* ─── Generic Card ──────────────────────────────────────── */
.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
}

/* ─── Mono Numbers ──────────────────────────────────────── */
.mono-num { font-variant-numeric: tabular-nums; }

/* ─── Segmented Control ─────────────────────────────────── */
.seg {
  display: grid;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 3px;
  gap: 2px;
}
.seg button {
  background: transparent;
  border: none;
  padding: 7px 12px;
  border-radius: calc(var(--r-md) - 4px);
  font-size: 13px;
  font-weight: 500;
  color: var(--tsec);
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease, box-shadow 0.12s ease;
  font-family: 'Inter', sans-serif;
}
.seg button.active {
  background: var(--white);
  color: var(--text);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}
.seg button:hover:not(.active) { background: rgba(255,255,255,0.6); color: var(--text); }

/* ─── Logo Dot ──────────────────────────────────────────── */
.logo-dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  background: var(--primary);
  flex-shrink: 0;
  display: inline-block;
}

/* ─── Language Cards ────────────────────────────────────── */
.lang-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.lang-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 22px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
  font-family: 'Inter', sans-serif;
}
.lang-card:hover { background: var(--bg); border-color: var(--border-s); }
.lang-card.selected { border-color: var(--primary); background: var(--bg); }
.lang-flag { font-size: 36px; line-height: 1; }
.lang-name { font-weight: 600; font-size: 14px; color: var(--text); }
.lang-sub { font-size: 11.5px; color: var(--tsec); }

/* ─── Confirm Modal Icon Circle ─────────────────────────── */
.confirm-icon-circle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--danger-bg);
  color: var(--danger);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
}

/* ─── Dashboard Empty State (dashed) ────────────────────── */
.empty-state-dashed {
  padding: 48px 20px;
  text-align: center;
  background: var(--white);
  border: 1.5px dashed var(--border);
  border-radius: var(--r-lg);
}
.empty-state-dashed h3 { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.empty-state-dashed p { font-size: 13px; color: var(--tsec); margin-bottom: 18px; }

/* ─── Pill progress alias ───────────────────────────────── */
.pill-progress { background: var(--amber); color: var(--amber-strong); }

/* ─── Settings 2-col layout ─────────────────────────────── */
.settings-section-v2 {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 24px;
  margin-bottom: 16px;
}
.settings-sec-grid {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 32px;
  align-items: start;
}
.settings-sec-title { font-size: 14px; font-weight: 600; margin: 0 0 4px; }
.settings-sec-desc { font-size: 12.5px; color: var(--tsec); line-height: 1.55; }
.settings-sec-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.settings-sec-fields .span-full { grid-column: 1 / -1; }
@media (max-width: 700px) {
  .settings-sec-grid { grid-template-columns: 1fr; gap: 16px; }
  .settings-sec-fields { grid-template-columns: 1fr; }
  .settings-sec-fields .span-full { grid-column: span 1; }
}

/* ─── Dashboard header ──────────────────────────────────── */
.dash-header { margin-bottom: 24px; }
.dash-greeting { font-size: 24px; font-weight: 600; letter-spacing: -0.02em; margin: 0 0 4px; }
.dash-subtitle { font-size: 13px; color: var(--tsec); }
.dash-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.dash-section-header h2 { font-size: 15px; font-weight: 600; margin: 0; letter-spacing: -0.01em; }
.dash-view-all { font-size: 12.5px; color: var(--tsec); text-decoration: none; font-weight: 500; }
.dash-view-all:hover { color: var(--text); }
