:root {
    --bg: #f5f6fb;
    --surface: #ffffff;
    --line: #e8ecf6;
    --text: #2c4ea8;
    --text-soft: #7e91bf;
    --primary: #1f5fe9;
    --primary-strong: #1f4fc7;
    --primary-soft: #eef2ff;
    --danger: #e05757;
    --radius: 12px;
    --tab-height: 66px;
    --shadow: 0 1px 8px rgba(45, 78, 166, 0.04);
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: "Avenir Next", "SF Pro Text", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    -webkit-font-smoothing: antialiased;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input {
    font: inherit;
}

input,
select,
textarea {
    font-size: 16px;
}

button {
    border: 0;
    cursor: pointer;
}

.app-shell {
    width: min(100%, 398px);
    min-height: 100vh;
    margin: 0 auto;
}

.screen {
    min-height: 100vh;
    padding: calc(15px + env(safe-area-inset-top)) 14px calc(var(--tab-height) + 12px + env(safe-area-inset-bottom));
}

.screen-auth {
    padding-bottom: 18px;
}

.flash-stack {
    display: grid;
    gap: 8px;
    margin-bottom: 10px;
}

.flash-card {
    background: #fff7ea;
    color: #b17812;
    border: 1px solid #f2dfba;
    border-radius: 10px;
    padding: 8px 11px;
    font-size: 0.81rem;
}

h1,
h2,
h3,
p {
    margin: 0;
}

.page-title,
h1 {
    font-size: 1.72rem;
    line-height: 1.08;
    letter-spacing: -0.012em;
    color: var(--text);
    font-weight: 700;
}

.topbar,
.section-heading,
.metric-head,
.detail-row,
.progress-meta,
.commit-metrics,
.two-up {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.topbar {
    margin: 2px 2px 11px;
}

.chip-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 4px 11px;
    border-radius: 999px;
    border: 1.6px solid #9cb2e6;
    color: #3258b3;
    background: #f7f9ff;
    font-size: 0.74rem;
    font-weight: 700;
}

.chip-icon {
    width: 12px;
    height: 10px;
    border: 1.4px solid currentColor;
    border-radius: 2px;
    position: relative;
}

.chip-icon::after {
    content: "";
    position: absolute;
    width: 4px;
    height: 4px;
    border: 1.4px solid currentColor;
    border-radius: 50%;
    right: -4px;
    top: 1px;
}

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.metric-stack,
.resource-stack,
.resource-list,
.mini-list,
.auth-actions {
    display: grid;
    gap: 10px;
}

.metric-card,
.resource-card,
.wallet-card,
.chart-panel,
.split-card,
.quick-card,
.form-card,
.detail-card,
.commit-hero,
.search-card,
.reward-card,
.validator-card,
.settings-card {
    padding: 13px;
}

.metric-label {
    color: #2f57b7;
    font-size: 0.82rem;
    font-weight: 700;
}

.metric-number {
    margin-top: 7px;
    font-size: 1.72rem;
    line-height: 1;
    font-weight: 700;
    color: #2348aa;
    letter-spacing: 0;
}

.metric-number span {
    font-size: 0.84rem;
    font-weight: 700;
    text-transform: uppercase;
}

.metric-number.small {
    margin-top: 5px;
    font-size: 1.58rem;
}

.tiny-pill {
    border-radius: 999px;
    background: var(--primary-soft);
    color: #7990c5;
    font-size: 0.6rem;
    font-weight: 600;
    padding: 4px 10px;
}

.chart-head {
    margin-bottom: 7px;
}

.info-badge {
    display: inline-flex;
    width: 14px;
    height: 14px;
    margin-left: 4px;
    border-radius: 50%;
    align-items: center;
    justify-content: center;
    border: 1px solid #a8b7de;
    color: #8ca1ce;
    font-size: 0.58rem;
    vertical-align: top;
}

.tiny-selects {
    display: flex;
    gap: 7px;
}

.tiny-select {
    border: 1px solid #d8e0f2;
    background: #fff;
    border-radius: 4px;
    color: #617ab9;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 4px 9px;
}

.chart-wrap {
    margin-top: 9px;
    display: flex;
    align-items: flex-end;
    gap: 6px;
}

.chart {
    flex: 1;
    height: 124px;
    display: flex;
    align-items: flex-end;
    gap: 6px;
    padding-top: 10px;
    border-top: 1px solid #edf1fb;
}

.chart-bar {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.chart-bar span {
    width: 100%;
    min-height: 14px;
    border-radius: 2px 2px 1px 1px;
    background: linear-gradient(180deg, #4d86f0 0%, #2e6ee8 100%);
}

.chart-bar small {
    font-size: 0.62rem;
    color: #a6b3d7;
    font-weight: 700;
}

.chart-axis {
    width: 22px;
    display: grid;
    gap: 22px;
    color: #9aa9d0;
    font-size: 0.68rem;
    font-weight: 700;
    margin-bottom: 2px;
}

.quick-card {
    margin-top: 0;
}

.quick-grid {
    display: grid;
    gap: 7px;
}

.inline-form {
    display: flex;
    gap: 7px;
}

.inline-form.compact input {
    padding: 9px 10px;
}

.field {
    display: grid;
    gap: 6px;
    margin-bottom: 11px;
}

.field span {
    color: #2e56b3;
    font-size: 0.82rem;
    font-weight: 700;
}

.field input,
.inline-form input,
.search-input {
    width: 100%;
    border: 1px solid #d8dfef;
    border-radius: 10px;
    background: #fff;
    color: #2a4fa9;
    padding: 11px 12px;
    outline: none;
}

.field input:focus,
.inline-form input:focus,
.search-input:focus {
    border-color: #8ca4e7;
    box-shadow: 0 0 0 3px rgba(69, 106, 205, 0.1);
}

.icon-btn {
    width: 38px;
    min-width: 38px;
    border-radius: 9px;
    background: var(--primary);
    color: #fff;
    font-size: 1.2rem;
    line-height: 1;
}

.primary-btn,
.secondary-btn,
.ghost-btn,
.danger-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    border-radius: 999px;
    padding: 13px 14px;
    font-weight: 700;
}

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

.secondary-btn,
.ghost-btn {
    border: 1px solid #c7d4f0;
    color: #3058b3;
    background: #fff;
}

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

.full-width {
    width: 100%;
}

.wallet-layout {
    margin-top: 2px;
}

.wallet-header {
    color: #2f57b7;
    font-size: 0.94rem;
    font-weight: 700;
    padding-bottom: 11px;
    border-bottom: 1px solid #edf1fa;
}

.wallet-header.split {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.link-cta {
    color: #456bc0;
    font-size: 0.86rem;
    font-weight: 700;
}

.asset-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    border-radius: 10px;
    padding: 10px 2px;
    color: #2b4da6;
}

.asset-left,
.asset-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.asset-left strong {
    font-size: 0.98rem;
    letter-spacing: 0;
    font-weight: 700;
    color: #2549a7;
}

.asset-right strong {
    font-size: 1.01rem;
    letter-spacing: 0;
    font-weight: 700;
    color: #2e54af;
}

.asset-right small {
    color: #6178b5;
    font-size: 0.8rem;
    font-weight: 700;
}

.asset-right span {
    color: #7b90c3;
    font-size: 1rem;
    font-weight: 700;
}

.asset-icon {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
}

.icon-focus {
    background: radial-gradient(circle at 34% 30%, #ffd18b 0%, #f5b14a 32%, #e9802a 72%, #c95e1e 100%);
}

.icon-atom {
    background: radial-gradient(circle at 32% 30%, #4d4f70 0%, #1d243e 70%);
}

.icon-astro {
    background: radial-gradient(circle at 35% 32%, #7cd7ff 0%, #2d68f0 70%);
}

.icon-goal {
    background: radial-gradient(circle at 34% 30%, #ffd18b 0%, #f3a83b 40%, #cf6f24 100%);
}

.vesting-row {
    padding-bottom: 3px;
}

.vesting-meta {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    color: #95a7d0;
    font-size: 0.74rem;
    margin: 2px 0 4px 2px;
}

.vesting-meta p {
    color: #5b76b6;
    font-size: 0.9rem;
    font-weight: 700;
    margin: 0;
}

.vesting-meta small {
    color: #748ac0;
}

.stake-wrap {
    margin-top: 4px;
}

.section-title {
    color: #2f57b7;
    font-size: 1.62rem;
    font-weight: 700;
    margin: 14px 0 10px;
}

.reward-card {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.reward-icon {
    width: 40px;
    height: 30px;
    border-radius: 4px;
    border: 3px solid var(--primary-strong);
    position: relative;
}

.reward-icon::before {
    content: "";
    position: absolute;
    width: 14px;
    height: 10px;
    border: 3px solid var(--primary-strong);
    border-radius: 2px;
    right: -7px;
    top: 6px;
    background: #fff;
}

.reward-title {
    color: #2b50ad;
    font-size: 1.02rem;
    font-weight: 700;
}

.reward-card small {
    color: #6d83bc;
    font-size: 0.8rem;
    font-weight: 600;
}

.search-shell {
    position: relative;
    margin-bottom: 10px;
}

.search-icon {
    position: absolute;
    left: 13px;
    top: 50%;
    width: 14px;
    height: 14px;
    transform: translateY(-50%);
    border: 2px solid #4163bb;
    border-radius: 50%;
}

.search-icon::after {
    content: "";
    position: absolute;
    width: 7px;
    height: 2px;
    background: #4163bb;
    right: -4px;
    bottom: -3px;
    transform: rotate(45deg);
    border-radius: 2px;
}

.search-shell .search-input {
    padding-left: 36px;
}

.sort-row {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    margin-bottom: 12px;
}

.sort-row p {
    color: #5d77b5;
    font-size: 0.82rem;
    font-weight: 600;
}

.sort-icon {
    width: 11px;
    height: 10px;
    position: relative;
}

.sort-icon::before,
.sort-icon::after {
    content: "";
    position: absolute;
    left: 0;
    background: #8aa0d0;
    border-radius: 1px;
}

.sort-icon::before {
    top: 1px;
    width: 11px;
    height: 2px;
}

.sort-icon::after {
    top: 5px;
    width: 7px;
    height: 2px;
}

.validator-card {
    margin-bottom: 10px;
}

.validator-title {
    display: flex;
    align-items: center;
    gap: 8px;
}

.validator-title p {
    font-size: 1rem;
    font-weight: 700;
    color: #2b4fa9;
}

.validator-icon {
    width: 18px;
    height: 18px;
    border-radius: 50%;
}

.validator-icon.orbit {
    background: radial-gradient(circle at 35% 30%, #8ab6ff 0%, #2d6ce8 100%);
}

.validator-icon.smart {
    background: radial-gradient(circle at 35% 30%, #9fd6ff 0%, #4ea8cc 100%);
}

.validator-icon.ku {
    background: radial-gradient(circle at 35% 30%, #73e7b8 0%, #33b67d 100%);
}

.validator-metrics {
    margin-top: 10px;
    display: grid;
    gap: 7px;
}

.validator-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.validator-row span {
    color: #4e67ac;
    font-size: 0.84rem;
    font-weight: 700;
}

.validator-row strong {
    color: #6078b5;
    font-size: 0.84rem;
    font-weight: 700;
}

.pill {
    border-radius: 999px;
    border: 1px solid #d9e3fb;
    background: #eff4ff;
    color: #5570b2;
    font-size: 0.74rem;
    font-weight: 700;
    padding: 5px 10px;
}

.action-pill {
    min-width: 40px;
}

.resource-row,
.mini-row {
    width: 100%;
    border: 1px solid #e6ebf8;
    border-radius: 10px;
    background: #f9fbff;
    color: #2d51ab;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    text-align: left;
    padding: 10px 11px;
}

.mini-row small,
.resource-row small,
.detail-row span,
.progress-meta small,
.empty-state,
.intro-copy,
.auth-switch,
.back-link,
.top-link {
    color: var(--text-soft);
}

.mini-row.is-complete span {
    text-decoration: line-through;
}

.empty-state {
    border: 1px dashed #d6e0f6;
    border-radius: 10px;
    padding: 13px 12px;
    text-align: center;
    font-size: 0.9rem;
}

.detail-card {
    display: grid;
    gap: 2px;
    padding: 14px;
}

.detail-row {
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
}

.detail-row:last-child {
    border-bottom: 0;
}

.progress-block {
    margin-top: 10px;
}

.progress-rail {
    width: 100%;
    height: 10px;
    border-radius: 999px;
    background: #e9eefb;
    overflow: hidden;
}

.progress-rail span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #4a85f0 0%, #2e6de9 100%);
}

.progress-meta {
    margin-top: 6px;
}

.commit-metrics {
    margin-top: 10px;
}

.commit-metrics div {
    flex: 1;
    border: 1px solid #e5ebf8;
    border-radius: 10px;
    background: #f9fbff;
    padding: 9px;
}

.commit-metrics span {
    color: var(--text-soft);
    font-size: 0.74rem;
}

.commit-metrics strong {
    display: block;
    margin-top: 4px;
    color: #3157b4;
}

.entry-page,
.auth-page {
    padding-top: 2px;
}

.auth-card,
.form-card {
    padding: 14px;
}

.auth-title,
.settings-label,
.danger-title {
    color: #2f56b5;
    font-size: 1rem;
    font-weight: 700;
}

.setup-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 2px 0 6px;
    color: #2e56b3;
    font-size: 0.84rem;
    font-weight: 700;
}

.copy-pill {
    border: 1.4px solid #9cb2e6;
    border-radius: 999px;
    background: #f7f9ff;
    color: #4d67ad;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 4px 10px;
    line-height: 1;
}

.setup-box {
    border: 1px solid #d8dfef;
    border-radius: 10px;
    background: #fff;
    color: #5e76b3;
    font-size: 0.77rem;
    font-weight: 600;
    line-height: 1.35;
    padding: 10px 12px;
}

.warn-note {
    margin-top: 10px;
    border-radius: 8px;
    border: 1px solid #f2dfba;
    background: #fff7ea;
    color: #c39133;
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1.35;
    padding: 9px 10px;
}

.check-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 10px 0 4px;
}

.check-row input {
    width: 15px;
    height: 15px;
    accent-color: #4a75df;
}

.check-row span {
    color: #7b8ebd;
    font-size: 0.84rem;
    font-weight: 600;
}

.settings-actions {
    margin: 10px 0 2px;
}

.settings-actions .secondary-btn {
    padding: 10px 12px;
}

.settings-value {
    margin-top: 2px;
    color: #6e83bc;
    font-size: 0.9rem;
}

.danger-copy {
    margin-top: 2px;
    color: #8394bf;
    font-size: 0.84rem;
}

.mini-grid {
    margin-top: 10px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.mini-box {
    border: 1px solid #e6ebf8;
    border-radius: 10px;
    background: #f8faff;
    padding: 9px;
}

.mini-box span {
    display: block;
    color: #8093c0;
    font-size: 0.72rem;
}

.mini-box strong {
    display: block;
    margin-top: 3px;
    color: #2f55b1;
    font-size: 0.96rem;
}

.auth-actions.compact {
    gap: 8px;
}

.auth-nav {
    margin-bottom: 8px;
}

.back-link {
    display: inline-flex;
    width: 30px;
    height: 30px;
    border-radius: 999px;
    align-items: center;
    justify-content: center;
    color: #3f60b6;
    font-size: 1.2rem;
    font-weight: 700;
}

.auth-form,
.stacked-form {
    margin-top: 10px;
}

.auth-switch {
    margin: 10px 2px 0;
    font-size: 0.86rem;
}

.auth-switch a {
    color: #345bb7;
    font-weight: 700;
}

.danger-card {
    margin-top: 12px;
}

.settings-page .page-title {
    margin-bottom: 10px;
}

.bottom-nav {
    position: fixed;
    left: 50%;
    bottom: 0;
    transform: translateX(-50%);
    width: min(100%, 398px);
    z-index: 90;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    border-top: 1px solid #e3e8f5;
    background: #fff;
    padding: 6px 10px calc(6px + env(safe-area-inset-bottom));
}

.nav-item {
    display: grid;
    justify-items: center;
    gap: 3px;
    color: #c4cde3;
    font-size: 0.5rem;
    font-weight: 700;
    letter-spacing: 0.03em;
}

.nav-item.active {
    color: #2f58b7;
}

.nav-icon {
    width: 16px;
    height: 14px;
    display: inline-flex;
    position: relative;
}

.nav-icon::before,
.nav-icon::after {
    content: "";
    position: absolute;
}

.nav-wallet::before {
    left: 1px;
    right: 1px;
    top: 3px;
    bottom: 2px;
    border: 1.6px solid currentColor;
    border-radius: 2px;
}

.nav-wallet::after {
    width: 4px;
    height: 4px;
    border: 1.6px solid currentColor;
    border-radius: 50%;
    right: 2px;
    top: 5px;
}

.nav-stake::before {
    left: 7px;
    top: 1px;
    width: 2px;
    height: 12px;
    background: currentColor;
}

.nav-stake::after {
    left: 4px;
    top: 1px;
    width: 8px;
    height: 8px;
    border-left: 2px solid currentColor;
    border-top: 2px solid currentColor;
    transform: rotate(45deg);
}

.nav-more::before,
.nav-more::after {
    left: 2px;
    right: 2px;
    height: 2px;
    background: currentColor;
    border-radius: 2px;
}

.nav-more::before {
    top: 3px;
}

.nav-more::after {
    top: 9px;
}

@media (min-width: 768px) {
    .screen {
        padding-top: 20px;
    }

    .page-title,
    h1 {
        font-size: 1.72rem;
    }
}
