:root {
    color-scheme: light;
    --bg: #eef2f4;
    --panel: #ffffff;
    --panel-soft: #f6f8f9;
    --ink: #17212b;
    --muted: #667582;
    --line: #d7e0e5;
    --accent: #0f766e;
    --accent-dark: #115e59;
    --accent-soft: #e5f4f1;
    --danger: #b42318;
    --success: #047857;
    --shadow: 0 18px 42px rgba(23, 33, 43, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--ink);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
textarea,
input {
    font: inherit;
}

button {
    cursor: pointer;
}

.access-app {
    min-height: 100vh;
}

.access-topbar {
    height: 64px;
    padding: 0 22px;
    background: #111a22;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.back-link {
    color: #cbd5df;
    text-decoration: none;
    border: 1px solid rgba(203, 213, 223, 0.24);
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 750;
}

.back-link:hover {
    background: rgba(255, 255, 255, 0.06);
}

.access-brand {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.access-brand strong {
    font-size: 18px;
    letter-spacing: 0;
}

.access-brand span {
    color: #91a1ad;
    font-size: 12px;
}

.access-shell {
    width: min(1320px, calc(100% - 36px));
    margin: 18px auto 46px;
}

.generator-panel {
    display: grid;
    grid-template-columns: minmax(360px, 0.86fr) minmax(0, 1.14fr);
    gap: 18px;
    align-items: stretch;
}

.input-column,
.output-column,
.reference-panel {
    background: var(--panel);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
}

.input-column,
.output-column {
    padding: 22px;
    min-width: 0;
}

.panel-head {
    margin-bottom: 18px;
}

h1,
h2,
h3,
p {
    margin: 0;
    letter-spacing: 0;
}

h1 {
    font-size: 24px;
    line-height: 1.25;
}

h2 {
    font-size: 19px;
    line-height: 1.25;
}

h3 {
    font-size: 14px;
    margin-bottom: 8px;
}

.panel-head p,
.result-head p,
.message,
.reference-panel p {
    color: var(--muted);
    font-size: 13px;
}

.panel-head p {
    margin-top: 6px;
}

.field-label {
    display: block;
    margin: 0 0 7px;
    color: #344054;
    font-size: 13px;
    font-weight: 800;
}

textarea {
    width: 100%;
    min-height: 286px;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 13px;
    resize: vertical;
    outline: none;
    color: var(--ink);
    background: #fff;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 13px;
    line-height: 1.45;
}

input[type="number"] {
    width: 100%;
    height: 42px;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 0 12px;
    outline: none;
    color: var(--ink);
    background: #fff;
}

textarea:focus,
input[type="number"]:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.control-row {
    display: grid;
    grid-template-columns: 120px minmax(0, 1fr);
    gap: 14px;
    margin-top: 16px;
    align-items: end;
}

.mode-switch {
    height: 42px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    border: 1px solid var(--line);
    border-radius: 6px;
    overflow: hidden;
    background: #fff;
}

.mode-switch label {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    color: #344054;
    font-size: 13px;
    font-weight: 800;
}

.mode-switch label + label {
    border-left: 1px solid var(--line);
}

.mode-switch input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.mode-switch input:checked + span {
    background: var(--accent-soft);
    color: var(--accent-dark);
}

.mode-switch span {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.action-row {
    display: flex;
    gap: 10px;
    margin-top: 18px;
}

.primary-button,
.ghost-button {
    border-radius: 6px;
    min-height: 42px;
    padding: 0 15px;
    font-weight: 800;
}

.primary-button {
    background: var(--accent);
    border: 1px solid var(--accent);
    color: #fff;
}

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

.ghost-button {
    background: #fff;
    border: 1px solid var(--line);
    color: #344054;
}

.ghost-button:hover {
    background: var(--panel-soft);
}

.compact {
    min-height: 38px;
    white-space: nowrap;
}

.result-head {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: flex-start;
    margin-bottom: 14px;
}

.result-head > div {
    min-width: 0;
}

.result-head p {
    margin-top: 5px;
}

.message {
    min-height: 22px;
    margin-bottom: 12px;
}

.message.success {
    color: var(--success);
}

.message.error {
    color: var(--danger);
}

.result-table-wrap {
    border: 1px solid var(--line);
    overflow: auto;
    max-height: 450px;
}

.result-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 760px;
    font-size: 13px;
}

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

.result-table th {
    position: sticky;
    top: 0;
    background: #f9fbfc;
    color: #506171;
    font-weight: 850;
    z-index: 1;
}

.result-table td {
    color: #344054;
}

.result-table tr:last-child td {
    border-bottom: 0;
}

.email-cell {
    font-weight: 800;
    color: var(--ink);
    word-break: break-all;
}

.mode-chip {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent-dark);
    padding: 0 9px;
    font-size: 12px;
    font-weight: 850;
    white-space: nowrap;
}

.url-cell {
    max-width: 430px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12px;
    word-break: break-all;
    color: #1f2937;
}

.copy-button {
    min-height: 32px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
    color: #344054;
    padding: 0 10px;
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}

.copy-button:hover {
    background: var(--panel-soft);
}

.empty-row td {
    color: var(--muted);
    text-align: center;
    padding: 42px 12px;
}

.invalid-box {
    margin-top: 12px;
    color: var(--danger);
    font-size: 13px;
    line-height: 1.55;
}

.reference-panel {
    margin-top: 18px;
    padding: 0;
}

.reference-panel details {
    padding: 18px 22px;
}

.reference-panel summary {
    color: #344054;
    font-size: 14px;
    font-weight: 850;
    cursor: pointer;
}

.reference-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin: 18px 0 12px;
}

code {
    display: block;
    width: 100%;
    border: 1px solid var(--line);
    background: #f9fbfc;
    border-radius: 6px;
    padding: 10px;
    color: #344054;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12px;
    word-break: break-all;
}

.reference-panel p code {
    display: inline;
    padding: 2px 5px;
}

@media (max-width: 980px) {
    .generator-panel,
    .reference-grid {
        grid-template-columns: 1fr;
    }

    textarea {
        min-height: 220px;
        font-size: 16px;
    }
}

@media (max-width: 620px) {
    .access-topbar {
        padding: 0 12px;
    }

    .back-link {
        padding: 7px 9px;
    }

    .access-shell {
        width: min(100% - 20px, 1320px);
        margin-top: 10px;
    }

    .input-column,
    .output-column,
    .reference-panel details {
        padding: 16px;
    }

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

    .action-row {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .result-head {
        align-items: stretch;
        flex-direction: column;
    }

    .compact {
        width: 100%;
    }
}
