:root {
    color-scheme: light;
    --ink: #172026;
    --muted: #66717a;
    --panel: rgba(255, 255, 255, 0.86);
    --line: rgba(31, 45, 61, 0.13);
    --accent: #0e8f83;
    --accent-dark: #076a62;
    --danger: #b3261e;
    --danger-bg: #fff0ee;
    --shadow: 0 28px 80px rgba(27, 39, 51, 0.18);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    min-height: 100vh;
    margin: 0;
    color: var(--ink);
    background:
        radial-gradient(circle at 15% 20%, rgba(14, 143, 131, 0.18), transparent 30%),
        radial-gradient(circle at 85% 70%, rgba(230, 114, 67, 0.18), transparent 28%),
        linear-gradient(135deg, #f5f8f7 0%, #edf2f5 52%, #f7f0eb 100%);
}

.auth-shell,
.success-shell {
    min-height: 100vh;
    width: min(1120px, calc(100% - 32px));
    margin: 0 auto;
    display: grid;
    align-items: center;
    gap: 28px;
    padding: 32px 0;
}

.auth-shell {
    grid-template-columns: 1.05fr 0.95fr;
}

.brand-panel,
.auth-card,
.success-panel {
    border: 1px solid var(--line);
    background: var(--panel);
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
}

.brand-panel {
    min-height: 520px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 42px;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
}

.brand-panel::after {
    content: "";
    position: absolute;
    inset: auto 42px 42px auto;
    width: 180px;
    height: 180px;
    border: 28px solid rgba(14, 143, 131, 0.16);
    border-radius: 50%;
}

.brand-mark {
    width: 58px;
    height: 58px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: var(--ink);
    color: #fff;
    font-size: 26px;
    font-weight: 800;
}

.eyebrow {
    margin: 0 0 12px;
    color: var(--accent-dark);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}

h1,
h2,
p {
    margin-top: 0;
}

h1 {
    max-width: 620px;
    margin-bottom: 18px;
    font-size: clamp(38px, 6vw, 68px);
    line-height: 0.96;
}

h2 {
    margin-bottom: 0;
    font-size: 34px;
}

.lead {
    max-width: 520px;
    margin-bottom: 0;
    color: var(--muted);
    font-size: 18px;
    line-height: 1.6;
}

.auth-card {
    padding: 36px;
    border-radius: 8px;
}

.card-heading {
    margin-bottom: 28px;
}

.login-form {
    display: grid;
    gap: 18px;
}

label {
    display: grid;
    gap: 8px;
    color: #2d3942;
    font-size: 14px;
    font-weight: 700;
}

input {
    width: 100%;
    height: 54px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0 16px;
    color: var(--ink);
    background: rgba(255, 255, 255, 0.9);
    font: inherit;
    outline: none;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

input[type="checkbox"] {
    width: 18px;
    height: 18px;
    padding: 0;
    accent-color: var(--accent);
}

input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(14, 143, 131, 0.15);
}

button {
    width: 100%;
    height: 54px;
    border: 0;
    border-radius: 8px;
    color: #fff;
    background: linear-gradient(135deg, var(--accent), #1261a6);
    font: inherit;
    font-weight: 800;
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

button:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 30px rgba(14, 143, 131, 0.22);
}

.alert {
    margin-bottom: 18px;
    padding: 13px 14px;
    border: 1px solid rgba(179, 38, 30, 0.2);
    border-radius: 8px;
    color: var(--danger);
    background: var(--danger-bg);
    font-weight: 700;
}

.success-shell {
    place-items: center;
}

.success-panel {
    width: min(720px, 100%);
    padding: 48px;
    border-radius: 8px;
    text-align: center;
}

.success-panel h1 {
    max-width: none;
    margin-bottom: 16px;
    font-size: clamp(36px, 7vw, 64px);
}

.success-panel .lead {
    margin: 0 auto 30px;
}

.status-orbit {
    width: 104px;
    height: 104px;
    margin: 0 auto 28px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(14, 143, 131, 0.24);
    border-radius: 50%;
    background: rgba(14, 143, 131, 0.08);
}

.checkmark {
    width: 70px;
    height: 70px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: #fff;
    background: var(--accent);
    font-size: 36px;
    font-weight: 900;
}

.secondary-button {
    width: auto;
    min-width: 150px;
    padding: 0 24px;
    color: var(--ink);
    background: #fff;
    border: 1px solid var(--line);
}

.secondary-button:hover {
    box-shadow: 0 14px 30px rgba(27, 39, 51, 0.12);
}

.admin-shell {
    width: min(1800px, calc(100% - 32px));
    min-height: 100vh;
    margin: 0 auto;
    padding: 34px 0;
}

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

.admin-header h1 {
    margin-bottom: 0;
    font-size: clamp(34px, 5vw, 56px);
}

.users-counter {
    width: fit-content;
    margin-top: 14px;
    border: 1px solid rgba(14, 143, 131, 0.2);
    border-radius: 999px;
    padding: 8px 12px;
    color: var(--accent-dark);
    background: rgba(14, 143, 131, 0.1);
    font-size: 14px;
    font-weight: 900;
}

.admin-header form {
    flex: 0 0 auto;
}

.notice {
    margin-bottom: 16px;
    padding: 13px 14px;
    border: 1px solid rgba(14, 143, 131, 0.24);
    border-radius: 8px;
    color: var(--accent-dark);
    background: rgba(14, 143, 131, 0.1);
    font-weight: 800;
}

.settings-panel,
.admin-actions,
.table-panel {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
}

.settings-panel {
    display: grid;
    grid-template-columns: minmax(220px, 320px) 1fr;
    gap: 20px;
    align-items: start;
    margin-bottom: 20px;
    padding: 20px;
}

.settings-panel h2 {
    margin-bottom: 0;
    font-size: 24px;
}

.settings-form {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) minmax(180px, 280px) auto;
    gap: 14px;
    align-items: end;
}

.settings-form button {
    width: auto;
    min-width: 190px;
}

.admin-actions {
    display: grid;
    grid-template-columns: minmax(280px, 380px) auto minmax(360px, 520px);
    gap: 20px;
    align-items: start;
    margin-bottom: 20px;
    padding: 20px;
}

.create-panel summary,
.row-menu summary,
.export-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0 16px;
    color: var(--ink);
    background: #fff;
    font-weight: 800;
    text-decoration: none;
    cursor: pointer;
}

.create-panel[open] summary {
    margin-bottom: 16px;
}

.inline-form,
.import-form,
.file-picker {
    display: grid;
    gap: 14px;
}

.inline-form {
    grid-template-columns: 1fr;
    align-items: stretch;
    max-width: 320px;
}

.inline-form button,
.import-form button {
    height: 48px;
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 28px;
}

.file-picker {
    gap: 8px;
}

.file-picker > span:first-child {
    color: #2d3942;
    font-size: 14px;
    font-weight: 800;
}

.file-button {
    width: fit-content;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0 14px;
    color: var(--ink);
    background: #fff;
    font-size: 14px;
    font-weight: 800;
    cursor: pointer;
}

.file-button input {
    position: absolute;
    inline-size: 1px;
    block-size: 1px;
    opacity: 0;
    pointer-events: none;
}

.file-name {
    min-height: 22px;
    color: var(--muted);
    font-size: 14px;
    font-weight: 700;
    word-break: break-word;
}

.table-panel {
    overflow-x: auto;
    overflow-y: visible;
    max-width: 100%;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 1720px;
    table-layout: fixed;
}

th,
td {
    padding: 20px 18px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: middle;
    font-size: 14px;
    white-space: nowrap;
}

tbody tr {
    transition: background 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

tbody tr.is-editing {
    position: relative;
    z-index: 2;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 18px 42px rgba(27, 39, 51, 0.2);
    transform: translateY(-1px);
}

th {
    color: #47545e;
    background: rgba(255, 255, 255, 0.56);
    font-size: 12px;
    text-transform: uppercase;
}

.password-copy {
    display: inline-block;
    width: auto;
    height: auto;
    padding: 6px 9px;
    border: 0;
    border-radius: 6px;
    color: var(--ink);
    background: rgba(23, 32, 38, 0.07);
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
    white-space: nowrap;
    box-shadow: none;
}

.password-copy:hover,
.password-copy:focus {
    transform: none;
    background: rgba(14, 143, 131, 0.13);
    box-shadow: 0 0 0 3px rgba(14, 143, 131, 0.12);
}

.copy-tooltip {
    position: fixed;
    z-index: 80;
    border-radius: 8px;
    padding: 8px 10px;
    color: #fff;
    background: var(--ink);
    box-shadow: 0 12px 28px rgba(27, 39, 51, 0.2);
    font-size: 13px;
    font-weight: 800;
    pointer-events: none;
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.18s ease, transform 0.18s ease;
}

.copy-tooltip.is-hiding {
    opacity: 0;
    transform: translateY(4px);
}

th:nth-child(1),
td:nth-child(1) {
    width: 58px;
}

th:nth-child(2),
td:nth-child(2) {
    width: 64px;
}

th:nth-child(3),
td:nth-child(3) {
    width: 160px;
}

th:nth-child(4),
td:nth-child(4) {
    width: 280px;
}

th:nth-child(5),
td:nth-child(5) {
    width: 300px;
}

th:nth-child(6),
td:nth-child(6) {
    width: 190px;
}

th:nth-child(7),
td:nth-child(7) {
    width: 120px;
}

th:nth-child(8),
td:nth-child(8) {
    width: 120px;
}

th:nth-child(9),
td:nth-child(9) {
    width: 160px;
}

th:nth-child(10),
td:nth-child(10) {
    width: 150px;
}

th:nth-child(11),
td:nth-child(11) {
    width: 110px;
}

th:nth-child(12),
td:nth-child(12) {
    width: 130px;
}

.edit-field,
.edit-actions {
    display: none;
}

.edit-field {
    width: min(180px, 100%);
    height: 38px;
    padding: 0 10px;
    background: #fff;
}

.email-edit-field {
    width: min(240px, 100%);
}

.full-name-edit-field {
    width: min(240px, 100%);
}

tr.is-editing .read-value,
tr.is-editing .row-menu {
    display: none;
}

tr.is-editing .edit-field,
tr.is-editing .edit-actions {
    display: inline-grid;
}

.status {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    border-radius: 999px;
    padding: 0 10px;
    font-size: 12px;
    font-weight: 900;
}

.status-ok {
    color: #096b3f;
    background: rgba(11, 128, 76, 0.12);
}

.status-bad {
    color: #a91d15;
    background: rgba(179, 38, 30, 0.12);
}

.status-warn {
    color: #8a4d00;
    background: rgba(212, 132, 26, 0.16);
}

.status-neutral {
    color: #40505b;
    background: rgba(64, 80, 91, 0.1);
}

.row-menu {
    display: inline-flex;
}

.menu-toggle {
    min-height: 36px;
    height: 36px;
    width: auto;
    padding: 0 12px;
    color: var(--ink);
    background: #fff;
    border: 1px solid var(--line);
    font-size: 13px;
    box-shadow: none;
}

.menu-toggle:hover {
    transform: none;
    box-shadow: 0 10px 22px rgba(27, 39, 51, 0.1);
}

.menu-dropdown {
    position: fixed;
    z-index: 50;
    width: 250px;
    display: none;
    gap: 2px;
    padding: 6px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 18px 44px rgba(27, 39, 51, 0.16);
}

.row-menu.is-open .menu-dropdown,
.menu-dropdown.is-floating {
    display: grid;
}

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

.menu-dropdown button {
    height: 38px;
    border-radius: 6px;
    color: var(--ink);
    text-align: left;
    background: #fff;
    font-size: 13px;
    font-weight: 700;
    box-shadow: none;
}

.menu-dropdown button:hover {
    transform: none;
    box-shadow: none;
    background: #f0f3f4;
}

.edit-actions {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.edit-actions button {
    width: auto;
    height: 38px;
    padding: 0 12px;
    font-size: 13px;
}

.cancel-edit-button {
    color: var(--ink);
    background: #fff;
    border: 1px solid var(--line);
}

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

@media (max-width: 820px) {
    .auth-shell {
        grid-template-columns: 1fr;
    }

    .brand-panel {
        min-height: 340px;
        padding: 28px;
    }

    .auth-card,
    .success-panel {
        padding: 28px;
    }

    .admin-header,
    .admin-actions,
    .settings-panel,
    .settings-form,
    .inline-form {
        grid-template-columns: 1fr;
    }

    .admin-header {
        align-items: stretch;
        display: grid;
    }

    h1 {
        font-size: 42px;
    }
}
