:root {
    --bg-top: #f7f2e9;
    --bg-bottom: #edf3ef;
    --panel: rgba(255, 255, 255, 0.82);
    --panel-strong: #ffffff;
    --text: #152033;
    --muted: #5d6875;
    --accent: #147a6f;
    --accent-deep: #113856;
    --line: rgba(21, 32, 51, 0.12);
    --shadow: 0 20px 48px rgba(21, 32, 51, 0.1);
    --radius-lg: 0px;
    --radius-md: 0px;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-family: "Avenir Next", "Trebuchet MS", sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(20, 122, 111, 0.18), transparent 32%),
        linear-gradient(180deg, var(--bg-top) 0%, var(--bg-bottom) 100%);
}

a {
    color: inherit;
    text-decoration: none;
}

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

.shell {
    width: min(1280px, calc(100% - 2rem));
    margin: 0 auto;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 10;
    border-bottom: 1px solid var(--line);
    background: rgba(247, 242, 233, 0.82);
    backdrop-filter: blur(18px);
}

.header-stack {
    display: grid;
    gap: 0.8rem;
    padding: 0.95rem 0 0.85rem;
}

.nav-shell {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.brand-mark {
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(17, 56, 86, 0.16);
    border-radius: 0;
    color: #ffffff;
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    background: linear-gradient(135deg, var(--accent-deep), var(--accent));
    box-shadow: 0 12px 24px rgba(20, 122, 111, 0.22);
}

.brand-copy {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.brand-copy strong {
    font-size: 0.94rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.brand-copy small {
    color: var(--muted);
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.site-nav,
.site-subnav {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    flex-wrap: wrap;
    padding: 0.45rem;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.56);
}

.site-nav {
    justify-content: flex-end;
}

.subnav-shell {
    display: flex;
    justify-content: flex-end;
}

.site-subnav {
    width: 100%;
    justify-content: flex-start;
}

.nav-link,
.subnav-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0.7rem 0.95rem;
    border: 1px solid var(--line);
    border-radius: 0;
    background: rgba(255, 255, 255, 0.86);
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    line-height: 1;
    text-transform: uppercase;
    transition: background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

.nav-link:hover,
.nav-link.is-active,
.subnav-link:hover,
.subnav-link.is-active {
    color: var(--text);
    border-color: rgba(20, 122, 111, 0.32);
    background: rgba(20, 122, 111, 0.12);
}

.page-shell {
    flex: 1;
    padding: clamp(2rem, 5vw, 4rem) 0 4rem;
}

.stack-xl {
    display: grid;
    gap: 1.5rem;
}

.stack-md {
    display: grid;
    gap: 1rem;
}

.hero-grid,
.auth-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.85fr);
    gap: 1.5rem;
    align-items: start;
}

.card {
    border: 1px solid rgba(255, 255, 255, 0.55);
    border-radius: var(--radius-lg);
    background: var(--panel);
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
}

.hero-card,
.summary-card,
.form-card,
.side-card {
    padding: clamp(1.6rem, 4vw, 2.3rem);
}

.eyebrow {
    margin: 0 0 0.75rem;
    color: var(--accent);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

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

h1 {
    font-size: clamp(2.1rem, 5.2vw, 4.4rem);
    line-height: 0.98;
    letter-spacing: -0.04em;
    margin-bottom: 1rem;
}

h2 {
    font-size: clamp(1.45rem, 3vw, 2rem);
    line-height: 1.1;
    margin-bottom: 0.8rem;
}

h3 {
    font-size: 1.2rem;
    margin-bottom: 0.65rem;
}

.lead,
.feature-card p,
.helper-copy,
.site-footer p {
    color: var(--muted);
    line-height: 1.7;
}

.button-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.9rem;
    margin-top: 1.6rem;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 50px;
    padding: 0.85rem 1.25rem;
    border: 1px solid transparent;
    border-radius: 0;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.button:hover {
    transform: translateY(-1px);
}

.button-primary {
    color: #ffffff;
    background: linear-gradient(135deg, var(--accent-deep), var(--accent));
    box-shadow: 0 14px 28px rgba(20, 122, 111, 0.24);
}

.button-secondary {
    color: var(--text);
    background: var(--panel-strong);
    border: 1px solid var(--line);
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}

.feature-card {
    padding: 1.45rem;
}

.card-index {
    margin-bottom: 0.8rem;
    color: var(--accent);
    font-size: 0.88rem;
    font-weight: 800;
    letter-spacing: 0.14em;
}

.detail-list,
.compact-list {
    display: grid;
    gap: 0.9rem;
    margin: 0;
}

.detail-list div,
.compact-list div {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    padding-bottom: 0.8rem;
    border-bottom: 1px solid var(--line);
}

.detail-list dt,
.compact-list dt {
    color: var(--muted);
}

.detail-list dd,
.compact-list dd {
    margin: 0;
    text-align: right;
    font-weight: 700;
}

.field-group {
    display: grid;
    gap: 0.45rem;
}

.field-group label {
    font-weight: 700;
}

.field-group input {
    min-height: 52px;
    padding: 0.85rem 1rem;
    color: var(--text);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.88);
}

.field-group select {
    min-height: 52px;
    padding: 0.85rem 1rem;
    color: var(--text);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.88);
}

.field-group textarea {
    min-height: 160px;
    padding: 0.85rem 1rem;
    color: var(--text);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.88);
    resize: vertical;
}

.field-group input:focus {
    outline: none;
    border-color: rgba(20, 122, 111, 0.5);
    box-shadow: 0 0 0 4px rgba(20, 122, 111, 0.12);
}

.field-group select:focus {
    outline: none;
    border-color: rgba(20, 122, 111, 0.5);
    box-shadow: 0 0 0 4px rgba(20, 122, 111, 0.12);
}

.field-group textarea:focus {
    outline: none;
    border-color: rgba(20, 122, 111, 0.5);
    box-shadow: 0 0 0 4px rgba(20, 122, 111, 0.12);
}

.field-hint {
    margin: 0;
    color: var(--muted);
    font-size: 0.92rem;
}

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

.checkbox-field {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 700;
}

.checkbox-field input {
    width: 18px;
    height: 18px;
    min-height: 18px;
    margin: 0;
}

.alert {
    margin-bottom: 1rem;
    padding: 0.9rem 1rem;
    border-radius: var(--radius-md);
}

.alert-error {
    color: #7f2027;
    border: 1px solid rgba(165, 56, 60, 0.2);
    background: rgba(165, 56, 60, 0.1);
}

.alert-success {
    color: #17524a;
    border: 1px solid rgba(20, 122, 111, 0.18);
    background: rgba(20, 122, 111, 0.1);
}

.text-link {
    color: var(--accent-deep);
    font-weight: 700;
}

.code-panel {
    margin-top: 1rem;
    padding: 1rem;
    overflow-x: auto;
    border-radius: var(--radius-md);
    background: #102636;
    color: #dff5ee;
    font-family: "SFMono-Regular", Consolas, monospace;
    font-size: 0.92rem;
    line-height: 1.6;
}

.qr-setup-panel {
    margin-bottom: 1.4rem;
}

.qr-code-frame {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 244px;
    min-height: 244px;
    padding: 0.75rem;
    border: 1px solid var(--line);
    border-radius: 0;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.qr-code-surface {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 220px;
    height: 220px;
    border-radius: 0;
    overflow: hidden;
    background: #ffffff;
}

.qr-code-surface img,
.qr-code-surface canvas {
    display: block;
}

.qr-status {
    margin: 0.85rem 0 0;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}

.stat-card,
.table-card,
.editor-card {
    padding: clamp(1.45rem, 4vw, 2rem);
}

.table-card {
    padding: clamp(1.8rem, 4vw, 2.5rem);
    width: 100%;
    max-width: none;
}

.stat-value {
    margin-bottom: 0.4rem;
    font-size: clamp(2rem, 3vw, 2.6rem);
    font-weight: 800;
    line-height: 1;
}

.dashboard-grid {
    display: block;
    width: 100%;
    gap: 1.5rem;
}

.dashboard-grid > * {
    width: 100%;
    min-width: 0;
}

.section-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.2rem;
}

.section-actions,
.form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.admin-form-grid,
.meta-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.5rem;
}

.meta-card {
    padding: clamp(1.45rem, 4vw, 1.9rem);
}

.meta-value {
    margin-bottom: 0;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.6;
}

.meta-code {
    word-break: break-word;
    font-family: "SFMono-Regular", Consolas, monospace;
    font-size: 0.9rem;
}

.table-responsive {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 0.9rem 0.75rem;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: middle;
}

.data-table th {
    color: var(--muted);
    font-size: 0.88rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.table-subcopy {
    margin: 0.25rem 0 0;
    color: var(--muted);
    font-size: 0.9rem;
}

.data-table tbody tr.is-selected {
    background: rgba(20, 122, 111, 0.08);
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.35rem 0.7rem;
    border-radius: 0;
    font-size: 0.82rem;
    font-weight: 700;
}

.badge-admin,
.badge-system-admin {
    color: #113856;
    background: rgba(17, 56, 86, 0.12);
}

.badge-manager {
    color: #7a4a00;
    background: rgba(196, 124, 0, 0.16);
}

.badge-staff {
    color: #147a6f;
    background: rgba(20, 122, 111, 0.12);
}

.badge-company-role {
    color: #5b3a12;
    background: rgba(176, 122, 41, 0.16);
}

.badge-active {
    color: #17524a;
    background: rgba(20, 122, 111, 0.12);
}

.badge-inactive,
.badge-invited {
    color: #7a4a00;
    background: rgba(196, 124, 0, 0.16);
}

.badge-suspended,
.badge-locked {
    color: #7f2027;
    background: rgba(165, 56, 60, 0.12);
}

.badge-disabled {
    color: #7f2027;
    background: rgba(165, 56, 60, 0.12);
}

.site-footer {
    padding-bottom: 1.5rem;
}

.footer-shell {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding-top: 1.3rem;
    border-top: 1px solid var(--line);
}

.site-footer p {
    margin-bottom: 0;
}

@media (max-width: 900px) {
    .nav-shell,
    .footer-shell {
        flex-direction: column;
        align-items: flex-start;
    }

    .site-nav,
    .site-subnav,
    .subnav-shell {
        justify-content: flex-start;
        width: 100%;
    }

    .hero-grid,
    .auth-grid,
    .feature-grid,
    .dashboard-grid,
    .stat-grid,
    .admin-form-grid,
    .meta-grid {
        grid-template-columns: 1fr;
    }

    .section-heading {
        flex-direction: column;
    }

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

@media (max-width: 640px) {
    .button-row,
    .site-nav,
    .site-subnav {
        width: 100%;
    }

    .button {
        width: 100%;
    }

    .detail-list div,
    .compact-list div {
        flex-direction: column;
        align-items: flex-start;
    }

    .detail-list dd,
    .compact-list dd {
        text-align: left;
    }

    .qr-code-frame {
        width: 100%;
        min-width: 0;
    }
}