/*
|--------------------------------------------------------------------------
| REJIT Dairy Farm — brand stylesheet
|--------------------------------------------------------------------------
| Color tokens extracted from https://rejitdairyfarm.lovable.app/
| Deep green primary, warm cream background, golden accent.
*/

:root {
    --rejit-radius: .75rem;
    --rejit-background: oklch(98.5% .012 95);
    --rejit-foreground: oklch(22% .04 145);
    --rejit-card: oklch(100% 0 0);
    --rejit-primary: oklch(42% .11 148);
    --rejit-primary-dark: oklch(35% .1 148);
    --rejit-primary-foreground: oklch(98.5% .012 95);
    --rejit-secondary: oklch(94% .03 90);
    --rejit-secondary-foreground: oklch(28% .05 145);
    --rejit-muted: oklch(95% .015 90);
    --rejit-muted-foreground: oklch(50% .02 145);
    --rejit-accent: oklch(78% .14 75);
    --rejit-accent-foreground: oklch(22% .04 145);
    --rejit-success: oklch(62% .16 150);
    --rejit-warning: oklch(72% .16 60);
    --rejit-destructive: oklch(55% .22 25);
    --rejit-border: oklch(90% .02 90);
    --rejit-input: oklch(92% .02 90);
    --rejit-ring: oklch(42% .11 148);
    --rejit-sidebar: oklch(27% .05 145);
    --rejit-sidebar-foreground: oklch(95% .02 90);
    --rejit-sidebar-accent: oklch(35% .07 148);
    --rejit-sidebar-border: oklch(32% .05 145);
}

body {
    background-color: var(--rejit-background);
    color: var(--rejit-foreground);
    font-family: 'Nunito', system-ui, -apple-system, sans-serif;
}

/* ---------------------------------------------------------------------
 | Scrollbars — brand green thumb on a transparent track
 |-------------------------------------------------------------------- */
* {
    scrollbar-width: thin;                                  /* Firefox */
    scrollbar-color: oklch(42% .11 148 / .55) transparent;  /* thumb, track */
}

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background-color: oklch(42% .11 148 / .55);
    border-radius: 999px;
    border: 2px solid transparent;   /* inset look, lets the wallpaper breathe */
    background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
    background-color: var(--rejit-primary);
}

::-webkit-scrollbar-corner {
    background: transparent;
}

/* While a window titlebar is pinned to the menu bar, make the page
   scrollbar more present so the scroll position stays obvious. */
body.titlebar-stuck::-webkit-scrollbar-thumb {
    background-color: oklch(42% .11 148 / .85);
}

body.titlebar-stuck {
    scrollbar-color: oklch(42% .11 148 / .85) transparent;
}

a {
    color: var(--rejit-primary);
}

a:hover {
    color: var(--rejit-primary-dark);
}

/* ---------------------------------------------------------------------
 | Navbar
 |-------------------------------------------------------------------- */
.rejit-navbar {
    background-color: var(--rejit-sidebar);
    border-bottom: 1px solid var(--rejit-sidebar-border);
}

.rejit-navbar .navbar-brand,
.rejit-navbar .nav-link {
    color: var(--rejit-sidebar-foreground);
}

.rejit-navbar .nav-link:hover,
.rejit-navbar .nav-link:focus {
    color: var(--rejit-accent);
}

.rejit-navbar .nav-link.active {
    color: var(--rejit-accent);
    font-weight: 700;
}

.rejit-navbar .navbar-toggler {
    border-color: var(--rejit-sidebar-border);
}

.rejit-navbar .navbar-toggler-icon {
    filter: invert(1);
}

.rejit-navbar .dropdown-menu {
    border-radius: var(--rejit-radius);
    border-color: var(--rejit-border);
}

/* ---------------------------------------------------------------------
 | Bootstrap component overrides
 |-------------------------------------------------------------------- */
.btn-primary {
    --bs-btn-bg: var(--rejit-primary);
    --bs-btn-border-color: var(--rejit-primary);
    --bs-btn-hover-bg: var(--rejit-primary-dark);
    --bs-btn-hover-border-color: var(--rejit-primary-dark);
    --bs-btn-active-bg: var(--rejit-primary-dark);
    --bs-btn-active-border-color: var(--rejit-primary-dark);
    border-radius: var(--rejit-radius);
}

.btn-accent {
    background-color: var(--rejit-accent);
    border-color: var(--rejit-accent);
    color: var(--rejit-accent-foreground);
    border-radius: var(--rejit-radius);
    font-weight: 700;
}

.btn-accent:hover {
    filter: brightness(.95);
    color: var(--rejit-accent-foreground);
}

.btn-link {
    color: var(--rejit-primary);
}

.card {
    border-radius: var(--rejit-radius);
    border-color: var(--rejit-border);
    background-color: var(--rejit-card);
}

.card-header {
    background-color: var(--rejit-muted);
    border-bottom-color: var(--rejit-border);
    font-weight: 700;
    border-radius: var(--rejit-radius) var(--rejit-radius) 0 0 !important;
}

.form-control,
.form-select {
    border-radius: calc(var(--rejit-radius) - .25rem);
    border-color: var(--rejit-input);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--rejit-ring);
    box-shadow: 0 0 0 .25rem oklch(42% .11 148 / .15);
}

/* Custom <select> styling — brand-themed dropdown/options instead of
   the browser/Bootstrap defaults (used across the whole app). */
.form-select {
    --bs-form-select-bg-img: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23135d27' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
}

.form-select option {
    font-weight: 600;
    color: var(--rejit-foreground);
    background-color: var(--rejit-card);
}

.form-select option:checked {
    background-color: var(--rejit-primary);
    color: #fff;
}

/* Modern Chromium (customizable select): style the whole dropdown picker */
@supports (appearance: base-select) {
    .form-select,
    .form-select::picker(select) {
        appearance: base-select;
    }

    /* Hide the native picker arrow — keep only our themed chevron
       (background-image set via --bs-form-select-bg-img above). */
    .form-select::picker-icon {
        display: none;
    }

    .form-select::picker(select) {
        margin-top: .35rem;
        padding: .3rem;
        border: 1px solid var(--rejit-border);
        border-radius: .75rem;
        background: var(--rejit-card);
        box-shadow: 0 12px 28px oklch(18% .03 145 / .22);
    }

    .form-select option {
        padding: .4rem .9rem;
        border-radius: .5rem;
        cursor: pointer;
    }

    .form-select option:hover,
    .form-select option:focus {
        background: var(--rejit-muted);
    }

    .form-select option:checked {
        background: var(--rejit-primary);
        color: #fff;
    }

    .form-select option::checkmark {
        display: none;
    }
}

/* Custom date/time inputs — themed calendar icon & picker accent color
   instead of the default Bootstrap/browser look. */
input[type="date"],
input[type="time"],
input[type="datetime-local"],
input[type="month"],
input[type="week"] {
    accent-color: var(--rejit-primary);
    color-scheme: light;
}

input[type="date"]::-webkit-calendar-picker-indicator,
input[type="datetime-local"]::-webkit-calendar-picker-indicator,
input[type="month"]::-webkit-calendar-picker-indicator,
input[type="week"]::-webkit-calendar-picker-indicator {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23135d27' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3crect x='3' y='4' width='18' height='18' rx='2'/%3e%3cline x1='16' y1='2' x2='16' y2='6'/%3e%3cline x1='8' y1='2' x2='8' y2='6'/%3e%3cline x1='3' y1='10' x2='21' y2='10'/%3e%3c/svg%3e");
    background-size: 1rem 1rem;
    width: 1rem;
    height: 1rem;
    opacity: .75;
    cursor: pointer;
    filter: none;
}

input[type="date"]::-webkit-calendar-picker-indicator:hover,
input[type="datetime-local"]::-webkit-calendar-picker-indicator:hover,
input[type="month"]::-webkit-calendar-picker-indicator:hover,
input[type="week"]::-webkit-calendar-picker-indicator:hover {
    opacity: 1;
}

/* input[type="date"] is made read-only by rejitInitDatePicker() so the
   native OS calendar never opens — keep it looking like a normal
   (non-disabled) field. */
input[type="date"]:read-only {
    background-color: var(--rejit-card);
    cursor: pointer;
}

/* Custom calendar popover (rejitInitDatePicker in rejit.js) — replaces the
   native OS/browser calendar with one themed to match the rest of the app. */
.rejit-datepicker {
    position: absolute;
    z-index: 1080;
    width: 17.5rem;
    max-width: calc(100vw - 1rem);
    padding: .75rem;
    background: var(--rejit-card);
    border: 1px solid var(--rejit-border);
    border-radius: var(--rejit-radius);
    box-shadow: 0 12px 28px oklch(18% .03 145 / .22);
    font-size: .875rem;
}

.rejit-datepicker[hidden] {
    display: none;
}

.rejit-datepicker-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: .5rem;
}

.rejit-datepicker-title {
    font-weight: 600;
    color: var(--rejit-foreground);
}

.rejit-datepicker-header button {
    border: 1px solid var(--rejit-border);
    background: var(--rejit-muted);
    color: var(--rejit-foreground);
    border-radius: .5rem;
    width: 2rem;
    height: 2rem;
    line-height: 1;
    font-size: 1.1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.rejit-datepicker-header button:hover {
    background: var(--rejit-secondary);
}

.rejit-datepicker-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: .15rem;
    text-align: center;
}

.rejit-datepicker-weekday {
    font-size: .7rem;
    font-weight: 600;
    color: var(--rejit-muted-foreground);
    padding: .25rem 0;
    text-transform: uppercase;
}

.rejit-datepicker-grid button {
    border: none;
    background: transparent;
    color: var(--rejit-foreground);
    border-radius: .5rem;
    padding: .4rem 0;
    cursor: pointer;
}

.rejit-datepicker-grid button:hover {
    background: var(--rejit-muted);
}

.rejit-datepicker-grid button.is-outside {
    color: var(--rejit-muted-foreground);
    opacity: .5;
}

.rejit-datepicker-grid button.is-today {
    font-weight: 700;
    box-shadow: inset 0 0 0 1px var(--rejit-primary);
}

.rejit-datepicker-grid button.is-selected {
    background: var(--rejit-primary);
    color: var(--rejit-primary-foreground);
}

.rejit-datepicker-grid button:disabled {
    color: var(--rejit-muted-foreground);
    opacity: .35;
    cursor: not-allowed;
}

.rejit-datepicker-footer {
    display: flex;
    gap: .5rem;
    margin-top: .5rem;
    padding-top: .5rem;
    border-top: 1px solid var(--rejit-border);
}

.rejit-datepicker-footer button {
    flex: 1;
    border: 1px solid var(--rejit-border);
    background: var(--rejit-muted);
    color: var(--rejit-foreground);
    border-radius: .5rem;
    padding: .35rem .5rem;
    font-size: .8rem;
    font-weight: 600;
    cursor: pointer;
}

.rejit-datepicker-footer button:hover {
    background: var(--rejit-secondary);
}

.form-check-input:checked {
    background-color: var(--rejit-primary);
    border-color: var(--rejit-primary);
}

.text-success { color: var(--rejit-success) !important; }
.text-warning { color: var(--rejit-warning) !important; }
.text-danger  { color: var(--rejit-destructive) !important; }

/* ---------------------------------------------------------------------
 | Auth (login) page
 |-------------------------------------------------------------------- */
.rejit-auth {
    min-height: 100vh;
    display: flex;
    align-items: stretch;
}

.rejit-auth-brand {
    background:
        linear-gradient(to top, oklch(18% .03 145 / .9) 0%, oklch(18% .03 145 / .35) 45%, oklch(18% .03 145 / .1) 100%),
        url('../images/login-hero.jpg') center / cover no-repeat;
    color: var(--rejit-sidebar-foreground);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 3rem 3.5rem;
}

.rejit-auth-brand .brand-logo {
    font-size: 2.25rem;
    font-weight: 800;
    color: #fff;
    text-shadow: 0 2px 8px oklch(18% .03 145 / .6);
}

.rejit-auth-brand .brand-location {
    color: var(--rejit-accent);
    font-weight: 700;
    letter-spacing: .02em;
}

.rejit-auth-brand .brand-tagline {
    font-size: 1.2rem;
    max-width: 26rem;
    opacity: .9;
}

.rejit-auth-form {
    /* background-color: var(--rejit-background); */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem 1.5rem;
}

.rejit-auth-card {
    width: 100%;
    /* max-width: 26rem; */
    /* background-color: var(--rejit-card); */
    /* border: 1px solid var(--rejit-border); */
    /* border-radius: var(--rejit-radius); */
    /* box-shadow: 0 10px 30px oklch(22% .04 145 / .08); */
    padding: 2.5rem 2rem;
}

.rejit-auth-card h1 {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--rejit-foreground);
}

.rejit-auth-card .form-label {
    font-weight: 700;
    color: var(--rejit-secondary-foreground);
}

.rejit-auth-footer {
    color: var(--rejit-muted-foreground);
    font-size: .875rem;
}

@media (max-width: 991.98px) {
    .rejit-auth {
        flex-direction: column;
    }

    .rejit-auth-brand {
        display: none;
    }

    .rejit-auth-form {
        min-height: 100vh;
        background:
            linear-gradient(to top, oklch(18% .03 145 / .9) 0%, oklch(18% .03 145 / .55) 100%),
            url('../images/login-hero.jpg') center / cover no-repeat;
    }

    .rejit-auth-card {
        background-color: var(--rejit-card);
        border-radius: var(--rejit-radius);
        box-shadow: 0 10px 30px oklch(18% .03 145 / .35);
    }
}

/* ---------------------------------------------------------------------
 | macOS-style desktop (logged-in shell)
 |-------------------------------------------------------------------- */
.rejit-desktop {
    min-height: 100vh;
    background: url('../images/desktop-bg.jpg') center / cover no-repeat fixed;
    display: flex;
    flex-direction: column;
}

.rejit-desktop-main {
    flex: 1;
    padding-top: 2.5rem;   /* exactly the fixed menu bar height — no extra gap */
    padding-bottom: 7rem;  /* clear the dock */
    overflow-y: auto;
}

/* Wide content container for desktop pages */
.rejit-container {
    width: 100%;
    max-width: 1400px;
    margin-inline: auto;
    padding-inline: 1rem;
}

/* Menu bar (top) */
.rejit-menubar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1030;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
    background: oklch(27% .05 145 / .65);
    backdrop-filter: blur(16px) saturate(1.4);
    -webkit-backdrop-filter: blur(16px) saturate(1.4);
    color: #fff;
    font-size: .9rem;
}

.rejit-menubar .menubar-left,
.rejit-menubar .menubar-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.rejit-menubar .menubar-brand {
    color: #fff;
    text-decoration: none;
}

.menubar-logo {
    height: 1.4rem;
    width: auto;
    border-radius: .25rem;
    vertical-align: text-bottom;
}

.brand-logo-img {
    height: 2.5rem;
    width: auto;
    border-radius: .4rem;
    vertical-align: middle;
}

.rejit-menubar .menubar-item {
    color: oklch(95% .02 90);
    text-decoration: none;
    cursor: default;
}

.rejit-menubar a.menubar-item {
    cursor: pointer;
}

.rejit-menubar a.menubar-item:hover {
    color: var(--rejit-accent);
}

.menubar-avatar {
    width: 1.6em;
    height: 1.6em;
    border-radius: 50%;
    object-fit: cover;
    vertical-align: -.4em;
    margin-right: .25rem;
    border: 1px solid oklch(95% .02 90 / .35);
}

.rejit-menubar .menubar-clock {
    font-variant-numeric: tabular-nums;
    min-width: 9rem;
    text-align: right;
}

.rejit-menubar .dropdown-menu {
    border-radius: var(--rejit-radius);
    margin-top: .5rem;
}

/* Dock (bottom) */
.rejit-dock {
    position: fixed;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1030;
    display: flex;
    align-items: flex-end;
    gap: .5rem;
    padding: .6rem .9rem;
    border-radius: 1.25rem;
    background: oklch(98.5% .012 95 / .35);
    border: 1px solid oklch(100% 0 0 / .35);
    backdrop-filter: blur(18px) saturate(1.5);
    -webkit-backdrop-filter: blur(18px) saturate(1.5);
    box-shadow: 0 15px 35px oklch(18% .03 145 / .35);
}

.rejit-dock .dock-item {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
}

.rejit-dock .dock-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 3.25rem;
    height: 3.25rem;
    border-radius: .9rem;
    background: linear-gradient(160deg, oklch(100% 0 0 / .85), oklch(94% .03 90 / .75));
    border: 1px solid oklch(100% 0 0 / .6);
    box-shadow: 0 4px 10px oklch(18% .03 145 / .25);
    transition: transform .18s ease, margin .18s ease;
}

.rejit-dock .dock-icon img {
    width: 2rem;
    height: 2rem;
}

.rejit-dock .dock-item:hover .dock-icon {
    transform: scale(1.35) translateY(-.5rem);
    margin: 0 .45rem;
}

/* Label appears above the icon on hover, like macOS tooltips */
.rejit-dock .dock-label {
    position: absolute;
    bottom: calc(100% + 1rem);
    padding: .2rem .6rem;
    border-radius: .5rem;
    background: oklch(22% .04 145 / .85);
    color: #fff;
    font-size: .75rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity .15s ease;
}

.rejit-dock .dock-item:hover .dock-label {
    opacity: 1;
}

/* Running-app indicator dot for the active page */
.rejit-dock .dock-item.active::after {
    content: '';
    position: absolute;
    bottom: -.45rem;
    width: .3rem;
    height: .3rem;
    border-radius: 50%;
    background: oklch(22% .04 145 / .8);
}

/* macOS-style window */
.rejit-window {
    max-width: 100%;
    border-radius: .9rem;
    overflow: hidden;
    background: oklch(98.5% .012 95 / .92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid oklch(100% 0 0 / .5);
    box-shadow: 0 25px 60px oklch(18% .03 145 / .45);
}

.rejit-window .window-titlebar {
    display: flex;
    align-items: center;
    padding: .65rem 1rem;
    background: oklch(94% .03 90 / .9);
    border-bottom: 1px solid var(--rejit-border);
    /* pins against the lower edge of the 2.5rem fixed menu bar; at top: 0
       it would slide underneath the menu bar instead of touching it */
    position: sticky;
    top: 0 rem;
    z-index: 10;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: box-shadow .2s ease, background-color .2s ease;
}

/* Applied by rejit.js the moment the titlebar touches the menu bar */
.rejit-window .window-titlebar.is-stuck {
    background: oklch(96% .02 90 / .97);
    box-shadow: 0 6px 18px oklch(18% .03 145 / .25);
    border-bottom-color: oklch(85% .03 90);
}

.rejit-window .traffic-lights {
    display: flex;
    gap: .45rem;
    color: oklch(25% 0 0 / .65);

}

.rejit-window .light {
    width: .75rem;
    height: .75rem;
    border-radius: 50%;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: oklch(25% 0 0 / .65);

}

.rejit-window .light:hover {
    filter: brightness(.85);
}

/* macOS-style glyphs, revealed when hovering the traffic-light cluster */
.rejit-window .light::after {
    font-size: .55rem;
    font-weight: 800;
    line-height: 1;
    color: #000;
}

.rejit-window .light.red::after    { content: '✕'; }
.rejit-window .light.yellow::after { content: '–'; }
.rejit-window .light.green::after  { content: '⤢'; }

/* Window states driven by the traffic lights */
.rejit-window.window-hidden {
    display: none;
}

.rejit-window.window-small {
    max-width: 48rem;
}

/* Split view button injected into the titlebar */
.window-split-btn {
    border: 0;
    background: transparent;
    font-size: 1rem;
    line-height: 1;
    color: var(--rejit-muted-foreground);
    padding: 0 .25rem;
    cursor: pointer;
}

.window-split-btn:hover {
    color: var(--rejit-foreground);
}

.rejit-window .light.red    { background: #ff5f57; }
.rejit-window .light.yellow { background: #febc2e; }
.rejit-window .light.green  { background: #28c840; }

.rejit-window .window-title {
    flex: 1;
    text-align: center;
    font-size: .85rem;
    font-weight: 700;
    color: var(--rejit-muted-foreground);
    /* keep the title visually centered despite the traffic lights */
    margin-right: 2.85rem;
}

.rejit-window .window-body {
    padding: 1.5rem 2rem;
}

@media (max-width: 575.98px) {
    .rejit-window .window-body {
        padding: 1.25rem 1rem;
    }
}

/* Read-only system information block (Farm Config) */
.system-info {
    border-top: 1px dashed var(--rejit-border);
    padding-top: 1.25rem;
    color: var(--rejit-muted-foreground);
}

.system-info dd {
    color: var(--rejit-foreground);
    font-weight: 600;
}

.rejit-window .window-heading {
    font-size: 1.4rem;
    font-weight: 800;
}

/* Dashboard stat cards inside the window */
.stat-card {
    background: var(--rejit-card);
    border: 1px solid var(--rejit-border);
    border-radius: var(--rejit-radius);
    padding: 1.25rem;
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: .35rem;
}

.stat-card .stat-label {
    font-size: .85rem;
    font-weight: 700;
    color: var(--rejit-muted-foreground);
    text-transform: uppercase;
    letter-spacing: .04em;
}

.stat-card .stat-value {
    font-size: 1.6rem;
    font-weight: 800;
}

.stat-card .stat-link {
    font-size: .875rem;
    font-weight: 700;
    text-decoration: none;
    margin-top: auto;
}

/* Minimized-window tray inside the dock */
.dock-divider {
    width: 1px;
    align-self: stretch;
    background: oklch(22% .04 145 / .25);
    margin: 0 .3rem;
    border-radius: 1px;
}

.dock-tray {
    display: flex;
    align-items: flex-end;
    gap: .5rem;
}

.dock-icon-min {
    font-size: 1.5rem;
    color: var(--rejit-primary);
}

/* Split view: two pages side by side */
.rejit-desktop-main.split {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    padding-inline: 1rem;
}

.rejit-desktop-main.split > .rejit-container,
.rejit-desktop-main.split > .container {
    flex: 1;
    min-width: 0;
}

.split-pane {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    height: calc(100vh - 11.5rem);
    position: sticky;
    top: 3.5rem;
    margin-top: 1.5rem;
}

.split-pane .window-titlebar {
    position: static;
    justify-content: space-between;
    gap: .5rem;
}

.split-pane iframe {
    flex: 1;
    border: 0;
    background: var(--rejit-background);
    border-radius: 0 0 .9rem .9rem;
}

.split-select {
    max-width: 15rem;
}

@media (max-width: 991.98px) {
    .rejit-desktop-main.split {
        display: block;
    }

    .split-pane {
        display: none;
    }
}

/* Embedded mode (page loaded inside a split-view iframe) */
.embedded .rejit-menubar,
.embedded .rejit-dock {
    display: none !important;
}

.embedded .rejit-desktop-main {
    padding-top: 1rem;
    padding-bottom: 1rem;
}

.embedded .rejit-window .window-titlebar {
    top: 0;
}

/* Reusable floating tab bar (hovers above the dock).
   One horizontal row on all screens; scrolls sideways when tabs overflow. */
.floating-tabbar {
    position: fixed;
    bottom: 6.75rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1030;
    display: flex;
    flex-wrap: nowrap;
    gap: .25rem;
    padding: .4rem;
    max-width: min(94vw, 60rem);
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    border-radius: 999px;
    background: oklch(98.5% .012 95 / .6);
    border: 1px solid oklch(100% 0 0 / .45);
    backdrop-filter: blur(16px) saturate(1.4);
    -webkit-backdrop-filter: blur(16px) saturate(1.4);
    box-shadow: 0 10px 25px oklch(18% .03 145 / .3);
}

.floating-tabbar::-webkit-scrollbar {
    display: none;
}

.floating-tab {
    flex: 0 0 auto;
    border: 0;
    background: transparent;
    border-radius: 999px;
    padding: .45rem .9rem; /* touch-friendly */
    font-weight: 700;
    font-size: .875rem;
    color: var(--rejit-foreground);
    cursor: pointer;
    white-space: nowrap;
}

.floating-tab.active {
    background: var(--rejit-primary);
    color: #fff;
}

.floating-tab:hover:not(.active) {
    background: oklch(94% .03 90 / .85);
}

.embedded .floating-tabbar {
    position: static;
    transform: none;
    margin: 0 auto 1rem;
    width: max-content;
    max-width: 100%;
}

/* A minimized/closed window takes its page chrome with it */
.window-minimized .floating-tabbar {
    display: none !important;
}

.settings-emoji-select {
    font-size: 1.25rem;
}

/* Farm settings page */
.settings-group-title {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--rejit-secondary-foreground);
    border-bottom: 1px solid var(--rejit-border);
    padding-bottom: .5rem;
    margin-bottom: 1rem;
}

.settings-image-preview {
    display: block;
    max-height: 5rem;
    border-radius: calc(var(--rejit-radius) - .25rem);
    border: 1px solid var(--rejit-border);
}

.form-control-color {
    min-width: 4rem;
}

/* Inline line icons (<x-icon>) — size to surrounding text */
.rejit-icon {
    width: 1.1em;
    height: 1.1em;
    vertical-align: -.18em;
    flex: 0 0 auto;
}

/* Staff page: roles & permissions */
.role-badge {
    background: var(--rejit-primary);
    color: #fff;
}

.perm-badge {
    background: var(--rejit-muted);
    color: var(--rejit-secondary-foreground);
    font-weight: 600;
}

.permission-details summary {
    cursor: pointer;
    font-weight: 700;
    font-size: .85rem;
    color: var(--rejit-primary);
}

.permission-details[open] .permission-badges {
    display: flex;
    flex-wrap: wrap;
    gap: .25rem;
    margin-top: .5rem;
    text-align: left;
}

/* Stat tiles (Total Roles / Total Permissions) */
.stat-tile {
    display: flex;
    align-items: center;
    gap: .85rem;
    background: var(--rejit-card);
    border: 2px solid var(--rejit-border);
    /* border-left: 4px solid var(--rejit-primary); */
    border-radius: var(--rejit-radius);
    padding: .9rem 1.1rem;
}

.stat-tile-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: .6rem;
    background: var(--rejit-sidebar);
    color: #fff;
    font-size: 1.15rem;
}

.stat-tile-value {
    font-size: 1.35rem;
    font-weight: 800;
    line-height: 1.1;
}

.stat-tile-label {
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--rejit-muted-foreground);
}

/* Role rows (expandable) */
.role-list {
    display: flex;
    flex-direction: column;
    gap: .75rem;
}

.role-row {
    background: var(--rejit-card);
    border: 1px solid var(--rejit-border);
    border-left: 4px solid var(--rejit-accent);
    border-radius: var(--rejit-radius);
}

.role-row-head {
    display: flex;
    align-items: center;
    gap: .8rem;
    padding: .85rem 1rem;
    flex-wrap: wrap;
}

.role-avatar {
    flex: 0 0 auto;
    width: 2.6rem;
    height: 2.6rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: .7rem;
    background: var(--rejit-muted);
    color: var(--rejit-primary);
    font-weight: 800;
    font-size: .95rem;
}

.role-row-title {
    flex: 1;
    min-width: 12rem;
}

.role-row-meta {
    display: flex;
    align-items: center;
    gap: .5rem;
    flex-wrap: wrap;
}

.meta-pill {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    padding: .25rem .7rem;
    border-radius: 999px;
    border: 1px solid var(--rejit-accent);
    color: var(--rejit-accent-foreground);
    background: oklch(78% .14 75 / .12);
    font-size: .8rem;
    font-weight: 700;
    white-space: nowrap;
}

.role-toggle .rejit-icon {
    transition: transform .2s ease;
}

.role-toggle[aria-expanded="true"] .rejit-icon {
    transform: rotate(180deg);
}

.role-row-body {
    border-top: 1px solid var(--rejit-border);
    padding: 1rem;
}

/* Staff table */
.staff-avatar {
    width: 2.4rem;
    height: 2.4rem;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--rejit-border);
}

.staff-avatar-lg {
    width: 4.5rem;
    height: 4.5rem;
}

.staff-avatar-xl {
    width: 6rem;
    height: 6rem;
}

.profile-card {
    background: var(--rejit-card);
    border: 1px solid var(--rejit-border);
    border-radius: var(--rejit-radius);
    padding: 1.5rem;
    text-align: center;
    height: 100%;
}

.profile-contact {
    display: flex;
    flex-direction: column;
    gap: .5rem;
    text-align: left;
    font-size: .9rem;
    word-break: break-word;
}

.user-profile-list dt {
    color: var(--rejit-muted-foreground);
    font-weight: 700;
    margin-bottom: .5rem;
}

.user-profile-list dd {
    margin-bottom: .5rem;
}

.staff-table thead th {
    font-size: .75rem;
    font-weight: 800;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--rejit-muted-foreground);
    background: var(--rejit-muted);
}

.cursor-pointer {
    cursor: pointer;
}

.staff-table tbody tr.cursor-pointer:hover {
    background: var(--rejit-muted);
}

.status-badge {
    display: inline-block;
    padding: .2rem .65rem;
    border-radius: 999px;
    font-size: .78rem;
    font-weight: 700;
}

.status-active {
    background: oklch(62% .16 150 / .15);
    color: var(--rejit-success);
}

.status-inactive {
    background: oklch(55% .22 25 / .12);
    color: var(--rejit-destructive);
}

/* Tasks page */
.task-filterbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .6rem;
}

.task-filterbar .perm-search {
    min-width: 14rem;
}

.task-status,
.priority-badge {
    display: inline-block;
    padding: .2rem .65rem;
    border-radius: 999px;
    font-size: .78rem;
    font-weight: 700;
    white-space: nowrap;
}

.task-status-pending     { background: oklch(72% .16 60 / .16);  color: oklch(55% .14 60); }
.task-status-in_progress { background: oklch(60% .12 240 / .14); color: oklch(48% .12 240); }
.task-status-completed   { background: oklch(62% .16 150 / .15); color: var(--rejit-success); }
.task-status-accepted    { background: oklch(42% .11 148 / .14); color: var(--rejit-primary); }
.task-status-overdue     { background: oklch(55% .22 25 / .16);  color: var(--rejit-destructive); }

.stat-tile-overdue .stat-tile-icon {
    background: oklch(55% .22 25 / .16);
    color: var(--rejit-destructive);
}
.stat-tile-overdue{
    border-color: var(--rejit-destructive) !important;
    color: var(--rejit-destructive);
}

.stat-tile-success {
    /* border-left-color: var(--rejit-success); */
}

.stat-tile-success .stat-tile-icon {
    background: oklch(62% .16 150 / .16);
    color: var(--rejit-success);
}

.stat-tile-success .stat-tile-value {
    color: var(--rejit-success);
}

.stat-tile-revenue {
    /* border-left-color: #135D27; */
}

.stat-tile-revenue .stat-tile-icon {
    background: #135D2729;
    color: #135D27;
}

.stat-tile-revenue .stat-tile-value {
    color: #135D27;
}

.stat-tile-danger {
    /* border-left-color: var(--rejit-destructive); */
}

.stat-tile-danger .stat-tile-icon {
    background: oklch(55% .22 25 / .16);
    color: var(--rejit-destructive);
}

.stat-tile-danger .stat-tile-value {
    color: var(--rejit-destructive);
}

/* Stat tiles that link out to their module page */
a.stat-tile-link {
    text-decoration: none;
    color: inherit;
    transition: transform .12s ease, box-shadow .12s ease;
}

a.stat-tile-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 .35rem .9rem -.4rem oklch(22% .04 145 / .3);
}

/* Monthly Income vs Expenses bar chart */
.chart-bars {
    display: flex;
    align-items: flex-end;
    gap: .6rem;
    height: 12rem;
    padding: 0 .25rem;
    overflow-x: auto;
}

.chart-bar-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1 0 2.5rem;
    min-width: 2.5rem;
    gap: .35rem;
}

.chart-bar-track {
    display: flex;
    align-items: flex-end;
    gap: .2rem;
    height: 10rem;
    width: 100%;
    justify-content: center;
}

.chart-bar {
    width: .85rem;
    min-height: 2px;
    border-radius: .25rem .25rem 0 0;
}

.chart-bar-income { background: var(--rejit-success); }
.chart-bar-expense { background: var(--rejit-destructive); }

.chart-month-label {
    font-size: .72rem;
    font-weight: 700;
    color: var(--rejit-muted-foreground);
    text-transform: uppercase;
}

.chart-legend {
    display: flex;
    gap: 1.25rem;
    align-items: center;
    font-size: .82rem;
    color: var(--rejit-muted-foreground);
}

.chart-legend-swatch {
    display: inline-block;
    width: .75rem;
    height: .75rem;
    border-radius: .2rem;
    margin-right: .35rem;
    vertical-align: -1px;
}

.priority-low    { background: var(--rejit-muted); color: var(--rejit-muted-foreground); }
.priority-medium { background: oklch(78% .14 75 / .18); color: oklch(55% .12 75); }
.priority-high   { background: oklch(55% .22 25 / .14); color: var(--rejit-destructive); }

/* Income & Expenses */
.txn-badge {
    display: inline-block;
    padding: .2rem .65rem;
    border-radius: 999px;
    font-size: .78rem;
    font-weight: 700;
    white-space: nowrap;
}

.txn-badge-income  { background: oklch(62% .16 150 / .15); color: var(--rejit-success); }
.txn-badge-expense { background: oklch(55% .22 25 / .16);  color: var(--rejit-destructive); }
.txn-badge-neutral { background: oklch(60% .02 250 / .12); color: var(--rejit-muted-foreground, #6b7280); }

.txn-amount-income  { color: var(--rejit-success); font-weight: 700; }
.txn-amount-expense { color: var(--rejit-destructive); font-weight: 700; }

.task-thumb {
    width: 2.6rem;
    height: 2.6rem;
    object-fit: cover;
    border-radius: .5rem;
    border: 1px solid var(--rejit-border);
    flex: 0 0 auto;
}

.task-show-image {
    max-width: 100%;
    max-height: 20rem;
    border-radius: var(--rejit-radius);
    border: 1px solid var(--rejit-border);
}

/* Assignee multi-select picker (built on the permission-grid pattern) */
.assignee-picker .assignee-items {
    max-height: 14rem;
    overflow-y: auto;
}

.assignee-item {
    align-items: flex-start;
}

.assignee-item .assignee-info {
    display: flex;
    flex-direction: column;
    line-height: 1.25;
    min-width: 0;
}

/* Menu bar notifications bell */
.menubar-bell {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.notif-badge {
    position: absolute;
    top: -6px;
    right: -8px;
    min-width: 1rem;
    height: 1rem;
    padding: 0 .25rem;
    border-radius: 999px;
    background: var(--rejit-destructive);
    color: #fff;
    font-size: .65rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
}

.notif-menu {
    width: 22rem;
    max-width: 90vw;
    max-height: 24rem;
    overflow-y: auto;
    border-radius: var(--rejit-radius);
}

.notif-menu-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: .5rem 1rem;
    border-bottom: 1px solid var(--rejit-border);
}

.notif-item {
    display: flex;
    align-items: flex-start;
    gap: .6rem;
    white-space: normal;
    padding: .6rem 1rem;
}

.notif-item.unread {
    background: oklch(42% .11 148 / .07);
    font-weight: 600;
}

.notif-item .notif-link {
    display: flex;
    flex: 1;
    gap: .6rem;
    color: inherit;
    text-decoration: none;
}

.notif-item .notif-text {
    flex: 1;
    font-size: .85rem;
}

.notif-mark-btn {
    flex-shrink: 0;
    border: none;
    background: none;
    padding: .15rem;
    line-height: 1;
    border-radius: 999px;
    color: var(--rejit-muted-foreground);
    cursor: pointer;
}

.notif-mark-btn:hover {
    color: var(--rejit-success);
    background: oklch(62% .16 150 / .12);
}

.notif-item .notif-time {
    display: block;
    font-size: .75rem;
    color: var(--rejit-muted-foreground);
    font-weight: 400;
}

/* Permission grid (search + module bands + checkbox items) */
.perm-search {
    position: relative;
    max-width: 22rem;
}

.perm-search .rejit-icon {
    position: absolute;
    left: .75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--rejit-muted-foreground);
}

.perm-search .form-control {
    padding-left: 2.3rem;
    border-radius: 999px;
}

.perm-module {
    margin-bottom: .35rem;
}

.perm-module-head {
    display: flex;
    align-items: center;
    gap: .6rem;
    background: var(--rejit-muted);
    border-radius: .45rem;
    padding: .45rem .75rem;
    margin-bottom: .35rem;
}

.perm-module-name {
    flex: 1;
    font-size: .8rem;
    font-weight: 800;
    letter-spacing: .04em;
    color: var(--rejit-secondary-foreground);
}

.perm-module-count {
    font-size: .8rem;
    color: var(--rejit-muted-foreground);
}

.perm-check-all {
    background: var(--rejit-primary);
    color: #fff;
    font-size: .72rem;
    font-weight: 700;
    padding: .1rem .55rem;
    border-radius: .35rem;
}

.perm-check-all:hover {
    background: var(--rejit-primary-dark);
    color: #fff;
}

.perm-items {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
    gap: .35rem .75rem;
    padding: .25rem .25rem .5rem;
}

.perm-item {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin: 0;
    padding: .35rem .55rem;
    border-radius: .45rem;
    font-size: .875rem;
    cursor: pointer;
}

.perm-item:hover {
    background: var(--rejit-muted);
}

.perm-item:has(:checked) {
    background: oklch(42% .11 148 / .08);
    font-weight: 700;
}

.perm-item .form-check-input {
    margin: 0;
    flex: 0 0 auto;
}

/* Pagination (Bootstrap 5 paginator, brand colors) */
.pagination {
    --bs-pagination-color: var(--rejit-primary);
    --bs-pagination-active-bg: var(--rejit-primary);
    --bs-pagination-active-border-color: var(--rejit-primary);
    --bs-pagination-hover-color: var(--rejit-primary-dark);
    --bs-pagination-focus-color: var(--rejit-primary-dark);
    --bs-pagination-border-radius: var(--rejit-radius);
    margin-bottom: 0;
}

/* Per-page selector */
.per-page-select {
    border-radius: calc(var(--rejit-radius) - .25rem);
    border: 1px solid var(--rejit-input);
    background-color: var(--rejit-card);
    color: var(--rejit-primary);
    font-weight: 700;
    font-size: .875rem;
    padding: .3rem 2rem .3rem .9rem;
    cursor: pointer;
}

.per-page-select:focus {
    border-color: var(--rejit-ring);
    box-shadow: 0 0 0 .25rem oklch(42% .11 148 / .15);
}

/* Options — classic rendering only honors font/color/background */
#staff-per-page option {
    font-weight: 700;
    color: var(--rejit-foreground);
    background-color: var(--rejit-card);
}

#staff-per-page option:checked {
    background-color: var(--rejit-primary);
    color: #fff;
}

/* Modern Chromium (customizable select): style the whole dropdown picker */
@supports (appearance: base-select) {
    #staff-per-page,
    #staff-per-page::picker(select) {
        appearance: base-select;
    }

    #staff-per-page::picker(select) {
        margin-top: .35rem;
        padding: .3rem;
        border: 1px solid var(--rejit-border);
        border-radius: .75rem;
        background: var(--rejit-card);
        box-shadow: 0 12px 28px oklch(18% .03 145 / .22);
    }

    #staff-per-page option {
        padding: .4rem .9rem;
        border-radius: .5rem;
        cursor: pointer;
    }

    #staff-per-page option:hover,
    #staff-per-page option:focus {
        background: var(--rejit-muted);
    }

    #staff-per-page option:checked {
        background: var(--rejit-primary);
        color: #fff;
    }

    #staff-per-page option::checkmark {
        display: none;
    }
}

.create-role-card {
    border-top: 1px dashed var(--rejit-border);
    padding-top: 1.25rem;
}

.permission-module {
    background: var(--rejit-muted);
    border: 1px solid var(--rejit-border);
    border-radius: calc(var(--rejit-radius) - .25rem);
    padding: .75rem;
    height: 100%;
}

.permission-module-title {
    font-weight: 800;
    font-size: .85rem;
    color: var(--rejit-secondary-foreground);
    margin-bottom: .35rem;
}

.permission-module .form-check-label {
    font-size: .85rem;
}

@media (max-width: 575.98px) {
    .rejit-dock {
        gap: .35rem;
        padding: .5rem .6rem;
    }

    .rejit-dock .dock-icon {
        width: 2.75rem;
        height: 2.75rem;
    }

    .rejit-dock .dock-icon img {
        width: 1.6rem;
        height: 1.6rem;
    }

    .rejit-menubar .menubar-clock {
        display: none;
    }
}
