/* ================= AEGISPAY — UI LAYER =================
   Base styles and the component set every page is built from. Layout is Tailwind
   (aegis-tw.js); components are prefixed ag-.

   Identity: a regulated multi-currency wallet. Navy ink and a brass accent on cool paper,
   Public Sans for everything you read and operate, Newsreader (serif) only for display
   headlines on public pages. Figures use tabular digits so columns of money line up. */

:root {
  --ag-ink: 11 26 48;
  --ag-body: 58 71 92;
  --ag-muted: 102 114 138;
  --ag-paper: 244 246 249;
  --ag-surface: 255 255 255;
  --ag-raised: 238 241 245;
  --ag-line: 221 226 234;
  --ag-line-strong: 196 204 216;
  --ag-navy: 18 48 92;
  --ag-navy-hover: 12 35 71;
  --ag-navy-soft: 225 232 242;
  --ag-brass: 181 139 67;
  --ag-brass-text: 138 106 47;
  --ag-pos: 19 122 75;
  --ag-neg: 180 35 44;
  --ag-warn: 168 98 10;
  --ag-info: 36 87 197;
  --ag-shadow-1: 0 1px 2px rgb(11 26 48 / .05);
  --ag-shadow-2: 0 1px 2px rgb(11 26 48 / .05), 0 6px 16px -4px rgb(11 26 48 / .08);
  --ag-shadow-3: 0 2px 6px rgb(11 26 48 / .06), 0 24px 48px -12px rgb(11 26 48 / .22);
  color-scheme: light;
}

/* ---------------------------------------------------------------- base */
body {
  font-family: "Public Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  color: rgb(var(--ag-body));
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
.font-mono, .ag-num { font-variant-numeric: tabular-nums; letter-spacing: 0; }
::selection { background: rgb(var(--ag-navy) / .14); }
:focus-visible { outline: 2px solid rgb(var(--ag-navy)); outline-offset: 2px; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; }
input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]):focus,
select:focus, textarea:focus {
  border-color: rgb(var(--ag-navy)) !important;
  box-shadow: 0 0 0 3px rgb(var(--ag-navy) / .14);
  outline: none;
}
input[type="checkbox"], input[type="radio"] { accent-color: rgb(var(--ag-navy)); }
input::placeholder, textarea::placeholder { color: rgb(var(--ag-muted) / .8); }

.animate-bounce { animation: none !important; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* ---------------------------------------------------------------- icons */
.ag-icon { width: 18px; height: 18px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.ag-icon-sm { width: 16px; height: 16px; }
.ag-icon-lg { width: 22px; height: 22px; }
.ag-icon-xl { width: 28px; height: 28px; stroke-width: 1.5; }

/* ---------------------------------------------------------------- brand */
.ag-logo { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; flex-shrink: 0; }
.ag-logo-mark { width: 30px; height: 30px; flex-shrink: 0; }
.ag-logo-name { font-size: 19px; font-weight: 700; letter-spacing: -0.01em; color: rgb(var(--ag-ink)); white-space: nowrap; }
.ag-on-dark .ag-logo-name { color: #fff; }

/* ---------------------------------------------------------------- header (public + app) */
.ag-topbar { background: rgb(var(--ag-ink)); color: rgb(203 213 228); font-size: 12px; }
.ag-topbar a { color: rgb(203 213 228); }
.ag-topbar a:hover { color: #fff; }
.ag-header { position: sticky; top: 0; z-index: 50; background: rgb(255 255 255 / .92); -webkit-backdrop-filter: saturate(1.4) blur(12px); backdrop-filter: saturate(1.4) blur(12px); border-bottom: 1px solid rgb(var(--ag-line)); }
.ag-header-inner { max-width: 1240px; margin: 0 auto; height: 68px; padding: 0 20px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.ag-app-header .ag-header-inner { max-width: 1320px; height: 64px; }
.ag-nav { display: flex; align-items: center; gap: 4px; }
.ag-nav-link { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px; border-radius: 8px; font-size: 14px; font-weight: 500; color: rgb(var(--ag-body)); white-space: nowrap; transition: background-color .15s, color .15s; }
.ag-nav-link:hover { color: rgb(var(--ag-ink)); background: rgb(var(--ag-raised)); }
.ag-nav-link.is-active, .ag-nav-link[aria-current="page"] { color: rgb(var(--ag-navy)); background: rgb(var(--ag-navy-soft)); font-weight: 600; }

/* app sub-navigation (signed-in pages) */
.ag-subnav { background: #fff; border-bottom: 1px solid rgb(var(--ag-line)); }
.ag-subnav-inner { max-width: 1320px; margin: 0 auto; padding: 0 20px; display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.ag-subnav-inner::-webkit-scrollbar { display: none; }
.ag-subnav-link { display: inline-flex; align-items: center; gap: 8px; height: 46px; padding: 0 12px; font-size: 14px; font-weight: 500; color: rgb(var(--ag-muted)); border-bottom: 2px solid transparent; white-space: nowrap; }
.ag-subnav-link:hover { color: rgb(var(--ag-ink)); }
.ag-subnav-link.is-active, .ag-subnav-link[aria-current="page"] { color: rgb(var(--ag-navy)); border-bottom-color: rgb(var(--ag-navy)); font-weight: 600; }

/* ---------------------------------------------------------------- buttons */
.ag-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 42px; padding: 0 18px; border-radius: 10px; border: 1px solid transparent; font-size: 14px; font-weight: 600; line-height: 1; white-space: nowrap; cursor: pointer; text-decoration: none; transition: background-color .15s, border-color .15s, color .15s; }
.ag-btn:disabled, .ag-btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
.ag-btn-sm { height: 34px; padding: 0 12px; font-size: 13px; border-radius: 8px; gap: 6px; }
.ag-btn-lg { height: 50px; padding: 0 22px; font-size: 15px; }
.ag-btn-block { width: 100%; }
.ag-btn-primary { background: rgb(var(--ag-navy)); color: #fff; box-shadow: var(--ag-shadow-1); }
.ag-btn-primary:hover { background: rgb(var(--ag-navy-hover)); }
.ag-btn-secondary { background: #fff; color: rgb(var(--ag-ink)); border-color: rgb(var(--ag-line-strong)); box-shadow: var(--ag-shadow-1); }
.ag-btn-secondary:hover { background: rgb(var(--ag-raised)); }
.ag-btn-ghost { background: transparent; color: rgb(var(--ag-body)); }
.ag-btn-ghost:hover { background: rgb(var(--ag-raised)); color: rgb(var(--ag-ink)); }
.ag-btn-brass { background: rgb(var(--ag-brass)); color: #fff; }
.ag-btn-brass:hover { background: rgb(154 115 52); }
.ag-btn-danger { background: #fff; color: rgb(var(--ag-neg)); border-color: rgb(var(--ag-neg) / .35); }
.ag-btn-danger:hover { background: rgb(var(--ag-neg) / .06); }
.ag-btn-light { background: #fff; color: rgb(var(--ag-ink)); }
.ag-btn-light:hover { background: rgb(var(--ag-raised)); }
.ag-btn-outline-light { background: transparent; color: #fff; border-color: rgb(255 255 255 / .35); }
.ag-btn-outline-light:hover { background: rgb(255 255 255 / .08); }
.ag-icon-btn { width: 38px; height: 38px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; border-radius: 9px; border: 1px solid transparent; background: transparent; color: rgb(var(--ag-muted)); cursor: pointer; transition: background-color .15s, color .15s; }
.ag-icon-btn:hover { background: rgb(var(--ag-raised)); color: rgb(var(--ag-ink)); }
.ag-link { color: rgb(var(--ag-navy)); font-weight: 600; text-decoration: none; }
.ag-link:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ---------------------------------------------------------------- layout + surfaces */
.ag-container { max-width: 1240px; margin: 0 auto; padding: 0 20px; width: 100%; }
.ag-app { max-width: 1320px; margin: 0 auto; width: 100%; padding: 28px 20px 64px; }
.ag-narrow { max-width: 760px; }
.ag-section { padding: 72px 0; }
@media (min-width: 1024px) { .ag-section { padding: 96px 0; } }
.ag-section-tight { padding: 48px 0; }
.ag-band { background: rgb(var(--ag-ink)); color: rgb(203 213 228); }
/* headings on a band are white, except inside a white card placed on the band */
.ag-band :is(h1, h2, h3):not(:where(.ag-card *)) { color: #fff; }

.ag-card { background: #fff; border: 1px solid rgb(var(--ag-line)); border-radius: 14px; box-shadow: var(--ag-shadow-1); }
.ag-card-pad { padding: 20px; }
@media (min-width: 640px) { .ag-card-pad { padding: 28px; } }
.ag-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid rgb(var(--ag-line)); }
@media (min-width: 640px) { .ag-card-head { padding: 18px 24px; } }
.ag-inset { background: rgb(var(--ag-paper)); border: 1px solid rgb(var(--ag-line)); border-radius: 10px; }
.ag-rule { border: 0; border-top: 1px solid rgb(var(--ag-line)); }

/* ---------------------------------------------------------------- type */
.ag-display { font-family: Newsreader, Georgia, serif; font-weight: 500; font-size: 42px; line-height: 1.06; letter-spacing: -0.02em; color: rgb(var(--ag-ink)); }
@media (min-width: 768px) { .ag-display { font-size: 60px; } }
.ag-display-sm { font-family: Newsreader, Georgia, serif; font-weight: 500; font-size: 32px; line-height: 1.12; letter-spacing: -0.015em; color: rgb(var(--ag-ink)); }
@media (min-width: 768px) { .ag-display-sm { font-size: 42px; } }
.ag-h1 { font-size: 26px; line-height: 1.2; font-weight: 700; letter-spacing: -0.015em; color: rgb(var(--ag-ink)); }
@media (min-width: 768px) { .ag-h1 { font-size: 30px; } }
.ag-h2 { font-size: 20px; line-height: 1.3; font-weight: 700; letter-spacing: -0.01em; color: rgb(var(--ag-ink)); }
.ag-h3 { font-size: 16px; line-height: 1.4; font-weight: 600; color: rgb(var(--ag-ink)); }
.ag-title { font-size: 15px; line-height: 1.4; font-weight: 600; color: rgb(var(--ag-ink)); }
.ag-sub { font-size: 14px; line-height: 1.55; color: rgb(var(--ag-muted)); }
.ag-lead { font-size: 17px; line-height: 1.65; color: rgb(var(--ag-body)); max-width: 62ch; }
.ag-prose { font-size: 15px; line-height: 1.75; color: rgb(var(--ag-body)); max-width: 72ch; }
.ag-prose h2 { font-size: 20px; font-weight: 700; color: rgb(var(--ag-ink)); margin: 40px 0 12px; letter-spacing: -0.01em; }
.ag-prose h3 { font-size: 16px; font-weight: 600; color: rgb(var(--ag-ink)); margin: 28px 0 8px; }
.ag-prose p, .ag-prose ul, .ag-prose ol { margin: 0 0 14px; }
.ag-prose ul { list-style: disc; padding-inline-start: 20px; }
.ag-prose ol { list-style: decimal; padding-inline-start: 20px; }
.ag-prose li { margin: 4px 0; }
.ag-prose a { color: rgb(var(--ag-navy)); font-weight: 600; }
.ag-kicker { font-size: 13px; font-weight: 600; color: rgb(var(--ag-brass-text)); }
.ag-kpi-label { font-size: 13px; color: rgb(var(--ag-muted)); }
.ag-kpi-value { font-size: 26px; line-height: 1.15; font-weight: 700; letter-spacing: -0.015em; color: rgb(var(--ag-ink)); font-variant-numeric: tabular-nums; }
.ag-amount { font-variant-numeric: tabular-nums; font-weight: 600; color: rgb(var(--ag-ink)); }

/* ---------------------------------------------------------------- forms */
.ag-label { display: block; font-size: 13px; font-weight: 600; color: rgb(var(--ag-ink)); margin-bottom: 6px; }
.ag-help { font-size: 12.5px; color: rgb(var(--ag-muted)); margin-top: 6px; line-height: 1.5; }
.ag-input { width: 100%; height: 46px; padding: 0 14px; border-radius: 10px; background: #fff; border: 1px solid rgb(var(--ag-line-strong)); color: rgb(var(--ag-ink)); font-size: 15px; transition: border-color .15s, box-shadow .15s; }
.ag-input:hover { border-color: rgb(var(--ag-muted) / .6); }
textarea.ag-input { height: auto; min-height: 110px; padding: 11px 14px; line-height: 1.55; }
select.ag-input { appearance: none; -webkit-appearance: none; padding-inline-end: 40px; cursor: pointer; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2366728A' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; }
.ag-input-group { display: flex; align-items: stretch; border-radius: 10px; border: 1px solid rgb(var(--ag-line-strong)); background: #fff; overflow: hidden; transition: border-color .15s, box-shadow .15s; }
.ag-input-group:focus-within { border-color: rgb(var(--ag-navy)); box-shadow: 0 0 0 3px rgb(var(--ag-navy) / .14); }
.ag-input-group input, .ag-input-group select { flex: 1; min-width: 0; background: transparent; border: 0; height: 46px; padding: 0 14px; color: rgb(var(--ag-ink)); font-size: 15px; }
.ag-input-group input:focus, .ag-input-group select:focus { box-shadow: none; }
.ag-addon { display: inline-flex; align-items: center; gap: 6px; padding: 0 14px; font-size: 14px; font-weight: 600; color: rgb(var(--ag-muted)); background: rgb(var(--ag-paper)); }
.ag-field-row { display: grid; gap: 16px; }
@media (min-width: 640px) { .ag-field-row { grid-template-columns: 1fr 1fr; } }

.ag-seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px; background: rgb(var(--ag-raised)); border-radius: 12px; }
.ag-seg-btn { height: 38px; border-radius: 9px; font-size: 14px; font-weight: 500; color: rgb(var(--ag-muted)); white-space: nowrap; padding: 0 12px; transition: background-color .15s, color .15s; }
.ag-seg-btn:hover { color: rgb(var(--ag-ink)); }
.ag-seg-btn.is-active { background: #fff; color: rgb(var(--ag-ink)); font-weight: 600; box-shadow: var(--ag-shadow-1); }

/* selectable option card (payment rails, currencies) */
.ag-option { display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: 12px; border: 1px solid rgb(var(--ag-line)); background: #fff; transition: border-color .15s, box-shadow .15s, background-color .15s; text-align: start; }
.ag-option:hover { border-color: rgb(var(--ag-line-strong)); box-shadow: var(--ag-shadow-2); }
.ag-option.is-active { border-color: rgb(var(--ag-navy)); background: rgb(var(--ag-navy-soft) / .5); box-shadow: 0 0 0 1px rgb(var(--ag-navy)); }
.ag-option-icon { width: 42px; height: 42px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; background: rgb(var(--ag-navy-soft)); color: rgb(var(--ag-navy)); flex-shrink: 0; }

/* ---------------------------------------------------------------- chips + alerts */
.ag-chip { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; line-height: 1; background: rgb(var(--ag-raised)); color: rgb(var(--ag-body)); }
.ag-chip-pos { background: rgb(var(--ag-pos) / .1); color: rgb(var(--ag-pos)); }
.ag-chip-neg { background: rgb(var(--ag-neg) / .09); color: rgb(var(--ag-neg)); }
.ag-chip-warn { background: rgb(var(--ag-warn) / .1); color: rgb(var(--ag-warn)); }
.ag-chip-info { background: rgb(var(--ag-info) / .1); color: rgb(var(--ag-info)); }
.ag-chip-navy { background: rgb(var(--ag-navy-soft)); color: rgb(var(--ag-navy)); }
.ag-chip-brass { background: rgb(var(--ag-brass) / .14); color: rgb(var(--ag-brass-text)); }
.ag-dot { width: 7px; height: 7px; border-radius: 999px; background: currentColor; flex-shrink: 0; }

.ag-alert { display: flex; gap: 10px; align-items: flex-start; padding: 13px 15px; border-radius: 10px; font-size: 14px; line-height: 1.55; border: 1px solid rgb(var(--ag-line)); background: rgb(var(--ag-paper)); color: rgb(var(--ag-body)); }
.ag-alert-pos { background: rgb(var(--ag-pos) / .06); border-color: rgb(var(--ag-pos) / .25); color: rgb(15 92 57); }
.ag-alert-neg { background: rgb(var(--ag-neg) / .05); border-color: rgb(var(--ag-neg) / .25); color: rgb(var(--ag-neg)); }
.ag-alert-warn { background: rgb(var(--ag-warn) / .06); border-color: rgb(var(--ag-warn) / .28); color: rgb(122 72 8); }
.ag-alert-info { background: rgb(var(--ag-navy-soft) / .6); border-color: rgb(var(--ag-navy) / .18); color: rgb(var(--ag-navy)); }

/* ---------------------------------------------------------------- tables */
.ag-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.ag-table { width: 100%; border-collapse: collapse; font-size: 14px; }
:where(.ag-table th) { text-align: start; color: rgb(var(--ag-muted)); }
.ag-table th { font-size: 12.5px; font-weight: 600; padding: 11px 16px; background: rgb(var(--ag-paper)); border-bottom: 1px solid rgb(var(--ag-line)); white-space: nowrap; }
.ag-table td { padding: 13px 16px; border-bottom: 1px solid rgb(var(--ag-line)); vertical-align: middle; }
/* colour at zero specificity so a text-* utility on a cell still wins */
:where(.ag-table td) { color: rgb(var(--ag-body)); }
.ag-table tbody tr:last-child td { border-bottom: 0; }
.ag-table tbody tr:hover td { background: rgb(var(--ag-paper) / .7); }

/* ---------------------------------------------------------------- overlays */
.ag-backdrop { background: rgb(8 23 47 / .5); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.ag-modal { background: #fff; border: 1px solid rgb(var(--ag-line)); border-radius: 18px; box-shadow: var(--ag-shadow-3); }

/* ---------------------------------------------------------------- footer */
.ag-footer { background: rgb(var(--ag-ink)); color: rgb(160 174 196); font-size: 14px; }
.ag-footer h4 { font-size: 13px; font-weight: 600; color: #fff; margin-bottom: 14px; }
.ag-footer a { color: rgb(160 174 196); }
.ag-footer a:hover { color: #fff; }
.ag-footer-light { background: #fff; color: rgb(var(--ag-muted)); border-top: 1px solid rgb(var(--ag-line)); font-size: 13px; }

/* ---------------------------------------------------------------- misc */
.ag-empty { padding: 40px 20px; text-align: center; color: rgb(var(--ag-muted)); font-size: 14px; }
.ag-step { width: 28px; height: 28px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; color: rgb(var(--ag-navy)); background: rgb(var(--ag-navy-soft)); flex-shrink: 0; }
.ag-check { color: rgb(var(--ag-pos)); }

/* ---------------------------------------------------------------- very narrow phones
   Below ~380px the logo, the register button and the menu button can't share the header row;
   the menu panel already carries "Open Account", so the header button steps aside. */
@media (max-width: 379px) {
  .ag-header .ag-header-inner { padding: 0 14px; gap: 10px; }
  .ag-header-inner a[href="register.html"].ag-btn-primary { display: none; }
}
