:root {
  color-scheme: light;
  --lime: #d4ff3b;
  --charcoal: #121212;
  --bg: #f5f4f0;
  --ink: #121212;
  --on-ink: #d4ff3b;
  --accent: #d4ff3b;
  --muted: rgba(18, 18, 18, 0.62);
  --faint: rgba(18, 18, 18, 0.42);
  --line: rgba(18, 18, 18, 0.16);
  --line-strong: rgba(18, 18, 18, 0.28);
  --card: #ffffff;
  --danger: #b42318;
  --ok: #067647;
  --ok-bg: #ecfdf3;
  --ok-line: #abefc6;
  --danger-bg: #fef3f2;
  --danger-line: #fecdca;
  --status-blue: #175cd3;
  --status-red: #d92d20;
  --status-green: #067647;
  --topbar-bg: rgba(245, 244, 240, 0.92);
  --focus: color-mix(in srgb, var(--accent) 18%, transparent);
  --hover-row: rgba(18, 18, 18, 0.04);
  --overlay: rgba(18, 18, 18, 0.45);
  --btn: #121212;
  --btn-text: #d4ff3b;
  --btn-hover: #000000;
  --btn-icon-size: 36px;
  --btn-icon-bg: rgba(18, 18, 18, 0.06);
  --btn-icon-border: rgba(18, 18, 18, 0.18);
  --btn-icon-color: rgba(18, 18, 18, 0.55);
  --btn-icon-hover-bg: rgba(18, 18, 18, 0.1);
  --btn-icon-hover-border: rgba(18, 18, 18, 0.28);
  --shadow: 0 20px 60px rgba(18, 18, 18, 0.08), 0 1px 0 rgba(18, 18, 18, 0.04);
  --radius: 20px;
  --font: Outfit, Inter, system-ui, sans-serif;
  --display: Syne, Outfit, sans-serif;
  /* Mesma caixa do header do portal (logo → Sair) */
  --portal-max: 1440px;
  --portal-inline: clamp(40px, 8vw, 96px);
  --page-title-size: clamp(32px, 5vw, 52px);
  --page-title-tracking: -0.05em;
  --page-title-leading: 0.95;
  /* Modais — referência Agenda › Nova Tarefa */
  --modal-field-gap: 20px;
  --modal-label-gap: 8px;
  --modal-scroll-gutter: 12px;
  --modal-inline-pad: 16px;
  /* Atmosfera do portal (index) — usa accent/bg do usuário */
  --portal-wash:
    radial-gradient(80% 90% at 8% 10%, color-mix(in srgb, var(--accent, var(--lime)) 22%, transparent), transparent 58%),
    radial-gradient(70% 80% at 92% 20%, color-mix(in srgb, var(--accent, var(--lime)) 12%, transparent), transparent 52%),
    var(--bg);
}

html[data-theme="light"] {
  --portal-wash:
    radial-gradient(80% 90% at 8% 10%, color-mix(in srgb, var(--accent, var(--lime)) 28%, transparent), transparent 58%),
    radial-gradient(70% 80% at 92% 20%, color-mix(in srgb, var(--accent, var(--lime)) 14%, transparent), transparent 52%),
    var(--bg);
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121212;
  --ink: #ffffff;
  --on-ink: #121212;
  --accent: #d4ff3b;
  --muted: rgba(255, 255, 255, 0.62);
  --faint: rgba(255, 255, 255, 0.42);
  --line: rgba(255, 255, 255, 0.12);
  --line-strong: rgba(255, 255, 255, 0.22);
  --card: #1a1a1a;
  --danger: #f97066;
  --ok: #d4ff3b;
  --ok-bg: rgba(212, 255, 59, 0.12);
  --ok-line: rgba(212, 255, 59, 0.28);
  --danger-bg: rgba(180, 35, 24, 0.18);
  --danger-line: rgba(249, 112, 102, 0.28);
  --status-blue: #53b1fd;
  --status-red: #f97066;
  --status-green: #47cd89;
  --topbar-bg: rgba(18, 18, 18, 0.9);
  --focus: color-mix(in srgb, var(--accent) 22%, transparent);
  --hover-row: rgba(255, 255, 255, 0.04);
  --overlay: rgba(0, 0, 0, 0.62);
  --btn: #d4ff3b;
  --btn-text: #121212;
  --btn-hover: #eaff6a;
  --btn-icon-bg: rgba(255, 255, 255, 0.08);
  --btn-icon-border: rgba(255, 255, 255, 0.18);
  --btn-icon-color: rgba(255, 255, 255, 0.68);
  --btn-icon-hover-bg: rgba(255, 255, 255, 0.12);
  --btn-icon-hover-border: rgba(255, 255, 255, 0.28);
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.45), 0 1px 0 rgba(255, 255, 255, 0.04);
}

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

html, body { min-height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.2s ease, color 0.2s ease;
}

::selection {
  background: var(--btn);
  color: var(--btn-text);
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; }
img { max-width: 100%; display: block; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(24px);
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 12px 24px;
  min-height: 88px;
  height: auto;
  display: flex;
  align-items: center;
  gap: 28px;
}

.topbar-inner.wide {
  max-width: var(--portal-max);
  width: 100%;
  padding: 12px var(--portal-inline);
  box-sizing: border-box;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.brand-logo {
  display: none;
  height: 64px;
  width: auto;
  max-width: 360px;
  object-fit: contain;
  object-position: left center;
}

html[data-theme="light"] .brand-logo-light { display: block; }
html[data-theme="dark"] .brand-logo-dark { display: block; }

.brand-text {
  font-family: var(--display);
  font-weight: 800;
  letter-spacing: -0.04em;
  font-size: 15px;
}

.brand-text em {
  font-style: normal;
  font-weight: 400;
  color: var(--muted);
}

.nav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
}

.nav a {
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 14px;
  color: var(--muted);
}

.nav a:hover,
.nav a.is-active {
  color: var(--ink);
  background: var(--card);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.user-chip {
  font-size: 13px;
  color: var(--muted);
}

.page {
  max-width: 1280px;
  margin: 0 auto;
  padding: 28px 24px 80px;
}

.page.wide {
  max-width: var(--portal-max);
  padding: 20px var(--portal-inline) 80px;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
  flex-wrap: wrap;
  text-align: left;
}

.page-head h1 {
  margin: 0;
  font-family: var(--display);
  font-size: var(--page-title-size);
  font-weight: 800;
  letter-spacing: var(--page-title-tracking);
  line-height: var(--page-title-leading);
}

.page-head p {
  margin: 8px 0 0;
  color: var(--muted);
}

.stats {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 14px;
  margin-bottom: 22px;
}

.stat {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px 20px;
}

.stat .label {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
}

.stat .value {
  margin-top: 6px;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.03em;
}

.stat-aprovado {
  background: var(--status-blue);
  border-color: var(--status-blue);
}

.stat-reprovado {
  background: var(--status-red);
  border-color: var(--status-red);
}

.stat-enviadas {
  background: var(--status-green);
  border-color: var(--status-green);
}

.stat-aprovado .label,
.stat-reprovado .label,
.stat-enviadas .label {
  color: rgba(255, 255, 255, 0.78);
}

.stat-aprovado .value,
.stat-reprovado .value,
.stat-enviadas .value {
  color: #fff;
}

.chart-card {
  margin-bottom: 22px;
  padding: 22px 24px 24px;
}

.chart-title {
  margin: 0 0 20px;
  font-family: var(--display);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.chart-filters {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.chart-filters .select {
  min-width: 110px;
  height: 42px;
}

.chart-wrap {
  position: relative;
  height: 300px;
}

.toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 16px;
}

.search {
  flex: 1;
  min-width: 220px;
  height: 42px;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 999px;
  padding: 0 16px;
  outline: none;
}

.search:focus,
.field:focus,
.select:focus,
.area:focus {
  border-color: var(--accent, var(--lime));
  box-shadow: 0 0 0 3px var(--focus);
}

.filters {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.filters button {
  height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 14px;
  color: var(--muted);
}

.filters button.is-on {
  background: var(--btn-icon-hover-bg);
  color: var(--ink);
  border: 1px solid var(--btn-icon-hover-border);
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

body.measure-module .card,
body.measure-module .stat,
body.measure-module .panel,
body.measure-module .search,
body.measure-module .filters,
body.measure-module .chip,
body.measure-module .table-wrap,
body.measure-module .modal-card {
  background: var(--bg);
}

.table-wrap { overflow: auto; }

.proposals-table {
  overflow-x: hidden;
}

.proposals-table th,
.proposals-table td {
  white-space: normal;
  vertical-align: top;
}

.proposals-table td .sub {
  overflow-wrap: anywhere;
}

.proposals-table .row-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
  max-width: 100%;
}

.proposals-table .qty-cell {
  width: 1%;
  white-space: nowrap;
  padding-left: 8px;
  padding-right: 8px;
  text-align: center;
}

.qty-input {
  width: 3ch;
  min-width: 2.5ch;
  max-width: 5ch;
  height: 32px;
  padding: 0 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  text-align: center;
  font-weight: 600;
  -moz-appearance: textfield;
}

.qty-input::-webkit-outer-spin-button,
.qty-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.qty-input:focus {
  outline: none;
  border-color: var(--accent, var(--lime));
  box-shadow: 0 0 0 3px var(--focus);
}

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

th, td {
  text-align: left;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

th {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
  font-weight: 500;
}

tbody tr:hover td { background: var(--hover-row); }

td.strong { font-weight: 600; }
td .sub { display: block; color: var(--muted); font-weight: 400; font-size: 13px; }

.badge {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 13px;
  border: 1px solid var(--line);
  background: var(--bg);
}

.badge.rascunho {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border-color: rgba(59, 130, 246, 0.3);
}
.badge.enviada {
  background: rgba(71, 205, 137, 0.18);
  color: var(--status-green);
  border-color: rgba(71, 205, 137, 0.4);
}
.badge.aprovada {
  background: rgba(83, 177, 253, 0.18);
  color: var(--status-blue);
  border-color: rgba(83, 177, 253, 0.4);
}
.badge.recusada {
  background: rgba(217, 45, 32, 0.15);
  color: var(--status-red);
  border-color: rgba(217, 45, 32, 0.35);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 42px;
  padding: 0 18px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  border: 1px solid var(--btn-icon-border);
  background: var(--btn-icon-bg);
  color: var(--btn-icon-color);
  box-shadow: none;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.btn:hover {
  border-color: var(--btn-icon-hover-border);
  background: var(--btn-icon-hover-bg);
  color: var(--ink);
  transform: none;
}

.btn-primary {
  background: var(--accent, var(--lime));
  color: var(--accent-ink, var(--charcoal, #121212));
  border-color: var(--accent, var(--lime));
}
.btn-primary:hover {
  background: color-mix(in srgb, var(--accent, var(--lime)) 72%, #000);
  color: var(--accent-ink, var(--charcoal, #121212));
  border-color: color-mix(in srgb, var(--accent, var(--lime)) 72%, #000);
}
.btn-ghost {
  background: var(--btn-icon-bg);
  border-color: var(--btn-icon-border);
  color: var(--btn-icon-color);
}
.btn-ghost:hover {
  border-color: var(--btn-icon-hover-border);
  background: var(--btn-icon-hover-bg);
  color: var(--ink);
}
.btn-danger {
  background: var(--btn-icon-bg);
  border-color: var(--btn-icon-border);
  color: var(--btn-icon-color);
}
.btn-danger:hover {
  color: var(--danger);
  border-color: var(--danger-line);
  background: var(--danger-bg);
}
.btn-sm { height: 34px; padding: 0 12px; font-size: 13.5px; }
.btn.btn-icon {
  height: var(--btn-icon-size);
  padding: 0;
  border-radius: 50%;
  border-color: var(--btn-icon-border);
  background: var(--btn-icon-bg);
  color: var(--btn-icon-color);
}
.btn-icon {
  width: var(--btn-icon-size);
  height: var(--btn-icon-size);
  min-width: var(--btn-icon-size);
  min-height: var(--btn-icon-size);
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--btn-icon-border);
  background: var(--btn-icon-bg);
  color: var(--btn-icon-color);
  flex-shrink: 0;
  box-shadow: none;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}
.btn-icon:hover {
  border-color: var(--btn-icon-hover-border);
  background: var(--btn-icon-hover-bg);
  color: var(--ink);
  transform: none;
}
.btn-icon svg {
  width: 16px;
  height: 16px;
  display: block;
  stroke: currentColor;
  fill: none;
}

.btn-icon.btn-danger {
  color: var(--btn-icon-color);
}
.btn-icon.btn-danger:hover {
  color: var(--danger);
  border-color: var(--danger-line);
  background: var(--danger-bg);
}

.row-actions { display: flex; gap: 6px; align-items: center; }

.btn-export-pdf {
  width: var(--btn-icon-size);
  height: var(--btn-icon-size);
  min-width: var(--btn-icon-size);
  max-width: var(--btn-icon-size);
  min-height: var(--btn-icon-size);
  max-height: var(--btn-icon-size);
  padding: 0;
  border-radius: 50%;
  aspect-ratio: 1 / 1;
  flex: 0 0 var(--btn-icon-size);
  line-height: 0;
  position: relative;
}
.btn-export-pdf::before {
  content: "";
  display: block;
  width: 18px;
  height: 18px;
  background-color: currentColor;
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3v12M8 11l4 4 4-4M4 21h16'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3v12M8 11l4 4 4-4M4 21h16'/%3E%3C/svg%3E");
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
}
.proposals-table .row-actions > .btn-export-pdf {
  flex: 0 0 var(--btn-icon-size);
}

.empty {
  padding: 56px 24px;
  text-align: center;
  color: var(--muted);
}

html[data-auth-screen] {
  --bg: #121212;
}

html[data-auth-screen],
html[data-auth-screen] body,
html[data-auth-screen] .page:has(.auth-wrap),
html[data-auth-screen] .auth-wrap {
  background: #121212;
}

.page:has(.auth-wrap) {
  max-width: none;
  padding: 0;
}

.auth-wrap {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 32px 16px;
}

body:has(> header.topbar) .auth-wrap {
  min-height: calc(100vh - 88px);
  min-height: calc(100dvh - 88px);
}

.auth-panel {
  width: 100%;
  max-width: 440px;
  display: grid;
  gap: 24px;
  justify-items: center;
}

.auth-card {
  width: 100%;
  max-width: 440px;
  background: #2a2a2a;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 28px;
  box-shadow: none;
  padding: 36px 32px;
  color: #fff;
}

.auth-card h1 {
  font-family: var(--display);
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.04em;
  margin: 0 0 8px;
  text-align: center;
  color: #fff;
}

.auth-card:has(.auth-title-cadastro) {
  padding-top: 60px;
}

@media (max-width: 768px) {
  .auth-card h1.auth-title-cadastro {
    line-height: 0.75;
  }
}

.auth-card p { color: rgba(255, 255, 255, 0.62); margin: 0 0 24px; }

.auth-card label.lbl {
  text-align: center;
  font-size: 16px;
  color: rgba(255, 255, 255, 0.82);
}

.auth-card .field {
  text-align: center;
  background: #1a1a1a;
  border-color: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.auth-card .field::placeholder {
  color: rgba(255, 255, 255, 0.38);
}

.auth-card .auth-actions {
  display: flex;
  justify-content: center;
  margin-top: 10px;
}

.auth-card .btn-primary {
  background: #bfff00;
  border-color: #bfff00;
  color: #111;
  width: max-content;
  max-width: max-content;
  flex: 0 0 auto;
  padding-inline: 28px;
  font-family: var(--display);
  font-size: 14px;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.auth-card .btn-primary:hover {
  background: #759c00;
  border-color: #759c00;
  color: #111;
}

.auth-switch {
  text-align: center;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.62);
  margin: 0;
}

.auth-switch a {
  color: #fff;
  font-weight: 600;
  text-decoration: none;
}

.auth-switch a:hover { text-decoration: underline; }

.auth-logo {
  text-align: center;
  margin: 0;
}

.auth-logo a {
  display: inline-block;
}

.auth-logo img {
  display: block;
  margin: 0 auto;
  max-width: 135px;
  height: auto;
  opacity: .85;
}

.stack { display: grid; gap: 12px; }
.stack-lg { display: grid; gap: 18px; }

label.lbl {
  display: grid;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
}

.field, .select, .area {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--bg);
  border-radius: 14px;
  padding: 11px 14px;
  outline: none;
}

.area { min-height: 96px; resize: vertical; }

.help { font-size: 13px; color: var(--faint); }

.editor-grid {
  display: grid;
  grid-template-columns: 440px minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}

.editor-col {
  display: grid;
  gap: 14px;
}

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 18px;
}

.panel h2 {
  margin: 0 0 14px;
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--faint);
  font-weight: 600;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  font-size: 13px;
}

.chip.is-on {
  background: var(--btn-icon-hover-bg);
  color: var(--ink);
  border-color: var(--btn-icon-hover-border);
}

.pkg-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}

.pkg {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius, 20px);
  padding: 24px 16px;
  background: var(--bg);
  box-shadow: var(--shadow);
  color: var(--ink);
  width: 100%;
  min-height: 120px;
  box-sizing: border-box;
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.pkg:hover {
  transform: translateY(-2px);
  border-color: var(--line-strong);
}

.pkg.is-on {
  background: var(--bg);
  border-color: var(--line-strong);
  box-shadow: var(--shadow), 0 0 0 1px var(--line-strong);
}

.pkg-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: baseline;
}

.pkg-list .pkg-top {
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.pkg-name {
  font-family: var(--display);
  font-weight: 800;
  letter-spacing: -0.04em;
  font-size: 18px;
  line-height: 1.15;
  color: var(--ink);
}

.pkg-price { font-weight: 600; font-size: 14px; color: var(--ink); }
.pkg-meta { margin-top: 6px; font-size: 13px; color: var(--muted); }

#extras,
#cases {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}

#extras > .help,
#cases > .help,
.pkg-list > .help {
  grid-column: 1 / -1;
}

.extra-row {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  margin: 0;
  padding: 24px 16px;
  min-height: 120px;
  box-sizing: border-box;
  border: 1px solid var(--line);
  border-radius: var(--radius, 20px);
  background: var(--bg);
  box-shadow: var(--shadow);
  color: var(--ink);
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.extra-row:hover {
  transform: translateY(-2px);
  border-color: var(--line-strong);
}

.extra-row.is-on {
  border-color: var(--line-strong);
  box-shadow: var(--shadow), 0 0 0 1px var(--line-strong);
}

.extra-row input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
  pointer-events: none;
}

.extra-row label { flex: 1; cursor: pointer; }
.extra-row .price { font-size: 14px; font-weight: 600; color: var(--ink); }

.check-list {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 4px 12px;
  background: var(--bg);
  max-height: 220px;
  overflow: auto;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}

.check-row:last-child { border-bottom: 0; }

.switch-field {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--bg);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  user-select: none;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.switch-field:hover { border-color: var(--line-strong); }

.switch-field input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
}

.switch-ui {
  flex-shrink: 0;
  width: 42px;
  height: 24px;
  border-radius: 999px;
  background: var(--line-strong);
  position: relative;
  transition: background 0.18s ease;
}

.switch-ui::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(18, 18, 18, 0.28);
  transition: transform 0.18s ease, background 0.18s ease;
}

.switch-field input:checked + .switch-ui {
  background: var(--accent);
}

.switch-field input:checked + .switch-ui::after {
  transform: translateX(18px);
  background: var(--charcoal);
}

.switch-field:has(input:checked) {
  border-color: var(--ok-line);
  background: var(--ok-bg);
}

.switch-field:has(input:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.sticky-preview {
  position: sticky;
  top: 104px;
}

.doc {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 28px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.doc-bar { height: 4px; background: var(--accent); }

.doc-body { padding: 40px 44px 48px; }

.doc-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 22px;
}

.doc-brand {
  display: grid;
  gap: 12px;
  min-width: 0;
  flex: 1 1 0;
  max-width: 50%;
}

.doc-brand-end {
  justify-items: end;
  text-align: right;
}

.doc-logo {
  display: block;
  max-height: 83px;
  max-width: min(312px, 100%);
  width: auto;
  height: auto;
  object-fit: contain;
  object-position: left center;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

html[data-theme="light"] .doc-logo:not(.doc-logo-client):not(.is-dark-mark):not(.is-color-mark),
html[data-theme="dark"] .doc-logo.is-dark-mark:not(.doc-logo-client) {
  filter: invert(1);
}

.doc-logo-client {
  object-position: right center;
  margin-left: auto;
}

.doc-client-info {
  font-size: 14px;
  line-height: 1.45;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.doc-client-name { font-weight: 600; }

.doc-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 20px;
  margin: 0 0 2px;
}

.doc-meta-row .doc-client-info {
  flex: 0 1 auto;
  max-width: 50%;
  text-align: right;
  margin-left: auto;
}

.doc-lead {
  margin: 0;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
  flex: 1 1 auto;
  min-width: 0;
}

.doc-project {
  margin: 10px 0 0;
  font-family: var(--display);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.logo-drop {
  border: 1px dashed var(--line-strong);
  border-radius: 16px;
  padding: 14px;
  background: var(--bg);
  display: grid;
  gap: 10px;
  outline: none;
}

.logo-drop:focus,
.logo-drop.is-over {
  border-color: var(--ink);
}

.logo-drop-img {
  max-height: 64px;
  max-width: 180px;
  width: auto;
  height: auto;
  object-fit: contain;
}

.logo-drop-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.logo-thumb {
  width: 36px;
  height: 36px;
  object-fit: contain;
  border-radius: 8px;
  background: var(--bg);
  border: 1px solid var(--line);
}

.doc-kicker {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--faint);
}

.doc-body h1 {
  font-family: var(--display);
  font-size: 44px;
  line-height: 0.95;
  letter-spacing: -0.04em;
  font-weight: 800;
  margin: 13.5px 0 8px;
}

.doc-sub { color: var(--muted); font-size: 15px; max-width: 520px; }

.section {
  margin-top: 36px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.section-label {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 10px;
}

.section h3 {
  margin: 0 0 10px;
  font-family: var(--display);
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.checks { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.checks li {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.checks i {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: var(--accent, var(--btn));
  color: var(--accent-ink, var(--btn-text));
  display: grid;
  place-items: center;
  font-size: 10px;
  flex-shrink: 0;
  margin-top: 2px;
  font-style: normal;
}

.money-grid {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 0;
}

.money-grid > div { padding: 12px 0; border-top: 1px solid var(--line); }
.money-grid .k { color: var(--muted); font-size: 14px; }
.money-total { font-family: var(--display); font-size: 22px; font-weight: 800; letter-spacing: -0.03em; }
.money-total-sub { margin-top: 4px; font-family: var(--sans); font-size: 13px; font-weight: 500; color: var(--muted); letter-spacing: 0; }

.steps {
  display: flex;
  align-items: stretch;
  gap: 32px;
}

.step {
  position: relative;
  flex: 1;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  background: var(--bg);
}

.step:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 100%;
  width: 16px;
  height: 16px;
  margin-left: 8px;
  transform: translateY(-50%);
  background: var(--muted);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12h14M13 6l6 6-6 6'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12h14M13 6l6 6-6 6'/%3E%3C/svg%3E") center / contain no-repeat;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

.step b { display: block; font-size: 13px; color: var(--faint); margin-bottom: 6px; }

.doc-foot {
  margin-top: 40px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  color: var(--muted);
  font-size: 14px;
}

.doc-social {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.doc-social-icon {
  display: grid;
  place-items: center;
  color: inherit;
  width: 18px;
  height: 18px;
}

.doc-social-icon svg {
  width: 18px;
  height: 18px;
  display: block;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

.editor-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
  align-items: center;
}

.page-head .editor-actions {
  margin-bottom: 0;
}

.status-pills {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.status-pills button {
  height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 14px;
}

.status-pills button.is-on {
  background: var(--btn-icon-hover-bg);
  color: var(--ink);
  border: 1px solid var(--btn-icon-hover-border);
}

.public-body { background: var(--bg); }
.public-wrap { max-width: 860px; margin: 0 auto; padding: 32px 16px 96px; }
.public-bar {
  position: sticky;
  bottom: 16px;
  z-index: 20;
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.public-wrap--export .public-bar--export {
  margin-top: 56px;
  padding-top: 8px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 80;
  background: var(--btn);
  color: var(--btn-text);
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 14px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.modal {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 70;
}

.modal-card {
  width: min(640px, 100%);
  background: var(--card);
  border-radius: 24px;
  overflow: hidden;
}

.modal-card header, .modal-card footer {
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-card footer {
  border-bottom: 0;
  border-top: 1px solid var(--line);
  justify-content: center;
  gap: 8px;
}

.modal-card .body { padding: 20px; }

.case-pick {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 20px 16px;
  min-height: 140px;
  box-sizing: border-box;
  border: 1px solid var(--line);
  border-radius: var(--radius, 20px);
  background: var(--bg);
  box-shadow: var(--shadow);
  color: var(--ink);
  cursor: pointer;
  text-align: center;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.case-pick:hover {
  transform: translateY(-2px);
  border-color: var(--line-strong);
}

.case-pick.is-on {
  background: var(--bg);
  border-color: var(--line-strong);
  box-shadow: var(--shadow), 0 0 0 1px var(--line-strong);
}

.case-pick img {
  width: 100%;
  height: 88px;
  object-fit: cover;
  border-radius: 14px;
  flex-shrink: 0;
  border: 1px solid var(--line);
}

.case-pick input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
  pointer-events: none;
}

.case-pick .grow {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  width: 100%;
}

.case-pick strong {
  font-family: var(--display);
  font-weight: 800;
  letter-spacing: -0.04em;
  font-size: 16px;
  color: var(--ink);
}

.case-card {
  margin-top: 22px;
  break-inside: avoid;
  page-break-inside: avoid;
}

.case-card h4 {
  margin: 0 0 4px;
  font-family: var(--display);
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.case-meta {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 8px;
}

.case-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.case-gallery img {
  width: 100%;
  height: 150px;
  object-fit: cover;
  border-radius: 16px;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

.case-cover {
  width: 100%;
  height: 110px;
  object-fit: cover;
  border-radius: 14px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
}

.case-thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.case-thumb {
  position: relative;
  width: 72px;
  height: 72px;
}

.case-thumb img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 10px;
}

.case-thumb button {
  position: absolute;
  top: -6px;
  right: -6px;
  width: var(--btn-icon-size);
  height: var(--btn-icon-size);
  border-radius: 50%;
  border: 1px solid var(--btn-icon-border);
  background: var(--btn-icon-bg);
  color: var(--btn-icon-color);
  font-size: 14px;
  line-height: 1;
  display: grid;
  place-items: center;
}

.case-thumb button:hover {
  border-color: var(--btn-icon-hover-border);
  background: var(--btn-icon-hover-bg);
  color: var(--ink);
}

.catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 280px));
  gap: 24px;
  justify-content: start;
}

.catalog-grid > .empty {
  grid-column: 1 / -1;
  text-align: center;
  justify-self: stretch;
  width: 100%;
  margin: 0;
}

.pkg-admin {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 24px;
  min-height: 140px;
  box-sizing: border-box;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius, 20px);
  box-shadow: var(--shadow);
  color: var(--ink);
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.pkg-admin:hover {
  transform: translateY(-2px);
  border-color: var(--line-strong);
}

.pkg-admin h3 {
  margin: 0 0 8px;
  font-family: var(--display);
  font-size: 21.6px;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.15;
  color: var(--ink);
  width: 100%;
}

.pkg-admin .pkg-meta,
.pkg-admin .muted {
  width: 100%;
}

.pkg-admin .muted {
  margin: 8px 0 0;
}

.pkg-admin .board-card-actions,
.pkg-admin .row-actions {
  justify-content: center;
  margin-top: 16px;
  gap: 12px;
  width: 100%;
}

.tabs { display: flex; gap: 6px; margin-bottom: 16px; }

.muted { color: var(--muted); }
.right { text-align: right; }
.grow { flex: 1; }

.theme-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  height: 34px;
  padding: 3px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  flex-shrink: 0;
  overflow: hidden;
}

.theme-knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: calc(50% - 3px);
  height: 28px;
  border-radius: 999px;
  background: var(--btn);
  transition: transform 0.2s ease;
  z-index: 0;
}

.theme-switch.is-dark .theme-knob {
  transform: translateX(100%);
}

.theme-switch .opt-light,
.theme-switch .opt-dark {
  position: relative;
  z-index: 1;
  flex: 1;
  min-width: 52px;
  padding: 0 10px;
  font-size: 13px;
  font-weight: 500;
  line-height: 28px;
  text-align: center;
  color: var(--muted);
}

.theme-switch:not(.is-dark) .opt-light,
.theme-switch.is-dark .opt-dark {
  color: var(--btn-text);
}

.public-theme {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 40;
}

@media (max-width: 1024px) {
  .topbar-inner { flex-wrap: wrap; height: auto; padding: 10px 16px; gap: 10px; }
  .nav { display: flex; width: 100%; order: 3; overflow: auto; padding-bottom: 4px; }
  .user-chip { display: none; }
  .editor-grid { grid-template-columns: 1fr; }
  .sticky-preview { position: static; }
  .stats { grid-template-columns: 1fr 1fr; }
  .chart-filters { width: 100%; }
  .chart-filters .select { flex: 1; min-width: 0; }
  .chart-wrap { height: 260px; }
  .doc-body { padding: 28px 22px 36px; }
  .doc-body h1 { font-size: 32px; }
  .money-grid { grid-template-columns: 1fr; }
  .steps { flex-direction: column; gap: 28px; }
  .step:not(:last-child)::after {
    left: 50%;
    top: 100%;
    margin-left: 0;
    margin-top: 6px;
    transform: translateX(-50%) rotate(90deg);
  }
  .catalog-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 280px)); }
}

@page {
  margin: 12mm;
  background: var(--bg);
}

@media print {
  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    color-adjust: exact !important;
  }

  .topbar, .editor-col, .editor-actions, .page-head, .public-bar, .toast, .public-theme, .theme-switch, .doc-kicker { display: none !important; }

  html, body, .public-body, .page, .public-wrap, .sticky-preview, .editor-grid, .doc {
    background: var(--bg) !important;
    color: var(--ink) !important;
  }

  body::before {
    content: "";
    position: fixed;
    inset: -20mm;
    z-index: -1;
    background: var(--bg) !important;
  }

  .editor-grid { display: block; }
  .sticky-preview { position: static; }
  .doc {
    box-shadow: none;
    border: 0;
    border-radius: 0;
    overflow: visible !important;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }
  .doc-body {
    padding: 10mm 12mm 12mm !important;
    box-sizing: border-box;
    max-width: 100%;
  }
  .doc-brand {
    max-width: 50%;
    min-width: 0;
  }
  .doc-head {
    max-width: 100%;
    break-inside: avoid;
    page-break-inside: avoid;
    margin-bottom: 8.8px;
  }
  .doc-bar { background: var(--accent) !important; }
  .checks i {
    background: var(--accent) !important;
    color: var(--accent-ink, var(--btn-text)) !important;
  }
  .page, .public-wrap { padding: 0; max-width: none; }
  .doc-body h1 { margin-top: 5.4px; }
  .doc-meta-row {
    break-inside: avoid;
    page-break-inside: avoid;
  }
  .doc-logo,
  .doc-logo-client {
    max-height: 83px !important;
    max-width: 100% !important;
  }
  html[data-theme="light"] .doc-logo:not(.doc-logo-client):not(.is-dark-mark):not(.is-color-mark),
  html[data-theme="dark"] .doc-logo.is-dark-mark:not(.doc-logo-client) {
    filter: invert(1) !important;
  }
  .money-grid {
    display: grid !important;
    grid-template-columns: max-content 1fr !important;
    column-gap: 20px !important;
    align-items: baseline;
  }
  .money-grid > div {
    border: 0 !important;
    padding: 8px 0 !important;
  }
  .case-gallery img { height: 160px; }
  .steps {
    flex-direction: row !important;
    gap: 32px !important;
  }
  .step:not(:last-child)::after {
    left: 100% !important;
    top: 50% !important;
    margin-left: 8px !important;
    margin-top: 0 !important;
    transform: translateY(-50%) !important;
    background: var(--muted) !important;
  }
}

[hidden] { display: none !important; }
