:root {
    --color-brand-navy: #0B192C;
    --color-brand-navy-light: #1E3E62;
    --color-sky-blue: #00A3E0;
    --color-sky-blue-light: #E6F4FA;
    --color-pale-sky: #F4F8FC;
    --color-tricolor-saffron: #FF9933;
    --color-tricolor-green: #138808;
    --color-surface-white: #FFFFFF;
    --color-text-main: #1F2937;
    --color-text-muted: #6B7280;
    --bg: var(--color-pale-sky);
    --surface: var(--color-surface-white);
    --surface-muted: #eef5fa;
    --border: #d7e4ee;
    --text: var(--color-text-main);
    --muted: var(--color-text-muted);
    --primary: var(--color-brand-navy-light);
    --primary-strong: var(--color-brand-navy);
    --danger: #b42318;
    --warning: #8a5a00;
    --info: var(--color-brand-navy-light);
    --shadow: 0 14px 34px rgba(11, 25, 44, 0.08);
    --shadow-soft: 0 5px 16px rgba(11, 25, 44, 0.06);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Segoe UI", system-ui, sans-serif;
    font-size: 15px;
    color: var(--text);
    background: linear-gradient(135deg, #f4f8fc 0%, #ffffff 42%, #eef7fc 100%);
    line-height: 1.5;
}

a {
    color: var(--color-brand-navy-light);
}

.auth-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background: linear-gradient(135deg, #f4f8fc 0%, #ffffff 52%, #e6f4fa 100%);
}

.auth-shell {
    width: min(420px, 100%);
}

.auth-panel,
.panel,
.form-panel,
.table-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.auth-panel {
    padding: 32px;
    border-top: 4px solid var(--color-sky-blue);
}

.auth-panel h1 {
    margin: 0 0 20px;
    font-size: 26px;
    color: var(--color-brand-navy);
}

.auth-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
}

.auth-brand h1,
.auth-brand p {
    margin: 0;
}

.auth-brand p {
    color: var(--muted);
}

.auth-visual {
    display: none;
}

.brand-mark {
    width: 36px;
    height: 36px;
    display: inline-grid;
    place-items: center;
    border-radius: 9px;
    background: var(--color-sky-blue);
    color: var(--color-surface-white);
    font-size: 20px;
    font-weight: 800;
    box-shadow: 0 6px 14px rgba(0, 163, 224, 0.24);
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 5;
    background: rgba(255, 255, 255, 0.96);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 3px 14px rgba(11, 25, 44, 0.05);
}

.topbar-inner {
    width: min(1180px, calc(100% - 32px));
    min-height: 64px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 22px;
}

.brand {
    font-weight: 700;
    text-decoration: none;
    color: var(--color-brand-navy);
    white-space: nowrap;
}

.brand > span:last-child {
    display: grid;
    gap: 1px;
}

.brand small {
    color: var(--muted);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.nav-links {
    display: flex;
    gap: 14px;
    flex: 1;
}

.nav-links a {
    color: var(--muted);
    text-decoration: none;
    font-weight: 700;
    padding: 21px 4px 18px;
    border-bottom: 3px solid transparent;
}

.nav-links a:hover {
    color: var(--color-sky-blue);
}

.nav-links a.is-active {
    color: var(--color-brand-navy);
    border-bottom-color: var(--color-sky-blue);
}

.nav-toggle {
    display: none;
}

.user-chip {
    width: 30px;
    height: 30px;
    display: inline-grid;
    place-items: center;
    border-radius: 50%;
    background: var(--color-sky-blue-light);
    color: var(--color-brand-navy-light);
    font-weight: 800;
}

.username {
    color: var(--color-brand-navy);
    font-weight: 700;
}

.logout-form {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--muted);
}

.page-shell {
    width: min(1180px, calc(100% - 32px));
    margin: 36px auto 64px;
}

.page-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 20px;
}

.page-heading h1 {
    margin: 0 0 6px;
    font-size: 30px;
    color: var(--color-brand-navy);
}

.eyebrow {
    display: block;
    margin-bottom: 6px;
    color: var(--color-sky-blue);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.page-heading p,
.muted {
    color: var(--muted);
    margin: 0;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 8px 14px;
    border: 1px solid transparent;
    border-radius: 7px;
    font: inherit;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    background: var(--surface);
    color: var(--text);
    white-space: nowrap;
    transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

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

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

.button-primary:hover {
    background: var(--color-brand-navy);
}

.button-secondary {
    border-color: var(--border);
    color: var(--text);
    background: var(--surface);
}

.button-danger {
    border-color: #f0b4ad;
    color: var(--danger);
}

.button-small {
    min-height: 32px;
    padding: 6px 10px;
    font-size: 13px;
}

.button:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.alert {
    padding: 12px 14px;
    border-radius: 6px;
    margin-bottom: 14px;
    border: 1px solid var(--border);
    background: var(--surface);
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.alert-close {
    border: 0;
    background: transparent;
    color: inherit;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}

.alert-success {
    border-color: #9fd2bd;
    background: #ecf8f2;
}

.alert-error {
    border-color: #efb2a8;
    background: #fff0ed;
}

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

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 18px;
    border-top: 3px solid var(--color-sky-blue);
    box-shadow: var(--shadow-soft);
}

.stat-total { border-top-color: var(--color-brand-navy-light); }
.stat-processing { border-top-color: var(--color-sky-blue); }
.stat-completed { border-top-color: var(--color-tricolor-green); }
.stat-failed { border-top-color: var(--color-tricolor-saffron); }

.stat-card span {
    display: block;
    color: var(--muted);
    margin-bottom: 10px;
}

.stat-card strong {
    font-size: 30px;
}

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

.panel,
.form-panel,
.table-panel {
    padding: 18px;
}

.form-panel-hero {
    border-top: 3px solid var(--color-sky-blue);
}

.panel-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}

.panel-heading h2 {
    margin: 0;
    font-size: 20px;
}

.compact-list {
    display: grid;
    gap: 10px;
}

.compact-item {
    display: grid;
    gap: 4px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    text-decoration: none;
    background: #fbfdff;
    transition: border-color 160ms ease, transform 160ms ease;
}

.compact-item:hover {
    border-color: var(--color-sky-blue);
    transform: translateX(2px);
}

.compact-item span,
.compact-item small,
.row-note {
    color: var(--muted);
}

.row-note {
    display: block;
    margin-top: 4px;
    max-width: 360px;
}

.actions-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.form-stack,
.issue-form {
    display: grid;
    gap: 16px;
}

label {
    display: grid;
    gap: 7px;
    font-weight: 700;
}

input,
textarea {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 10px 11px;
    font: inherit;
    color: var(--text);
    background: #ffffff;
    transition: border-color 160ms ease, box-shadow 160ms ease;
}

input:focus,
textarea:focus {
    outline: none;
    border-color: var(--color-sky-blue);
    box-shadow: 0 0 0 3px rgba(0, 163, 224, 0.14);
}

textarea {
    resize: vertical;
}

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

.section-editor {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    margin: 0 0 14px;
    display: grid;
    gap: 14px;
    background: #fbfdff;
}

.section-editor legend {
    font-weight: 700;
    padding: 0 6px;
}

.section-actions,
.sticky-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.sticky-actions {
    position: sticky;
    bottom: 0;
    padding: 14px 0;
    background: var(--bg);
}

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

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

th,
td {
    padding: 12px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: top;
}

th {
    color: var(--muted);
    font-size: 13px;
    background: var(--color-pale-sky);
}

tbody tr:hover {
    background: #fbfdff;
}

.empty-cell {
    color: var(--muted);
    text-align: center;
    padding: 28px;
}

.status {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    background: var(--surface-muted);
    color: var(--text);
}

.status-completed {
    background: #e7f6ee;
    color: #176146;
}

.status-processing,
.status-pending {
    background: #eaf2fb;
    color: var(--info);
}

.status-failed,
.status-ambiguous {
    background: #fff0ed;
    color: var(--danger);
}

.status-strip {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}

.status-strip div {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 14px;
    display: grid;
    gap: 8px;
}

.status-strip span {
    color: var(--muted);
    font-weight: 700;
}

.details-list {
    display: grid;
    gap: 12px;
    margin: 0 0 16px;
}

.details-list div {
    display: grid;
    gap: 4px;
}

.details-list dt {
    color: var(--muted);
    font-weight: 700;
}

.details-list dd {
    margin: 0;
    overflow-wrap: anywhere;
}

.section-list {
    display: grid;
    gap: 12px;
}

.section-summary {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr);
    gap: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 14px;
}

.section-summary h3 {
    margin: 0 0 6px;
}

.section-summary p {
    margin: 0 0 8px;
}

.section-summary small {
    display: block;
    margin-top: 8px;
    color: var(--muted);
    overflow-wrap: anywhere;
}

.position-pill {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: inline-grid;
    place-items: center;
    background: var(--color-sky-blue-light);
    color: var(--color-brand-navy-light);
    font-weight: 700;
}

.table-toolbar {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.search-field {
    flex: 1;
    max-width: 420px;
}

.filter-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.filter-pill {
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 7px 12px;
    background: var(--surface);
    color: var(--muted);
    font: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

.filter-pill:hover,
.filter-pill.is-active {
    border-color: var(--color-sky-blue);
    background: var(--color-sky-blue-light);
    color: var(--color-brand-navy-light);
}

@media (max-width: 800px) {
    .topbar-inner,
    .page-heading,
    .logout-form {
        align-items: stretch;
    }

    .topbar-inner,
    .page-heading {
        flex-direction: column;
        padding: 12px 0;
    }

    .nav-toggle {
        display: inline-flex;
        align-self: flex-end;
        flex-direction: column;
        gap: 4px;
        padding: 8px;
        border: 1px solid var(--border);
        border-radius: 6px;
        background: var(--surface);
    }

    .nav-toggle span {
        width: 20px;
        height: 2px;
        background: var(--color-brand-navy);
    }

    .nav-links {
        display: none;
        flex-direction: column;
        gap: 0;
    }

    .nav-links.is-open {
        display: flex;
    }

    .nav-links a {
        padding: 10px 4px;
    }

    .nav-links,
    .logout-form,
    .actions-row {
        flex-wrap: wrap;
    }

    .stats-grid,
    .content-grid,
    .field-grid,
    .status-strip {
        grid-template-columns: 1fr;
    }

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

    .search-field {
        max-width: none;
    }
}

