:root {
  --primary: #0E4B5A;
  --primary-light: #16748A;
  --accent: #F28C28;
  --bg: #F6FAFB;
  --surface: #fff;
  --text: #0F172A;
  --muted: #64748B;
  --border: #E2E8F0;
  --success: #22C55E;
  --error: #EF4444;
  --shadow: 0 10px 30px rgba(14, 75, 90, 0.10);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
/* The `hidden` attribute must win over flex/grid display rules below
   (e.g. .modal/.form use display:flex which would otherwise show them). */
[hidden] { display: none !important; }
body { font-family: 'Plus Jakarta Sans', system-ui, sans-serif; background: var(--bg); color: var(--text); }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 6vw; background: var(--primary); color: #fff;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.brand img { width: 30px; height: 30px; border-radius: 8px; background: #fff; padding: 3px; }
.brand b { color: var(--accent); }
.link-btn { background: none; border: 1px solid rgba(255,255,255,.4); color: #fff; padding: 7px 14px; border-radius: 8px; cursor: pointer; }

.container { max-width: 1120px; margin: 0 auto; padding: 24px 6vw 60px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow); padding: 22px; margin-bottom: 18px; }
.card h3 { margin-bottom: 14px; }

.hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  background: linear-gradient(135deg, #0e4b5a, #16748a);
  color: #fff;
  border-radius: 18px;
  padding: 28px;
  margin-bottom: 18px;
}
.hero h1 { font-size: clamp(30px, 5vw, 52px); line-height: 1; margin-bottom: 10px; }
.hero p { max-width: 620px; color: rgba(255,255,255,.82); font-size: 16px; }

.auth { max-width: 440px; margin: 40px auto; }
.tabs { display: flex; gap: 8px; margin-bottom: 18px; }
.tab { flex: 1; padding: 10px; border: none; background: var(--bg); border-radius: 10px; font-weight: 600; cursor: pointer; color: var(--muted); }
.tab.active { background: var(--primary); color: #fff; }

.form { display: flex; flex-direction: column; gap: 12px; }
.form h2 { margin-bottom: 4px; }
input, select { padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; font: inherit; }
input:focus, select:focus { outline: 2px solid var(--primary-light); border-color: var(--primary-light); }

.btn { background: var(--accent); color: #fff; border: none; padding: 13px 20px; border-radius: 10px; font-weight: 700; cursor: pointer; font: inherit; }
.btn:hover { filter: brightness(0.95); }
.btn--ghost { background: transparent; color: var(--text); border: 1.5px solid var(--border); }
.btn--sm { padding: 9px 16px; font-size: 14px; }

.error { color: var(--error); font-weight: 600; margin-top: 10px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid--three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.big { font-size: 30px; font-weight: 800; margin: 6px 0 12px; color: var(--primary); }
.balance .big { color: var(--accent); }
.code-value { letter-spacing: 3px; }

.list { display: flex; flex-direction: column; gap: 10px; }
.row { display: flex; justify-content: space-between; align-items: center; padding: 12px; border: 1px solid var(--border); border-radius: 10px; }
.row .name { font-weight: 600; }
.badge { font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 999px; }
.badge.active { background: #E9F9EF; color: #15803D; }
.badge.expired { background: #FEECEC; color: #B91C1C; }
.amount.pos { color: var(--success); font-weight: 700; }
.amount.neg { color: var(--error); font-weight: 700; }

.wizard-grid, .portal-grid, .tool-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.wizard-card, .portal-card, .tool {
  text-align: left;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  cursor: pointer;
  font: inherit;
  min-height: 116px;
}
.wizard-card:hover, .portal-card:hover, .tool:hover { border-color: var(--primary-light); box-shadow: 0 8px 24px rgba(14,75,90,.09); }
.wizard-card span, .portal-card span, .tool span { display: block; font-weight: 800; margin-bottom: 8px; color: var(--primary); }
.wizard-card small, .portal-card small, .tool small { color: var(--muted); line-height: 1.45; }
.portal-card { background: #fbf7f0; border-color: #f2d7b6; }
.tool { background: #f8fbfc; }
.wizard-body p { color: var(--muted); margin-bottom: 14px; }
.wizard-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.wizard-form label { display: grid; gap: 6px; color: var(--muted); font-size: 13px; font-weight: 700; }
.steps { display: grid; gap: 10px; }
.steps div { border: 1px solid var(--border); border-radius: 10px; padding: 12px; }
.steps b, .steps span { display: block; }
.steps span { color: var(--muted); margin-top: 4px; }
.wizard-output { margin-top: 14px; border: 1px solid var(--border); border-radius: 12px; background: #0f172a; color: #e2e8f0; overflow: hidden; }
.wizard-output h4 { padding: 12px 14px; border-bottom: 1px solid rgba(255,255,255,.12); }
.wizard-output pre { max-height: 260px; overflow: auto; padding: 14px; white-space: pre-wrap; font-size: 12px; line-height: 1.5; }

.modal { position: fixed; inset: 0; background: rgba(15,23,42,.5); display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 50; }
.modal__box { background: #fff; border-radius: 16px; padding: 24px; width: 100%; max-width: 420px; }
.modal__box--wide { max-width: 680px; }
.modal__box h3 { margin-bottom: 16px; }
.modal__actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 6px; }

@media (max-width: 880px) {
  .hero { align-items: flex-start; flex-direction: column; }
  .grid, .grid--three, .wizard-grid, .portal-grid, .tool-grid, .wizard-form { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
  .btn,
  .link-btn {
    width: 100%;
    text-align: center;
    justify-content: center;
  }
  .modal__actions {
    flex-direction: column-reverse;
    align-items: stretch;
  }
  .topbar,
  .hero,
  .card .row {
    align-items: stretch;
  }
}
