:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  color: #1b2b32;
  background: #f4f7f7;

  --font-ui: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --text-xs: 0.6875rem;
  --text-sm: 0.8125rem;
  --text-md: 0.9375rem;
  --text-lg: 1.125rem;
  --text-xl: 1.75rem;
  --text-display: clamp(1.75rem, 3vw, 2.125rem);
  --line-height: 1.55;
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --ink: #1b2b32;
  --muted: #697b81;
  --muted-light: #89979b;
  --line: #e1e9e8;
  --blue: #145d78;
  --blue-dark: #10465a;
  --blue-soft: #eaf4f5;
  --mint: #d8f0e7;
  --paper: #fff;
  --bg: #f4f7f7;
  --red: #a53a3a;
  --red-soft: #fff0ee;
  --green: #367250;
  --green-soft: #e3f4ea;
  --amber: #8a671c;
  --amber-soft: #fff4dd;
  --shadow: 0 12px 32px rgb(29 54 70 / 5%);
  --radius: 0.75rem;
  --radius-sm: 0.5rem;
}

* { box-sizing: border-box; }
html { min-width: 320px; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--ink); font: 400 var(--text-sm)/var(--line-height) var(--font-ui); }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }
button, a, input, select { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid rgb(20 93 120 / 28%); outline-offset: 2px; }

.topbar { min-height: 4.75rem; display: flex; align-items: center; gap: clamp(1rem, 3.5vw, 3rem); padding: 0 max(1.25rem, calc((100vw - 1320px) / 2)); background: var(--paper); border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; gap: 0.7rem; flex: 0 0 auto; font-size: var(--text-md); font-weight: 750; letter-spacing: -0.025em; white-space: nowrap; }
.brand-logo { display: block; width: 6.2rem; max-height: 2.6rem; object-fit: contain; }
.brand > span { color: var(--blue-dark); font-size: var(--text-xs); font-weight: 720; letter-spacing: 0.04em; text-transform: uppercase; }
.brand small { display: block; margin-top: 0.1rem; color: var(--muted); font-size: 0.625rem; font-weight: 650; letter-spacing: 0.1em; text-transform: uppercase; }
.brand-mark { display: grid; width: 2.25rem; height: 2.25rem; place-items: center; border-radius: 0.7rem; color: #fff; background: var(--blue); font-size: 1.125rem; font-weight: 800; }
.topbar nav { display: flex; align-items: center; gap: clamp(0.7rem, 2vw, 1.5rem); flex: 1 1 auto; min-width: 0; align-self: stretch; }
.topbar nav a { display: inline-flex; align-items: center; min-height: 100%; border-bottom: 2px solid transparent; color: #5f7278; font-size: var(--text-sm); font-weight: 600; white-space: nowrap; }
.topbar nav a:hover { border-color: #84bdad; color: var(--blue); }
.topbar nav .nav-cta { min-height: 2.55rem; align-self: center; padding: 0.3rem 0.9rem; border: 0; border-radius: var(--radius-sm); background: var(--mint); color: #174e45; }
.account { display: flex; align-items: center; gap: 0.9rem; flex: 0 0 auto; color: var(--muted); font-size: var(--text-xs); white-space: nowrap; }
.account form { margin: 0; }
.link-button { border: 0; padding: 0; color: var(--blue); background: transparent; font: 650 var(--text-xs)/1 var(--font-ui); cursor: pointer; }
.container { width: min(100%, 1384px); margin: 0 auto; padding: 2.5rem clamp(1rem, 3vw, 2.25rem) 1.5rem; }
.page-heading { display: flex; align-items: center; justify-content: space-between; gap: 1.25rem; margin: 0 0 1.7rem; }
.page-heading h1 { margin: 0.25rem 0 0; font-size: var(--text-display); line-height: 1.15; letter-spacing: -0.045em; font-weight: 730; }
.page-heading p { margin: 0.5rem 0 0; }
.eyebrow { color: #4b857a; font-size: var(--text-xs); line-height: 1.3; font-weight: 750; letter-spacing: 0.13em; text-transform: uppercase; }
.muted { color: var(--muted); font-size: var(--text-sm); line-height: var(--line-height); }

.button { display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; min-height: 2.65rem; padding: 0 1rem; border: 1px solid transparent; border-radius: var(--radius-sm); font: 700 var(--text-sm)/1 var(--font-ui); cursor: pointer; transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease; }
.button:disabled { opacity: 0.5; cursor: not-allowed; }
.primary { color: #fff; background: var(--blue); }
.primary:hover:not(:disabled) { background: var(--blue-dark); }
.secondary { color: #42565d; background: #fff; border-color: #d5e0e0; }
.secondary:hover:not(:disabled) { color: var(--blue); border-color: #9bb5ba; }
.danger { color: #963a35; background: #fff; border-color: #edcfca; }
.danger:hover:not(:disabled) { background: var(--red-soft); border-color: #d9a9a2; }
.button.small { min-height: 2.1rem; padding: 0 0.7rem; font-size: var(--text-xs); }
.full { width: 100%; margin-top: 0.35rem; }
.button-row, .form-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 0.65rem; }
.button-row { justify-content: flex-start; margin: 0.9rem 0 1.15rem; }

.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; margin-bottom: 1.4rem; }
.stat, .panel { min-width: 0; border: 1px solid #e5eceb; border-radius: var(--radius); background: var(--paper); box-shadow: var(--shadow); }
.stat { padding: 1.2rem 1.35rem; }
.stat span, .stat small { display: block; color: var(--muted); font-size: var(--text-xs); }
.stat strong { display: block; margin: 0.65rem 0 0.2rem; font-size: 1.7rem; line-height: 1.1; font-weight: 730; letter-spacing: -0.035em; }
.stat .stat-state { color: var(--amber); font-size: 1.2rem; }
.panel { margin-bottom: 1.15rem; padding: 1.45rem; }
.panel h2 { margin: 0 0 0.4rem; font-size: var(--text-lg); line-height: 1.3; font-weight: 720; letter-spacing: -0.02em; }
.panel h3 { margin: 1.2rem 0 0.75rem; font-size: var(--text-sm); font-weight: 720; }
.panel p { max-width: 80ch; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.section-heading h2 { margin: 0; }
.section-heading p { margin: 0.25rem 0 0; }
.text-link { color: var(--blue); font-size: var(--text-xs); font-weight: 720; }
.text-link:hover { text-decoration: underline; }
.count { display: inline-flex; align-items: center; min-height: 1.6rem; padding: 0 0.65rem; border-radius: 99px; color: #5e7077; background: #f0f5f4; font-size: var(--text-xs); font-weight: 680; }
.notice { display: flex; flex-direction: column; gap: 0.2rem; margin-top: 1.3rem; padding: 0.85rem 1rem; border-left: 3px solid #76ab9d; border-radius: 0.35rem; color: #5a6b70; background: #f1f7f6; font-size: var(--text-xs); line-height: var(--line-height); }
.notice strong { color: #315b53; }

.table-wrap { width: 100%; min-width: 0; overflow-x: auto; }
table { width: 100%; min-width: 610px; border-collapse: collapse; text-align: left; }
table.company-table { min-width: 0; table-layout: fixed; }
table.company-table th, table.company-table td { overflow-wrap: anywhere; white-space: normal; }
th { padding: 0.7rem 0.65rem; border-bottom: 1px solid var(--line); color: var(--muted-light); font-size: 0.625rem; font-weight: 740; letter-spacing: 0.06em; text-transform: uppercase; white-space: nowrap; }
td { padding: 0.85rem 0.65rem; border-bottom: 1px solid #edf1f0; color: #485a60; font-size: var(--text-xs); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td strong { color: #273a41; }
.table-link { display: flex; flex-direction: column; gap: 0.15rem; }
.table-link small, td small { display: block; margin-top: 0.2rem; color: #8b999d; font-size: 0.625rem; }
.url-cell { max-width: 26rem; overflow-wrap: anywhere; white-space: normal; }
.badge { display: inline-flex; align-items: center; padding: 0.27rem 0.55rem; border-radius: 99px; font-size: 0.625rem; line-height: 1.2; font-weight: 730; }
.badge.gray { color: #697780; background: #eff2f3; }
.badge.green { color: var(--green); background: var(--green-soft); }
.badge.amber { color: var(--amber); background: var(--amber-soft); }
.empty { padding: 1.8rem; color: #91a0a4; text-align: center; white-space: normal; }
.two-column { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr); gap: 1.1rem; align-items: start; }
.two-column > .panel { min-width: 0; }
.two-column .panel { padding: 1.3rem; }
.catalog-layout { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.catalog-layout > .panel { min-width: 0; width: 100%; }
.catalog-list, .catalog-builder, .catalog-form { min-width: 0; }
.catalog-search { margin: 0.85rem 0; }
.catalog-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; }
.catalog-actions form { margin: 0; }
.catalog-lines { max-width: 24rem; white-space: normal; line-height: 1.6; }
.catalog-form-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 1rem; }
.catalog-form .catalog-save { margin-top: 0.8rem; }
.template-service-picker { margin: 0.5rem 0 0.9rem; padding: 0.8rem; border-radius: var(--radius-sm); background: #f6f9f9; }
.template-service-picker .button { flex: 0 0 auto; }

.panel form > label, .auth-card form label { display: flex; flex-direction: column; gap: 0.4rem; margin: 0 0 0.8rem; color: #596b71; font-size: var(--text-xs); font-weight: 680; }
.panel input, .panel select, .auth-card input, .copy-row input { width: 100%; min-width: 0; min-height: 2.5rem; padding: 0.55rem 0.7rem; border: 1px solid #d5e0e0; border-radius: 0.45rem; outline: none; color: #24373e; background: #fff; font: 400 var(--text-sm)/1.3 var(--font-ui); }
.panel input:focus, .panel select:focus, .auth-card input:focus { border-color: #72a89d; box-shadow: 0 0 0 3px rgb(114 168 157 / 12%); }
.panel input.field-invalid, .panel select.field-invalid { border-color: #c84e4e; box-shadow: 0 0 0 3px rgb(200 78 78 / 12%); }
.panel input[type="checkbox"] { width: 1rem; min-height: 1rem; height: 1rem; margin: 0; padding: 0; accent-color: var(--blue); }
.panel input[type="file"] { min-height: auto; padding: 0.45rem; font-size: var(--text-xs); }
.panel input[type="file"]::file-selector-button { margin-right: 0.6rem; padding: 0.45rem 0.65rem; border: 0; border-radius: 0.35rem; color: var(--blue); background: var(--blue-soft); font: 700 var(--text-xs) var(--font-ui); cursor: pointer; }
.field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; }
.field-row.three { grid-template-columns: minmax(0, 0.7fr) minmax(0, 1fr) minmax(0, 0.65fr); }
.field-note { margin: 0.4rem 0 0.9rem; color: var(--muted-light); font-size: var(--text-xs); line-height: var(--line-height); }
.lookup-result { margin: -0.25rem 0 0.9rem; padding: 0.7rem 0.8rem; border: 1px solid #e2ece9; border-radius: var(--radius-sm); color: #5d7278; background: #f6faf9; font-size: var(--text-xs); line-height: var(--line-height); }
.lookup-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.55rem; margin: -0.2rem 0 1rem; padding: 0.8rem; border: 1px solid #e1e9e8; border-radius: var(--radius-sm); background: #f8fbfa; }
.lookup-actions[hidden] { display: none; }
.lookup-actions button { min-height: 2.5rem; }
.alert-panel { border-color: #ecd8ad; background: #fffcf4; }
.alert-panel h2 { color: #745b20; }
.alert-panel .button-row { margin-bottom: 0.5rem; }
.alert-panel .button-row form { margin: 0; }
.invite-again { display: flex; align-items: end; gap: 0.65rem; flex-wrap: wrap; margin-top: 0.8rem; padding-top: 0.8rem; border-top: 1px solid var(--line); }
.invite-again label { display: flex; flex: 1 1 15rem; flex-direction: column; gap: 0.35rem; color: #596b71; font-size: var(--text-xs); font-weight: 680; }
.invite-again input { width: 100%; min-width: 0; min-height: 2.5rem; padding: 0.55rem 0.7rem; border: 1px solid #d5e0e0; border-radius: 0.45rem; color: #24373e; background: #fff; font: 400 var(--text-sm)/1.3 var(--font-ui); }
.search { display: flex; gap: 0.55rem; margin-bottom: 0.9rem; }
.search input { flex: 1; }
.form-panel { max-width: 58rem; margin: 0 auto; }
.form-panel > .field-row, .form-panel > label { margin-bottom: 0.85rem; }
.line-items { margin: 0.5rem 0 1.1rem; padding: 1.25rem 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.line-items .section-heading { align-items: center; }
.line-row { display: grid; width: 100%; min-width: 0; grid-template-columns: minmax(0, 2fr) minmax(0, 0.6fr) minmax(0, 0.7fr) minmax(0, 1fr) minmax(0, 0.6fr) minmax(0, 1fr) 1.5rem; align-items: end; gap: 0.45rem; margin: 0.5rem 0; padding: 0.75rem; border: 1px solid #edf0f2; border-radius: var(--radius-sm); background: #f8fafb; }
.line-row label { display: flex; min-width: 0; flex-direction: column; gap: 0.35rem; color: #77838a; font-size: 0.625rem; font-weight: 700; }
.label-with-help { display: flex; align-items: center; gap: 0.35rem; min-height: 1.1rem; }
.info-button { display: inline-grid; width: 1rem; height: 1rem; place-items: center; padding: 0; border: 1px solid #83aab5; border-radius: 50%; color: #145d78; background: #eef6f7; font: 750 0.65rem/1 var(--font-ui); cursor: pointer; }
.nature-dialog { width: min(92vw, 38rem); max-height: 85vh; padding: 1.4rem; border: 1px solid var(--line); border-radius: 0.8rem; color: var(--ink); background: #fff; box-shadow: 0 22px 70px rgb(22 44 52 / 22%); }
.nature-dialog::backdrop { background: rgb(17 35 42 / 42%); }
.nature-dialog p, .nature-dialog li { color: #596b71; font-size: var(--text-sm); line-height: 1.65; }
.nature-dialog ul { padding-left: 1.25rem; }
.service-picker { display: flex; align-items: end; gap: 0.6rem; margin: 0 0 0.8rem; }
.service-picker label { flex: 1; display: flex; flex-direction: column; gap: 0.35rem; color: #77838a; font-size: var(--text-xs); font-weight: 700; }
.service-picker select { width: 100%; min-width: 0; min-height: 2.5rem; padding: 0.5rem 0.65rem; border: 1px solid #d5e0e0; border-radius: 0.45rem; color: #24373e; background: #fff; font: 400 var(--text-sm)/1.3 var(--font-ui); }
.impersonation-banner { display: flex; align-items: center; justify-content: center; gap: 1rem; flex-wrap: wrap; padding: 0.65rem 1rem; color: #744c14; background: #fff2d4; border-bottom: 1px solid #efddb8; font-size: var(--text-xs); }
.impersonation-banner form { margin: 0; }
.line-row input, .line-row select { width: 100%; min-width: 0; height: 2.3rem; padding: 0.4rem; border: 1px solid #dce3e7; border-radius: 0.35rem; background: #fff; font: 400 var(--text-xs)/1.2 var(--font-ui); }
.remove-line { width: 1.75rem; height: 2.3rem; border: 0; color: #a86969; background: transparent; font-size: 1.4rem; cursor: pointer; }
.form-actions { margin-top: 1rem; }
.impersonation-controls { display: grid; grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.3fr); gap: 0.75rem; align-items: start; }
.impersonation-controls .search, .impersonation-picker { display: flex; min-width: 0; gap: 0.55rem; margin: 0; }
.impersonation-picker { align-items: center; }
.impersonation-picker input[type="hidden"] { display: none; }
.impersonation-picker select { flex: 1 1 auto; }
.superadmin-menu { position: relative; display: flex; align-items: center; }
.superadmin-menu summary { display: inline-flex; min-height: 100%; align-items: center; gap: 0.35rem; border-bottom: 2px solid transparent; color: #5f7278; font-size: var(--text-sm); font-weight: 650; white-space: nowrap; list-style: none; cursor: pointer; }
.superadmin-menu summary::-webkit-details-marker { display: none; }
.superadmin-menu[open] summary, .superadmin-menu summary:hover { border-color: #84bdad; color: var(--blue); }
.superadmin-menu-popover { position: absolute; z-index: 30; top: calc(100% + 0.65rem); left: 0; display: flex; width: min(17rem, calc(100vw - 2rem)); flex-direction: column; padding: 0.4rem; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; box-shadow: 0 14px 36px rgb(29 54 70 / 13%); }
.superadmin-menu-popover form { margin: 0; }
.superadmin-menu-popover .link-button { display: block; width: 100%; padding: 0.65rem 0.7rem; border-radius: 0.35rem; text-align: left; }
.superadmin-menu-popover .link-button:hover { color: var(--blue); background: #f2f7f6; }
.privacy-card { margin-top: 1.6rem; }

.document-tabs { display: flex; gap: 0.45rem; margin: 0 0 1rem; padding-bottom: 0.75rem; border-bottom: 1px solid var(--line); overflow-x: auto; }
.document-tabs a { padding: 0.55rem 0.85rem; border-radius: var(--radius-sm); color: var(--muted); font-weight: 650; white-space: nowrap; }
.document-tabs a.active { color: var(--blue-dark); background: var(--blue-soft); }
.pdf-preview { margin-top: 1.2rem; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.pdf-preview summary { padding: 0.8rem 1rem; color: var(--blue); font-weight: 700; cursor: pointer; }
.pdf-preview iframe { display: block; width: 100%; height: 560px; border: 0; background: #eef2f2; }
.pdf-preview .field-note { padding: 0 1rem 0.75rem; }
.company-logo-preview { display: block; width: min(100%, 360px); height: 150px; margin: 1rem 0; padding: 1rem; object-fit: contain; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; }
.logo-placeholder { display: grid; width: min(100%, 360px); height: 150px; margin: 1rem 0; place-items: center; border: 1px dashed #b5c7c7; border-radius: var(--radius-sm); color: var(--muted); background: #fbfdfd; }
.stats-four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.year-filter { display: flex; align-items: center; gap: 0.55rem; }
.year-filter label { color: var(--muted); font-weight: 650; }
.year-filter select { min-width: 6rem; }
.bar-chart { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 0.55rem; min-height: 190px; align-items: stretch; padding: 1.2rem 0.25rem 0; }
.chart-month { display: flex; min-width: 0; flex-direction: column; align-items: center; gap: 0.45rem; color: var(--muted); }
.chart-bars { display: flex; align-items: end; justify-content: center; gap: 0.2rem; width: 100%; height: 155px; border-bottom: 1px solid var(--line); }
.chart-bar { width: min(34%, 1rem); min-height: 2px; border-radius: 0.25rem 0.25rem 0 0; }
.chart-bar.sales, .chart-legend i.sales { background: #2b8c79; }
.chart-bar.vat, .chart-legend i.vat { background: #8bb3d2; }
.chart-month small { font-size: var(--text-xs); }
.chart-legend { display: flex; gap: 0.85rem; color: var(--muted); font-size: var(--text-xs); }
.chart-legend span { display: inline-flex; align-items: center; gap: 0.35rem; }
.chart-legend i { display: inline-block; width: 0.55rem; height: 0.55rem; border-radius: 0.12rem; }
.stats-four .stat { min-width: 0; }
.stats-four .stat strong { font-size: clamp(1.15rem, 2vw, 1.6rem); }
.alert { margin: 0 0 1.1rem; padding: 0.75rem 0.9rem; border: 1px solid transparent; border-radius: var(--radius-sm); font-size: var(--text-xs); line-height: var(--line-height); }
.alert.error { color: #923e36; background: var(--red-soft); border-color: #f0d1cd; }
.alert.success { color: #32714e; background: #eaf6ed; border-color: #d0e8d7; }
.alert.info { color: #3f6878; background: #eef5f7; border-color: #d4e3e9; }
.import-errors { margin: 0.6rem 0 0; padding-left: 1.2rem; }
.detail-grid { grid-template-columns: minmax(0, 1.25fr) minmax(17rem, 0.75fr); }
.detail-total { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin: 0.75rem 0 1.1rem; padding: 1rem; border-radius: var(--radius-sm); color: #62727a; background: #f5f8f8; font-size: var(--text-xs); }
.detail-total strong { color: #172d37; font-size: 1.4rem; letter-spacing: -0.02em; }
.timeline { margin: 1.25rem 0; padding: 0; list-style: none; }
.timeline li { position: relative; display: flex; gap: 0.7rem; padding-bottom: 1.25rem; }
.timeline li:not(:last-child)::after { position: absolute; top: 0.9rem; bottom: 0; left: 0.3rem; width: 1px; background: #dce6e3; content: ""; }
.timeline-dot { position: relative; z-index: 1; width: 0.7rem; height: 0.7rem; flex: 0 0 0.7rem; margin-top: 0.15rem; border: 2px solid #77a99e; border-radius: 50%; background: #fff; }
.timeline li strong, .timeline li small { display: block; }
.timeline li strong { font-size: var(--text-xs); }
.timeline li small { margin-top: 0.25rem; color: var(--muted-light); font-size: 0.625rem; }
.copy-row { display: flex; gap: 0.6rem; margin: 0.8rem 0 0.55rem; }
.result-panel { border-color: #cce3d8; background: #fafffc; }
.result-panel p, .result-panel small { color: #647770; font-size: var(--text-xs); }
.result-panel h2 { margin-top: 0.35rem; }
.result-panel input { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: var(--text-xs); }
.secret-panel { border-color: #c1ddd0; }
.inline-form, .integration-form { margin-top: 1.2rem; padding-top: 1.1rem; border-top: 1px solid var(--line); }
.integration-form h3 { margin-top: 0; }
.integrations-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.integration-form .scope-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.6rem 1rem; margin: 0 0 1rem; padding: 0.8rem; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.scope-list legend { padding: 0 0.3rem; color: var(--muted); font-size: var(--text-xs); font-weight: 700; }
.scope-list label { display: flex; align-items: center; gap: 0.5rem; color: #53666c; font-size: var(--text-xs); }
.action-stack { display: flex; align-items: center; gap: 0.4rem; }
.action-stack form { margin: 0; }
.api-hint { display: flex; flex-direction: column; gap: 0.35rem; margin-top: 1.2rem; padding: 0.9rem; border-radius: var(--radius-sm); background: #f2f7f7; color: var(--muted); font-size: var(--text-xs); }
.api-hint strong { color: var(--ink); }
.api-hint code, .webhook-help code { color: #245d70; font: 650 var(--text-xs)/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; }
.feature-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.75rem; }
.feature-list p { display: flex; flex-direction: column; gap: 0.25rem; margin: 0; padding: 0.8rem; border: 1px solid #edf1f0; border-radius: var(--radius-sm); color: var(--muted); font-size: var(--text-xs); }
.feature-list strong { color: var(--ink); }
.upload-form { margin: 1rem 0 0.75rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.archive-form { margin-top: 1.2rem; padding-top: 1rem; border-top: 1px solid var(--line); }

.auth-body { display: grid; min-height: 100vh; place-items: center; padding: 1.5rem; background: radial-gradient(ellipse at 25% 20%, #e8f2ef 0, transparent 43%), var(--bg); }
.auth-card { width: min(100%, 27rem); padding: 2.25rem 2.25rem 1.8rem; border: 1px solid var(--line); border-radius: 0.9rem; background: #fff; box-shadow: 0 25px 70px rgb(26 51 63 / 10%); }
.auth-card .brand { margin-bottom: 2.25rem; }
.auth-card h1 { margin: 0.5rem 0; font-size: 1.65rem; line-height: 1.2; letter-spacing: -0.04em; }
.auth-card .eyebrow { margin-bottom: 0.5rem; }
.auth-card .muted { margin: 0 0 1.4rem; }
.auth-card .tiny { margin: 1rem 0 0; color: var(--muted); font-size: var(--text-xs); text-align: center; }
.auth-card label { margin-bottom: 0.9rem !important; }
.auth-card input { min-height: 2.75rem; }
.auth-card .alert { margin-bottom: 1.1rem; }
.auth-links { margin: 0.9rem 0 0; color: var(--blue); font-size: var(--text-xs); font-weight: 680; text-align: center; }
.auth-links a:hover { text-decoration: underline; }
.auth-card .field-note { margin: 0; color: var(--muted-light); font-size: 0.625rem; font-weight: 450; }
footer { display: flex; justify-content: space-between; gap: 1rem; padding: 1.1rem 0.15rem 0.45rem; color: #9aa7aa; font-size: 0.625rem; }

@media (max-width: 1120px) {
  .topbar { flex-wrap: wrap; gap: 0 1.3rem; padding: 0.7rem 1.2rem; }
  .topbar nav { order: 3; flex-basis: 100%; min-height: 2.6rem; overflow-x: auto; }
  .topbar nav a { min-height: 2.5rem; }
  .account { margin-left: auto; }
  .container { padding-top: 1.8rem; }
  .line-row { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.5rem; }
  .line-row label:first-child { grid-column: 1 / -1; }
  .line-row label:nth-of-type(6) { grid-column: span 2; }
  .remove-line { grid-column: 3; justify-self: end; }
  .impersonation-controls { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 760px) {
  .topbar { padding: 0.7rem 1rem; }
  .topbar nav { gap: 1rem; }
  .account > span { display: none; }
  .container { padding: 1.5rem 1rem 1rem; }
  .page-heading { align-items: flex-start; flex-direction: column; }
  .stats, .two-column, .detail-grid, .integrations-grid, .stats-four { grid-template-columns: minmax(0, 1fr); }
  .stats { gap: 0.65rem; }
  .page-heading { align-items: flex-start; flex-direction: column; }
  .year-filter { align-self: stretch; }
  .bar-chart { gap: 0.2rem; }
  .chart-bars { height: 125px; }
  .chart-month small { font-size: 0.58rem; }
  .pdf-preview iframe { height: 420px; }
  .stat { padding: 0.9rem 1rem; }
  .stat strong { margin: 0.4rem 0 0.15rem; font-size: 1.4rem; }
  .panel { padding: 1.1rem; }
  .two-column .panel { padding: 1.1rem; }
  .field-row, .field-row.three { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .line-row { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.55rem; }
  .line-row label:first-child { grid-column: 1 / -1; }
  .line-row label:nth-of-type(6) { grid-column: 1 / -1; }
  .remove-line { grid-column: 2; justify-self: end; }
  .copy-row, .search { align-items: stretch; flex-direction: column; }
  .copy-row input { font-size: 0.625rem; }
  .feature-list { grid-template-columns: minmax(0, 1fr); }
  .integration-form .scope-list { grid-template-columns: minmax(0, 1fr); }
  .action-stack { align-items: flex-start; flex-direction: column; }
  footer { flex-direction: column; gap: 0.3rem; }
  .auth-card { padding: 1.9rem 1.5rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; }
}

.panel form > label.check-row { display: flex; flex-direction: row; align-items: flex-start; gap: 0.65rem; margin: 0.7rem 0; color: var(--ink); font-weight: 500; line-height: var(--line-height); }
.panel form > label.check-row input { flex: 0 0 1rem; margin-top: 0.2rem; }
.notification-events { margin: 0.75rem 0 1.1rem; padding: 0.75rem 0.9rem; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.notification-events legend { padding: 0 0.35rem; color: var(--ink); font-size: var(--text-xs); font-weight: 700; }
.notification-events .check-row { display: flex; align-items: flex-start; gap: 0.6rem; margin: 0.4rem 0; color: var(--muted); font-size: var(--text-xs); line-height: var(--line-height); }
.notification-events .check-row input { flex: 0 0 1rem; margin-top: 0.15rem; }
.panel pre { max-width: 100%; overflow: auto; margin: 0.8rem 0 1rem; padding: 1rem; border: 1px solid #e4ebeb; border-radius: var(--radius-sm); color: #e8f2f1; background: #172c35; font: 400 0.75rem/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; tab-size: 2; }
.panel pre code { white-space: pre; }
.panel code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; overflow-wrap: anywhere; }

/* Account menu and profile preferences */
.account-menu { position: relative; }
.account-menu summary { display: flex; align-items: center; gap: 0.6rem; list-style: none; cursor: pointer; }
.account-menu summary::-webkit-details-marker { display: none; }
.account-avatar { display: grid; width: 2.15rem; height: 2.15rem; flex: 0 0 2.15rem; place-items: center; overflow: hidden; border: 1px solid #d8e7e3; border-radius: 50%; color: #245d58; background: #e8f3ef; font-size: var(--text-xs); font-weight: 760; }
.account-avatar img { width: 100%; height: 100%; object-fit: cover; }
.account-identity { display: flex; max-width: 13rem; flex-direction: column; gap: 0.08rem; overflow: hidden; }
.account-identity strong { overflow: hidden; color: #344b52; font-size: var(--text-xs); font-weight: 700; text-overflow: ellipsis; }
.account-identity small { overflow: hidden; color: var(--muted-light); font-size: 0.625rem; text-overflow: ellipsis; }
.account-chevron { color: var(--muted); font-size: 1rem; }
.account-menu-popover { position: absolute; z-index: 20; top: calc(100% + 0.65rem); right: 0; display: flex; width: min(17rem, calc(100vw - 2rem)); max-height: min(75vh, 36rem); flex-direction: column; overflow-y: auto; padding: 0.45rem; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; box-shadow: 0 14px 36px rgb(29 54 70 / 13%); }
.account-menu-popover > a, .account-menu-popover > form > button { display: block; width: 100%; padding: 0.65rem 0.7rem; border: 0; border-radius: 0.35rem; color: #41575e; background: transparent; font: 650 var(--text-xs)/1.35 var(--font-ui); text-align: left; }
.account-menu-popover > a:hover, .account-menu-popover > form > button:hover { color: var(--blue); background: #f2f7f6; }
.account-menu-popover > form { margin: 0.35rem 0 0; padding-top: 0.35rem; border-top: 1px solid var(--line); }
.account-menu-divider { display: block; height: 1px; flex: 0 0 1px; margin: 0.35rem 0; background: var(--line); }
.account-menu-note { padding: 0.4rem 0.7rem; color: #4e8176; font-size: 0.625rem; }
.profile-option { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin: 1.2rem 0; padding: 1rem; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #f8fbfa; }
.profile-option strong { color: #30474e; font-size: var(--text-sm); }
.profile-option p { margin: 0.25rem 0 0; color: var(--muted); font-size: var(--text-xs); }
.toggle-label { display: flex; flex: 0 0 auto; align-items: center; gap: 0.45rem; color: #53666c; font-size: var(--text-xs); font-weight: 700; }
.toggle-label input { width: 1rem !important; min-height: 1rem !important; height: 1rem; accent-color: var(--blue); }
.customer-editor-form > .customer-save { margin-top: 0.9rem; }
.customer-lookup { display: flex; align-items: center; flex-wrap: wrap; gap: 0.5rem 0.75rem; margin: -0.25rem 0 0.95rem; }
.customer-lookup span { min-width: 0; flex: 1 1 12rem; color: var(--muted); font-size: var(--text-xs); line-height: var(--line-height); }
.customer-lookup .button { white-space: nowrap; }
.customer-lookup .button[hidden] { display: none; }
.lookup-spinner { width: 0.85rem; height: 0.85rem; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: lookup-spin 700ms linear infinite; }
@keyframes lookup-spin { to { transform: rotate(360deg); } }
.profile-photo-row { display: flex; align-items: center; gap: 1rem; margin: 1rem 0 1.25rem; }
.profile-avatar-preview, .profile-avatar-placeholder { display: grid; width: 4.5rem; height: 4.5rem; flex: 0 0 4.5rem; place-items: center; overflow: hidden; border: 1px solid #d8e7e3; border-radius: 50%; color: #245d58; background: #e8f3ef; font-size: var(--text-lg); font-weight: 760; object-fit: cover; }
.profile-photo-row > div { min-width: 0; flex: 1 1 auto; }
.selected-row { background: #f2f8f6; }
.selected-row td:first-child { box-shadow: inset 3px 0 #69a796; }
.customer-editor > .section-heading { align-items: center; }
.event-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.5rem; margin: 0 0 0.9rem; padding: 0.8rem; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.event-list legend { padding: 0 0.3rem; color: var(--muted); font-size: var(--text-xs); font-weight: 700; }
.event-option { display: flex !important; align-items: center; gap: 0.55rem !important; margin: 0 !important; padding: 0.45rem; border-radius: 0.35rem; cursor: pointer; }
.event-option:hover { background: #f5f9f8; }
.event-option input { width: 1rem !important; min-height: 1rem !important; height: 1rem; flex: 0 0 1rem; accent-color: var(--blue); }
.event-option span, .event-option small { display: block; }
.event-option strong { color: #41575e; font-size: var(--text-xs); }
.event-option small { margin-top: 0.05rem; color: var(--muted-light); font-size: 0.625rem; }

@media (max-width: 760px) {
  .account-identity { display: none; }
  .account-menu-popover { top: calc(100% + 0.45rem); }
  .profile-option { align-items: flex-start; flex-direction: column; }
  .customer-lookup { align-items: flex-start; flex-direction: column; }
  .service-picker { align-items: stretch; flex-direction: column; }
  .impersonation-picker { align-items: stretch; flex-direction: column; }
  .impersonation-picker .button { width: 100%; }
  .privacy-card { margin-top: 1.2rem; }
}

.billing-plan { width: min(100%, 74rem); max-width: none; margin: 1.7rem auto; padding: clamp(1.35rem, 3vw, 2.5rem); border: 1px solid #dce8e6; border-top: 4px solid var(--blue); background: linear-gradient(145deg, #fff 0%, #fbfdfd 100%); box-shadow: 0 20px 48px rgb(29 54 70 / 7%); }
.billing-overview { display: grid; gap: 1.2rem; }
.billing-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.billing-metric { min-width: 0; padding: 1.4rem; }
.billing-metric strong { display: block; margin: 0.75rem 0 0.3rem; color: var(--ink); font-size: clamp(1.45rem, 2.5vw, 2rem); letter-spacing: -0.04em; line-height: 1.15; overflow-wrap: anywhere; }
.billing-metric p { margin: 0; color: var(--muted); font-size: var(--text-sm); }
.billing-tables { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.billing-tables .panel { min-width: 0; }
.billing-tables .section-heading { margin-bottom: 1rem; }
.billing-tables table { min-width: 28rem; }
.billing-intro { margin-bottom: 1.6rem; }
.billing-intro h2 { margin: 0.4rem 0 0.45rem; color: var(--ink); font-size: clamp(1.65rem, 3vw, 2.3rem); letter-spacing: -0.04em; }
.billing-intro p { max-width: 60ch; margin: 0; color: var(--muted); font-size: var(--text-md); }
.billing-price { margin: 1rem 0; color: var(--blue); font-size: clamp(2.4rem, 8vw, 4rem); font-weight: 780; letter-spacing: -0.055em; line-height: 1; }
.billing-price small { color: var(--muted); font-size: var(--text-sm); font-weight: 600; letter-spacing: 0; }
.billing-plan [data-paypal-checkout] { width: 100%; min-height: 2.8rem; max-width: none; margin: 0.25rem 0 0; }
.billing-plan [data-paypal-checkout][aria-busy="true"] { opacity: 0.6; pointer-events: none; }
.billing-plan .field-note { max-width: 42rem; }
.billing-footnotes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.4rem; margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.billing-footnotes .field-note { margin: 0; }
.paypal-plans-heading { align-items: center; margin: 1.4rem 0 0.8rem; }
.paypal-plans-heading h3 { margin: 0; }
.paypal-plan-list { display: grid; gap: 0.8rem; }
.paypal-plan-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; align-items: end; gap: 0.75rem; padding: 0.9rem; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #f8fbfa; }
.paypal-plan-row label { min-width: 0; }
.paypal-plan-description { grid-column: 1 / -1; }
.paypal-plan-description textarea { min-height: 5rem; resize: vertical; }
.paypal-plan-row .button { margin-bottom: 0.1rem; white-space: nowrap; }
.paypal-plan-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 25rem), 1fr)); gap: clamp(1rem, 2vw, 1.5rem); }
.paypal-plan-option { position: relative; display: flex; min-width: 0; min-height: 31rem; flex-direction: column; padding: clamp(1.35rem, 2.3vw, 2rem); overflow: hidden; border: 1px solid #dce8e6; border-radius: 0.9rem; background: linear-gradient(155deg, #fff 18%, #f7fbfa 100%); box-shadow: 0 8px 24px rgb(29 54 70 / 5%); transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease; }
.paypal-plan-option::before { position: absolute; top: 0; right: 0; left: 0; height: 3px; background: linear-gradient(90deg, #145d78, #78b3a4 75%, #d8f0e7); content: ""; }
.paypal-plan-option:hover { transform: translateY(-3px); border-color: #b7d2cc; box-shadow: 0 16px 34px rgb(29 54 70 / 9%); }
.plan-card-kicker { display: flex; align-items: center; justify-content: space-between; gap: 0.8rem; }
.plan-audience { display: inline-flex; max-width: 62%; align-items: center; padding: 0.35rem 0.65rem; border: 1px solid #d7e8e3; border-radius: 99px; color: #356b60; background: #eff7f4; font-size: 0.65rem; font-weight: 720; line-height: 1.25; text-align: center; }
.paypal-plan-option h2 { margin: 1rem 0 0.35rem; overflow-wrap: anywhere; color: var(--ink); font-size: clamp(1.45rem, 2vw, 1.8rem); line-height: 1.2; letter-spacing: -0.035em; }
.paypal-plan-option .billing-price { margin: 0.85rem 0 0.6rem; font-size: clamp(2.4rem, 4vw, 3.35rem); }
.paypal-plan-option .billing-price small { font-size: var(--text-sm); }
.plan-description { min-height: 4.5rem; margin: 0; color: #51676e; font-size: var(--text-md); line-height: 1.55; }
.paypal-plan-includes { display: grid; gap: 0.7rem; margin: 1.15rem 0 0; padding: 1.05rem 0 0; border-top: 1px solid #e4ecea; list-style: none; }
.paypal-plan-includes li { display: flex; align-items: flex-start; gap: 0.65rem; color: #405a61; font-size: var(--text-sm); line-height: 1.45; }
.paypal-plan-includes li span { display: grid; width: 1.2rem; height: 1.2rem; flex: 0 0 1.2rem; place-items: center; border-radius: 50%; color: #276c5b; background: #e1f2eb; font-size: 0.72rem; font-weight: 800; }
.plan-card-action { margin-top: auto; padding-top: 1.5rem; }
.plan-card-action > .field-note { margin: 0.4rem 0 0; }
.plan-card-action [data-paypal-checkout] { width: 100%; }

@media (max-width: 760px) {
  .billing-metrics, .billing-tables { grid-template-columns: minmax(0, 1fr); }
  .paypal-plan-row { grid-template-columns: minmax(0, 1fr); }
  .paypal-plan-row .button { justify-self: start; }
  .paypal-plan-description { grid-column: auto; }
  .paypal-plan-option { min-height: 0; }
  .plan-description { min-height: 0; }
  .billing-footnotes { grid-template-columns: minmax(0, 1fr); gap: 0.5rem; }
}

[hidden] { display: none !important; }
