:root {
    --bg: #080a08;
    --card: #191d18;
    --line: #2a3029;
    --text: #f2f4ef;
    --muted: #858c82;
    --lime: #b6d52c;
    --red: #ff4f5e;
    --green: #76d56a;
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    background: var(--bg);
}

body {
    margin: 0;
    min-height: 100vh;
    background: radial-gradient(
        circle at 50% -5%,
        #303728 0,
        #151913 25%,
        #080a08 58%
    );
    color: var(--text);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    -webkit-font-smoothing: antialiased;
}

main {
    width: 100%;
    max-width: 720px;
    margin: auto;
    padding: 18px 14px calc(92px + env(safe-area-inset-bottom));
}

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

/* ================================
   HEADER
   ================================ */

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 3px 3px 22px;
}

.brand {
    display: block;
}

header small,
label {
    color: var(--lime);
    font-weight: 800;
    font-size: 11px;
    letter-spacing: .5px;
}

h1 {
    margin: 1px 0;
    font-size: 28px;
    line-height: 1.05;
}

.plus {
    display: grid;
    place-items: center;
    width: 50px;
    height: 50px;
    border: 1px solid var(--line);
    border-radius: 15px;
    color: var(--lime);
    font-size: 27px;
    background: #111510;
}

/* ================================
   SUMMARY
   ================================ */

.summary {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.summary > div,
.card {
    background: linear-gradient(145deg, #1a1f19, #141713);
    border: 1px solid #252a24;
    border-radius: 20px;
    padding: 17px;
}

.summary b {
    display: block;
    font-size: 22px;
    margin-top: 7px;
}

/* ================================
   TITLES
   ================================ */

.title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 23px 4px 10px;
}

.title h2 {
    margin: 0;
    font-size: 20px;
}

.title small,
.row small,
.history small,
.muted {
    color: var(--muted);
    display: block;
    font-size: 11px;
    margin-top: 3px;
}

/* ================================
   ACCOUNT LIST
   ================================ */

.account-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.row {
    display: flex;
    align-items: center;
    gap: 11px;
    min-height: 68px;
    background: linear-gradient(145deg, #181c18, #121512);
    border: 1px solid var(--line);
    border-radius: 17px;
    padding: 12px 11px;
    transition: transform .08s ease;
}

.row:active {
    transform: scale(.985);
}

.status-dot {
    width: 13px;
    height: 13px;
    border-radius: 50%;
    flex: none;
}

.green {
    background: var(--green);
    box-shadow: 0 0 10px #76d56a88;
}

.red {
    background: var(--red);
    box-shadow: 0 0 10px #ff4f5e88;
}

.person {
    min-width: 0;
    flex: 1;
}

.person b {
    display: block;
    font-size: 15px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.balances {
    text-align: right;
    min-width: 120px;
}

.balances strong {
    display: block;
    color: var(--lime);
    font-size: 15px;
    line-height: 1.1;
}

.balances small {
    white-space: nowrap;
}

.chevron {
    color: #a4aa9f;
    font-size: 23px;
    line-height: 1;
}

/* ================================
   CARDS / ACCOUNT DETAILS
   ================================ */

.back {
    display: inline-block;
    color: var(--muted);
    font-size: 14px;
    margin: 0 0 12px;
    padding: 5px 0;
}

.card {
    margin-bottom: 12px;
}

.card h2 {
    margin: 0;
    font-size: 20px;
}

.cardhead {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.edit {
    color: var(--lime);
    font-size: 13px;
    font-weight: 800;
    padding: 7px 0;
}

.profile-card .contact-line {
    margin-top: 17px;
}

.contact-line label {
    display: block;
}

.contact-line a {
    display: block;
    margin-top: 5px;
    font-size: 15px;
    word-break: break-word;
}

/* ================================
   STATUS PILLS
   ================================ */

.status-pill {
    font-size: 11px;
    font-weight: 800;
    padding: 5px 9px;
    border-radius: 999px;
}

.status-pill.available {
    color: #bff4a9;
    background: #18311a;
    border: 1px solid #2f6033;
}

.status-pill.exhausted {
    color: #ff9ca4;
    background: #35181c;
    border: 1px solid #67252c;
}

/* ================================
   LIMITS
   ================================ */

.limit {
    padding: 18px 0 22px;
    border-bottom: 1px solid var(--line);
    margin-bottom: 20px;
}

.limit:last-child {
    border: 0;
    margin-bottom: 0;
    padding-bottom: 2px;
}

.limit > div {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.limit > div small {
    color: var(--muted);
    font-size: 11px;
}

.limit > b {
    display: block;
    font-size: 22px;
    margin: 12px 0;
}

.limit em {
    font-style: normal;
    color: var(--muted);
    font-size: 13px;
    font-weight: 500;
}

.limit p {
    color: var(--muted);
    font-size: 12px;
    margin: 8px 0 0;
}

progress {
    width: 100%;
    height: 10px;
    appearance: none;
    border: 0;
    border-radius: 99px;
    overflow: hidden;
    background: #30352f;
}

progress::-webkit-progress-bar {
    background: #30352f;
    border-radius: 99px;
}

progress::-webkit-progress-value {
    background: var(--lime);
    border-radius: 99px;
}

progress::-moz-progress-bar {
    background: var(--lime);
    border-radius: 99px;
}

/* ================================
   FORMS
   ================================ */

form label {
    display: block;
    margin-top: 17px;
}

input,
select {
    width: 100%;
    min-height: 50px;
    margin-top: 7px;
    padding: 12px 13px;
    border-radius: 13px;
    border: 1px solid var(--line);
    background: #0e110e;
    color: var(--text);
    font: inherit;
    font-size: 16px;
    outline: none;
}

input:focus,
select:focus {
    border-color: #53651f;
    box-shadow: 0 0 0 2px #b6d52c18;
}

form .button {
    margin-top: 18px;
}

.two {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

/* ================================
   BUTTON
   ================================ */

.button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 52px;
    border: 0;
    border-radius: 15px;
    background: var(--lime);
    color: #11150e;
    font-weight: 850;
    text-align: center;
    padding: 14px;
    font: inherit;
    box-shadow: 0 4px 18px #0004;
}

.button:active {
    transform: scale(.99);
}

/* ================================
   FLASH MESSAGE
   ================================ */

.flash {
    background: #3a3016;
    border: 1px solid #675526;
    padding: 11px 12px;
    border-radius: 12px;
    margin-bottom: 12px;
    color: #f0d67a;
    font-size: 13px;
}

/* ================================
   PURCHASE QUICK AMOUNTS
   ================================ */

.quick-amounts {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin: 14px 0 18px;
}

.quick-amount {
    flex: 1;
    min-width: 75px;
    padding: 12px 8px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,.15);
    background: #151915;
    color: #f2f2f2;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition:
        background .15s ease,
        border-color .15s ease,
        color .15s ease,
        transform .1s ease;
}

.quick-amount:hover {
    border-color: var(--lime);
}

.quick-amount:active {
    transform: scale(.97);
}

.quick-amount.selected {
    background: var(--lime);
    color: #111;
    border-color: var(--lime);
    font-weight: 700;
}

/* ================================
   PURCHASE LIMIT INFORMATION
   ================================ */

.limit-info {
    margin: 4px 0 18px;
    padding: 13px 15px;
    border-radius: 12px;
    background: rgba(255,255,255,.035);
    border: 1px solid rgba(255,255,255,.08);
    color: #aaa;
    font-size: 14px;
    line-height: 1.5;
}

.limit-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
}

.limit-row strong {
    color: var(--lime);
    font-weight: 700;
}

/* ================================
   ACCOUNT SEARCH
   ================================ */

.account-search {
    margin: 0 0 12px;
}

.account-search input {
    margin-top: 0;
    min-height: 48px;
    border-radius: 14px;
    background: #0e110e;
}

/* ================================
   ACCOUNT STATUS TABS
   ================================ */

.account-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 12px;
}

.account-tab {
    min-height: 46px;
    border: 1px solid var(--line);
    border-radius: 13px;
    background: #111510;
    color: var(--muted);
    font: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all .15s ease;
}

.account-tab span {
    margin-left: 4px;
    opacity: .7;
}

.account-tab.active {
    background: #1d2517;
    border-color: #61751f;
    color: var(--lime);
}

.account-tab:active {
    transform: scale(.98);
}

/* ================================
   PURCHASE HISTORY
   ================================ */

.history {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 13px 0;
    border-bottom: 1px solid var(--line);
}

.history:last-child {
    border-bottom: 0;
}

.empty {
    text-align: center;
    padding: 40px 15px;
    color: var(--muted);
    background: #111410;
    border: 1px dashed var(--line);
    border-radius: 16px;
}

/* ================================
   EDIT PURCHASE
   ================================ */

.purchase-edit-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 16px 0 4px;
}

.purchase-edit-info small {
    color: var(--muted);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .5px;
    margin-top: 12px;
}

.purchase-edit-info b {
    font-size: 16px;
}

.purchase-edit-info small:first-child {
    margin-top: 0;
}

/* ================================
   BOTTOM NAVIGATION
   ================================ */

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: min(720px, 100%);
    background: #0c0f0ced;
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border-top: 1px solid var(--line);
    display: flex;
    justify-content: space-around;
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
    z-index: 10;
}

.navitem {
    min-width: 68px;
    text-align: center;
    font-size: 21px;
    color: #8d9489;
    padding: 2px 6px;
}

.navitem small {
    display: block;
    font-size: 10px;
    margin-top: 2px;
    color: inherit;
}

.navitem:active {
    color: var(--lime);
}

/* ================================
   LOGIN / AUTH
   ================================ */

.auth {
    min-height: 86vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.authbox {
    width: min(430px, 100%);
    background: linear-gradient(145deg, #191d18, #111410);
    border: 1px solid #252a24;
    border-radius: 24px;
    padding: 26px;
}

.authbox h1 {
    margin: 5px 0 8px;
}

.authbox .button {
    margin-top: 14px;
}

.muted {
    color: var(--muted);
    font-size: 13px;
}

/* ================================
   RESPONSIVE
   ================================ */

@media (min-width: 700px) {
    main {
        padding-left: 20px;
        padding-right: 20px;
    }

    .row {
        min-height: 72px;
    }
}

@media (max-width: 480px) {
    main {
        padding-left: 11px;
        padding-right: 11px;
        padding-top: 13px;
    }

    header {
        margin-bottom: 18px;
    }

    .summary > div {
        padding: 15px;
    }

    .summary b {
        font-size: 21px;
    }

    .two {
        grid-template-columns: 1fr;
    }

    .row {
        padding: 11px 10px;
        min-height: 66px;
    }

    .balances {
        min-width: 103px;
    }

    .balances strong {
        font-size: 14px;
    }

    .balances small {
        font-size: 10px;
    }

    .quick-amounts {
        gap: 5px;
    }

    .quick-amount {
        font-size: 11px;
        min-width: 65px;
    }

    .account-tabs {
        gap: 7px;
    }

    .account-tab {
        min-height: 44px;
        font-size: 12px;
    }
}

@media (max-width: 360px) {
    .person b {
        font-size: 14px;
    }

    .person small {
        font-size: 10px;
    }

    .balances {
        min-width: 92px;
    }

    .balances strong {
        font-size: 13px;
    }

    .chevron {
        font-size: 20px;
    }

    .navitem {
        min-width: 60px;
    }
}

/* ============================================================
   HISTORY ACTIONS
   ============================================================ */

.history-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 7px;
}

.history-right > strong {
    color: var(--text);
    font-size: 16px;
    white-space: nowrap;
}

.history-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.history-edit,
.history-delete {
    border: 0;
    background: transparent;
    font: inherit;
    font-size: 11px;
    font-weight: 700;
    padding: 4px 7px;
    border-radius: 7px;
    cursor: pointer;
}

.history-edit {
    color: var(--lime);
}

.history-delete {
    color: var(--red);
}

.history-edit:hover {
    background: #b6d52c18;
}

.history-delete:hover {
    background: #ff4f5e18;
}

.history-delete:active,
.history-edit:active {
    transform: scale(.95);
}

.history-actions form {
    margin: 0;
}

@media(max-width:480px) {

    .history-right > strong {
        font-size: 15px;
    }

    .history-edit,
    .history-delete {
        font-size: 10px;
        padding: 4px 6px;
    }

}