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

:root {
  --bg: #0f0f17;
  --bg2: #16162a;
  --surface: #1c1c35;
  --surface2: #25254a;
  --amber: #e2b714;
  --amber-dim: #a8880f;
  --amber-glow: rgba(226, 183, 20, .15);
  --cream: #f0ead6;
  --cream-dim: #a09b8c;
  --red: #e05555;
  --green: #50c878;
  --mono: 'JetBrains Mono', monospace;
  --serif: 'Playfair Display', serif;
  --transition-step: .35s;
}

html {
  font-size: 15px;
  scroll-behavior: smooth
}

body {
  font-family: var(--mono);
  color: var(--cream);
  background: var(--bg);
  min-height: 100vh;
  line-height: 1.6;
  background-image:
    radial-gradient(ellipse at 20% 0%, rgba(226, 183, 20, .04) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 100%, rgba(80, 200, 120, .03) 0%, transparent 50%);
}

/* noise overlay */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: .035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 128px 128px;
}

.container {
  max-width: 740px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  position: relative;
  z-index: 1
}

/* ── Header ── */
header {
  text-align: center;
  margin-bottom: 2.4rem;
  padding-top: .6rem
}

.header-img {
  display: none;
  margin: 0 auto .6rem;
  height: 160px;
  width: auto;
  object-fit: contain;
  object-position: top;
  filter: drop-shadow(0 4px 18px rgba(226, 183, 20, .18));
}

body.fun-mode .header-img {
  display: block;
}

header h1 {
  font-family: var(--serif);
  font-weight: 900;
  font-size: 2.8rem;
  color: var(--amber);
  letter-spacing: -.02em;
  line-height: 1.1;
}

header h1 span {
  color: var(--cream);
  font-weight: 700;
  font-size: .5em;
  display: block;
  margin-top: .35rem;
  letter-spacing: .1em;
  font-family: var(--mono);
  text-transform: uppercase;
}

header p.subtitle {
  color: var(--cream-dim);
  font-size: .78rem;
  margin-top: .6rem
}

/* ── Step dots ── */
.steps-bar {
  display: flex;
  gap: .5rem;
  justify-content: center;
  margin-bottom: 2.5rem
}

.steps-bar .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--surface2);
  transition: all .3s ease;
  border: 1.5px solid var(--surface2);
}

.steps-bar .dot.active {
  background: var(--amber);
  border-color: var(--amber);
  box-shadow: 0 0 10px rgba(226, 183, 20, .35)
}

.steps-bar .dot.done {
  background: var(--green);
  border-color: var(--green)
}

/* ── Step panels ── */
.step {
  display: none;
  animation: fadeSlide var(--transition-step) ease
}

.step.active {
  display: block
}

@keyframes fadeSlide {
  from {
    opacity: 0;
    transform: translateY(14px)
  }

  to {
    opacity: 1;
    transform: translateY(0)
  }
}

.panel {
  background: var(--surface);
  border: 1px solid var(--surface2);
  border-radius: 8px;
  padding: 1.8rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 4px 24px rgba(0, 0, 0, .25);
}

.panel h2 {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 1.35rem;
  color: var(--amber);
  margin-bottom: .7rem
}

.panel>p {
  font-size: .84rem;
  color: var(--cream-dim);
  margin-bottom: 1rem
}

/* ── File drop zone ── */
.drop-zone {
  border: 2px dashed var(--surface2);
  border-radius: 6px;
  padding: 2.5rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: all .2s ease;
  position: relative;
}

.drop-zone:hover,
.drop-zone.dragover {
  border-color: var(--amber);
  background: var(--amber-glow)
}

.drop-zone .dz-icon {
  font-size: 1.6rem;
  margin-bottom: .4rem;
  display: block;
  color: var(--amber-dim);
  transition: color .2s
}

.drop-zone .dz-label {
  font-size: .84rem;
  color: var(--cream-dim)
}

.drop-zone .dz-label strong {
  color: var(--amber)
}

.drop-zone input[type=file] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer
}

.drop-zone.has-file {
  border-color: var(--green);
  border-style: solid;
  background: rgba(80, 200, 120, .05)
}

.drop-zone.has-file .dz-icon {
  color: var(--green)
}

/* ── Buttons ── */
.btn {
  font-family: var(--mono);
  font-size: .82rem;
  font-weight: 500;
  padding: .6rem 1.5rem;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: all .15s ease;
  display: inline-flex;
  align-items: center;
  gap: .4rem;
}

.btn:disabled {
  opacity: .35;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important
}

.btn-primary {
  background: var(--amber);
  color: var(--bg);
  box-shadow: 0 2px 12px rgba(226, 183, 20, .2)
}

.btn-primary:not(:disabled):hover {
  background: #f0c420;
  transform: translateY(-1px);
  box-shadow: 0 4px 18px rgba(226, 183, 20, .35)
}

.btn-primary:not(:disabled):active {
  transform: translateY(0)
}

.btn-secondary {
  background: var(--surface2);
  color: var(--cream)
}

.btn-secondary:not(:disabled):hover {
  background: #2f2f5a
}

.btn-group {
  display: flex;
  gap: .8rem;
  margin-top: 1.5rem;
  justify-content: flex-end;
  flex-wrap: wrap
}

/* ── NIF radio cards ── */
.nif-options {
  display: flex;
  flex-direction: column;
  gap: .6rem
}

.nif-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.2rem;
  background: var(--bg2);
  border: 1.5px solid var(--surface2);
  border-radius: 6px;
  cursor: pointer;
  transition: all .15s ease;
  user-select: none;
}

.nif-card:hover {
  border-color: var(--amber-dim)
}

.nif-card.selected {
  border-color: var(--amber);
  background: var(--amber-glow)
}

.nif-card input {
  display: none
}

.nif-card .radio-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--surface2);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .15s;
}

.nif-card.selected .radio-dot {
  border-color: var(--amber)
}

.nif-card.selected .radio-dot::after {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--amber)
}

.nif-card .nif-info {
  font-size: .88rem
}

.nif-card .nif-num {
  color: var(--cream);
  font-weight: 700;
  letter-spacing: .03em
}

.nif-tag {
  font-size: .68rem;
  margin-left: .6rem;
  vertical-align: middle
}

/* ── Custom NIF input ── */
.custom-nif-row {
  display: flex;
  align-items: center;
  gap: .8rem;
  padding: 1rem 1.2rem;
  background: var(--bg2);
  border: 1.5px solid var(--surface2);
  border-radius: 6px;
  transition: all .15s ease;
}

.custom-nif-row:focus-within {
  border-color: var(--amber)
}

.custom-nif-row.selected {
  border-color: var(--amber);
  background: var(--amber-glow)
}

.custom-nif-row .radio-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--surface2);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .15s;
  cursor: pointer;
}

.custom-nif-row.selected .radio-dot {
  border-color: var(--amber)
}

.custom-nif-row.selected .radio-dot::after {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--amber)
}

.custom-nif-input {
  font-family: var(--mono);
  font-size: .88rem;
  font-weight: 700;
  letter-spacing: .05em;
  background: transparent;
  border: none;
  border-bottom: 1.5px solid var(--surface2);
  color: var(--cream);
  padding: .25rem .1rem;
  width: 10ch;
  outline: none;
  transition: border-color .15s;
}

.custom-nif-input:focus {
  border-bottom-color: var(--amber)
}

.custom-nif-input::placeholder {
  color: var(--cream-dim);
  font-weight: 400;
  letter-spacing: 0;
  font-size: .78rem
}

.custom-nif-label {
  font-size: .82rem;
  color: var(--cream-dim)
}

.custom-nif-err {
  font-size: .7rem;
  color: var(--red);
  margin-left: auto
}

/* ── Summary tables ── */
.summary-section {
  margin-bottom: 1.2rem
}

.summary-section h3 {
  font-size: .88rem;
  color: var(--amber);
  margin-bottom: .5rem;
  font-weight: 500
}

table.summary-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .78rem
}

.summary-table th {
  text-align: left;
  padding: .45rem .6rem;
  color: var(--cream-dim);
  font-weight: 500;
  border-bottom: 1px solid var(--surface2);
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.summary-table td {
  padding: .45rem .6rem;
  border-bottom: 1px solid rgba(37, 37, 74, .5);
  color: var(--cream)
}

.summary-table td.num,
.summary-table th.num {
  text-align: right;
  font-variant-numeric: tabular-nums
}

.summary-table tr:last-child td {
  border-bottom: none
}

.summary-table tfoot td {
  border-top: 1.5px solid var(--amber-dim);
  font-weight: 700;
  color: var(--amber)
}

.summary-table .mono-sm {
  font-size: .7rem;
  color: var(--cream-dim)
}

/* ── Badges ── */
.badge {
  display: inline-block;
  padding: .15rem .5rem;
  border-radius: 3px;
  font-size: .68rem;
  font-weight: 500
}

.badge-green {
  background: rgba(80, 200, 120, .15);
  color: var(--green)
}

.badge-red {
  background: rgba(224, 85, 85, .15);
  color: var(--red)
}

.badge-amber {
  background: var(--amber-glow);
  color: var(--amber)
}

/* ── Boxes ── */
.warning-box {
  background: rgba(224, 85, 85, .08);
  border: 1px solid rgba(224, 85, 85, .25);
  border-radius: 6px;
  padding: .75rem 1rem;
  font-size: .8rem;
  color: var(--red);
  margin-top: .8rem;
}

.info-box {
  background: var(--amber-glow);
  border: 1px solid rgba(226, 183, 20, .2);
  border-radius: 6px;
  padding: .75rem 1rem;
  font-size: .8rem;
  color: var(--amber);
  margin-top: .8rem;
}

/* ── Download area ── */
.download-area {
  text-align: center;
  padding: 1.5rem 0
}

.download-area .checkmark {
  font-size: 3.5rem;
  color: var(--green);
  margin-bottom: .8rem;
  display: block;
  animation: popIn .4s cubic-bezier(.175, .885, .32, 1.275);
}

@keyframes popIn {
  from {
    transform: scale(0);
    opacity: 0
  }

  to {
    transform: scale(1);
    opacity: 1
  }
}

/* ── Mortagua download image ── */
#downloadHelpText,
.mortagua-wrap {
  position: relative;
  display: none;
  margin: 1rem auto 0;
}

body.fun-mode #downloadHelpText {
  display: block;
}

body.fun-mode .mortagua-wrap {
  display: inline-block;
}

#standardDownloadBtn {
  display: inline-flex;
}

body.fun-mode #standardDownloadBtn {
  display: none;
}

.mortagua-wrap img {
  display: block;
  max-width: 100%;
  height: auto;
  filter: drop-shadow(0 4px 18px rgba(0, 0, 0, .4));
}

.mortagua-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

#paperHighlight {
  fill: rgba(226, 183, 20, 0);
  stroke: none;
  transition: fill .15s ease;
}

.mortagua-wrap.paper-hover #paperHighlight {
  fill: rgba(226, 183, 20, .22);
  stroke: var(--amber);
  stroke-width: 2;
}

/* make the image map area show a pointer */
area#downloadBtn {
  cursor: pointer
}

/* ── Utility ── */
.mt1 {
  margin-top: .8rem
}

.mt2 {
  margin-top: 1.4rem
}

.text-dim {
  color: var(--cream-dim)
}

.text-green {
  color: var(--green)
}

.text-red {
  color: var(--red)
}

.text-amber {
  color: var(--amber)
}

/* ── Notice / Landing page ── */
.notice-cards {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  margin-top: 1rem
}

.notice-card {
  background: var(--bg);
  border: 1.5px solid var(--surface2);
  border-radius: 6px;
  padding: 1.3rem 1.5rem;
}

.notice-card-header {
  display: flex;
  align-items: baseline;
  gap: .8rem;
  margin-bottom: 1rem;
  padding-bottom: .7rem;
  border-bottom: 1px solid var(--surface2);
}

.notice-card h3 {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--amber);
}

.notice-card-type {
  font-size: .68rem;
  color: var(--cream-dim);
  font-weight: 500;
  background: var(--surface2);
  padding: .15rem .55rem;
  border-radius: 3px;
}

.notice-list {
  display: flex;
  flex-direction: column;
  gap: .55rem
}

.notice-item {
  font-size: .82rem;
  color: var(--cream);
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .3rem .5rem;
  border-radius: 4px;
  background: var(--surface);
}

.notice-item .notice-icon {
  flex-shrink: 0;
  font-weight: 700;
  width: 1.2rem;
  text-align: center;
  font-size: .72rem;
}

.notice-item.notice-yes .notice-icon {
  color: var(--green)
}

.notice-item.notice-no .notice-icon {
  color: var(--cream-dim);
  font-size: .9rem
}

.notice-item.notice-no {
  color: var(--cream-dim)
}

.notice-label {
  flex: 1
}

.notice-ref {
  font-size: .66rem;
  color: var(--amber-dim);
  white-space: nowrap;
  font-weight: 500;
  letter-spacing: .02em;
}

.notice-detail {
  font-size: .72rem;
  color: var(--cream-dim);
  margin-top: 1rem;
  line-height: 1.55;
  border-top: 1px solid var(--surface2);
  padding-top: .7rem;
}

/* ── Step 1: year + XML two-column layout ── */
.step1-row {
  display: flex;
  gap: 1.2rem;
  align-items: stretch;
  margin-top: 1rem;
}

.step1-col {
  display: flex;
  flex-direction: column
}

.step1-year {
  flex: 0 0 auto;
  background: var(--bg2);
  border: 1.5px solid var(--surface2);
  border-radius: 6px;
  padding: 1.2rem 1.4rem;
  justify-content: center;
  gap: .5rem;
  min-width: 140px;
}

.step1-year .year-label {
  margin-bottom: .45rem
}

.step1-xml {
  flex: 1 1 auto
}

.step1-xml .drop-zone {
  height: 100%;
  min-height: 110px
}

/* ── Year input ── */
.year-input-wrap {
  display: flex;
  align-items: center;
  gap: .6rem;
  flex-wrap: wrap
}

.year-label {
  font-size: .78rem;
  color: var(--amber);
  font-weight: 500;
  display: block;
  text-transform: uppercase;
  letter-spacing: .07em;
}

.year-input {
  font-family: var(--mono);
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: .06em;
  background: transparent;
  border: none;
  border-bottom: 2px solid var(--surface2);
  color: var(--cream);
  padding: .2rem .1rem;
  width: 5ch;
  outline: none;
  transition: border-color .2s;
}

.year-input:focus {
  border-bottom-color: var(--amber)
}

.year-input::placeholder {
  color: var(--surface2);
  font-weight: 400;
  letter-spacing: 0;
  font-size: 1.2rem
}

.year-input-err {
  font-size: .68rem;
  color: var(--red);
  display: block;
  margin-top: .25rem
}

@media(max-width:520px) {
  .step1-row {
    flex-direction: column
  }

  .step1-year {
    min-width: unset;
    flex-direction: row;
    align-items: center;
    padding: .9rem 1rem
  }

  .step1-year .year-label {
    margin-bottom: 0;
    white-space: nowrap
  }
}

/* ── Country picker ── */
.country-picker {
  margin-top: 1.2rem
}

.country-picker h3 {
  font-size: .88rem;
  color: var(--amber);
  margin-bottom: .3rem;
  font-weight: 500
}

.country-rows {
  display: flex;
  flex-direction: column;
  gap: .5rem
}

.country-row {
  display: flex;
  align-items: center;
  gap: .8rem;
  padding: .6rem .8rem;
  background: var(--bg2);
  border: 1px solid var(--surface2);
  border-radius: 5px;
  flex-wrap: wrap;
}

.country-ticker {
  font-weight: 700;
  font-size: .84rem;
  color: var(--cream);
  min-width: 5ch;
}

.country-isin {
  font-size: .7rem;
  color: var(--cream-dim);
  min-width: 13ch;
}

.country-select,
.counterparty-country-select {
  font-family: var(--mono);
  font-size: .76rem;
  font-weight: 500;
  background: var(--surface);
  color: var(--cream);
  border: 1px solid var(--surface2);
  border-radius: 4px;
  padding: .35rem 2rem .35rem .5rem;
  outline: none;
  cursor: pointer;
  transition: border-color .15s;
  margin-left: auto;
  min-width: 22ch;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23e2b714%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.4-12.8z%22%2F%3E%3C%2Fsvg%3E");
  background-repeat: no-repeat;
  background-position: right .7rem top 50%;
  background-size: .55rem auto;
}

.country-select:focus,
.counterparty-country-select:focus {
  border-color: var(--amber)
}

.country-select option,
.counterparty-country-select option {
  background: var(--surface);
  color: var(--cream)
}

/* ── Scrollbar ── */
::-webkit-scrollbar {
  width: 6px
}

::-webkit-scrollbar-track {
  background: var(--bg)
}

::-webkit-scrollbar-thumb {
  background: var(--surface2);
  border-radius: 3px
}

/* ── Responsive ── */
@media(max-width:520px) {
  html {
    font-size: 13.5px
  }

  .container {
    padding: 1.2rem 1rem
  }

  header h1 {
    font-size: 2.1rem
  }

  .panel {
    padding: 1.3rem
  }

  .summary-table {
    font-size: .72rem
  }
}