/* ═══════════════════════════════════════════════════════════════
   ESProof Design System — "Dossier"
   Light, paper-like, EU-document aesthetic.
   Display: Bricolage Grotesque · Body: DM Sans · Data: IBM Plex Mono
   ═══════════════════════════════════════════════════════════════ */
:root {
  --primary:       #1a3a8f;
  --primary-dk:    #122c73;
  --primary-soft:  #e9eef9;
  --primary-line:  #c3d0ec;
  --gold:          #b8901f;
  --bg:            #fafbfd;
  --surface:       #ffffff;
  --bg-subtle:     #f3f6fb;
  --text:          #131c30;
  --text-2:        #5b6981;
  --text-3:        #939eb6;
  --border:        #e2e7f0;
  --border-strong: #c9d2e2;
  --ok:            #15803d;
  --warn:          #a16207;
  --error:         #b91c1c;
  --radius:        6px;
  --radius-btn:    4px;
  --font-display:  'Bricolage Grotesque', sans-serif;
  --font-body:     'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono:     'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --shadow-card:   0 1px 2px rgba(14, 21, 38, 0.04);
  --shadow-doc:    0 1px 3px rgba(14, 21, 38, 0.05), 0 16px 40px -16px rgba(20, 35, 80, 0.14);
  --transition:    all 0.16s ease;
}

/* ─── Reset ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--primary-soft); color: var(--primary-dk); }

/* ─── Header ─────────────────────────────────────────────────── */
header {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0 2rem;
  position: sticky;
  top: 0;
  z-index: 100;
  height: 60px;
  display: flex;
  align-items: center;
}

.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
  height: 60px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
}

.logo-mark { display: flex; align-items: center; flex-shrink: 0; }
.logo-mark svg { width: 28px; height: 30px; display: block; }

.logo-wordmark {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.03em;
  line-height: 1;
}

.header-badge {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  color: var(--text-2);
  font-size: 0.62rem;
  font-weight: 500;
  font-family: var(--font-mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 4px 9px;
  border-radius: 3px;
}

.header-legal {
  margin-left: auto;
  font-size: 0.78rem;
  color: var(--text-2);
  text-decoration: none;
  transition: var(--transition);
}

.header-legal:hover { color: var(--primary); }

/* ─── Progress Steps ─────────────────────────────────────────── */
.progress-bar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 2rem;
}

.progress-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  height: 50px;
}

.step {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 18px;
  color: var(--text-3);
  font-size: 0.8rem;
  font-weight: 500;
  position: relative;
  height: 100%;
}

.step:first-child { padding-left: 0; }

.step:not(:last-child)::after {
  content: '';
  position: absolute;
  right: -9px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 1px;
  background: var(--border-strong);
}

.step-num {
  width: 22px;
  height: 22px;
  border-radius: 3px;
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--text-3);
  font-size: 0.68rem;
  font-weight: 600;
  font-family: var(--font-mono);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: var(--transition);
}

.step.active .step-num {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.step.active {
  color: var(--text);
  font-weight: 600;
}
.step.active::before {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 18px;
  right: 18px;
  height: 2px;
  background: var(--primary);
}
.step:first-child.active::before { left: 0; }
.step.done .step-num {
  background: var(--surface);
  border-color: var(--primary);
  color: var(--primary);
}
.step.done { color: var(--text-2); }
.step.done .step-num::after { content: '✓'; font-size: 0.6rem; }
.step.done .step-num-inner { display: none; }

/* ─── Main Layout ────────────────────────────────────────────── */
main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 44px 2rem 72px;
  flex: 1;
  width: 100%;
}

.page { display: none; animation: pageIn 0.3s cubic-bezier(0.16, 1, 0.3, 1); }
.page.active { display: block; }

@keyframes pageIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─── Hero ───────────────────────────────────────────────────── */
.hero {
  text-align: center;
  margin-bottom: 44px;
}

.hero h1 {
  font-family: var(--font-display);
  font-size: 34px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.035em;
  line-height: 1.15;
  margin-bottom: 14px;
  text-wrap: balance;
}

.hero h1 span { color: var(--primary); }

.hero p {
  font-size: 0.95rem;
  color: var(--text-2);
  max-width: 520px;
  margin: 0 auto;
  text-wrap: pretty;
}

/* ─── Sector Grid ─────────────────────────────────────────────── */
.dept-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.dept-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 20px;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: flex-start;
  gap: 14px;
  position: relative;
}

.dept-card:hover {
  border-color: var(--primary-line);
  box-shadow: 0 2px 8px rgba(20, 35, 80, 0.08);
}

.dept-card.selected {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary), 0 2px 10px rgba(26, 58, 143, 0.12);
}

.dept-card.selected::before {
  content: '';
  position: absolute;
  top: -1px;
  left: 16px;
  right: 16px;
  height: 2px;
  background: var(--primary);
}

.dept-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-btn);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  transition: var(--transition);
}

.dept-card:hover .dept-icon,
.dept-card.selected .dept-icon {
  background: var(--primary-soft);
  border-color: var(--primary-line);
}

.dept-icon svg {
  width: 18px;
  height: 18px;
  stroke: var(--text-2);
  fill: none;
  transition: var(--transition);
}

.dept-card:hover .dept-icon svg,
.dept-card.selected .dept-icon svg { stroke: var(--primary); }

.dept-info h3 {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
  letter-spacing: -0.02em;
}

.dept-info p {
  font-size: 0.8rem;
  color: var(--text-2);
  line-height: 1.45;
}

.dept-badge {
  margin-top: 8px;
  display: inline-block;
  font-size: 0.6rem;
  font-weight: 500;
  font-family: var(--font-mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 3px;
  background: var(--primary-soft);
  color: var(--primary);
  border: 1px solid var(--primary-line);
}

/* ─── Form Header ────────────────────────────────────────────── */
.form-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.form-header-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.form-header-icon svg {
  width: 22px;
  height: 22px;
  stroke: var(--primary);
  fill: none;
}

.form-header-text h2 {
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.025em;
}

.form-header-text p {
  color: var(--text-2);
  font-size: 0.86rem;
}

/* ─── Form Sections ──────────────────────────────────────────── */
.form-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  margin-bottom: 10px;
  overflow: hidden;
}

.section-header {
  padding: 11px 14px;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
}

.section-header:hover { background: #edf1f8; }

.section-header-icon {
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.section-header-icon svg {
  width: 15px;
  height: 15px;
  stroke: var(--text-2);
  fill: none;
}

.section-header h3 {
  font-size: 0.65rem;
  font-weight: 500;
  color: var(--text-2);
  flex: 1;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-family: var(--font-mono);
}

.section-toggle {
  color: var(--text-3);
  transition: transform 0.18s ease;
  font-size: 0.95rem;
  line-height: 1;
}

.section-header.open .section-toggle { transform: rotate(180deg); }

.section-body {
  padding: 18px 16px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px 12px;
}

.section-body.collapsed { display: none; }
.field-full { grid-column: 1 / -1; }

/* ─── Progressive Disclosure ─────────────────────────────── */
.btn-advanced-toggle {
  grid-column: 1 / -1;
  background: none;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-btn);
  color: var(--text-2);
  font-size: 0.78rem;
  font-family: var(--font-body);
  font-weight: 500;
  padding: 8px 14px;
  cursor: pointer;
  text-align: left;
  transition: var(--transition);
  margin-top: 2px;
}

.btn-advanced-toggle:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-soft);
}

.advanced-fields {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.advanced-fields.collapsed { display: none; }

.field-advanced {
  background: var(--bg-subtle);
  border-radius: var(--radius-btn);
  padding: 8px 10px 10px;
}

.field-advanced input,
.field-advanced select,
.field-advanced textarea { background: var(--surface); }

/* ─── Fields ─────────────────────────────────────────────────── */
.field label {
  display: block;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 6px;
  font-family: var(--font-body);
}

.field label .req { color: var(--error); margin-left: 2px; }

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-btn);
  padding: 8px 10px;
  font-size: 0.875rem;
  color: var(--text);
  background: var(--surface);
  font-family: var(--font-body);
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
  appearance: auto;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26, 58, 143, 0.12);
}

.field input::placeholder,
.field textarea::placeholder { color: var(--text-3); }

.field textarea { resize: vertical; min-height: 80px; }
.field select { cursor: pointer; }

/* ─── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-btn);
  font-size: 0.86rem;
  font-weight: 600;
  letter-spacing: -0.005em;
  cursor: pointer;
  border: 1px solid transparent;
  transition: var(--transition);
  font-family: var(--font-body);
  text-decoration: none;
  white-space: nowrap;
  line-height: 1;
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 1px 2px rgba(18, 44, 115, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-dk);
  border-color: var(--primary-dk);
}

.btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-secondary {
  background: var(--surface);
  color: var(--primary);
  border-color: var(--primary-line);
}

.btn-secondary:hover {
  background: var(--primary-soft);
  border-color: var(--primary);
}

.btn-outline {
  background: var(--surface);
  color: var(--text-2);
  border-color: var(--border-strong);
}

.btn-outline:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-soft);
}

.form-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

/* ─── Generation Loader ──────────────────────────────────────── */
.loading-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 420px;
  text-align: center;
  gap: 28px;
}

/* Document-scan visual */
.gen-visual {
  width: 88px;
  height: 110px;
  position: relative;
}

.gen-doc {
  position: absolute;
  inset: 0;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  box-shadow: var(--shadow-doc);
  padding: 16px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  overflow: hidden;
}

.gen-doc::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--primary);
}

.gen-doc::after {
  content: '';
  position: absolute;
  top: 4px;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--gold);
  opacity: 0.7;
}

.gen-doc-line {
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  animation: lineShimmer 2.2s ease-in-out infinite;
}

.gen-doc-line.w90 { width: 90%; }
.gen-doc-line.w70 { width: 70%; }
.gen-doc-line.w80 { width: 80%; }
.gen-doc-line.w50 { width: 50%; }
.gen-doc-line:nth-child(2) { animation-delay: 0.15s; }
.gen-doc-line:nth-child(3) { animation-delay: 0.3s; }
.gen-doc-line:nth-child(4) { animation-delay: 0.45s; }
.gen-doc-line:nth-child(5) { animation-delay: 0.6s; }

@keyframes lineShimmer {
  0%, 100% { background: var(--border); }
  50%      { background: var(--primary-line); }
}

.gen-scanline {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 32px;
  background: linear-gradient(to bottom, transparent, rgba(26, 58, 143, 0.07) 60%, rgba(26, 58, 143, 0.22));
  border-bottom: 1.5px solid var(--primary);
  animation: scan 2.4s cubic-bezier(0.45, 0, 0.55, 1) infinite;
}

@keyframes scan {
  0%   { transform: translateY(-34px); opacity: 0; }
  12%  { opacity: 1; }
  88%  { opacity: 1; }
  100% { transform: translateY(112px); opacity: 0; }
}

/* Spinner — still used by dpp.html loading state */
.spinner-ring {
  width: 40px;
  height: 40px;
  border: 2.5px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.loading-page h2 {
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.025em;
}

.loading-page p {
  color: var(--text-2);
  font-size: 0.875rem;
  max-width: 380px;
  margin-top: 6px;
}

.loading-steps {
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: left;
  min-width: 320px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-card);
  padding: 6px;
}

.loading-step {
  display: flex;
  align-items: center;
  gap: 11px;
  font-size: 0.82rem;
  color: var(--text-3);
  padding: 8px 12px;
  border-radius: var(--radius-btn);
  transition: color 0.3s, background 0.3s;
  position: relative;
}

.loading-step.active {
  color: var(--text);
  font-weight: 500;
  background: var(--bg-subtle);
}

.loading-step.done { color: var(--text-2); }

.loading-step .dot {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  border: 1.5px solid var(--border-strong);
  background: transparent;
  flex-shrink: 0;
  position: relative;
  transition: border-color 0.3s, background 0.3s;
}

.loading-step.active .dot {
  border-color: var(--primary);
  animation: dotPulse 1.4s ease-in-out infinite;
}

.loading-step.done .dot {
  background: var(--primary);
  border-color: var(--primary);
}

.loading-step.done .dot::after {
  content: '';
  position: absolute;
  left: 3.5px;
  top: 1px;
  width: 4px;
  height: 7px;
  border: solid #fff;
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(45deg);
}

@keyframes dotPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(26, 58, 143, 0.28); }
  55%      { box-shadow: 0 0 0 4px rgba(26, 58, 143, 0); }
}

/* ─── Results ────────────────────────────────────────────────── */
.result-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 16px;
}

.result-header-left h2 {
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.025em;
}

.result-header-left p {
  color: var(--text-2);
  font-size: 0.82rem;
  margin-top: 4px;
}

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

/* ─── DPP Document ───────────────────────────────────────────── */
.dpp-document {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  box-shadow: var(--shadow-doc);
  padding: 52px 56px 44px;
  position: relative;
  overflow: hidden;
}

/* EU dossier band: navy bar + gold hairline */
.dpp-document::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 6px;
  background: var(--primary);
}

.dpp-document::after {
  content: '';
  position: absolute;
  top: 6px;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--gold);
  opacity: 0.65;
}

.dpp-watermark {
  position: absolute;
  top: 22px;
  right: 24px;
  font-size: 0.6rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-3);
  font-family: var(--font-mono);
}

.dpp-content { line-height: 1.75; }

.dpp-content h1 {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 800;
  color: var(--text);
  margin: 0 0 24px;
  padding-bottom: 14px;
  border-bottom: 2px solid var(--text);
  letter-spacing: -0.03em;
  line-height: 1.25;
}

.dpp-content h2 {
  font-size: 0.66rem;
  font-weight: 600;
  color: var(--primary);
  margin: 32px 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-family: var(--font-mono);
  display: flex;
  align-items: center;
  gap: 12px;
}

.dpp-content h2::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.dpp-content h3 {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin: 18px 0 8px;
  letter-spacing: -0.02em;
}

.dpp-content p  { margin-bottom: 10px; color: var(--text-2); font-size: 0.875rem; }
.dpp-content ul,
.dpp-content ol { padding-left: 1.5rem; margin-bottom: 10px; }
.dpp-content li { margin-bottom: 4px; color: var(--text-2); font-size: 0.875rem; }
.dpp-content strong { color: var(--text); font-weight: 600; }
.dpp-content em { color: var(--text-3); }
.dpp-content code {
  background: var(--bg-subtle);
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 0.8em;
  border: 1px solid var(--border);
  font-family: var(--font-mono);
}

.dpp-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 14px 0;
  font-size: 0.84rem;
  border: 1px solid var(--border-strong);
}
.dpp-content th {
  background: var(--bg-subtle);
  border: 1px solid var(--border-strong);
  border-width: 0 0 1px 0;
  padding: 8px 12px;
  text-align: left;
  font-weight: 500;
  color: var(--text-2);
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-family: var(--font-mono);
}
.dpp-content th + th,
.dpp-content td + td { border-left: 1px solid var(--border); }
.dpp-content td {
  border-bottom: 1px solid var(--border);
  padding: 8px 12px;
  color: var(--text-2);
  vertical-align: top;
}
.dpp-content tr:last-child td { border-bottom: none; }
.dpp-content tbody tr:hover td { background: #fafbfe; }
.dpp-content blockquote {
  border-left: 2px solid var(--primary);
  padding-left: 1rem;
  margin: 12px 0;
  color: var(--text-2);
}
.dpp-content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 24px 0;
}

/* Machine-readable zone — passport gesture */
.dpp-mrz {
  margin-top: 40px;
  padding: 16px 0 0;
  border-top: 1.5px dashed var(--border-strong);
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  line-height: 2;
  color: var(--text-3);
  text-transform: uppercase;
  word-break: break-all;
  user-select: all;
}

/* Compliance badges */
.compliance-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 3px;
  background: var(--primary-soft);
  color: var(--primary);
  border: 1px solid var(--primary-line);
  font-size: 0.66rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  margin: 2px 4px 2px 0;
  font-family: var(--font-mono);
}

/* ─── DPP Toggle (public/internal tabs) ──────────────────────── */
.dpp-toggle {
  display: inline-flex;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-btn);
  overflow: hidden;
  margin-bottom: 16px;
  background: var(--surface);
  box-shadow: var(--shadow-card);
}

.dpp-toggle-tab {
  padding: 9px 18px;
  font-size: 0.74rem;
  font-weight: 500;
  font-family: var(--font-mono);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
  border: none;
  background: transparent;
  color: var(--text-2);
  transition: var(--transition);
  line-height: 1;
}

.dpp-toggle-tab + .dpp-toggle-tab { border-left: 1px solid var(--border); }

.dpp-toggle-tab.active {
  background: var(--primary);
  color: #fff;
}

.dpp-toggle-tab:not(.active):hover {
  background: var(--bg-subtle);
  color: var(--text);
}

/* Tab content swap animation (retriggered from dpp.html) */
.dpp-content.swap { animation: contentSwap 0.28s cubic-bezier(0.16, 1, 0.3, 1); }

@keyframes contentSwap {
  from { opacity: 0; transform: translateY(5px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─── URL Box ────────────────────────────────────────────────── */
.dpp-url-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-btn);
  box-shadow: var(--shadow-card);
  padding: 10px 16px;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.dpp-url-box span { font-weight: 500; color: var(--text); }
.dpp-url-box a,
.dpp-url-box #current-url {
  color: var(--primary);
  word-break: break-all;
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: 0.74rem;
}
.dpp-url-box a:hover { text-decoration: underline; }

/* ─── QR Code ────────────────────────────────────────────────── */
.qr-code-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

#qr-canvas img,
#qr-canvas canvas {
  display: block;
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 4px;
  background: #fff;
}

.qr-code-info {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.qr-code-info p {
  font-size: 0.8rem;
  color: var(--text-2);
}

/* ─── Alert ──────────────────────────────────────────────────── */
.alert {
  border-radius: var(--radius-btn);
  padding: 12px 16px;
  margin-bottom: 16px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 0.86rem;
}

.alert-error {
  background: #fef5f5;
  border: 1px solid #f3c4c4;
  border-left: 3px solid var(--error);
  color: var(--error);
}

.alert-icon { flex-shrink: 0; margin-top: 1px; }

/* ─── Footer ─────────────────────────────────────────────────── */
footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  color: var(--text-3);
  text-align: center;
  font-size: 0.74rem;
  padding: 18px 2rem;
}

footer a { color: var(--text-2); text-decoration: none; transition: var(--transition); }
footer a:hover { color: var(--primary); }
footer span { color: var(--text); font-weight: 500; }

/* ─── Copy Feedback ──────────────────────────────────────────── */
.copy-feedback {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--text);
  color: #fff;
  padding: 9px 16px;
  border-radius: var(--radius-btn);
  font-size: 0.8rem;
  font-weight: 500;
  opacity: 0;
  transform: translateY(8px);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
  z-index: 999;
  box-shadow: 0 8px 24px rgba(14, 21, 38, 0.24);
}

.copy-feedback.show { opacity: 1; transform: translateY(0); }

/* ─── Login ──────────────────────────────────────────────────── */
.login-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 1rem;
  background:
    radial-gradient(ellipse 60% 50% at 50% 0%, rgba(26, 58, 143, 0.05), transparent),
    var(--bg);
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  box-shadow: var(--shadow-doc);
  padding: 44px 36px 36px;
  width: 100%;
  max-width: 400px;
  position: relative;
  overflow: hidden;
}

.login-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 5px;
  background: var(--primary);
}

.login-card::after {
  content: '';
  position: absolute;
  top: 5px;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--gold);
  opacity: 0.65;
}

.login-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  margin-bottom: 30px;
  text-decoration: none;
}

.login-logo-mark svg { width: 32px; height: 34px; display: block; }

.login-logo-wordmark {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.03em;
}

.login-card h1 {
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
  letter-spacing: -0.025em;
}

.login-card > p {
  font-size: 0.86rem;
  color: var(--text-2);
  margin-bottom: 26px;
}

.login-field { margin-bottom: 14px; }

.login-field label {
  display: block;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 6px;
}

.login-field input {
  width: 100%;
  padding: 10px 11px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-btn);
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--text);
  background: var(--surface);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.login-field input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26, 58, 143, 0.12);
}

.login-btn {
  width: 100%;
  margin-top: 10px;
  padding: 12px 20px;
  justify-content: center;
  font-size: 0.9rem;
}

.login-error {
  display: none;
  background: #fef5f5;
  border: 1px solid #f3c4c4;
  border-left: 3px solid var(--error);
  color: var(--error);
  border-radius: var(--radius-btn);
  padding: 10px 12px;
  font-size: 0.85rem;
  margin-bottom: 16px;
}

.login-error.show { display: block; }

/* ─── Responsive ─────────────────────────────────────────────── */
@media (max-width: 768px) {
  .dept-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  header { padding: 0 1rem; height: 56px; }
  .header-inner { height: 56px; }
  .progress-bar { padding: 0 1rem; }
  main { padding: 24px 1rem 48px; }
  .hero h1 { font-size: 27px; }
  .dept-grid { grid-template-columns: 1fr; }
  .section-body { grid-template-columns: 1fr; }
  .dpp-document { padding: 36px 22px 32px; }
  .result-header { flex-direction: column; }
  .result-actions { flex-wrap: wrap; }
  .login-card { padding: 36px 22px 28px; }
  .loading-steps { min-width: 0; width: 100%; }
}

/* ─── Print / Save PDF ───────────────────────────────────────── */
@media print {
  * { animation: none !important; transition: none !important; }
  header, footer, .progress-bar, .result-actions,
  #dpp-url-banner, #alert-result, .copy-feedback,
  .dpp-toggle, #dpp-tabs { display: none !important; }
  .page { display: none !important; opacity: 1 !important; }
  .page.active { display: block !important; opacity: 1 !important; transform: none !important; }
  body, main { background: white !important; padding: 0 !important; margin: 0 !important; }
  .dpp-document {
    box-shadow: none !important;
    border: 1px solid #bbb !important;
    border-radius: 0 !important;
  }
  .dpp-document::before { background: var(--primary) !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .dpp-content tbody tr:hover td { background: transparent; }
}
