:root {
    color-scheme: light;
    --tshop-ink: #17231c;
    --tshop-muted: #667169;
    --tshop-canvas: #f4f1e9;
    --tshop-surface: #ffffff;
    --tshop-brand: #24573f;
    --tshop-brand-strong: #173d2b;
    --tshop-brand-soft: #e0ede4;
    --tshop-accent: #c38b45;
    --tshop-danger: #9f352d;
    --tshop-border: #d7ddd8;
    --tshop-focus: #157347;
    --tshop-shadow: 0 24px 70px rgba(28, 44, 34, .12);
    font-family: Tahoma, Arial, sans-serif;
}

* { box-sizing: border-box; }
html { min-width: 320px; max-width: 100%; overflow-x: hidden; }

body {
    margin: 0;
    width: 100%;
    max-width: 100%;
    min-height: 100vh;
    overflow-x: hidden;
    color: var(--tshop-ink);
    background: var(--tshop-canvas);
}

button, input { font: inherit; }
[hidden] { display: none !important; }

.skip-link {
    position: fixed;
    inset-block-start: .75rem;
    inset-inline-start: .75rem;
    z-index: 1000;
    padding: .7rem 1rem;
    border-radius: .5rem;
    color: #fff;
    background: var(--tshop-brand-strong);
    transform: translateY(-180%);
}

.skip-link:focus { transform: translateY(0); }
:focus-visible { outline: 3px solid var(--tshop-focus); outline-offset: 3px; }
.auth-shell {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    width: 100%;
    max-width: 100%;
    min-height: 100vh;
    overflow-x: clip;
}

.brand-panel {
    position: relative;
    display: grid;
    align-content: center;
    gap: 2rem;
    overflow: hidden;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    min-height: 18rem;
    padding: clamp(2rem, 7vw, 5rem);
    color: #fff;
    background: radial-gradient(circle at 12% 10%, rgba(195, 139, 69, .38), transparent 18rem), linear-gradient(145deg, #173d2b, #285f45);
}

.brand-panel > div { min-width: 0; }

.brand-panel::after {
    position: absolute;
    inset-inline-end: -5rem;
    inset-block-end: -7rem;
    width: 20rem;
    height: 20rem;
    border: 1px solid rgba(255, 255, 255, .14);
    border-radius: 50%;
    content: '';
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 3.5rem;
    height: 3.5rem;
    border: 1px solid rgba(255, 255, 255, .35);
    border-radius: 1rem;
    color: var(--tshop-brand-strong);
    background: #fff;
    font-size: 1.6rem;
    font-weight: 800;
    box-shadow: 0 12px 24px rgba(0, 0, 0, .18);
}

.eyebrow, .section-kicker { color: var(--tshop-accent); font-size: .86rem; font-weight: 800; letter-spacing: .02em; }
.brand-panel h1 { max-width: 100%; margin: .5rem 0 .75rem; overflow-wrap: anywhere; font-size: clamp(2.4rem, 10vw, 4.8rem); font-weight: 800; letter-spacing: -.06em; }
.brand-panel p { max-width: 38rem; margin: 0; color: rgba(255, 255, 255, .78); font-size: clamp(1rem, 2vw, 1.15rem); line-height: 1.9; }
.trust-list { display: grid; gap: .8rem; margin: 0; padding: 0; list-style: none; }
.trust-list li { display: flex; align-items: center; gap: .65rem; color: rgba(255, 255, 255, .86); }
.trust-list li::before { display: grid; flex: 0 0 1.35rem; place-items: center; width: 1.35rem; height: 1.35rem; border-radius: 50%; color: var(--tshop-brand-strong); background: #fff; content: '✓'; font-size: .75rem; font-weight: 900; }

.auth-panel {
    display: grid;
    place-items: center;
    align-content: center;
    gap: 1.5rem;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    padding: 1.25rem;
    background: radial-gradient(circle at 85% 8%, rgba(195, 139, 69, .13), transparent 20rem), var(--tshop-canvas);
}

.auth-card { width: min(100%, 30rem); max-width: 100%; min-width: 0; padding: clamp(1.35rem, 5vw, 2.5rem); border: 1px solid rgba(23, 35, 28, .08); border-radius: 1.5rem; background: rgba(255, 255, 255, .92); box-shadow: var(--tshop-shadow); }
.section-heading { margin-block-end: 1.75rem; }
.section-heading--center { text-align: center; }
.section-heading h2 { margin: .35rem 0 .5rem; font-size: clamp(1.65rem, 5vw, 2.15rem); font-weight: 800; letter-spacing: -.035em; }
.section-heading p { margin: 0; color: var(--tshop-muted); line-height: 1.75; }
.field-group { margin-block-end: 1.25rem; }
.form-label { margin-block-end: .5rem; font-weight: 700; }
.form-control { min-height: 3.25rem; border-color: var(--tshop-border); border-radius: .8rem; background: #fff; }
.form-control:focus { border-color: var(--tshop-brand); box-shadow: 0 0 0 .22rem rgba(36, 87, 63, .16); }
.form-text { color: var(--tshop-muted); font-size: .82rem; }
.label-row { display: flex; align-items: baseline; justify-content: space-between; gap: .75rem; }
.caps-warning { color: var(--tshop-danger); font-size: .75rem; }
.password-control { position: relative; min-width: 0; }
.password-control .form-control { width: 100%; min-width: 0; padding-inline-end: 3.75rem; }
.password-toggle { position: absolute; inset-block: .25rem; inset-inline-end: .25rem; display: grid; place-items: center; width: 2.75rem; min-width: 2.75rem; min-height: 2.75rem; padding: 0; border: 0; border-radius: .6rem; color: var(--tshop-brand); background: var(--tshop-brand-soft); }
.password-toggle:hover { color: #fff; background: var(--tshop-brand); }
.password-icon { width: 1.35rem; height: 1.35rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.submit-button { display: inline-flex; align-items: center; justify-content: center; gap: .65rem; width: 100%; min-height: 3.25rem; border-radius: .8rem; font-weight: 800; }
.btn-success { --bs-btn-bg: var(--tshop-brand); --bs-btn-border-color: var(--tshop-brand); --bs-btn-hover-bg: var(--tshop-brand-strong); --bs-btn-hover-border-color: var(--tshop-brand-strong); }
.alert { border: 0; border-radius: .8rem; line-height: 1.65; }
.state-view { display: flex; align-items: center; justify-content: center; gap: .8rem; min-height: 12rem; color: var(--tshop-muted); }
.success-icon { display: grid; place-items: center; width: 4rem; height: 4rem; margin: 0 auto 1.25rem; border-radius: 50%; color: #fff; background: var(--tshop-brand); font-size: 1.8rem; font-weight: 900; }
footer { color: var(--tshop-muted); font-size: .8rem; text-align: center; }

.is-authenticated .auth-shell { display: block; }
.is-authenticated .brand-panel { display: none; }
.is-authenticated .auth-panel { min-height: 100vh; place-items: stretch; align-content: start; padding: clamp(1rem, 3vw, 2.5rem); }
.is-authenticated .auth-card { width: min(100%, 78rem); max-width: 78rem; margin-inline: auto; padding: clamp(1rem, 3vw, 2rem); }
.is-authenticated footer { margin-block-start: 1.25rem; }

.workspace-header, .workspace-section__heading, .users-toolbar, .workspace-meta, .dialog-header, .dialog-actions {
    display: flex;
    align-items: center;
}
.workspace-header, .workspace-section__heading, .workspace-meta, .dialog-header { justify-content: space-between; }
.workspace-header { gap: 1rem; padding-block-end: 1.5rem; border-block-end: 1px solid var(--tshop-border); }
.workspace-header h2, .workspace-section h3, .dialog-header h2 { margin: .3rem 0; font-weight: 800; }
.workspace-header p, .workspace-section__heading p { margin: 0; color: var(--tshop-muted); }
.workspace-section { padding-block-start: 1.75rem; }
.workspace-section__heading { gap: 1rem; }
.users-toolbar { flex-wrap: wrap; gap: .75rem; margin-block: 1.25rem; padding: 1rem; border-radius: 1rem; background: var(--tshop-brand-soft); }
.users-toolbar .form-control { flex: 1 1 18rem; }
.users-toolbar .form-select { flex: 0 1 11rem; min-height: 3.25rem; border-color: var(--tshop-border); border-radius: .8rem; }
.workspace-meta { gap: 1rem; margin-block-end: .75rem; color: var(--tshop-muted); font-size: .85rem; }
.users-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 19rem), 1fr)); gap: 1rem; }
.user-card { display: grid; gap: 1rem; min-width: 0; padding: 1.15rem; border: 1px solid var(--tshop-border); border-radius: 1rem; background: #fff; }
.user-card__header { display: flex; align-items: flex-start; justify-content: space-between; gap: .75rem; }
.user-card__header h4 { margin: 0; font-size: 1.05rem; font-weight: 800; overflow-wrap: anywhere; }
.user-card__username { margin: .25rem 0 0; color: var(--tshop-muted); direction: ltr; text-align: right; overflow-wrap: anywhere; }
.status-badge, .access-chip { display: inline-flex; align-items: center; width: fit-content; border-radius: 999px; font-size: .75rem; font-weight: 800; }
.status-badge { padding: .35rem .65rem; }
.status-badge--active { color: #14532d; background: #dcfce7; }
.status-badge--inactive { color: #7f1d1d; background: #fee2e2; }
.user-card__access { display: grid; gap: .6rem; }
.access-row { display: grid; gap: .4rem; }
.access-row__label { color: var(--tshop-muted); font-size: .75rem; font-weight: 800; }
.access-chips { display: flex; flex-wrap: wrap; gap: .35rem; }
.access-chip { padding: .25rem .55rem; color: var(--tshop-brand-strong); background: var(--tshop-brand-soft); }
.user-card__meta { color: var(--tshop-muted); font-size: .78rem; }
.user-card__actions { display: flex; flex-wrap: wrap; gap: .45rem; padding-block-start: .85rem; border-block-start: 1px solid var(--tshop-border); }
.user-card__actions .btn { min-height: 2.75rem; }
.empty-state { margin-block: 1rem; padding: 2rem 1rem; border: 1px dashed var(--tshop-border); border-radius: 1rem; color: var(--tshop-muted); text-align: center; background: rgba(255, 255, 255, .6); }

.app-dialog { width: min(calc(100% - 2rem), 46rem); max-height: calc(100vh - 2rem); padding: 0; border: 0; border-radius: 1.25rem; color: var(--tshop-ink); background: #fff; box-shadow: 0 28px 90px rgba(0, 0, 0, .28); }
.app-dialog::backdrop { background: rgba(15, 25, 19, .62); backdrop-filter: blur(3px); }
.app-dialog form { padding: clamp(1rem, 4vw, 2rem); }
.app-dialog--compact { max-width: 32rem; }
.dialog-header { gap: 1rem; margin-block-end: 1.25rem; }
.dialog-close { display: grid; flex: 0 0 2.75rem; place-items: center; width: 2.75rem; height: 2.75rem; padding: 0; border: 0; border-radius: .7rem; color: var(--tshop-ink); background: var(--tshop-canvas); font-size: 1.5rem; }
.dialog-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.dialog-grid__full { grid-column: 1 / -1; }
.dialog-grid fieldset { min-width: 0; padding: 1rem; border: 1px solid var(--tshop-border); border-radius: .9rem; }
.dialog-grid legend { float: none; width: auto; margin: 0 0 .75rem; padding: 0 .25rem; font-size: .9rem; font-weight: 800; }
.choice-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: .6rem; }
.choice-item { display: flex; align-items: center; gap: .55rem; min-height: 2.75rem; padding: .6rem .75rem; border: 1px solid var(--tshop-border); border-radius: .7rem; }
.choice-item input { width: 1.15rem; height: 1.15rem; }
.scope-target-group { margin-block-start: 1rem; }
.scope-target-group .form-select { min-height: 8rem; }
.dialog-actions { justify-content: flex-end; flex-wrap: wrap; gap: .75rem; margin-block-start: 1.5rem; padding-block-start: 1rem; border-block-start: 1px solid var(--tshop-border); }
.dialog-actions .btn { min-height: 2.75rem; }
.dialog-context { color: var(--tshop-muted); }

@media (min-width: 768px) {
    .auth-panel { padding: 2.5rem; }
    .auth-card { border-radius: 1.75rem; }
}

@media (min-width: 992px) {
    .auth-shell { grid-template-columns: minmax(24rem, 46%) minmax(32rem, 54%); }
    .brand-panel { min-height: 100vh; }
    .trust-list { margin-block-start: 2rem; }
}

@media (max-width: 575.98px) {
    .brand-panel { gap: 1.25rem; min-height: 15rem; padding: 1.5rem; }
    .brand-mark { width: 3rem; height: 3rem; }
    .brand-panel h1 { font-size: clamp(2.1rem, 13vw, 3.15rem); letter-spacing: -.04em; }
    .trust-list { display: none; }
    .auth-panel { place-items: stretch; padding: 1rem; }
    .auth-card { width: 100%; padding: 1.25rem; border-radius: 1.1rem; box-shadow: 0 12px 34px rgba(28, 44, 34, .1); }
    .is-authenticated .auth-panel { padding: .75rem; }
    .is-authenticated .auth-card { padding: 1rem; }
    .workspace-header, .workspace-section__heading { align-items: stretch; flex-direction: column; }
    .workspace-header .btn, .workspace-section__heading .btn { width: 100%; min-height: 2.75rem; }
    .users-toolbar { align-items: stretch; flex-direction: column; }
    .users-toolbar .form-control, .users-toolbar .form-select, .users-toolbar .btn { flex: auto; width: 100%; }
    .dialog-grid { grid-template-columns: minmax(0, 1fr); }
    .dialog-grid__full { grid-column: auto; }
    .app-dialog { width: calc(100% - 1rem); max-height: calc(100vh - 1rem); }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}

@media (forced-colors: active) {
    .brand-mark, .success-icon, .trust-list li::before { border: 1px solid CanvasText; }
}
