:root {
  --bg: #eef2f8;
  --bg-elevated: #ffffff;
  --text: #0f172a;
  --text-soft: #475569;
  --text-muted: #64748b;
  --line: rgba(15, 23, 42, 0.08);
  --line-strong: rgba(15, 23, 42, 0.12);
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-soft: rgba(37, 99, 235, 0.1);
  --secondary: #0f766e;
  --secondary-soft: rgba(15, 118, 110, 0.1);
  --violet: #7c3aed;
  --violet-soft: rgba(124, 58, 237, 0.1);
  --gold: #b45309;
  --gold-soft: rgba(180, 83, 9, 0.1);
  --danger: #dc2626;
  --danger-soft: rgba(220, 38, 38, 0.08);
  --success: #059669;
  --warning: #d97706;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow: 0 12px 40px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 24px 60px rgba(15, 23, 42, 0.12);
  --radius-sm: 12px;
  --radius: 18px;
  --radius-lg: 24px;
  --header-height: 72px;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Plus Jakarta Sans", system-ui, -apple-system, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

img,
svg {
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font: inherit;
}

.app-shell {
  position: relative;
  min-height: 100vh;
  overflow-x: clip;
}

.ambient {
  position: fixed;
  border-radius: 50%;
  filter: blur(80px);
  pointer-events: none;
  z-index: 0;
}

.ambient-a {
  width: 420px;
  height: 420px;
  top: -120px;
  right: -80px;
  background: rgba(37, 99, 235, 0.18);
}

.ambient-b {
  width: 360px;
  height: 360px;
  bottom: 10%;
  left: -100px;
  background: rgba(15, 118, 110, 0.14);
}

.container {
  position: relative;
  z-index: 1;
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(16px) saturate(160%);
  background: rgba(255, 255, 255, 0.78);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: var(--header-height);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.28);
}

.brand-copy {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.brand-copy strong {
  font-size: 1.02rem;
  letter-spacing: -0.02em;
}

.brand-copy span:last-child {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.nav-link {
  padding: 0.55rem 0.85rem;
  border-radius: 999px;
  color: var(--text-soft);
  font-weight: 600;
  font-size: 0.92rem;
  transition: background 0.15s ease, color 0.15s ease;
}

.nav-link:hover {
  background: rgba(15, 23, 42, 0.04);
  color: var(--text);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.68rem 1rem;
  border-radius: 999px;
  border: 1px solid transparent;
  font-weight: 700;
  font-size: 0.92rem;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  white-space: nowrap;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), #1e40af);
  color: white;
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.24);
}

.btn-primary:hover {
  box-shadow: 0 14px 28px rgba(37, 99, 235, 0.3);
}

.btn-secondary {
  background: linear-gradient(135deg, var(--secondary), #115e59);
  color: white;
  box-shadow: 0 10px 24px rgba(15, 118, 110, 0.22);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.8);
  border-color: var(--line-strong);
  color: var(--text-soft);
}

.btn-ghost:hover {
  background: white;
  color: var(--text);
}

.btn-lg {
  padding: 0.9rem 1.25rem;
  font-size: 0.98rem;
}

.btn-block {
  width: 100%;
}

/* Layout */
.main-content {
  padding: 2.5rem 0 5rem;
}

.site-footer {
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.55);
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.4rem 0 2rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.footer-tags {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.footer-tags span {
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.05);
  font-size: 0.78rem;
  font-weight: 600;
}

/* Typography */
.eyebrow {
  margin: 0 0 0.65rem;
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--primary);
}

.eyebrow-light {
  color: rgba(255, 255, 255, 0.78);
}

h1,
h2,
h3 {
  margin: 0;
  letter-spacing: -0.03em;
  line-height: 1.12;
}

h1 {
  font-size: clamp(2rem, 4vw, 3.2rem);
}

h2 {
  font-size: clamp(1.35rem, 2vw, 1.75rem);
}

.lead {
  margin: 0;
  color: var(--text-soft);
  font-size: 1.06rem;
  max-width: 58ch;
}

.lead.narrow {
  max-width: 42ch;
}

.meta,
.muted {
  color: var(--text-muted);
}

/* Toasts */
.toast-stack {
  margin-top: 1rem;
}

.toast {
  padding: 0.9rem 1rem;
  border-radius: var(--radius-sm);
  margin-bottom: 0.65rem;
  font-weight: 600;
  border: 1px solid transparent;
}

.toast-success,
.toast.success {
  background: #ecfdf5;
  color: var(--success);
  border-color: rgba(5, 150, 105, 0.15);
}

.toast-error,
.toast.error {
  background: #fef2f2;
  color: var(--danger);
  border-color: rgba(220, 38, 38, 0.15);
}

/* Hero home */
.hero-panel {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 2rem;
  align-items: center;
  margin-bottom: 2rem;
  padding: 2rem;
  border-radius: var(--radius-lg);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(255, 255, 255, 0.82)),
    linear-gradient(135deg, rgba(37, 99, 235, 0.06), rgba(15, 118, 110, 0.05));
  border: 1px solid rgba(255, 255, 255, 0.8);
  box-shadow: var(--shadow);
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 1rem;
}

.pill,
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.32rem 0.72rem;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.pill {
  background: rgba(15, 23, 42, 0.05);
  color: var(--text-soft);
}

.pill-accent {
  background: var(--primary-soft);
  color: var(--primary);
}

.badge-invoice {
  background: var(--primary-soft);
  color: var(--primary);
}

.badge-contract {
  background: var(--secondary-soft);
  color: var(--secondary);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.6rem;
}

.hero-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: 1.75rem;
}

.metric-chip {
  padding: 0.85rem 0.95rem;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
}

.metric-value {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text);
}

.metric-label {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.74rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.hero-visual {
  display: grid;
  place-items: center;
}

.preview-stack {
  position: relative;
  width: min(100%, 360px);
  min-height: 320px;
}

.preview-card {
  position: absolute;
  width: 100%;
  padding: 1.1rem 1.15rem;
  border-radius: var(--radius);
  background: white;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.preview-invoice {
  top: 0;
  left: 0;
  transform: rotate(-3deg);
}

.preview-contract {
  bottom: 0;
  right: 0;
  transform: rotate(3deg);
  background: linear-gradient(180deg, #ffffff, #f8fafc);
}

.preview-head {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 0.85rem;
  font-size: 0.88rem;
  font-weight: 700;
}

.preview-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--primary);
}

.preview-dot-green {
  background: var(--secondary);
}

.preview-lines span {
  display: block;
  height: 8px;
  margin-bottom: 0.45rem;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.08);
}

.preview-lines span:nth-child(1) { width: 92%; }
.preview-lines span:nth-child(2) { width: 78%; }
.preview-lines span:nth-child(3) { width: 64%; }

.preview-total {
  margin-top: 1rem;
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--primary);
}

.preview-list {
  margin: 0;
  padding-left: 1rem;
  color: var(--text-soft);
  font-size: 0.86rem;
}

.preview-list li + li {
  margin-top: 0.45rem;
}

/* Feature grid */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.feature-tile {
  padding: 1.35rem;
  border-radius: var(--radius);
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.feature-tile:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}

.tile-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  margin-bottom: 1rem;
}

.tile-icon-blue { background: var(--primary-soft); color: var(--primary); }
.tile-icon-teal { background: var(--secondary-soft); color: var(--secondary); }
.tile-icon-violet { background: var(--violet-soft); color: var(--violet); }

.feature-tile h3 {
  margin-bottom: 0.55rem;
  font-size: 1.05rem;
}

.feature-tile p {
  margin: 0;
  color: var(--text-soft);
  font-size: 0.94rem;
}

/* Section blocks */
.section-block {
  margin-top: 2rem;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.doc-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.doc-tile {
  padding: 1.2rem;
  border-radius: var(--radius);
  background: white;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.doc-tile:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
  border-color: rgba(37, 99, 235, 0.18);
}

.doc-tile-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.85rem;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--text-muted);
}

.status-completed { background: var(--success); }
.status-failed { background: var(--danger); }
.status-processing { background: var(--warning); }

.doc-tile h3 {
  font-size: 1.02rem;
  margin-bottom: 0.35rem;
}

.doc-tile-link {
  display: inline-block;
  margin-top: 0.85rem;
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--primary);
}

.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  border-radius: var(--radius-lg);
  background: white;
  border: 1px dashed var(--line-strong);
}

.empty-icon {
  font-size: 2.2rem;
  margin-bottom: 0.75rem;
}

.empty-state h2 {
  margin-bottom: 0.5rem;
}

.empty-state p {
  color: var(--text-soft);
  margin: 0 0 1.25rem;
}

/* Upload page */
.type-tabs {
  display: inline-flex;
  gap: 0.35rem;
  padding: 0.35rem;
  margin-bottom: 1.25rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}

.type-tab {
  padding: 0.55rem 1.1rem;
  border-radius: 999px;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-muted);
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.type-tab:hover {
  color: var(--text);
  background: rgba(15, 23, 42, 0.04);
}

.type-tab.is-active {
  background: white;
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.upload-page {
  max-width: 640px;
}

.upload-header {
  margin-bottom: 1.25rem;
}

.upload-header h1 {
  font-size: clamp(1.65rem, 3vw, 2.2rem);
  margin-bottom: 0.45rem;
}

.upload-subtitle {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.94rem;
}

.upload-form {
  padding: 1.35rem;
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.form-section-inline {
  margin-top: 1rem;
}

.page-intro {
  margin-bottom: 1.5rem;
}

.type-switch {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}

.type-switch-link {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--primary);
}

.type-switch-link:hover {
  text-decoration: underline;
}

.upload-layout {
  display: grid;
  grid-template-columns: 0.85fr 1.15fr;
  gap: 1rem;
  align-items: start;
}

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

.upload-steps {
  padding: 1.35rem;
}

.steps-list {
  list-style: none;
  margin: 1rem 0 0;
  padding: 0;
}

.steps-list li {
  display: flex;
  gap: 0.85rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--line);
}

.steps-list li:last-child {
  border-bottom: 0;
}

.step-num {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 0.82rem;
  font-weight: 800;
  flex-shrink: 0;
}

.steps-list p {
  margin: 0.2rem 0 0;
  color: var(--text-soft);
  font-size: 0.9rem;
}

.tip-box {
  margin-top: 1rem;
  padding: 0.95rem 1rem;
  border-radius: var(--radius-sm);
  background: #fffbeb;
  border: 1px solid rgba(217, 119, 6, 0.15);
}

.tip-box p {
  margin: 0.35rem 0 0;
  color: var(--text-soft);
  font-size: 0.9rem;
}

.upload-form {
  padding: 1.5rem;
}

.form-section + .form-section {
  margin-top: 1.35rem;
}

.form-label {
  display: block;
  margin-bottom: 0.65rem;
  font-weight: 700;
  font-size: 0.92rem;
}

.optional {
  color: var(--text-muted);
  font-weight: 500;
}

.upload-form input[type="text"] {
  width: 100%;
  padding: 0.85rem 1rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: #fbfdff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.upload-form input[type="text"]:focus {
  outline: none;
  border-color: rgba(37, 99, 235, 0.45);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.type-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.type-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding: 1rem;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--line);
  background: #fbfdff;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

.type-card input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.type-card.is-selected {
  border-color: var(--primary);
  background: rgba(37, 99, 235, 0.05);
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.08);
}

.type-card-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
}

.type-card-icon-invoice {
  background: var(--primary-soft);
  color: var(--primary);
}

.type-card-icon-contract {
  background: var(--secondary-soft);
  color: var(--secondary);
}

.type-card-title {
  font-weight: 800;
}

.type-card-desc {
  color: var(--text-muted);
  font-size: 0.86rem;
}

.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 190px;
  padding: 1.25rem;
  border-radius: var(--radius);
  border: 2px dashed rgba(37, 99, 235, 0.22);
  background:
    radial-gradient(circle at top, rgba(37, 99, 235, 0.05), transparent 55%),
    #fbfdff;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

.dropzone:hover,
.dropzone.is-dragover {
  border-color: var(--primary);
  background: rgba(37, 99, 235, 0.06);
  transform: translateY(-1px);
}

.dropzone.has-file {
  border-style: solid;
  border-color: rgba(15, 118, 110, 0.35);
  background: rgba(15, 118, 110, 0.05);
}

.dropzone-icon {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: white;
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.dropzone-title {
  margin: 0;
  font-weight: 700;
}

.dropzone-filename {
  margin: 0;
  font-weight: 700;
  color: var(--secondary);
}

.dropzone-meta,
.field-error {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.86rem;
}

.field-error {
  margin-top: 0.45rem;
  color: var(--danger);
  font-weight: 600;
}

.submit-btn .submit-loading {
  display: none;
}

.upload-form.is-submitting .submit-label {
  display: none;
}

.upload-form.is-submitting .submit-loading {
  display: inline;
}

.upload-form.is-submitting .submit-btn {
  opacity: 0.85;
  pointer-events: none;
}

/* Loading overlay */
.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background: rgba(15, 23, 42, 0.42);
  backdrop-filter: blur(6px);
}

.loading-overlay[hidden] {
  display: none;
}

.loading-card {
  width: min(420px, calc(100% - 2rem));
  padding: 1.5rem;
  border-radius: var(--radius);
  background: white;
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.loading-card p {
  margin: 0.45rem 0 0;
  color: var(--text-soft);
}

.spinner {
  width: 42px;
  height: 42px;
  margin: 0 auto 1rem;
  border-radius: 50%;
  border: 3px solid rgba(37, 99, 235, 0.15);
  border-top-color: var(--primary);
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Results */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 1rem;
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 600;
}

.breadcrumb a:hover {
  color: var(--primary);
}

.result-hero {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
  padding: 1.5rem;
  border-radius: var(--radius-lg);
  color: white;
  box-shadow: var(--shadow);
}

.result-hero-invoice {
  background: linear-gradient(135deg, #1d4ed8 0%, #2563eb 45%, #0f766e 100%);
}

.result-hero-contract {
  background: linear-gradient(135deg, #115e59 0%, #0f766e 45%, #7c3aed 100%);
}

.result-hero-badge {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 0.75rem;
}

.result-hero .badge {
  background: rgba(255, 255, 255, 0.16);
  color: white;
}

.status-badge {
  padding: 0.32rem 0.72rem;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
  background: rgba(255, 255, 255, 0.14);
}

.result-hero .meta {
  color: rgba(255, 255, 255, 0.78);
}

.result-hero-actions {
  display: flex;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.result-hero-actions .btn-ghost {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.18);
  color: white;
}

.result-hero-actions .btn-secondary {
  background: rgba(255, 255, 255, 0.18);
  box-shadow: none;
}

.kpi-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.85rem;
  margin-bottom: 1rem;
}

.kpi-card {
  padding: 1rem 1.05rem;
  border-radius: var(--radius);
  background: white;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}

.kpi-card-accent {
  background: linear-gradient(180deg, #ffffff, #eff6ff);
  border-color: rgba(37, 99, 235, 0.15);
}

.kpi-label {
  display: block;
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.kpi-value {
  display: block;
  margin-top: 0.35rem;
  font-size: 1.35rem;
  letter-spacing: -0.03em;
}

.kpi-value-sm {
  font-size: 1rem;
}

.kpi-card-accent .kpi-value {
  color: var(--primary);
}

.results-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

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

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

.card {
  overflow: hidden;
}

.card-head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1.1rem 1.2rem 0.85rem;
  border-bottom: 1px solid var(--line);
}

.card-head h2 {
  font-size: 1rem;
}

.card-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 11px;
  font-weight: 800;
  font-size: 0.82rem;
}

.card-icon-blue { background: var(--primary-soft); color: var(--primary); }
.card-icon-teal { background: var(--secondary-soft); color: var(--secondary); }
.card-icon-violet { background: var(--violet-soft); color: var(--violet); }
.card-icon-gold { background: var(--gold-soft); color: var(--gold); }
.card-icon-red { background: var(--danger-soft); color: var(--danger); }

.data-grid {
  margin: 0;
  padding: 0.35rem 1.2rem 1.1rem;
}

.data-grid div {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 0.75rem;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--line);
}

.data-grid div:last-child {
  border-bottom: 0;
}

.data-grid dt {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--text-muted);
}

.data-grid dd {
  margin: 0;
  color: var(--text);
}

.grand-row dd {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--primary);
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  word-break: break-all;
}

.highlight-value {
  padding: 0.35rem 0.55rem;
  border-radius: 8px;
  background: rgba(15, 118, 110, 0.06);
}

.sub-section {
  padding: 0 1.2rem 1.1rem;
}

.sub-section h3 {
  font-size: 0.88rem;
  margin-bottom: 0.65rem;
  color: var(--text-soft);
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.tag {
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.05);
  font-size: 0.82rem;
  font-weight: 600;
}

/* Table */
.table-shell {
  overflow: hidden;
}

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

.data-table th,
.data-table td {
  padding: 0.85rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--line);
  font-size: 0.9rem;
}

.data-table th {
  background: #f8fafc;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.data-table tbody tr:hover {
  background: rgba(37, 99, 235, 0.03);
}

.cell-strong {
  font-weight: 700;
}

.totals-panel {
  background: linear-gradient(180deg, #ffffff, #f8fbff);
}

.note-panel p {
  padding: 0 1.2rem 1.1rem;
  margin: 0;
}

/* Contract summary */
.summary-banner {
  display: flex;
  gap: 1rem;
  align-items: start;
  margin-bottom: 1rem;
  padding: 1.35rem 1.4rem;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, #0f172a, #1e293b);
  color: white;
  box-shadow: var(--shadow);
}

.summary-banner-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.1);
  font-size: 1.1rem;
  flex-shrink: 0;
}

.summary-text {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.65;
}

.summary-subject {
  margin: 0.75rem 0 0;
  color: rgba(255, 255, 255, 0.78);
}

.party-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.75rem;
  padding: 0 1.2rem 1.1rem;
}

.party-card {
  padding: 0.95rem;
  border-radius: var(--radius-sm);
  background: #f8fafc;
  border: 1px solid var(--line);
}

.party-role {
  display: block;
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--primary);
}

.party-name {
  display: block;
  margin-top: 0.25rem;
  font-size: 1rem;
}

.party-meta {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.86rem;
  color: var(--text-muted);
}

.action-list {
  list-style: none;
  margin: 0;
  padding: 0 1.2rem 1.1rem;
}

.action-item {
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--line);
}

.action-item:last-child {
  border-bottom: 0;
}

.action-item p {
  margin: 0.45rem 0 0;
}

.action-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.priority-badge {
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  background: rgba(15, 23, 42, 0.06);
  color: var(--text-soft);
}

.priority-high .priority-badge {
  background: var(--danger-soft);
  color: var(--danger);
}

.priority-medium .priority-badge {
  background: var(--gold-soft);
  color: var(--gold);
}

.action-date {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-muted);
}

.timeline {
  padding: 0.35rem 1.2rem 1.1rem;
}

.timeline-item {
  display: grid;
  grid-template-columns: 16px 1fr;
  gap: 0.85rem;
  padding-bottom: 1rem;
}

.timeline-item:last-child {
  padding-bottom: 0;
}

.timeline-marker {
  position: relative;
  width: 12px;
  height: 12px;
  margin-top: 0.25rem;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.timeline-item:not(:last-child) .timeline-marker::after {
  content: "";
  position: absolute;
  top: 16px;
  left: 5px;
  width: 2px;
  height: calc(100% + 12px);
  background: var(--line-strong);
}

.timeline-content {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.timeline-date {
  font-weight: 700;
  color: var(--primary);
}

.warning-chip {
  display: inline-block;
  margin-top: 0.25rem;
  padding: 0.35rem 0.55rem;
  border-radius: 8px;
  background: #fff7ed;
  color: var(--warning);
  font-size: 0.84rem;
  font-weight: 600;
}

.penalty-grid,
.check-list,
.risk-list {
  padding: 0.35rem 1.2rem 1.1rem;
}

.penalty-item {
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--line);
}

.penalty-item:last-child {
  border-bottom: 0;
}

.penalty-item p {
  margin: 0.35rem 0;
  color: var(--text-soft);
}

.alert-panel {
  background: linear-gradient(180deg, #ffffff, #fff7f7);
  border-color: rgba(220, 38, 38, 0.12);
}

.risk-panel {
  background: linear-gradient(180deg, #ffffff, #fffbeb);
  border-color: rgba(217, 119, 6, 0.12);
}

.check-list,
.risk-list {
  margin: 0;
  padding-left: 1.2rem;
}

.check-list li + li,
.risk-list li + li {
  margin-top: 0.55rem;
}

/* Preview panel */
.preview-panel summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.2rem;
  cursor: pointer;
  font-weight: 700;
  list-style: none;
}

.preview-panel summary::-webkit-details-marker {
  display: none;
}

.summary-chevron {
  transition: transform 0.15s ease;
  color: var(--text-muted);
}

.preview-panel[open] .summary-chevron {
  transform: rotate(180deg);
}

.preview-body {
  padding: 0 1.2rem 1.2rem;
}

.doc-preview {
  width: 100%;
  min-height: 520px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.doc-preview-image {
  width: 100%;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
}

/* Responsive */
@media (max-width: 980px) {
  .hero-panel,
  .upload-layout,
  .feature-grid,
  .doc-grid,
  .results-grid,
  .results-grid-3,
  .kpi-row,
  .hero-metrics {
    grid-template-columns: 1fr;
  }

  .span-2 {
    grid-column: auto;
  }

  .preview-stack {
    min-height: 280px;
  }

  .preview-invoice,
  .preview-contract {
    position: relative;
    transform: none;
  }

  .preview-contract {
    margin-top: 0.75rem;
  }

  .header-inner,
  .footer-inner,
  .result-hero,
  .section-heading {
    flex-direction: column;
    align-items: start;
  }

  .data-grid div {
    grid-template-columns: 1fr;
    gap: 0.2rem;
  }
}

@media (max-width: 640px) {
  .nav-links {
    width: 100%;
    justify-content: stretch;
  }

  .nav-links .btn,
  .nav-link {
    flex: 1;
    justify-content: center;
  }

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