/* ─── Design System (ported from Mologo Mockups) ────────── */
:root {
  --primary: #1A1A1A;
  --primary-hover: #2e2e2e;
  --primary-active: #050505;
  --primary-pale: #f0f0f0;
  --bg: #f4f4f4;
  --white: #FFFFFF;
  --border: #e2e2e2;
  --border-s: #d4d4d4;
  --text: #1A1A1A;
  --tsec: #6B6B6B;
  --tph: #ABABAB;
  --accent: #1A1A1A;
  /* ── Greens — the only greens to use ──
     Pills:        bg var(--green)            · text var(--green-dark)
     Announcement: bg var(--green-announce-bg) · border var(--green-announce-border) */
  --green: #c5f3c4;
  --green-dark: #166534;
  --green-announce-bg: #f0fdf4;
  --green-announce-border: #4fde8a;
  /* Legacy aliases → mapped onto the canonical greens above */
  --green-strong: var(--green-dark);
  --success: var(--green-dark);
  --success-bg: var(--green);
  --success-border: var(--green-announce-border);
  --amber: #fde68a;
  --amber-strong: #b45309;
  --amber-bg: #fef2c9; /* pale amber — light generic yellow background */
  --warning: #854d0e;
  --warning-bg: #ffeca7;
  --warning-border: #f5d98b;
  --danger: #dc2626;
  --danger-hover: #b91c1c;
  --danger-bg: #fef2f2;
  --danger-border: #fecaca;
  --grey-pill: #e8e8e8;
  --grey-pill-text: #4a4a4a;
  --orange: #fe822c;
  --lav: #ece6ff;
  --lav-2: #c4b5f5;
  --lav-d: #4b3a8c;
  --blue-bg: #dbeafe;
  --blue-d: #1e40af;

  --ink-wash: color-mix(in srgb, var(--text) 8%, var(--white));

  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-btn: 999px;
  --shadow: rgba(0,0,0,0.06);
  --ai-panel-w: 340px;
}

*, *::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' 300, 'GRAD' 200, 'opsz' 48;
  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: #111111;
  border-right: none;
  padding: 24px 0;
  display: flex;
  flex-direction: column;
  z-index: 100;
}

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

.sidebar-nav-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.sidebar-nav {
  padding: 0 16px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  cursor: pointer;
  color: rgba(255,255,255,0.5);
  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: rgba(255,255,255,0.07); color: #ffffff; }
.nav-item:active { background: rgba(255,255,255,0.12); }
.nav-item.active { background: rgba(255,255,255,0.1); color: #ffffff; font-weight: 600; }
.nav-item.active .material-symbols-outlined { color: #ffffff; }
.nav-separator {
  border-top: 1px solid rgba(255,255,255,0.1);
  margin: 8px 0;
}

.sidebar-user {
  border-top: 1px solid rgba(255,255,255,0.1);
  margin-top: 8px;
  padding: 32px 16px 8px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: background 0.12s ease, opacity 0.22s ease;
}
.sidebar-user:hover { background: none; }
#sidebar-avatar { background: #c5f3c4; }
.sidebar-user .icon-btn { align-self: center; flex-shrink: 0; margin-left: auto; background: #111111; color: rgba(255,255,255,0.5); border-color: rgba(255,255,255,0.15); }

.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; color: rgba(255,255,255,0.5); }
.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;
  position: relative;
  z-index: 1;
}

.view-panel {
  display: none;
  height: 100%;
  flex-direction: column;
  overflow: hidden;
}
.view-panel.active { display: flex; }
#view-compositor.active { overflow: hidden; }

.view-body {
  flex: 1;
  overflow-y: auto;
  padding: 32px 40px;
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
  transition: scrollbar-color 0.3s;
}
.view-body:hover,
.view-body.is-scrolling {
  scrollbar-color: var(--border-s) transparent;
}
.view-body::-webkit-scrollbar { width: 5px; }
.view-body::-webkit-scrollbar-track { background: transparent; }
.view-body::-webkit-scrollbar-thumb {
  background: transparent;
  border-radius: 999px;
  transition: background 0.3s;
}
.view-body:hover::-webkit-scrollbar-thumb,
.view-body.is-scrolling::-webkit-scrollbar-thumb {
  background: var(--border-s);
}

/* ─── View Headers ──────────────────────────────────────── */
.view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  padding: 24px 40px 24px;
  background: var(--bg);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s;
}
.view-header.is-scrolled {
  border-bottom-color: var(--border);
}
.dash-top-bar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 40px 24px;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s;
}
.dash-top-bar.is-scrolled {
  border-bottom-color: var(--border);
}
/* ─── Projects table meta bar ───────────────────────────── */
.projects-table-meta {
  display: flex;
  align-items: center;
  margin-bottom: 8px;
}
.projects-table-count {
  font-size: 12.5px;
  color: var(--tsec);
}
.ref-toggle-link {
  font-size: 12.5px;
  color: var(--tsec);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  font-family: inherit;
  transition: color 0.15s;
}
.ref-toggle-link:hover { color: var(--text); }
.ref-toggle-link.active { color: var(--primary); }

/* ─── Table footer / scroll controls ────────────────────── */
.table-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 2px 2px;
}
.table-range {
  font-size: 12.5px;
  color: var(--tsec);
  min-width: 60px;
  text-align: center;
}
.scroll-btn {
  width: 30px; height: 30px;
  border-radius: 50%;
  border: none;
  background: #1a1a1a;
  color: #fff;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.12s, opacity 0.12s;
  flex-shrink: 0;
}
.scroll-btn .material-symbols-outlined { font-size: 16px; }
.scroll-btn:hover:not(:disabled) { background: #333; }
.scroll-btn:disabled { opacity: 0.25; cursor: default; }
.view-header h1 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.4px;
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ─── Projects filter bar ───────────────────────────────── */
.projects-filter-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 40px;
  border-bottom: 1px solid transparent;
  flex-shrink: 0;
  flex-wrap: wrap;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-height 0.25s ease, opacity 0.2s ease, padding 0.25s ease, border-color 0.25s ease;
}
.projects-filter-bar.is-open {
  max-height: 120px;
  opacity: 1;
  padding: 10px 40px;
  border-bottom-color: var(--border);
}
.view-header.filter-bar-open { border-bottom-color: var(--border); }

/* Filter toggle button — matches icon-btn style */
.filter-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--tsec);
  position: relative;
}
.filter-toggle-btn .material-symbols-outlined { font-size: 14px; }
.filter-toggle-btn.active { color: var(--text); }

.filter-group {
  display: flex;
  align-items: center;
  gap: 4px;
}
.filter-sep {
  width: 1px;
  height: 18px;
  background: var(--border);
  margin: 0 4px;
}
.filter-pill {
  padding: 6px 16px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: transparent;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--tsec);
  cursor: pointer;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
  white-space: nowrap;
}
.filter-pill:hover { background: #ffffff; color: var(--tsec); }
.filter-pill.active {
  background: #ffffff;
  border-color: var(--border);
  color: #6b6b6b;
}
.sort-th {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.sort-th:hover { color: var(--text); }
.sort-arrow {
  font-size: 12px;
  color: var(--tsec);
  margin-left: 1px;
  vertical-align: middle;
  line-height: 1;
  position: relative;
  top: -1px;
}

.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-btn);
  padding: 8px 16px;
  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; }

/* ─── Hover menu ────────────────────────────────────────── */
.hover-menu { position: relative; display: inline-block; }
.hover-menu-drop {
  position: absolute;
  top: 100%;
  right: 0;
  z-index: 9999;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: 0 4px 20px rgba(0,0,0,0.1);
  min-width: 220px;
  padding: 4px 0;
  display: none;
}
.hover-menu:hover .hover-menu-drop { display: block; }
.hover-menu-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  background: none;
  border: none;
  padding: 8px 14px;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  text-align: left;
  transition: background 0.1s;
}
.hover-menu-item:hover { background: var(--bg); }
.hover-menu-label { font-weight: 500; color: var(--text); }
.hover-menu-desc { color: var(--tsec); font-size: 11px; }
.hover-menu-section { padding: 6px 12px 2px; font-size: 10px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--tsec); }
.hover-menu-sub-wrap { position: relative; }
.hover-menu-sub-wrap > .hover-menu-item { display: flex; flex-direction: row; align-items: center; justify-content: space-between; }
.hover-menu-sub {
  display: none; position: absolute; left: 100%; top: -4px;
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--r-md); box-shadow: 0 4px 20px rgba(0,0,0,0.1);
  min-width: 180px; padding: 4px 0; z-index: 10000;
}
.hover-menu-sub-wrap:hover .hover-menu-sub { display: block; }

.btn-ghost {
  background: var(--white);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--r-btn);
  padding: 8px 16px;
  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-btn);
  padding: 8px 16px;
  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-danger-outline {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid var(--danger-border);
  border-radius: var(--r-btn);
  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; }
.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-sm);
  padding: 8px 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: 999px;
  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;
}
.stat-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.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: #ffffff;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.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); }
.data-table tbody tr.selected td { background: var(--primary-pale); }

/* ─── 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: 80px;
}
.pill-draft    { background: var(--grey-pill);  color: var(--grey-pill-text); }
.pill-sent     { background: #dbeafe;           color: #1e40af; }
.pill-pending  { background: #ffedd5;           color: #c2410c; }
.pill-paid     { background: var(--green);      color: var(--green-dark); }
.pill-connected { background: var(--green); color: var(--green-dark); padding: 8px 16px; }
.pill-unpaid   { background: var(--danger-bg);  color: var(--danger); }
.pill-approved { background: var(--green);      color: var(--green-dark); }
.pill-rejected { background: var(--danger-bg);  color: var(--danger); }
.pill-invoice { background: var(--warning-bg); color: var(--warning); }
.pill-quote { background: var(--lav); color: var(--lav-d); }
.pill-contract { background: var(--blue-bg); color: var(--blue-d); }

/* 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: flex;
  align-items: center;
  justify-content: space-between;
  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;
}
.dd-shortcut { font-size: 11px; color: var(--tsec); margin-left: 16px; flex-shrink: 0; }
.status-dropdown button:hover { background: var(--bg); }
.status-dropdown-submenu-wrap { position: relative; }
.status-dropdown-submenu-wrap > button { display: flex; align-items: center; justify-content: space-between; }
.status-dropdown-submenu {
  position: absolute;
  left: 100%;
  top: -4px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: 0 4px 16px var(--shadow);
  min-width: 200px;
  padding: 4px;
  display: none;
  z-index: 10000;
}
.status-dropdown-submenu-wrap:hover .status-dropdown-submenu { display: block; }
.status-dropdown-submenu button { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; }
.status-dropdown-submenu .submenu-desc { font-size: 11px; color: var(--tsec); font-weight: 400; }

.comp-export-as-toggle {
  display: flex !important;
  align-items: center;
  justify-content: space-between;
}
.comp-export-sub { display: none; }
.comp-export-sub-btn {
  padding-left: 24px !important;
  color: var(--tsec) !important;
  font-size: 12.5px !important;
}
.comp-export-sub-btn:hover { color: var(--text) !important; }

/* ─── 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);
  animation: overlay-in 0.15s ease;
  overflow: hidden;
}

@keyframes overlay-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.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: 6px; 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 { width: 100%; padding: 11px; margin-bottom: 8px; }
.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; }

.timer-setup-services { display: flex; flex-direction: column; gap: 6px; }
.timer-frame-card {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; border-radius: var(--r-sm);
  border: 1.5px solid var(--border);
  background: var(--white); cursor: pointer;
  transition: background 0.1s;
  user-select: none;
}
.timer-frame-card:hover { background: var(--bg); }
.timer-frame-card.timer-frame-selected { border-color: var(--primary); background: var(--white); }
.timer-frame-name { font-size: 14px; font-weight: 500; }
.timer-frame-rate { font-size: 12px; color: var(--tsec); font-variant-numeric: tabular-nums; }


/* ─── 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.38s cubic-bezier(0.4, 0, 0.2, 1);
}
.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: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.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; }
.open-item-pills { display: flex; align-items: center; gap: 5px; margin-top: 5px; }
.timer-setup-selected { border-color: var(--border-s) !important; }

/* ─── 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;
}
.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; display: flex; align-items: center; }

.flag-img {
  width: 24px;
  height: 18px;
  object-fit: cover;
  border-radius: 3px;
  display: inline-block;
  flex-shrink: 0;
  margin-right: 8px;
  vertical-align: middle;
}

/* ─── 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; display: flex; align-items: center; }

.flag-img {
  width: 24px;
  height: 18px;
  object-fit: cover;
  border-radius: 3px;
  display: inline-block;
  flex-shrink: 0;
  margin-right: 8px;
  vertical-align: middle;
}

/* ─── 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 & Rates section ────────────────────────────────── */
.ctax-picker-wrap { display: flex; flex-direction: column; gap: 14px; }
.ctax-empty { font-size: 13px; color: var(--tph); font-style: italic; margin: 4px 0; }
.ctax-group { display: flex; flex-direction: column; gap: 8px; }
.ctax-label { font-size: 11px; font-weight: 600; color: var(--tsec); text-transform: uppercase; letter-spacing: 0.07em; }
.ctax-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.ctax-chip {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 13px;
  font-size: 12px;
  font-weight: 500;
  color: var(--tsec);
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.ctax-chip:hover { background: var(--white); border-color: var(--border-s); color: var(--text); }
.ctax-chip.active { background: var(--primary); border-color: var(--primary); color: var(--white); }
.ss-input-row { display: flex; gap: 8px; align-items: center; }
.ss-input-row input { flex: 1; min-width: 0; width: auto; }
.ss-unit { color: var(--tsec); width: 16px; text-align: center; flex-shrink: 0; font-size: 13px; }
.ss-mode-label { font-size: 13px; color: var(--tsec); white-space: nowrap; flex-shrink: 0; }

/* Custom country dropdown */
.ctax-select { position: relative; }
.ctax-select-trigger { width: 100%; display: flex; align-items: center; justify-content: space-between; background: var(--white); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 8px 12px; font-size: 13px; font-family: 'Inter', sans-serif; color: var(--text); cursor: pointer; text-align: left; transition: border-color 0.15s; }
.ctax-select-trigger:hover { border-color: var(--border-s); }
.ctax-select.open .ctax-select-trigger { border-color: var(--primary); }
.ctax-chevron { font-size: 18px; color: var(--tsec); transition: transform 0.15s; line-height: 1; }
.ctax-select.open .ctax-chevron { transform: rotate(180deg); }
.ctax-select-dropdown { display: none; position: absolute; top: calc(100% + 4px); left: 0; right: 0; background: var(--white); border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: 0 4px 20px rgba(0,0,0,0.1); z-index: 300; overflow: hidden; }
.ctax-select.open .ctax-select-dropdown { display: block; }
.ctax-select-search-wrap { padding: 8px; border-bottom: 1px solid var(--border); }
.ctax-select-search { width: 100%; border: 1px solid var(--border); border-radius: var(--r-sm); padding: 6px 10px; font-size: 13px; font-family: 'Inter', sans-serif; background: var(--bg); color: var(--text); outline: none; }
.ctax-select-search:focus { border-color: var(--primary); }
.ctax-select-options { max-height: 240px; overflow-y: auto; padding: 4px 0; }
.ctax-select-group { padding: 6px 12px 2px; font-size: 10.5px; font-weight: 600; color: var(--tph); text-transform: uppercase; letter-spacing: 0.07em; }
.ctax-select-option { padding: 7px 12px; font-size: 13px; color: var(--text); cursor: pointer; transition: background 0.08s; display: flex; align-items: center; }
.ctax-select-option:hover { background: var(--bg); }
.ctax-select-option.active { background: var(--primary); color: var(--white); }

.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; }

/* ─── 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;
}

/* ─── 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-x: auto;
  position: relative;
}
.recent-table-wrap.is-scrolled::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  right: 156px;
  width: 20px;
  background: linear-gradient(to left, rgba(0,0,0,0.08), transparent);
  pointer-events: none;
  z-index: 3;
}
.col-truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* border-collapse:separate + overflow:visible required for position:sticky on td/th */
.projects-table {
  border-collapse: separate;
  border-spacing: 0;
  overflow: visible;
  border: none;
  min-width: 850px;
  table-layout: fixed;
  width: 100%;
}
.projects-table th.col-actions,
.projects-table td.col-actions {
  position: sticky;
  right: 0;
  z-index: 2;
  width: 156px;
  background: var(--white);
}
.projects-table th.col-actions { background: #ffffff; }

/* ── Row checkboxes (smaller than Tax Center) ── */
.projects-table .tc-checkbox { display: block; }
#view-projects .projects-table th:first-child,
#view-projects .projects-table td:first-child { width: 40px; padding-right: 0 !important; }
#view-services .projects-table th:first-child,
#view-services .projects-table td:first-child { width: 40px; padding-right: 0 !important; }

/* ── Ref subtitle ── */
.name-ref-wrap {
  display: flex;
  flex-direction: column;
  justify-content: center;
  height: 48px;
  overflow: hidden;
  padding: 0 16px;
}
.ref-sub {
  font-size: 10.5px;
  color: var(--tsec);
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-height: 0;
  opacity: 0;
  transition: max-height 0.25s ease, opacity 0.2s ease;
}
.projects-table.show-ref .ref-sub { max-height: 16px; opacity: 1; }

/* ─── 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.32s ease, transform 0.36s ease, margin-right 0.36s 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: var(--green-announce-border);
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(79,222,138,0.5);
  animation: pulse-dot 2s infinite;
  flex-shrink: 0;
}
@keyframes pulse-dot {
  0%, 100% { box-shadow: 0 0 0 0 rgba(79,222,138,0.5); }
  50% { box-shadow: 0 0 0 6px rgba(79,222,138,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-list-item {
  display: block;
  padding-left: 14px;
  position: relative;
  line-height: 1.6;
}
.ai-list-item::before {
  content: '-';
  position: absolute;
  left: 0;
  color: var(--tsec);
}
.ai-bubble.user {
  background: var(--primary);
  color: var(--white);
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

/* Message action row (copy / read aloud / 👍 / 👎 / regenerate) */
.ai-msg-actions { display: flex; gap: 2px; align-items: center; margin: -2px 0 6px; }
.ai-msg-act {
  background: none; border: none; padding: 5px; border-radius: 6px;
  color: var(--tsec); cursor: pointer; display: inline-flex;
  align-items: center; justify-content: center;
  transition: background 0.12s ease, color 0.12s ease;
}
.ai-msg-act .material-symbols-outlined { font-size: 16px; }
.ai-msg-act:hover { background: var(--bg); color: var(--text); }
.ai-msg-act.active { color: var(--text); }
/* Full-page chat: align the row with the centered assistant text column */
.ai-page-messages > .ai-msg-actions { width: 100%; max-width: 768px; margin: -2px auto 14px; padding: 0 20px; }
.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-h-resize-handle {
  height: 8px;
  flex-shrink: 0;
  cursor: ns-resize;
  display: flex;
  align-items: center;
  justify-content: center;
  border-top: 1px solid var(--border);
  user-select: none;
  touch-action: none;
}
.ai-h-resize-handle::after {
  content: '';
  width: 32px;
  height: 3px;
  background: var(--border);
  border-radius: 999px;
  transition: background 0.15s;
}
.ai-h-resize-handle:hover::after,
.ai-h-resize-handle.dragging::after { background: var(--border-s); }

.ai-quick-buttons {
  padding: 10px 14px 16px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  flex-shrink: 0;
}
.ai-quick-buttons button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  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-quick-buttons button .material-symbols-outlined { font-size: 16px; color: var(--tsec); }

.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;
  overflow-y: auto;
  outline: none;
}
.ai-input-row textarea.ai-drag-over { background: color-mix(in srgb, var(--primary) 8%, transparent); }
.ai-input-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px;
  border-top: 1px solid var(--border);
}
.ai-toolbar-right { display: flex; align-items: center; gap: 6px; }

/* Floating input — reparented into .main-content and centered purely by CSS,
   so it auto-tracks sidebar / panel / window width changes (no JS math). */
.ai-input-row.floating { border-color: var(--border); }
.ai-input-row.floating:focus-within { border-color: var(--primary); }
.ai-input-row.floating {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: 24px;
  width: min(768px, 90vw);
  margin: 0;
  z-index: 600;
  box-shadow: 0 8px 40px rgba(0,0,0,0.14);
  border-radius: var(--r-lg);
  height: auto !important;
}
.ai-input-row.floating textarea {
  min-height: 80px;
  height: auto !important;
}
.ai-h-resize-handle.hidden-for-float,
.ai-quick-buttons.hidden-for-float { display: none; }
/* The floating input must never appear on the full-page AI chat view
   (that view has its own input). It reappears when you leave the view. */
.main-content:has(#view-ai.active) .ai-input-row.floating { display: none; }
.ai-toolbar-right { display: flex; align-items: center; gap: 6px; }

.ai-send-btn {
  background: var(--primary);
  color: var(--white);
  border: none;
  border-radius: var(--r-md);
  width: 30px;
  height: 30px;
  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: 14px; }



/* 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, opacity 0.22s ease;
  padding: 0;
}
.ai-toggle .material-symbols-outlined { font-size: 16px; }
.ai-panel-open-btn { width: 33.5px; height: 33.5px; }
.ai-toggle:hover { background: var(--primary-hover); }
.ai-toggle:active { background: var(--primary-active); }

/* ─── AI Full-page View ─────────────────────────────────── */
.ai-page { flex-direction: row; height: 100%; overflow: hidden; }

.ai-history-sidebar {
  width: 220px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}
.ai-history-header {
  padding: 16px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
}
.ai-history-header .btn-primary { width: 100%; justify-content: center; }
.ai-conv-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}
.ai-conv-group-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--tsec);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 10px 12px 4px;
}
.ai-conv-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  font-size: 13px;
  color: var(--tpri);
  cursor: pointer;
  border-radius: 6px;
  margin: 0 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  position: relative;
}
.ai-conv-item:hover { background: var(--hover); }
.ai-conv-item.active { background: var(--border); font-weight: 500; }
.ai-conv-item-title { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.ai-conv-item-del {
  display: none;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  color: var(--tsec);
  flex-shrink: 0;
  line-height: 1;
}
.ai-conv-item:hover .ai-conv-item-del { display: flex; }
.ai-conv-item-del .material-symbols-outlined { font-size: 14px; }
.ai-conv-item-del:hover { color: var(--danger, #e53e3e); }

.ai-page-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

.ai-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.ai-page-header .ai-page-header-left { display: flex; align-items: center; gap: 8px; }

.ai-page-messages {
  flex: 1;
  overflow-y: auto;
  width: 100%;
  background: var(--white);
  position: relative;
  display: flex;
  flex-direction: column;
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
  transition: scrollbar-color 0.3s;
}
.ai-page-messages:hover { scrollbar-color: var(--border-s) transparent; }
.ai-page-messages::-webkit-scrollbar { width: 5px; }
.ai-page-messages::-webkit-scrollbar-track { background: transparent; }
.ai-page-messages::-webkit-scrollbar-thumb { background: transparent; border-radius: 999px; transition: background 0.3s; }
.ai-page-messages:hover::-webkit-scrollbar-thumb { background: var(--border-s); }

/* Messages — ChatGPT-style: assistant = plain text, user = right-aligned bubble */
.ai-page-messages > .ai-bubble {
  box-sizing: border-box;
  font-size: 14px;
  line-height: 1.6;
}
.ai-page-messages > .ai-bubble:first-of-type { margin-top: 24px; }

.ai-page-messages > .ai-bubble.assistant {
  width: 100%;
  max-width: 768px;
  margin: 6px auto;
  padding: 6px 24px;
  background: transparent;
  border-radius: 0;
  color: var(--text);
}
/* Kill the extra blank line the renderer inserts after each list item */
.ai-page-messages > .ai-bubble.assistant .ai-list-item + br { display: none; }
.ai-page-messages > .ai-bubble.assistant .ai-list-item {
  line-height: 1.5;
  margin: 1px 0;
}

.ai-page-messages > .ai-bubble.user {
  width: fit-content;
  max-width: min(75%, 560px);
  margin: 14px max(24px, calc(50% - 384px)) 14px auto;
  padding: 11px 16px;
  background: var(--bg);
  color: var(--text);
  border-radius: 18px;
}

/* Thinking dots + change bubbles share the centered text column */
.ai-page-messages > .ai-thinking,
.ai-page-messages > .ai-change-bubble {
  width: 100%;
  max-width: 768px;
  margin: 6px auto;
  align-self: auto;
}
.ai-page-messages > .ai-thinking { padding-left: 24px; background: transparent; }

/* Empty state: center-wrap absolutely centered (ChatGPT first-open) */
.ai-page-center-wrap {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: calc(100% - 48px);
  max-width: 768px;
  box-sizing: border-box;
}
.ai-page-greeting {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 22px;
}
.ai-page-greeting h1 {
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
  margin: 0;
}
.ai-page-greeting .ai-dot { width: 9px; height: 9px; }

/* Has messages: input docks to the bottom, greeting + chips hidden */
.ai-page-messages.has-messages .ai-page-center-wrap {
  position: sticky;
  top: auto;
  left: auto;
  transform: none;
  bottom: 0;
  margin-top: auto;
  width: 100%;
  max-width: none;
  padding: 8px 24px 20px;
  background: linear-gradient(to bottom, rgba(255,255,255,0), var(--white) 28%);
}
.ai-page-messages.has-messages .ai-page-greeting,
.ai-page-messages.has-messages .ai-page-quick { display: none; }

.ai-page-input-row { width: 100%; max-width: 768px; margin: 0 auto; }
.ai-page-quick { justify-content: center; padding-bottom: 0; }

/* AI panel open button — black, full rounded like btn-primary */
.ai-panel-open-btn {
  width: 33.5px;
  height: 33.5px;
  background: var(--primary) !important;
  color: var(--white) !important;
  border-color: var(--primary) !important;
  border-radius: var(--r-btn) !important;
}
.ai-panel-open-btn:hover { background: var(--primary-hover) !important; border-color: var(--primary-hover) !important; }


/* 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;
  touch-action: none;
}
.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-header { padding: 16px 16px 14px; }
  .view-body { 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;
}

/* ─── 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; }
.empty-state-icon-wrap {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--bg);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px;
}
.empty-state-icon-wrap .material-symbols-outlined { font-size: 24px; color: var(--tsec); }

/* ─── 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;
  margin-top: 32px;
}
.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); }

/* ─── Language Overlay ───────────────────────────────────── */
.overlay-card--lang { max-width: 560px; padding: 36px; }
#lang-overlay h2 { margin-bottom: 6px; }
#lang-overlay p { font-size: 14px; color: var(--tsec); margin: 0 0 26px; }

/* ─── Auth Screen extras ─────────────────────────────────── */
.auth-brand { display: flex; align-items: center; gap: 8px; margin-bottom: 28px; }
.auth-brand-name { font-weight: 700; letter-spacing: -0.02em; font-size: 17px; }
#auth-title { font-size: 22px; margin-bottom: 6px; }
.auth-card > p { font-size: 13.5px; color: var(--tsec); margin: 0 0 20px; }
.auth-card .seg { grid-template-columns: 1fr 1fr; margin-bottom: 18px; }
.form-group--tight { margin-bottom: 6px; }
.pw-wrap { position: relative; }
.pw-input { padding-right: 38px !important; }
.pw-toggle {
  position: absolute; right: 0; top: 0; bottom: 0; width: 38px;
  background: none; border: none; cursor: pointer;
  color: var(--tsec); display: flex; align-items: center; justify-content: center;
}
.pw-toggle .material-symbols-outlined { font-size: 16px; }
#auth-submit { padding: 11px; margin: 14px 0 10px; }
.auth-footer-note { text-align: center; font-size: 12.5px; color: var(--tsec); }
.auth-footer-note a { color: var(--text); font-weight: 500; text-decoration: underline; }

/* ─── Welcome Overlay extras ─────────────────────────────── */
.welcome-icon-circle {
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--green); color: var(--green-dark);
  margin: 0 auto 16px; display: flex; align-items: center; justify-content: center;
}
.welcome-icon-circle .material-symbols-outlined {
  font-size: 34px; padding-top: 4px; font-variation-settings: 'FILL' 0;
}
.welcome-card .btn-ghost {
  width: 100%; border: none; background: transparent; color: var(--tsec); font-size: 13px;
}

/* ─── Confirm Modal extras ───────────────────────────────── */
.confirm-icon-circle .material-symbols-outlined { font-size: 20px; }

/* ─── Profile Modal extras ───────────────────────────────── */
.profile-modal-head .icon-btn-del { margin-left: auto; }
.profile-modal-head .icon-btn .material-symbols-outlined { font-size: 16px; }
.profile-modal-body .btn-danger-outline { margin-top: 8px; }

/* ─── Sidebar user btn ───────────────────────────────────── */
.sidebar-user .icon-btn .material-symbols-outlined { font-size: 13px; }

/* ─── Dashboard top bar ──────────────────────────────────── */
.dash-top-bar {
  display: flex; align-items: flex-start;
  justify-content: space-between;
}

/* ─── AI Panel header actions ────────────────────────────── */
.ai-header-actions { display: flex; align-items: center; gap: 6px; }
.ai-header-actions .material-symbols-outlined { font-size: 13px; }

/* ─── Mobile Composer Message ────────────────────────────── */
#mobile-composer-msg {
  display: none; position: fixed; inset: 0; bottom: 56px;
  background: var(--bg); z-index: 300; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center; padding: 40px 28px; gap: 16px;
}
#mobile-composer-msg .mobile-composer-icon { font-size: 48px; }
#mobile-composer-msg h2 { font-size: 20px; font-weight: 700; letter-spacing: -0.02em; }
#mobile-composer-msg p { font-size: 15px; color: var(--tsec); line-height: 1.65; max-width: 280px; }

/* ─── Toggle switch ─────────────────────────────────────── */
.toggle-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 2px 0;
}
.toggle-row label { font-size: 13.5px; color: var(--text); font-weight: 500; margin: 0; }
.toggle-switch { position: relative; display: inline-block; width: 40px; height: 22px; flex-shrink: 0; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0; background: var(--border-s);
  border-radius: 22px; cursor: pointer; transition: background 0.2s;
}
.toggle-slider::before {
  content: ''; position: absolute; width: 16px; height: 16px;
  left: 3px; top: 3px; background: #fff; border-radius: 50%;
  transition: transform 0.2s; box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.toggle-switch input:checked + .toggle-slider { background: var(--primary); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(18px); }

/* ─── 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;
}


/* ─── Enviar a AEAT button ───────────────────────────────── */

/* ─── Verifactu status badge ─────────────────────────────── */
.vf-status-badge {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600; letter-spacing: .01em;
  padding: 4px 10px; border-radius: 20px;
  background: var(--bg2); cursor: pointer;
  border: 1px solid var(--border); transition: opacity .15s;
  white-space: nowrap;
}
.vf-status-badge:hover { opacity: .75; }
.vf-badge-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }

/* ─── E-Invoice activation block (Settings) ─────────────── */
.einvoice-block {
  display: flex; align-items: center; flex-wrap: wrap; gap: 12px;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 12px; padding: 12px 16px; margin-top: 4px;
}
.einvoice-block.einvoice-connected {
  border-color: var(--green-announce-border); background: var(--green-announce-bg);
}
.einvoice-block-info {
  display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; flex-wrap: wrap;
}
.einvoice-name {
  font-size: 14px; font-weight: 600; color: var(--text);
}
.einvoice-authority {
  font-size: 12px; color: var(--tsec);
}
.einvoice-note {
  font-size: 11px; color: #d97706; background: #fef3c7;
  border-radius: 20px; padding: 2px 8px; font-weight: 600;
  border: solid 1px #d97706;
}
.einvoice-missing {
  width: 100%; font-size: 12px; color: var(--tsec);
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}

/* ─── AI Panel header action buttons ─────────────────────── */
/* Round 33.5px icon buttons in the panel header */
.ai-header-actions .icon-btn {
  width: 33.5px;
  height: 33.5px;
  border-radius: 50%;
}
/* The X (dismiss) button is solid black */
.ai-header-actions .ai-dismiss-btn {
  background: var(--primary) !important;
  border-color: var(--primary) !important;
  color: var(--white) !important;
}
.ai-header-actions .ai-dismiss-btn:hover {
  background: var(--primary-hover) !important;
  border-color: var(--primary-hover) !important;
}

/* ─── Dashboard body: single source of vertical rhythm (gap, no margins) ─── */
.dash-body { display: flex; flex-direction: column; gap: 20px; }
.dash-body .dash-section-header { margin: 0; }

/* ─── Dashboard overview row (Overview chart + attention, 3 cols) ─── */
.dash-overview-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  align-items: stretch;
}
.dash-overview-row > #dash-overview-card { grid-column: span 2; }
.dash-overview-row #dashboard-attention { margin-top: 0; display: flex; }
.dash-overview-row #dashboard-attention > .an-card { flex: 1; }
.dash-overview-row--empty { grid-template-columns: 1fr; }
@media (max-width: 900px) {
  .dash-overview-row { grid-template-columns: 1fr; }
  .dash-overview-row > #dash-overview-card { grid-column: auto; }
}

/* ─── Services pills ─────────────────────────────────────── */
.pill-sv { padding: 2px 8px; font-size: 11px; }
.pill-sv-flat   { background: var(--grey-pill); color: var(--grey-pill-text); }
.pill-sv-hourly { background: var(--lav);       color: var(--lav-d); }

/* ─── Services form ──────────────────────────────────────── */
.sv-form { display: flex; flex-direction: column; gap: 16px; max-width: 640px; }
.sv-lines-section { display: flex; flex-direction: column; gap: 6px; }
.sv-lines-header { display: flex; align-items: center; justify-content: space-between; }
.sv-lines-header label { font-size: 12px; font-weight: 500; color: var(--tsec); }
.sv-lines-labels {
  display: grid;
  grid-template-columns: 1fr 120px 32px;
  gap: 8px;
  padding: 0 2px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--tph);
}
#svf-lines { display: flex; flex-direction: column; gap: 6px; }
.svf-line-row {
  display: grid;
  grid-template-columns: 1fr 120px 32px;
  gap: 8px;
  align-items: center;
}
.svf-line-row input {
  width: 100%;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 8px 12px;
  font-size: 13.5px;
  font-family: 'Inter', sans-serif;
  color: var(--text);
  transition: border-color 0.15s;
  outline: none;
  box-sizing: border-box;
}
.svf-line-row input:hover { border-color: var(--border-s); }
.svf-line-row input:focus { border-color: var(--primary); }

/* ── Dropdown separator + groups ── */
.status-dd-sep { height: 1px; background: var(--border); margin: 4px 0; pointer-events: none; }
.status-dd-group-label {
  font-size: 10.5px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase;
  color: var(--tph); opacity: .5; padding: 8px 14px 2px; pointer-events: none;
}
.status-dd-subitem { padding-left: 22px !important; }

/* ── Doc type area (topbar) ── */
#comp-doc-type-area { display: flex; align-items: center; gap: 8px; }
.comp-doctype-label {
  font-size: 11px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--tph); opacity: .6;
}
.comp-source-link {
  font-size: 12px; color: var(--primary); cursor: pointer;
  text-decoration: none; background: none; border: none; padding: 0;
  display: inline-flex; align-items: center; gap: 3px;
}
.comp-source-link:hover { opacity: .75; }

/* ── Templates gallery view ── */
.tpl-gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  padding: 24px;
}
.tpl-gallery-card {
  border: 1px solid var(--border); border-radius: var(--r-lg, 12px);
  background: var(--white); overflow: hidden;
  display: flex; flex-direction: column;
  transition: box-shadow .15s, border-color .15s;
}
.tpl-gallery-card:hover { border-color: var(--border-s); box-shadow: 0 4px 16px rgba(0,0,0,.07); }
.tpl-gallery-card--builtin .tpl-gallery-thumb { background: var(--bg); }
.tpl-gallery-thumb {
  height: 160px; display: flex; align-items: center; justify-content: center;
  background: var(--bg-alt, #f6f7f9); overflow: hidden; flex-shrink: 0;
}
.tpl-gallery-thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.tpl-gallery-thumb .material-symbols-outlined { font-size: 40px; color: var(--tph); opacity: .25; }
.tpl-thumb-icon { font-size: 48px !important; opacity: .8 !important; font-variation-settings: 'wght' 200, 'FILL' 0, 'GRAD' -25, 'opsz' 48; }
.tpl-gallery-thumb--clickable { cursor: pointer; position: relative; }
.tpl-thumb-overlay {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.35); opacity: 0; transition: opacity .15s;
}
.tpl-thumb-overlay .material-symbols-outlined { font-size: 26px; color: #fff; opacity: 1; }
.tpl-gallery-thumb--clickable:hover .tpl-thumb-overlay { opacity: 1; }
.tpl-gallery-info {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 14px 6px;
}
.tpl-gallery-name {
  font-size: 13px; font-weight: 500; color: var(--text);
  flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tpl-rename-input {
  font-size: 13px; font-weight: 500; color: var(--text); font-family: inherit;
  flex: 1; border: none; border-bottom: 1px solid var(--ink); background: none;
  outline: none; padding: 0; width: 100%;
}
.tpl-gallery-badge {
  font-size: 10px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  padding: 2px 7px; border-radius: 20px; flex-shrink: 0;
}
.tpl-gallery-badge--quote   { background: var(--violet-light, #ede9fe); color: var(--violet, #7c3aed); }
.tpl-gallery-badge--invoice { background: var(--green-light,  #dcfce7); color: var(--green-dark, #15803d); }
.tpl-gallery-actions {
  display: flex; align-items: center; gap: 4px;
  padding: 8px 10px 12px;
}
.tpl-gallery-actions .btn-primary { font-size: 12px; padding: 5px 12px; margin-right: auto; }
.tpl-action-btn {
  width: 30px; height: 30px; border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); background: var(--white); cursor: pointer;
  color: var(--tsec); transition: background .12s, border-color .12s, color .12s;
}
.tpl-action-btn:hover { background: var(--bg); border-color: var(--border-s); color: var(--text); }
.tpl-action-btn .material-symbols-outlined { font-size: 16px; }
.tpl-action-danger:hover { background: var(--red-light, #fee2e2); border-color: var(--danger, #e53e3e); color: var(--danger, #e53e3e); }
.tpl-empty {
  font-size: 13.5px; color: var(--tph); opacity: .55;
  text-align: center; padding: 64px 24px; margin: 0;
}

/* ── PDF preview mode — hide all app chrome immediately on class add ── */
body.preview-mode .sidebar,
body.preview-mode .comp-topbar,
body.preview-mode .comp-ratebar,
body.preview-mode .comp-hours-hint,
body.preview-mode .ai-panel,
body.preview-mode .ai-toggle,
body.preview-mode .mobile-nav,
body.preview-mode .block-drag,
body.preview-mode .block-side-r,
body.preview-mode .block-inserter,
body.preview-mode .canvas-add-zone,
body.preview-mode .block-picker-overlay,
body.preview-mode #toast { display: none !important; }

/* ─── Info Modal ──────────────────────────────────────────── */
.info-overlay {
  position: fixed;
  inset: 0;
  z-index: 1100;
  background: rgba(0,0,0,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.info-overlay.hidden { display: none; }

.info-modal {
  display: flex;
  width: min(860px, 100%);
  height: min(620px, 90vh);
  background: var(--white);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 24px 64px rgba(0,0,0,0.25);
}

.info-sidebar {
  width: 180px;
  flex-shrink: 0;
  background: var(--bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 20px 0 16px;
}
.info-sidebar-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--tsec);
  padding: 0 16px 12px;
}
.info-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 8px;
}
.info-nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 500;
  color: var(--tsec);
  cursor: pointer;
  background: none;
  border: none;
  text-align: left;
  width: 100%;
  transition: background 0.12s, color 0.12s;
}
.info-nav-item .material-symbols-outlined { font-size: 16px; }
.info-nav-item:hover { background: var(--primary-pale); color: var(--text); }
.info-nav-item.active { background: var(--primary-pale); color: var(--primary); font-weight: 600; }
.info-nav-item.active .material-symbols-outlined { color: var(--primary); }

.info-body {
  flex: 1;
  min-width: 0;
  position: relative;
  display: flex;
  flex-direction: column;
}
.info-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  background: var(--bg);
  color: var(--tsec);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
  transition: background 0.12s, color 0.12s;
}
.info-close:hover { background: var(--border); color: var(--text); }
.info-close .material-symbols-outlined { font-size: 16px; }

.info-content {
  flex: 1;
  overflow-y: auto;
  padding: 32px 40px 40px;
  scroll-behavior: smooth;
}
.info-content h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 8px;
}
.info-content .info-intro {
  font-size: 14px;
  color: var(--tsec);
  margin: 0 0 28px;
  line-height: 1.55;
}
.info-content h3 {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--tsec);
  margin: 36px 0 8px;
}
.info-content p {
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--text);
  margin: 0 0 10px;
}
.info-content ul {
  margin: 0 0 10px;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.info-content li {
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--text);
}
.info-content strong { color: var(--text); font-weight: 600; }
.info-content em { color: var(--tsec); font-style: normal; font-weight: 500; }
.info-content code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  color: var(--text);
}
.info-shortcuts { width: 100%; border-collapse: collapse; margin-top: 4px; }
.info-shortcuts td { padding: 7px 0; font-size: 13px; border-bottom: 1px solid var(--border-s); color: var(--text); }
.info-shortcut-key { text-align: right; color: var(--tsec); font-size: 12px; font-family: 'JetBrains Mono', monospace; white-space: nowrap; }

/* ── Composer intro card ── */
#composer-intro-card {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 8000;
  width: 300px;
  background: #2563eb;
  color: #fff;
  border-radius: 14px;
  padding: 20px;
  box-shadow: 0 16px 48px rgba(0,0,0,0.28);
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.24s ease, transform 0.24s ease;
}
#composer-intro-card.ci-visible { opacity: 1; transform: translateY(0); }
.ci-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.ci-title { font-size: 13.5px; font-weight: 700; }
.ci-close { background: none; border: none; color: rgba(255,255,255,0.4); cursor: pointer; font-size: 14px; padding: 0; line-height: 1; }
.ci-close:hover { color: #fff; }
.ci-list { margin: 0 0 16px 0; padding: 0 0 0 16px; display: flex; flex-direction: column; gap: 8px; }
.ci-list li { font-size: 12.5px; color: rgba(255,255,255,0.75); line-height: 1.5; }
.ci-list strong { color: #fff; font-weight: 600; }
.ci-footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ci-hint { font-size: 11px; color: rgba(255,255,255,0.4); }
.ci-hint kbd { background: rgba(255,255,255,0.1); border-radius: 4px; padding: 1px 5px; font-family: inherit; }
.ci-got-it { background: #fff; color: #1A1A1A; border: none; border-radius: 7px; padding: 7px 14px; font-size: 12.5px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.ci-got-it:hover { background: #e8e8e8; }
