:root {
  --ink: #171a1d;
  --muted: #697077;
  --paper: #ffffff;
  --canvas: #eef0f2;
  --line: #d8dde1;
  --line-dark: #aab1b7;
  --accent: #10a9b7;
  --accent-dark: #087985;
  --accent-soft: #e7f9fa;
  --success: #18794e;
  --danger: #b42318;
  --danger-soft: #fff0ee;
  --shadow: 0 18px 60px rgba(22, 26, 29, 0.12);
  --radius: 14px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  max-width: 100%;
  overflow-x: hidden;
  color: var(--ink);
  background:
    radial-gradient(circle at 15% 0%, rgba(16, 169, 183, 0.1), transparent 28rem),
    var(--canvas);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  line-height: 1.55;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.login-screen {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(145deg, rgba(16, 169, 183, 0.13), transparent 45%),
    #111618;
}

.login-card {
  width: min(430px, 100%);
  padding: 38px;
  background: #fff;
  border-top: 5px solid var(--accent);
  border-radius: 18px;
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.35);
}

.login-card > img {
  display: block;
  width: auto;
  height: auto;
  max-width: min(150px, 100%);
  max-height: 112px;
  margin: 0 auto 22px;
  object-fit: contain;
}

.login-card h1,
.login-card > p {
  margin-top: 0;
}

.login-card > p:not(.eyebrow) {
  color: var(--muted);
}

.login-button {
  width: 100%;
  min-height: 52px;
  margin-top: 20px;
}

.login-error {
  margin: 12px 0 0;
  color: var(--danger);
  font-size: 0.85rem;
  font-weight: 700;
}

.login-security-note {
  margin: 8px 0 0;
  padding: 10px 12px;
  color: #4b5d61;
  background: #eef8fa;
  border: 1px solid #cce7ea;
  border-radius: 10px;
  font-size: 0.83rem;
  font-weight: 650;
}

.app-header {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 84px;
  padding: 14px clamp(20px, 4vw, 64px);
  color: #fff;
  background: rgba(22, 26, 29, 0.97);
  border-bottom: 3px solid var(--accent);
  backdrop-filter: blur(12px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-logo {
  width: auto;
  height: auto;
  max-width: 76px;
  max-height: 54px;
  object-fit: contain;
  background: #fff;
  border-radius: 5px;
}

.brand h1,
.brand p {
  margin: 0;
}

.brand h1 {
  font-size: clamp(1.15rem, 2vw, 1.55rem);
  line-height: 1.1;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.brand .eyebrow {
  color: #c7ccd0;
}

.offline-status {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #d5d9dc;
  font-size: 0.85rem;
}

.header-button {
  min-height: 36px;
  margin-left: 12px;
  padding: 6px 12px;
  color: #fff;
  background: transparent;
  border: 1px solid #596267;
  border-radius: 8px;
  font-weight: 700;
}

.main-nav {
  display: flex;
  gap: 8px;
  margin-bottom: 38px;
  padding: 7px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.nav-button {
  min-height: 48px;
  padding: 10px 18px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 8px;
  font-weight: 800;
}

.nav-button.active {
  color: #fff;
  background: var(--ink);
}

.status-dot {
  width: 9px;
  height: 9px;
  background: #53d68a;
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(83, 214, 138, 0.13);
}

.app-shell {
  width: min(1320px, calc(100% - 32px));
  margin: 0 auto;
  padding: clamp(32px, 6vw, 72px) 0 80px;
}

.section-heading {
  max-width: 680px;
  margin-bottom: 28px;
}

.section-heading h2,
.saved-heading h2 {
  margin: 0;
  font-size: clamp(1.8rem, 4vw, 3rem);
  line-height: 1.08;
  letter-spacing: -0.035em;
}

.section-heading > p:last-child {
  color: var(--muted);
}

.contract-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 16px;
}

.contract-card {
  position: relative;
  grid-column: span 2;
  min-height: 220px;
  padding: 24px;
  overflow: hidden;
  color: var(--ink);
  text-align: left;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 8px 30px rgba(22, 26, 29, 0.05);
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.contract-card:nth-child(4) {
  grid-column: 2 / span 2;
}

.contract-card:hover,
.contract-card:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 16px 36px rgba(22, 26, 29, 0.11);
  outline: none;
  transform: translateY(-4px);
}

.contract-card::after {
  position: absolute;
  right: -36px;
  bottom: -70px;
  width: 145px;
  height: 145px;
  content: "";
  background: var(--accent-soft);
  border-radius: 50%;
}

.card-number,
.card-title,
.card-description,
.card-arrow {
  position: relative;
  z-index: 1;
  display: block;
}

.card-number {
  margin-bottom: 26px;
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: 0.12em;
}

.card-title {
  margin-bottom: 8px;
  font-size: 1.25rem;
  font-weight: 800;
  line-height: 1.2;
}

.card-description {
  max-width: 260px;
  color: var(--muted);
  font-size: 0.9rem;
}

.card-arrow {
  position: absolute;
  bottom: 20px;
  color: var(--accent-dark);
  font-size: 0.84rem;
  font-weight: 800;
}

.saved-section {
  margin-top: 20px;
}

.saved-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 20px;
}

.export-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.evidence-status {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  width: min(960px, 100%);
  margin: 0 auto 18px;
}

.evidence-status span,
.status-badge {
  padding: 6px 10px;
  color: #5d656b;
  background: #fff;
  border: 1px solid var(--line-dark);
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
}

.evidence-status span.done,
.status-badge.done {
  color: var(--success);
  background: #eaf7f0;
  border-color: #91c9aa;
}

.evidence-status span.pending,
.status-badge.pending {
  color: #8a5200;
  background: #fff7e8;
  border-color: #e8c47c;
}

.saved-statuses {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 7px;
}

.saved-statuses .status-badge {
  padding: 3px 7px;
  font-size: 0.64rem;
}

.saved-heading h2 {
  font-size: 1.8rem;
}

.saved-contracts {
  display: grid;
  gap: 10px;
}

.saved-row {
  display: grid;
  grid-template-columns: minmax(180px, 1.4fr) minmax(170px, 1fr) minmax(160px, 1fr) auto;
  align-items: center;
  gap: 16px;
  padding: 16px 18px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.saved-row strong,
.saved-row span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.saved-row span {
  color: var(--muted);
  font-size: 0.88rem;
}

.saved-actions {
  display: flex;
  gap: 8px;
}

.row-button {
  padding: 7px 10px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 7px;
  font-size: 0.8rem;
  font-weight: 700;
}

.row-button:hover {
  border-color: var(--accent);
}

.row-button.danger {
  color: var(--danger);
}

.empty-state {
  padding: 32px;
  color: var(--muted);
  text-align: center;
  background: rgba(255, 255, 255, 0.55);
  border: 1px dashed var(--line-dark);
  border-radius: var(--radius);
}

.workspace-toolbar {
  position: sticky;
  z-index: 15;
  top: 84px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  width: min(960px, 100%);
  margin: -24px auto 18px;
  padding: 12px;
  background: rgba(238, 240, 242, 0.92);
  border: 1px solid rgba(170, 177, 183, 0.6);
  border-radius: 12px;
  backdrop-filter: blur(10px);
}

.toolbar-actions {
  display: flex;
  gap: 10px;
}

.button {
  min-height: 42px;
  padding: 9px 16px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 800;
  transition: background 150ms ease, border-color 150ms ease, color 150ms ease;
}

.button-primary {
  color: #fff;
  background: var(--accent);
}

.button-primary:hover {
  background: var(--accent-dark);
}

.button-secondary {
  color: var(--ink);
  background: #fff;
  border-color: var(--line-dark);
}

.button-secondary:hover {
  border-color: var(--accent);
}

.button-ghost {
  color: var(--ink);
  background: transparent;
}

.validation-banner {
  width: min(960px, 100%);
  margin: 0 auto 18px;
  padding: 14px 18px;
  color: var(--danger);
  background: var(--danger-soft);
  border: 1px solid #f3b8b2;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 650;
}

.validation-banner.success {
  color: #0f5132;
  background: #dff7e8;
  border-color: #b9e4c7;
}

.contract-document {
  width: min(960px, 100%);
  margin: 0 auto;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.document-header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 24px;
  padding: 36px 44px 30px;
  border-bottom: 4px solid var(--ink);
}

.document-logo-image {
  width: 118px;
  height: 82px;
  object-fit: contain;
}

.document-title p,
.document-title h2 {
  margin: 0;
}

.document-title p {
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.document-title h2 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.4rem, 3vw, 2rem);
  line-height: 1.15;
}

.document-meta {
  min-width: 190px;
  margin: 0;
  padding-left: 18px;
  border-left: 1px solid var(--line);
}

.document-meta div + div {
  margin-top: 8px;
}

.document-meta dt {
  color: var(--muted);
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.document-meta dd {
  margin: 1px 0 0;
  font-size: 0.79rem;
  font-weight: 700;
}

.document-section {
  padding: 34px 44px;
  border-bottom: 1px solid var(--line);
}

.document-section h3 {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 22px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.25rem;
}

.document-section h3::after {
  flex: 1;
  height: 1px;
  content: "";
  background: var(--line);
}

.legal-copy {
  color: #353a3e;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.98rem;
  text-align: justify;
}

.legal-copy p {
  margin: 0 0 14px;
}

.legal-copy .original-contract-title {
  margin-bottom: 28px;
  color: var(--ink);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-align: center;
  text-transform: uppercase;
}

.numbered-copy {
  counter-reset: legal-clause;
}

.numbered-copy p {
  position: relative;
  padding-left: 34px;
  counter-increment: legal-clause;
}

.numbered-copy p::before {
  position: absolute;
  left: 0;
  color: var(--accent-dark);
  content: counter(legal-clause) ".";
  font-family: Inter, "Segoe UI", sans-serif;
  font-size: 0.8rem;
  font-weight: 900;
}

.notice-box {
  margin-top: 22px;
  padding: 16px 18px;
  background: var(--accent-soft);
  border-left: 4px solid var(--accent);
  font-size: 0.88rem;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.field {
  display: grid;
  gap: 6px;
}

.field-wide {
  grid-column: span 2;
}

.field span {
  color: #4d545a;
  font-size: 0.77rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.field input {
  width: 100%;
  height: 46px;
  padding: 9px 11px;
  color: var(--ink);
  background: #fbfbfa;
  border: 1px solid var(--line-dark);
  border-radius: 6px;
  outline: none;
}

.field select {
  width: 100%;
  height: 46px;
  padding: 9px 11px;
  color: var(--ink);
  background: #fbfbfa;
  border: 1px solid var(--line-dark);
  border-radius: 6px;
  outline: none;
}

.field input:focus {
  background: #fff;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(16, 169, 183, 0.14);
}

.field select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(16, 169, 183, 0.14);
}

.field input.invalid {
  border-color: var(--danger);
  background: var(--danger-soft);
}

.age-result {
  margin-top: 18px;
  padding: 12px 14px;
  color: #475057;
  background: #f3f5f6;
  border-radius: 6px;
  font-size: 0.83rem;
  font-weight: 700;
}

.age-result.resolved {
  color: var(--success);
  background: #eaf7f0;
}

.section-help {
  margin: -10px 0 20px;
  color: var(--muted);
  font-size: 0.88rem;
}

.declaration-list {
  display: grid;
  gap: 12px;
}

.legal-documents-panel {
  margin-bottom: 24px;
  padding: 20px;
  background: #f7f8f8;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.legal-documents-panel h4,
.legal-documents-panel p {
  margin: 0;
}

.legal-documents-panel h4 {
  font-size: 1.05rem;
}

.legal-documents-panel > div:first-child > p:last-child {
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.84rem;
}

.legal-document-actions {
  display: grid;
  gap: 9px;
  margin-top: 16px;
}

.legal-document-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 15px;
  color: var(--ink);
  text-align: left;
  background: #fff;
  border: 1px solid var(--line-dark);
  border-radius: 7px;
}

.legal-document-button:hover,
.legal-document-button:focus-visible {
  border-color: var(--accent);
  outline: none;
}

.legal-document-button span {
  flex: 0 0 auto;
  color: #8a5200;
  font-size: 0.7rem;
  font-weight: 800;
}

.legal-document-button.opened {
  border-color: #91c9aa;
}

.legal-document-button.opened span {
  color: var(--success);
}

.check-row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: start;
  padding: 16px;
  background: #f7f8f8;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
}

.check-row:has(input:disabled) {
  cursor: not-allowed;
  opacity: 0.62;
}

.check-row:has(input:checked) {
  background: #eef8f2;
  border-color: #91c9aa;
}

.check-row input,
.consent-group input {
  width: 19px;
  height: 19px;
  margin: 2px 0 0;
  accent-color: var(--accent);
}

.check-row span {
  color: #4b5258;
  font-size: 0.88rem;
}

.check-row strong {
  display: block;
  margin-bottom: 3px;
  color: var(--ink);
}

.consent-group {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 30px;
  margin: 22px 0 0;
  padding: 18px;
  border: 1px solid var(--line-dark);
  border-radius: 8px;
}

.consent-group legend {
  padding: 0 8px;
  font-size: 0.85rem;
  font-weight: 800;
}

.consent-group label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}

.signature-grid {
  display: grid;
  gap: 24px;
}

.signature-block {
  padding: 18px;
  background: #f7f8f8;
  border: 2px solid #c7dadd;
  border-radius: 9px;
  touch-action: none;
  overscroll-behavior: contain;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.dashboard-section {
  padding-top: 8px;
}

.dashboard-cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

.metric-card {
  min-height: 126px;
  padding: 20px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.metric-card span {
  display: block;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
}

.metric-card strong {
  display: block;
  margin-top: 12px;
  font-size: 1.75rem;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.dashboard-panel {
  padding: 22px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.dashboard-panel h3 {
  margin-top: 0;
}

.bar-row {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) 2fr auto;
  gap: 10px;
  align-items: center;
  margin: 10px 0;
  font-size: 0.82rem;
}

.bar-track {
  height: 10px;
  overflow: hidden;
  background: #e8edef;
  border-radius: 999px;
}

.bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: inherit;
}

.bar-row > strong {
  display: grid;
  justify-items: end;
}

.bar-row > strong small {
  color: #71878c;
  font-size: 0.62rem;
  font-weight: 600;
}

.signature-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.clear-signature {
  padding: 5px 9px;
  color: var(--danger);
  background: #fff;
  border: 1px solid #e2b8b4;
  border-radius: 5px;
  font-size: 0.73rem;
  font-weight: 800;
}

.signature-canvas {
  display: block;
  width: 100%;
  height: 180px;
  background:
    linear-gradient(to bottom, transparent calc(100% - 38px), #aeb5ba calc(100% - 37px), transparent calc(100% - 36px)),
    #fff;
  border: 1px solid var(--line-dark);
  border-radius: 5px;
  cursor: crosshair;
  touch-action: none;
  overscroll-behavior: contain;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

.signature-pad,
.signature-canvas,
canvas.signature-canvas {
  touch-action: none !important;
  overscroll-behavior: contain !important;
  user-select: none !important;
  -webkit-user-select: none !important;
  -webkit-touch-callout: none !important;
  -webkit-tap-highlight-color: transparent !important;
}

.signature-canvas.invalid {
  border: 2px solid var(--danger);
  background-color: var(--danger-soft);
}

.signature-block > p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 0.72rem;
  text-align: center;
}

.signature-block > .signature-time {
  margin-top: 3px;
  color: var(--success);
  font-weight: 700;
}

.closing-copy {
  margin-top: 24px;
  color: #4c5358;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.88rem;
  font-style: italic;
  text-align: center;
}

.document-footer {
  display: flex;
  justify-content: space-between;
  padding: 20px 44px;
  color: #7a8085;
  background: #f3f4f4;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.toast {
  position: fixed;
  z-index: 50;
  right: 22px;
  bottom: 22px;
  max-width: min(420px, calc(100% - 44px));
  padding: 13px 17px;
  color: #fff;
  background: var(--ink);
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.22);
  font-size: 0.86rem;
  font-weight: 700;
}

.toast.success {
  color: #073f2b;
  background: #dff7e8;
  border-left-color: #168a55;
}

.legal-modal {
  width: min(900px, calc(100% - 28px));
  max-width: none;
  height: min(88vh, 940px);
  max-height: none;
  padding: 0;
  overflow: hidden;
  color: var(--ink);
  background: #fff;
  border: 0;
  border-radius: 14px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.32);
}

.legal-modal::backdrop {
  background: rgba(12, 15, 17, 0.72);
  backdrop-filter: blur(4px);
}

.legal-modal[open] {
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.legal-modal-header,
.legal-modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 22px;
  background: #fff;
}

.legal-modal-header {
  border-bottom: 1px solid var(--line);
}

.legal-modal-header h2,
.legal-modal-header p {
  margin: 0;
}

.legal-modal-header h2 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.25rem, 3vw, 1.75rem);
}

.legal-modal-header #legalModalMeta {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
}

.legal-modal-body {
  padding: 28px clamp(22px, 5vw, 54px);
  overflow-y: auto;
  overscroll-behavior: contain;
  background: #fdfdfc;
}

.legal-modal-body p {
  margin: 0 0 15px;
  color: #30363a;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1rem;
  line-height: 1.7;
  text-align: left;
}

.legal-modal-body p:first-child {
  color: var(--ink);
  font-size: 1.2rem;
  font-weight: 700;
}

.legal-modal-footer {
  justify-content: flex-end;
  border-top: 1px solid var(--line);
}

@media (max-width: 900px) {
  .contract-card {
    grid-column: span 3;
  }

  .contract-card:nth-child(4) {
    grid-column: span 3;
  }

  .contract-card:last-child {
    grid-column: 2 / span 4;
  }

  .document-header {
    grid-template-columns: auto 1fr;
  }

  .document-meta {
    grid-column: span 2;
    display: flex;
    gap: 32px;
    padding: 14px 0 0;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .document-meta div + div {
    margin-top: 0;
  }

  .dashboard-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 660px) {
  .app-header {
    min-height: 72px;
    padding: 12px 16px;
  }

  .brand-logo {
    width: 58px;
    height: 42px;
  }

  .brand .eyebrow,
  .offline-status span:last-child {
    display: none;
  }

  .app-shell {
    width: min(100% - 20px, 1320px);
    padding-top: 32px;
  }

  .contract-grid {
    display: grid;
    grid-template-columns: 1fr;
  }

  .contract-card,
  .contract-card:nth-child(4),
  .contract-card:last-child {
    grid-column: auto;
    min-height: 190px;
  }

  .saved-heading,
  .workspace-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .export-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .main-nav {
    display: grid;
    grid-template-columns: 1fr;
  }

  .dashboard-cards,
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .saved-row {
    grid-template-columns: 1fr;
    gap: 5px;
  }

  .workspace-toolbar {
    top: 72px;
    margin-top: -20px;
  }

  .toolbar-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .document-header,
  .document-section {
    padding-right: 22px;
    padding-left: 22px;
  }

  .document-header {
    gap: 15px;
  }

  .document-logo-image {
    width: 82px;
    height: 60px;
  }

  .document-title p {
    display: none;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .field-wide {
    grid-column: auto;
  }

  .legal-copy {
    text-align: left;
  }

  .signature-canvas {
    height: 150px;
  }

  .legal-document-button {
    align-items: flex-start;
    flex-direction: column;
    gap: 5px;
  }

  .legal-modal {
    width: 100%;
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
  }

  .legal-modal-header {
    align-items: flex-start;
  }

  .legal-modal-header .button {
    flex: 0 0 auto;
    padding-inline: 11px;
  }

  .legal-modal-body {
    padding: 22px 20px;
  }

  .document-footer {
    padding: 18px 22px;
  }
}

@media print {
  body {
    background: #fff;
  }

  .app-header,
  .workspace-toolbar,
  .validation-banner,
  .toast {
    display: none !important;
  }

  .app-shell {
    width: 100%;
    padding: 0;
  }

  .contract-document {
    width: 100%;
    box-shadow: none;
  }
}

/* Vegleges vilagos tema - a korabbi brand reteg felulirasa */
body {
  color: #102027;
  background: #f4f8f9;
}

.app-header {
  min-height: 76px;
  padding: 10px clamp(16px, 4vw, 54px);
  color: #102027;
  background: rgba(255, 255, 255, 0.98);
  border-bottom: 3px solid #13b7c5;
  box-shadow: 0 3px 16px rgba(16, 32, 39, 0.08);
}

.brand-logo {
  width: 86px;
  height: 60px;
  background: transparent;
  box-shadow: none;
}

.brand h1 {
  color: #102027;
}

.brand-subtitle,
.offline-status {
  color: #557078;
}

.header-button {
  color: #102027;
  background: #fff;
  border-color: #b8dadd;
}

.main-nav {
  position: sticky;
  z-index: 12;
  top: 79px;
  display: grid;
  grid-template-columns: repeat(4, minmax(135px, 1fr));
  gap: 6px;
  margin-bottom: 24px;
  padding: 7px;
  overflow-x: auto;
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid #d8e7e9;
  border-bottom: 2px solid #13b7c5;
  box-shadow: 0 4px 16px rgba(16, 32, 39, 0.06);
}

.nav-button {
  min-height: 52px;
  color: #31525a;
  white-space: nowrap;
  background: #f5fbfc;
}

.nav-button.active {
  color: #063d43;
  background: #e8fafa;
  box-shadow: inset 0 -4px 0 #13b7c5;
}

.workspace-toolbar {
  top: 79px;
  background: rgba(255, 255, 255, 0.97);
  border-color: #d4e5e7;
}

.contract-card,
.saved-row,
.dashboard-panel,
.info-panel,
.export-card {
  color: #102027;
  background: #fff;
  box-shadow: 0 5px 18px rgba(16, 32, 39, 0.07);
}

.infographic-section {
  color: #102027;
  background: #f7fbfc;
  border: 1px solid #dcebed;
  border-top: 4px solid #13b7c5;
}

.info-metric {
  color: #102027;
  background: #fff;
  border-color: #d8e7e9;
}

.export-card {
  min-height: 130px;
  border: 1px solid #d8e7e9;
  border-left: 5px solid #13b7c5;
}

.export-card span {
  color: #5d7278;
}

@media (max-width: 820px) {
  .main-nav {
    top: 76px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    overflow-x: visible;
  }

  .nav-button {
    padding-inline: 6px;
    font-size: 0.72rem;
    white-space: normal;
  }
}

/* Vegleges CTA es diagram meretek */
.finalize-action {
  order: 6;
  padding: 30px 34px 36px;
  background: #fff;
  border-top: 1px solid #dce8ea;
}

.finalize-button {
  width: 100%;
  min-height: 68px;
  font-size: 1.05rem;
  box-shadow: 0 8px 22px rgba(19, 183, 197, 0.22);
}

.bar-row {
  grid-template-columns: minmax(120px, 1fr) minmax(180px, 3fr) 42px;
  gap: 12px;
  min-height: 38px;
}

.bar-track {
  height: 18px;
  overflow: hidden;
  background: #e4f0f2;
  border: 1px solid #c8e1e4;
  border-radius: 999px;
}

.bar-fill {
  display: block;
  min-width: 8px;
  height: 100%;
  background: linear-gradient(90deg, #078793, #13b7c5);
  border-radius: 999px;
}

.column-chart {
  height: 230px;
  gap: 12px;
  padding: 20px 8px 0;
  background: repeating-linear-gradient(to top, #eef8f9 0 1px, transparent 1px 40px);
}

.column-item span {
  width: min(62px, 78%);
  min-height: 10px;
  background: linear-gradient(to top, #078793, #24c8d5);
  box-shadow: 0 5px 14px rgba(19, 183, 197, 0.18);
}

.donut-chart {
  filter: drop-shadow(0 7px 13px rgba(16, 32, 39, 0.1));
}

@media (max-width: 760px) {
  .bar-row {
    grid-template-columns: 100px minmax(120px, 1fr) 34px;
  }
}

.finalize-button {
  width: 100%;
  min-height: 68px;
  font-size: 1.05rem;
  letter-spacing: 0.02em;
  box-shadow: 0 8px 22px rgba(19, 183, 197, 0.22);
}

.bar-row {
  grid-template-columns: minmax(120px, 1fr) minmax(180px, 3fr) 42px;
  gap: 12px;
  min-height: 38px;
}

.bar-track {
  height: 18px;
  overflow: hidden;
  background: #e4f0f2;
  border: 1px solid #c8e1e4;
  border-radius: 999px;
}

.bar-fill {
  display: block;
  min-width: 8px;
  height: 100%;
  background: linear-gradient(90deg, #078793, #13b7c5);
  border-radius: 999px;
}

.column-chart {
  height: 230px;
  gap: 12px;
  padding: 20px 8px 0;
  background: linear-gradient(to top, #eef8f9 1px, transparent 1px);
  background-size: 100% 40px;
}

.column-item span {
  width: min(62px, 78%);
  min-height: 10px;
  background: linear-gradient(to top, #078793, #24c8d5);
  box-shadow: 0 5px 14px rgba(19, 183, 197, 0.18);
}

.donut-chart {
  filter: drop-shadow(0 7px 13px rgba(16, 32, 39, 0.1));
}

@media (max-width: 760px) {
  .bar-row {
    grid-template-columns: 100px minmax(120px, 1fr) 34px;
  }
}

/* Egyszeru, folyamatos szerzodeskitoltes */
body {
  background: #f2f4f5;
}

.app-header {
  min-height: 82px;
  padding-block: 10px;
  background: #151a1c;
  border-bottom-width: 3px;
}

.brand-logo {
  width: 86px;
  height: 60px;
  box-shadow: none;
}

.main-nav {
  margin-bottom: 24px;
  padding: 5px;
  background: #fff;
  border: 1px solid var(--line);
  border-bottom: 2px solid var(--accent);
}

.nav-button {
  min-height: 46px;
  color: #4f5b60;
}

.nav-button.active {
  color: #fff;
  background: #182023;
  box-shadow: inset 0 -3px 0 var(--accent);
}

.app-shell {
  padding-top: 28px;
}

.section-heading {
  margin-bottom: 18px;
}

.section-heading h2,
.saved-heading h2 {
  font-size: clamp(1.65rem, 3vw, 2.35rem);
}

.contract-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.contract-card,
.contract-card:nth-child(4),
.contract-card:last-child {
  display: grid;
  grid-column: auto;
  grid-template-columns: 40px 1fr auto;
  gap: 10px 14px;
  align-items: center;
  min-height: 98px;
  padding: 16px 18px;
  border-top-width: 1px;
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  box-shadow: 0 4px 14px rgba(22, 26, 29, 0.05);
}

.contract-card::after {
  display: none;
}

.card-number {
  grid-row: span 2;
  margin: 0;
}

.card-title,
.card-description {
  margin: 0;
}

.card-description {
  font-size: 0.82rem;
}

.card-arrow {
  position: static;
  grid-column: 3;
  grid-row: 1 / span 2;
}

.workspace-toolbar {
  top: 82px;
  margin-top: 0;
  padding: 9px;
  background: rgba(255, 255, 255, 0.96);
  border-radius: 8px;
  box-shadow: 0 5px 18px rgba(22, 26, 29, 0.08);
}

.contract-document {
  border-top: 4px solid var(--accent);
  box-shadow: 0 12px 34px rgba(22, 26, 29, 0.1);
}

.document-header {
  padding: 26px 34px 22px;
  border-bottom: 2px solid #1a2022;
}

.document-logo-image {
  width: 126px;
  height: 88px;
}

#contractForm {
  display: flex;
  flex-direction: column;
}

.rider-data-section {
  order: 1;
}

.representative-data-section {
  order: 2;
}

.intro-section {
  order: 3;
}

.acceptance-section {
  order: 4;
}

.signature-section {
  order: 5;
}

.document-section {
  padding: 28px 34px;
}

.document-section h3 {
  margin-bottom: 18px;
  font-size: 1.16rem;
}

.legal-copy {
  font-size: 1.02rem;
  line-height: 1.68;
}

.legal-copy p {
  margin-bottom: 11px;
}

.notice-box,
.legal-documents-panel {
  padding: 14px 16px;
}

.signature-block {
  padding: 16px;
  border-radius: 7px;
}

.infographic-section {
  padding: 20px;
  color: var(--ink);
  background: #fff;
  border-top: 4px solid var(--accent);
  border-radius: 10px;
}

.infographic-header h2 {
  font-size: clamp(1.8rem, 4vw, 2.7rem);
}

.infographic-brand {
  margin: 18px 0;
  padding: 12px;
  border-left-width: 4px;
}

.infographic-metrics {
  gap: 8px;
}

.info-metric {
  min-height: 96px;
  padding: 14px;
  color: var(--ink);
  background: #f5f7f7;
  border: 1px solid #d8e0e2;
  border-bottom: 3px solid var(--accent);
}

.info-metric span {
  color: #607075;
}

.info-metric strong {
  margin-top: 8px;
  font-size: 1.55rem;
}

.info-panel {
  min-height: 240px;
  padding: 16px;
  border: 1px solid #dce3e5;
}

@media (max-width: 760px) {
  .contract-grid {
    grid-template-columns: 1fr;
  }

  .workspace-toolbar {
    position: static;
    flex-direction: column;
  }

  .toolbar-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .document-header {
    padding: 22px;
  }

  .document-section {
    padding: 24px 22px;
  }
}

/* Vilagos, tabletbarat CL4 felulet */
:root {
  --ink: #102027;
  --canvas: #f4f8f9;
  --accent: #13b7c5;
  --accent-dark: #078793;
  --accent-soft: #e8fafa;
  --success: #16a34a;
  --danger: #dc2626;
}

html,
body {
  min-height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
}

body {
  background: #f4f8f9;
}

.app-header {
  position: sticky;
  top: 0;
  min-height: 76px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.98);
  border-bottom: 3px solid var(--accent);
  box-shadow: 0 3px 16px rgba(16, 32, 39, 0.08);
}

.brand-logo {
  background: transparent;
}

.brand-subtitle,
.offline-status {
  color: #557078;
}

.header-button {
  color: var(--ink);
  background: #fff;
  border-color: #b8dadd;
}

.main-nav {
  position: sticky;
  z-index: 12;
  top: 79px;
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  gap: 6px;
  padding: 7px;
  overflow-x: auto;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 4px 16px rgba(16, 32, 39, 0.06);
}

.nav-button {
  min-height: 52px;
  color: #31525a;
  white-space: nowrap;
  background: #f5fbfc;
}

.nav-button.active {
  color: #063d43;
  background: var(--accent-soft);
  box-shadow: inset 0 -4px 0 var(--accent);
}

.contract-card,
.saved-row,
.dashboard-panel,
.info-panel,
.export-card {
  background: #fff;
  box-shadow: 0 5px 18px rgba(16, 32, 39, 0.07);
}

.contract-card {
  border-color: #d8e7e9;
  border-left-color: var(--accent);
}

.contract-card:hover,
.contract-card:focus-visible {
  box-shadow: 0 8px 24px rgba(19, 183, 197, 0.14);
  transform: translateY(-2px);
}

.event-contract-grid {
  max-width: 650px;
}

.button {
  min-height: 50px;
}

.button-primary {
  color: #fff;
  background: var(--accent);
  box-shadow: none;
}

.workspace-toolbar {
  top: 79px;
}

.infographic-section {
  color: var(--ink);
  background: #f7fbfc;
  border: 1px solid #dcebed;
}

.infographic-brand,
.info-panel,
.info-metric {
  background: #fff;
}

.info-metric {
  color: var(--ink);
}

.export-card {
  min-height: 130px;
  color: var(--ink);
  border: 1px solid #d8e7e9;
  border-left: 5px solid var(--accent);
}

.export-card span {
  color: #5d7278;
}

.status-badge.error,
.evidence-status span.error {
  color: var(--danger);
  background: #fff1f1;
  border-color: #f4b6b6;
}

@media (max-width: 820px) {
  .main-nav {
    top: 76px;
    grid-template-columns: repeat(4, minmax(150px, 1fr));
  }

  .app-shell {
    width: min(100% - 18px, 1320px);
    padding-top: 18px;
  }
}

/* CL4 branded interface */
:root {
  --dark: #0e1416;
  --dark-soft: #182126;
  --cyan-glow: rgba(16, 169, 183, 0.22);
}

.app-header {
  min-height: 104px;
  padding: 15px clamp(20px, 4vw, 64px);
  background: linear-gradient(115deg, rgba(16, 169, 183, 0.12), transparent 38%), rgba(10, 15, 17, 0.98);
  border-bottom-width: 4px;
}

.brand-logo {
  width: 112px;
  height: 76px;
  border-radius: 8px;
  box-shadow: 0 0 0 2px rgba(17, 184, 197, 0.35);
}

.brand h1 {
  font-size: clamp(1.2rem, 2.2vw, 1.8rem);
}

.brand-subtitle {
  margin: 6px 0 0;
  color: #8edfe5;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.main-nav {
  padding: 8px;
  background: var(--dark);
  border-color: #29363a;
  border-bottom: 3px solid var(--accent);
}

.nav-button {
  flex: 1;
  min-height: 54px;
  color: #b9c4c8;
}

.nav-button.active {
  color: #061113;
  background: var(--accent);
  box-shadow: 0 8px 24px var(--cyan-glow);
}

.contract-card {
  border: 1px solid #cfdadd;
  border-top: 5px solid var(--dark);
}

.contract-card:hover,
.contract-card:focus-visible {
  border-top-color: var(--accent);
}

.card-number {
  display: inline-grid;
  width: 38px;
  height: 38px;
  place-items: center;
  color: #fff;
  background: var(--dark);
  border-left: 4px solid var(--accent);
}

.button {
  min-height: 48px;
  padding: 11px 18px;
  border-radius: 7px;
  letter-spacing: 0.01em;
  text-transform: uppercase;
}

.button-primary {
  color: #071315;
  box-shadow: 0 8px 22px var(--cyan-glow);
}

.saved-filters {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 12px;
  margin-bottom: 18px;
  padding: 14px;
  background: var(--dark);
  border-left: 5px solid var(--accent);
  border-radius: 10px;
}

.saved-filters input,
.saved-filters select {
  min-height: 48px;
  padding: 10px 12px;
  background: #fff;
  border: 1px solid #516267;
  border-radius: 7px;
}

.workspace-toolbar {
  top: 104px;
  background: rgba(14, 20, 22, 0.96);
}

.stepper {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  width: min(960px, 100%);
  margin: 0 auto 18px;
  padding: 10px;
  background: var(--dark);
  border-bottom: 3px solid var(--accent);
  border-radius: 12px;
}

.step {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 8px;
  align-items: center;
  min-height: 56px;
  padding: 8px;
  color: #9eaeb3;
  text-align: left;
  background: transparent;
  border: 1px solid #2c393d;
  border-radius: 8px;
}

.step span {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  background: #263237;
  border-radius: 50%;
  font-weight: 900;
}

.step strong {
  font-size: 0.75rem;
}

.step.active {
  color: #071315;
  background: var(--accent);
  border-color: var(--accent);
}

.step.active span {
  color: #fff;
  background: var(--dark);
}

.step.done {
  color: #b9eff2;
  border-color: #26777e;
}

.step.done span {
  color: var(--dark);
  background: var(--accent);
}

.step.error {
  color: #fff;
  background: #a92e2e;
  border-color: #e36c6c;
}

.contract-document {
  border-top: 6px solid var(--accent);
  box-shadow: 0 26px 80px rgba(9, 17, 19, 0.18);
}

.document-header {
  background: linear-gradient(90deg, rgba(16, 169, 183, 0.08), transparent 55%), #fff;
  border-bottom-color: var(--dark);
}

.gender-estimate > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  background: #edf9fa;
  border-left: 5px solid var(--accent);
  border-radius: 7px;
}

.gender-estimate strong {
  color: var(--accent-dark);
}

.gender-estimate label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  font-weight: 700;
}

.gender-estimate select {
  width: auto;
  min-width: 140px;
}

.infographic-section {
  padding: 26px;
  color: #fff;
  background: linear-gradient(135deg, rgba(16, 169, 183, 0.12), transparent 38%), var(--dark);
  border-top: 6px solid var(--accent);
  border-radius: 16px;
}

.infographic-header,
.infographic-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.report-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

.test-data-toggle {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 44px;
  padding: 8px 12px;
  color: var(--ink);
  background: #fff;
  border-radius: 8px;
  font-weight: 700;
}

.test-data-toggle input {
  width: 20px;
  height: 20px;
}

.report-number-filter {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.report-number-filter input {
  width: 7rem;
  min-height: 44px;
  padding: 8px 12px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.test-data-notice {
  margin: 16px 0 0;
  padding: 12px 14px;
  color: #3d2a00;
  background: #fff4cc;
  border-left: 5px solid #ffb547;
  border-radius: 7px;
  font-weight: 700;
}

.stress-test-result {
  margin: 18px 0;
  padding: 20px;
  background: #f5fffa;
  border: 2px solid #64bd86;
  border-radius: 10px;
}

.stress-test-result h3 {
  margin: 0 0 14px;
  color: #176b36;
}

.stress-test-result dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 18px;
  margin: 0;
}

.stress-test-result dl div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 0;
  border-bottom: 1px solid #cfe8d8;
}

.stress-test-result dd {
  margin: 0;
  text-align: right;
}

@media (max-width: 700px) {
  .stress-test-result dl {
    grid-template-columns: 1fr;
  }
}

.stress-test-closed {
  margin: 18px 0 0;
  padding: 12px;
  color: #125d2e;
  background: #dff5e6;
  border-radius: 7px;
  font-weight: 800;
}

.danger-button {
  color: #8d2424;
  border-color: #e7b9b9;
}

.gender-question {
  margin: 10px 0 0;
  padding: 10px 12px;
  color: #704900;
  background: #fff5d9;
  border-left: 4px solid #e5a51b;
  border-radius: 6px;
  font-weight: 700;
}

.annual-report-panel {
  margin: 18px 0;
  padding: 20px;
  background: #fff;
  border: 1px solid #d8e7e9;
  border-radius: 10px;
}

.annual-report-panel h3 {
  margin-top: 0;
}

.annual-table {
  min-width: 760px;
}

.annual-table > div {
  display: grid;
  grid-template-columns: 80px repeat(5, minmax(110px, 1fr));
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid #e2ecee;
}

#annualSummaryTable {
  overflow-x: auto;
}

.annual-table-head {
  color: #34565d;
  background: #eef8f9;
  font-weight: 800;
}

.positive-change {
  color: #18733a;
  font-weight: 800;
}

.negative-change {
  color: #a12d2d;
  font-weight: 800;
}

.import-modal {
  width: min(1100px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  padding: 0;
  border: 0;
  border-radius: 12px;
  box-shadow: 0 24px 70px rgba(10, 35, 40, 0.25);
}

.import-modal::backdrop {
  background: rgba(7, 22, 26, 0.62);
}

.import-modal-header,
.import-modal-footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
  padding: 20px 24px;
  background: #f5fbfc;
  border-bottom: 1px solid #d9e8ea;
}

.import-modal-footer {
  justify-content: flex-end;
  border-top: 1px solid #d9e8ea;
  border-bottom: 0;
}

.import-modal-header h2,
.import-modal-header p {
  margin: 0;
}

.import-modal-body {
  max-height: calc(100vh - 210px);
  padding: 22px 24px;
  overflow: auto;
}

.import-modal-body section {
  margin-top: 22px;
}

.import-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  gap: 10px;
}

.import-summary div {
  padding: 12px;
  background: #eef8f9;
  border-radius: 8px;
}

.import-summary span,
.import-summary strong {
  display: block;
}

.import-summary strong {
  margin-top: 5px;
  font-size: 1.35rem;
}

.import-mapping > div {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.mapping-field {
  display: grid;
  gap: 5px;
  min-width: 220px;
  padding: 9px;
  background: #f4f9fa;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 700;
}

.import-issues {
  display: grid;
  gap: 7px;
  max-height: 310px;
  overflow: auto;
}

.import-issues > div,
.import-gender-row {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  padding: 9px 11px;
  background: #f8fbfb;
  border: 1px solid #dce8ea;
  border-radius: 7px;
}

.import-gender-row select {
  min-width: 150px;
}

.compact-check {
  margin-top: 12px;
}

.birth-date-fields {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 10px;
  margin-top: 7px;
}

.birth-date-fields label {
  display: grid;
  gap: 6px;
}

.birth-date-fields label > span {
  font-size: 0.78rem;
}

.print-selection-modal {
  width: min(760px, calc(100vw - 32px));
  padding: 0;
  border: 0;
  border-radius: 12px;
  box-shadow: 0 24px 70px rgba(10, 35, 40, 0.25);
}

.print-selection-modal::backdrop {
  background: rgba(7, 22, 26, 0.62);
}

.print-selection-header,
.print-selection-footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
  padding: 20px 24px;
  background: #f5fbfc;
}

.print-selection-header {
  border-bottom: 1px solid #d9e8ea;
}

.print-selection-footer {
  justify-content: flex-end;
  border-top: 1px solid #d9e8ea;
}

.print-selection-header h2,
.print-selection-header p {
  margin: 0;
}

.print-selection-body {
  padding: 24px;
}

.print-selection-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.print-selection-grid label {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 12px;
  background: #f4f9fa;
  border: 1px solid #dce8ea;
  border-radius: 8px;
  font-weight: 700;
}

.print-selection-error {
  margin: 16px 0 0;
  color: #a12d2d;
  font-weight: 800;
}

.transition-group + .transition-group {
  margin-top: 18px;
}

.transition-group h4 {
  margin: 0 0 8px;
}

@media (max-width: 700px) {
  .import-summary {
    grid-template-columns: repeat(2, 1fr);
  }

  .import-modal-header {
    align-items: flex-start;
  }

  .import-issues > div,
  .import-gender-row {
    align-items: stretch;
    flex-direction: column;
  }

  .print-selection-grid {
    grid-template-columns: 1fr;
  }

  .birth-date-fields {
    grid-template-columns: 1fr;
  }
}

.button.finalize-button {
  width: 100%;
  min-height: 72px;
  padding: 18px 24px;
  font-size: 1.08rem;
}

.infographic-header h2,
.infographic-header p {
  margin: 0;
}

.infographic-header h2 {
  font-size: clamp(2rem, 5vw, 3.7rem);
}

.infographic-brand {
  justify-content: flex-start;
  margin: 28px 0;
  padding: 18px;
  background: #fff;
  border-left: 7px solid var(--accent);
  border-radius: 10px;
}

.infographic-brand img {
  width: 125px;
  height: 86px;
  object-fit: contain;
}

.infographic-brand strong,
.infographic-brand span {
  display: block;
}

.infographic-brand strong {
  color: var(--dark);
  font-size: 1.5rem;
}

.infographic-brand span {
  color: #66767b;
}

.infographic-metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}

.info-metric {
  min-height: 126px;
  padding: 19px;
  background: var(--dark-soft);
  border: 1px solid #334247;
  border-bottom: 4px solid var(--accent);
  border-radius: 10px;
}

.info-metric span {
  color: #9db0b5;
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.info-metric strong {
  display: block;
  margin-top: 15px;
  font-size: 1.9rem;
}

.infographic-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.info-panel {
  min-height: 280px;
  padding: 20px;
  color: var(--ink);
  background: #fff;
  border-radius: 10px;
}

.info-panel h3 {
  margin: 0 0 18px;
  padding-bottom: 10px;
  border-bottom: 3px solid var(--accent);
}

.tile-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 10px;
  margin: -4px 0 14px;
  padding: 12px;
  background: #f3fafb;
  border: 1px solid #d6e8ea;
  border-radius: 8px;
}

.tile-controls label {
  display: grid;
  gap: 4px;
  color: #557078;
  font-size: 0.74rem;
  font-weight: 800;
}

.tile-controls input,
.tile-controls select {
  width: 9rem;
  min-height: 38px;
  padding: 6px 9px;
  color: #102027;
  background: #fff;
  border: 1px solid #b8dadd;
  border-radius: 7px;
}

.tile-controls .button {
  min-height: 38px;
  padding: 7px 11px;
}

.tile-setting-summary {
  margin: 0 0 14px;
  color: #557078;
  font-size: 0.82rem;
  font-weight: 700;
}

.returning-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

.returning-metrics > div {
  padding: 10px;
  background: #eef9fa;
  border-radius: 8px;
}

.returning-metrics span,
.returning-metrics strong {
  display: block;
}

.returning-metrics span {
  color: #557078;
  font-size: 0.72rem;
  font-weight: 800;
}

.returning-metrics strong {
  margin-top: 5px;
  font-size: 1.45rem;
}

.returning-list {
  display: grid;
  gap: 7px;
  max-height: 340px;
  overflow: auto;
}

.returning-list > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid #e1ecee;
}

.returning-list span {
  color: #557078;
  font-size: 0.76rem;
  text-align: right;
}

.monthly-column-chart {
  grid-template-columns: repeat(12, minmax(30px, 1fr));
}

.unique-people-section {
  margin-top: 14px;
}

.unique-summary-metrics {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.unique-people-table {
  display: grid;
  max-height: 620px;
  overflow: auto;
  border: 1px solid #d8e7e9;
  border-radius: 8px;
}

.unique-people-table > div {
  display: grid;
  grid-template-columns: 1.4fr 0.8fr 1fr 0.65fr 0.8fr 1fr;
  gap: 10px;
  align-items: center;
  padding: 9px 11px;
  border-bottom: 1px solid #e1ecee;
  font-size: 0.78rem;
}

.unique-people-table .unique-table-head {
  position: sticky;
  z-index: 1;
  top: 0;
  color: #fff;
  background: #31525a;
  font-weight: 800;
}

.unique-people-table .uncertain-match {
  background: #fff7df;
}

.county-detail-metrics {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.donut-layout {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 20px;
  align-items: center;
}

.donut-chart {
  width: 180px;
  height: 180px;
}

.donut-chart text {
  fill: var(--dark);
  font-size: 22px;
  font-weight: 900;
}

.donut-chart .donut-caption {
  fill: #718086;
  font-size: 8px;
}

.chart-legend-row {
  display: grid;
  grid-template-columns: 12px 1fr auto;
  gap: 8px;
  align-items: center;
  margin: 9px 0;
  font-size: 0.8rem;
}

.chart-legend-row i {
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

.column-chart {
  display: flex;
  align-items: end;
  gap: 8px;
  height: 190px;
  padding-top: 12px;
  border-bottom: 2px solid #bdc9cc;
}

.column-item {
  display: grid;
  flex: 1;
  align-items: end;
  justify-items: center;
  min-width: 24px;
}

.column-item span {
  display: block;
  width: 72%;
  min-width: 14px;
  background: linear-gradient(to top, var(--accent-dark), var(--accent));
  border-radius: 5px 5px 0 0;
}

.column-item strong,
.column-item small {
  font-size: 0.65rem;
}

.export-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.export-card {
  min-height: 180px;
  padding: 26px;
  color: #fff;
  text-align: left;
  background: var(--dark);
  border: 1px solid #354347;
  border-left: 7px solid var(--accent);
  border-radius: 12px;
}

.export-card strong,
.export-card span {
  display: block;
}

.export-card strong {
  font-size: 1.35rem;
}

.export-card span {
  margin-top: 12px;
  color: #aab9bd;
}

.pdf-final-step {
  min-height: 360px;
  text-align: center;
}

.pdf-final-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 30px;
}

@media (max-width: 900px) {
  .infographic-metrics {
    grid-template-columns: repeat(2, 1fr);
  }

  .donut-layout {
    grid-template-columns: 1fr;
    justify-items: center;
  }
}

@media (max-width: 660px) {
  .app-header {
    min-height: 86px;
  }

  .brand-logo {
    width: 76px;
    height: 54px;
  }

  .main-nav {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
  }

  .saved-filters,
  .stepper,
  .infographic-metrics,
  .infographic-grid,
  .export-cards {
    grid-template-columns: 1fr;
  }

  .gender-estimate > div,
  .infographic-header,
  .pdf-final-actions {
    align-items: stretch;
    flex-direction: column;
  }
}

@media print {
  body:has(#infographicView:not(.hidden)) {
    background: #fff;
  }

  body:has(#infographicView:not(.hidden)) .app-header,
  body:has(#infographicView:not(.hidden)) .main-nav,
  body:has(#infographicView:not(.hidden)) #contractsView,
  body:has(#infographicView:not(.hidden)) #savedView,
  body:has(#infographicView:not(.hidden)) #dashboardView,
  body:has(#infographicView:not(.hidden)) #exportView,
  body:has(#infographicView:not(.hidden)) .no-print {
    display: none !important;
  }

  body.print-selection-active [data-print-section].print-excluded {
    display: none !important;
  }

  .infographic-section {
    padding: 0;
    color: #111;
    background: #fff;
    border: 0;
  }

  .info-metric {
    color: #111;
    background: #fff;
    border: 1px solid #9aabad;
  }

  .info-panel {
    break-inside: avoid;
    border: 1px solid #c6d1d3;
  }

  .returning-list {
    max-height: none;
    overflow: visible;
  }

  .unique-people-table {
    max-height: none;
    overflow: visible;
  }

  .unique-people-table .unique-table-head {
    position: static;
  }
}

/* A fajl vegen ervenyesulo vilagos CL4 tema */
.app-header {
  min-height: 76px;
  padding: 10px clamp(16px, 4vw, 54px);
  color: #102027;
  background: rgba(255, 255, 255, 0.98);
  border-bottom: 3px solid #13b7c5;
  box-shadow: 0 3px 16px rgba(16, 32, 39, 0.08);
}

.brand-logo {
  width: 86px;
  height: 60px;
  background: transparent;
  box-shadow: none;
}

.brand h1 {
  color: #102027;
}

.brand-subtitle,
.offline-status {
  color: #557078;
}

.header-button {
  color: #102027;
  background: #fff;
  border-color: #b8dadd;
}

.main-nav {
  position: sticky;
  z-index: 12;
  top: 79px;
  display: grid;
  grid-template-columns: repeat(4, minmax(135px, 1fr));
  gap: 6px;
  margin-bottom: 24px;
  padding: 7px;
  overflow-x: auto;
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid #d8e7e9;
  border-bottom: 2px solid #13b7c5;
  box-shadow: 0 4px 16px rgba(16, 32, 39, 0.06);
}

.nav-button {
  min-height: 52px;
  color: #31525a;
  white-space: nowrap;
  background: #f5fbfc;
}

.nav-button.active {
  color: #063d43;
  background: #e8fafa;
  box-shadow: inset 0 -4px 0 #13b7c5;
}

.workspace-toolbar {
  top: 79px;
  background: rgba(255, 255, 255, 0.97);
  border-color: #d4e5e7;
}

.contract-card,
.saved-row,
.dashboard-panel,
.info-panel,
.export-card {
  color: #102027;
  background: #fff;
  box-shadow: 0 5px 18px rgba(16, 32, 39, 0.07);
}

.infographic-section {
  color: #102027;
  background: #f7fbfc;
  border: 1px solid #dcebed;
  border-top: 4px solid #13b7c5;
}

.info-metric {
  color: #102027;
  background: #fff;
  border-color: #d8e7e9;
}

.export-card {
  min-height: 130px;
  border: 1px solid #d8e7e9;
  border-left: 5px solid #13b7c5;
}

.export-card span {
  color: #5d7278;
}

@media (max-width: 820px) {
  .main-nav {
    top: 76px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    overflow-x: visible;
  }

  .nav-button {
    padding-inline: 6px;
    font-size: 0.72rem;
    white-space: normal;
  }
}

/* iPad PWA overrides */
button,
input,
select,
textarea {
  font-size: 16px;
}

.offline-status {
  flex-wrap: wrap;
  gap: 10px;
}

.main-nav {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  overflow-x: visible;
}

.nav-button {
  width: 100%;
  white-space: normal;
}

.app-shell {
  max-width: 100%;
}

.contract-document,
.saved-row,
.saved-heading,
.contract-grid,
.form-grid,
.signature-grid,
.infographic-grid,
.dashboard-grid,
.dashboard-cards {
  max-width: 100%;
}

.signature-canvas {
  width: 100%;
  touch-action: none;
}

body.signature-drawing-active {
  overflow: hidden;
  overscroll-behavior: contain;
}

.ipad-status-panel {
  display: grid;
  gap: 6px;
  margin-top: 12px;
  padding: 12px 14px;
  color: #1a2b2f;
  background: #eef8fa;
  border: 1px solid #cce7ea;
  border-radius: 10px;
}

.ipad-status-panel p {
  margin: 0;
}

.backup-reminder {
  color: #8a5a00;
  font-weight: 700;
}

.saved-heading {
  flex-wrap: wrap;
}

.backup-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.backup-encryption-toggle {
  min-width: 220px;
  align-items: center;
}

#backupImportInput {
  display: none;
}

.field input,
.field select,
.saved-filters input,
.saved-filters select,
.tile-controls input,
.tile-controls select {
  font-size: 16px;
  max-width: 100%;
}

.birth-date-fields {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.toast {
  max-width: min(520px, calc(100% - 32px));
  font-size: 0.95rem;
}

.infographic-grid,
.dashboard-grid,
.dashboard-cards {
  align-items: start;
}

.info-panel,
.dashboard-panel {
  min-width: 0;
  overflow: hidden;
}

.column-chart,
.bar-row,
.returning-list,
.unique-people-table {
  max-width: 100%;
}

@media (max-width: 820px) {
  .main-nav {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .nav-button {
    font-size: 0.75rem;
  }
}

@media (max-width: 1024px) {
  body {
    overflow-x: hidden;
  }

  .app-shell {
    width: min(100% - 18px, 1320px);
    padding-top: 18px;
  }

  .contract-grid,
  .form-grid,
  .dashboard-grid,
  .dashboard-cards,
  .infographic-grid {
    grid-template-columns: 1fr;
  }

  .contract-card,
  .contract-card:nth-child(4),
  .contract-card:last-child,
  .field-wide {
    grid-column: auto;
  }

  .saved-row {
    grid-template-columns: 1fr;
  }

  .document-header {
    grid-template-columns: 1fr;
  }

  .signature-canvas {
    height: 170px;
  }

  .annual-table {
    min-width: 0;
    width: 100%;
  }

  .annual-table > div {
    grid-template-columns: 64px repeat(5, minmax(0, 1fr));
  }

  .infographic-grid {
    gap: 12px;
  }

  .info-panel {
    min-height: 240px;
  }
}

@media (max-width: 900px) {
  .main-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .nav-button {
    width: 100%;
    min-width: 0;
  }
}

@media (max-width: 820px) {
  .saved-heading,
  .saved-filters,
  .toolbar-actions {
    grid-template-columns: 1fr;
  }
}

img.logo,
.auth-brand img,
.stats-logo,
.report-logo,
.dashboard-logo,
.brand-logo,
.app-logo,
.document-logo-image,
.infographic-brand img {
  width: auto;
  height: auto;
  max-width: 120px;
  max-height: 90px;
  object-fit: contain;
  aspect-ratio: auto;
  flex-shrink: 0;
}

.infographic-brand {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.saved-row,
.saved-row strong,
.saved-row span,
.status-badge {
  overflow-wrap: anywhere;
  word-break: normal;
}

.saved-row {
  color: #172126;
  background: #fff;
}

.saved-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

@media (orientation: portrait), (max-width: 900px) {
  .app-header,
  .brand,
  .offline-status,
  .saved-heading,
  .saved-filters,
  .workspace-toolbar,
  .toolbar-actions,
  .report-actions,
  .backup-actions,
  .signature-label {
    min-width: 0;
    max-width: 100%;
  }

  .app-header {
    position: static;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 12px;
  }

  .offline-status {
    justify-content: space-between;
  }

  .app-shell {
    width: 100%;
    padding: 14px 10px 48px;
  }

  .main-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    margin-bottom: 20px;
  }

  .contract-grid,
  .form-grid,
  .signature-grid,
  .infographic-grid,
  .dashboard-grid,
  .dashboard-cards,
  .infographic-metrics,
  .document-header,
  .saved-row,
  .saved-filters {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .contract-card,
  .contract-card:nth-child(4),
  .contract-card:last-child,
  .field,
  .field-wide,
  .signature-block,
  .info-panel,
  .metric-card,
  .saved-row > * {
    grid-column: 1 !important;
    min-width: 0;
    max-width: 100%;
  }

  .field input,
  .field select,
  .field textarea,
  .saved-filters input,
  .saved-filters select,
  .signature-canvas,
  .button,
  .row-button {
    width: 100%;
    max-width: 100%;
  }

  .birth-date-fields {
    grid-template-columns: minmax(0, 1fr);
  }

  .saved-actions,
  .toolbar-actions,
  .report-actions,
  .backup-actions {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
  }

  .contract-document,
  .document-section,
  .signature-block {
    width: 100%;
    max-width: 100%;
  }

  .signature-canvas {
    min-height: 190px;
  }

  .saved-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .infographic-brand {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (orientation: landscape) and (min-width: 901px) and (max-width: 1366px) {
  .contract-grid,
  .form-grid,
  .infographic-grid,
  .dashboard-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-cards {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .contract-card,
  .contract-card:nth-child(4),
  .contract-card:last-child {
    grid-column: auto;
  }

  .field-wide {
    grid-column: span 2;
  }
}
