/* ==========================================================================
   Rekhta Events — component library
   Every class is prefixed `rk-` to avoid colliding with Bootstrap / ruang-admin.
   All values reference tokens.css. No raw hex, no magic numbers.
   ========================================================================== */

/* ----- Base ------------------------------------------------------------- */
.rk-app,
.rk-app * ,
.rk-app *::before,
.rk-app *::after { box-sizing: border-box; }

.rk-app {
    background: var(--rk-canvas);
    color: var(--rk-ink-900);
    font-family: var(--rk-f-sans);
    font-size: 13px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}
.rk-app a { color: inherit; text-decoration: none; }
.rk-app button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
.rk-app ::selection { background: var(--rk-accent-tint); color: var(--rk-accent-lo); }
.rk-app :focus-visible { outline: 2px solid var(--rk-accent); outline-offset: 2px; border-radius: var(--rk-r-1); }
@media (prefers-reduced-motion: reduce) {
    .rk-app *, .rk-app *::before, .rk-app *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* ----- Shell ------------------------------------------------------------ */
.rk-shell { display: grid; grid-template-columns: var(--rk-sidebar-w) 1fr; min-height: 100vh; }
.rk-main  { display: flex; flex-direction: column; min-width: 0; }

/* ----- Sidebar ---------------------------------------------------------- */
.rk-side {
    background: var(--rk-surface-2);
    border-right: 1px solid var(--rk-line-soft);
    display: flex; flex-direction: column;
    padding: var(--rk-s-5) 0 var(--rk-s-4);
    position: sticky; top: 0; height: 100vh;
}
.rk-side__brand {
    display: flex; align-items: center; gap: var(--rk-s-3);
    padding: 0 var(--rk-s-5) var(--rk-s-5);
    border-bottom: 1px solid var(--rk-line-soft);
    position: relative;
}
.rk-side__brand::after {
    content: ""; position: absolute; left: var(--rk-s-5); right: var(--rk-s-5); bottom: -1px;
    height: 1px; background: linear-gradient(to right, var(--rk-gilt), transparent 70%);
}
.rk-side__crest {
    width: 32px; height: 32px; border-radius: var(--rk-r-1);
    background: var(--rk-accent); color: var(--rk-accent-ink);
    display: grid; place-items: center;
    font-family: var(--rk-f-serif); font-style: italic; font-size: 20px; font-weight: 400; line-height: 1;
}
.rk-side__lockup { display: flex; flex-direction: column; line-height: 1; }
.rk-side__lockup-1 { font-family: var(--rk-f-serif); font-style: italic; font-size: 18px; color: var(--rk-ink-900); }
.rk-side__lockup-2 {
    font-size: 10px; letter-spacing: 0.22em; text-transform: uppercase;
    color: var(--rk-ink-500); margin-top: 4px; font-weight: 600;
}

.rk-side__scroll { flex: 1; overflow-y: auto; padding: var(--rk-s-5) var(--rk-s-3) var(--rk-s-4); }
.rk-side__section { margin-bottom: var(--rk-s-5); }
.rk-side__eyebrow {
    padding: 0 var(--rk-s-4) var(--rk-s-2);
    font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase;
    color: var(--rk-ink-500); font-weight: 600;
}
.rk-side__nav { display: flex; flex-direction: column; gap: 1px; }
.rk-side__link {
    display: flex; align-items: center; gap: var(--rk-s-3);
    padding: 7px var(--rk-s-4);
    color: var(--rk-ink-700); font-size: 13px; font-weight: 500;
    border-radius: var(--rk-r-2);
    position: relative;
    transition: background 120ms ease, color 120ms ease;
}
.rk-side__link:hover { background: var(--rk-surface-3); color: var(--rk-ink-900); }
.rk-side__link .rk-ic { width: 16px; height: 16px; flex: 0 0 auto; color: var(--rk-ink-500); }
.rk-side__link:hover .rk-ic { color: var(--rk-ink-700); }
.rk-side__link .rk-badge {
    margin-left: auto;
    font-size: 10px; font-weight: 600;
    padding: 2px 6px; border-radius: 10px;
    background: var(--rk-surface-3); color: var(--rk-ink-500);
    font-variant-numeric: tabular-nums;
}
.rk-side__link[aria-current="page"] { background: var(--rk-accent-tint); color: var(--rk-accent-lo); }
.rk-side__link[aria-current="page"] .rk-ic { color: var(--rk-accent); }
.rk-side__link[aria-current="page"]::before {
    content: ""; position: absolute; left: 0; top: 6px; bottom: 6px; width: 2px;
    background: var(--rk-gilt); border-radius: 2px;
}
.rk-side__link[aria-current="page"] .rk-badge { background: var(--rk-accent); color: var(--rk-accent-ink); }

.rk-side__foot {
    padding: var(--rk-s-4) var(--rk-s-5);
    border-top: 1px solid var(--rk-line-soft);
    display: flex; align-items: center; gap: var(--rk-s-3);
}
.rk-avatar {
    width: 30px; height: 30px; border-radius: 50%;
    background: var(--rk-accent-tint); color: var(--rk-accent-lo);
    display: grid; place-items: center; font-weight: 600; font-size: 12px;
}
.rk-side__who { display: flex; flex-direction: column; line-height: 1.2; flex: 1; min-width: 0; }
.rk-side__who b { font-size: 12px; font-weight: 600; color: var(--rk-ink-900); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rk-side__who span { font-size: 11px; color: var(--rk-ink-500); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rk-side__signout { margin: 0; }
.rk-side__signout .rk-icon-btn { color: var(--rk-ink-500); }
.rk-side__signout .rk-icon-btn:hover { color: var(--rk-danger); background: var(--rk-danger-tint); }

/* ----- Topbar ----------------------------------------------------------- */
.rk-top {
    height: var(--rk-topbar-h);
    background: var(--rk-surface);
    border-bottom: 1px solid var(--rk-line-soft);
    display: flex; align-items: center;
    padding: 0 var(--rk-s-6);
    gap: var(--rk-s-4);
    position: sticky; top: 0; z-index: 20;
}
.rk-crumb { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--rk-ink-500); }
.rk-crumb a:hover { color: var(--rk-ink-900); }
.rk-crumb .rk-sep { color: var(--rk-ink-300); }
.rk-crumb .rk-last { color: var(--rk-ink-900); font-weight: 500; }
.rk-top__spacer { flex: 1; }
.rk-top__act { display: flex; align-items: center; gap: var(--rk-s-2); color: var(--rk-ink-500); }
.rk-kbd {
    font-family: var(--rk-f-mono); font-size: 10px;
    padding: 2px 5px; border: 1px solid var(--rk-line-strong); border-radius: 3px;
    background: var(--rk-surface); color: var(--rk-ink-500);
}
.rk-icon-btn {
    width: 32px; height: 32px; border-radius: var(--rk-r-2);
    display: inline-grid; place-items: center;
    color: var(--rk-ink-500);
}
.rk-icon-btn:hover { background: var(--rk-surface-3); color: var(--rk-ink-900); }

/* ----- Page container --------------------------------------------------- */
.rk-page { padding: var(--rk-s-6) var(--rk-s-6) var(--rk-s-9); flex: 1; }
.rk-page__head {
    display: flex; align-items: flex-end; justify-content: space-between;
    gap: var(--rk-s-6); margin-bottom: var(--rk-s-5);
}
.rk-page__title {
    font-size: 22px; font-weight: 600; letter-spacing: -0.01em;
    color: var(--rk-ink-900); margin: 0 0 4px;
}
.rk-page__desc { color: var(--rk-ink-500); font-size: 13px; margin: 0; max-width: 60ch; }
.rk-page__actions { display: flex; gap: var(--rk-s-2); }

/* ----- Stats row -------------------------------------------------------- */
.rk-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--rk-s-4); margin-bottom: var(--rk-s-5); }
.rk-stat {
    background: var(--rk-surface); border: 1px solid var(--rk-line-soft); border-radius: var(--rk-r-3);
    padding: var(--rk-s-4) var(--rk-s-4) var(--rk-s-3);
    display: flex; flex-direction: column; gap: 4px;
}
.rk-stat__label {
    font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase;
    color: var(--rk-ink-500); font-weight: 600;
}
.rk-stat__value { font-size: 22px; font-weight: 600; color: var(--rk-ink-900); font-variant-numeric: tabular-nums; }
.rk-stat__delta { font-size: 11px; color: var(--rk-ink-500); font-variant-numeric: tabular-nums; }
.rk-stat__delta.rk-up { color: var(--rk-ok); }
.rk-stat__delta.rk-down { color: var(--rk-danger); }

/* ----- Buttons ---------------------------------------------------------- */
.rk-btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 7px 12px;
    font-size: 12.5px; font-weight: 500;
    border: 1px solid var(--rk-line-strong); border-radius: var(--rk-r-2);
    background: var(--rk-surface); color: var(--rk-ink-700);
    transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
    white-space: nowrap;
    text-decoration: none;
}
.rk-btn:hover { background: var(--rk-surface-3); color: var(--rk-ink-900); }
/* Primary — chained selector + :visited/:focus so no link/browser default ever
   overrides the white text on the maroon fill. */
.rk-btn.rk-btn--primary,
.rk-btn.rk-btn--primary:link,
.rk-btn.rk-btn--primary:visited,
.rk-btn.rk-btn--primary:focus {
    background: var(--rk-accent);
    border-color: var(--rk-accent);
    color: var(--rk-accent-ink);
}
.rk-btn.rk-btn--primary:hover,
.rk-btn.rk-btn--primary:active {
    background: var(--rk-accent-hi);
    border-color: var(--rk-accent-hi);
    color: var(--rk-accent-ink);
}
.rk-btn--ghost { border-color: transparent; background: transparent; color: var(--rk-ink-700); }
.rk-btn--ghost:hover { background: var(--rk-surface-3); }
.rk-btn--danger { color: var(--rk-danger); }
.rk-btn--danger:hover { background: var(--rk-danger-tint); color: var(--rk-danger); }
.rk-btn .rk-ic { width: 14px; height: 14px; }
.rk-btn--sm { padding: 4px 8px; font-size: 11.5px; }
.rk-btn--lg { padding: 9px 14px; font-size: 13px; }
.rk-btn[disabled] { opacity: 0.5; cursor: not-allowed; }

/* ----- Toolbar (list page) --------------------------------------------- */
.rk-toolbar {
    display: flex; align-items: center; gap: var(--rk-s-3);
    padding: var(--rk-s-3) var(--rk-s-4);
    background: var(--rk-surface);
    border: 1px solid var(--rk-line-soft);
    border-radius: var(--rk-r-3) var(--rk-r-3) 0 0;
    border-bottom: 0;
    flex-wrap: wrap;
}
.rk-search {
    flex: 0 1 340px; display: flex; align-items: center; gap: 8px;
    padding: 6px 10px;
    background: var(--rk-surface-2);
    border: 1px solid var(--rk-line-soft);
    border-radius: var(--rk-r-2);
    color: var(--rk-ink-500);
    transition: border-color 120ms ease, background 120ms ease;
}
.rk-search:focus-within { border-color: var(--rk-accent); background: var(--rk-surface); }
.rk-search input {
    flex: 1; border: 0; outline: 0; background: transparent;
    font-size: 13px; color: var(--rk-ink-900); min-width: 0;
}
.rk-search input::placeholder { color: var(--rk-ink-300); }

.rk-chip {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 5px 10px;
    border: 1px solid var(--rk-line-strong); border-radius: 999px;
    background: var(--rk-surface);
    color: var(--rk-ink-700); font-size: 12px; font-weight: 500;
    white-space: nowrap;
}
.rk-chip:hover { background: var(--rk-surface-3); }
.rk-chip__label { color: var(--rk-ink-500); font-weight: 500; }
.rk-chip .rk-caret { color: var(--rk-ink-500); }
.rk-chip--active { background: var(--rk-accent-tint); border-color: var(--rk-accent); color: var(--rk-accent-lo); }
.rk-chip--active .rk-chip__label { color: var(--rk-accent-lo); }

.rk-toolbar__spacer { flex: 1; }
.rk-toolbar__meta { color: var(--rk-ink-500); font-size: 12px; font-variant-numeric: tabular-nums; }

/* ----- Grid card wrapper ----------------------------------------------- */
.rk-grid-card {
    background: var(--rk-surface);
    border: 1px solid var(--rk-line-soft);
    border-radius: 0 0 var(--rk-r-3) var(--rk-r-3);
    overflow: hidden;
}
.rk-grid-mount { width: 100%; height: 560px; }   /* AG Grid needs an explicit height */

/* ----- Pills ------------------------------------------------------------ */
.rk-pill {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 2px 8px;
    font-size: 11px; font-weight: 500;
    border-radius: 999px;
    border: 1px solid transparent;
}
.rk-pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: 0.9; }
.rk-pill--ok     { background: var(--rk-ok-tint);     color: var(--rk-ok); }
.rk-pill--warn   { background: var(--rk-warn-tint);   color: var(--rk-warn); }
.rk-pill--danger { background: var(--rk-danger-tint); color: var(--rk-danger); }
.rk-pill--info   { background: var(--rk-info-tint);   color: var(--rk-info); }
.rk-pill--muted  { background: var(--rk-surface-3);   color: var(--rk-ink-500); }

/* ----- Sections (form) -------------------------------------------------- */
.rk-section {
    background: var(--rk-surface);
    border: 1px solid var(--rk-line-soft);
    border-radius: var(--rk-r-3);
    margin-bottom: var(--rk-s-4);
}
.rk-section__head {
    padding: var(--rk-s-4) var(--rk-s-5) var(--rk-s-3);
    border-bottom: 1px solid var(--rk-line-soft);
    display: flex; align-items: baseline; gap: var(--rk-s-3);
}
.rk-section__num {
    font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase;
    color: var(--rk-ink-500); font-weight: 600; font-variant-numeric: tabular-nums;
}
.rk-section__title { font-size: 15px; font-weight: 600; color: var(--rk-ink-900); margin: 0; }
.rk-section__hint { color: var(--rk-ink-500); font-size: 12px; margin-left: auto; }
.rk-section__body {
    padding: var(--rk-s-5);
    display: flex; flex-direction: column; gap: var(--rk-s-4);
}

/* ----- Form fields ------------------------------------------------------ */
.rk-field { display: flex; flex-direction: column; gap: 6px; }
.rk-field__row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--rk-s-4); }
.rk-label {
    font-size: 12px; font-weight: 500; color: var(--rk-ink-900);
    display: flex; align-items: center; gap: 6px;
}
.rk-label .rk-req { color: var(--rk-danger); font-weight: 600; }
.rk-label .rk-opt { color: var(--rk-ink-500); font-weight: 400; font-size: 11px; }
.rk-help { font-size: 11.5px; color: var(--rk-ink-500); }
.rk-err  { font-size: 11.5px; color: var(--rk-danger); display: flex; align-items: center; gap: 4px; }

.rk-input, .rk-select, .rk-textarea {
    width: 100%;
    background: var(--rk-surface);
    border: 1px solid var(--rk-line-strong);
    border-radius: var(--rk-r-2);
    padding: 8px 10px;
    font-size: 13px; color: var(--rk-ink-900);
    font-family: inherit;
    transition: border-color 120ms ease, box-shadow 120ms ease;
    outline: 0;
}
.rk-input:hover, .rk-select:hover, .rk-textarea:hover { border-color: var(--rk-ink-300); }
.rk-input:focus, .rk-select:focus, .rk-textarea:focus {
    border-color: var(--rk-accent);
    box-shadow: 0 0 0 3px var(--rk-accent-tint);
}
.rk-input::placeholder { color: var(--rk-ink-300); }
.rk-input--invalid { border-color: var(--rk-danger); }
.rk-input--invalid:focus { box-shadow: 0 0 0 3px var(--rk-danger-tint); }
.rk-textarea { min-height: 90px; resize: vertical; }
.rk-select {
    appearance: none;
    background-image:
        linear-gradient(45deg, transparent 50%, var(--rk-ink-500) 50%),
        linear-gradient(135deg, var(--rk-ink-500) 50%, transparent 50%);
    background-position: calc(100% - 14px) 50%, calc(100% - 10px) 50%;
    background-size: 4px 4px, 4px 4px;
    background-repeat: no-repeat;
    padding-right: 28px;
}

/* ----- File / asset cluster -------------------------------------------- */
.rk-assets { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--rk-s-4); }
.rk-asset {
    display: flex; flex-direction: column; gap: 6px;
    border: 1px dashed var(--rk-line-strong); border-radius: var(--rk-r-3);
    padding: var(--rk-s-3);
    background: var(--rk-surface-2);
}
.rk-asset__preview {
    aspect-ratio: 1; border-radius: var(--rk-r-2);
    background: var(--rk-surface-3);
    display: grid; place-items: center;
    color: var(--rk-ink-300); font-size: 22px;
    overflow: hidden;
}
.rk-asset__preview img { width: 100%; height: 100%; object-fit: cover; }
.rk-asset__meta { display: flex; justify-content: space-between; align-items: baseline; }
.rk-asset__name { font-size: 12px; color: var(--rk-ink-900); font-weight: 500; }
.rk-asset__size { font-size: 10px; color: var(--rk-ink-500); font-variant-numeric: tabular-nums; }
.rk-asset__actions { display: flex; gap: 4px; }

/* ----- Dynamic URL list ------------------------------------------------- */
.rk-url-list { display: flex; flex-direction: column; gap: 6px; }
.rk-url-row { display: flex; gap: 6px; }
.rk-url-row .rk-input { flex: 1; font-family: var(--rk-f-mono); font-size: 12px; }
.rk-url-row__drag { color: var(--rk-ink-300); display: grid; place-items: center; width: 22px; cursor: grab; user-select: none; }
.rk-url-row__remove { color: var(--rk-ink-500); }
.rk-url-row__remove:hover { color: var(--rk-danger); }

/* ----- Side rail (form) ------------------------------------------------- */
.rk-rail { display: flex; flex-direction: column; gap: var(--rk-s-4); }
.rk-kv { display: flex; justify-content: space-between; gap: var(--rk-s-3); font-size: 12px; margin: 0; }
.rk-kv dt { color: var(--rk-ink-500); }
.rk-kv dd { margin: 0; color: var(--rk-ink-900); font-weight: 500; font-variant-numeric: tabular-nums; text-align: right; }

.rk-toggle {
    display: inline-flex; align-items: center; gap: 10px;
    padding: 6px 10px 6px 6px;
    border: 1px solid var(--rk-line-strong); border-radius: 999px;
    background: var(--rk-surface);
    font-size: 12px; color: var(--rk-ink-700); font-weight: 500;
    cursor: pointer;
}
.rk-toggle__dot {
    width: 22px; height: 22px; border-radius: 50%;
    background: var(--rk-surface-3);
    display: grid; place-items: center;
    color: var(--rk-ink-500);
}
.rk-toggle[data-on="true"] { border-color: var(--rk-ok); color: var(--rk-ok); background: var(--rk-ok-tint); }
.rk-toggle[data-on="true"] .rk-toggle__dot { background: var(--rk-ok); color: #fff; }

/* ----- Form grid & footbar --------------------------------------------- */
.rk-form-grid {
    display: grid; grid-template-columns: minmax(0, 1fr) 320px;
    gap: var(--rk-s-6); align-items: flex-start;
}
.rk-footbar {
    position: sticky; bottom: 0;
    display: flex; align-items: center; gap: var(--rk-s-3);
    padding: var(--rk-s-3) var(--rk-s-6);
    background: var(--rk-surface);
    border-top: 1px solid var(--rk-line-soft);
    z-index: 10;
}
.rk-footbar__meta { color: var(--rk-ink-500); font-size: 12px; }
.rk-footbar__spacer { flex: 1; }
.rk-footbar__actions { display: flex; gap: var(--rk-s-2); }

/* ----- Radio cards (booking type, category picker, etc.) --------------- */
.rk-radio-cards { display: flex; flex-direction: column; gap: 8px; }
.rk-radio-card {
    display: flex; align-items: flex-start; gap: 12px;
    padding: 12px 14px;
    border: 1px solid var(--rk-line-strong);
    border-radius: var(--rk-r-2);
    background: var(--rk-surface);
    cursor: pointer;
    transition: border-color 120ms ease, background 120ms ease;
    margin: 0;
}
.rk-radio-card:hover { border-color: var(--rk-ink-300); background: var(--rk-surface-2); }
.rk-radio-card input[type="radio"] {
    flex: 0 0 auto; margin: 3px 0 0;
    accent-color: var(--rk-accent);
    width: 15px; height: 15px;
}
.rk-radio-card--selected,
.rk-radio-card:has(input:checked) {
    border-color: var(--rk-accent);
    background: var(--rk-accent-tint);
}
.rk-radio-card__icon {
    width: 32px; height: 32px; flex: 0 0 auto;
    display: grid; place-items: center;
    color: var(--rk-ink-500);
}
.rk-radio-card--selected .rk-radio-card__icon,
.rk-radio-card:has(input:checked) .rk-radio-card__icon { color: var(--rk-accent); }
.rk-radio-card__text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.rk-radio-card__title { font-size: 13px; font-weight: 600; color: var(--rk-ink-900); }
.rk-radio-card__desc { font-size: 12px; color: var(--rk-ink-500); }

/* ----- Alerts (TempData success / error banners) ----------------------- */
.rk-alert {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 10px 14px;
    border: 1px solid var(--rk-line-strong);
    border-radius: var(--rk-r-2);
    background: var(--rk-surface);
    font-size: 12.5px;
    margin-bottom: var(--rk-s-4);
}
.rk-alert__icon { flex: 0 0 auto; color: var(--rk-ink-500); margin-top: 1px; }
.rk-alert__body { flex: 1; color: var(--rk-ink-900); }
.rk-alert__close {
    color: var(--rk-ink-500); padding: 0 4px;
    font-size: 16px; line-height: 1;
}
.rk-alert--ok     { background: var(--rk-ok-tint);     border-color: var(--rk-ok);     color: var(--rk-ok); }
.rk-alert--warn   { background: var(--rk-warn-tint);   border-color: var(--rk-warn);   color: var(--rk-warn); }
.rk-alert--danger { background: var(--rk-danger-tint); border-color: var(--rk-danger); color: var(--rk-danger); }
.rk-alert--info   { background: var(--rk-info-tint);   border-color: var(--rk-info);   color: var(--rk-info); }
.rk-alert--ok .rk-alert__icon,
.rk-alert--ok .rk-alert__body { color: var(--rk-ok); }
.rk-alert--warn .rk-alert__icon,
.rk-alert--warn .rk-alert__body { color: var(--rk-warn); }
.rk-alert--danger .rk-alert__icon,
.rk-alert--danger .rk-alert__body { color: var(--rk-danger); }
.rk-alert--info .rk-alert__icon,
.rk-alert--info .rk-alert__body { color: var(--rk-info); }

/* ----- Day / session rows (repeatable multi-input rows) --------------- */
.rk-repeater { display: flex; flex-direction: column; gap: 8px; }
.rk-repeater__row {
    background: var(--rk-surface-2);
    border: 1px solid var(--rk-line-soft);
    border-radius: var(--rk-r-2);
    padding: 12px 14px;
}
.rk-repeater__fields {
    display: grid;
    grid-template-columns: 2fr 2fr 2fr auto;
    gap: 10px;
    align-items: flex-end;
}
.rk-repeater__fields > .rk-field { min-width: 0; }
.rk-repeater__remove { align-self: end; height: 34px; }
@media (max-width: 780px) {
    .rk-repeater__fields { grid-template-columns: 1fr; }
}

/* ----- Theme toggle button --------------------------------------------
   Shows the moon in light mode (click → dark) and the sun in dark mode
   (click → light). Follows the OS default until the user clicks once. */
.rk-theme-icon { display: none; }
:root[data-theme="dark"] .rk-theme-icon--sun,
:root:not([data-theme]) .rk-theme-icon--moon { display: block; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme]) .rk-theme-icon--moon { display: none; }
    :root:not([data-theme]) .rk-theme-icon--sun  { display: block; }
}
:root[data-theme="light"] .rk-theme-icon--moon { display: block; }
:root[data-theme="light"] .rk-theme-icon--sun  { display: none; }
:root[data-theme="dark"]  .rk-theme-icon--sun  { display: block; }
:root[data-theme="dark"]  .rk-theme-icon--moon { display: none; }

/* ----- Switch (form toggle bound to a checkbox) ----------------------- */
.rk-switch {
    display: inline-flex; align-items: center; gap: 10px;
    cursor: pointer;
    font-size: 12.5px; color: var(--rk-ink-700); font-weight: 500;
    user-select: none;
}
.rk-switch__input { position: absolute; opacity: 0; pointer-events: none; }
.rk-switch__track {
    width: 34px; height: 20px;
    background: var(--rk-surface-3);
    border-radius: 999px;
    position: relative;
    transition: background 120ms ease;
    flex: 0 0 auto;
}
.rk-switch__track::after {
    content: "";
    position: absolute; top: 2px; left: 2px;
    width: 16px; height: 16px;
    background: var(--rk-surface);
    border-radius: 50%;
    box-shadow: var(--rk-shadow-1);
    transition: transform 140ms ease;
}
.rk-switch__input:checked + .rk-switch__track { background: var(--rk-ok); }
.rk-switch__input:checked + .rk-switch__track::after { transform: translateX(14px); }
.rk-switch__input:focus-visible + .rk-switch__track {
    outline: 2px solid var(--rk-accent);
    outline-offset: 2px;
}
.rk-switch__label b { color: var(--rk-ink-900); font-weight: 600; }
.rk-switch__hint { color: var(--rk-ink-500); font-size: 11.5px; }

/* ----- Color picker (native input styled to match) --------------------- */
.rk-color-picker {
    display: inline-flex; align-items: stretch;
    border: 1px solid var(--rk-line-strong);
    border-radius: var(--rk-r-2);
    background: var(--rk-surface);
    overflow: hidden;
    transition: border-color 120ms ease, box-shadow 120ms ease;
    height: 34px;
}
.rk-color-picker:focus-within {
    border-color: var(--rk-accent);
    box-shadow: 0 0 0 3px var(--rk-accent-tint);
}
.rk-color-picker__swatch {
    width: 42px;
    background: var(--rk-surface-3);
    position: relative;
    cursor: pointer;
}
.rk-color-picker__swatch input[type="color"] {
    appearance: none; -webkit-appearance: none;
    position: absolute; inset: 0;
    width: 100%; height: 100%;
    border: 0; padding: 0; margin: 0;
    background: transparent;
    cursor: pointer;
    opacity: 0;
}
.rk-color-picker__hex {
    flex: 1;
    padding: 0 10px;
    background: transparent;
    border: 0; outline: 0;
    font-family: var(--rk-f-mono);
    font-size: 12px;
    color: var(--rk-ink-900);
    text-transform: uppercase;
    letter-spacing: 0.02em;
}
.rk-color-picker__hex::placeholder { color: var(--rk-ink-300); font-family: var(--rk-f-mono); }

/* ----- Drop zone (file upload target) ---------------------------------- */
.rk-drop {
    display: flex; flex-direction: column; align-items: center; gap: 6px;
    padding: var(--rk-s-6);
    border: 1.5px dashed var(--rk-line-strong);
    border-radius: var(--rk-r-3);
    background: var(--rk-surface-2);
    color: var(--rk-ink-500);
    cursor: pointer;
    transition: border-color 120ms ease, background 120ms ease, color 120ms ease;
    outline: 0;
    text-align: center;
}
.rk-drop:hover,
.rk-drop:focus-visible { border-color: var(--rk-accent); color: var(--rk-accent-lo); }
.rk-drop--over { border-color: var(--rk-accent); background: var(--rk-accent-tint); color: var(--rk-accent-lo); }
.rk-drop code { font-family: var(--rk-f-mono); font-size: 12px; }
.rk-drop__or { text-align: center; margin: var(--rk-s-2) 0; color: var(--rk-ink-500); font-size: 12px; }

/* ----- Modal (image / small-content overlay) --------------------------- */
.rk-modal {
    position: fixed; inset: 0;
    background: rgba(15, 18, 22, 0.55);
    display: none;
    align-items: center; justify-content: center;
    z-index: 100;
    padding: var(--rk-s-6);
}
.rk-modal[data-open="true"] { display: flex; }
.rk-modal__card {
    background: var(--rk-surface);
    border-radius: var(--rk-r-3);
    box-shadow: var(--rk-shadow-2);
    max-width: 520px; width: 100%;
    max-height: 90vh;
    display: flex; flex-direction: column;
    overflow: hidden;
}
.rk-modal__card--lg { max-width: 820px; }
.rk-modal__card--xl { max-width: 1080px; }
.rk-modal__head {
    display: flex; align-items: center; gap: var(--rk-s-3);
    padding: var(--rk-s-4) var(--rk-s-5);
    border-bottom: 1px solid var(--rk-line-soft);
}
.rk-modal__title { font-size: 14px; font-weight: 600; color: var(--rk-ink-900); margin: 0; flex: 1; }
.rk-modal__close {
    color: var(--rk-ink-500);
    width: 28px; height: 28px; border-radius: var(--rk-r-2);
    display: grid; place-items: center;
}
.rk-modal__close:hover { background: var(--rk-surface-3); color: var(--rk-ink-900); }
.rk-modal__body { padding: var(--rk-s-5); overflow-y: auto; }
.rk-modal__body img { width: 100%; display: block; border-radius: var(--rk-r-2); }
.rk-modal__foot {
    padding: var(--rk-s-3) var(--rk-s-5);
    border-top: 1px solid var(--rk-line-soft);
    display: flex; justify-content: flex-end; gap: var(--rk-s-2);
}

/* ----- Empty state ------------------------------------------------------ */
.rk-empty {
    padding: var(--rk-s-9) var(--rk-s-6);
    text-align: center;
    color: var(--rk-ink-500);
}
.rk-empty__mark {
    display: inline-block;
    padding: 0 var(--rk-s-4) 4px;
    font-family: var(--rk-f-serif); font-style: italic; font-size: 20px;
    color: var(--rk-ink-700);
    border-bottom: 1px solid var(--rk-gilt);
    margin-bottom: var(--rk-s-4);
}

/* ----- Utility: stack --------------------------------------------------- */
.rk-stack { display: flex; flex-wrap: wrap; gap: var(--rk-s-3); align-items: center; }

/* ----- AG Grid theme adjustments --------------------------------------- */
/* We use ag-theme-quartz and re-skin it with our tokens.
   Any raw color inside AG Grid comes from these overrides. */
.ag-theme-quartz.rk-ag {
    --ag-font-family: var(--rk-f-sans);
    --ag-font-size: 12.5px;
    --ag-foreground-color: var(--rk-ink-900);
    --ag-background-color: var(--rk-surface);
    --ag-header-background-color: var(--rk-surface-2);
    --ag-header-foreground-color: var(--rk-ink-500);
    --ag-odd-row-background-color: var(--rk-surface);
    --ag-row-hover-color: var(--rk-surface-2);
    --ag-selected-row-background-color: var(--rk-accent-tint);
    --ag-border-color: var(--rk-line-soft);
    --ag-secondary-border-color: var(--rk-line-soft);
    --ag-header-column-separator-color: transparent;
    --ag-cell-horizontal-border: solid var(--rk-line-soft);
    --ag-row-border-color: var(--rk-line-soft);
    --ag-input-focus-border-color: var(--rk-accent);
    --ag-input-focus-box-shadow: 0 0 0 3px var(--rk-accent-tint);
    --ag-checkbox-checked-color: var(--rk-accent);
    --ag-range-selection-border-color: var(--rk-accent);
    --ag-header-height: 40px;
    --ag-row-height: 44px;
    --ag-cell-widget-spacing: 8px;
    --ag-borders: none;
    --ag-wrapper-border-radius: 0;
    border-top: 1px solid var(--rk-line-soft);
}
.ag-theme-quartz.rk-ag .ag-header {
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
    font-size: 11px;
}

/* ----- Responsive ------------------------------------------------------- */
@media (max-width: 1100px) {
    .rk-form-grid { grid-template-columns: 1fr; }
    .rk-stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 780px) {
    :root { --rk-sidebar-w: 0px; }
    .rk-side { display: none; }
    .rk-assets { grid-template-columns: 1fr; }
    .rk-field__row { grid-template-columns: 1fr; }
}

/* ==========================================================================
   Pre-auth screens — Login, Logout, ForgotPassword, ResetPassword, AccessDenied
   Rendered inside _LayoutV2Auth.cshtml (no sidebar, no topbar).
   ========================================================================== */

body.rk-auth {
    background: var(--rk-canvas);
    color: var(--rk-ink-700);
    min-height: 100vh;
    margin: 0;
    font-family: var(--rk-f-sans);
    display: flex;
    flex-direction: column;
}

.rk-auth__topact {
    position: absolute;
    top: var(--rk-s-4);
    right: var(--rk-s-4);
    display: flex;
    gap: var(--rk-s-2);
}

.rk-auth__stage {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--rk-s-10) var(--rk-s-4);
    gap: var(--rk-s-6);
}

.rk-auth__brand {
    display: inline-flex;
    align-items: center;
    gap: var(--rk-s-3);
    text-decoration: none;
    color: inherit;
    padding: var(--rk-s-2) var(--rk-s-3);
    border-radius: var(--rk-r-2);
}
.rk-auth__brand:hover { background: transparent; }
.rk-auth__brand:focus-visible { outline: 2px solid var(--rk-accent); outline-offset: 2px; }

.rk-auth__crest {
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: var(--rk-f-serif);
    font-style: italic;
    font-size: 22px;
    color: var(--rk-accent-ink);
    background: var(--rk-accent);
    border-radius: 4px;
    box-shadow: inset 0 0 0 1px var(--rk-gilt);
}

.rk-auth__lockup {
    display: inline-flex;
    flex-direction: column;
    line-height: 1;
    gap: 4px;
}
.rk-auth__wordmark {
    font-family: var(--rk-f-serif);
    font-style: italic;
    font-size: 22px;
    color: var(--rk-ink-900);
    letter-spacing: 0.01em;
}
.rk-auth__eyebrow {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--rk-ink-500);
}

.rk-auth__card {
    width: 100%;
    max-width: 400px;
    background: var(--rk-surface);
    border: 1px solid var(--rk-line-strong);
    border-radius: var(--rk-r-3);
    box-shadow: var(--rk-shadow-2);
    padding: var(--rk-s-8) var(--rk-s-7);
    position: relative;
}
.rk-auth__card::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 2px;
    background: var(--rk-gilt);
    opacity: 0.55;
    border-top-left-radius: var(--rk-r-3);
    border-top-right-radius: var(--rk-r-3);
}

.rk-auth__title {
    margin: 0 0 var(--rk-s-2);
    font-size: 20px;
    font-weight: 600;
    color: var(--rk-ink-900);
    letter-spacing: -0.005em;
}
.rk-auth__sub {
    margin: 0 0 var(--rk-s-6);
    font-size: 13px;
    color: var(--rk-ink-500);
}

.rk-auth__form { display: flex; flex-direction: column; gap: var(--rk-s-4); }

.rk-auth__row { display: flex; align-items: center; justify-content: space-between; gap: var(--rk-s-3); }

.rk-auth__check {
    display: inline-flex;
    align-items: center;
    gap: var(--rk-s-2);
    font-size: 13px;
    color: var(--rk-ink-700);
    cursor: pointer;
    user-select: none;
}
.rk-auth__check input { margin: 0; accent-color: var(--rk-accent); }

.rk-auth__link {
    font-size: 13px;
    color: var(--rk-accent);
    text-decoration: none;
    font-weight: 500;
}
.rk-auth__link:hover { text-decoration: underline; }

.rk-auth__cta { width: 100%; justify-content: center; }

.rk-auth__foot {
    margin-top: var(--rk-s-4);
    font-size: 11px;
    color: var(--rk-ink-500);
    letter-spacing: 0.02em;
}

.rk-auth__meta {
    display: flex;
    justify-content: center;
    gap: var(--rk-s-4);
    margin-top: var(--rk-s-5);
    font-size: 12px;
    color: var(--rk-ink-500);
}
.rk-auth__meta a { color: var(--rk-accent); text-decoration: none; }
.rk-auth__meta a:hover { text-decoration: underline; }

.rk-auth__icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--rk-accent-tint);
    color: var(--rk-accent);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--rk-s-4);
}
.rk-auth__icon--ok    { background: var(--rk-ok-tint);   color: var(--rk-ok); }
.rk-auth__icon--warn  { background: var(--rk-warn-tint); color: var(--rk-warn); }
.rk-auth__icon--danger{ background: var(--rk-danger-tint); color: var(--rk-danger); }

@media (max-width: 480px) {
    .rk-auth__card { padding: var(--rk-s-6) var(--rk-s-5); }
    .rk-auth__stage { padding: var(--rk-s-6) var(--rk-s-3); }
}
