:root {
    /* Sidebar */
    --sidebar-width: 240px;
    --sidebar-bg: #1e2a3a;
    --sidebar-border: rgba(255, 255, 255, 0.07);

    /* Blue palette — matches IHLite */
    --app-teal:        #044070;
    --app-teal-mid:    #0a6da8;
    --app-teal-soft:   #eef4fb;
    --app-teal-line:   #c9d8e8;
    --app-dark:        #1e2a3a;
    --app-gold:        #fcbf49;

    --accent:      var(--app-teal-mid);
    --accent-dim:  rgba(10, 109, 168, 0.12);

    /* Surface tokens */
    --surface-card:        #ffffff;
    --surface-card-border: #dde2ec;
    --surface-input-bg:    #fafbfd;
    --surface-soft:        #f7fafd;

    /* Text */
    --text-primary: #eef2f8;
    --text-ink:     #1e2a3a;
    --text-muted:   #6b7280;
    --text-dim:     #aab4c8;

    /* Page background */
    --content-bg:  #3a4455;
    --content-dot: rgba(255,255,255,0.07);

    --card-shadow: 0 8px 32px rgba(15,45,74,0.12), 0 2px 8px rgba(15,45,74,0.06);

    --font-display: 'Inter', system-ui, sans-serif;
    --font-mono:    'JetBrains Mono', monospace;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: var(--font-display);
    color: var(--text-ink);
}

h1:focus { outline: none; }

/* ── Admin shell ────────────────────────────────────────────── */

.admin-shell {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

.admin-main {
    flex: 1;
    overflow-y: auto;
    background: var(--content-bg);
    background-image: radial-gradient(var(--content-dot) 1px, transparent 1px);
    background-size: 24px 24px;
}

.admin-content {
    padding: 28px 32px;
    min-height: 100%;
    max-width: 960px;
    margin: 0 auto;
}

/* ── Headings ───────────────────────────────────────────────── */

.page-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 20px;
    letter-spacing: -0.01em;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}

.page-mode-tag {
    display: inline-block;
    margin-left: 12px;
    padding: 3px 10px;
    border-radius: 20px;
    background: var(--app-teal-soft);
    color: var(--app-teal);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    vertical-align: middle;
}

.page-mode-tag--new { background: #d1fae5; color: #065f46; }

h1, h2, h3 { color: var(--app-teal); }

/* ── Cards ──────────────────────────────────────────────────── */

.admin-card {
    background: var(--surface-card);
    border: 1px solid var(--surface-card-border);
    border-radius: 12px;
    box-shadow: var(--card-shadow);
    overflow: hidden;
}

.admin-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 22px;
    border-bottom: 1px solid var(--surface-card-border);
    background: var(--app-teal-soft);
}

.admin-card-title {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--app-teal);
    margin: 0;
}

/* ── Sidebar nav items (NavLink renders its own <a>) ────────── */

.sidebar .nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 8px;
    text-decoration: none;
    color: rgba(255, 255, 255, 0.82);
    position: relative;
    white-space: nowrap;
    width: 100%;
    transition: color 0.18s ease, background 0.18s ease;
}

.sidebar .nav-item:hover {
    color: #ffffff;
    text-decoration: none;
    background: rgba(255, 255, 255, 0.08);
}

.sidebar .nav-item.active {
    color: #ffffff;
    background: linear-gradient(90deg, rgba(10,109,168,0.28) 0%, rgba(10,109,168,0.08) 60%, transparent 100%);
}

.sidebar .nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 6px;
    bottom: 6px;
    width: 3px;
    background: var(--app-gold);
    border-radius: 0 3px 3px 0;
}

/* ── Form fields ────────────────────────────────────────────── */

.fields-rows,
.fields-grid {
    padding: 22px 28px 26px;
}

.fields-rows {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.fields-row {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    flex-wrap: wrap;
}

.fields-row .field        { flex: 1 1 160px; min-width: 0; }
.fields-row .field--medium { flex: 0 0 240px; }
.fields-row .field--short  { flex: 0 0 140px; }
.fields-row .field--narrow { flex: 0 0 110px; }

.fields-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 18px 20px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.field--full {
    width: 100%;
    grid-column: 1 / -1;
}

.field-label {
    font-family: var(--font-display);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-ink);
    user-select: none;
}

.req { color: #e53e3e; font-size: 13px; font-weight: 700; margin-left: 2px; }

.field-input,
.field-select {
    height: 40px;
    width: 100%;
    padding: 0 12px;
    background: var(--surface-input-bg);
    border: 1px solid var(--surface-card-border);
    border-radius: 8px;
    font-family: var(--font-display);
    font-size: 11.5px;
    color: var(--text-ink);
    outline: none;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
    -webkit-appearance: none;
    appearance: none;
}

.field-input:focus,
.field-select:focus {
    background: #ffffff;
    border-color: var(--app-teal-mid);
    box-shadow: 0 0 0 3px var(--accent-dim);
}

.field-input:hover:not(:focus),
.field-select:hover:not(:focus) { border-color: #b8c4d2; }

.field-input--err,
.field-select--err {
    background: #fff0f2 !important;
    border-color: #e53e3e !important;
}

.field-input[type="date"]::-webkit-calendar-picker-indicator {
    opacity: 0.5;
    cursor: pointer;
}

/* ── Tables ─────────────────────────────────────────────────── */

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.admin-table th {
    padding: 10px 14px;
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--app-teal);
    border-bottom: 2px solid var(--app-teal-line);
    background: var(--app-teal-soft);
    white-space: nowrap;
}

.admin-table td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--surface-card-border);
    color: var(--text-ink);
    vertical-align: middle;
}

.admin-table th:first-child,
.admin-table td:first-child { padding-left: 24px; }

.admin-table th:last-child,
.admin-table td:last-child  { padding-right: 24px; }

.admin-table tbody tr:hover td { background: var(--app-teal-soft); }
.admin-table tbody tr:last-child td { border-bottom: none; }

/* ── Status badges ──────────────────────────────────────────── */

.badge-active {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    background: #d1fae5;
    color: #065f46;
}

.badge-inactive {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    background: #fee2e2;
    color: #991b1b;
}

/* ── Page loading ───────────────────────────────────────────── */

@keyframes spin { to { transform: rotate(360deg); } }

.page-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 80px 24px;
}

.page-loading-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--app-teal-line);
    border-top-color: var(--app-teal-mid);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

.page-loading-text {
    font-size: 13px;
    font-weight: 600;
    color: #ffffff;
    letter-spacing: 0.02em;
}

/* ── Alerts ─────────────────────────────────────────────────── */

.validation-banner {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    background: #fff5f5;
    border: 1px solid #feb2b2;
    border-left: 4px solid #e53e3e;
    border-radius: 6px;
    padding: 0.3rem 0.75rem;
    font-size: 11.5px;
    font-weight: 600;
    color: #742a2a;
}

.valid.modified:not([type=checkbox]) { outline: 1px solid #26b050; }
.invalid                              { outline: 1px solid #e50000; }
.validation-message                   { color: #b91c1c; font-size: 11px; }

.blazor-error-boundary {
    background: #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

.blazor-error-boundary::after { content: "An error has occurred."; }

/* ── Table toolbar (sort + page size + pagination) ──────────── */

.table-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px 6px;
    font-size: 13px;
    color: var(--text-muted);
}

.toolbar-label {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0;
}

.toolbar-select {
    padding: 2px 6px;
    font-size: 13px;
    width: auto;
    height: auto;
}

.toolbar-count {
    font-size: 12px;
    color: var(--text-dim);
}

.sort-btn {
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    font: inherit;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--app-teal);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
}

.sort-btn:hover { color: var(--app-teal-mid); }

.sort-icon {
    font-size: 10px;
    opacity: 0.7;
}

.table-pager {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 10px 16px;
    border-top: 1px solid var(--surface-card-border);
}

.pager-btn {
    background: none;
    border: 1px solid var(--surface-card-border);
    border-radius: 4px;
    padding: 2px 10px;
    font-size: 18px;
    line-height: 1.4;
    cursor: pointer;
    color: var(--text-ink);
    transition: background 0.15s;
}

.pager-btn:hover:not(:disabled) { background: var(--app-teal-soft); }
.pager-btn:disabled { opacity: 0.35; cursor: default; }

.pager-info {
    font-size: 13px;
    color: var(--text-muted);
    min-width: 100px;
    text-align: center;
}

/* ── Bootstrap primary button — IHLite blue gradient ────────── */

.btn.btn-primary {
    background: linear-gradient(90deg, #044070, #0a6da8);
    border-color: #044070;
    box-shadow: 0 4px 14px rgba(4, 64, 112, 0.30);
    transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.btn.btn-primary:hover:not(:disabled):not(.disabled) {
    background: linear-gradient(90deg, #033460, #0960a8);
    border-color: #033460;
    transform: translateY(-1px);
    box-shadow: 0 6px 22px rgba(4, 64, 112, 0.42);
}

.btn.btn-primary:active:not(:disabled):not(.disabled),
.btn.btn-primary.active {
    background: linear-gradient(90deg, #022a50, #0858a0);
    border-color: #022a50;
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(4, 64, 112, 0.25);
}

.btn.btn-primary:focus-visible {
    box-shadow: 0 0 0 3px rgba(10, 109, 168, 0.40);
}

/* ── Form actions bar ───────────────────────────────────────── */

.form-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 20px;
    padding-top: 8px;
}

.form-actions .btn-delete { margin-right: auto; }

/* ── Save button ────────────────────────────────────────────── */

.btn-save {
    display: inline-flex;
    align-items: center;
    height: 40px;
    padding: 0 22px;
    background: linear-gradient(90deg, var(--app-teal), var(--app-teal-mid));
    border: none;
    border-radius: 6px;
    font-family: var(--font-display);
    font-size: 12.5px;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: #ffffff;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(4, 64, 112, 0.35);
    transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.btn-save:hover:not(:disabled) {
    background: linear-gradient(90deg, #033460, #0960a8);
    transform: translateY(-1px);
    box-shadow: 0 6px 22px rgba(4, 64, 112, 0.45);
    color: #ffffff;
}

.btn-save:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(4, 64, 112, 0.25);
}

.btn-save:disabled { opacity: 0.6; cursor: not-allowed; }

/* ── Delete button ──────────────────────────────────────────── */

.btn-delete {
    display: inline-flex;
    align-items: center;
    height: 40px;
    padding: 0 22px;
    background: linear-gradient(90deg, #991b1b, #c0392b);
    border: 1px solid #7f1d1d;
    border-radius: 6px;
    font-family: var(--font-display);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: #ffffff;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(127, 29, 29, 0.30);
    transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.btn-delete:hover:not(:disabled) {
    background: linear-gradient(90deg, #7f1d1d, #a52828);
    transform: translateY(-1px);
    box-shadow: 0 6px 22px rgba(127, 29, 29, 0.40);
    color: #ffffff;
}

.btn-delete:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(127, 29, 29, 0.25);
}

.btn-delete:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Cancel button ──────────────────────────────────────────── */

.btn-cancel {
    display: inline-flex;
    align-items: center;
    height: 40px;
    padding: 0 18px;
    background: #fff0f0;
    border: 1px solid #f5a0a0;
    border-radius: 6px;
    font-family: var(--font-display);
    font-size: 12.5px;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: #c0392b;
    cursor: pointer;
    transition: color 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.btn-cancel:hover {
    background: #ffe0e0;
    border-color: #e05555;
    color: #a93226;
    text-decoration: none;
}

.btn-cancel:active {
    background: linear-gradient(90deg, #b91c1c, #ef4444);
    border-color: #b91c1c;
    color: #ffffff;
}

/* ── Confirm dialog ─────────────────────────────────────────── */

.confirm-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(3px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 900;
    animation: confirmFadeIn 0.18s ease both;
}

@keyframes confirmFadeIn { from { opacity: 0; } to { opacity: 1; } }

.confirm-dialog {
    background: var(--surface-card);
    border: 1px solid var(--surface-card-border);
    border-radius: 16px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.28);
    padding: 32px 28px 24px;
    width: min(420px, 90vw);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    text-align: center;
    animation: confirmSlideUp 0.22s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes confirmSlideUp {
    from { opacity: 0; transform: translateY(12px) scale(0.97); }
    to   { opacity: 1; transform: none; }
}

.confirm-icon {
    width: 48px;
    height: 48px;
    background: rgba(229, 57, 53, 0.08);
    border: 1.5px solid rgba(229, 57, 53, 0.2);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #e53935;
}

.confirm-icon svg { width: 22px; height: 22px; }

.confirm-title {
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 700;
    color: var(--text-ink);
    margin: 0;
}

.confirm-desc {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.6;
    margin: 0;
}

.confirm-actions {
    display: flex;
    gap: 10px;
    margin-top: 6px;
    width: 100%;
}

.confirm-btn-stay,
.confirm-btn-leave {
    flex: 1;
    height: 40px;
    border-radius: 8px;
    font-family: var(--font-display);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: opacity 0.18s ease, transform 0.15s ease;
}

.confirm-btn-stay {
    background: var(--surface-soft);
    border: 1px solid var(--surface-card-border);
    color: var(--text-ink);
}

.confirm-btn-stay:hover { opacity: 0.8; }

.confirm-btn-leave {
    background: #e53935;
    color: #ffffff;
}

.confirm-btn-leave:hover { opacity: 0.88; transform: translateY(-1px); }
