/* ==========================================================================
   Shared Components & Reset
   ========================================================================== */

/* --- CSS Reset-ish ------------------------------------------------------- */
* {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
}

body {
    margin: 0;
    font-family: var(--font-body);
    color: var(--text);
    background: var(--bg);
}

img {
    max-width: 100%;
    height: auto;
}

a {
    color: var(--action);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

code,
pre {
    font-family: var(--font-mono);
}

/* --- Utilities ----------------------------------------------------------- */
.wrap {
    max-width: 980px;
    margin: 30px auto;
    padding: 0 18px;
}

.muted {
    color: var(--muted);
}

.kb {
    white-space: nowrap;
}

.hr {
    border: 0;
    border-top: 1px solid var(--line);
    margin: 16px 0;
}

.row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}

.row--between {
    justify-content: space-between;
}

.row--end {
    justify-content: flex-end;
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

@media (max-width: 860px) {
    .grid-2 {
        grid-template-columns: 1fr;
    }
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* --- Cards --------------------------------------------------------------- */
.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    padding: 16px;
}

/* --- Pills --------------------------------------------------------------- */
.pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--surface-2);
    color: var(--text);
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
}

.pill--role {
    letter-spacing: 0.5px;
}

/* --- Buttons ------------------------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;

    padding: 10px 16px;
    border-radius: var(--radius-md);

    font-weight: 800 !important;
    font-size: 14px !important;
    line-height: 1;

    border: 1px solid transparent;
    text-decoration: none;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;

    transition: transform 0.05s ease, filter 0.12s ease, background 0.12s ease, border-color 0.12s ease;
    -webkit-text-fill-color: currentColor;
}

button.btn {
    appearance: none;
    background: transparent;
    font-family: inherit;
}

.btn:focus-visible {
    outline: none;
    box-shadow: var(--focus);
}

/* Primary */
.btn-primary {
    background: var(--action) !important;
    color: #fff !important;
    border-color: rgba(49, 56, 114, 0.20) !important;
    box-shadow: 0 12px 22px rgba(49, 56, 114, 0.16);
    -webkit-text-fill-color: #fff;
}

.btn-primary:hover {
    filter: brightness(0.98);
}

.btn-primary:active {
    transform: translateY(1px);
}

/* Inverted primary */
.btn-primary-invert {
    background: rgba(255, 255, 255, 0.96) !important;
    color: var(--action) !important;
    border-color: rgba(49, 56, 114, 0.28) !important;
    box-shadow: none;
    -webkit-text-fill-color: var(--action);
}

.btn-primary-invert:hover {
    background: rgba(49, 56, 114, 0.06);
}

.btn-primary-invert:active {
    transform: translateY(1px);
}

/* Secondary */
.btn-secondary {
    background: rgba(17, 24, 39, 0.04);
    color: var(--text);
    border-color: rgba(17, 24, 39, 0.12);
}

.btn-secondary:hover {
    background: rgba(17, 24, 39, 0.06);
}

.btn-secondary:active {
    transform: translateY(1px);
}

/* Ghost */
.btn-ghost {
    background: transparent;
    color: var(--action);
    border-color: transparent;
}

.btn-ghost:hover {
    background: rgba(49, 56, 114, 0.06);
    text-decoration: none;
}

.btn-ghost:active {
    transform: translateY(1px);
}

/* Small Buttons */
.btn-sm,
.btn-sm:hover,
.btn-sm:focus {
    padding: 6px 12px;
    font-size: 13px !important;
    text-decoration: none !important;
}

/* Action-button row (compact, adapts to varying button count) */
.action-btns {
    display: inline-flex;
    flex-wrap: nowrap;
    gap: 2px;
    align-items: center;
}

/* Icon buttons (Admin/Shared) */
.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 28px;
    border-radius: 6px;
    border: 1px solid rgba(0, 0, 0, 0.10);
    background: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    vertical-align: middle;
    margin-right: 0;
}

.icon-btn:hover {
    background: rgba(0, 0, 0, 0.04);
}

.icon-btn--danger {
    border-color: rgba(220, 38, 38, 0.25);
    color: rgb(220, 38, 38);
}

.icon-btn--danger:hover {
    background: rgba(220, 38, 38, 0.08);
}

.icon-btn svg {
    display: block;
}


/* --- Alert --------------------------------------------------------------- */
.alert {
    border-radius: var(--radius-md);
    padding: 12px 14px;
    border: 1px solid var(--line);
    background: #fff;
    margin: 12px 0;
}

.alert-danger {
    border-color: rgba(185, 28, 28, 0.25);
    background: rgba(185, 28, 28, 0.06);
    color: #7f1d1d;
    font-weight: 700;
}

/* --- Forms --------------------------------------------------------------- */
label {
    display: block;
    font-size: 12px;
    font-weight: 800;
    color: var(--muted);
    margin-bottom: 6px;
    letter-spacing: 0.2px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
input[type="search"],
select,
textarea {
    width: 100%;
    border-radius: var(--radius-md);
    border: 1px solid var(--line);
    background: #fff;
    padding: 10px 12px;
    font-size: 14px;
    color: var(--text);
    outline: none;
    transition: box-shadow 0.12s ease, border-color 0.12s ease;
    font-family: inherit;
}

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

input:focus,
select:focus,
textarea:focus {
    border-color: rgba(49, 56, 114, 0.35);
    box-shadow: var(--focus);
}

/* Form Helpers */
.form-row,
.form-group,
.mb-3 {
    margin-bottom: 12px;
    display: grid;
    gap: 6px;
}

.form-help,
.form-text,
.help-text,
form .help-text {
    display: inline-flex;
    align-items: flex-start;
    gap: 8px;
    margin-top: 6px;
    padding: 7px 10px;
    border: 1px solid rgba(49, 56, 114, 0.14);
    background: rgba(49, 56, 114, 0.06);
    border-radius: 12px;
    font-size: 12px;
    line-height: 1.35;
    color: rgba(17, 24, 39, 0.70);
    max-width: 72ch;
}

.form-help::before,
.form-text::before,
.help-text::before {
    content: "i";
    width: 18px;
    height: 18px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 12px;
    color: #fff;
    background: var(--action);
    flex: 0 0 auto;
}

form label+*+.form-help {
    margin-left: 2px;
}

.form-error {
    margin-top: 6px;
    color: #b91c1c;
    font-size: 12px;
    font-weight: 700;
}

/* --- Tables -------------------------------------------------------------- */
.table {
    width: 100%;
    border-collapse: collapse;
    border-spacing: 0;
}

.table thead th {
    text-align: left;
    font-size: 12px;
    color: var(--muted);
    letter-spacing: 0.2px;
    padding: 10px 8px;
    border-bottom: 1px solid var(--line);
}

.table tbody td {
    padding: 12px 8px;
    border-bottom: 1px solid var(--line-2);
    vertical-align: top;
}

.table tbody tr:hover {
    background: rgba(49, 56, 114, 0.03);
}

/* --- Typography / CMS ---------------------------------------------------- */
.cms-body {
    font-size: 16px;
    line-height: 1.75;
    color: var(--text);
}

.cms-body>*:first-child {
    margin-top: 0;
}

.cms-body>*:last-child {
    margin-bottom: 0;
}

.cms-body p {
    margin: 0 0 16px;
}

.cms-body h2 {
    margin: 28px 0 12px;
    font-size: 22px;
    line-height: 1.25;
    font-weight: 900;
}

.cms-body h3 {
    margin: 22px 0 10px;
    font-size: 18px;
    line-height: 1.3;
    font-weight: 900;
}

.cms-body a {
    color: var(--action);
    text-decoration: underline;
    text-decoration-thickness: 2px;
    text-underline-offset: 3px;
}

.cms-body a:hover {
    color: #2f3873;
}

.cms-body ul,
.cms-body ol {
    margin: 0 0 16px;
    padding-left: 22px;
}

.cms-body li {
    margin: 6px 0;
}

.cms-body img {
    display: block;
    max-width: 100%;
    height: auto;
    border-radius: 0;
    margin: 16px 0;
}

.cms-body hr {
    border: 0;
    border-top: 1px solid rgba(17, 24, 39, 0.12);
    margin: 22px 0;
}

.cms-body:after {
    content: "";
    display: block;
    clear: both;
}

/* Image floats */
.cms-img--left {
    float: left;
    margin: 0 14px 10px 0;
    max-width: min(320px, 50%);
}

.cms-img--right {
    float: right;
    margin: 0 0 10px 14px;
    max-width: min(320px, 50%);
}

/* --- Hero Shell (Background system) --- */
.hero-shell {
    position: relative;
}

.hero-shell__bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
}

.hero-shell__slide {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0;
    transition: opacity 1200ms ease;
    will-change: opacity;
}

.hero-shell__slide.is-active {
    opacity: 1;
}

.hero-shell__shade {
    position: absolute;
    inset: 0;
}