:root {
    --brand: #10b981;
    --brand-dark: #047857;
    --brand-light: #d1fae5;
    --ink: #0f172a;
    --muted: #64748b;
    --surface: rgba(255, 255, 255, 0.86);
    --line: rgba(148, 163, 184, 0.22);
    --shadow: 0 24px 70px -34px rgba(15, 23, 42, 0.5);
    --radius: 28px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    min-height: 100vh;
    margin: 0;
    background:
        radial-gradient(circle at top left, rgba(16, 185, 129, .24), transparent 34rem),
        radial-gradient(circle at bottom right, rgba(14, 165, 233, .14), transparent 38rem),
        linear-gradient(135deg, #e2e8f0 0%, #f8fafc 42%, #e5e7eb 100%);
    color: var(--ink);
    -webkit-tap-highlight-color: transparent;
}

.premium-bg {
    position: fixed;
    inset: 0;
    z-index: -2;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(15, 23, 42, .04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(15, 23, 42, .04) 1px, transparent 1px);
    background-size: 44px 44px;
    mask-image: linear-gradient(to bottom, rgba(0,0,0,.9), rgba(0,0,0,.12));
}

.app-shell {
    width: 100%;
    min-height: 100vh;
    margin: 0 auto;
    background:
        linear-gradient(180deg, rgba(248, 250, 252, .96), rgba(241, 245, 249, .96)),
        #f8fafc;
    position: relative;
    overflow-x: clip;
    box-shadow: 0 0 0 rgba(0,0,0,0);
}

.app-shell::before,
.app-shell::after {
    content: "";
    position: absolute;
    border-radius: 999px;
    pointer-events: none;
    filter: blur(28px);
    opacity: .48;
    z-index: 0;
}
.app-shell::before {
    width: 220px;
    height: 220px;
    right: -84px;
    top: 80px;
    background: rgba(16, 185, 129, .18);
}
.app-shell::after {
    width: 180px;
    height: 180px;
    left: -72px;
    bottom: 120px;
    background: rgba(59, 130, 246, .12);
}
.app-shell > *:not(.app-navigation) { position: relative; z-index: 1; }

.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }
.pb-safe { padding-bottom: max(env(safe-area-inset-bottom), 14px); }
.pt-safe { padding-top: max(env(safe-area-inset-top), 14px); }

.app-topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    background: rgba(255, 255, 255, .78);
    backdrop-filter: blur(24px) saturate(1.2);
    -webkit-backdrop-filter: blur(24px) saturate(1.2);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 14px 42px -32px rgba(15, 23, 42, .55);
}

.app-glass,
.app-shell .bg-white {
    border-color: rgba(226, 232, 240, .88) !important;
}

.app-shell .rounded-\[2\.5rem\],
.app-shell .rounded-\[2rem\] {
    box-shadow: var(--shadow);
}

.app-shell input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
.app-shell select,
.app-shell textarea {
    min-height: 44px;
}
.app-shell input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):focus,
.app-shell select:focus,
.app-shell textarea:focus {
    outline: none;
    box-shadow: 0 0 0 4px rgba(16, 185, 129, .14);
}

.app-shell button,
.app-shell a {
    touch-action: manipulation;
}

.app-shell table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}
.app-shell thead th {
    background: #f8fafc;
    color: #475569;
    font-size: 11px;
    letter-spacing: .08em;
    text-transform: uppercase;
}
.app-shell tbody tr {
    transition: background-color .2s ease, transform .2s ease;
}
.app-shell tbody tr:hover { background: rgba(16, 185, 129, .035); }
.app-shell .overflow-x-auto {
    -webkit-overflow-scrolling: touch;
}

.app-navigation {
    position: fixed;
    left: 50%;
    bottom: 0;
    transform: translateX(-50%);
    width: 100%;
    max-width: 540px;
    z-index: 60;
    background: rgba(255, 255, 255, .86);
    backdrop-filter: blur(24px) saturate(1.25);
    -webkit-backdrop-filter: blur(24px) saturate(1.25);
    border-top: 1px solid rgba(226, 232, 240, .92);
    box-shadow: 0 -18px 44px -30px rgba(15, 23, 42, .65);
}
.nav-list {
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: space-around;
    gap: 2px;
    padding: 0 8px;
}
.nav-item {
    position: relative;
    flex: 1;
    min-width: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    border-radius: 18px;
    color: #94a3b8;
    text-decoration: none;
    transition: transform .18s ease, color .18s ease, background-color .18s ease;
}
.nav-item:active { transform: scale(.94); }
.nav-item:hover { color: #334155; background: rgba(248, 250, 252, .9); }
.nav-item i { font-size: 1.12rem; }
.nav-label {
    font-size: 9px;
    line-height: 1;
    font-weight: 850;
    letter-spacing: .015em;
    white-space: nowrap;
}
.nav-item.is-active {
    color: var(--brand-dark);
    background: linear-gradient(180deg, rgba(236,253,245,.9), rgba(255,255,255,.6));
}
.nav-indicator {
    position: absolute;
    top: 0;
    width: 32px;
    height: 4px;
    border-radius: 0 0 999px 999px;
    background: linear-gradient(90deg, var(--brand-dark), var(--brand));
    box-shadow: 0 8px 20px rgba(16, 185, 129, .35);
}

.login-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1fr;
    background: #020617;
    overflow: hidden;
}
.login-hero {
    display: none;
}
.login-card {
    width: min(100%, 420px);
    margin: auto;
    padding: 24px;
}
.login-panel {
    background: rgba(255, 255, 255, .08);
    border: 1px solid rgba(255, 255, 255, .12);
    box-shadow: 0 30px 90px -40px rgba(0,0,0,.9);
    backdrop-filter: blur(22px);
    -webkit-backdrop-filter: blur(22px);
}

@media (min-width: 640px) {
    .app-shell {
        width: calc(100% - 32px);
        min-height: calc(100vh - 32px);
        margin: 16px auto;
        border: 1px solid rgba(255, 255, 255, .72);
        border-radius: 30px;
        box-shadow: 0 28px 90px -50px rgba(15, 23, 42, .68);
        overflow: hidden;
    }
    .app-shell.is-public { max-width: 1040px; }
    .app-shell.is-authenticated { max-width: 980px; }
    .app-navigation {
        bottom: 18px;
        border: 1px solid rgba(226, 232, 240, .95);
        border-radius: 28px;
        width: min(calc(100% - 72px), 820px);
        max-width: 820px;
    }
    .nav-list { height: 72px; padding: 0 12px; }
}

@media (min-width: 768px) {
    .app-shell .px-5 { padding-left: 2rem !important; padding-right: 2rem !important; }
    .app-shell .px-6 { padding-left: 2rem !important; padding-right: 2rem !important; }
    .app-shell .grid.grid-cols-4 { grid-template-columns: repeat(8, minmax(0, 1fr)) !important; }
    .app-shell .grid.grid-cols-2 { gap: 1rem !important; }
    .app-shell .text-\[9px\] { font-size: 10px !important; }
    .app-shell .text-\[10px\] { font-size: 11px !important; }
}

@media (min-width: 1024px) {
    .app-shell.is-authenticated {
        max-width: 1280px;
        padding-left: 116px;
    }
    .app-shell.is-authenticated .pb-32 { padding-bottom: 2.5rem !important; }
    .app-shell.is-authenticated > .pb-32,
    .app-shell.is-authenticated #main-app-container,
    .app-shell.is-authenticated > .min-h-screen {
        min-height: calc(100vh - 32px);
    }
    .app-navigation {
        top: 32px;
        bottom: 32px;
        left: max(24px, calc(50vw - 640px + 24px));
        transform: none;
        width: 92px;
        max-width: 92px;
        border-radius: 30px;
        border: 1px solid rgba(226, 232, 240, .98);
        box-shadow: 24px 0 70px -52px rgba(15, 23, 42, .75);
    }
    .nav-list {
        height: 100%;
        flex-direction: column;
        justify-content: flex-start;
        padding: 18px 10px;
        gap: 8px;
    }
    .nav-item {
        flex: none;
        width: 100%;
        height: 76px;
        border-radius: 22px;
        gap: 8px;
    }
    .nav-item i { font-size: 1.22rem; }
    .nav-label { font-size: 10px; }
    .nav-indicator { display: none; }
    .nav-brand-mini {
        display: flex !important;
        margin-bottom: 10px;
    }
    .app-topbar {
        top: 0;
        border-radius: 0;
    }
    .login-shell {
        grid-template-columns: 1.1fr .9fr;
    }
    .login-hero {
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        min-height: calc(100vh - 32px);
        padding: 54px;
        background:
            radial-gradient(circle at top right, rgba(16, 185, 129, .28), transparent 32rem),
            linear-gradient(135deg, #0f172a 0%, #020617 100%);
        color: #fff;
    }
    .login-card {
        padding: 40px;
    }
}

@media (min-width: 1280px) {
    .app-shell.is-authenticated .px-5 { padding-left: 2.5rem !important; padding-right: 2.5rem !important; }
    .app-shell.is-authenticated .grid.grid-cols-4 { gap: 1rem !important; }
}

@media (max-width: 420px) {
    .app-shell .grid.grid-cols-2 { grid-template-columns: 1fr !important; }
    .app-shell .rounded-\[2\.5rem\] { border-radius: 1.75rem !important; }
    .app-shell .rounded-\[2rem\] { border-radius: 1.5rem !important; }
}

@media print {
    body { background: #fff !important; }
    .premium-bg, .app-navigation, .app-topbar { display: none !important; }
    .app-shell { width: 100%; margin: 0; box-shadow: none; border: 0; border-radius: 0; padding-left: 0 !important; }
}
