* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'Inter', sans-serif;
    background-color: #f3f5f9;
    color: #0f1f3d;
}

.portal-header {
    background: linear-gradient(90deg, #0f5aad, #0f81c7);
    color: #fff;
    box-shadow: 0 2px 12px rgba(3, 30, 62, 0.2);
}

.portal-header__inner {
    max-width: min(1280px, 96vw);
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.portal-header .logo {
    font-weight: 700;
    font-size: 1.2rem;
    letter-spacing: 0.08em;
}

.header-actions {
    margin-left: auto;
    display: inline-flex;
    gap: 0.75rem;
    align-items: center;
}

.header-btn {
    min-width: auto;
    padding: 0.5rem 1rem;
    font-size: 0.95rem;
    line-height: 1.2;
    border: none;
    background: transparent;
    color: inherit;
    text-decoration: none;
}


.header-btn--ios {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.55rem 1.5rem;
    min-width: 140px;
    border-radius: 999px;
    background: linear-gradient(180deg, #f7f7f7, #b5b5b5);
    border: 1px solid rgba(255, 255, 255, 0.65);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.85),
        inset 0 -1px 0 rgba(0, 0, 0, 0.18),
        0 4px 10px rgba(0, 0, 0, 0.25);
    color: #101010;
    font-weight: 600;
    letter-spacing: -0.01em;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.header-btn--ios i {
    margin-right: 0.35rem;
}

.header-btn--ios:hover {
    transform: translateY(-1px);
    background: linear-gradient(180deg, #fafafa, #c3c3c3);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.9),
        inset 0 -1px 0 rgba(0, 0, 0, 0.15),
        0 6px 16px rgba(0, 0, 0, 0.32);
}

.header-btn--ios:active {
    transform: translateY(1px);
    background: linear-gradient(180deg, #d8d8d8, #acacac);
    box-shadow:
        inset 0 1px 2px rgba(0, 0, 0, 0.24),
        0 2px 6px rgba(0, 0, 0, 0.25);
}

.header-btn--ios:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.8);
    outline-offset: 2px;
}

.header-btn i {
    margin-right: 0.35rem;
}

.header-btn span {
    display: inline-flex;
    align-items: center;
}

.portal-main {
    padding: 2rem 0 3rem;
}

.portal-main__inner {
    max-width: min(1280px, 96vw);
    margin: 0 auto;
    padding: 0 2rem;
}

.page-grid {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    width: 100%;
}

.column-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    background: #f0f5ff;
    border-radius: 12px;
    border: 1px solid #d8e0f3;
}

.column-controls__label {
    font-weight: 600;
    color: #0f2e5c;
    margin-right: 0.25rem;
}

.column-controls__option {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.9rem;
    color: #0f2e5c;
}

.column-controls__option input {
    accent-color: #0f81c7;
}

.panel {
    background: #fff;
    border-radius: 16px;
    padding: 1.8rem;
    box-shadow: 0 16px 40px rgba(15, 45, 94, 0.1);
    animation: fadeIn 0.5s ease;
    width: 100%;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.panel header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 1rem;
}

.primary,
.ghost {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.6rem 1.3rem;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.95rem;
    min-width: 140px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.primary {
    background: linear-gradient(135deg, #0f5aad, #0f81c7);
    color: #fff;
    border: none;
}

.primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(15, 90, 173, 0.25);
}

.ghost {
    background: transparent;
    border: 1px solid #0f81c7;
    color: #0f81c7;
}

.ghost:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(15, 129, 199, 0.2);
}

.ghost.danger {
    border-color: #c74343;
    color: #c74343;
}

.ghost.danger:hover {
    box-shadow: 0 6px 16px rgba(199, 67, 67, 0.25);
}

.button-ios {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1.4rem;
    border-radius: 999px;
    font-weight: 600;
    letter-spacing: -0.01em;
    font-size: 0.95rem;
    border: none;
    background: linear-gradient(180deg, #1e86ff, #0b66d6);
    color: #ffffff;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
    text-decoration: none;
    cursor: pointer;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.3),
        inset 0 -1px 0 rgba(255, 255, 255, 0.05),
        0 8px 20px rgba(11, 102, 214, 0.35);
}

.button-ios.button-ios--accent {
    background: linear-gradient(180deg, #1e8bff, #0560d3);
}

.button-ios:hover {
    transform: translateY(-1px);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.4),
        inset 0 -1px 0 rgba(0, 0, 0, 0.1),
        0 10px 24px rgba(5, 96, 211, 0.42);
}

.button-ios:active {
    transform: translateY(1px);
    background: linear-gradient(180deg, #155bcc, #044fb0);
    box-shadow:
        inset 0 1px 2px rgba(0, 0, 0, 0.35),
        0 4px 12px rgba(0, 0, 0, 0.3);
}

.button-ios:focus-visible {
    outline: 2px solid rgba(30, 139, 255, 0.8);
    outline-offset: 2px;
}

.button-ios:disabled {
    cursor: not-allowed;
    opacity: 0.65;
    box-shadow: inset 0 0 0 rgba(0, 0, 0, 0);
}

.panel h2 {
    margin: 0;
    font-size: 1.4rem;
}

.panel .controls {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.panel .controls label {
    display: flex;
    flex-direction: column;
    font-size: 0.8rem;
    color: #4f5d78;
}

.panel .controls input,
.panel .controls select {
    margin-top: 0.3rem;
    padding: 0.5rem 0.65rem;
    border: 1px solid #d0d8e6;
    border-radius: 8px;
    min-width: 120px;
}

.metric-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-top: 1.4rem;
}

.metric-cards .card {
    background: linear-gradient(180deg, rgba(15, 90, 173, 0.08), rgba(15, 129, 199, 0.08));
    border-radius: 14px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    color: #0f2e5c;
}

.metric-cards .value {
    font-size: 1.6rem;
    font-weight: 700;
}

.dataset #grid-table {
    margin-top: 0;
}

.table-scroll {
    margin-top: 1rem;
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid #d8e0f3;
    background: #ffffff;
}

.table-scroll::-webkit-scrollbar {
    height: 10px;
}

.table-scroll::-webkit-scrollbar-thumb {
    background: rgba(15, 45, 94, 0.25);
    border-radius: 999px;
}

.table-scroll .tabulator {
    min-width: 100%;
}

.table-scroll-slider {
    display: none;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.6rem;
    color: #0f2e5c;
}

.table-scroll-slider__label {
    font-weight: 600;
}

.table-scroll-slider input[type="range"] {
    flex: 1;
    accent-color: #0f81c7;
}

.dataset #grid-table .tabulator {
    width: 100%;
}

.table-footer {
    margin-top: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.table-pagination {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

#page-label {
    font-weight: 600;
    color: #0f2e5c;
}

.charts {
    display: grid;
    gap: 1.2rem;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.chart-item canvas {
    width: 100%;
    height: 320px;
}

.uploads-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.uploads-table th,
.uploads-table td {
    padding: 0.75rem 0.6rem;
    text-align: left;
    border-bottom: 1px solid #e3e8f4;
    font-size: 0.9rem;
}

.uploads-table .status.completed {
    color: #138f5b;
    font-weight: 600;
}

.uploads-table .status.processing {
    color: #d9950c;
    font-weight: 600;
}

.uploads-table .status.failed {
    color: #c74343;
    font-weight: 600;
}

.uploads-table td form {
    margin: 0;
}

.uploads-table td .ghost {
    min-width: auto;
    padding: 0.45rem 0.9rem;
}

.page-login {
    background-color: #041c54;
    background-image: url("/static/img/login-background.svg"), radial-gradient(circle at 18% 14%, #4db4ff 0%, #134fd1 40%, #041c54 100%);
    background-size: cover, cover;
    background-position: center, center;
    background-repeat: no-repeat, no-repeat;
    color: #f4f9ff;
    min-height: 100vh;
}

.page-login .portal-header {
    display: none;
}

.page-login .portal-main {
    padding: 0;
    min-height: 100vh;
}

.page-login .portal-main__inner {
    max-width: none;
    width: 100%;
    padding: 0;
}

.login-hero {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5rem 1.5rem;
    overflow: hidden;
}

.login-hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(120deg, rgba(12, 44, 120, 0.25), rgba(3, 17, 52, 0.35));
    mix-blend-mode: screen;
    pointer-events: none;
}

.login-card {
    position: relative;
    width: min(440px, 92vw);
    padding: 3rem 3rem 2.75rem;
    border-radius: 30px;
    background: linear-gradient(150deg, rgba(255, 255, 255, 0.32), rgba(255, 255, 255, 0.12));
    border: 1px solid rgba(255, 255, 255, 0.35);
    backdrop-filter: blur(24px);
    box-shadow: 0 30px 80px rgba(7, 27, 78, 0.45);
    color: #0d1b3d;
    z-index: 1;
}

.login-card--glass::before {
    content: "";
    position: absolute;
    inset: 16px;
    border-radius: 22px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    pointer-events: none;
}


.login-card__brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.25rem;
    text-align: center;
    margin-bottom: 2.5rem;
    color: rgba(13, 27, 61, 0.92);
}


.login-card__logo {
    width: min(420px, 88%);
    max-height: 160px;
    object-fit: contain;
    background: rgba(255, 255, 255, 0.52);
    padding: 1.5rem 2rem;
    border-radius: 32px;
    box-shadow: 0 30px 58px rgba(12, 52, 138, 0.32);
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.login-card__brand-text {
    display: flex;
    flex-direction: column;
    font-weight: 600;
    letter-spacing: -0.01em;
    gap: 0.3rem;
}

.login-card__brand-name {
    font-size: 1.6rem;
}

.login-card__brand-subtitle {
    font-size: 0.95rem;
    color: rgba(13, 27, 61, 0.7);
    letter-spacing: 0.02em;
}

.login-card__helper {
    margin: 1rem 0 2.5rem;
    font-size: 1rem;
    text-align: center;
    color: rgba(13, 27, 61, 0.58);
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 1.4rem;
}

.login-form__field {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.login-form__field label {
    font-weight: 600;
    color: rgba(13, 27, 61, 0.75);
    letter-spacing: -0.005em;
}

.login-form__input {
    padding: 0.85rem 1rem;
    border-radius: 18px;
    border: 1px solid rgba(13, 27, 61, 0.14);
    background: rgba(255, 255, 255, 0.68);
    font-size: 1rem;
    color: rgba(13, 27, 61, 0.85);
    transition: border 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}

.login-form__input:focus {
    outline: none;
    border-color: rgba(30, 139, 255, 0.6);
    box-shadow: 0 0 0 3px rgba(30, 139, 255, 0.2);
    background: rgba(255, 255, 255, 0.92);
}

.login-form__input::placeholder {
    color: rgba(13, 27, 61, 0.45);
}

.login-card__submit {
    margin-top: 0.75rem;
    width: 100%;
    padding: 0.95rem;
    border-radius: 24px;
    border: none;
    background: linear-gradient(135deg, #0d52d9, #042685);
    color: #ffffff;
    font-weight: 600;
    font-size: 1.05rem;
    letter-spacing: 0.02em;
    box-shadow: 0 18px 38px rgba(3, 28, 94, 0.45);
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.login-card__submit:hover {
    transform: translateY(-1px);
    background: linear-gradient(135deg, #1461f0, #06309a);
    box-shadow: 0 22px 48px rgba(8, 44, 126, 0.55);
}

.login-card__submit:active {
    transform: translateY(1px);
}

.login-card__submit:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.65);
    outline-offset: 2px;
}

.login-footer {
    margin-top: 2.5rem;
    text-align: center;
    font-size: 0.85rem;
    color: rgba(13, 27, 61, 0.6);
}


.page-login .alert {
    background: rgba(255, 85, 85, 0.15);
    border-color: rgba(255, 159, 159, 0.4);
    color: #8b1422;
}

@media (max-width: 640px) {
    .login-hero {
        padding: 3rem 1.25rem;
    }

    .login-card {
        padding: 2.4rem 2.1rem;
    }

    .login-card__heading {
        font-size: 1.9rem;
    }

    .login-card__helper {
        margin-bottom: 1.6rem;
    }

    .login-card__social {
        gap: 0.75rem;
    }

    .login-social {
        width: 44px;
        height: 44px;
    }
}

.alert {
    background: rgba(255, 85, 85, 0.15);
    border: 1px solid rgba(255, 85, 85, 0.4);
    padding: 0.75rem;
    border-radius: 10px;
    margin-bottom: 1rem;
    color: #ffe5e5;
}

.uploads-admin .upload-form {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-bottom: 1.5rem;
}

.upload-form .file-input {
    position: relative;
    overflow: hidden;
    border: 1px dashed #0f81c7;
    border-radius: 12px;
    padding: 0.75rem 1.25rem;
    color: #0f81c7;
    cursor: pointer;
    font-weight: 600;
}

.upload-form .file-input input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.hint {
    color: #4f5d78;
    font-size: 0.9rem;
}

.panel-subtitle {
    color: #5c6f92;
    margin-top: 0.2rem;
    font-size: 0.95rem;
}

@media (max-width: 768px) {
    .portal-main {
        padding: 1rem 0 2rem;
    }
    .portal-main__inner {
        padding: 0 1rem;
    }
    .portal-header__inner {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }
    .header-actions {
        margin-left: 0;
        justify-content: flex-end;
        gap: 1rem;
        flex-wrap: wrap;
        width: 100%;
    }
    .panel header {
        flex-direction: column;
        align-items: stretch;
    }
    .panel .controls {
        width: 100%;
        justify-content: flex-start;
    }
    .portal-header nav a {
        margin-left: 1rem;
    }
}
