html, body {
    min-height: 100%;
    font-family: 'Instrument Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-style: normal;
    padding: 0;
    margin: 0;
    color: #223231;
    background: #f7f2ea;
}

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

button, input {
    font: inherit;
}

input[type="checkbox"] {
    accent-color: #7dcab0;
}

button {
    cursor: pointer;
}

.app-shell {
    min-height: 100svh;
    display: grid;
    justify-items: center;
    background:
        linear-gradient(135deg, rgba(181, 229, 213, .64), transparent 38%),
        linear-gradient(315deg, rgba(246, 193, 171, .48), transparent 44%),
        #f7f2ea;
}

.mobile-app {
    width: min(100%, 480px);
    min-height: 100svh;
    display: grid;
    grid-template-rows: auto 1fr auto;
    background: rgba(255, 250, 242, .72);
}

.app-header {
    min-height: 74px;
    padding: max(14px, env(safe-area-inset-top)) 18px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 10;
    background: rgba(255, 250, 242, .84);
    border-bottom: 1px solid rgba(49, 67, 66, .08);
    backdrop-filter: blur(18px);
}

.brand-row {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.brand-row strong {
    color: #24302f;
    font-size: 16px;
    line-height: 1.1;
}

.brand-row div > span {
    margin-top: 2px;
    color: #6b807d;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

.brand-mark {
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    border-radius: 14px;
    background: #b5e5d5;
    color: #24302f;
    font-size: 14px;
    font-weight: 800;
    line-height: 1;
    text-align: center;
    padding: 0;
    box-shadow: 0 14px 32px rgba(93, 151, 131, .2);
}

.screen {
    min-width: 0;
    padding: 22px 18px calc(28px + env(safe-area-inset-bottom));
}

.screen.is-hidden,
.icon-button.is-hidden,
.header-button.is-hidden,
.admin-panel.is-hidden,
.debug-panel.is-hidden {
    display: none;
}

.screen--login {
    display: grid;
    align-content: center;
    gap: 26px;
}

.welcome-copy {
    display: grid;
    gap: 10px;
}

.eyebrow {
    margin: 0;
    color: #63807c;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}

h1, h2, p {
    margin: 0;
}

h1 {
    color: #24302f;
    font-size: 54px;
    line-height: .96;
    letter-spacing: 0;
}

h2 {
    color: #24302f;
    font-size: 25px;
    line-height: 1.08;
    letter-spacing: 0;
}

.welcome-copy p:last-child {
    color: #526866;
    font-size: 17px;
    line-height: 1.5;
}

.login-form,
.admin-panel,
.debug-panel {
    display: grid;
    gap: 16px;
    padding: 18px;
    border: 1px solid rgba(49, 67, 66, .1);
    border-radius: 8px;
    background: rgba(255, 255, 255, .72);
    box-shadow: 0 18px 54px rgba(45, 60, 58, .1);
    backdrop-filter: blur(18px);
}

.field {
    display: grid;
    gap: 8px;
    color: #526866;
    font-size: 14px;
    font-weight: 700;
}

.field input {
    width: 100%;
    min-height: 54px;
    padding: 0 15px;
    border: 1px solid rgba(49, 67, 66, .15);
    border-radius: 8px;
    outline: none;
    background: #fffaf2;
    color: #24302f;
    font-size: 17px;
    transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}

.field input:focus {
    border-color: #7dcab0;
    background: #ffffff;
    box-shadow: 0 0 0 4px rgba(181, 229, 213, .48);
}

.check-field {
    display: grid;
    grid-template-columns: 18px minmax(0, 1fr);
    gap: 10px;
    align-items: start;
    color: #526866;
    font-size: 14px;
    line-height: 1.4;
}

.check-field input {
    margin: 2px 0 0;
}

.button {
    min-height: 52px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border: 0;
    border-radius: 8px;
    padding: 0 16px;
    color: #24302f;
    font-weight: 800;
    transition: transform .2s ease, opacity .2s ease, box-shadow .2s ease;
}

.button:hover {
    transform: translateY(-1px);
}

.button:disabled {
    cursor: wait;
    opacity: .58;
}

.button--primary {
    background: #b5e5d5;
    box-shadow: 0 14px 34px rgba(93, 151, 131, .22);
}

.button__icon {
    font-size: 18px;
}

.icon-button {
    width: 42px;
    height: 42px;
    display: inline-grid;
    place-items: center;
    flex: 0 0 auto;
    border: 0;
    border-radius: 50%;
    background: #f1e6d9;
    color: #566b68;
    font-weight: 900;
}

.header-button {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex: 0 0 auto;
    border: 0;
    border-radius: 999px;
    padding: 0 14px;
    background: #f1e6d9;
    color: #566b68;
    font-weight: 800;
}

.header-button i {
    font-size: 18px;
    line-height: 1;
}

.status {
    min-height: 22px;
    color: #687b78;
    font-size: 14px;
    line-height: 1.5;
}

.status[data-type="success"] {
    color: #357962;
}

.status[data-type="error"] {
    color: #b25348;
}

.screen--dashboard {
    display: grid;
    align-content: start;
    gap: 16px;
}

.app-nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.app-nav__link {
    min-height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border-radius: 8px;
    padding: 0 14px;
    background: rgba(255, 255, 255, .68);
    color: #5c716e;
    font-size: 14px;
    font-weight: 800;
    text-decoration: none;
    border: 1px solid rgba(49, 67, 66, .08);
}

.app-nav__link.is-active {
    background: #b5e5d5;
    color: #24302f;
    box-shadow: 0 14px 34px rgba(93, 151, 131, .18);
}

.app-nav__link i {
    font-size: 18px;
    line-height: 1;
}

.screen--migration {
    display: grid;
    align-content: center;
    width: 100%;
    max-width: 460px;
    margin: 0 auto;
}

.guest-hero {
    display: grid;
    gap: 10px;
    padding: 6px 2px 4px;
}

.guest-hero h1 {
    font-size: 38px;
}

.guest-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.guest-meta span {
    min-height: 28px;
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 0 10px;
    background: rgba(255, 255, 255, .7);
    color: #637673;
    font-size: 13px;
    font-weight: 700;
}

.balance-strip {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.balance-item {
    min-height: 132px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 16px;
    border-radius: 8px;
    border: 1px solid rgba(49, 67, 66, .08);
    background: rgba(255, 255, 255, .72);
    box-shadow: 0 16px 42px rgba(45, 60, 58, .09);
}

.balance-item:first-child {
    background: #d9f0e8;
}

.balance-item:last-child {
    background: #f8ded2;
}

.balance-item span,
.progress-block span,
.action-row small {
    color: #5d716e;
    font-size: 13px;
    font-weight: 800;
}

.balance-item strong {
    color: #24302f;
    font-size: 58px;
    line-height: .9;
    letter-spacing: 0;
    font-variant-numeric: tabular-nums;
}

.progress-block {
    display: grid;
    gap: 12px;
    padding: 16px;
    border-radius: 8px;
    background: #fffaf2;
    border: 1px solid rgba(49, 67, 66, .1);
}

.progress-block__top {
    display: flex;
    justify-content: space-between;
    gap: 16px;
}

.progress-block__top strong {
    color: #24302f;
}

.progress-track {
    height: 12px;
    overflow: hidden;
    border-radius: 999px;
    background: #eadfd2;
}

.progress-track span {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: #8bcfba;
    transition: width .28s ease;
}

.actions-list {
    display: grid;
    gap: 10px;
}

.action-row {
    min-height: 78px;
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) 28px;
    align-items: center;
    gap: 12px;
    width: 100%;
    border: 1px solid rgba(49, 67, 66, .1);
    border-radius: 8px;
    padding: 12px;
    background: rgba(255, 255, 255, .78);
    color: #24302f;
    text-align: left;
    box-shadow: 0 14px 38px rgba(45, 60, 58, .08);
}

.action-row:disabled {
    cursor: wait;
    opacity: .62;
}

.action-row__icon {
    width: 44px;
    height: 44px;
    display: inline-grid;
    place-items: center;
    border-radius: 14px;
    background: #f6d2c4;
    color: #24302f;
    font-size: 20px;
    font-weight: 900;
}

.action-row__icon i {
    font-size: 20px;
    line-height: 1;
}

.action-row strong,
.action-row small {
    display: block;
}

.action-row strong {
    margin-bottom: 4px;
    font-size: 16px;
}

.action-row small {
    font-variant-numeric: tabular-nums;
}

.code-expiry {
    margin-top: 4px;
    color: #9b6b4f;
}

.action-row__chevron {
    color: #8aa09d;
    font-weight: 900;
}

.section-heading {
    display: grid;
    gap: 6px;
}

.admin-fields {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 112px;
    gap: 10px;
}

.debug-panel {
    background: rgba(255, 255, 255, .62);
}

.debug-status {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    border-radius: 8px;
    padding: 0 14px;
    background: #fffaf2;
    color: #526866;
    font-size: 14px;
    font-weight: 700;
}

.debug-status__dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #c7c7c7;
    box-shadow: 0 0 0 4px rgba(199, 199, 199, .18);
}

.debug-status__dot[data-state="online"] {
    background: #4caf7d;
    box-shadow: 0 0 0 4px rgba(76, 175, 125, .18);
}

.debug-status__dot[data-state="connecting"] {
    background: #e5b657;
    box-shadow: 0 0 0 4px rgba(229, 182, 87, .18);
}

.debug-status__dot[data-state="offline"],
.debug-status__dot[data-state="error"] {
    background: #d67a72;
    box-shadow: 0 0 0 4px rgba(214, 122, 114, .18);
}

@media (min-width: 560px) {
    .app-shell {
        padding: 24px;
        align-items: center;
    }

    .mobile-app {
        min-height: min(820px, calc(100svh - 48px));
        overflow: hidden;
        border: 1px solid rgba(49, 67, 66, .1);
        border-radius: 28px;
        box-shadow: 0 30px 90px rgba(45, 60, 58, .16);
    }

    .screen {
        overflow: auto;
    }
}

@media (max-width: 380px) {
    h1 {
        font-size: 46px;
    }

    .guest-hero h1 {
        font-size: 32px;
    }

    .balance-item strong {
        font-size: 48px;
    }

    .admin-fields {
        grid-template-columns: 1fr;
    }
}

.migration-shell {
    width: 100%;
    min-height: 100svh;
    padding: 0;
}

.migration-stack {
    display: grid;
    gap: 16px;
}

.migration-title {
    margin-bottom: 10px;
    font-size: 36px;
    line-height: 1;
}

.migration-copy {
    color: #526866;
    line-height: 1.5;
}

.migration-message {
    padding: 12px 14px;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.5;
}

.migration-message--note {
    background: #fff7e7;
    color: #6a5e3e;
}

.migration-message--error {
    background: #fde8e5;
    color: #a34a43;
}

.migration-message--success {
    background: #e3f4ed;
    color: #2f775f;
}

.migration-message ul {
    margin: 0;
    padding-left: 18px;
}

.migration-meta {
    display: grid;
    gap: 6px;
    padding: 14px;
    border-radius: 8px;
    background: #fffaf2;
}

.app-footer {
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
    background: rgba(255, 250, 242, .72);
    border-top: 1px solid rgba(49, 67, 66, .08);
}

.app-footer__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    color: #7a8d8a;
    font-size: 11px;
    font-weight: 500;
    /*text-transform: uppercase;*/
}
