:root {
    --ink: #102a33;
    --navy: #0b3a4a;
    --turquoise: #006b75;
    --violet: #5a3d7a;
    --gold: #c49a3a;
    --rose: #9e3f67;
    --paper: #f3f8f9;
    --white: #ffffff;
    --border: #6f8f98;
    --navigation-blue: #0b3a67;
    --selected-yellow: #ffd84d;
    --error: #8f1537;
    --success: #17633a;
    --shadow: 0 1rem 3rem rgba(11, 58, 74, 0.12);
}

* { box-sizing: border-box; }

html { color-scheme: light; }

body {
    margin: 0;
    color: var(--ink);
    background: var(--paper);
    font-family: Karla, system-ui, -apple-system, "Segoe UI", sans-serif;
    font-size: 1rem;
    line-height: 1.6;
}

a { color: var(--turquoise); text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 0.16em; }

h1, h2, h3, .brand {
    color: var(--navy);
    font-family: Fraunces, Georgia, serif;
    line-height: 1.15;
}

h1 { margin: 0 0 0.75rem; font-size: clamp(2rem, 5vw, 3.25rem); }
h2 { margin-top: 0; font-size: clamp(1.45rem, 3vw, 2rem); }
h3 { font-size: 1.2rem; }

.shell { width: min(72rem, calc(100% - 2rem)); margin-inline: auto; }
.skip-link { position: absolute; left: 1rem; top: -10rem; z-index: 100; padding: 0.75rem 1rem; background: var(--white); color: var(--navy); border: 0.2rem solid var(--gold); }
.skip-link:focus { top: 1rem; }

.site-header { color: var(--white); background: var(--navigation-blue); border-bottom: 0.25rem solid var(--selected-yellow); }
.header-inner { min-height: 6.5rem; display: flex; gap: 1.5rem; align-items: center; justify-content: space-between; }
.brand { margin: 0; font-size: clamp(1.45rem, 4vw, 2rem); font-weight: 700; }
.site-header .brand { color: var(--white); }
.brand-subtitle { margin: 0; color: var(--selected-yellow); font-size: 0.82rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; }
.environment-label { margin: 0; padding: 0.35rem 0.7rem; color: var(--ink); background: var(--selected-yellow); border: 0.125rem solid var(--ink); border-radius: 100vmax; font-weight: 700; }

.main-content { min-height: calc(100vh - 12rem); padding-block: clamp(2rem, 6vw, 5rem); }
.site-footer { padding-block: 1rem 2rem; text-align: center; }
.site-footer p { margin: 0; }

.auth-card, .panel {
    width: min(100%, 43rem);
    margin-inline: auto;
    padding: clamp(1.25rem, 4vw, 2.5rem);
    background: var(--white);
    border: 0.1rem solid var(--border);
    border-radius: 1rem;
    box-shadow: var(--shadow);
}
.auth-card-wide { width: min(100%, 52rem); }
.auth-card-extra-wide { width: min(100%, 64rem); }
.panel { width: 100%; margin-top: 1.5rem; }
.eyebrow { margin: 0 0 0.5rem; color: var(--turquoise); font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; }

.form-stack { display: grid; gap: 1.25rem; margin-top: 1.5rem; }
.form-compact { max-width: 40rem; }
.form-section { display: grid; gap: 1rem; margin: 0; padding: 1.25rem; border: 0.1rem solid var(--border); border-radius: 0.75rem; }
.form-section legend { padding-inline: 0.5rem; color: var(--navy); font-family: Fraunces, Georgia, serif; font-size: 1.35rem; font-weight: 600; }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.field-grid-three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.choice-list { display: grid; gap: 0.55rem; }
.offer-section { border-left: 0.35rem solid var(--gold); background: #fffdf8; }
.field { display: grid; gap: 0.35rem; }
label { font-weight: 700; }
input, select, textarea {
    width: 100%;
    min-height: 3rem;
    padding: 0.65rem 0.8rem;
    color: var(--ink);
    background: var(--white);
    border: 0.125rem solid #68838a;
    border-radius: 0.4rem;
    font: inherit;
}
input[aria-invalid="true"] { border-color: var(--error); }
select[aria-invalid="true"] { border-color: var(--error); }
textarea[aria-invalid="true"] { border-color: var(--error); }
textarea { resize: vertical; }
.check-row { display: flex; gap: 0.65rem; align-items: flex-start; }
.check-row input { width: 1.35rem; min-height: 1.35rem; margin-top: 0.2rem; }
.field-help { margin: 0; color: #3e5960; }
.field-error { margin: 0; color: var(--error); font-weight: 700; }

.button {
    display: inline-flex;
    width: fit-content;
    min-height: 2.9rem;
    align-items: center;
    justify-content: center;
    padding: 0.65rem 1.1rem;
    border: 0.125rem solid transparent;
    border-radius: 0.5rem;
    font: inherit;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
}
.button-primary { color: var(--white); background: var(--turquoise); }
.button-secondary { color: var(--navy); background: var(--white); border-color: var(--navy); }
.button-danger { color: var(--white); background: var(--error); }
.button:hover { filter: brightness(0.9); }

.site-nav { border-top: 0.1rem solid rgba(255, 255, 255, 0.55); background: var(--navigation-blue); }
.nav-inner { display: flex; gap: 0.35rem 1.25rem; align-items: center; flex-wrap: wrap; padding-block: 0.65rem; }
.site-nav a, .nav-button {
    padding: 0.5rem 0.7rem;
    color: var(--white);
    background: transparent;
    border: 0.15rem solid transparent;
    border-radius: 0.4rem;
    font: inherit;
    font-weight: 700;
    text-decoration: none;
}
.site-nav a:hover, .nav-button:hover { border-color: var(--selected-yellow); text-decoration: underline; text-decoration-thickness: 0.14rem; }
.site-nav a[aria-current="page"] {
    color: var(--ink);
    background: var(--selected-yellow);
    border-color: var(--ink);
    font-weight: 800;
    text-decoration: underline;
    text-decoration-thickness: 0.14rem;
}
.nav-inner form { margin-left: auto; }
.nav-button { cursor: pointer; }

:focus-visible { outline: 0.2rem solid var(--navigation-blue); outline-offset: 0.2rem; }
.site-nav a:focus-visible, .nav-button:focus-visible { outline-color: var(--selected-yellow); box-shadow: 0 0 0 0.12rem var(--navigation-blue); }
.site-nav a[aria-current="page"]:focus-visible { outline-color: var(--ink); box-shadow: 0 0 0 0.15rem var(--white); }

.notice, .error-summary { margin-block: 1.25rem; padding: 1rem; border-left: 0.35rem solid var(--violet); background: #f2edf7; }
.notice-success { border-color: var(--success); background: #eaf6ee; }
.notice-error, .error-summary { border-color: var(--error); background: #fff0f3; }
.error-summary h2, .error-summary h3 { margin-bottom: 0.4rem; color: var(--error); }
.error-summary p, .error-summary ul { margin-block: 0.3rem; }
.separator { display: flex; align-items: center; gap: 0.8rem; margin: 0; color: #49636a; }
.separator::before, .separator::after { content: ""; height: 0.1rem; flex: 1; background: var(--border); }

.page-heading { display: flex; gap: 1.5rem; align-items: flex-start; justify-content: space-between; }
.page-heading p { margin-bottom: 0; }
.heading-actions { display: flex; gap: 0.75rem; flex-wrap: wrap; justify-content: flex-end; }
.details-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; margin-block: 1.5rem; }
.details-list div { padding: 0.85rem; background: var(--paper); border-radius: 0.5rem; }
.details-list dt { font-weight: 700; }
.details-list dd { margin: 0.2rem 0 0; overflow-wrap: anywhere; }
.feature-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.8rem; }
.feature-list li { display: flex; gap: 1rem; justify-content: space-between; padding-bottom: 0.8rem; border-bottom: 0.1rem solid var(--border); }
.feature-list span { color: var(--violet); font-weight: 700; text-align: right; }
.breadcrumb { margin-bottom: 1.5rem; }
.qr-code { width: fit-content; max-width: 100%; padding: 1rem; background: var(--white); border: 0.1rem solid var(--border); overflow: auto; }
.qr-code svg { max-width: 18rem; height: auto; }
.secret-code, .recovery-codes code { overflow-wrap: anywhere; font-size: 1rem; }
.recovery-codes { columns: 2; }
.status-active { padding-left: 0.8rem; border-left: 0.3rem solid var(--success); }
.danger-zone { margin-top: 2rem; padding-top: 1.25rem; border-top: 0.1rem solid var(--border); }
.danger-zone form { display: grid; gap: 1rem; }
details { margin-top: 1.25rem; }
summary { width: fit-content; cursor: pointer; font-weight: 700; }

.actions-row { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.table-scroll { max-width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 0.8rem; border-bottom: 0.1rem solid var(--border); text-align: left; vertical-align: top; }
thead th { color: var(--white); background: var(--navy); }
tbody tr:hover { background: #edf5f6; }
.status-badge { display: inline-block; padding: 0.15rem 0.55rem; border: 0.1rem solid currentColor; border-radius: 100vmax; font-weight: 700; }
.status-badge-active { color: var(--success); }
.status-badge-inactive { color: var(--error); }
.pagination { display: flex; gap: 0.75rem 1.25rem; justify-content: space-between; flex-wrap: wrap; margin-top: 1.5rem; }
.temporary-secret { margin-block: 1.5rem; padding: 1.25rem; border: 0.2rem solid var(--gold); border-radius: 0.5rem; background: #fffaf0; }
.temporary-secret h2 { margin-bottom: 0.5rem; }
.temporary-password { margin-block: 0.5rem; font-size: clamp(1.1rem, 3vw, 1.5rem); overflow-wrap: anywhere; }
.visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }
.optional-label { font-weight: 400; }
.empty-state { margin-top: 1rem; padding: 1.25rem; border: 0.1rem dashed var(--border); border-radius: 0.5rem; background: var(--paper); }
.empty-state h3, .empty-state p { margin-block: 0.25rem; }
.success-message { margin-block: 1.25rem; padding: 1rem; color: var(--success); background: #eaf6ee; border-left: 0.35rem solid var(--success); }
.admin-photo-preview { width: min(20rem, 100%); margin: 0 0 1.25rem; }
.admin-photo-preview img { display: block; width: 100%; aspect-ratio: 4 / 5; object-fit: cover; object-position: center; border: 0.1rem solid var(--border); border-radius: 0.75rem; }
.admin-photo-preview figcaption { margin-top: 0.4rem; color: #3e5960; }
.old-price { display: block; text-decoration: line-through; text-decoration-thickness: 0.12em; }
.offer-price { display: block; color: var(--rose); font-size: 1.08rem; }
.discount-badge { display: inline-block; margin-top: 0.3rem; padding: 0.1rem 0.45rem; color: var(--navy); background: #f6ead0; border: 0.1rem solid var(--gold); border-radius: 100vmax; font-weight: 700; }
.rule-list { margin-block: 1rem; padding-left: 1.5rem; }
.assignment-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; }
.assignment-choice { padding: 0.9rem; border: 0.1rem solid var(--border); border-radius: 0.55rem; background: var(--paper); cursor: pointer; }
.assignment-choice:hover { border-color: var(--turquoise); }
.choice-meta { display: block; margin-top: 0.15rem; color: #3e5960; font-weight: 400; }

@media (max-width: 42rem) {
    .header-inner, .page-heading { align-items: flex-start; flex-direction: column; padding-block: 1rem; }
    .details-list { grid-template-columns: 1fr; }
    .feature-list li { flex-direction: column; gap: 0.2rem; }
    .feature-list span { text-align: left; }
    .recovery-codes { columns: 1; }
    .field-grid, .field-grid-three { grid-template-columns: 1fr; }
    .assignment-grid { grid-template-columns: 1fr; }
    .button { width: 100%; }
    .actions-row { display: grid; }
    .nav-inner { align-items: flex-start; flex-direction: column; }
    .nav-inner form { margin-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}

@media (forced-colors: active) {
    .site-header, .auth-card, .panel, input, select, textarea, .button, .notice, .error-summary, .environment-label, .temporary-secret, .status-badge, .empty-state, .form-section, .discount-badge, .assignment-choice { border: 0.125rem solid CanvasText; }
    .button { forced-color-adjust: auto; }
    :focus-visible { outline: 0.2rem solid Highlight; }
}
