@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700;800&display=swap');

* { box-sizing: border-box; }

:root {
    --app-bg: #eef2f7;
    --app-ink: #111827;
    --app-muted: #6b7280;
    --app-border: rgba(255, 255, 255, 0.72);
    --app-panel: rgba(255, 255, 255, 0.82);
    --app-panel-solid: #ffffff;
    --app-accent: #ff5f45;
    --app-accent-soft: #fff1e8;
    --app-mint: #34d399;
    --app-sky: #dff6ff;
}

html, body {
    height: 100%;
}

body {
    margin: 0;
    font-family: "Poppins", "Avenir Next", "SF Pro Text", "Segoe UI", sans-serif;
    background: linear-gradient(180deg, #f2f4f8 0%, #eef4f8 54%, #f8fafc 100%);
    color: var(--app-ink);
}

button,
input,
select,
textarea {
    font-family: inherit;
}

.app-body {
    position: relative;
    isolation: isolate;
}

.app-grid {
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image:
        radial-gradient(rgba(255, 95, 69, 0.08) 1px, transparent 1px),
        linear-gradient(transparent 97%, rgba(255,255,255,0.28) 100%);
    background-size: 18px 18px, 100% 100%;
    opacity: 0.35;
}

.app-bg-orb {
    position: fixed;
    border-radius: 999px;
    filter: blur(70px);
    pointer-events: none;
    opacity: 0.7;
}

.app-bg-orb-a {
    top: -80px;
    left: -80px;
    width: 280px;
    height: 280px;
    background: rgba(255, 95, 69, 0.16);
}

.app-bg-orb-b {
    right: -70px;
    top: 18%;
    width: 240px;
    height: 240px;
    background: rgba(52, 211, 153, 0.14);
}

.app-shell {
    gap: 0.25rem;
}

.app-main-shell {
    min-width: 0;
}

.app-topbar {
    background: linear-gradient(180deg, rgba(255,255,255,0.78), rgba(255,255,255,0.64));
    backdrop-filter: blur(18px);
}

#app > section {
    animation: pageEnter 240ms ease-out;
}

.desktop-sidebar {
    position: relative;
}

.desktop-sidebar::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at top right, rgba(52, 211, 153, 0.1), transparent 26%),
        radial-gradient(circle at bottom left, rgba(255, 95, 69, 0.08), transparent 24%);
    pointer-events: none;
}

.sidebar-brand,
.sidebar-scroll,
.desktop-sidebar > div:last-child {
    position: relative;
    z-index: 1;
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3rem;
    height: 3rem;
    border-radius: 1rem;
    background: linear-gradient(135deg, var(--app-accent), #ff8a3d);
    color: white;
    font-weight: 900;
    letter-spacing: 0.02em;
    box-shadow: 0 14px 30px rgba(255, 95, 69, 0.25);
}

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    border-radius: 999px;
    padding: 0.45rem 0.85rem;
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    border: 1px solid transparent;
}

.status-pill::before {
    content: "";
    width: 0.45rem;
    height: 0.45rem;
    border-radius: 999px;
    background: currentColor;
    opacity: 0.92;
}

.status-pill-pending_review,
.status-pill-processing_done {
    background: #fff7ed;
    color: #c2410c;
    border-color: #fed7aa;
}

.status-pill-approved,
.status-pill-packed,
.status-pill-active,
.status-pill-custom,
.status-pill-success {
    background: #ecfdf3;
    color: #15803d;
    border-color: #bbf7d0;
}

.status-pill-failed,
.status-pill-inactive,
.status-pill-disabled,
.status-pill-error {
    background: #fef2f2;
    color: #dc2626;
    border-color: #fecaca;
}

.status-pill-unpacked {
    background: #eff6ff;
    color: #2563eb;
    border-color: #bfdbfe;
}

.status-pill-default {
    background: #f4f4f5;
    color: #52525b;
    border-color: #e4e4e7;
}

.status-pill-system {
    background: #f4f4f5;
    color: #3f3f46;
    border-color: #e4e4e7;
}

button.rounded-xl,
button.rounded-2xl,
a.rounded-xl,
a.rounded-2xl,
a.rounded-\[1\.1rem\],
a.rounded-\[1\.3rem\] {
    white-space: nowrap;
    transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease, background 180ms ease, color 180ms ease;
}

button.rounded-xl:hover,
button.rounded-2xl:hover,
a.rounded-xl:hover,
a.rounded-2xl:hover,
a.rounded-\[1\.1rem\]:hover,
a.rounded-\[1\.3rem\]:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.09);
}

button.bg-zinc-950,
a.bg-zinc-950 {
    background: linear-gradient(135deg, #18181b, #09090b);
    box-shadow: 0 14px 28px rgba(24, 24, 27, 0.18);
}

button.border-red-300,
a.border-red-300 {
    background: linear-gradient(180deg, #fff, #fff8f8);
    border-color: #fca5a5;
    color: #b91c1c;
}

button.border-zinc-300,
a.border-zinc-300 {
    background: linear-gradient(180deg, #ffffff, #fafafa);
    border-color: #d4d4d8;
    color: #18181b;
}

.toast-success {
    background: linear-gradient(135deg, #16a34a, #15803d);
}

.toast-error {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
}

.action-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    border-radius: 1rem;
    border: 1px solid #d4d4d8;
    background: linear-gradient(180deg, #ffffff, #fafafa);
    color: #18181b;
    padding: 0.7rem 1rem;
    font-size: 0.85rem;
    font-weight: 700;
    line-height: 1;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06);
}

.action-chip:hover {
    border-color: #a1a1aa;
    box-shadow: 0 14px 28px rgba(15, 23, 42, 0.1);
}

.action-chip svg {
    width: 1rem;
    height: 1rem;
    flex: 0 0 auto;
}

.action-chip-pdf {
    background: linear-gradient(135deg, #fff7ed, #ffffff);
    border-color: #fdba74;
    color: #c2410c;
}

.action-chip-pdf svg {
    color: #ea580c;
}

.action-chip-dark {
    background: linear-gradient(135deg, rgba(255,255,255,0.14), rgba(255,255,255,0.06));
    border-color: rgba(255,255,255,0.18);
    color: #fff;
    box-shadow: none;
}

.action-chip-dark:hover {
    border-color: rgba(255,255,255,0.32);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.12);
}

.action-chip-uniform {
    justify-content: center;
    min-height: 2.85rem;
    width: 100%;
    padding: 0.8rem 1rem;
    text-align: center;
    white-space: nowrap;
}

.order-action-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.6rem;
    min-width: 15.5rem;
}

.order-action-stack {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.55rem;
}

.icon-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.8rem;
    height: 2.8rem;
    border-radius: 0.95rem;
    border: 1px solid #d4d4d8;
    background: linear-gradient(180deg, #ffffff, #fafafa);
    color: #18181b;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06);
    transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease, background 180ms ease;
}

.icon-action-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.1);
}

.icon-action-btn svg {
    width: 1.05rem;
    height: 1.05rem;
}

.icon-action-btn-primary {
    background: linear-gradient(135deg, #18181b, #09090b);
    color: #fff;
    border-color: transparent;
}

.icon-action-btn-danger {
    color: #b91c1c;
    border-color: #fca5a5;
    background: linear-gradient(180deg, #fff, #fff8f8);
}

.order-action-menu {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    z-index: 20;
    min-width: 12.5rem;
    border-radius: 1rem;
    border: 1px solid #e4e4e7;
    background: rgba(255,255,255,0.98);
    box-shadow: 0 18px 34px rgba(15, 23, 42, 0.12);
    padding: 0.4rem;
    backdrop-filter: blur(14px);
}

.order-action-menu.hidden {
    display: none;
}

.order-action-menu-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    border: 0;
    background: transparent;
    text-align: left;
    border-radius: 0.8rem;
    padding: 0.75rem 0.85rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: #18181b;
}

.order-action-menu-item:hover {
    background: #f8fafc;
}

.order-action-menu-item svg {
    width: 1rem;
    height: 1rem;
    flex: 0 0 auto;
}

.order-action-menu-item-danger {
    color: #b91c1c;
}

.nav-section-label {
    padding: 0 0.85rem 0.55rem;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: #9ca3af;
}

.nav-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.15rem;
    height: 1.15rem;
    flex: 0 0 auto;
}

.nav-icon svg {
    width: 100%;
    height: 100%;
}

.sidebar-link,
.sidebar-sublink,
.mobile-nav-link,
.mobile-sheet-link {
    color: #374151;
}

.sidebar-link {
    border: 1px solid transparent;
}

.sidebar-link:hover,
.sidebar-group-toggle:hover {
    background: rgba(255, 255, 255, 0.8);
    border-color: rgba(255, 255, 255, 0.72);
    transform: translateY(-1px);
}

.sidebar-sublink {
    position: relative;
    background: rgba(255, 255, 255, 0.48);
    border: 1px solid transparent;
}

.sidebar-sublink::before {
    content: "";
    position: absolute;
    left: -1.1rem;
    top: 50%;
    width: 0.8rem;
    height: 0.8rem;
    transform: translateY(-50%);
    border-left: 1px solid #d4d4d8;
    border-bottom: 1px solid #d4d4d8;
    border-bottom-left-radius: 0.7rem;
}

.sidebar-sublink:hover {
    background: #fff;
    border-color: #f3f4f6;
}

.sidebar-link.active,
.sidebar-group-toggle.active {
    background: linear-gradient(135deg, #111827, #1f2937);
    color: white;
    box-shadow: 0 16px 32px rgba(15, 23, 42, 0.16);
}

.sidebar-sublink.active {
    background: linear-gradient(135deg, var(--app-accent-soft), #fff);
    color: #111827;
    font-weight: 700;
    border-color: #ffd8cb;
    box-shadow: 0 10px 25px rgba(255, 95, 69, 0.12);
}

.sidebar-sublink.active::before {
    border-color: rgba(255, 95, 69, 0.45);
}

.mobile-bottom-nav {
    padding-bottom: max(0.5rem, env(safe-area-inset-bottom));
}

.mobile-nav-link {
    display: inline-flex;
    flex: 1 1 0;
    min-width: 0;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.28rem;
    border-radius: 1.1rem;
    padding: 0.65rem 0.3rem;
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1;
    text-align: center;
    border: 1px solid transparent;
    background: transparent;
}

.mobile-nav-link-primary {
    background: linear-gradient(135deg, #fff2e9, #eefcf7);
    color: #6b7280;
    border-color: rgba(255, 95, 69, 0.15);
}

.mobile-nav-link.active {
    background: linear-gradient(135deg, rgba(255, 95, 69, 0.12), rgba(52, 211, 153, 0.12));
    color: #111827;
    border-color: rgba(255, 95, 69, 0.15);
}

.mobile-nav-link-primary.active {
    color: white;
    border-color: transparent;
    background: linear-gradient(135deg, var(--app-accent), #111827);
    box-shadow: 0 12px 24px rgba(255, 95, 69, 0.22);
}

.mobile-sheet-panel {
    max-height: min(80vh, 720px);
    overflow-y: auto;
}

.app-table-section {
    position: relative;
}

.app-table-toolbar {
    position: sticky;
    top: 0.75rem;
    z-index: 18;
}

.app-row-number-head,
.app-row-number-cell {
    width: 3.75rem;
    min-width: 3.75rem;
}

.mobile-group-title {
    margin-bottom: 0.9rem;
    font-size: 0.8rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #9ca3af;
}

.mobile-group-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.9rem;
}

.mobile-sheet-link {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    border-radius: 1.35rem;
    border: 1px solid #eef2f7;
    background: linear-gradient(180deg, #ffffff, #fafafa);
    padding: 1rem;
    font-size: 0.95rem;
    font-weight: 700;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
}

.mobile-sheet-link-accent {
    background: linear-gradient(135deg, var(--app-accent-soft), #ffffff);
    border-color: #ffd6ca;
}

.mobile-sheet-link .nav-icon {
    width: 2rem;
    height: 2rem;
    border-radius: 0.85rem;
    background: #f9fafb;
    padding: 0.45rem;
}

.mobile-sheet-link-accent .nav-icon {
    background: rgba(255, 95, 69, 0.12);
    color: var(--app-accent);
}

.glass-panel {
    background: rgba(255,255,255,.82);
    backdrop-filter: blur(20px);
}

.dashboard-hero {
    background:
        radial-gradient(circle at top right, rgba(52, 211, 153, 0.26), transparent 24%),
        radial-gradient(circle at bottom left, rgba(255,255,255,0.13), transparent 28%),
        linear-gradient(135deg, #121826 0%, #171f2f 40%, #ff5f45 100%);
}

.dashboard-hero-orb {
    position: absolute;
    border-radius: 999px;
    filter: blur(48px);
    opacity: 0.65;
}

.dashboard-hero-orb-a {
    right: -40px;
    top: -30px;
    width: 180px;
    height: 180px;
    background: rgba(255,255,255,0.12);
}

.dashboard-hero-orb-b {
    left: -35px;
    bottom: -40px;
    width: 200px;
    height: 200px;
    background: rgba(52, 211, 153, 0.18);
}

.dashboard-stat-card {
    border-radius: 1.7rem;
    padding: 1.35rem;
    background: linear-gradient(180deg, rgba(255,255,255,0.92), rgba(255,255,255,0.8));
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.08);
    border: 1px solid rgba(255,255,255,0.75);
}

.dashboard-stat-card-warm {
    background: linear-gradient(180deg, #fff5ef, #ffffff);
}

.dashboard-stat-card-mint {
    background: linear-gradient(180deg, #effdf7, #ffffff);
}

.dashboard-stat-card-ink {
    background: linear-gradient(180deg, #f3f4f6, #ffffff);
}

.dashboard-stat-label {
    font-size: 0.8rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #6b7280;
}

.dashboard-stat-value {
    margin-top: 0.6rem;
    font-size: 2rem;
    line-height: 1;
    font-weight: 900;
    color: #111827;
}

.dashboard-stat-foot {
    margin-top: 0.65rem;
    font-size: 0.88rem;
    color: #6b7280;
}

.app-skeleton {
    position: relative;
    overflow: hidden;
    background: linear-gradient(90deg, rgba(228, 228, 231, 0.95), rgba(244, 244, 245, 1), rgba(228, 228, 231, 0.95));
    background-size: 200% 100%;
    animation: appSkeletonShift 1.15s ease-in-out infinite;
}

.app-metric-loading {
    color: transparent !important;
    position: relative;
    min-height: 1.2em;
}

.app-metric-loading::after {
    content: "";
    position: absolute;
    inset: 0.18em 0;
    border-radius: 999px;
    background: linear-gradient(90deg, rgba(228, 228, 231, 0.95), rgba(244, 244, 245, 1), rgba(228, 228, 231, 0.95));
    background-size: 200% 100%;
    animation: appSkeletonShift 1.15s ease-in-out infinite;
}

@keyframes appSkeletonShift {
    0% { background-position: 180% 0; }
    100% { background-position: -20% 0; }
}

.field-warning {
    background: #fef9c3;
    border-color: #facc15 !important;
}

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-thumb {
    background: #d4d4d8;
    border-radius: 999px;
}

@media (max-width: 767px) {
    .app-shell {
        gap: 0;
        min-height: 100dvh;
    }

    .app-topbar {
        height: auto;
        padding-top: calc(0.85rem + env(safe-area-inset-top));
        padding-bottom: 0.85rem;
        gap: 0.8rem;
    }

    #app {
        overflow: visible !important;
        padding-bottom: calc(6.5rem + env(safe-area-inset-bottom));
    }

    #app > section {
        padding: 1rem !important;
    }

    #app > section.space-y-6 > * + *,
    #app > section.space-y-5 > * + * {
        margin-top: 1rem !important;
    }

    #app .p-8 {
        padding: 1.1rem;
    }

    #app .p-6 {
        padding: 1rem;
    }

    #app .rounded-3xl,
    #app .rounded-\[2rem\] {
        border-radius: 1.5rem;
    }

    #app .shadow-soft,
    #app .shadow-floaty {
        box-shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
    }

    #app .text-3xl {
        font-size: 2rem;
        line-height: 1.05;
    }

    #app table {
        font-size: 0.84rem;
    }

    #app .overflow-x-auto {
        -webkit-overflow-scrolling: touch;
    }

    .app-main-shell {
        overflow: visible;
    }

    .mobile-bottom-nav {
        padding-bottom: calc(0.5rem + env(safe-area-inset-bottom));
        padding-left: max(0.75rem, env(safe-area-inset-left));
        padding-right: max(0.75rem, env(safe-area-inset-right));
        box-shadow: 0 -10px 30px rgba(15, 23, 42, 0.08);
    }

    .mobile-group-grid {
        grid-template-columns: 1fr;
    }
}

@keyframes pageEnter {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
