:root {
  color-scheme: light;
  --navy-950: #0a172a;
  --navy-900: #0d1d33;
  --navy-800: #152943;
  --ink: #182230;
  --muted: #667085;
  --soft: #98a2b3;
  --line: #e6e9ee;
  --line-strong: #d8dde5;
  --surface: #ffffff;
  --canvas: #f5f7fa;
  --blue: #2563eb;
  --blue-dark: #1d4ed8;
  --blue-soft: #eaf1ff;
  --green: #0f9f6e;
  --green-soft: #e8f8f2;
  --amber: #c77916;
  --amber-soft: #fff5e5;
  --red: #d14343;
  --red-soft: #fff0f0;
  --violet: #7c3aed;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05), 0 1px 5px rgba(15, 23, 42, .03);
  --shadow-lg: 0 22px 60px rgba(15, 23, 42, .18);
  --radius: 14px;
  --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html { min-width: 320px; background: var(--canvas); }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--canvas);
  font-family: var(--font);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; }
button { color: inherit; }

button:focus-visible, input:focus-visible, select:focus-visible {
  outline: 3px solid rgba(37, 99, 235, .18);
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.app-shell { min-height: 100vh; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 30;
  display: flex;
  width: 252px;
  flex-direction: column;
  padding: 26px 18px 18px;
  color: #d9e2ef;
  background:
    radial-gradient(circle at 15% 5%, rgba(49, 112, 202, .17), transparent 28%),
    linear-gradient(180deg, var(--navy-900), #091525 100%);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 10px 24px;
  color: #fff;
  text-decoration: none;
}

.brand-logo-compact {
  display: block;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 12px;
  object-fit: contain;
  padding: 3px;
  background: #fff;
  box-shadow: 0 8px 20px rgba(31, 85, 199, .35);
}

.brand strong, .brand small { display: block; }
.brand strong { font-size: 17px; letter-spacing: .01em; }
.brand small { margin-top: 2px; color: #9eb0c7; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }

.back-site {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: -10px 7px 17px;
  padding: 9px 11px;
  border: 1px solid rgba(255,255,255,.09);
  border-radius: 9px;
  color: #9fb1c8;
  background: rgba(255,255,255,.035);
  font-size: 11px;
  font-weight: 650;
  text-decoration: none;
  transition: color .18s, background .18s;
}

.back-site:hover { color: #fff; background: rgba(255,255,255,.075); }

.main-nav { flex: 1; }
.nav-label { margin: 12px 12px 8px; color: #6f829a; font-size: 10px; font-weight: 700; letter-spacing: .13em; }
.nav-label-spaced { margin-top: 25px; }

.nav-item {
  position: relative;
  display: flex;
  width: 100%;
  align-items: center;
  gap: 12px;
  margin: 3px 0;
  padding: 11px 12px;
  border: 0;
  border-radius: 9px;
  color: #aebdd0;
  background: transparent;
  cursor: pointer;
  text-align: left;
  transition: color .18s, background .18s;
}

.nav-item:hover { color: #fff; background: rgba(255,255,255,.055); }
.nav-item.active { color: #fff; background: rgba(59, 130, 246, .16); box-shadow: inset 3px 0 #4c8cff; }
.nav-item svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.nav-item:first-of-type svg { fill: currentColor; stroke: none; }
.nav-count { margin-left: auto; min-width: 22px; padding: 2px 6px; border-radius: 99px; background: rgba(255,255,255,.1); font-size: 11px; text-align: center; }

.pac-status-card {
  display: grid;
  grid-template-columns: 30px 1fr;
  gap: 10px;
  padding: 13px;
  border: 1px solid rgba(255, 185, 81, .18);
  border-radius: 11px;
  background: rgba(255, 176, 58, .06);
}

.status-icon { display: grid; width: 28px; height: 28px; place-items: center; border-radius: 50%; color: #fdbd5c; background: rgba(253, 189, 92, .13); font-weight: 800; }
.pac-status-card strong, .pac-status-card span { display: block; }
.pac-status-card strong { color: #f4f7fb; font-size: 12px; }
.pac-status-card span { margin-top: 3px; color: #8699b1; font-size: 11px; }
.pac-status-card button { grid-column: 2; justify-self: start; padding: 0; border: 0; color: #76a6ff; background: transparent; cursor: pointer; font-size: 11px; font-weight: 700; }

.user-card { display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; align-items: center; margin-top: 14px; padding: 14px 8px 2px; border-top: 1px solid rgba(255,255,255,.08); }
.avatar { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 50%; color: #cfe0ff; background: #233c5c; font-size: 11px; font-weight: 700; }
.user-card strong, .user-card span { display: block; }
.user-card strong { color: #eaf0f8; font-size: 12px; }
.user-card span { margin-top: 2px; color: #71859d; font-size: 10px; }
.user-card button { border: 0; color: #71859d; background: transparent; cursor: pointer; }

.workspace { min-height: 100vh; margin-left: 252px; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  height: 66px;
  align-items: center;
  justify-content: space-between;
  padding: 0 36px;
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,.94);
  backdrop-filter: blur(12px);
}

.breadcrumb { display: flex; align-items: center; gap: 9px; color: var(--soft); font-size: 12px; }
.breadcrumb b { color: #c2c8d1; }
.breadcrumb strong { color: #354052; font-weight: 600; }
.top-actions { display: flex; gap: 7px; }
.icon-button, .mobile-menu { display: grid; width: 35px; height: 35px; place-items: center; border: 1px solid var(--line); border-radius: 9px; background: #fff; cursor: pointer; }
.icon-button svg, .mobile-menu svg { width: 18px; height: 18px; fill: none; stroke: #667085; stroke-width: 1.7; stroke-linecap: round; }
.notification::after { content: ""; position: absolute; width: 6px; height: 6px; margin: -19px -18px 0 0; border: 2px solid #fff; border-radius: 50%; background: #ef4444; }
.mobile-menu { display: none; }

.content { max-width: 1500px; margin: 0 auto; padding: 38px 42px 72px; }
.view { display: none; }
.view.active { display: block; animation: reveal .24s ease-out; }
@keyframes reveal { from { opacity: 0; transform: translateY(4px); } }

.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.eyebrow { margin: 0 0 7px; color: var(--blue); font-size: 10px; font-weight: 800; letter-spacing: .14em; }
h1, h2, p { margin-top: 0; }
.page-heading h1, .invoice-editor-heading h1 { margin: 0 0 6px; color: #111c2d; font-size: clamp(26px, 3vw, 33px); line-height: 1.15; letter-spacing: -.035em; }
.page-heading p, .invoice-editor-heading p { margin: 0; color: var(--muted); line-height: 1.55; }

.button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 17px;
  border: 1px solid transparent;
  border-radius: 9px;
  cursor: pointer;
  font-weight: 650;
  transition: transform .15s, background .15s, border-color .15s, box-shadow .15s;
}
.button:hover { transform: translateY(-1px); }
.button.primary { color: #fff; background: var(--blue); box-shadow: 0 5px 12px rgba(37, 99, 235, .17); }
.button.primary:hover { background: var(--blue-dark); }
.button.secondary { border-color: var(--line-strong); color: #344054; background: #fff; box-shadow: var(--shadow-sm); }
.button.secondary:hover { border-color: #bdc5d1; background: #fafbfc; }
.button.ghost { color: var(--blue); background: #f4f7ff; }
.button.compact { min-height: 35px; padding: 0 12px; font-size: 12px; }
.button.full { width: 100%; margin-top: 10px; }
.button svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.metrics-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 15px; margin-bottom: 20px; }
.metric-card { display: flex; min-width: 0; align-items: center; gap: 14px; padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); }
.metric-icon { display: grid; width: 44px; height: 44px; flex: 0 0 auto; place-items: center; border-radius: 12px; }
.metric-icon svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.metric-icon.blue { color: var(--blue); background: var(--blue-soft); }
.metric-icon.amber { color: var(--amber); background: var(--amber-soft); }
.metric-icon.green { color: var(--green); background: var(--green-soft); }
.metric-icon.violet { color: var(--violet); background: #f2ecff; }
.metric-card div:last-child { min-width: 0; }
.metric-card span, .metric-card strong, .metric-card small { display: block; }
.metric-card span { margin-bottom: 5px; overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.metric-card strong { color: #172235; font-size: 21px; letter-spacing: -.02em; }
.metric-card small { margin-top: 5px; color: var(--soft); font-size: 9px; }
.metric-card small b { color: var(--green); }

.panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); }
.invoices-panel { overflow: hidden; }
.panel-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 17px 20px; border-bottom: 1px solid var(--line); }
.segmented { display: flex; gap: 3px; }
.segmented button { padding: 8px 10px; border: 0; border-radius: 7px; color: var(--muted); background: transparent; cursor: pointer; font-size: 11px; font-weight: 600; }
.segmented button:hover { color: #344054; background: #f5f7fa; }
.segmented button.active { color: var(--blue); background: var(--blue-soft); }
.segmented span { margin-left: 3px; color: inherit; opacity: .72; }
.toolbar-actions { display: flex; gap: 9px; }
.search-box { display: flex; width: min(290px, 28vw); align-items: center; gap: 8px; padding: 0 11px; border: 1px solid var(--line-strong); border-radius: 8px; background: #fff; }
.search-box:focus-within { border-color: #8fb2fb; box-shadow: 0 0 0 3px rgba(37, 99, 235, .08); }
.search-box svg { width: 16px; height: 16px; flex: 0 0 auto; fill: none; stroke: #98a2b3; stroke-width: 1.8; stroke-linecap: round; }
.search-box input { width: 100%; height: 35px; border: 0; outline: 0; color: #344054; background: transparent; font-size: 11px; }
.search-box input::placeholder { color: #98a2b3; }

.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { padding: 12px 20px; border-bottom: 1px solid var(--line); color: #7c8798; background: #fafbfc; font-size: 9px; font-weight: 750; letter-spacing: .07em; text-align: left; text-transform: uppercase; white-space: nowrap; }
.data-table td { padding: 16px 20px; border-bottom: 1px solid #edf0f3; color: #344054; font-size: 12px; vertical-align: middle; }
.data-table tbody tr { transition: background .15s; }
.data-table tbody tr:hover { background: #fbfcfe; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.align-right { text-align: right !important; }
.folio-cell strong { display: block; color: #172235; font-size: 12px; }
.folio-cell span { display: block; max-width: 135px; margin-top: 3px; overflow: hidden; color: var(--soft); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 8px; text-overflow: ellipsis; white-space: nowrap; }
.client-cell { display: flex; align-items: center; gap: 10px; }
.client-avatar { display: grid; width: 32px; height: 32px; flex: 0 0 auto; place-items: center; border-radius: 9px; color: #49617d; background: #edf2f8; font-size: 10px; font-weight: 750; }
.client-cell strong, .client-cell span { display: block; }
.client-cell strong { max-width: 245px; overflow: hidden; color: #253044; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.client-cell span { margin-top: 2px; color: var(--soft); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 9px; }
.status-badge, .badge { display: inline-flex; align-items: center; gap: 6px; padding: 5px 9px; border-radius: 99px; font-size: 9px; font-weight: 750; }
.status-badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.status-badge.stamped, .badge.stamped { color: #087752; background: #e9f8f2; }
.status-badge.draft, .badge.draft { color: #9a6113; background: #fff3df; }
.status-badge.cancelled { color: #b33d3d; background: #fff0f0; }
.amount-cell { color: #172235 !important; font-variant-numeric: tabular-nums; font-weight: 700; text-align: right; }
.row-menu { width: 30px; height: 30px; border: 0; border-radius: 7px; color: #7d8999; background: transparent; cursor: pointer; }
.row-menu:hover { background: #f1f4f8; }
.panel-footer { display: flex; align-items: center; justify-content: space-between; padding: 13px 20px; border-top: 1px solid var(--line); color: var(--soft); background: #fcfcfd; font-size: 10px; }
.pagination { display: flex; gap: 3px; }
.pagination button { display: grid; width: 28px; height: 28px; place-items: center; border: 1px solid var(--line); border-radius: 7px; color: #667085; background: #fff; }
.pagination button.active { border-color: #d7e3ff; color: var(--blue); background: var(--blue-soft); }
.pagination button:disabled { opacity: .45; }
.empty-state { padding: 60px 20px; text-align: center; }
.empty-state div { display: grid; width: 48px; height: 48px; margin: 0 auto 12px; place-items: center; border-radius: 50%; color: #7a8ba2; background: #eef2f7; font-size: 25px; }
.empty-state strong { font-size: 14px; }
.empty-state p { margin: 5px 0 0; color: var(--muted); font-size: 11px; }

.invoice-editor-heading { display: grid; grid-template-columns: auto 1fr auto; gap: 15px; align-items: center; margin-bottom: 24px; }
.back-button { display: grid; width: 38px; height: 38px; place-items: center; border: 1px solid var(--line-strong); border-radius: 9px; background: #fff; cursor: pointer; font-size: 19px; }
.title-line { display: flex; align-items: center; gap: 10px; }
.title-line h1 { font-size: 26px; }
.editor-actions { display: flex; gap: 9px; }
.editor-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: start; }
.editor-main { display: grid; gap: 18px; }
.editor-sidebar { position: sticky; top: 86px; display: grid; gap: 15px; }
.form-card { padding: 24px; }
.form-card-header { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: start; margin-bottom: 22px; }
.step-number { display: grid; width: 31px; height: 31px; place-items: center; border-radius: 9px; color: var(--blue); background: var(--blue-soft); font-size: 10px; font-weight: 800; }
.form-card-header h2 { margin: 0 0 4px; font-size: 16px; letter-spacing: -.015em; }
.form-card-header p { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.45; }
.text-button { padding: 5px 0; border: 0; color: var(--blue); background: transparent; cursor: pointer; font-size: 10px; font-weight: 700; }
.form-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 17px 14px; }
.field { display: block; min-width: 0; }
.field.span-2 { grid-column: span 2; }
.span-4, .field.span-4 { grid-column: 1 / -1; }
.field > span { display: block; margin-bottom: 7px; color: #475467; font-size: 10px; font-weight: 700; }
.field > span b { color: var(--red); }
.field input, .field select {
  width: 100%;
  height: 39px;
  padding: 0 11px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  outline: 0;
  color: #253044;
  background: #fff;
  font-size: 11px;
  transition: border .15s, box-shadow .15s;
}
.field input:focus, .field select:focus { border-color: #79a3fa; box-shadow: 0 0 0 3px rgba(37, 99, 235, .08); }
.field input::placeholder { color: #a4adba; }
.field.invalid input, .field.invalid select { border-color: #eb7a7a; background: #fffafa; }
.field-error { display: none; margin-top: 5px; color: var(--red); font-size: 9px; }
.field.invalid .field-error { display: block; }

.concept-list { display: grid; gap: 14px; }
.concept-card { position: relative; padding: 17px; border: 1px solid var(--line); border-radius: 11px; background: #fbfcfe; }
.concept-card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.concept-card-header strong { font-size: 11px; }
.remove-concept { width: 29px; height: 29px; border: 0; border-radius: 7px; color: #a64b4b; background: #fff0f0; cursor: pointer; font-size: 17px; }
.concept-grid { display: grid; grid-template-columns: 1fr 1fr .55fr .75fr .75fr; gap: 12px; }
.concept-grid .description { grid-column: span 2; }
.concept-grid .tax-object { grid-column: span 2; }
.concept-grid .line-total { display: flex; align-items: flex-end; justify-content: flex-end; padding-bottom: 7px; color: #1b2b42; font-size: 13px; font-weight: 750; }
.add-concept { display: grid; width: 100%; grid-template-columns: 32px auto 1fr; align-items: center; gap: 10px; margin-top: 14px; padding: 13px 15px; border: 1px dashed #b8c6d8; border-radius: 10px; color: #40536c; background: #fbfdff; cursor: pointer; text-align: left; }
.add-concept:hover { border-color: #7fa7f8; background: #f7faff; }
.add-concept > span { display: grid; width: 30px; height: 30px; place-items: center; border-radius: 8px; color: var(--blue); background: var(--blue-soft); font-size: 18px; }
.add-concept strong { font-size: 10px; }
.add-concept small { color: var(--soft); font-size: 9px; }

.summary-card { overflow: hidden; }
.summary-header { display: flex; align-items: flex-start; justify-content: space-between; padding: 20px; border-bottom: 1px solid var(--line); }
.summary-header span, .summary-header strong { display: block; }
.summary-header > div > span { margin-bottom: 5px; color: var(--muted); font-size: 10px; }
.summary-header strong { color: #1d2939; font-size: 13px; }
.summary-header strong b { color: var(--blue); }
.currency-pill { padding: 4px 7px; border-radius: 6px; color: #536277; background: #f0f3f7; font-size: 9px; font-weight: 750; }
.summary-lines { display: grid; gap: 11px; padding: 19px 20px; border-bottom: 1px solid var(--line); }
.summary-lines div { display: flex; justify-content: space-between; color: var(--muted); font-size: 11px; }
.summary-lines strong { color: #344054; font-weight: 650; font-variant-numeric: tabular-nums; }
.summary-total { padding: 20px; background: #fafbfc; }
.summary-total span, .summary-total strong, .summary-total small { display: block; }
.summary-total span { color: var(--muted); font-size: 10px; }
.summary-total strong { margin-top: 3px; color: #101828; font-size: 25px; letter-spacing: -.025em; }
.summary-total small { margin-top: 3px; color: var(--soft); font-size: 9px; }
.summary-card > .button, .summary-card > .security-note { margin-left: 20px; width: calc(100% - 40px); }
.security-note { display: flex; gap: 7px; align-items: center; margin-top: 15px; margin-bottom: 18px; color: var(--soft); font-size: 9px; line-height: 1.4; }
.security-note span { color: var(--amber); }
.help-card { display: flex; gap: 12px; padding: 16px; border: 1px solid #dce7fc; border-radius: 12px; background: #f3f7ff; }
.help-icon { display: grid; width: 27px; height: 27px; flex: 0 0 auto; place-items: center; border-radius: 50%; color: #fff; background: var(--blue); font-size: 11px; font-weight: 800; }
.help-card strong { font-size: 11px; }
.help-card p { margin: 4px 0 7px; color: var(--muted); font-size: 9px; line-height: 1.45; }
.help-card button { padding: 0; border: 0; color: var(--blue); background: transparent; cursor: pointer; font-size: 9px; font-weight: 750; }

.registered-client { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 10px; align-items: end; padding: 13px; border: 1px solid #dbe6fb; border-radius: 10px; background: #f5f8ff; }
.registered-client > div > span { display: block; margin-bottom: 6px; color: #52627a; font-size: 10px; font-weight: 700; }
.registered-client select { width: 100%; height: 36px; padding: 0 10px; border: 1px solid #cbd7eb; border-radius: 8px; color: #253044; background: #fff; font-size: 11px; }
.registered-client .text-button { align-self: center; padding: 9px 4px; }

.client-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 15px; margin-bottom: 20px; }
.client-metric { display: flex; align-items: center; gap: 13px; padding: 17px 19px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; box-shadow: var(--shadow-sm); }
.client-metric-icon { display: grid; width: 40px; height: 40px; place-items: center; border-radius: 11px; font-size: 12px; font-weight: 800; }
.client-metric-icon.blue { color: var(--blue); background: var(--blue-soft); }
.client-metric-icon.green { color: var(--green); background: var(--green-soft); }
.client-metric-icon.violet { color: var(--violet); background: #f2ecff; font-size: 9px; }
.client-metric div span, .client-metric div strong { display: block; }
.client-metric div span { margin-bottom: 3px; color: var(--muted); font-size: 10px; }
.client-metric div strong { color: #172235; font-size: 19px; }
.clients-panel { overflow: hidden; }
.panel-title, .panel-subtitle { display: block; }
.panel-title { color: #243044; font-size: 13px; }
.panel-subtitle { margin-top: 3px; color: var(--soft); font-size: 9px; }
.client-search { width: min(330px, 36vw); }
.clients-table .client-name-cell { min-width: 220px; }
.client-name-cell > div { display: flex; align-items: center; gap: 11px; }
.client-avatar { display: grid; width: 34px; height: 34px; flex: 0 0 auto; place-items: center; border-radius: 10px; color: #315faa; background: #eaf1ff; font-size: 10px; font-weight: 800; }
.client-name-cell strong, .client-name-cell span { display: block; }
.client-name-cell strong { max-width: 260px; overflow: hidden; color: #253044; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.client-name-cell span { margin-top: 3px; color: var(--soft); font-size: 9px; }
.rfc-text { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 10px; font-weight: 650; white-space: nowrap; }
.regime-text { display: block; max-width: 250px; color: #526072; font-size: 10px; line-height: 1.35; }
.source-badge { display: inline-flex; align-items: center; gap: 5px; padding: 5px 8px; border-radius: 99px; color: #526072; background: #f0f3f7; font-size: 9px; font-weight: 700; white-space: nowrap; }
.source-badge.pdf { color: #7b4d0d; background: #fff3df; }
.client-actions { display: flex; gap: 5px; }
.client-action { min-height: 29px; padding: 0 9px; border: 1px solid var(--line); border-radius: 7px; color: #526072; background: #fff; cursor: pointer; font-size: 9px; font-weight: 700; white-space: nowrap; }
.client-action:hover { border-color: #9db9ee; color: var(--blue); background: #f7faff; }
.client-action.primary { border-color: #d6e2fb; color: var(--blue); background: #edf3ff; }

.client-editor-heading { margin-bottom: 22px; }
.client-editor-layout { display: grid; grid-template-columns: 310px minmax(0, 1fr); gap: 20px; align-items: start; }
.csf-import-card { position: sticky; top: 86px; padding: 23px; }
.csf-icon { display: grid; width: 48px; height: 48px; margin-bottom: 17px; place-items: center; border-radius: 14px; color: #c33f3f; background: #fff0f0; font-size: 11px; font-weight: 850; letter-spacing: .05em; }
.csf-import-card h2 { margin-bottom: 7px; color: #182230; font-size: 18px; }
.csf-import-card > p:not(.eyebrow) { margin-bottom: 18px; color: var(--muted); font-size: 10px; line-height: 1.55; }
.pdf-dropzone { position: relative; display: grid; min-height: 155px; place-items: center; align-content: center; gap: 6px; padding: 20px; overflow: hidden; border: 1.5px dashed #aebdd1; border-radius: 12px; color: #43536a; background: #fafcff; cursor: pointer; text-align: center; transition: border-color .18s, background .18s, transform .18s; }
.pdf-dropzone:hover, .pdf-dropzone.dragging { border-color: var(--blue); background: #f2f6ff; transform: translateY(-1px); }
.pdf-dropzone input { position: absolute; inset: 0; z-index: 2; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.upload-icon { display: grid; width: 35px; height: 35px; margin-bottom: 3px; place-items: center; border-radius: 50%; color: var(--blue); background: var(--blue-soft); font-size: 18px; font-weight: 700; }
.pdf-dropzone strong { font-size: 11px; }
.pdf-dropzone small { color: var(--soft); font-size: 8px; }
.pdf-status { display: grid; grid-template-columns: 30px 1fr; gap: 9px; align-items: center; margin-top: 11px; padding: 10px; border: 1px solid #d7eadf; border-radius: 9px; background: #f3fbf7; }
.pdf-status.processing { border-color: #dce5f4; background: #f7f9fc; }
.pdf-status.error { border-color: #f3cdcd; background: #fff6f6; }
.pdf-status-icon { display: grid; width: 28px; height: 28px; place-items: center; border-radius: 8px; color: var(--green); background: #e1f6ed; font-size: 11px; font-weight: 800; }
.pdf-status.processing .pdf-status-icon { color: var(--blue); background: var(--blue-soft); animation: pulse 1s infinite alternate; }
.pdf-status.error .pdf-status-icon { color: var(--red); background: var(--red-soft); }
@keyframes pulse { to { opacity: .45; } }
.pdf-status strong, .pdf-status small { display: block; max-width: 210px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pdf-status strong { color: #344054; font-size: 9px; }
.pdf-status small { margin-top: 2px; color: var(--muted); font-size: 8px; }
.privacy-note { display: flex; gap: 9px; margin-top: 15px; padding: 11px; border-radius: 9px; color: #52627a; background: #f4f6f9; }
.privacy-note > span { color: var(--green); }
.privacy-note p { margin: 0; font-size: 8px; line-height: 1.5; }
.privacy-note strong { display: block; color: #344054; font-size: 9px; }
.extract-summary { margin-top: 14px; }
.extract-summary > span, .extract-summary > strong { font-size: 9px; }
.extract-summary > span { color: var(--muted); }
.extract-summary > strong { float: right; color: #344054; }
.extract-summary > div { height: 5px; margin-top: 7px; overflow: hidden; border-radius: 99px; background: #edf0f4; }
.extract-summary i { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--blue), #67a1ff); transition: width .35s; }
.client-form-card { padding: 24px; }
.client-form-section { display: grid; grid-template-columns: 34px 1fr; gap: 11px; align-items: start; margin-bottom: 19px; }
.client-form-section.divided { margin-top: 27px; padding-top: 23px; border-top: 1px solid var(--line); }
.section-number { display: grid; width: 32px; height: 32px; place-items: center; border-radius: 9px; color: var(--blue); background: var(--blue-soft); font-size: 9px; font-weight: 800; }
.client-form-section h2 { margin: 1px 0 3px; color: #1d2939; font-size: 14px; }
.client-form-section p { margin: 0; color: var(--muted); font-size: 9px; }
.client-form-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 26px; padding-top: 19px; border-top: 1px solid var(--line); }

.issuer-heading .title-line { justify-content: flex-start; }
.issuer-import-card { top: 86px; }
.issuer-preview-card { display: flex; align-items: center; gap: 11px; margin-top: 16px; padding: 13px; border: 1px solid #dce5f4; border-radius: 11px; background: linear-gradient(135deg, #f8fbff, #eef4ff); }
.issuer-preview-mark { display: grid; width: 39px; height: 39px; flex: 0 0 auto; place-items: center; border-radius: 10px; color: #fff; background: #172b4f; font-size: 10px; font-weight: 850; letter-spacing: .08em; }
.issuer-preview-card div { min-width: 0; }
.issuer-preview-card small, .issuer-preview-card strong, .issuer-preview-card div > span { display: block; }
.issuer-preview-card small { margin-bottom: 3px; color: var(--soft); font-size: 8px; }
.issuer-preview-card strong { overflow: hidden; color: #243044; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.issuer-preview-card div > span { margin-top: 3px; color: #607087; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 8px; }
.certificate-upload-row { display: grid; grid-template-columns: minmax(250px, 1fr) minmax(260px, 1fr); gap: 14px; align-items: stretch; }
.certificate-picker { position: relative; display: flex; min-height: 78px; align-items: center; gap: 12px; padding: 14px; overflow: hidden; border: 1.5px dashed #aebdd1; border-radius: 11px; color: #43536a; background: #fafcff; cursor: pointer; transition: border-color .18s, background .18s, transform .18s; }
.certificate-picker:hover, .certificate-picker.loaded { border-color: var(--blue); background: #f2f6ff; transform: translateY(-1px); }
.certificate-picker.error { border-color: #e7a8a8; background: #fff6f6; }
.certificate-picker input { position: absolute; inset: 0; z-index: 2; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.certificate-icon { display: grid; width: 42px; height: 42px; flex: 0 0 auto; place-items: center; border-radius: 11px; color: #315faa; background: #e8f0ff; font-size: 9px; font-weight: 850; letter-spacing: .06em; }
.certificate-picker strong, .certificate-picker small { display: block; }
.certificate-picker strong { color: #344054; font-size: 10px; }
.certificate-picker small { margin-top: 4px; color: var(--muted); font-size: 8px; line-height: 1.4; }
.certificate-serial-field { margin: 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: 11px; background: #fff; }
.certificate-serial-field input { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-weight: 750; letter-spacing: .04em; }
.certificate-serial-field small { display: block; margin-top: 6px; color: var(--muted); font-size: 8px; line-height: 1.4; }
.certificate-serial-field.valid { border-color: #b9e2d2; background: #f7fcfa; }
.certificate-serial-field.valid small { color: #087752; }
.issuer-security-note { display: flex; gap: 10px; margin-top: 24px; padding: 13px; border: 1px solid #f1deb5; border-radius: 10px; color: #76591d; background: #fffaf0; }
.issuer-security-note > span { display: grid; width: 25px; height: 25px; flex: 0 0 auto; place-items: center; border-radius: 50%; color: #8f6413; background: #ffefc9; font-size: 10px; font-weight: 850; }
.issuer-security-note p { margin: 0; font-size: 8px; line-height: 1.55; }
.issuer-security-note strong { display: block; margin-bottom: 2px; color: #604815; font-size: 9px; }

.placeholder-view { padding: 80px 20px; text-align: center; }
.placeholder-icon { display: grid; width: 70px; height: 70px; margin: 0 auto 18px; place-items: center; border-radius: 22px; color: var(--blue); background: var(--blue-soft); font-size: 30px; }
.placeholder-view h1 { margin-bottom: 8px; }
.placeholder-view p { color: var(--muted); }

.drawer-backdrop { position: fixed; inset: 0; z-index: 60; background: rgba(9, 21, 37, .44); backdrop-filter: blur(2px); }
.preview-drawer { position: fixed; inset: 0 0 0 auto; z-index: 70; display: flex; width: min(880px, 92vw); flex-direction: column; background: #f0f2f5; box-shadow: var(--shadow-lg); transform: translateX(105%); transition: transform .3s ease; }
.preview-drawer.open { transform: translateX(0); }
.preview-drawer > header { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px; border-bottom: 1px solid var(--line); background: #fff; }
.preview-drawer > header p { margin: 0 0 4px; color: var(--blue); font-size: 8px; font-weight: 800; letter-spacing: .13em; }
.preview-drawer > header h2 { margin: 0; font-size: 18px; }
.close-button { display: grid; width: 34px; height: 34px; place-items: center; border: 1px solid var(--line); border-radius: 8px; color: #667085; background: #fff; cursor: pointer; font-size: 22px; line-height: 1; }
.preview-toolbar { display: flex; align-items: center; justify-content: space-between; padding: 11px 24px; border-bottom: 1px solid var(--line); background: #fbfcfd; }
.preview-toolbar > div { display: flex; gap: 8px; }
.preview-scroll { flex: 1; overflow: auto; padding: 24px; }

.invoice-paper {
  position: relative;
  width: 100%;
  min-height: 980px;
  margin: 0 auto;
  padding: 42px 44px 34px;
  color: #111;
  background: #fff;
  box-shadow: 0 6px 22px rgba(15,23,42,.10);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 10px;
}
.invoice-watermark { position: absolute; top: 360px; left: 50%; color: rgba(183, 132, 48, .08); font-size: 82px; font-weight: 800; letter-spacing: .16em; transform: translateX(-50%) rotate(-26deg); pointer-events: none; }
.invoice-top { display: grid; grid-template-columns: 1fr 1fr; gap: 45px; margin-bottom: 20px; }
.invoice-logo { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.invoice-logo-mark { display: grid; width: 38px; height: 38px; place-items: center; border-radius: 8px; color: #fff; background: #142d4c; font-size: 13px; font-weight: 800; }
.invoice-logo strong { display: block; font-size: 15px; }
.invoice-logo span { color: #536277; font-size: 8px; letter-spacing: .08em; text-transform: uppercase; }
.invoice-meta-grid { display: grid; grid-template-columns: 118px 1fr; gap: 6px 8px; line-height: 1.28; }
.invoice-meta-grid b { font-size: 9px; }
.invoice-meta-grid span { word-break: break-word; }
.invoice-section-title { margin: 14px 0 9px; font-size: 15px; }
.invoice-concepts { width: 100%; border-collapse: collapse; font-size: 8px; }
.invoice-concepts th { padding: 7px 4px; border: 1px solid #222; background: #d7d7d7; text-align: center; }
.invoice-concepts td { padding: 6px 5px; border: 1px solid #222; text-align: center; vertical-align: top; }
.invoice-concepts td.description-cell { text-align: left; }
.invoice-concepts .amount { text-align: right; white-space: nowrap; }
.invoice-payment-totals { display: grid; grid-template-columns: 1.15fr .85fr; gap: 34px; margin-top: 18px; }
.invoice-payment { display: grid; grid-template-columns: 105px 1fr; gap: 7px 10px; }
.invoice-totals { display: grid; grid-template-columns: 1fr auto; gap: 7px 14px; align-self: start; font-size: 10px; }
.invoice-totals b:nth-last-child(-n+2) { font-size: 11px; }
.invoice-totals span { text-align: right; font-variant-numeric: tabular-nums; }
.invoice-tax-detail { margin-top: 13px; padding: 9px; border: 1px solid #aaa; background: #fafafa; }
.invoice-tax-detail strong { margin-right: 14px; }
.invoice-pending-stamp { display: grid; grid-template-columns: 105px 1fr; gap: 15px; align-items: center; margin-top: 32px; padding-top: 18px; border-top: 1px solid #ddd; }
.qr-placeholder { display: grid; width: 105px; height: 105px; place-items: center; border: 1px dashed #777; color: #777; background: repeating-linear-gradient(45deg, #fff, #fff 4px, #f5f5f5 4px, #f5f5f5 8px); text-align: center; font-size: 8px; line-height: 1.4; }
.invoice-pending-stamp h3 { margin: 0 0 7px; font-size: 12px; }
.invoice-pending-stamp p { margin: 0 0 6px; color: #444; font-size: 8px; line-height: 1.45; }
.invoice-legal { position: absolute; right: 44px; bottom: 30px; left: 44px; display: flex; justify-content: space-between; border-top: 1px solid #ddd; padding-top: 12px; font-size: 8px; }

.modal { width: min(520px, calc(100vw - 32px)); padding: 0; border: 0; border-radius: 17px; color: var(--ink); box-shadow: var(--shadow-lg); }
.modal::backdrop { background: rgba(9, 21, 37, .55); backdrop-filter: blur(3px); }
.modal form { position: relative; padding: 30px; }
.modal-close { position: absolute; top: 16px; right: 16px; }
.modal-illustration { display: grid; width: 50px; height: 50px; margin-bottom: 20px; place-items: center; border-radius: 15px; color: var(--blue); background: var(--blue-soft); }
.modal-illustration svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.modal h2 { margin-bottom: 9px; font-size: 22px; letter-spacing: -.025em; }
.modal > form > p:not(.eyebrow) { color: var(--muted); font-size: 12px; line-height: 1.6; }
.requirements { display: grid; gap: 10px; margin: 22px 0; }
.requirements div { display: grid; grid-template-columns: 27px 1fr; gap: 11px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: #fafbfc; }
.requirements div > span { display: grid; width: 26px; height: 26px; place-items: center; border-radius: 8px; color: var(--blue); background: var(--blue-soft); font-size: 10px; font-weight: 800; }
.requirements p { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.45; }
.requirements strong { display: block; color: #344054; font-size: 11px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 22px; }

.toast-region { position: fixed; z-index: 100; right: 24px; bottom: 24px; display: grid; gap: 8px; }
.toast { min-width: 280px; padding: 13px 16px; border: 1px solid #d5e0ef; border-radius: 10px; color: #24344b; background: #fff; box-shadow: 0 12px 35px rgba(15, 23, 42, .17); animation: toast-in .25s ease-out; font-size: 11px; }
.toast strong { display: block; margin-bottom: 2px; }
.toast.success { border-left: 4px solid var(--green); }
.toast.warning { border-left: 4px solid var(--amber); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

@media (max-width: 1180px) {
  .metrics-grid { grid-template-columns: repeat(2, 1fr); }
  .editor-layout { grid-template-columns: minmax(0, 1fr) 270px; }
  .client-editor-layout { grid-template-columns: 270px minmax(0, 1fr); }
  .form-grid { grid-template-columns: repeat(2, 1fr); }
  .concept-grid { grid-template-columns: 1fr 1fr 1fr; }
  .concept-grid .description, .concept-grid .tax-object { grid-column: span 2; }
}

@media (max-width: 900px) {
  .sidebar { transform: translateX(-105%); transition: transform .25s ease; }
  body.menu-open .sidebar { transform: translateX(0); box-shadow: var(--shadow-lg); }
  body.menu-open::after { content: ""; position: fixed; inset: 0; z-index: 25; background: rgba(9, 21, 37, .35); }
  .workspace { margin-left: 0; }
  .mobile-menu { display: grid; margin-right: 12px; }
  .topbar { justify-content: flex-start; padding: 0 20px; }
  .top-actions { margin-left: auto; }
  .content { padding: 30px 24px 60px; }
  .editor-layout { grid-template-columns: 1fr; }
  .editor-sidebar { position: static; grid-template-columns: 1fr 1fr; }
  .client-editor-layout { grid-template-columns: 1fr; }
  .certificate-upload-row { grid-template-columns: 1fr; }
  .csf-import-card { position: static; }
  .panel-toolbar { align-items: stretch; flex-direction: column; }
  .toolbar-actions { justify-content: space-between; }
  .search-box { width: 100%; }
}

@media (max-width: 640px) {
  .content { padding: 24px 15px 50px; }
  .page-heading { align-items: stretch; flex-direction: column; }
  .page-heading .button { width: 100%; }
  .metrics-grid { grid-template-columns: 1fr; }
  .client-metrics { grid-template-columns: 1fr; }
  .metric-card { padding: 16px; }
  .segmented { overflow-x: auto; padding-bottom: 2px; }
  .segmented button { flex: 0 0 auto; }
  .toolbar-actions { flex-direction: column; }
  .data-table th:nth-child(3), .data-table td:nth-child(3) { display: none; }
  .data-table th, .data-table td { padding-right: 11px; padding-left: 11px; }
  .client-avatar { display: none; }
  .invoice-editor-heading { grid-template-columns: auto 1fr; }
  .editor-actions { grid-column: span 2; }
  .editor-actions .button { flex: 1; padding: 0 10px; }
  .form-card { padding: 18px 14px; }
  .form-card-header { grid-template-columns: auto 1fr; }
  .form-card-header .text-button { grid-column: 2; justify-self: start; }
  .form-grid { grid-template-columns: 1fr; }
  .field.span-2, .field.span-4, .span-4 { grid-column: span 1; }
  .registered-client { grid-template-columns: 1fr; }
  .registered-client .button, .registered-client .text-button { width: 100%; }
  .client-editor-heading .button { grid-column: span 2; width: 100%; }
  .client-form-card { padding: 18px 14px; }
  .clients-table th:nth-child(3), .clients-table td:nth-child(3), .clients-table th:nth-child(4), .clients-table td:nth-child(4) { display: none; }
  .concept-grid { grid-template-columns: 1fr 1fr; }
  .concept-grid .description, .concept-grid .tax-object { grid-column: span 2; }
  .editor-sidebar { grid-template-columns: 1fr; }
  .preview-drawer { width: 100vw; }
  .preview-scroll { padding: 12px; }
  .preview-toolbar { align-items: flex-start; gap: 10px; flex-direction: column; }
  .invoice-paper { min-width: 720px; }
  .toast-region { right: 12px; bottom: 12px; left: 12px; }
  .toast { min-width: 0; }
}

@media print {
  @page { size: letter; margin: 0; }
  body { background: #fff; }
  body > *:not(.preview-drawer) { display: none !important; }
  .preview-drawer { position: static; display: block; width: auto; transform: none; background: #fff; box-shadow: none; }
  .preview-drawer > header, .preview-toolbar { display: none !important; }
  .preview-scroll { overflow: visible; padding: 0; }
  .invoice-paper { width: 8.5in; min-height: 11in; padding: .45in .5in .35in; box-shadow: none; }
  .invoice-legal { right: .5in; bottom: .3in; left: .5in; }
}
