:root {
    --bg: #f5f7f8;
    --surface: #ffffff;
    --surface-strong: #eef4f3;
    --text: #17201f;
    --muted: #687575;
    --line: #d8e0df;
    --accent: #0f766e;
    --accent-strong: #0b5f58;
    --danger: #b42318;
    --danger-bg: #fff0ee;
    --success: #136f38;
    --success-bg: #eaf7ef;
    --shadow: 0 18px 48px rgba(18, 38, 36, 0.1);
}

* {
    box-sizing: border-box;
}

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

button,
input,
select,
textarea {
    font: inherit;
}

button {
    cursor: pointer;
}

a {
    color: inherit;
}

button:disabled {
    cursor: not-allowed;
    opacity: 0.45;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 28px clamp(18px, 4vw, 54px);
    border-bottom: 1px solid var(--line);
    background: var(--surface);
}

.topbar h1,
.section-heading h2,
.case-header h3 {
    margin: 0;
    letter-spacing: 0;
}

.topbar h1 {
    font-size: clamp(1.65rem, 3vw, 2.45rem);
    line-height: 1.1;
}

.eyebrow {
    margin: 0 0 4px;
    color: var(--accent);
    font-size: 0.74rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

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

.login-panel,
.section-block,
.case-card,
.notice {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.login-panel {
    width: min(430px, 100%);
    margin: 64px auto;
    padding: 26px;
}

.login-form,
.support-form,
.logout-form {
    margin: 0;
}

.section-block {
    padding: clamp(18px, 3vw, 28px);
    margin-bottom: 22px;
}

.section-heading,
.case-header,
.submit-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.section-heading {
    margin-bottom: 18px;
}

.case-card {
    padding: clamp(16px, 3vw, 24px);
    margin: 18px 0;
}

.case-card[hidden],
[hidden] {
    display: none !important;
}

.case-header {
    margin-bottom: 18px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--line);
}

.grid {
    display: grid;
    gap: 16px;
    margin-bottom: 16px;
}

.grid.two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid.three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.field {
    display: flex;
    flex-direction: column;
    gap: 7px;
    min-width: 0;
    margin-bottom: 16px;
}

.field label,
.field-label {
    margin: 0;
    color: #273332;
    font-size: 0.92rem;
    font-weight: 750;
}

.muted {
    color: var(--muted);
    font-weight: 600;
}

input,
select,
textarea {
    width: 100%;
    min-height: 44px;
    border: 1px solid #bdc9c7;
    border-radius: 6px;
    background: #fff;
    color: var(--text);
    padding: 10px 12px;
    outline: none;
}

textarea {
    min-height: 112px;
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.14);
}

.primary-button,
.secondary-button,
.ghost-button {
    min-height: 42px;
    border-radius: 6px;
    border: 1px solid transparent;
    padding: 10px 15px;
    font-weight: 800;
}

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

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

.secondary-button {
    background: var(--surface-strong);
    border-color: #b9cac7;
    color: var(--accent-strong);
}

.secondary-button:hover,
.ghost-button:hover {
    border-color: var(--accent);
}

.ghost-button {
    background: transparent;
    border-color: var(--line);
    color: var(--text);
}

.topbar-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.submit-row {
    justify-content: flex-end;
    padding-top: 6px;
}

.notice {
    padding: 16px 18px;
    margin-bottom: 20px;
    box-shadow: none;
}

.notice ul,
.notice p {
    margin: 8px 0 0;
}

.notice-error {
    background: var(--danger-bg);
    border-color: #f3b0aa;
    color: var(--danger);
}

.notice-success {
    background: var(--success-bg);
    border-color: #a8d9b9;
    color: var(--success);
}

.access-field {
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfdfc;
}

.picker-controls {
    display: grid;
    grid-template-columns: minmax(180px, 0.85fr) minmax(220px, 1.15fr) auto;
    gap: 10px;
    margin-bottom: 10px;
}

.picker-add {
    white-space: nowrap;
}

.selected-values {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 0;
}

.selection-chip {
    display: inline-flex;
    align-items: center;
    max-width: 100%;
    gap: 8px;
    border: 1px solid #a9c8c4;
    border-radius: 6px;
    background: #e7f4f2;
    color: #113f3a;
    padding: 5px 8px;
    font-size: 0.88rem;
    font-weight: 700;
}

.selection-chip button {
    width: 24px;
    height: 24px;
    border: 0;
    border-radius: 4px;
    background: #c9e5e1;
    color: #113f3a;
    font-size: 0.82rem;
    font-weight: 900;
    line-height: 1;
}

.picker-list {
    display: grid;
    gap: 6px;
    max-height: 248px;
    overflow: auto;
    margin-top: 10px;
    padding-right: 4px;
}

.picker-option {
    display: grid;
    grid-template-columns: 20px minmax(0, 1fr);
    gap: 10px;
    align-items: start;
    padding: 10px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: #fff;
}

.picker-option:hover {
    border-color: #bdd2cf;
}

.picker-option input {
    width: 18px;
    min-height: 18px;
    margin-top: 2px;
}

.picker-text {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.picker-text strong,
.picker-text small {
    overflow-wrap: anywhere;
}

.picker-text small,
.picker-status,
.empty-result {
    color: var(--muted);
    font-size: 0.86rem;
}

.picker-status,
.empty-result {
    margin: 8px 0 0;
}

.delete-scope {
    display: grid;
    gap: 10px;
    margin-bottom: 16px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfdfc;
}

.radio-row {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
    font-weight: 650;
}

.radio-row input {
    width: 18px;
    min-height: 18px;
}

@media (max-width: 820px) {
    .topbar,
    .section-heading,
    .case-header,
    .submit-row {
        align-items: stretch;
        flex-direction: column;
    }

    .grid.two,
    .grid.three,
    .picker-controls {
        grid-template-columns: 1fr;
    }

    .shell {
        width: min(100% - 20px, 1180px);
        margin-top: 18px;
    }

    .primary-button,
    .secondary-button,
    .ghost-button {
        width: 100%;
    }
}
