/* =======================================================================
   kOS SCHEDULER — COSMIC PURPLE GLASS THEME (MATCHES kOS WALLPAPER)
   ======================================================================= */

/* ---------- GLOBAL TOKENS ---------- */
:root {
    /* Deep space background tones (match wallpaper) */
    --kos-bg-deep: #050015;
    --kos-bg-mid:  #17003A;

    /* Purple / magenta core */
    --kos-purple-1: #B46BFF;  /* mid purple */
    --kos-purple-2: #D58BFF;  /* brighter purple */
    --kos-purple-3: #F0D8FF;  /* soft lavender */

    /* Accents: magenta + cyan ring */
    --kos-accent-purple: #C73AF3;
    --kos-accent-blue:   #23E0D1;

    --kos-text-soft:   #eed6ff;
    --kos-text-strong: #FFFFFF;

    --kos-hover-bg:  rgba(58, 139, 255, 0.14);
    --kos-active-bg: rgba(199, 58, 243, 0.22);

    /* Unified spacing for Cosmic details: outer edges + gap */
    --kos-details-gutter: 24px;
    --kos-topnav-height: 96px;

    /* ---------- THEME TOKENS FOR CONTROLS / POPUPS / BUTTONS ---------- */

    /* Select / popup */
    --kos-select-bg: #16002b;
    --kos-select-border: rgba(255, 255, 255, 0.12);
    --kos-select-hover-bg: rgba(255, 255, 255, 0.06);
    --kos-select-selected-bg: rgba(140, 82, 255, 0.35);
    --kos-select-shadow: 0 14px 45px rgba(0, 0, 0, 0.6);

    /* Edit popup surface + backdrop */
    --kos-edit-overlay-backdrop: radial-gradient(circle at top,
                    rgba(0, 0, 0, 0.55) 0,
                    rgba(0, 0, 0, 0.8) 40%,
                    rgba(0, 0, 0, 0.9) 100%);

    --kos-edit-surface-bg: linear-gradient(135deg, #1a0035, #220044);
    --kos-edit-surface-radius: 18px;
    --kos-edit-surface-border: 1px solid rgba(255, 255, 255, 0.18);
    --kos-edit-surface-shadow:
        0 0 0 1px rgba(140, 82, 255, 0.3),
        0 24px 60px rgba(0, 0, 0, 0.9);

    /* Buttons */
    --kos-primary-button-bg: radial-gradient(circle at top left, #ff4dff, #8040ff);
    --kos-primary-button-bg-hover: radial-gradient(circle at top left, #ff70ff, #9a5dff);
    --kos-primary-button-color: #ffffff;

    --kos-secondary-button-bg: transparent;
    --kos-secondary-button-bg-hover: rgba(255, 255, 255, 0.08);
    --kos-secondary-button-border: rgba(255, 255, 255, 0.35);
    --kos-secondary-button-border-hover: rgba(255, 255, 255, 0.6);
    --kos-secondary-button-color: rgba(255, 255, 255, 0.85);
}

html,
body {
    position: relative;
}

/* =======================================================================
   DETAILS PAGES — LEFT NAV + VIEW/EDIT TOGGLE
   ======================================================================= */
.kos-details-shell {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 16px;
}

.kos-nav-window {
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 18px;
    padding: 12px;
    position: sticky;
    top: var(--kos-topnav-height);
    height: calc(100vh - var(--kos-topnav-height) - 24px);
    overflow: auto;
}

.kos-subnav {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.kos-subnav-section-title {
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 8px;
}

.kos-subnav-section-links {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.kos-subnav-link {
    text-decoration: none;
    color: rgba(255, 255, 255, 0.85);
    padding: 8px 10px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.02);
}

.kos-subnav-link:hover {
    background: rgba(255, 255, 255, 0.08);
}

.kos-subnav-disabled {
    opacity: 0.55;
    cursor: not-allowed;
    display: block;
    padding: 8px 10px;
    border-radius: 10px;
}

.kos-subnav-link-button {
    border: none;
    background: transparent;
    text-align: left;
    width: 100%;
    font: inherit;
    cursor: pointer;
}

.kos-owner-select { position: relative; width: 100%; }
.kos-owner-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    z-index: 2000;
    background: rgba(20, 20, 28, 0.98);
    border: 1px solid rgba(255,255,255,0.10);
    border-radius: 12px;
    padding: 6px;
    max-height: 240px;
    overflow: auto;
}
.kos-owner-option {
    width: 100%;
    text-align: left;
    background: transparent;
    border: none;
    color: inherit;
    padding: 10px 10px;
    border-radius: 10px;
    cursor: pointer;
}
.kos-owner-option:hover { background: rgba(255,255,255,0.06); }

.kos-details-main {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.kos-details-action-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    background: rgba(15, 0, 40, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 18px;
    padding: 16px 18px;
}

.kos-details-action-title {
    font-size: 22px;
    font-weight: 600;
    color: var(--kos-text-strong);
}

.kos-details-action-subtitle {
    margin-top: 4px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 13px;
}

.kos-details-action-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.kos-toggle-root {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(0, 0, 0, 0.3);
}

.kos-toggle-option--active {
    background: rgba(255, 255, 255, 0.18);
    color: #ffffff;
    padding: 6px 12px;
    border-radius: 999px;
    font-weight: 600;
}

.kos-toggle-option--inactive {
    color: rgba(255, 255, 255, 0.6);
    padding: 6px 12px;
    border-radius: 999px;
}

.kos-inline-readonly {
    display: inline-block;
    padding: 6px 10px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
    color: rgba(255, 255, 255, 0.85);
    min-height: 36px;
}

/* ---------- GLOBAL BACKGROUND ---------- */
body {
    margin: 0;
    padding: 0;

    /* Multi-layer nebula gradient – closer to the kOS art */
    background:
        radial-gradient(circle at 18% 12%, #5b16c2 0%, transparent 55%),
        radial-gradient(circle at 82% 78%, #c73af3 0%, transparent 60%),
        radial-gradient(circle at 50% 50%, #130033 0%, #050015 55%, #02000a 100%);
    color: var(--kos-text-soft);
    font-family: system-ui, sans-serif;
}

.page {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ============================================================
   TOP NAV — PURPLE GLASS BAR
   ============================================================ */

header {
    position: sticky;
    top: 0;
    z-index: 200;

    background: rgba(32, 0, 70, 0.88); /* brighter, more purple */
    backdrop-filter: blur(14px) saturate(160%);
    -webkit-backdrop-filter: blur(14px) saturate(160%);

    border-bottom: 1px solid rgba(200, 120, 255, 0.55); /* brighter highlight */
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.70);
}

/* ---------- TOP NAV BAR ---------- */
.kos-topnav {
    /* Make the nav stay at the top while scrolling */
    position: sticky;
    top: 0;
    z-index: 1000;

    /* Existing layout behavior */
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.25rem;

    padding: 0.75rem 1.5rem;
    margin: 0 auto 1.75rem auto;
    border-radius: 999px;

    /* Cosmic glassy background so content can slide behind */
    backdrop-filter: blur(20px);

    background: radial-gradient(circle at top left,
        rgba(40, 10, 90, 0.95) 0%,
        rgba(15, 0, 45, 0.98) 40%,
        rgba(8, 0, 25, 1) 100%);

    box-shadow:
        0 0 30px rgba(120, 80, 255, 0.75),
        0 0 12px rgba(120, 80, 255, 0.65);
}

.top-nav {
    display: flex;
    align-items: center;
    width: 100%;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    gap: 16px;
}

.kos-top-nav,
header.kos-top-nav {
    position: fixed;
    top: 0;
    z-index: 9999;
}

.kos-nav-left-spacer {
    flex: 1;
}

.kos-nav-buttons {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.kos-nav-right {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

.logged-in-user {
    font-size: 0.75rem;
    opacity: 0.8;
    text-align: right;
    white-space: nowrap;
}

.logged-in-user .user-name {
    font-weight: 600;
    font-size: 0.85rem;
}

.kos-nav-buttons .kos-btn,
.kos-nav-right .kos-btn {
    height: 36px;
    padding: 0 14px;
}

.logout-pill {
    min-width: 90px;
}


.kos-topnav-link {
    position: relative;
    z-index: 101;

    display: inline-block;
    padding: 6px 18px;
    font-size: 0.9rem;
    border-radius: 999px;

    text-decoration: none;
    color: #cabdff;

    border: 1px solid rgba(255, 255, 255, 0.1);

    background: radial-gradient(circle at top left,
        rgba(120, 40, 255, 0.26) 0%,
        rgba(24, 0, 52, 0.95) 45%,
        rgba(8, 0, 24, 1) 100%
    );

    transition:
        background 0.15s ease,
        border-color 0.15s ease,
        color 0.15s ease,
        box-shadow 0.25s ease,
        transform 0.1s ease;
}

/* hover */
.kos-topnav-link:hover {
    color: #ffffff;
    border-color: rgba(200, 120, 255, 0.85);

    background: radial-gradient(circle at top left,
        rgba(180, 90, 255, 0.46) 0%,
        rgba(60, 10, 120, 0.96) 45%,
        rgba(15, 0, 40, 1) 100%
    );

    box-shadow:
        0 0 14px rgba(180, 90, 255, 0.65),
        0 0 6px rgba(200, 120, 255, 0.75);

    transform: translateY(-1px);
}

/* active */
.kos-topnav-link.active {
    color: var(--kos-primary-button-color);
    font-weight: 600;

    background: var(--kos-primary-button-bg);
    border-color: transparent;

    box-shadow: 0 0 14px rgba(128, 64, 255, 0.6);
}

/* Ensure hover on the active tab matches primary button hover */
.kos-topnav-link.active:hover {
    background: var(--kos-primary-button-bg-hover);
    box-shadow: 0 0 18px rgba(154, 93, 255, 0.8);
    transform: translateY(-1px);
}

table {
    border-collapse: separate;
    border-spacing: 0;
}

thead {
    display: table-header-group;
}

tbody {
    display: table-row-group;
}

.table-scroll,
.table-window,
.kos-table-scroll,
.kos-list-scroll {
    overflow: auto;
    position: relative;
}

.table-scroll,
.table-window,
.kos-table-scroll,
.kos-list-table-scroll,
.kos-list-scroll {
    position: relative;
    isolation: isolate;
}

.table-scroll table thead th,
.table-window table thead th,
.kos-table-scroll table thead th,
.kos-list-table-scroll table thead th,
.kos-list-scroll table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: linear-gradient(
        180deg,
        rgba(30, 10, 60, 0.95),
        rgba(20, 5, 40, 0.95)
    );
    backdrop-filter: blur(6px);
}

.kos-table-sticky-under-nav .table-scroll table thead th,
.kos-table-sticky-under-nav .table-window table thead th,
.kos-table-sticky-under-nav .kos-table-scroll table thead th,
.kos-table-sticky-under-nav .kos-list-table-scroll table thead th,
.kos-table-sticky-under-nav .kos-list-scroll table thead th {
    top: var(--kos-topnav-height);
    z-index: 3;
}

.table-scroll table thead th select,
.table-scroll table thead th input,
.table-window table thead th select,
.table-window table thead th input,
.kos-table-scroll table thead th select,
.kos-table-scroll table thead th input,
.kos-list-table-scroll table thead th select,
.kos-list-table-scroll table thead th input,
.kos-list-scroll table thead th select,
.kos-list-scroll table thead th input {
    position: relative;
    z-index: 3;
}

.kos-primary-window_header,
.kos-section-header-row {
    z-index: 200;
}

/* ============================================================
   LOGIN PAGE
   ============================================================ */

.kos-login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 20px;
    background: transparent;
}

.kos-login-overlay {
    width: min(680px, 96vw);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
    text-align: center;
}

.kos-login-branding {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.kos-login-logo {
    font-size: clamp(2.6rem, 6vw, 3.6rem);
    letter-spacing: 0.35rem;
    font-weight: 700;
    color: #f4eaff;
    text-shadow: 0 0 24px rgba(150, 110, 255, 0.45);
}

.kos-login-tagline {
    font-size: clamp(1rem, 2.4vw, 1.3rem);
    color: rgba(246, 239, 255, 0.9);
    letter-spacing: 0.05em;
}

.kos-login-panel {
    width: min(420px, 90vw);
    padding: 20px 22px;
    border-radius: 16px;
    background: rgba(10, 8, 22, 0.78);
    border: 1px solid rgba(150, 115, 255, 0.35);
    box-shadow: 0 18px 50px rgba(11, 6, 26, 0.6);
    display: flex;
    flex-direction: column;
    gap: 12px;
    backdrop-filter: blur(10px);
}

.kos-login-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    text-align: left;
}

.kos-login-label {
    font-size: 0.85rem;
    color: rgba(239, 230, 255, 0.8);
    letter-spacing: 0.04em;
}

.kos-login-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-top: 4px;
}

.kos-login-error {
    font-size: 0.9rem;
    color: rgba(255, 180, 180, 0.9);
}

@media (max-width: 640px) {
    .kos-login-overlay {
        gap: 14px;
    }

    .kos-login-panel {
        width: min(360px, 92vw);
        padding: 18px;
    }
}

/* ============================================================
   CONTENT AREA
   ============================================================ */

main.content {
    flex: 1;
    padding: var(--kos-topnav-height) 24px 24px 24px;
    box-sizing: border-box;
}

.content {
    flex: 1;
    padding: var(--kos-topnav-height) 24px 24px 24px;
    box-sizing: border-box;
}

/* ============================================================
   WINDOW CHROME — COSMIC RADIAL GLASS
   ============================================================ */

/* ---------- PRIMARY WINDOW ---------- */
.kos-primary-window {
    width: 100%;
    padding: 20px 24px 24px 24px;

    border-radius: 20px;
    background: radial-gradient(circle at top left,
        rgba(36, 7, 94, 0.97),
        rgba(8, 0, 24, 0.99));
    border: 1px solid rgba(199, 58, 243, 0.55);
    box-shadow:
        0 20px 44px rgba(0, 0, 0, 0.9),
        0 0 26px rgba(199, 58, 243, 0.38);
}

/* ---------- SUBWINDOW (Section Panels) ---------- */
.kos-section-window {
    margin-bottom: 18px;
    padding: 18px 20px 20px 20px;

    border-radius: 16px;
    background: radial-gradient(circle at top left,
        rgba(45, 10, 110, 0.96),
        rgba(10, 0, 30, 0.98));
    border: 1px solid rgba(173, 82, 255, 0.5);
    box-shadow:
        0 14px 32px rgba(0, 0, 0, 0.78),
        0 0 20px rgba(173, 82, 255, 0.32);
}

.kos-area-window-stack {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 18px;
}

.kos-area-window-stack > .kos-section-window {
    margin-bottom: 0;
}

.kos-area-section-container {
    margin-bottom: 18px;
    padding: 16px 18px 18px 18px;
    border-radius: 14px;
    border: 1px solid rgba(173, 82, 255, 0.34);
    background: linear-gradient(
        180deg,
        rgba(32, 7, 80, 0.42),
        rgba(14, 3, 36, 0.46)
    );
    box-shadow:
        inset 0 0 0 1px rgba(255, 255, 255, 0.03),
        0 10px 22px rgba(0, 0, 0, 0.28);
}

.kos-area-section-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.kos-area-section-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.kos-area-section-body > .kos-section-descriptor {
    margin-bottom: 12px;
}

.kos-area-section-body > .kos-area-window-stack {
    margin-bottom: 0;
}

.kos-area-totals {
    margin-top: 12px;
    display: flex;
    justify-content: flex-end;
    gap: 20px;
    flex-wrap: wrap;
    color: rgba(255, 255, 255, 0.92);
}

/* ============================================================
   THEMED SELECTS (USED FOR DROPDOWNS LIKE DEPARTMENT / COLOR)
   ============================================================ */

.kos-select {
    position: relative;
    width: 100%;
}

/* Trigger button surface */
.kos-select-trigger {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    padding-inline: 12px;
    text-align: left;
}

.kos-select-label {
    flex-shrink: 0;
    white-space: nowrap;
}

.kos-select-caret {
    margin-left: auto;
}

/* Dropdown panel (opens upward) */
.kos-select-menu {
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    margin-bottom: 4px;
    z-index: 900;

    background: var(--kos-select-bg);
    border-radius: 8px;
    border: 1px solid var(--kos-select-border);
    box-shadow: var(--kos-select-shadow);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);

    max-height: 260px;
    overflow-y: auto;
}

.kos-select-option {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    width: 100%;
    gap: 10px;
    padding: 8px 12px;
    text-align: left;

    background: transparent;
    border: 0;
    color: #ffffff;
    font-size: 0.9rem;
    cursor: pointer;
    outline: none;
}

.kos-select-option:hover {
    background: var(--kos-select-hover-bg);
}

.kos-select-option.selected {
    background: var(--kos-select-selected-bg);
}

/* Color-specific chip sizing for dropdown */
.kos-select--color .kos-color-chip-sm {
    width: 1.75rem;
    min-width: 1.75rem;
    height: 0.7rem;
    border-radius: 999px;
}

/* ============================================================
   EDIT POPUP WINDOW (FLOATING CARD ABOVE PRIMARY / SUBWINDOWS)
   ============================================================ */

.kos-edit-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 160px;
    z-index: 20000;
    pointer-events: auto;
}

.kos-edit-overlay-backdrop {
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: auto;
    background: var(--kos-edit-overlay-backdrop);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.kos-edit-card {
    position: relative;
    z-index: 1;
    width: min(1180px, 96vw);      /* slightly wider / larger */
    max-height: calc(100vh - 220px);
    overflow-y: auto;

    background: var(--kos-edit-surface-bg);
    border-radius: var(--kos-edit-surface-radius);
    border: var(--kos-edit-surface-border);
    box-shadow: var(--kos-edit-surface-shadow);
    pointer-events: auto;
}

.kos-edit-card-header {
    padding: 20px 28px 12px;       /* padding so text doesn’t hit the edges */
}

.kos-edit-card-header-main {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

/* Left side: title + subtitle container */
.kos-edit-card-header-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0; /* allows text to shrink before overlapping buttons */
}

/* Row that holds the pill + title inline */
.kos-edit-card-header-main-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.kos-edit-card-header-inline-status {
    font-size: 0.82rem;
    line-height: 1.2;
    color: rgba(255, 255, 255, 0.78);
    opacity: 0.95;
    white-space: normal;
}

/* Right side: top-right Save / Cancel buttons */
.kos-edit-card-header-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* User controls placed in the edit header area */
.kos-edit-header-user-controls {
    position: absolute;
    top: 22px;
    right: 220px;
    display: flex;
    align-items: center;
}

/* Container for enum + toggle */
/* Header user controls container */
.user-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-right: 12px;
}

/* Label before enum */
.user-controls-label {
    font-size: 0.95rem;
    font-weight: 600;
    opacity: 0.85;
    white-space: nowrap;
}

/* UserType enum sizing to match buttons */
.usertype-select {
    min-width: 140px;
    height: 36px;
    font-size: 0.95rem;
    padding: 0 10px;
}

button {
    font: inherit;
}

button.kos-btn {
    appearance: none;
    background-clip: padding-box;
}

/* Global button primitive (matches scheduler preset buttons) */
.kos-btn {
    padding: 0.35rem 0.5rem;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    background: radial-gradient(circle at top left,
                                rgba(255, 255, 255, 0.06),
                                rgba(0, 0, 0, 0.8));
    color: rgba(255, 255, 255, 0.82);
    font-size: 0.78rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    cursor: pointer;
    outline: none;
    transition: none;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    user-select: none;
    white-space: nowrap;
}

.kos-btn:hover {
    border-color: rgba(255, 255, 255, 0.4);
    background: radial-gradient(circle at top left,
                                rgba(255, 255, 255, 0.10),
                                rgba(0, 0, 0, 0.85));
}

.kos-btn:active,
.kos-btn:focus {
    outline: none;
    box-shadow: none;
}

.kos-btn--active {
    background-image: linear-gradient(135deg,
                                      #ff42ff 0%,
                                      #b15bff 45%,
                                      #44e0ff 100%);
    border-color: rgba(255, 255, 255, 0.9);
    color: #0a0614;
    box-shadow: 0 0 18px rgba(255, 66, 255, 0.45);
    opacity: 1;
}

.kos-btn--active:hover,
.kos-btn--active:focus,
.kos-btn--active:active {
    background-image: linear-gradient(135deg,
                                      #ff42ff 0%,
                                      #b15bff 45%,
                                      #44e0ff 100%);
    border-color: rgba(255, 255, 255, 0.9);
    color: #0a0614;
    box-shadow: 0 0 18px rgba(255, 66, 255, 0.45);
}

.kos-btn--active:hover {
    filter: brightness(1.05);
}

.kos-btn--inactive {
    opacity: 0.78;
}

/* Login toggle — inherits kos-btn sizing */
.login-toggle {
    min-width: 150px;
    text-align: center;
    border-radius: 999px;
}

.kos-edit-pill {
    padding: 3px 10px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.35);
    font-size: 0.7rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--kos-text-soft);
    background: rgba(255, 255, 255, 0.03);
}

.kos-edit-card-title {
    font-size: 1.05rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: #ffffff;
}

.kos-edit-card-subtitle {
    margin-top: 4px;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.75);
}

.kos-edit-card-body {
    padding: 8px 28px 24px;        /* inner padding for fields */
}

.kos-edit-scroll-list {
    max-height: 320px;
    overflow-y: auto;
    padding-right: 6px;
}

.kos-history-icon {
    margin-left: 8px;
    width: 18px;
    height: 18px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.9);
    font-size: 12px;
    line-height: 16px;
    padding: 0;
    cursor: pointer;
}

.kos-history-icon:hover {
    background: rgba(255, 255, 255, 0.10);
}

.kos-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 4000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.kos-modal-window {
    width: min(980px, 96vw);
    max-height: min(720px, 88vh);
    overflow: hidden;
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.10);
    background: rgba(20, 20, 28, 0.96);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55);
    display: flex;
    flex-direction: column;
}

.kos-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.kos-modal-title {
    font-weight: 600;
    letter-spacing: 0.2px;
}

.kos-modal-close {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.75);
    cursor: pointer;
    font-size: 18px;
    line-height: 18px;
    padding: 6px 10px;
    border-radius: 10px;
}

.kos-modal-close:hover {
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.95);
}

.kos-modal-body {
    padding: 14px 16px;
    overflow: auto;
    min-height: 0;
}

.kos-modal-footer {
    padding: 12px 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.kos-edit-card-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 0 28px 22px;          /* padding so buttons don’t touch edges */
}

.kos-edit-card-actions-left,
.kos-edit-card-actions-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Hook for future styling if you want delete to look more "danger" later */
.kos-delete-button {
    /* currently inherits kos-primary-button styles */
}

/* ============================================================
   THEMED BUTTONS (PRIMARY / SECONDARY ACTIONS)
   ============================================================ */

.kos-primary-button,
.kos-secondary-button {
    padding: 0.35rem 0.5rem;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    background: radial-gradient(circle at top left,
                                rgba(255, 255, 255, 0.06),
                                rgba(0, 0, 0, 0.8));
    color: rgba(255, 255, 255, 0.82);
    font-size: 0.78rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    cursor: pointer;
    outline: none;
    transition: none;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    user-select: none;
    white-space: nowrap;
}

.kos-primary-button:hover,
.kos-secondary-button:hover {
    border-color: rgba(255, 255, 255, 0.4);
    background: radial-gradient(circle at top left,
                                rgba(255, 255, 255, 0.10),
                                rgba(0, 0, 0, 0.85));
}

/* Actions row beneath tables (New Team / New Member buttons) */
.kos-subwindow-actions {
    margin-top: 12px;   /* bump this up/down if you want more/less gap */
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.kos-subwindow-actions-left {
    display: flex;
    gap: 10px;
}

.kos-subwindow-actions-right {
    display: flex;
    gap: 10px;
}

.kos-subwindow-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex: 1;
}

.kos-subwindow-pagination .kos-input {
    width: 64px;
}

.kos-list-table-scroll {
    max-height: 420px;
    overflow-y: auto;
    overflow-x: auto;
    position: relative;
    isolation: isolate;
}

/* Bids landing page flattened body (single-card layout). */
.bids-list-flat {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.bids-list-flat .kos-subwindow-actions {
    margin-top: 8px;
    gap: 8px;
}

.bids-list-flat .kos-subwindow-actions-left,
.bids-list-flat .kos-subwindow-actions-right {
    gap: 8px;
}

/* Opt-in variant for selects that should open downward (below trigger). */
.kos-select.kos-select--downward .kos-select-menu {
    top: 100%;
    bottom: auto;
    margin-top: 4px;
    margin-bottom: 0;
}

/* ============================================================
   TABLES — Cosmic Glass (generic, if you use .kos-table)
   ============================================================ */

.kos-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 12px;
}

.kos-table th {
    text-align: left;
    padding: 8px 12px;
    color: var(--kos-purple-3);
    font-weight: 600;
    border-bottom: 1px solid rgba(200, 120, 255, 0.28);
}

.kos-table td {
    padding: 8px 12px;
    color: var(--kos-text-soft);
    border-bottom: 1px solid rgba(200, 120, 255, 0.16);
}

/* subtle row hover */
.kos-table tr:hover {
    background: radial-gradient(circle at left,
        rgba(58, 139, 255, 0.22),
        rgba(10, 0, 32, 0.98));
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

/* ============================
   COSMIC GRID TABLE — BASE
   Used by ListTable / ListTableEdit
   ============================ */

.kos-grid-table {
    width: 100%;
    border-collapse: separate;  /* important for rounded corners */
    border-spacing: 0;
    margin-top: 8px;
    font-size: 0.75em;
    position: relative;
    z-index: 0;

    background: rgba(12, 0, 30, 0.35);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);

    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.32); /* outer rectangle */
    overflow: hidden; /* keeps corners clean */
}

/* Header row */
.kos-grid-table thead tr {
    background: linear-gradient(
        90deg,
        rgba(24, 0, 60, 0.95),
        rgba(60, 12, 120, 0.95)
    );
}

/* Header cells */
.kos-grid-table th {
    text-align: center;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;

    color: var(--kos-purple-3);

    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.kos-grid-table th.select,
.kos-grid-table td.select {
    width: 44px;
    text-align: center;
}

.kos-grid-table th.select {
    position: relative;
}

.kos-grid-table th.select:has(.kos-select-all-popover) {
    overflow: visible;
    z-index: 2600;
}

.kos-grid-table th.select:has(.kos-select-all-popover) .kos-select-all-wrap {
    z-index: 2601;
}

.kos-grid-table th.select:has(input[type="checkbox"]:checked)::after {
    content: "Select All";
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translate(-50%, -6px);
    padding: 2px 6px;
    border-radius: 6px;
    background: rgba(20, 16, 24, 0.95);
    color: #f6f1ff;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.2px;
    white-space: nowrap;
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
    pointer-events: none;
    z-index: 5;
}

.kos-table-search {
    margin: 8px 0 12px;
}

.kos-header-label {
    font-size: 0.85rem;
    opacity: 0.9;
}

.kos-header-filter {
    width: 100%;
}

.kos-form-section-header {
    margin: 14px 0 8px;
    font-weight: 600;
    opacity: 0.9;
}

.kos-subheader {
    margin-top: 6px;
    font-weight: 600;
    opacity: 0.9;
}

.kos-divider {
    margin: 12px 0;
    opacity: 0.5;
}

.kos-link-button {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    text-decoration: underline;
    font: inherit;
    color: inherit;
}

.kos-muted {
    opacity: 0.6;
}

/* Shared box model for header + body cells */
.kos-grid-table th,
.kos-grid-table td {
    padding: 10px 12px;
    text-align: center;

    /* horizontal row separation */
    border-bottom: 1px solid rgba(255, 255, 255, 0.16);
}

/* vertical inner lines only (outer edges come from table border) */
.kos-grid-table th:not(:last-child),
.kos-grid-table td:not(:last-child) {
    border-right: 1px solid rgba(255, 255, 255, 0.16);
}

/* stronger bottom on last row so it matches outer border weight */
.kos-grid-table tbody tr:last-child td {
    border-bottom: 1px solid rgba(255, 255, 255, 0.32);
}

/* Row hover */
.kos-grid-table tbody tr:hover {
    background: rgba(138, 92, 255, 0.15);
}

.kos-grid-table td.calendar,
.kos-grid-table td.calendar .kos-link-button {
    position: relative;
    z-index: 1;
}

/* Action/Edit column: only as wide as needed */
.kos-grid-col--action {
    width: 1%;
    white-space: nowrap;
    text-align: center;
}

/* Color column: centers the chip */
.kos-grid-col--color {
    text-align: center;
}

/* Color chip used in grid and dropdowns */
.kos-color-chip {
    width: 18px;
    height: 18px;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    display: inline-block;
}
/* ============================
   COSMIC GRID TABLE — EDIT BUTTON
   ============================ */

.kos-list-edit-btn {
    padding: 0.35rem 0.5rem;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    background: radial-gradient(circle at top left,
                                rgba(255, 255, 255, 0.06),
                                rgba(0, 0, 0, 0.8));
    color: rgba(255, 255, 255, 0.82);
    font-size: 0.78rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    cursor: pointer;
    outline: none;
    transition: none;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    user-select: none;
    white-space: nowrap;
}

.kos-list-edit-btn:hover {
    border-color: rgba(255, 255, 255, 0.4);
    background: radial-gradient(circle at top left,
                                rgba(255, 255, 255, 0.10),
                                rgba(0, 0, 0, 0.85));
}

.kos-list-edit-btn.active {
    background-image: linear-gradient(135deg,
                                      #ff42ff 0%,
                                      #b15bff 45%,
                                      #44e0ff 100%);
    border-color: rgba(255, 255, 255, 0.9);
    color: #0a0614;
    box-shadow: 0 0 18px rgba(255, 66, 255, 0.45);
}

/* keep edit button centered in its narrow column */
.kos-grid-col--action .kos-list-edit-btn {
    margin: 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* ============================================================
   COSMIC: Edit Popup Table Styling (for EditPopupWindow)
   ============================================================ */

.kos-edit-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    table-layout: fixed; /* keeps column widths consistent */
}

/* Header cells */
.kos-edit-table thead th {
    padding: 12px 16px;
    text-align: center;
    font-weight: 600;
    color: var(--kos-text-strong);
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.kos-edit-table thead th:last-child {
    border-right: none;
}

/* Body rows */
.kos-edit-table tr {
    height: 64px; /* clean consistent row height */
}

/* Body cells */
.kos-edit-table td.kos-edit-cell {
    padding: 12px 16px;
    vertical-align: middle;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    border-right: 1px solid rgba(255, 255, 255, 0.08);
}

/* Inline label + control row inside edit popup */
.kos-inline-field {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
}

/* "Label:" text */
.kos-inline-label {
    white-space: nowrap;
    font-size: 0.95rem;
    font-weight: 600;
    color: rgba(230, 230, 255, 0.75);
    min-width: 120px;
}

/* Control should fill remaining space */
.kos-inline-control {
    flex: 1 1 auto;
}

/* Custom dropdowns should fill width inside inline rows */
.kos-inline-field .kos-select {
    width: 100%;
}

.kos-edit-table tr td.kos-edit-cell:last-child {
    border-right: none;
}

/* Center checkboxes and slightly enlarge them */
.kos-edit-table input[type="checkbox"] {
    transform: scale(1.1);
    margin: 0 auto;
    display: block;
}

/* Cell content / labels / inputs */
.kos-edit-cell {
    padding: 8px 12px;
    vertical-align: middle;
}

.kos-edit-cell label {
    display: block;
    font-size: 0.85rem;
    color: var(--kos-purple-3);
    margin-bottom: 4px;
    letter-spacing: 0.03em;
}

/* Cosmic input style (used by header filters AND edit popups) */
.kos-input {
    width: 100%;
    box-sizing: border-box;

    padding: 8px 10px;
    font-size: 0.95rem;
    text-align: center;

    border-radius: 8px;
    border: 1px solid rgba(200, 120, 255, 0.35);

    background: rgba(18, 0, 40, 0.75);
    color: var(--kos-text-strong);

    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);

    transition: border-color 0.15s ease, background 0.15s ease;
}

.kos-input:hover {
    border-color: rgba(200, 120, 255, 0.55);
}

.kos-input:focus {
    outline: none;
    border-color: rgba(200, 120, 255, 0.95);
    background: rgba(28, 0, 65, 0.85);
}

/* Fixed-value display cell */
.kos-edit-value {
    padding: 10px 12px;
    font-size: 0.95rem;

    border-radius: 8px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);

    color: var(--kos-text-soft);
}

/* Ensure equal width for the two primary columns in 2-column layouts */
.kos-edit-table td {
    width: 50%;
}

/* Slight glow on the whole row when hovering */
.kos-edit-table tr:hover {
    background: rgba(138, 92, 255, 0.12);
}
/* ============================================================
   EDIT POPUP SUBSECTIONS & LIST FILTERS
   ============================================================ */

/* Wrapper for secondary sections inside edit popups
   (e.g., Teams list under a Team Member, Members list under a Team) */
.kos-edit-subsection {
    margin-top: 16px;
}

/* Title row inside those subsections; pairs with kos-section-header-main */
.kos-edit-subsection-header {
    margin-bottom: 8px;
}

/* Filter row above tables in edit dialogs */
.kos-list-filters {
    margin-bottom: 8px;
}

/* === Scheduler Layout =================================================== */

.scheduler-page {
    display: flex;
    flex-direction: column;
    gap: 0rem;
    padding: 0.75rem 1.5rem 1.5rem 1.5rem;
}

.scheduler-page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1.5rem;
    text-align: left;
}

.scheduler-page-heading {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
}

/* Left header column for the Select Type card */
.scheduler-header-left {
    flex: 0 0 320px;
    max-width: 320px;
    display: flex;
    align-items: stretch;
}

.scheduler-page-title {
    width: 100%;
    text-align: center;
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
    padding: 10px 0 8px 0;
    letter-spacing: 0.02em;
}

.scheduler-page-subtitle {
    width: 100%;
    text-align: center;
    font-size: 0.86rem;
    line-height: 1.35;
    color: rgba(255, 255, 255, 0.78);
    margin-top: -2px;
    margin-bottom: 8px;
}

.scheduler-page-body {
    margin-top: 0;
    padding-top: 0;
}

.scheduler-layout {
    margin-top: 0;
    padding-top: 0;
}

.scheduler-top-actions {
    margin-top: 6px;
}

/* Header controls (right side: week nav, future toggles) */
.scheduler-header-controls {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.75rem;
}

.scheduler-top-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    width: 100%;
    position: relative;
    z-index: 2;
}

.scheduler-top-actions-left,
.scheduler-top-actions-right {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
}

.scheduler-top-actions-center {
    flex: 1 1 auto;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    gap: 8px;
}

.scheduler-top-actions-right {
    justify-content: flex-end;
    gap: 8px;
}

.scheduler-source-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.scheduler-toggle-label {
    font-size: 0.85rem;
    opacity: 0.9;
}

.scheduler-toggle-button {
    border-radius: 999px;
    padding: 0.25rem 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.25);
    background: transparent;
    font-size: 0.85rem;
    cursor: pointer;
}

.scheduler-toggle-button--active {
    background: rgba(255, 255, 255, 0.12);
}

.scheduler-week-nav {
    display: flex;
    align-items: center;
    gap: 10px;
}

.scheduler-top-filters {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 8px;
}

.scheduler-filter-label {
    font-size: 0.85rem;
    opacity: 0.85;
    white-space: nowrap;
}

.scheduler-filter-select {
    border-radius: 999px;
    padding: 0.35rem 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.25);
    background: rgba(10, 0, 30, 0.6);
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.85rem;
}

.scheduler-nav-button {
    border-radius: 999px;
    padding: 0.25rem 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.25);
    background: transparent;
    font-size: 0.85rem;
    cursor: pointer;
}

.scheduler-week-label {
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    font-size: 0.85rem;
}

/* Main layout: left pane + right pane */
.scheduler-layout {
    display: grid;
    grid-template-columns: 352px minmax(0, 1fr);
    gap: 1.5rem;
    align-items: stretch;
    margin-top: 0;
    min-height: calc(100vh - var(--kos-topnav-height) - 24px);
    position: relative;
    isolation: isolate;
}

/* Left pane (preset card + dynamic table) */
.scheduler-left-pane {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 0;
    min-height: 0;
    height: auto;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 6px;
}

.scheduler-left-sticky {
    position: sticky;
    top: 0;
    z-index: 1;
    background: transparent;
    backdrop-filter: none;
    padding-bottom: 10px;
}

.scheduler-left-list {
    min-height: 0;
    padding: 18px 20px 20px 20px;
    border-radius: 16px;
    background: radial-gradient(circle at top left,
        rgba(45, 10, 110, 0.96),
        rgba(10, 0, 30, 0.98));
    border: 1px solid rgba(173, 82, 255, 0.5);
    box-shadow:
        0 14px 32px rgba(0, 0, 0, 0.78),
        0 0 20px rgba(173, 82, 255, 0.32);
}

.scheduler-left-pane .kos-list-table-scroll,
.scheduler-left-pane .scheduler-pane-section,
.scheduler-left-pane .scheduler-sidebar-scroll,
.scheduler-left-pane .scheduler-table-scroll {
    overflow: visible !important;
    max-height: none !important;
    height: auto !important;
    position: relative;
    z-index: 0;
}

/* --- Select Type preset card ------------------------------------------- */
.scheduler-preset-window {
    padding: 0.85rem 1rem;
    margin-top: 0;
    border-radius: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(0, 0, 0, 0.32);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);

    display: flex;
    gap: 1rem;
    align-items: stretch;
    justify-content: center;
}

.scheduler-preset-inner {
    width: 100%;
}

.scheduler-preset-inner--centered {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.scheduler-preset-inner--centered .scheduler-preset-text {
    align-items: center;
}

.scheduler-preset-inner--centered .scheduler-preset-buttons-row {
    justify-content: center;
}

.scheduler-preset-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.scheduler-preset-row {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.scheduler-preset-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    opacity: 0.75;
}

.scheduler-preset-value {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.9);
}

.scheduler-preset-buttons {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 0.6rem;
    min-width: 190px;
    width: 100%;
    max-width: 280px;
}

.scheduler-preset-buttons-row {
    display: flex;
    gap: 0.6rem;
    justify-content: center;
}

.scheduler-preset-buttons-row .kos-btn {
    flex: 1;
}

.scheduler-preset-button {
    flex: 1;
    padding: 0.35rem 0.5rem;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    background: radial-gradient(circle at top left,
                                rgba(255, 255, 255, 0.06),
                                rgba(0, 0, 0, 0.8));
    color: rgba(255, 255, 255, 0.82);
    font-size: 0.78rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    cursor: pointer;
    outline: none;
    transition: none;
}

.scheduler-preset-button:hover {
    border-color: rgba(255, 255, 255, 0.4);
    background: radial-gradient(circle at top left,
                                rgba(255, 255, 255, 0.10),
                                rgba(0, 0, 0, 0.85));
}

.scheduler-preset-button:active,
.scheduler-preset-button:focus {
    outline: none;
    box-shadow: none;
}

.scheduler-preset-button--active {
    background-image: linear-gradient(135deg,
                                      #ff42ff 0%,
                                      #b15bff 45%,
                                      #44e0ff 100%);
    border-color: rgba(255, 255, 255, 0.9);
    color: #0a0614;
    box-shadow: 0 0 18px rgba(255, 66, 255, 0.45);
}

.scheduler-preset-button--active:active,
.scheduler-preset-button--active:focus {
    background-image: linear-gradient(135deg,
                                      #ff42ff 0%,
                                      #b15bff 45%,
                                      #44e0ff 100%);
    border-color: rgba(255, 255, 255, 0.9);
    box-shadow: 0 0 18px rgba(255, 66, 255, 0.45);
}

.scheduler-preset-button--active:hover {
    box-shadow: 0 0 22px rgba(255, 66, 255, 0.6);
    transform: translateY(-1px);
}

/* Sidebar pane ----------------------------------------------------------- */
.scheduler-pane-section {
    padding: 18px 20px 20px 20px;
    border-radius: 16px;
    border: 1px solid rgba(173, 82, 255, 0.5);
    background: radial-gradient(circle at top left,
        rgba(45, 10, 110, 0.96),
        rgba(10, 0, 30, 0.98));
    box-shadow:
        0 14px 32px rgba(0, 0, 0, 0.78),
        0 0 20px rgba(173, 82, 255, 0.32);
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
}

/* Align the left Drag & Drop window top with the calendar window top */
.scheduler-left-pane .scheduler-pane-section:first-child {
    position: relative;
    top: 24px;
}

.scheduler-left-pane > .scheduler-pane-section {
    height: 100%;
}

.scheduler-pane-header {
    margin-bottom: 0.5rem;
}

.scheduler-pane-title {
    font-weight: 600;
}

.scheduler-pane-subtitle {
    font-size: 0.8rem;
    opacity: 0.8;
}

.scheduler-filter-row {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.scheduler-color-swatch {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 999px;
    margin-right: 8px;
    border: 1px solid rgba(255, 255, 255, 0.35);
    vertical-align: middle;
}

.scheduler-color-dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 999px;
    margin-right: 10px;
    border: 1px solid rgba(255, 255, 255, 0.35);
    vertical-align: middle;
}

.scheduler-filter-dept {
    max-width: 110px;
}

.scheduler-filter-search {
    flex: 1;
}

.scheduler-sidebar-table {
    margin-top: 0;
}

.scheduler-placeholder-cell {
    text-align: center;
    padding: 12px;
    opacity: 0.8;
}

/* Right pane: week grid -------------------------------------------------- */
.scheduler-main-pane {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    min-height: 0;
    height: auto;
    position: relative;
    z-index: 0;
}

.scheduler-week-grid {
    position: relative;
    z-index: 0;
    isolation: isolate;
    overflow: hidden;
    border-radius: 20px;
    background: radial-gradient(circle at top left,
        rgba(20, 0, 60, 0.96),
        rgba(4, 0, 18, 0.98));
    border: 1px solid rgba(255, 255, 255, 0.16);
    box-shadow:
        0 20px 44px rgba(0, 0, 0, 0.9),
        0 0 22px rgba(128, 80, 255, 0.42);

    padding: 12px 16px 12px 16px;
}

.scheduler-week-grid-header-row {
    display: grid;
    grid-template-columns: 70px repeat(7, minmax(0, 1fr));
    align-items: stretch;
    margin-bottom: 4px;
}

.scheduler-time-column-header {
    /* empty spacer above time column */
}

.scheduler-day-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    text-align: center;
    padding-bottom: 2px;
}

.scheduler-day-header-name {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: rgba(255, 255, 255, 0.78);
}

.scheduler-day-header-date {
    margin-top: 1px;
    font-size: 0.75rem;
    letter-spacing: 0.06em;
    color: rgba(255, 255, 255, 0.6);
}

/* Grid body: 1 time column + 7 day columns; 1 row per hour slot */
.scheduler-week-grid-body {  
    margin-top: 4px;
    position: relative;
    display: grid;
    grid-template-columns: 70px repeat(7, minmax(0, 1fr));
    grid-auto-rows: 36px; /* fixed row height for predictable blocks */
}

/* Time labels in column 1 */
.scheduler-time-cell {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 10px;
    font-size: 0.78rem;
    color: rgba(255, 255, 255, 0.55);
    z-index: 1;
}

.scheduler-grid-slot {
    border-top: 1.25px solid rgba(255, 255, 255, 0.18); /* 25% thicker row lines */
    border-left: 1px solid rgba(255, 255, 255, 0.16);   /* vertical day separators */
    box-sizing: border-box;
    z-index: 0;
}

/* Time labels in column 1 */
.scheduler-time-cell {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 10px;
    font-size: 0.78rem;
    color: rgba(255, 255, 255, 0.55);
    z-index: 1;
}

/* Event blocks occupy their full grid area and visually override grid lines */
.scheduler-event-pill {
    position: relative;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: flex-start;
    padding: 4px 6px;
    border-radius: 18px;
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.6);
    cursor: pointer;
    overflow: hidden;

    /* Overlap interaction fix:
       When multiple events share a slot, we shrink the pill width.
       Grid defaults to stretching items, which makes the hitbox full-width and blocks clicks/drags. */
    justify-self: start;
    align-self: stretch;
    min-width: 0;
    max-width: 100%;
    z-index: 10;

    /* Drag friendliness */
    user-select: none;
    -webkit-user-select: none;
    -ms-user-select: none;
    touch-action: none;
}

.event-pill-content {
    padding: 0;
}

.event-pill-line {
    font-size: 0.72rem;
    line-height: 1.05;
    margin: 0;
}

.event-pill-project {
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1.05;
    margin: 1px 0;
}

.event-pill-header {
    opacity: 0.95;
}

.event-pill-assigned {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Ensure inner text doesn't steal pointer events (helps drag initiation on overlapped pills) */
.scheduler-event-pill .scheduler-event-content,
.scheduler-event-pill .scheduler-event-line
{
    pointer-events: none;
}

/* Penciled-in events: no teams / team members assigned */
.scheduler-event-pill--penciled {
    background: rgba(40, 40, 40, 0.55);              /* dark grey */
    border-color: rgba(255, 255, 255, 0.35);
    border-style: dashed;
    opacity: 0.72;                                   /* transparent to show it's tentative */
}

.scheduler-event-pill--penciled .scheduler-event-line {
    color: rgba(255, 255, 255, 0.78);
}

.scheduler-event-pill--penciled:hover {
    opacity: 0.9;
}

.event-pill--dim {
    opacity: 0.20;
    filter: saturate(0.7);
}

.event-pill--cancelled {
    opacity: 0.75;
    filter: grayscale(0.4) saturate(0.6);
    border: 1px dashed rgba(255, 120, 120, 0.85);
    box-shadow: none;
}

.scheduler-pill--preview-active {
    z-index: 1200 !important;
    transition: none !important;
    will-change: transform, width, height;
    max-width: none !important;
}

.scheduler-pill--preview-outside {
    opacity: 0.55 !important;
    filter: grayscale(0.35) saturate(0.75);
}

.scheduler-pill--preview-delete {
    border: 1px dashed rgba(255, 150, 150, 0.95) !important;
    box-shadow: 0 0 0 2px rgba(255, 88, 88, 0.45) inset !important;
    filter: grayscale(0.25) saturate(0.65);
}

/* Start-day segment: rounded top, flat bottom */
.scheduler-pill-seg-start {
    border-bottom-left-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
}

/* End-day segment: flat top, rounded bottom */
.scheduler-pill-seg-end {
    border-top-left-radius: 0 !important;
    border-top-right-radius: 0 !important;
}

/* Middle segments: flat top and bottom */
.scheduler-pill-seg-middle {
    border-radius: 0 !important;
}

.scheduler-event-content {
    width: 100%;
}

.scheduler-event-line {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif;
    line-height: 1.2;
    margin-bottom: 2px;
    text-shadow: 0 0 8px rgba(0, 0, 0, 0.6);
}

.scheduler-event-date {
    font-size: 11px;
    opacity: 0.75;
}

.scheduler-event-time {
    font-size: 11px;
    opacity: 0.85;
}

.scheduler-event-project {
    font-size: 13px;
    font-weight: 600;
}

.scheduler-event-department,
.scheduler-event-status {
    font-size: 11px;
    opacity: 0.9;
}

/* Submit row ------------------------------------------------------------- */
.scheduler-submit-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 4px;
    padding: 0 4px;
}

.scheduler-staged-label {
    font-size: 0.8rem;
    opacity: 0.8;
}

.scheduler-submit-button {
    min-width: 150px;
}
.scheduler-new-event-body {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.scheduler-new-event-intro {
    font-size: 0.9rem;
    opacity: 0.85;
    margin-bottom: 4px;
}

.scheduler-new-event-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.1fr);
    gap: 18px;
}

.scheduler-new-event-column {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.scheduler-new-event-section-title {
    font-size: 0.85rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    opacity: 0.85;
    margin: 6px 0 10px 0;
}

.scheduler-new-event-section-subtitle {
    font-size: 0.9rem;
    font-weight: 600;
    opacity: 0.9;
    margin: 10px 0 8px 0; /* extra gap before and a little space before fields */
}

.scheduler-new-event-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.scheduler-modal-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.scheduler-modal-header-left {
    display: flex;
    align-items: center;
}

.scheduler-modal-header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.scheduler-new-event-label {
    font-size: 0.8rem;
    opacity: 0.8;
}

.scheduler-new-event-help {
    font-size: 0.78rem;
    opacity: 0.75;
    margin: 0 0 4px 0;
}

.scheduler-new-event-time-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.scheduler-new-event-location-card {
    margin-top: 4px;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: rgba(10, 0, 26, 0.85);
}

.scheduler-location-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 10px;
}

.scheduler-location-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.scheduler-invite-table {
    margin-top: 4px;
}

.scheduler-asana-preview {
    height: 80px;
    resize: vertical;
    text-align: left;
}
/* Time + AM/PM side-by-side */
.scheduler-time-input-group {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.75rem;          /* space between HH:MM and AM/PM */
}

/* Keep the time box wide, AM/PM compact */
.scheduler-time-input-group .scheduler-time-text {
    flex: 1 1 auto;
}

/* Make the AM/PM dropdown only as wide as it needs */
.scheduler-time-input-group .scheduler-time-ampm {
    flex: 0 0 auto;
    max-width: 5rem;
}

/* Override any global full-width input behavior inside this group */
.scheduler-time-input-group .kos-input {
    width: auto;
}

/* Scheduler: Time & Arrival Window single-row layout */
.scheduler-new-event-time-row {
    display: flex;
    flex-wrap: wrap;        /* will wrap on tiny screens instead of breaking */
    gap: 1rem;
    align-items: flex-end;
}

.scheduler-new-event-time-row .scheduler-time-field {
    flex: 0 0 260px;        /* Start/End time widths */
}

.scheduler-new-event-time-row .scheduler-arrival-field {
    flex: 0 0 200px;        /* Arrival window width */
}

/* Keep the controls nicely sized inside the row */
.scheduler-new-event-time-row .scheduler-time-input-group,
.scheduler-new-event-time-row .scheduler-time-text,
.scheduler-new-event-time-row .scheduler-time-ampm,
.scheduler-new-event-time-row .scheduler-arrival-field .kos-input {
    width: 100%;
}
/* Date selector row inside the New Event editor */
.scheduler-date-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.scheduler-date-nav-button {
    min-width: 0;
}

.scheduler-date-nav-button:hover {
    opacity: 1;
}

.scheduler-date-input {
    max-width: 180px;
    text-align: center;
}

/* Keep time and arrival fields aligned in one row when space allows */
.scheduler-new-event-time-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.scheduler-new-event-field.scheduler-time-field {
    flex: 1 1 160px;
}

.scheduler-arrival-field {
    flex: 0 0 180px;
}
.kos-app-shell,
#app,
main.content {
    z-index: 0;
}


.kos-select-all-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.kos-select-all-popover-backdrop,
.kos-select-all-floating-backdrop {
    position: fixed;
    inset: 0;
    background: transparent;
    z-index: 5000;
}

.kos-select-all-popover,
.kos-select-all-floating-popover {
    position: fixed;
    z-index: 5001;
    width: 280px;
    min-width: 220px;
    max-width: 280px;
    padding: 8px 10px;
    border-radius: 10px;
    background: rgba(30, 5, 65, 0.96);
    border: 1px solid rgba(200, 120, 255, 0.55);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.45);
    text-align: center;
}

.kos-select-all-popover::after,
.kos-select-all-floating-popover::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 100%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid rgba(30, 5, 65, 0.96);
}

.kos-select-all-floating-popover.is-below::after {
    top: auto;
    bottom: 100%;
    border-top: none;
    border-bottom: 8px solid rgba(30, 5, 65, 0.96);
}

.kos-select-all-popover-text {
    font-size: 0.78rem;
    margin-bottom: 8px;
    line-height: 1.2;
}

.kos-select-all-popover-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.kos-select-all-popover-confirm,
.kos-select-all-popover-cancel {
    width: 100%;
    font-size: 0.72rem;
    padding: 0.25rem 0.5rem;
}

.team-member-calendar-sync-panel {
    margin-bottom: 14px;
    padding: 14px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(24, 6, 56, 0.58);
    position: relative;
    z-index: 1;
    isolation: isolate;
}

.team-member-calendar-sync-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--kos-text-strong);
}

.team-member-calendar-sync-subtitle {
    margin-top: 4px;
    margin-bottom: 12px;
    color: rgba(255, 255, 255, 0.78);
    font-size: 0.88rem;
    line-height: 1.35;
}

.team-member-calendar-sync-helper {
    margin-bottom: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid rgba(255, 200, 120, 0.55);
    background: rgba(70, 28, 0, 0.45);
    color: rgba(255, 234, 191, 0.98);
    font-size: 0.84rem;
}

.team-member-calendar-sync-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 10px;
    position: relative;
    z-index: 1;
}

.team-member-calendar-sync-grid .kos-btn {
    width: 100%;
    position: relative;
    z-index: 1;
}

.team-member-calendar-popup-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.team-member-calendar-popup-steps {
    margin: 0;
    padding-left: 20px;
    color: rgba(255, 255, 255, 0.92);
    line-height: 1.4;
}

.team-member-calendar-popup-steps li + li {
    margin-top: 4px;
}

.team-member-calendar-popup-note {
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid rgba(132, 203, 255, 0.45);
    background: rgba(16, 41, 80, 0.4);
    color: rgba(211, 237, 255, 0.95);
    font-size: 0.85rem;
    line-height: 1.35;
}

.team-member-calendar-popup-warning {
    padding: 11px 12px;
    border-radius: 10px;
    border: 1px solid rgba(255, 194, 107, 0.55);
    background: rgba(78, 34, 0, 0.46);
}

.team-member-calendar-popup-warning-title {
    font-weight: 700;
    color: rgba(255, 236, 190, 0.98);
    margin-bottom: 5px;
}

.team-member-calendar-popup-warning-body {
    color: rgba(255, 243, 215, 0.95);
    line-height: 1.35;
}

.team-member-calendar-copy-toast {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 6100;
    min-width: 210px;
    max-width: 320px;
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid rgba(168, 255, 196, 0.58);
    background: rgba(10, 64, 26, 0.9);
    color: rgba(226, 255, 236, 1);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35);
    font-size: 0.86rem;
    animation: team-member-calendar-toast-in 160ms ease-out;
}

@keyframes team-member-calendar-toast-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.kos-project-color-swatch {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 999px;
    margin-right: 8px;
    vertical-align: middle;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.kos-project-stat-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
}

.kos-project-stat-pill {
    min-width: 132px;
    padding: 8px 12px;
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.04));
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.35);
}

.kos-project-stat-pill__label {
    font-size: 0.72rem;
    line-height: 1.05;
    color: rgba(255, 255, 255, 0.72);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.kos-project-stat-pill__value {
    margin-top: 4px;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.05;
    color: #fff;
}

.kos-project-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px 14px;
}

.kos-project-summary-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.kos-project-summary-item span {
    color: rgba(255, 255, 255, 0.72);
    font-size: 0.82rem;
}

.kos-project-summary-item strong {
    color: #fff;
    font-size: 0.92rem;
}
