:root {
    --myki-blue: #087df1;
    --myki-green: #17a957;
    --myki-turquoise: #18a6b8;
    --myki-ink: #172033;
    --myki-muted: #68778c;
    --myki-line: #dfe5ec;
    --myki-surface: #ffffff;
    --myki-canvas: #f3f5f8;
    --myki-header-height: 72px;
    --myki-tab-height: 70px;
    --myki-safe-top: env(safe-area-inset-top, 0px);
    --myki-safe-bottom: env(safe-area-inset-bottom, 0px);
}

html {
    min-height: 100%;
    background: var(--myki-canvas);
    scroll-padding-top: calc(var(--myki-header-height) + var(--myki-safe-top) + 12px);
}

body.app-page {
    min-height: 100%;
    height: auto;
    max-width: none;
    padding: 0;
    margin: 0;
    overflow-x: hidden;
    background: var(--myki-canvas);
    color: var(--myki-ink);
}

.app-page .app-header-fixed {
    height: calc(var(--myki-header-height) + var(--myki-safe-top));
    padding: var(--myki-safe-top) 16px 10px;
    align-items: flex-end;
    margin: 0;
    border-bottom: 1px solid rgba(23, 32, 51, .1);
    background: rgba(255, 255, 255, .96);
    box-shadow: 0 5px 20px rgba(23, 32, 51, .06);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}

.app-page .header-content {
    min-height: 42px;
    gap: 12px;
}

.app-page .header-logo img {
    width: clamp(142px, 38vw, 190px) !important;
}

.app-page .header-user {
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    padding: 7px 11px;
    font-size: .76rem;
    line-height: 1;
}

.app-page .app-content {
    width: min(100%, 760px);
    max-width: 760px;
    min-height: 100dvh;
    margin: 0 auto;
    padding: calc(var(--myki-header-height) + var(--myki-safe-top) + 14px) 12px calc(var(--myki-tab-height) + var(--myki-safe-bottom) + 28px);
    overflow: visible hidden;
    position: relative;
    z-index: 1;
}

.app-page.page-login .app-content,
.app-page.page-logout .app-content {
    padding: max(20px, var(--myki-safe-top)) 12px max(20px, var(--myki-safe-bottom)) !important;
}

.app-page .bottom-spacer {
    display: none !important;
}

.app-page .card {
    border: 1px solid rgba(23, 32, 51, .08);
    border-radius: 18px;
    padding: 20px;
    box-shadow: 0 8px 28px rgba(23, 32, 51, .08);
}

.app-page .card h1,
.app-page .card h2,
.app-page .card h3,
.app-page .card h4,
.app-page .card h5,
.app-page .card h6 {
    color: var(--myki-ink) !important;
}

.app-page input,
.app-page select,
.app-page textarea,
.app-page button,
.app-page .btn-primary,
.app-page .btn-secondary {
    min-height: 44px;
}

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

.app-page .tab-bar {
    position: fixed;
    inset: auto 0 0;
    height: calc(var(--myki-tab-height) + var(--myki-safe-bottom));
    padding: 7px max(8px, env(safe-area-inset-right, 0px)) var(--myki-safe-bottom) max(8px, env(safe-area-inset-left, 0px));
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    align-items: start;
    gap: 2px;
    border-top: 1px solid rgba(23, 32, 51, .12);
    background: rgba(255, 255, 255, .98);
    box-shadow: 0 -8px 26px rgba(23, 32, 51, .09);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    z-index: 5000;
}

.app-page .tab-bar.tab-bar-four {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.app-page .tab-item {
    min-width: 0;
    min-height: 55px;
    padding: 5px 2px 3px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 2px;
    border-radius: 12px;
    color: #7a8494;
    text-decoration: none;
    line-height: 1;
}

.app-page .tab-item i {
    margin: 0;
    font-size: 1.35rem;
    line-height: 26px;
}

.app-page .tab-item span {
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: .67rem;
    font-weight: 700;
    line-height: 1.15;
}

.app-page .tab-item.active {
    color: var(--myki-blue);
    background: #eef6ff;
}

.app-page .quickstart-grid {
    gap: 12px;
}

.app-page .quickstart-grid .grid-item,
.app-page .stat-item {
    min-height: 104px;
    border: 1px solid var(--myki-line);
    border-radius: 15px;
    background: #fff;
    box-shadow: none;
}

.app-page .quickstart-grid .grid-item span {
    white-space: nowrap;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (min-width: 850px) {
    .app-page .app-content {
        width: min(100%, 1040px);
        max-width: 1040px;
        padding-left: 20px;
        padding-right: 20px;
    }

    .app-page .tab-bar {
        left: 50%;
        right: auto;
        width: min(760px, calc(100% - 32px));
        transform: translateX(-50%);
        border: 1px solid rgba(23, 32, 51, .12);
        border-bottom: 0;
        border-radius: 18px 18px 0 0;
    }
}

@media (max-width: 430px) {
    :root {
        --myki-header-height: 66px;
        --myki-tab-height: 66px;
    }

    .app-page .app-content {
        padding-left: 10px;
        padding-right: 10px;
    }

    .app-page .card {
        padding: 16px;
        border-radius: 16px;
    }

    .app-page .header-user {
        padding: 6px 8px;
        font-size: .7rem;
    }

    .app-page .tab-item {
        min-height: 52px;
    }
}

@media (prefers-color-scheme: dark) {
    html,
    body.app-page {
        background: #0f1115;
    }

    .app-page .app-content {
        color: #eef2f7;
    }

    .app-page .card,
    .app-page .quickstart-grid .grid-item,
    .app-page .stat-item {
        background: #ffffff;
        color: var(--myki-ink);
    }

    .app-page .re-styl {
        background: #ffffff;
    }
}

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