:root {
    --primary: #075a9c;
    --primary-dark: #063f70;
    --primary-soft: #eaf3fb;
    --danger: #b4232c;
    --danger-dark: #8d1d24;
    --danger-soft: #fff0f1;
    --success: #198754;
    --success-soft: #eaf8f1;
    --text: #17202a;
    --muted: #667085;
    --border: #d9e2ec;
    --surface: #ffffff;
    --background: #f3f6f9;
    --shadow: 0 18px 45px rgba(18, 50, 79, 0.13);
    --radius: 20px;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
}

body {
    min-height: 100vh;
    margin: 0;
    background:
        radial-gradient(circle at top left, rgba(7, 90, 156, 0.12), transparent 34rem),
        linear-gradient(180deg, #f8fafc 0%, var(--background) 100%);
    color: var(--text);
    font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, Arial, sans-serif;
    line-height: 1.5;
}

a {
    color: inherit;
}

.portal-shell {
    width: min(1120px, calc(100% - 32px));
    margin: 0 auto;
    padding: 34px 0;
}

.portal-header {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-bottom: 28px;
}

.portal-logo {
    width: 82px;
    height: 82px;
    object-fit: contain;
    border-radius: 18px;
    background: var(--surface);
    padding: 7px;
    box-shadow: 0 10px 25px rgba(18, 50, 79, 0.12);
}

.portal-title {
    margin: 0;
    color: var(--primary-dark);
    font-size: clamp(1.25rem, 3vw, 2rem);
    letter-spacing: 0.015em;
}

.portal-subtitle {
    margin: 3px 0 0;
    color: var(--muted);
    font-weight: 600;
}

.hero {
    overflow: hidden;
    position: relative;
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    color: #ffffff;
    border-radius: 26px;
    padding: clamp(28px, 5vw, 54px);
    box-shadow: var(--shadow);
    margin-bottom: 26px;
}

.hero::after {
    content: "";
    position: absolute;
    width: 260px;
    height: 260px;
    right: -90px;
    top: -110px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.09);
}

.hero h2,
.hero p {
    position: relative;
    z-index: 1;
}

.hero h2 {
    margin: 0 0 10px;
    font-size: clamp(1.55rem, 4vw, 2.55rem);
}

.hero p {
    max-width: 740px;
    margin: 0;
    color: rgba(255, 255, 255, 0.88);
    font-size: 1.03rem;
}

.action-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 22px;
}

.action-card,
.panel-card,
.form-card,
.result-card {
    background: var(--surface);
    border: 1px solid rgba(217, 226, 236, 0.85);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.action-card {
    padding: 28px;
    display: flex;
    flex-direction: column;
    min-height: 275px;
}

.action-icon,
.result-icon {
    display: grid;
    place-items: center;
    width: 58px;
    height: 58px;
    border-radius: 17px;
    background: var(--primary-soft);
    color: var(--primary);
    font-size: 1.7rem;
    font-weight: 800;
}

.action-icon-danger {
    background: var(--danger-soft);
    color: var(--danger);
}

.action-card h3 {
    margin: 18px 0 9px;
    font-size: 1.35rem;
}

.action-card p {
    margin: 0 0 22px;
    color: var(--muted);
}

.action-card .button {
    margin-top: auto;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 11px 18px;
    border: 0;
    border-radius: 12px;
    cursor: pointer;
    text-decoration: none;
    font: inherit;
    font-weight: 700;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.button:hover {
    transform: translateY(-1px);
    box-shadow: 0 9px 22px rgba(18, 50, 79, 0.15);
}

.button:focus-visible,
.input:focus-visible {
    outline: 3px solid rgba(7, 90, 156, 0.28);
    outline-offset: 2px;
}

.button-primary {
    background: var(--primary);
    color: #ffffff;
}

.button-primary:hover {
    background: var(--primary-dark);
}

.button-danger {
    background: var(--danger);
    color: #ffffff;
}

.button-danger:hover {
    background: var(--danger-dark);
}

.button-light {
    background: var(--primary-soft);
    color: var(--primary-dark);
}

.button-muted {
    background: #eef2f6;
    color: #344054;
}

.button-block {
    width: 100%;
}

.info-strip {
    margin-top: 24px;
    padding: 16px 18px;
    border: 1px solid #bcd7ec;
    border-radius: 14px;
    background: var(--primary-soft);
    color: var(--primary-dark);
}

.form-layout {
    width: min(600px, calc(100% - 32px));
    margin: 0 auto;
    padding: 34px 0;
}

.form-card {
    padding: clamp(24px, 5vw, 38px);
}

.form-heading {
    text-align: center;
    margin-bottom: 26px;
}

.form-heading .action-icon,
.form-heading .portal-logo {
    margin: 0 auto 15px;
}

.form-heading h1 {
    margin: 0;
    color: var(--primary-dark);
    font-size: 1.65rem;
}

.form-heading p {
    margin: 9px 0 0;
    color: var(--muted);
}

.form-group {
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 7px;
    font-weight: 700;
    color: #344054;
}

.input {
    display: block;
    width: 100%;
    min-height: 51px;
    padding: 11px 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #ffffff;
    color: var(--text);
    font: inherit;
    outline: none;
}

.input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(7, 90, 156, 0.12);
}

.code-input {
    text-align: center;
    font-size: 1.55rem;
    letter-spacing: 0.42rem;
    font-weight: 750;
}

.helper-text {
    margin: 7px 0 0;
    color: var(--muted);
    font-size: 0.9rem;
}

.form-actions {
    display: grid;
    gap: 11px;
}

.result-layout {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.result-card {
    width: min(560px, 100%);
    padding: clamp(30px, 6vw, 48px);
    text-align: center;
}

.result-icon {
    margin: 0 auto 18px;
    width: 72px;
    height: 72px;
    border-radius: 22px;
    font-size: 2rem;
}

.result-card.success .result-icon {
    background: var(--success-soft);
    color: var(--success);
}

.result-card.error .result-icon {
    background: var(--danger-soft);
    color: var(--danger);
}

.result-card h1 {
    margin: 0 0 12px;
}

.result-message {
    color: #344054;
    font-size: 1.05rem;
}

.admin-shell {
    width: min(1240px, calc(100% - 28px));
    margin: 0 auto;
    padding: 26px 0 40px;
}

.admin-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 22px;
}

.admin-topbar h1 {
    margin: 0;
    color: var(--primary-dark);
    font-size: 1.7rem;
}

.admin-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
}

.panel-card {
    overflow: hidden;
}

.panel-header {
    padding: 20px 22px;
    border-bottom: 1px solid var(--border);
}

.panel-header h2 {
    margin: 0;
    font-size: 1.2rem;
}

.table-tools {
    padding: 15px 20px;
    background: #f8fafc;
    border-bottom: 1px solid var(--border);
}

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

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 13px 16px;
    border-bottom: 1px solid #e9eef3;
    text-align: left;
    white-space: nowrap;
}

th {
    background: #f8fafc;
    color: #475467;
    font-size: 0.82rem;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

tbody tr:hover {
    background: #f8fbfd;
}

.badge {
    display: inline-flex;
    padding: 5px 9px;
    border-radius: 999px;
    background: var(--primary-soft);
    color: var(--primary-dark);
    font-size: 0.82rem;
    font-weight: 700;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 22px;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 17px;
    padding: 22px;
    box-shadow: 0 10px 28px rgba(18, 50, 79, 0.09);
}

.stat-label {
    color: var(--muted);
}

.stat-value {
    margin-top: 7px;
    color: var(--primary-dark);
    font-size: 2rem;
    font-weight: 800;
}

.footer {
    margin-top: 28px;
    text-align: center;
    color: var(--muted);
    font-size: 0.88rem;
}

.empty-state,
.chart-fallback {
    padding: 30px;
    color: var(--muted);
    text-align: center;
}

[hidden] {
    display: none !important;
}

@media (max-width: 760px) {
    .portal-shell {
        width: min(100% - 20px, 1120px);
        padding-top: 20px;
    }

    .portal-header {
        align-items: flex-start;
    }

    .portal-logo {
        width: 66px;
        height: 66px;
    }

    .action-grid,
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .action-card {
        min-height: auto;
    }

    .admin-topbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .admin-nav,
    .admin-nav .button {
        width: 100%;
    }
}
