
:root {
    color-scheme: dark;
    --navy: #071522;
    --navy-soft: #081923;
    --panel: #102535;
    --panel-hover: #132d3f;
    --gold: #c9a75d;
    --gold-soft: #dfc47f;
    --text: #f4f6f8;
    --muted: #afbbc5;
    --border: #29465a;
    --border-light: #446274;
    --danger: #ffb4ab;
    --danger-bg: #8d3333;
    --success: #7ee2a8;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --shadow-card: 0 24px 70px rgba(0, 0, 0, 0.45);
    --transition: 160ms ease;
}


/* =========================================================
   Base
   ========================================================= */

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    min-height: 100%;
}

html {
    background: var(--navy);
}

body {
    background: radial-gradient( circle at 15% 10%, #19394d 0, var(--navy) 48% );
    color: var(--text);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 15px;
    line-height: 1.5;
}


/* =========================================================
   Main Layout
   ========================================================= */

main {
    margin: 0;
    padding: 0;
}

.container {
    width: min(1120px, calc(100% - 20px));
    margin: 16px auto;
    padding: 0;
}

.full {
    width: 100%;
    height: calc(100vh - 62px);
    margin: 0;
    padding: 0;
}

.page-header {
    margin-bottom: 18px;
}

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

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


/* =========================================================
   Top Navigation
   ========================================================= */

.topbar {
    min-height: 62px;
    padding: 0 20px;
    background: rgba(8, 25, 35, 0.96);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    z-index: 20;
}

.topbar-inner {
    width: min(100%, 1400px);
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.brand {
    display: inline-flex;
    align-items: baseline;
    gap: 8px;
    color: var(--gold);
    font-weight: 800;
    letter-spacing: 0.08em;
    text-decoration: none;
    white-space: nowrap;
}

.brand-name {
    color: var(--gold);
}

.brand small {
    color: var(--muted);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0;
}

.topbar nav,
.main-nav {
    display: flex;
    align-items: center;
    gap: 18px;
}

    .topbar nav a,
    .link-button {
        color: var(--text);
        text-decoration: none;
        background: none;
        border: 0;
        padding: 6px 0;
        font: inherit;
        cursor: pointer;
        transition: color var(--transition), opacity var(--transition);
    }

        .topbar nav a:hover,
        .link-button:hover {
            color: var(--gold-soft);
        }

.topbar form {
    margin: 0;
}

.user-name {
    color: var(--muted);
    font-size: 14px;
}


/* =========================================================
   Typography
   ========================================================= */

h1,
h2,
h3 {
    margin-top: 0;
    color: var(--text);
    line-height: 1.2;
}

h1 {
    margin-bottom: 8px;
    font-size: clamp(28px, 4vw, 38px);
    letter-spacing: -0.025em;
}

h2 {
    margin-bottom: 14px;
    font-size: 21px;
}

h3 {
    margin: 22px 0 10px;
    font-size: 15px;
}

p {
    margin-top: 0;
}

.eyebrow {
    margin-bottom: 6px;
    color: var(--gold);
    font-size: 12px;
    font-weight: 750;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

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


/* =========================================================
   Cards
   ========================================================= */

.card {
    width: min(430px, 100%);
    background: rgba(16, 37, 53, 0.97);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 26px;
    box-shadow: var(--shadow-card);
}

    .card.wide,
    .wide {
        width: 100%;
    }

.card-header {
    margin-bottom: 18px;
}

    .card-header h2 {
        margin-bottom: 0;
    }

.create-user-card,
.temporary-password {
    margin-bottom: 18px;
}

.login-shell {
    min-height: calc(100vh - 134px);
    display: grid;
    place-items: center;
    padding: 24px 12px;
}


/* =========================================================
   Forms
   ========================================================= */

.form-fields {
    display: grid;
    gap: 2px;
}

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

label {
    display: block;
    margin: 12px 0 5px;
    color: var(--text);
    font-weight: 700;
}

input,
select {
    width: 100%;
    padding: 10px 11px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    background: var(--navy-soft);
    color: #fff;
    font: inherit;
    transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}

    input::placeholder {
        color: #81919d;
    }

    input:hover,
    select:hover {
        border-color: #5b7889;
    }

    input:focus,
    select:focus {
        outline: none;
        border-color: var(--gold);
        box-shadow: 0 0 0 2px rgba(201, 167, 93, 0.18);
    }

    input[readonly] {
        cursor: text;
        background: #0a1e2b;
    }

    input[type="file"] {
        padding: 8px;
    }

        input[type="file"]::file-selector-button {
            margin-right: 10px;
            border: 0;
            border-radius: 6px;
            padding: 7px 10px;
            background: var(--border);
            color: var(--text);
            font-weight: 700;
            cursor: pointer;
        }

.form-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 18px;
}


/* =========================================================
   Buttons
   ========================================================= */

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    border: 0;
    border-radius: var(--radius-sm);
    background: var(--gold);
    color: #101820;
    padding: 8px 14px;
    font: inherit;
    font-weight: 800;
    text-decoration: none;
    cursor: pointer;
    transition: transform var(--transition), background var(--transition), opacity var(--transition);
}

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

    .button:active {
        transform: translateY(0);
    }

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

        .button.danger:hover {
            background: #a83d3d;
        }

    .button.secondary {
        background: var(--border);
        color: #fff;
    }

        .button.secondary:hover {
            background: #36586d;
        }

.card .button {
    width: 100%;
    margin-top: 18px;
}


/* =========================================================
   Validation / Messages
   ========================================================= */

.validation-summary-errors,
.error {
    margin-bottom: 14px;
    color: var(--danger);
}

    .validation-summary-errors ul {
        margin: 0;
        padding-left: 20px;
    }

.field-validation-error {
    display: block;
    margin-top: 4px;
    color: var(--danger);
    font-size: 13px;
}

.success {
    padding: 11px 13px;
    border: 1px solid rgba(126, 226, 168, 0.25);
    border-radius: var(--radius-sm);
    background: rgba(126, 226, 168, 0.08);
    color: var(--success);
}


/* =========================================================
   Tables
   ========================================================= */

.table-wrapper {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--panel);
}

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

th {
    color: var(--gold);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    white-space: nowrap;
}

tbody tr:last-child td {
    border-bottom: 0;
}

tbody tr {
    transition: background var(--transition);
}

    tbody tr:hover {
        background: rgba(255, 255, 255, 0.025);
    }

td small {
    color: var(--muted);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}


/* =========================================================
   Actions
   ========================================================= */

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

    .actions form {
        margin: 0;
    }

    .actions .button {
        min-height: 33px;
        padding: 6px 9px;
    }


/* =========================================================
   Badges
   ========================================================= */

.badge {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 3px 9px;
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 999px;
    background: var(--border);
    color: var(--text);
    font-size: 12px;
    font-weight: 750;
}

    .badge.off {
        background: #5b2929;
        color: #ffd7d2;
    }


/* =========================================================
   Permission Management
   ========================================================= */

.permission-section {
    margin-top: 20px;
}

.permission-grid {
    display: grid;
    grid-template-columns: repeat( auto-fill, minmax(180px, 1fr) );
    gap: 7px;
}

    .permission-grid label {
        display: flex;
        align-items: center;
        gap: 9px;
        margin: 0;
        padding: 9px 10px;
        border: 1px solid var(--border);
        border-radius: var(--radius-sm);
        background: rgba(8, 25, 35, 0.55);
        font-size: 13px;
        font-weight: 600;
        cursor: pointer;
        transition: border-color var(--transition), background var(--transition);
    }

        .permission-grid label:hover {
            border-color: var(--border-light);
            background: rgba(255, 255, 255, 0.025);
        }

    .permission-grid input[type="checkbox"] {
        width: 16px;
        height: 16px;
        margin: 0;
        accent-color: var(--gold);
        cursor: pointer;
    }


/* =========================================================
   Document Content
   ========================================================= */

.content-section {
    margin-bottom: 22px;
}

.content-frame {
    display: block;
    width: 100%;
    min-height: 620px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: #fff;
    box-shadow: 0 16px 45px rgba(0, 0, 0, 0.28);
}

.version-history {
    margin-top: 24px;
}

.users-section,
.assignments-section {
    margin-top: 24px;
}


/* =========================================================
   Full-width Map
   ========================================================= */

.map {
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
    background: #fff;
}


/* =========================================================
   Links
   ========================================================= */

a {
    color: var(--gold-soft);
}

    a:hover {
        color: #f0d58f;
    }


    /* =========================================================
   Accessibility
   ========================================================= */

    button:focus-visible,
    a:focus-visible,
    input:focus-visible,
    select:focus-visible {
        outline: 2px solid var(--gold);
        outline-offset: 2px;
    }


/* =========================================================
   Responsive — Tablet / Mobile
   ========================================================= */

@media (max-width: 720px) {

    .container {
        width: calc(100% - 16px);
        margin: 10px auto;
        padding: 0;
    }

    .topbar {
        padding: 0 14px;
    }

    .topbar-inner {
        gap: 12px;
    }

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

    .toolbar {
        align-items: flex-start;
        flex-direction: column;
        gap: 10px;
        margin-bottom: 12px;
    }

        .toolbar > .actions {
            width: 100%;
        }

            .toolbar > .actions .button {
                flex: 1;
            }

    .brand small {
        display: none;
    }

    .topbar nav span,
    .user-name {
        display: none;
    }

    .topbar nav,
    .main-nav {
        gap: 12px;
    }

    .card {
        padding: 20px;
        border-radius: 14px;
    }

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

    .content-frame {
        min-height: 500px;
    }

    .table-wrapper {
        border-radius: var(--radius-sm);
    }
}


/* =========================================================
   Responsive — Small Mobile
   ========================================================= */

@media (max-width: 480px) {

    .container {
        width: calc(100% - 12px);
        margin: 8px auto;
    }

    h1 {
        font-size: 28px;
    }

    h2 {
        font-size: 19px;
    }

    .login-shell {
        padding: 18px 8px;
    }

    .card {
        padding: 17px;
    }

    .actions {
        width: 100%;
    }

        .actions .button,
        .actions form {
            flex: 1;
        }

            .actions form .button {
                width: 100%;
            }

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

        .form-actions .button {
            width: 100%;
        }

    th,
    td {
        padding: 9px 10px;
    }
}


