/* Sweden Capital — hoja de estilos propia, sin dependencias externas
   ni paso de compilacion, para que funcione en cualquier hosting. */

:root {
    --brand: #0b5fff;
    --brand-dark: #0741b8;
    --brand-soft: #e8f0ff;
    --ink: #10182b;
    --ink-soft: #5b6478;
    --line: #e2e6ee;
    --bg: #f5f7fb;
    --surface: #ffffff;
    /* #0f8a4b se quedaba en 4,42:1 sobre blanco (importes en verde) y sobre el
       verde del boton Aprobar. Este tono llega a 5,4:1. */
    --ok: #0b7a42;
    --ok-soft: #e4f6ec;
    --warn: #a4690a;
    --warn-soft: #fdf3e0;
    --bad: #c62b34;
    --bad-soft: #fdeaeb;
    --radius: 12px;
    --shadow: 0 1px 2px rgba(16, 24, 43, .06), 0 8px 24px rgba(16, 24, 43, .06);

    /* Portada: tokens propios para la capa de marketing */
    --violet: #6b30e0;
    --violet-dark: #4a1aa8;
    --mint: #16c79a;
    --sand: #ffd166;
    --radius-lg: 22px;
    --radius-xl: 30px;
    --shadow-lift: 0 2px 6px rgba(16, 24, 43, .05), 0 18px 46px rgba(16, 24, 43, .12);
    --shadow-float: 0 30px 70px rgba(28, 12, 74, .28);
}

* { box-sizing: border-box; }

/* El atributo hidden debe ganar siempre. Sin esto, cualquier elemento con un
   display propio (p. ej. el panel del selector de país, que es flex) se sigue
   mostrando aunque lleve hidden. */
[hidden] { display: none !important; }

body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 15px;
    line-height: 1.55;
    color: var(--ink);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { margin: 0 0 .5rem; line-height: 1.25; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 1rem; }

.container { width: min(1120px, 100% - 2rem); margin-inline: auto; }
.container-narrow { width: min(460px, 100% - 2rem); margin-inline: auto; }

/* ---------- Barra superior ---------- */

.topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 20;
}

.topbar-inner {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    min-height: 62px;
    flex-wrap: wrap;
}

.brand {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--ink);
    letter-spacing: -.01em;
    display: inline-flex;
    align-items: center;
    gap: .5rem;
}
.brand:hover { text-decoration: none; }

.logo-mark { flex: none; display: block; }

/* Marca en texto: se usa en las iniciales de la maqueta de la portada y
   como respaldo si alguna vista aun no usa el componente <x-logo-mark />. */
.brand-mark {
    width: 28px; height: 28px;
    border-radius: 8px;
    background-color: var(--brand);
    background-image: linear-gradient(135deg, var(--brand), #4b8bff);
    color: #fff;
    display: grid;
    place-items: center;
    font-size: .8rem;
    font-weight: 700;
}

.nav { display: flex; gap: .25rem; flex-wrap: wrap; margin-left: auto; align-items: center; }

.nav a {
    padding: .45rem .7rem;
    border-radius: 8px;
    color: var(--ink-soft);
    font-weight: 500;
    font-size: .92rem;
}
.nav a:hover { background: var(--bg); color: var(--ink); text-decoration: none; }
.nav a.is-active { background: var(--brand-soft); color: var(--brand-dark); }

.lang-switch { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.lang-switch a { padding: .3rem .55rem; font-size: .8rem; border-radius: 0; text-transform: uppercase; }
.lang-switch a.is-active { background: var(--brand); color: #fff; }

/* ---------- Estructura ---------- */

.page { padding: 2rem 0 3rem; }
.page-head { display: flex; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.page-head p { color: var(--ink-soft); margin: 0; }
.page-head .spacer { margin-left: auto; }

.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow);
}
.card + .card { margin-top: 1rem; }
.card-title { font-size: .95rem; font-weight: 600; margin-bottom: .9rem; }

/* ---------- Tarjeta de saldo ---------- */

.balance-card {
    background: linear-gradient(135deg, var(--brand-dark), var(--brand) 55%, #4b8bff);
    color: #fff;
    border: none;
}
.balance-card .label { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; opacity: .85; }
.balance-card .value { font-size: 2.1rem; font-weight: 700; letter-spacing: -.02em; margin-top: .25rem; }
.balance-card .meta { opacity: .85; font-size: .85rem; margin-top: .35rem; }

.stat .label { color: var(--ink-soft); font-size: .82rem; text-transform: uppercase; letter-spacing: .05em; }
.stat .value { font-size: 1.5rem; font-weight: 650; margin-top: .2rem; letter-spacing: -.01em; }

/* ---------- Formularios ---------- */

.field { margin-bottom: 1rem; }
.field label { display: block; font-weight: 550; font-size: .88rem; margin-bottom: .35rem; }
.field .hint { color: var(--ink-soft); font-size: .82rem; margin-top: .3rem; }

input[type=text], input[type=email], input[type=password], input[type=number],
input[type=search], select, textarea {
    width: 100%;
    padding: .6rem .75rem;
    border: 1px solid var(--line);
    border-radius: 9px;
    font: inherit;
    color: inherit;
    background: var(--surface);
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(11, 95, 255, .15);
}
textarea { min-height: 90px; resize: vertical; }

.checkbox { display: flex; align-items: center; gap: .5rem; font-size: .9rem; }
.checkbox input { width: auto; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    padding: .6rem 1.05rem;
    border: 1px solid transparent;
    border-radius: 9px;
    font: inherit;
    font-weight: 550;
    cursor: pointer;
    background: var(--brand);
    color: #fff;
}
.btn:hover { background: var(--brand-dark); text-decoration: none; }
.btn-block { width: 100%; }
.btn-sm { padding: .35rem .7rem; font-size: .85rem; }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { background: var(--bg); }
.btn-ok { background: var(--ok); }
.btn-ok:hover { background: #0b6f3c; }
.btn-bad { background: var(--bad); }
.btn-bad:hover { background: #a2222a; }

/* ---------- Avisos ---------- */

.alert { padding: .8rem 1rem; border-radius: 10px; margin-bottom: 1rem; font-size: .92rem; border: 1px solid transparent; }
.alert-ok { background: var(--ok-soft); color: #0a5c33; border-color: #b7e4ca; }
.alert-bad { background: var(--bad-soft); color: #8c1f26; border-color: #f2c2c5; }
.alert ul { margin: .35rem 0 0; padding-left: 1.1rem; }
.error-text { color: var(--bad); font-size: .84rem; margin-top: .3rem; }

/* ---------- Tablas ---------- */

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { padding: .7rem .85rem; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { background: #fafbfd; font-weight: 600; font-size: .82rem; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-soft); }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fafbfd; }
td.wrap, th.wrap { white-space: normal; min-width: 200px; }
.num { font-variant-numeric: tabular-nums; }
.credit { color: var(--ok); font-weight: 600; }
.debit { color: var(--bad); font-weight: 600; }

.empty { padding: 2.5rem 1rem; text-align: center; color: var(--ink-soft); }

.badge {
    display: inline-block;
    padding: .18rem .55rem;
    border-radius: 999px;
    font-size: .76rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .03em;
}
.badge-ok { background: var(--ok-soft); color: #0a5c33; }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-bad { background: var(--bad-soft); color: #8c1f26; }

.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .85em; }
.muted { color: var(--ink-soft); }
.text-sm { font-size: .88rem; }

/* ---------- Paginacion ---------- */

.pagination { display: flex; gap: .3rem; flex-wrap: wrap; list-style: none; padding: 0; margin: 1rem 0 0; }
.pagination li span, .pagination li a {
    display: inline-block; padding: .35rem .7rem;
    border: 1px solid var(--line); border-radius: 8px;
    background: var(--surface); font-size: .88rem;
}
.pagination .active span { background: var(--brand); color: #fff; border-color: var(--brand); }
.pagination .disabled span { color: #b8bfcd; }

/* ---------- Portada ---------- */

.hero { padding: 4rem 0 3rem; text-align: center; }
.hero h1 { font-size: clamp(1.9rem, 5vw, 2.9rem); letter-spacing: -.02em; }
.hero p { color: var(--ink-soft); font-size: 1.05rem; max-width: 34rem; margin-inline: auto; }
.hero-actions { display: flex; gap: .6rem; justify-content: center; flex-wrap: wrap; margin-top: 1.5rem; }

.feature { text-align: left; }
.feature h3 { margin-bottom: .3rem; }
.feature p { color: var(--ink-soft); font-size: .92rem; margin: 0; }
.feature-icon {
    width: 36px; height: 36px; border-radius: 10px;
    background: var(--brand-soft); color: var(--brand-dark);
    display: grid; place-items: center; font-size: 1.05rem; margin-bottom: .7rem;
}

.footer { border-top: 1px solid var(--line); padding: 1.75rem 0; color: var(--ink-soft); font-size: .88rem; }
.footer-nav { display: flex; gap: 1.1rem; flex-wrap: wrap; justify-content: center; margin-bottom: .9rem; }
.footer-nav a { color: var(--ink-soft); }
.footer-nav a:hover { color: var(--brand); }
.footer-legal { text-align: center; }

/* ---------- Paginas institucionales ---------- */

.page-hero { text-align: center; padding: 1rem 0 2rem; border-bottom: 1px solid var(--line); margin-bottom: 2rem; }
.page-hero h1 { font-size: clamp(1.7rem, 4vw, 2.4rem); letter-spacing: -.02em; }
.page-hero p { color: var(--ink-soft); max-width: 42rem; margin: .5rem auto 0; }

.prose { max-width: 46rem; margin-inline: auto; }
.prose h2 { margin-top: 2.2rem; font-size: 1.2rem; }
.prose h2:first-child { margin-top: 0; }
.prose h3 { margin-top: 1.5rem; font-size: 1rem; color: var(--ink); }
.prose p, .prose li { color: #3a4255; }
.prose ul { padding-left: 1.2rem; margin: 0 0 1rem; }
.prose li { margin-bottom: .4rem; }
.prose strong { color: var(--ink); }

.updated { color: var(--ink-soft); font-size: .85rem; margin-bottom: 2rem; padding-bottom: 1rem; border-bottom: 1px solid var(--line); }

/* Marcador visible para los datos que el titular del sitio debe completar
   antes de publicar (razon social, direccion, jurisdiccion...). */
.placeholder {
    background: var(--warn-soft);
    /* Tono propio, mas oscuro que var(--warn): sobre --warn-soft ese color
       se queda en 4.14:1 y no llega al minimo AA de 4.5:1. */
    color: #75490a;
    padding: .05rem .35rem;
    border-radius: 5px;
    font-weight: 600;
    font-size: .92em;
}

.notice {
    background: var(--warn-soft);
    border: 1px solid #f0dcb4;
    color: #6b4506;
    border-radius: var(--radius);
    padding: 1rem 1.15rem;
    margin-bottom: 2rem;
    font-size: .9rem;
}
.notice p:last-child { margin-bottom: 0; }

/* ---------- Auth ---------- */

.auth-wrap { min-height: 78vh; display: grid; place-items: center; padding: 2rem 0; }
.auth-card { width: min(430px, 100%); }
.auth-head { text-align: center; margin-bottom: 1.25rem; }
.auth-head p { color: var(--ink-soft); margin: .25rem 0 0; font-size: .92rem; }

/* ---------- Admin ---------- */

.admin-topbar { background: var(--ink); border-bottom: none; }
.admin-topbar .brand { color: #fff; }
.admin-topbar .nav a { color: #aab3c5; }
.admin-topbar .nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.admin-topbar .nav a.is-active { background: rgba(255,255,255,.14); color: #fff; }

.inline-form { display: inline; }
.row-actions { display: flex; gap: .35rem; flex-wrap: wrap; }

/* ---------- Botones dentro de la barra de navegacion ----------
   Las reglas de `.nav a` son mas especificas que `.btn`, asi que sin esto un
   enlace con clase .btn en la barra pierde su color de texto y queda
   ilegible sobre el fondo del boton. Va al final para ganar tambien a las
   variantes de .admin-topbar. */

.nav a.btn,
.nav a.btn:hover,
.admin-topbar .nav a.btn,
.admin-topbar .nav a.btn:hover { color: #fff; }

.nav a.btn:hover,
.admin-topbar .nav a.btn:hover { background: var(--brand-dark); }

.nav a.btn-ghost,
.nav a.btn-ghost:hover { color: var(--ink); background: transparent; }

.nav a.btn-ghost:hover { background: var(--bg); }

/* La barra del panel de administracion es oscura, asi que el color de texto
   por defecto de .btn-ghost (var(--ink)) queda invisible sobre ella.
   Aplica a <button> ademas de <a>: el boton de salir es un <button>. */
.admin-topbar .nav .btn-ghost {
    color: #e6e9f0;
    border-color: rgba(255, 255, 255, .28);
    background: transparent;
}
.admin-topbar .nav .btn-ghost:hover {
    color: #fff;
    background: rgba(255, 255, 255, .14);
}

@media (max-width: 640px) {
    .topbar-inner { min-height: 0; padding: .7rem 0; }
    .nav { width: 100%; margin-left: 0; }
    .page { padding: 1.25rem 0 2rem; }
}

/* ---------- Depositos en cripto ---------- */

.crypto-box {
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1rem 1.1rem;
    margin-bottom: 1rem;
}

.crypto-grid {
    display: flex;
    gap: 1.1rem;
    align-items: flex-start;
    flex-wrap: wrap;
}
.crypto-grid .qr {
    background: #fff;
    padding: .5rem;
    border-radius: 10px;
    border: 1px solid var(--line);
    line-height: 0;
    flex: none;
}
.crypto-grid .qr svg { display: block; width: 150px; height: 150px; }

.field-label {
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--ink-soft);
    font-weight: 600;
    margin-bottom: .3rem;
}

/* La direccion se parte por caracteres: son cadenas largas sin espacios y
   sin esto desbordan el contenedor en pantallas estrechas. */
.wallet {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: .84rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: .55rem .7rem;
    word-break: break-all;
    margin-bottom: .6rem;
}

/* Aviso de red: enviar por la cadena equivocada pierde los fondos, asi que
   tiene que destacar sobre el resto del bloque. */
.aviso {
    background: var(--warn-soft);
    border: 1px solid #f0dcb4;
    color: #6b4506;
    border-radius: 9px;
    padding: .6rem .8rem;
    font-size: .85rem;
    margin: .9rem 0 0;
}

@media (max-width: 560px) {
    .crypto-grid { justify-content: center; }
}

/* ---------- Selector de pais con bandera ---------- */

.flag {
    width: 20px;
    height: 15px;
    object-fit: cover;
    border-radius: 2px;
    flex: none;
    box-shadow: 0 0 0 1px rgba(16, 24, 43, .12);
    background: var(--bg);
}

.combo { position: relative; }

.combo-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .6rem .75rem;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: var(--surface);
    font: inherit;
    color: inherit;
    cursor: pointer;
    text-align: left;
}
.combo-toggle:hover { border-color: #c9d0dd; }
.combo-selected { display: flex; align-items: center; gap: .5rem; flex: 1; min-width: 0; }
.combo-selected span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.combo-caret { color: var(--ink-soft); flex: none; }

.combo-panel {
    position: absolute;
    z-index: 30;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 11px;
    box-shadow: var(--shadow);
    padding: .5rem;
    max-height: 320px;
    display: flex;
    flex-direction: column;
}

.combo-search {
    margin-bottom: .4rem;
    padding: .5rem .65rem !important;
}

.combo-list {
    list-style: none;
    margin: 0;
    padding: 0;
    overflow-y: auto;
}
.combo-option {
    width: 100%;
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .5rem .55rem;
    border: none;
    background: none;
    font: inherit;
    color: inherit;
    cursor: pointer;
    border-radius: 8px;
    text-align: left;
}
.combo-option:hover { background: var(--bg); }
.combo-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.combo-dial { flex: none; font-variant-numeric: tabular-nums; }

/* ---------- Telefono con prefijo ---------- */

.phone-input {
    display: flex;
    align-items: stretch;
    border: 1px solid var(--line);
    border-radius: 9px;
    overflow: hidden;
    background: var(--surface);
}
.phone-input:focus-within {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(11, 95, 255, .15);
}
.phone-prefix {
    display: flex;
    align-items: center;
    gap: .4rem;
    padding: 0 .7rem;
    background: var(--bg);
    border-right: 1px solid var(--line);
    font-variant-numeric: tabular-nums;
    color: var(--ink);
    white-space: nowrap;
}
.phone-input input {
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    flex: 1;
    min-width: 0;
}

/* ---------- Pais bloqueado (detectado por IP) ---------- */

.country-locked {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .6rem .75rem;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: var(--bg);
    color: var(--ink);
}
.country-locked-badge {
    margin-left: auto;
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    font-weight: 600;
    color: var(--ok);
    background: var(--ok-soft);
    padding: .2rem .5rem;
    border-radius: 999px;
    white-space: nowrap;
}
@media (max-width: 420px) {
    .country-locked-badge { display: none; }
}

/* ---------- Campo de archivo ---------- */

.file-input {
    padding: .5rem .6rem !important;
    cursor: pointer;
}
.file-input::file-selector-button {
    font: inherit;
    font-weight: 550;
    padding: .4rem .8rem;
    margin-right: .7rem;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: var(--bg);
    color: var(--ink);
    cursor: pointer;
}
.file-input::file-selector-button:hover { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-dark); }

/* ---------- Grafico de cotizacion en la tarjeta de saldo ---------- */

.fx {
    margin-top: 1.1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, .18);
}
.fx-head { display: flex; align-items: baseline; justify-content: space-between; gap: .5rem; }
.fx-title { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; opacity: .8; }
.fx-rate { font-size: .92rem; font-weight: 650; font-variant-numeric: tabular-nums; }
.fx-chart { display: block; width: 100%; height: 70px; margin-top: .5rem; overflow: visible; }
.fx-foot { font-size: .72rem; opacity: .7; margin-top: .4rem; }

.fx-balance {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: .5rem;
    margin-top: .7rem;
    padding-top: .7rem;
    border-top: 1px solid rgba(255, 255, 255, .18);
}
.fx-balance-label { font-size: .8rem; opacity: .85; }
.fx-balance-value { font-size: 1.05rem; font-weight: 700; font-variant-numeric: tabular-nums; }
