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

:root {
    --page-bg: #f5f7fb;
    --surface: #ffffff;
    --surface-muted: #f0f4ff;
    --text-main: #0f172a;
    --text-subtle: #64748b;
    --brand: #22b3c1;
    --brand-strong: #05818d;
    --border: #e2e8f0;
    --accent: #14b8a6;
    --danger: #ef4444;
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --shadow-sm: 0 10px 30px rgba(15, 23, 42, 0.08);
    --shadow-xs: 0 8px 20px rgba(15, 23, 42, 0.04);
    --spacing-unit: 6px;
    --sidebar-gradient-start: #00d8d8;
    --sidebar-gradient-end: #007f80;
    --card-gradient-start: rgba(255, 255, 255, 0.98);
    --card-gradient-end: rgba(72, 104, 255, 0.12);
    --anim-duration: 0.55s;
    --anim-ease: cubic-bezier(0.25, 0.1, 0.25, 1);
    --anim-delay-step: 0.08s;
}

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

body {
    margin: 0;
    min-height: 100vh;
    font-family: 'Inter', sans-serif;
    background: var(--page-bg);
    color: var(--text-main);
    line-height: 1.6;
    animation: fadeCanvas var(--anim-duration) var(--anim-ease) both;
}

img {
    max-width: 100%;
    display: block;
}

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

.app-shell {
    display: flex;
    min-height: 100vh;
    padding: calc(var(--spacing-unit) * 3);
    gap: calc(var(--spacing-unit) * 3);
    animation: softSlide var(--anim-duration) var(--anim-ease) both;
}

.app-sidebar {
    width: 260px;
    background: linear-gradient(165deg, var(--sidebar-gradient-start), var(--sidebar-gradient-end));
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xs);
    padding: calc(var(--spacing-unit) * 3);
    display: flex;
    flex-direction: column;
    gap: calc(var(--spacing-unit) * 3);
    position: sticky;
    top: calc(var(--spacing-unit) * 3);
    height: calc(100vh - var(--spacing-unit) * 6);
    max-height: calc(100vh - var(--spacing-unit) * 6);
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    animation: floatIn var(--anim-duration) var(--anim-ease) 0.05s both;
    color: rgba(255, 255, 255, 0.88);
    z-index: 20;
}

.app-sidebar::-webkit-scrollbar {
    width: 8px;
}

.app-sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.18);
    border-radius: 999px;
}

.brand-block {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-unit);
}

.brand-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1rem;
    letter-spacing: 0.08em;
    color: #fff;
    background: rgba(255, 255, 255, 0.16);
    border-radius: 999px;
    padding: 6px 14px;
}

.brand-user {
    margin: 0;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.65);
}

.sidebar-logo-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: calc(var(--spacing-unit) * 1);
    background: transparent;
}

.sidebar-logo {
    max-width: 100px;
    height: auto;
    opacity: 0.95;
    transition: opacity 0.2s ease, transform 0.2s ease;
    background: transparent;
    mix-blend-mode: normal;
}

.sidebar-logo:hover {
    opacity: 1;
    transform: scale(1.05);
}

.brand-user-row {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 14px;
    text-align: center;
}

.brand-avatar {
    width: 120px;
    height: 120px;
    border-radius: 999px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.12);
    border: 2px solid rgba(255, 255, 255, 0.22);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.12);
}

.brand-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
}

.brand-avatar span {
    font-weight: 900;
    letter-spacing: .5px;
    color: rgba(255, 255, 255, .92);
    font-size: 2rem;
}

.brand-user-label {
    font-size: .9rem;
    color: rgba(255, 255, 255, .80);
    line-height: 1;
}

.brand-user-name {
    font-size: 1.1rem;
    font-weight: 900;
    color: rgba(255, 255, 255, .98);
    line-height: 1.2;
}

.login-logo-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: calc(var(--spacing-unit) * 2);
}

.login-logo {
    max-width: 180px;
    height: auto;
    filter: drop-shadow(0 4px 12px rgba(72, 104, 255, 0.2));
    animation: logoFloat 3s ease-in-out infinite;
    transition: transform 0.3s ease;
}

.login-logo:hover {
    transform: scale(1.05);
}

@keyframes logoFloat {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-8px);
    }
}

.app-nav {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.app-nav__link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    color: rgba(255, 255, 255, 0.72);
    border-radius: var(--radius-md);
    transition: background 0.25s ease, color 0.25s ease, transform 0.25s ease;
}

.app-nav__link i {
    font-size: 1rem;
    color: inherit;
}

.app-nav__link.is-active,
.app-nav__link:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    transform: translateX(2px);
}

.app-sidebar__footer {
    margin-top: auto;
    padding: 16px 0 0 0;
    background: transparent;
    border-top: none;
    box-shadow: none;
}

.app-sidebar__footer .btn {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    border-color: transparent;
    padding: 8px 10px;
}

.app-sidebar__footer .btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.app-main {
    flex: 1;
    min-width: 0;
    background: transparent;
}

.page-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: calc(var(--spacing-unit) * 2);
    margin-bottom: calc(var(--spacing-unit) * 3);
}

.page-header__title {
    margin: 0;
    font-size: 2rem;
    font-weight: 600;
}

.page-header__subtitle {
    margin: 4px 0 0;
    color: var(--text-subtle);
    font-size: 0.95rem;
}

.surface {
    background: linear-gradient(140deg, var(--card-gradient-start), var(--card-gradient-end));
    border-radius: var(--radius-lg);
    padding: calc(var(--spacing-unit) * 3);
    box-shadow: var(--shadow-xs);
    opacity: 0;
    animation: fadeUp var(--anim-duration) var(--anim-ease) forwards;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: calc(var(--spacing-unit) * 2.5);
}

.section-title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: calc(var(--spacing-unit) * 2);
    margin-bottom: calc(var(--spacing-unit) * 3);
}

.stat-grid > .surface {
    animation: none !important;
    opacity: 1 !important;
    transition: none !important;
}

.stat-card {
    padding: calc(var(--spacing-unit) * 2);
    border-radius: var(--radius-md);
    background: var(--surface);
    box-shadow: var(--shadow-xs);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--card-accent), var(--card-accent-dark));
}

.stat-card__label {
    font-size: 0.85rem;
    color: var(--text-subtle);
    margin-bottom: 6px;
}

.stat-card__value {
    font-size: 1.7rem;
    font-weight: 600;
}

.table-scroll {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
}

.data-table thead {
    color: var(--text-subtle);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
}

.data-table th,
.data-table td {
    text-align: left;
    padding: 14px 12px;
    border-bottom: 1px solid var(--border);
}

.data-table tbody tr:hover {
    background: rgba(72, 104, 255, 0.04);
    transition: background 0.25s ease;
}

.data-table--gradient {
    border-collapse: separate;
    border-spacing: 0;
    overflow: hidden;
    border-radius: var(--radius-md);
}

.data-table--gradient thead {
    background: linear-gradient(135deg, var(--sidebar-gradient-start), var(--sidebar-gradient-end));
    color: #ffffff;
    font-weight: 600;
}

.data-table--gradient thead th {
    color: #ffffff;
    padding: 16px 14px;
    border: none;
    position: relative;
}

.data-table--gradient thead th:first-child {
    border-top-left-radius: var(--radius-md);
}

.data-table--gradient thead th:last-child {
    border-top-right-radius: var(--radius-md);
}

.data-table--gradient th,
.data-table--gradient td {
    padding: 14px;
}

.data-table--gradient tbody tr {
    transition: all 0.25s ease;
}

.data-table--gradient tbody tr:nth-child(4n+1) {
    background: linear-gradient(90deg, rgba(34, 179, 193, 0.04), rgba(255, 255, 255, 0.01));
}

.data-table--gradient tbody tr:nth-child(4n+2) {
    background: linear-gradient(90deg, rgba(139, 92, 246, 0.04), rgba(255, 255, 255, 0.01));
}

.data-table--gradient tbody tr:nth-child(4n+3) {
    background: linear-gradient(90deg, rgba(23, 72, 153, 0.04), rgba(255, 255, 255, 0.01));
}

.data-table--gradient tbody tr:nth-child(4n+4) {
    background: linear-gradient(90deg, rgba(59, 130, 246, 0.04), rgba(255, 255, 255, 0.01));
}

.data-table--gradient tbody tr:hover {
    background: linear-gradient(90deg, rgba(34, 179, 193, 0.12), rgba(31, 31, 120, 0.08)) !important;
    transform: translateX(2px);
}

.data-table--gradient tbody tr:last-child td:first-child {
    border-bottom-left-radius: var(--radius-md);
}

.data-table--gradient tbody tr:last-child td:last-child {
    border-bottom-right-radius: var(--radius-md);
}

.data-table--gradient tbody tr:last-child td {
    border-bottom: none;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 500;
}

.badge-neutral {
    background: var(--surface-muted);
    color: var(--brand);
}

.badge-success {
    background: rgba(20, 184, 166, 0.12);
    color: var(--accent);
}

.badge-warning {
    background: rgba(251, 191, 36, 0.15);
    color: #b45309;
}

.badge-danger {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: calc(var(--spacing-unit) * 2);
}

.form-control,
select,
input[type="text"],
input[type="number"],
input[type="date"],
input[type="password"] {
    width: 100%;
    padding: 12px 14px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: #fff;
    font-family: inherit;
    font-size: 0.95rem;
    color: var(--text-main);
    transition: border 0.2s ease, box-shadow 0.2s ease;
}

.form-control:focus,
select:focus,
input:focus,
textarea:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(72, 104, 255, 0.15);
}

.form-control.error {
    border-color: var(--danger);
    background: rgba(239, 68, 68, 0.03);
}

.form-control.error:focus {
    border-color: var(--danger);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}

textarea {
    width: 100%;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    padding: 12px 14px;
    font-family: inherit;
}

.btn {
    border: none;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.95rem;
    padding: 12px 18px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
    background: var(--surface-muted);
    color: var(--text-main);
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-xs);
}

.btn-primary {
    background: var(--brand);
    color: #fff;
}

.btn-primary:hover {
    background: var(--brand-strong);
}

.btn-primary:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(72, 104, 255, 0.2);
}

.btn-ghost {
    background: transparent;
    color: var(--text-subtle);
    border: 1px solid transparent;
}

.btn-ghost:hover {
    border-color: var(--border);
    color: var(--text-main);
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.table-actions {
    display: flex;
    gap: 8px;
}

.table-actions .btn {
    padding: 8px 12px;
    font-size: 0.85rem;
}

.pill {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 999px;
    background: var(--surface-muted);
    font-size: 1.8rem;
    color: var(--brand);
}

.muted {
    color: var(--text-subtle);
    font-size: 0.9rem;
}

.w-100 {
    width: 100%;
}

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at top, rgba(72, 104, 255, 0.08), transparent 55%), var(--page-bg);
    padding: 16px;
    position: relative;
    overflow: hidden;
}

.login-page::before,
.login-page::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    opacity: 0.3;
    animation: floatBackground 20s ease-in-out infinite;
    z-index: 0;
}

.login-page::before {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(72, 104, 255, 0.15), transparent 70%);
    top: -150px;
    left: -150px;
    animation-delay: 0s;
}

.login-page::after {
    width: 350px;
    height: 350px;
    background: radial-gradient(circle, rgba(20, 184, 166, 0.12), transparent 70%);
    bottom: -100px;
    right: -100px;
    animation-delay: -10s;
}

@keyframes floatBackground {
    0%, 100% {
        transform: translate(0, 0) scale(1);
        opacity: 0.3;
    }
    33% {
        transform: translate(30px, -30px) scale(1.1);
        opacity: 0.25;
    }
    66% {
        transform: translate(-20px, 20px) scale(0.9);
        opacity: 0.35;
    }
}

.login-page .login-bg-orb {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    filter: blur(60px);
    animation: pulseOrb 8s ease-in-out infinite;
    z-index: 0;
}

.login-page .login-bg-orb:nth-child(1) {
    width: 300px;
    height: 300px;
    background: rgba(72, 104, 255, 0.1);
    top: 20%;
    right: 10%;
    animation-delay: 0s;
}

.login-page .login-bg-orb:nth-child(2) {
    width: 250px;
    height: 250px;
    background: rgba(20, 184, 166, 0.08);
    bottom: 15%;
    left: 15%;
    animation-delay: -4s;
}

@keyframes pulseOrb {
    0%, 100% {
        transform: scale(1);
        opacity: 0.6;
    }
    50% {
        transform: scale(1.2);
        opacity: 0.8;
    }
}

.login-card {
    width: min(420px, 100%);
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: calc(var(--spacing-unit) * 4) calc(var(--spacing-unit) * 4);
    display: flex;
    flex-direction: column;
    gap: calc(var(--spacing-unit) * 2);
    opacity: 0;
    animation: fadeUp var(--anim-duration) var(--anim-ease) 0.1s forwards;
    position: relative;
    z-index: 1;
}

.login-card h1 {
    margin: 0;
    font-size: 1.8rem;
}

.login-card p {
    margin: 0;
    color: var(--text-subtle);
}

.pagination-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: calc(var(--spacing-unit) * 3);
}

.pagination-controls {
    display: flex;
    gap: 8px;
}

.pg-btn {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 8px 14px;
    background: var(--surface);
    cursor: pointer;
    font-weight: 500;
    color: var(--text-subtle);
}

.pg-btn[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
}

.pg-count {
    font-weight: 600;
    color: var(--text-main);
}

.status-text {
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.04em;
}

.status-completed {
    color: var(--accent);
}

.status-paid {
    color: #2563eb;
}

.status-dropped {
    color: #d97706;
}

.status-inprocess {
    color: #0891b2;
}

.status-created {
    color: #475569;
}

.status-sandbox {
    color: var(--text-subtle);
}

.status-qc {
    color: #7c3aed;
}

.status-ready {
    color: #16a34a;
}

.section-stack {
    display: flex;
    flex-direction: column;
    gap: calc(var(--spacing-unit) * 3);
}

.top-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

@keyframes fadeCanvas {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

@keyframes floatIn {
    from {
        opacity: 0;
        transform: translateX(-18px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

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

.stat-card--primary {
    --card-accent: #3b82f6;
    --card-accent-dark: #2563eb;
    --card-bg-light: rgba(59, 130, 246, 0.08);
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.05), rgba(147, 197, 253, 0.03));
}

.stat-card--primary .section-title {
    color: #1e40af;
}

.stat-card--success {
    --card-accent: #10b981;
    --card-accent-dark: #059669;
    --card-bg-light: rgba(16, 185, 129, 0.08);
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.05), rgba(52, 211, 153, 0.03));
}

.stat-card--success .section-title {
    color: #065f46;
}

.stat-card--warning {
    --card-accent: #f59e0b;
    --card-accent-dark: #d97706;
    --card-bg-light: rgba(245, 158, 11, 0.08);
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.05), rgba(251, 191, 36, 0.03));
}

.stat-card--warning .section-title {
    color: #92400e;
}

.stat-card--info {
    --card-accent: #8b5cf6;
    --card-accent-dark: #7c3aed;
    --card-bg-light: rgba(139, 92, 246, 0.08);
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.05), rgba(167, 139, 250, 0.03));
}

.stat-card--info .section-title {
    color: #5b21b6;
}

.stat-card .section-header {
    background: var(--card-bg-light);
    padding: calc(var(--spacing-unit) * 1.5);
    border-radius: var(--radius-md);
    margin-bottom: calc(var(--spacing-unit) * 2);
}

@media (max-width: 1100px) {
    .app-shell {
        flex-direction: row;
        padding: calc(var(--spacing-unit) * 2);
        gap: calc(var(--spacing-unit) * 2);
    }

    .app-sidebar {
        position: sticky;
        top: calc(var(--spacing-unit) * 2);
        left: auto;
        bottom: auto;
        transform: none;
        transition: none;
        width: 260px;
        height: calc(100vh - var(--spacing-unit) * 4);
        max-height: calc(100vh - var(--spacing-unit) * 4);
        border-radius: var(--radius-lg);
        padding-top: calc(var(--spacing-unit) * 3);
        animation: none;
    }
}

@media (max-width: 640px) {
    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }

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

    .table-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .login-page {
        padding: 12px;
        align-items: flex-start;
        padding-top: 40px;
    }

    .login-card {
        width: 100%;
        max-width: 100%;
        padding: calc(var(--spacing-unit) * 2.5);
        gap: calc(var(--spacing-unit) * 2);
    }

    .login-card h1 {
        font-size: 1.5rem;
    }

    .login-card p {
        font-size: 0.9rem;
    }

    .login-logo {
        max-width: 140px;
    }

    .brand-pill {
        padding: 5px 12px;
        font-size: 0.9rem;
    }
}