:root {
  --bg: #F5F7FA;
  --surface: #FFFFFF;
  --surface-subtle: #F9FAFB;
  --text: #111827;
  --text-secondary: #667085;
  --text-muted: #98A2B3;
  --border: #DDE3EA;
  --border-strong: #CBD5E1;
  --accent: #1F5EFF;
  --accent-hover: #174DD6;
  --accent-soft: #EEF4FF;
  --warning: #B45309;
  --warning-bg: #FFFBEB;
  --success: #067647;
  --success-bg: #ECFDF3;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16,24,40,0.06);
  --shadow-lg: 0 8px 24px rgba(16,24,40,0.10);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  min-height: 100vh;
}

.header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 24px 0 18px;
}

.header__inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 20px;
}

.header__title {
  color: var(--text);
  font-size: 24px;
  font-weight: 750;
}

.header__subtitle {
  color: var(--text-secondary);
  font-size: 14px;
  margin-top: 4px;
}

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 20px 40px;
}

.privacy-banner {
  align-items: flex-start;
  background: #F0FDF4;
  border: 1px solid #BBF7D0;
  border-left: 4px solid var(--success);
  border-radius: var(--radius);
  color: var(--text);
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  padding: 14px 16px;
}

.privacy-banner__mark {
  align-items: center;
  background: var(--success);
  border-radius: 999px;
  color: #fff;
  display: flex;
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 800;
  height: 24px;
  justify-content: center;
  margin-top: 1px;
  width: 24px;
}

.privacy-banner__title {
  color: var(--text);
  font-size: 14px;
  font-weight: 800;
}

.privacy-banner__text {
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.5;
  margin-top: 3px;
}

.service-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

@media (min-width: 680px) {
  .service-grid { grid-template-columns: repeat(3, 1fr); gap: 14px; }
}

@media (min-width: 940px) {
  .service-grid { grid-template-columns: repeat(4, 1fr); }
}

.home-footer-bar {
  align-items: center;
  background: #FAFAFA;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin-top: 20px;
  padding: 12px 14px;
}

.home-footer-bar span {
  color: var(--text-secondary);
  flex: 1 1 420px;
  font-size: 12px;
  line-height: 1.45;
}

.home-footer-bar a {
  color: var(--accent);
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}

.home-footer-bar a:hover { text-decoration: underline; }

.site-signature {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  margin-top: 16px;
  opacity: 0.55;
  text-align: center;
}

.service-card {
  align-items: stretch;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 138px;
  padding: 14px;
  text-align: left;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.service-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-lg);
  transform: translateY(-1px);
}

.service-card__top {
  align-items: center;
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.service-card__icon {
  align-items: center;
  border-radius: 10px;
  color: #fff;
  display: flex;
  flex-shrink: 0;
  font-size: 18px;
  font-weight: 800;
  height: 42px;
  justify-content: center;
  width: 42px;
}

.service-card__status {
  background: var(--success-bg);
  border-radius: 999px;
  color: var(--success);
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  white-space: nowrap;
}

.service-card__body {
  min-width: 0;
}

.service-card__name {
  color: var(--text);
  font-size: 15px;
  font-weight: 750;
  line-height: 1.25;
}

.service-card__legal {
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.35;
  margin-top: 4px;
  overflow-wrap: anywhere;
}

.service-card__meta {
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 11px;
  margin-top: auto;
  padding-top: 10px;
}

.service-card--add {
  background: transparent;
  border-style: dashed;
  color: var(--accent);
}

.service-card--add .service-card__status {
  background: var(--accent-soft);
  color: var(--accent);
}

.service-card__icon--add,
.service-page__icon--add {
  background: #111827;
}

.back-link {
  align-items: center;
  color: var(--accent);
  cursor: pointer;
  display: inline-flex;
  font-size: 14px;
  font-weight: 650;
  gap: 6px;
  margin-bottom: 20px;
  text-decoration: none;
}

.back-link:hover { text-decoration: underline; }

.service-page__header {
  align-items: flex-start;
  display: flex;
  gap: 14px;
  margin-bottom: 18px;
}

.service-page__icon {
  align-items: center;
  border-radius: 12px;
  color: #fff;
  display: flex;
  flex-shrink: 0;
  font-size: 22px;
  font-weight: 800;
  height: 48px;
  justify-content: center;
  width: 48px;
}

.service-page__name {
  color: var(--text);
  font-size: 24px;
  font-weight: 800;
  line-height: 1.15;
}

.service-page__legal {
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.4;
  margin-top: 4px;
}

.service-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.badge {
  background: var(--success-bg);
  border: 1px solid #ABEFC6;
  border-radius: 999px;
  color: var(--success);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  padding: 7px 9px;
}

.badge--muted {
  background: var(--surface-subtle);
  border-color: var(--border);
  color: var(--text-secondary);
}

.tabs {
  border-bottom: 1px solid var(--border);
  display: flex;
  margin-bottom: 20px;
}

.tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-secondary);
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  margin-bottom: -1px;
  padding: 12px 18px;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.tab:hover { color: var(--text); }

.tab--active {
  border-bottom-color: var(--accent);
  color: var(--accent);
}

.process-steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 20px;
}

.process-step {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-secondary);
  display: flex;
  gap: 8px;
  min-width: 0;
  padding: 10px;
}

.process-step span {
  align-items: center;
  background: var(--accent-soft);
  border-radius: 999px;
  color: var(--accent);
  display: flex;
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 800;
  height: 24px;
  justify-content: center;
  width: 24px;
}

.process-step strong {
  color: var(--text);
  font-size: 13px;
  line-height: 1.2;
}

.steps {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  counter-reset: step;
  list-style: none;
  overflow: hidden;
}

.step {
  counter-increment: step;
  display: flex;
  gap: 14px;
  padding: 16px;
}

.step + .step { border-top: 1px solid var(--border); }

.step::before {
  align-items: center;
  background: var(--accent-soft);
  border-radius: 999px;
  color: var(--accent);
  content: counter(step);
  display: flex;
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 800;
  height: 30px;
  justify-content: center;
  width: 30px;
}

.step__title {
  color: var(--text);
  font-size: 15px;
  font-weight: 750;
}

.step__desc {
  color: var(--text-secondary);
  font-size: 14px;
  margin-top: 2px;
}

.no-steps {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-size: 14px;
  padding: 28px;
  text-align: center;
}

.form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 750;
}

.label-with-help {
  align-items: center;
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.help-trigger {
  align-items: center;
  background: var(--accent-soft);
  border: 1px solid #C7D7FE;
  border-radius: 999px;
  color: var(--accent);
  cursor: pointer;
  display: inline-flex;
  flex-shrink: 0;
  font-family: inherit;
  font-size: 12px;
  font-weight: 800;
  height: 22px;
  justify-content: center;
  width: 22px;
}

.help-trigger:hover,
.help-trigger[aria-expanded="true"] {
  background: var(--accent);
  color: #fff;
}

.help-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.5;
  padding: 12px 14px;
}

.help-panel strong {
  color: var(--text);
  display: block;
  font-size: 13px;
  margin-bottom: 4px;
}

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

.form-group input,
.form-group textarea {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  color: var(--text);
  font-family: inherit;
  font-size: 15px;
  min-width: 0;
  padding: 12px 14px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-group input:focus,
.form-group textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(31,94,255,0.12);
  outline: none;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
}

.btn {
  align-items: center;
  border: none;
  border-radius: 9px;
  cursor: pointer;
  display: inline-flex;
  font-family: inherit;
  font-size: 14px;
  font-weight: 750;
  justify-content: center;
  min-height: 42px;
  padding: 10px 18px;
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

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

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

.btn--secondary {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--text);
}

.btn--secondary:hover {
  background: var(--surface-subtle);
  border-color: var(--text-muted);
}

.btn--tertiary {
  background: transparent;
  color: var(--text-secondary);
  padding-left: 10px;
  padding-right: 10px;
}

.btn--tertiary:hover {
  background: var(--surface-subtle);
  color: var(--text);
}

.preview-section {
  margin-top: 24px;
}

.preview-section__title {
  color: var(--text);
  font-size: 16px;
  font-weight: 800;
  margin-bottom: 12px;
}

.statement-preview {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: 'Times New Roman', serif;
  font-size: 14px;
  line-height: 1.8;
  max-width: 100%;
  overflow-x: auto;
  padding: 32px 28px;
}

.statement-preview h2 {
  font-size: 16px;
  margin-bottom: 16px;
  text-align: center;
}

.statement-preview .field {
  color: var(--accent);
  font-weight: 500;
}

.statement-preview .section {
  margin-bottom: 12px;
}

.request-preview {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  padding: 16px;
}

.delivery-note {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--text-muted);
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.5;
  margin-top: 12px;
  padding: 12px 14px;
}

.note-badge {
  background: var(--warning-bg);
  border: 1px solid #FEDF89;
  border-left: 4px solid #F79009;
  border-radius: var(--radius);
  color: var(--warning);
  font-size: 13px;
  line-height: 1.5;
  margin-bottom: 12px;
  padding: 12px 14px;
}

.source-note {
  color: var(--text-secondary);
  font-size: 12px;
  margin: 0 0 20px;
}

.source-note a {
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
}

.source-note a:hover { text-decoration: underline; }

.loading {
  color: var(--text-secondary);
  padding: 48px;
  text-align: center;
}

@media (max-width: 560px) {
  .header {
    padding: 24px 0 18px;
  }

  .header__title {
    font-size: 22px;
    line-height: 1.2;
  }

  .container {
    padding: 22px 20px 36px;
  }

  .service-card {
    min-height: 146px;
    padding: 12px;
  }

  .service-card__status {
    font-size: 10px;
    padding: 3px 7px;
  }

  .service-card__legal {
    display: none;
  }

  .service-page__header {
    gap: 12px;
  }

  .service-page__name {
    font-size: 23px;
  }

  .service-page__icon {
    height: 46px;
    width: 46px;
  }

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

  .tab {
    padding-left: 8px;
    padding-right: 8px;
  }

  .process-steps {
    grid-template-columns: 1fr;
  }

  .form-actions .btn {
    flex: 1 1 auto;
  }

  .statement-preview {
    padding: 24px 18px;
  }

  .privacy-banner {
    padding: 13px 14px;
  }

  .home-footer-bar {
    gap: 7px 12px;
    padding: 12px;
  }
}

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

  body * {
    visibility: hidden;
  }

  #statementContent,
  #statementContent * {
    visibility: visible;
  }

  #statementContent {
    border: none;
    border-radius: 0;
    box-shadow: none;
    color: #000;
    left: 0;
    overflow: visible;
    padding: 0;
    position: absolute;
    top: 0;
    width: 100%;
  }
}
