/* public/assets/css/s11-leave.css
   KHMER HRMS — S11 Leave Requests & Permission Approval
   All component colors are inherited from the existing theme variables.
   No external assets or CDN dependencies.
*/

.s11-form-card,
.s11-workflow-form,
.leave-filter-card {
    margin-bottom: var(--space-3, 24px);
}

.s11-detail-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(280px, .9fr);
    gap: var(--space-3, 24px);
    align-items: start;
}

.s11-detail-grid .card {
    min-width: 0;
}

.s11-detail-list {
    margin: 0;
    display: grid;
    gap: 0;
}

.s11-detail-list > div {
    display: grid;
    grid-template-columns: minmax(130px, .45fr) minmax(0, 1fr);
    gap: 16px;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
}

.s11-detail-list > div:last-child {
    border-bottom: 0;
}

.s11-detail-list dt {
    color: var(--text-muted);
    font-weight: 600;
}

.s11-detail-list dd {
    margin: 0;
    color: var(--text);
    overflow-wrap: anywhere;
}

.s11-info-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin: 24px 0;
}

.s11-info-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius, 14px);
    background: var(--surface-alt);
    box-shadow: var(--shadow-ambient), var(--shadow-contact);
}

.s11-info-card strong {
    display: block;
    margin-bottom: 4px;
}

.s11-info-card p {
    margin: 0;
    color: var(--text-muted);
}

.s11-info-icon {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 12px;
    color: var(--primary);
    background: color-mix(in srgb, var(--primary) 12%, var(--surface));
}

.s11-info-icon svg {
    width: 20px;
    height: 20px;
}

.s11-step-list {
    display: grid;
    gap: 16px;
    position: relative;
    padding: 8px 0;
}

.s11-step {
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
    z-index: 1;
    color: var(--text-muted);
}

.s11-step-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface);
    font-weight: 700;
}

.s11-step.is-current {
    color: var(--primary);
}

.s11-step.is-current .s11-step-number,
.s11-step.is-done .s11-step-number {
    color: var(--surface);
    background: var(--primary);
    border-color: var(--primary);
    box-shadow: 0 0 0 6px color-mix(in srgb, var(--primary) 12%, transparent);
}

.s11-detail-actions {
    margin-top: 24px;
}

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

.inline-filter label {
    font-weight: 600;
}

.inline-filter .form-control {
    width: auto;
    min-width: 180px;
}

.required {
    color: var(--danger);
}

.form-hint {
    display: block;
    margin-top: 6px;
    color: var(--text-muted);
}

.s11-form-card .form-grid,
.s11-workflow-form .form-grid,
.leave-filter-card .form-grid {
    align-items: end;
}

/* ── Approval Workflows: combined "Workflow Type + Add Workflow Step"
   card ──────────────────────────────────────────────────────────────
   One card, two parts: a header row (title + segmented Workflow Type
   switch) and, below a hairline divider, the step-creation fields laid
   out as a single row ending in the Create button — matching every
   other single-row toolbar in the app (Locations, Attendance filters)
   instead of the old separate filter card + stacked form-grid. */
.s11-workflow-config-card {
    margin-bottom: var(--space-3, 24px);
}

.s11-workflow-config-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.s11-workflow-config-header h2 {
    margin: 0 0 4px;
}

.s11-workflow-config-header .text-muted {
    margin: 0;
}

.s11-workflow-config-divider {
    height: 1px;
    margin: 20px 0;
    background: var(--border);
}

/* Segmented "Leave / Permission" switch — same pill-toggle visual
   language as the S24 Appearance settings (.s24-segmented), reused
   here as plain links so switching type is a single click with no
   separate Filter button. */
.s11-wtype-switch {
    display: inline-flex;
    flex-shrink: 0;
    padding: 4px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface-alt);
    gap: 4px;
}

.s11-wtype-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--text-muted);
    font-size: .86rem;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color .15s ease, color .15s ease, box-shadow .15s ease;
}

.s11-wtype-btn svg {
    width: 15px;
    height: 15px;
}

.s11-wtype-btn:hover {
    color: var(--text);
}

.s11-wtype-btn.is-active {
    background: var(--surface);
    color: var(--primary);
    box-shadow: var(--shadow-contact);
}

/* Add Workflow Step — one row: Department · Step · Approver Role ·
   Specific Approver · Create, all sharing the same baseline so the
   Create button sits level with the input fields instead of dropping
   to its own line below a stacked grid. */
.s11-workflow-step-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 14px;
}

.s11-workflow-step-row .form-group {
    flex: 1 1 170px;
    min-width: 150px;
    margin-bottom: 0;
}

.s11-workflow-step-submit {
    flex: 0 0 auto;
    min-width: 0;
}

/* Invisible label the same height as the real field labels, so the
   Create button's top edge lines up with every select/input's top
   edge — not just its baseline. */
.s11-label-spacer {
    visibility: hidden;
}

.s11-workflow-step-submit .btn {
    width: 100%;
    white-space: nowrap;
}

@media (max-width: 767.98px) {
    .s11-workflow-config-header {
        flex-direction: column;
        align-items: stretch;
    }

    .s11-wtype-switch {
        width: 100%;
    }

    .s11-wtype-btn {
        flex: 1 1 0;
        justify-content: center;
    }

    .s11-workflow-step-row {
        flex-direction: column;
        align-items: stretch;
    }

    .s11-workflow-step-row .form-group {
        flex: 1 1 auto;
        min-width: 0;
    }

    .s11-label-spacer {
        display: none;
    }
}

.s11-form-card .form-group:nth-child(4),
.s11-form-card .form-group:nth-child(5) {
    grid-column: 1 / -1;
}

@media (max-width: 991.98px) {
    .s11-detail-grid {
        grid-template-columns: 1fr;
    }

    .s11-info-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 767.98px) {
    .s11-detail-list > div {
        grid-template-columns: 1fr;
        gap: 4px;
    }

    .inline-filter {
        align-items: stretch;
        flex-direction: column;
    }

    .inline-filter .form-control {
        width: 100%;
        min-width: 0;
    }

    .s11-detail-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .s11-detail-actions > form,
    .s11-detail-actions > form .btn,
    .s11-detail-actions > a {
        width: 100%;
    }
}

@media print {
    .s11-detail-actions,
    .leave-filter-card,
    .s11-filter-bar,
    .table-action-dock,
    .s11-workflow-form,
    .s11-workflow-config-card {
        display: none !important;
    }

    .s11-detail-grid {
        grid-template-columns: 1fr;
    }
}

/* ── S11 filter toolbar (Leave Requests / Permission Requests) ──────
   Reuses the app-wide .filter-bar/.filter-form flat toolbar (same
   shape as Attendance/Locations/Mobile Check-In/Logs) instead of the
   old stacked .leave-filter-card/.form-grid layout, which had no grid
   rule defined anywhere and rendered every field on its own full-width
   row. Only page-specific sizing lives here — the toolbar shell itself
   is the shared, already-standard component.

   Fix: .filter-bar is a flex row, but .filter-form is its ONLY flex
   child — with no flex-grow it just shrinks to its content width,
   leaving a dead gap on the right inside the card (the "stops halfway"
   look). Scoped to .s11-filter-bar only, not the base .filter-form
   used elsewhere (Locations/Attendance), since those already look
   correct as-is and some pages put two .filter-form siblings side by
   side. */
.s11-filter-bar .filter-form {
    row-gap: 10px;
    flex: 1 1 auto;
    width: 100%;
}

/* Fields grow to fill the row instead of clustering on the left —
   each select/date-field shares the remaining space evenly, capped so
   none of them balloons to an unreasonable width on ultra-wide
   monitors. The Apply/Clear buttons keep their natural size (no
   flex-grow) so they land pinned at the end of the row. */
.s11-filter-bar .filter-form > select,
.s11-filter-bar .filter-form > .s11-picker-field {
    flex: 1 1 150px;
    max-width: 260px;
    min-width: 0;
}

/* The Employee dropdown's option text ("EMP-0001 · Sok Dara") is much
   longer than a status/type/department label, so it gets a wider cap
   than the other fields. */
.s11-filter-bar select.s11-filter-employee {
    flex: 1 1 200px;
    max-width: 320px;
}

@media (max-width: 991.98px) {
    .s11-filter-bar .filter-form > select,
    .s11-filter-bar .filter-form > .s11-picker-field,
    .s11-filter-bar select.s11-filter-employee {
        max-width: none;
    }
}

@media (max-width: 575.98px) {
    .s11-filter-bar .filter-form {
        flex-direction: column;
        align-items: stretch;
    }
    .s11-filter-bar select,
    .s11-filter-bar select.s11-filter-employee,
    .s11-filter-bar .s11-picker-field,
    .s11-filter-bar .btn {
        width: 100%;
        max-width: none;
    }
}

/* ── S11 Premium date/time picker ─────────────────────────────────── */
.s11-picker-field {
    position: relative;
    min-width: 0;
}

/* PATCH — date-format consistency pass: converting the last few plain
   `<input type="date">` fields (Certifications issue/expiry, Staff Cards
   expiry) to this shared picker means their existing `x-bind:disabled`
   (e.g. an "Is Permanent" toggle) now targets the hidden value input
   instead of a native, browser-rendered date field — so the browser no
   longer greys it out on its own. The wrapper's own `:class` binding adds
   this class alongside that same condition, so the display/trigger the
   picker builds still visually (and functionally, via pointer-events)
   reflects the disabled state, matching how a native disabled date input
   used to look and behave. */
.s11-picker-field.is-field-disabled {
    opacity: .55;
    pointer-events: none;
}

.s11-picker-input-row {
    position: relative;
    display: flex;
    align-items: stretch;
}

.s11-picker-display {
    padding-right: 48px;
    letter-spacing: .02em;
    font-variant-numeric: tabular-nums;
}

/* Real-time invalid state: e.g. typing "32" for the day group, or a
   date outside an allowed min/max range — the caret jumps back to
   (selects) the offending group so the person can just retype it. */
.s11-picker-display.is-invalid {
    border-color: var(--danger, #dc2626);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger, #dc2626) 15%, transparent);
}

.s11-picker-day.is-disabled {
    opacity: .32;
    cursor: not-allowed;
    text-decoration: line-through;
}

/* Date fields (S11 filters etc.) are typeable — dd/mm/yyyy — so the
   text caret is the right cursor, not a pointer/hand. The date+time
   picker's display stays read-only (time is set from the wheel/free
   text inside the popover), so it keeps the pointer cursor. */
.s11-datetime-display {
    cursor: pointer;
}

/* ── Hardening: the picker's display field must ALWAYS look like a
   single, clean date/time box — never inherit the pill-shaped
   "search" box styling (rounded-full + magnifier icon background)
   that `.filter-form input[type="text"]` applies to plain search
   fields. Wherever a picker field ends up — inside `.filter-form`
   (Attendance/Mobile-Check-in/Recycle-Bin style filter bars),
   `.form-group` (ordinary forms), `.filter-search-field`, or any
   future filter wrapper — this wins on `!important` so the visual
   result is identical everywhere in the app, not dependent on which
   ancestor happens to wrap it. */
.s11-picker-display,
.s11-picker-display[type="text"] {
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
    flex: 1 1 auto !important;
    padding: 10px 48px 10px 14px !important;
    border-radius: var(--radius-sm, 10px) !important;
    background-color: var(--surface) !important;
    background-image: none !important;
    background-position: 0 0 !important;
    background-size: auto !important;
    background-repeat: no-repeat !important;
    box-sizing: border-box !important;
}

.s11-picker-input-row {
    width: 100%;
}

.s11-picker-icon {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 10px;
    background: var(--surface-alt);
    color: var(--primary);
    cursor: pointer;
    transition: transform .18s ease, background-color .18s ease;
    z-index: 2;
}

.s11-picker-icon:hover {
    transform: translateY(-50%) scale(1.04);
    background: var(--surface-hover, var(--surface-alt));
}

.s11-picker-icon svg {
    width: 19px;
    height: 19px;
}

.s11-picker-popover {
    /* Base/fallback position — used only until JS measures the
       trigger and switches this to `position: fixed` with an exact
       viewport coordinate (see s11-picker.js). Fixed positioning is
       what actually matters: it lets the calendar float freely on
       top of the page instead of getting trapped/clipped inside a
       scrollable ancestor such as `.table-wrap` (overflow-x: auto
       implicitly forces overflow-y: auto too), which is what caused
       the popover to render as a cramped, partially-hidden box with
       odd gaps on filter bars that sit above a data table. */
    position: absolute;
    z-index: 1000;
    top: calc(100% + 8px);
    left: 0;
    width: min(320px, calc(100vw - 32px));
    max-height: min(80vh, 560px);
    overflow-y: auto;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--surface);
    box-shadow: var(--shadow-floating, var(--shadow-ambient));
    opacity: 0;
    visibility: hidden;
    box-sizing: border-box;
    transform: translateY(-6px) scale(.985);
    transform-origin: top left;
    transition: opacity .18s ease, transform .18s ease, visibility .18s ease;
}

/* When JS has flipped the popover to open upward (not enough room
   below the field, e.g. a filter bar near the bottom of the
   viewport), the scale/slide animation should originate from the
   bottom edge instead of the top so it doesn't visually "swoop" the
   wrong way. */
.s11-picker-field.s11-picker-open-up .s11-picker-popover {
    transform: translateY(6px) scale(.985);
    transform-origin: bottom left;
}
.s11-picker-field.s11-picker-open-up.is-open .s11-picker-popover {
    transform: translateY(0) scale(1);
}

/* The plain date popover (filters, single-date fields) is
   deliberately narrower/shorter than the date+time popover above —
   it's just a compact month grid, so it shouldn't stretch to the
   same 440px width or carry the same padding. */
.s11-date-popover {
    width: min(300px, calc(100vw - 32px));
}

.s11-picker-field.is-open .s11-picker-popover {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.s11-picker-header {
    display: grid;
    grid-template-columns: 34px 1fr 34px;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
}

.s11-date-popover .s11-picker-nav {
    width: 30px;
    height: 30px;
    font-size: 20px;
}

.s11-picker-month-title,
.s11-time-title {
    text-align: center;
    font-weight: 800;
    color: var(--text);
}

.s11-picker-nav,
.s11-picker-btn {
    border: 0;
    cursor: pointer;
}

.s11-picker-nav {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--surface-alt);
    color: var(--text);
    font-size: 25px;
    line-height: 1;
    transition: transform .18s ease, background-color .18s ease;
}

.s11-picker-nav:hover {
    transform: scale(1.05);
    background: var(--surface-hover, var(--surface-alt));
}


.s11-picker-header-rich {
    grid-template-columns: 34px 1fr 34px;
}

.s11-picker-title-group {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-width: 0;
}

.s11-picker-title-button {
    border: 0;
    background: transparent;
    color: var(--text);
    font-weight: 800;
    font-size: .86rem;
    padding: 5px 7px;
    border-radius: 8px;
    cursor: pointer;
}

.s11-picker-title-button:hover {
    background: var(--surface-alt);
    color: var(--primary);
}

.s11-picker-year-range {
    text-align: center;
    font-weight: 800;
    color: var(--text);
    font-size: .84rem;
}

.s11-picker-month-grid,
.s11-picker-year-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 7px;
    margin-top: 4px;
}

.s11-picker-month-button,
.s11-picker-year-button {
    min-height: 42px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface-alt);
    color: var(--text);
    font-size: .78rem;
    font-weight: 800;
    cursor: pointer;
    transition: transform .15s ease, border-color .15s ease, background-color .15s ease;
}

.s11-picker-month-button:hover,
.s11-picker-year-button:hover {
    transform: translateY(-1px);
    border-color: var(--primary);
}

.s11-picker-month-button.is-selected,
.s11-picker-year-button.is-selected {
    background: var(--primary);
    color: var(--surface);
    border-color: var(--primary);
}

.s11-picker-month-button:disabled,
.s11-picker-year-button:disabled {
    opacity: .45;
    cursor: not-allowed;
}

.s11-picker-weekdays,
.s11-picker-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    grid-auto-rows: minmax(28px, auto);
    align-content: start;
    gap: 4px;
}

.s11-picker-weekdays {
    margin-bottom: 4px;
}

.s11-picker-weekdays span {
    text-align: center;
    color: var(--text-muted);
    font-size: .72rem;
    font-weight: 700;
}

/* Saturday / Sunday marked in red, both in the weekday header row
   and on every day-cell that falls on a weekend — in the current
   month or the muted lead/trail days from adjacent months. */
.s11-picker-weekdays span.is-weekend {
    color: var(--danger);
}

.s11-picker-day.is-weekend {
    color: var(--danger);
}

.s11-picker-day.is-weekend.is-muted {
    color: var(--danger);
    opacity: .38;
}

.s11-picker-day.is-weekend.is-selected {
    color: var(--surface);
}

.s11-picker-day {
    min-height: 30px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: var(--surface-alt);
    color: var(--text);
    font-size: .8rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform .15s ease, background-color .15s ease, color .15s ease, border-color .15s ease;
}

.s11-picker-day:hover {
    transform: translateY(-1px);
    border-color: var(--primary);
}

.s11-picker-day.is-muted {
    color: var(--text-muted);
    opacity: .42;
}

.s11-picker-day.is-today {
    border-color: var(--primary);
}

.s11-picker-day.is-selected {
    background: var(--primary);
    color: var(--surface);
    border-color: var(--primary);
    box-shadow: 0 4px 12px color-mix(in srgb, var(--primary) 20%, transparent);
}

.s11-picker-footer {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 8px;
}

.s11-date-popover .s11-picker-day {
    min-height: 28px;
}

.s11-picker-secondary,
.s11-picker-primary {
    min-height: 34px;
    padding: 6px 12px;
    border-radius: 10px;
    font-size: .82rem;
    font-weight: 800;
    cursor: pointer;
    transition: transform .18s ease, box-shadow .18s ease;
}

.s11-picker-secondary {
    border: 1px solid var(--border);
    background: var(--surface-alt);
    color: var(--text);
}

.s11-picker-primary {
    border: 1px solid var(--primary);
    background: var(--primary);
    color: var(--surface);
}

.s11-picker-secondary:hover,
.s11-picker-primary:hover {
    transform: translateY(-1px);
}

.s11-time-popover {
    width: min(500px, calc(100vw - 32px));
}

.s11-time-title {
    margin-bottom: 14px;
    font-size: 1rem;
}

.s11-time-columns {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.s11-time-column {
    display: grid;
    justify-items: center;
    gap: 8px;
    padding: 8px;
    border-radius: 16px;
    background: var(--surface-alt);
}

.s11-time-label {
    color: var(--text-muted);
    font-size: .78rem;
    font-weight: 700;
}

.s11-time-arrow {
    width: 100%;
    height: 34px;
    border: 0;
    border-radius: 10px;
    background: var(--surface);
    color: var(--primary);
    font-size: 20px;
    cursor: pointer;
}

.s11-time-value {
    min-width: 72px;
    padding: 10px 8px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    color: var(--text);
    text-align: center;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

.s11-date-range-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface-alt);
}

.s11-date-range-toggle label {
    margin: 0;
    font-weight: 700;
}

.s11-date-range-toggle input {
    width: 20px;
    height: 20px;
    accent-color: var(--primary);
}

.s11-policy-warning {
    margin-top: 8px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface-alt);
    color: var(--text-muted);
    font-size: .86rem;
}

.s11-policy-warning.is-danger {
    color: var(--danger, var(--text));
    border-color: var(--danger, var(--border));
}

.s11-settings-section {
    margin-top: 24px;
}

.s11-settings-section:first-child {
    margin-top: 0;
}

.s11-settings-table-wrap {
    overflow-x: auto;
}

.s11-settings-table {
    min-width: 900px;
}

.s11-settings-table th,
.s11-settings-table td {
    vertical-align: middle;
}

.s11-settings-table select,
.s11-settings-table input[type="number"] {
    min-width: 120px;
}

@media (max-width: 767px) {
    .s11-picker-popover {
        position: fixed;
        left: 50%;
        top: 50%;
        transform: translate(-50%, -46%) scale(.985);
        width: min(520px, calc(100vw - 24px));
        max-height: min(720px, calc(100vh - 24px));
        overflow: auto;
        transform-origin: center;
    }

    .s11-picker-field.is-open .s11-picker-popover {
        transform: translate(-50%, -50%) scale(1);
    }

    .s11-picker-day {
        min-height: 40px;
    }

    .s11-time-columns {
        gap: 7px;
    }

    .s11-time-value {
        min-width: 58px;
    }
}

@media (max-width: 480px) {
    .s11-picker-popover {
        padding: 14px;
        border-radius: 18px;
    }

    .s11-picker-weekdays,
    .s11-picker-grid {
        gap: 4px;
    }

    .s11-picker-day {
        min-height: 38px;
        border-radius: 10px;
    }
}

/* ── S11 combined Date + Time picker ──────────────────────────────── */
.s11-datetime-popover {
    width: min(860px, calc(100vw - 32px));
}

.s11-datetime-shell {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(300px, .85fr);
    gap: 20px;
}

.s11-datetime-date-pane,
.s11-datetime-time-pane {
    min-width: 0;
}

.s11-datetime-time-pane {
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: var(--surface-alt);
}

.s11-datetime-time-pane .s11-time-columns {
    background: transparent;
}

.s11-datetime-time-pane .s11-time-column {
    background: var(--surface);
}

.s11-datetime-time-pane .s11-picker-footer {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.s11-datetime-display {
    font-variant-numeric: tabular-nums;
    letter-spacing: .01em;
}

.s11-urgent-box {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface-alt);
    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}

.s11-urgent-box:has(input:checked) {
    border-color: var(--warning);
    box-shadow: 0 8px 24px color-mix(in srgb, var(--warning) 14%, transparent);
}

.s11-urgent-box input {
    width: 20px;
    height: 20px;
    accent-color: var(--warning);
    flex: 0 0 auto;
}

.s11-urgent-box label {
    margin: 0;
    cursor: pointer;
    font-weight: 800;
}

.s11-urgent-icon {
    color: var(--warning);
    display: inline-flex;
}

.s11-review-banner {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 20px;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface-alt);
}

.s11-review-banner.is-locked {
    border-color: color-mix(in srgb, var(--warning) 55%, var(--border));
}

.s11-review-banner-icon {
    flex: 0 0 auto;
    color: var(--primary);
}

.s11-review-banner strong,
.s11-review-banner p {
    margin: 0;
}

.s11-review-banner p {
    color: var(--text-muted);
    margin-top: 3px;
}

.s11-request-meta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.s11-urgent-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

@media (max-width: 900px) {
    .s11-datetime-shell {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 767px) {
    .s11-datetime-popover {
        position: fixed;
        left: 50%;
        top: 50%;
        transform: translate(-50%, -46%) scale(.985);
        width: min(560px, calc(100vw - 24px));
        max-height: calc(100vh - 24px);
        overflow: auto;
        transform-origin: center;
    }

    .s11-picker-field.is-open .s11-datetime-popover {
        transform: translate(-50%, -50%) scale(1);
    }

    .s11-datetime-time-pane .s11-picker-footer {
        grid-template-columns: 1fr 1fr;
    }

    .s11-datetime-time-pane .s11-picker-footer .s11-picker-primary {
        grid-column: 1 / -1;
    }
}


.s11-datetime-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}
.s11-datetime-row > div { min-width: 0; }
@media (max-width: 767px) { .s11-datetime-row { grid-template-columns: 1fr; } }

.s11-urgent-settings-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-top: 16px;
}
.s11-urgent-settings-grid .check-row {
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface-alt);
}
@media (max-width: 767px) {
    .s11-urgent-settings-grid { grid-template-columns: 1fr; }
}

/* ── S11 workflow history / refined actions ───────────────────────── */
.s11-status-history-card {
    margin-top: var(--space-3, 24px);
}

.s11-status-history-subtitle {
    margin: 3px 0 0;
    font-size: .82rem;
}

.s11-status-timeline {
    display: grid;
    gap: 0;
    padding: 6px 0 2px;
}

.s11-status-event {
    display: grid;
    grid-template-columns: 16px minmax(0, 1fr);
    gap: 12px;
    position: relative;
    padding: 0 0 18px;
}

.s11-status-event:not(:last-child)::before {
    content: "";
    position: absolute;
    left: 7px;
    top: 15px;
    bottom: 0;
    width: 1px;
    background: var(--border);
}

.s11-status-dot {
    width: 10px;
    height: 10px;
    margin-top: 5px;
    border-radius: 999px;
    background: var(--text-muted);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--text-muted) 10%, transparent);
    z-index: 1;
}

.s11-status-event.is-pending .s11-status-dot {
    background: var(--warning);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--warning) 10%, transparent);
}

.s11-status-event.is-checking .s11-status-dot {
    background: var(--primary);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 10%, transparent);
}

.s11-status-event.is-returned .s11-status-dot {
    background: var(--warning);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--warning) 10%, transparent);
}

.s11-status-event.is-success .s11-status-dot {
    background: var(--success);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--success) 10%, transparent);
}

.s11-status-event.is-danger .s11-status-dot {
    background: var(--danger);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--danger) 10%, transparent);
}

.s11-status-event-head {
    display: flex;
    align-items: center;
    gap: 9px;
    min-width: 0;
    flex-wrap: wrap;
}

.s11-status-badge {
    font-size: .76rem;
    line-height: 1.35;
    font-weight: 700;
    padding: 3px 8px;
    border: 1px solid var(--border);
    background: var(--surface-alt);
    color: var(--text);
}

.s11-status-time {
    color: var(--text-muted);
    font-size: .76rem;
    font-weight: 500;
    opacity: .78;
    white-space: nowrap;
}

.s11-status-reason {
    margin: 5px 0 0;
    color: var(--text-muted);
    font-size: .82rem;
    line-height: 1.55;
}

.s11-detail-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: thin;
}

.s11-detail-actions > form {
    flex: 0 0 auto;
}

.s11-detail-actions > a {
    flex: 0 0 auto;
}

.s11-time-range-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius, 14px);
    background: var(--surface-alt);
}

.s11-time-range-row > div {
    display: grid;
    gap: 2px;
    min-width: 100px;
}

.s11-time-label {
    color: var(--text-muted);
    font-size: .72rem;
    font-weight: 600;
}

.s11-time-value {
    font-weight: 700;
    letter-spacing: .02em;
}

.s11-time-arrow {
    color: var(--text-muted);
    display: inline-flex;
}

.s11-time-arrow svg {
    width: 16px;
    height: 16px;
}

.s11-date-range-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius, 14px);
    background: var(--surface-alt);
}

.s11-date-range-toggle label {
    min-width: 0;
    font-weight: 700;
}

.s11-date-range-toggle input {
    flex: 0 0 auto;
    width: 20px;
    height: 20px;
    accent-color: var(--primary);
}

.s11-status-history-card .card-header h2 {
    margin-bottom: 0;
}

@media (max-width: 575.98px) {
    .s11-status-event-head {
        align-items: flex-start;
        flex-direction: column;
        gap: 4px;
    }

    .s11-status-time {
        font-size: .72rem;
    }

    .s11-time-range-row {
        justify-content: space-between;
        gap: 8px;
        padding: 10px 12px;
    }

    .s11-time-range-row > div {
        min-width: 0;
    }
}

.s11-list-status-time {
    display: block;
    margin-top: 3px;
    color: var(--text-muted);
    font-size: .72rem;
    font-weight: 500;
    opacity: .76;
}

.s11-current-status-time {
    display: inline-flex;
    margin-top: 4px;
    color: var(--text-muted);
    font-size: .76rem;
    font-weight: 500;
    opacity: .78;
}

/* ─────────────────────────────────────────────────────────────────────
   S11 V2 — Request lists + clean responsive action/status system
   ───────────────────────────────────────────────────────────────────── */
.s11-request-table {
    min-width: 0;
    table-layout: fixed;
}

.s11-request-table th,
.s11-request-table td {
    vertical-align: middle;
}

.s11-request-table th:nth-last-child(2),
.s11-request-table td:nth-last-child(2) {
    width: 150px;
    min-width: 150px;
}

.s11-request-table th:last-child,
.s11-request-table td.actions {
    width: 176px !important;
    min-width: 176px !important;
    max-width: 176px !important;
}

.s11-request-table td.actions {
    overflow: visible !important;
    white-space: nowrap !important;
}

.s11-action-group {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 7px !important;
    flex-wrap: nowrap !important;
    min-width: max-content !important;
}

.s11-action-group > form,
.s11-action-group > a {
    display: inline-flex !important;
    flex: 0 0 auto !important;
    margin: 0 !important;
}

.s11-action-group .btn {
    flex: 0 0 36px !important;
    width: 36px !important;
    min-width: 36px !important;
    max-width: 36px !important;
    height: 36px !important;
    min-height: 36px !important;
    padding: 0 !important;
}

.s11-status-cell {
    min-width: 0;
}

.s11-status-line {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    min-width: 0;
}

.s11-status-line .badge {
    margin: 0 !important;
    white-space: nowrap;
}

.s11-list-status-time {
    display: block;
    margin-top: 4px;
    color: var(--text-muted);
    opacity: .78;
    font-size: .72rem;
    line-height: 1.2;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.s11-urgent-badge {
    font-size: .70rem !important;
    padding: 4px 7px !important;
}

/* Permission form: one premium Start Date & Time control, with From/End
   Time columns inside the picker. End date appears only for cross-date use. */
.s11-permission-form-card .form-group-full {
    min-width: 0;
}

.s11-permission-end-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(180px, .45fr);
    gap: 12px;
    margin-top: 8px;
}

.s11-date-range-toggle > div {
    min-width: 0;
}

.s11-date-range-toggle .form-hint {
    margin-top: 3px;
}

.s11-datetime-range-popover {
    width: min(860px, calc(100vw - 32px));
}

.s11-datetime-range-shell {
    grid-template-columns: minmax(280px, .9fr) minmax(390px, 1.1fr);
}

.s11-datetime-range-shell .s11-datetime-time-pane {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    align-items: start;
}

.s11-datetime-range-shell .s11-time-selector {
    min-width: 0;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--surface);
}

.s11-time-selector-title {
    margin-bottom: 8px;
    text-align: center;
    color: var(--text);
    font-size: .78rem;
    font-weight: 800;
}

.s11-datetime-range-shell .s11-time-columns {
    gap: 6px;
}

.s11-datetime-range-shell .s11-time-column {
    padding: 6px;
    border-radius: 12px;
}

.s11-datetime-range-shell .s11-time-value {
    min-width: 0;
    width: 100%;
    padding: 8px 5px;
    font-size: .82rem;
}

.s11-datetime-range-shell .s11-picker-footer {
    grid-column: 1 / -1;
    margin-top: 2px;
}

@media (max-width: 991.98px) {
    .s11-datetime-range-shell {
        grid-template-columns: 1fr;
    }

    .s11-datetime-range-shell .s11-datetime-time-pane {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 767.98px) {
    /* Leave Requests / Permission Requests now match the Leave Types
       table on mobile: a compact, normal <table> that scrolls
       horizontally inside .table-wrap (base .data-table rule in
       responsive.css), instead of a tall one-field-per-line stacked
       card. table-layout reverts to auto (Leave Types never sets
       fixed), so columns size to their natural content width and the
       table scrolls sideways exactly like that reference page. */
    .s11-request-table {
        table-layout: auto;
        min-width: max-content;
    }

    .s11-permission-end-grid {
        grid-template-columns: 1fr;
    }

    .s11-datetime-range-shell .s11-datetime-time-pane {
        grid-template-columns: 1fr;
    }

    .s11-datetime-range-shell .s11-datetime-time-pane .s11-picker-footer {
        grid-column: auto;
    }

    .s11-datetime-range-popover {
        width: min(560px, calc(100vw - 24px));
    }
}

@media (max-width: 480px) {
    .s11-datetime-range-shell .s11-time-columns {
        gap: 5px;
    }

    .s11-datetime-range-shell .s11-time-value {
        font-size: .78rem;
    }
}

/* ─────────────────────────────────────────────────────────────────────
   S11 V3 — compact request tables, Employees-style desktop geometry
   Leave/Permission have fewer columns than Employees, so they should
   fill the available card cleanly without an artificial minimum width.
   ───────────────────────────────────────────────────────────────────── */
@media (min-width: 768px) {
    .s11-request-table {
        width: 100%;
        min-width: 0 !important;
        max-width: 100%;
        table-layout: fixed;
        font-size: .84rem;
    }

    .s11-request-table th,
    .s11-request-table td {
        white-space: normal !important;
        overflow-wrap: anywhere;
        word-break: normal;
        padding: 10px 12px;
    }

    .s11-request-table thead th {
        white-space: nowrap !important;
    }

    .s11-request-table .s11-col-employee { width: 17%; }
    .s11-request-table .s11-col-leave_type { width: 18%; }
    .s11-request-table .s11-col-permission_type { width: 20%; }
    .s11-request-table .s11-col-start_date,
    .s11-request-table .s11-col-end_date { width: 12%; }
    .s11-request-table .s11-col-request_date { width: 14%; }
    .s11-request-table .s11-col-total_days { width: 9%; }
    .s11-request-table .s11-col-duration { width: 16%; }
    .s11-request-table .s11-col-status { width: 14%; }
    .s11-request-table .s11-col-actions { width: 112px; }

    .s11-request-table td.actions,
    .s11-request-table th.s11-col-actions {
        width: 112px !important;
        min-width: 112px !important;
        max-width: 112px !important;
        text-align: center !important;
        white-space: nowrap !important;
    }

    .s11-request-table td.actions {
        overflow: visible !important;
    }

    .s11-request-table .s11-action-group {
        justify-content: center !important;
        gap: 6px !important;
        min-width: 0 !important;
        width: 100%;
    }

    .s11-request-table .s11-action-group .btn {
        width: 32px !important;
        min-width: 32px !important;
        max-width: 32px !important;
        height: 32px !important;
        min-height: 32px !important;
        border-radius: 8px !important;
    }

    .s11-request-table .s11-status-cell {
        padding-right: 10px;
    }

    .s11-request-table .s11-status-line {
        gap: 5px;
    }

    .s11-request-table .s11-status-line .badge {
        font-size: .70rem !important;
        line-height: 1.2;
        padding: 4px 7px !important;
    }

    .s11-request-table .s11-list-status-time {
        font-size: .68rem;
        opacity: .68;
    }

    .s11-request-table tbody tr:hover {
        background: var(--surface-alt);
    }
}

/* Free-type time field inside the picker. The wheel controls remain
   available, but users can directly type 03:35 PM / 15:35 / 0335. */
.s11-time-free-input {
    width: 100%;
    height: 40px;
    margin: 8px 0 10px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-size: .84rem;
    font-weight: 600;
    text-align: center;
    font-variant-numeric: tabular-nums;
    outline: none;
    transition: border-color .16s ease, box-shadow .16s ease;
}

.s11-time-free-input::placeholder {
    color: var(--text-muted);
    opacity: .68;
    font-weight: 500;
}

.s11-time-free-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 12%, transparent);
}

.s11-datetime-range-shell .s11-time-free-input {
    height: 38px;
    margin: 6px 0 8px;
    font-size: .80rem;
}

@media (max-width: 767.98px) {
    .s11-request-table .s11-list-status-time {
        font-size: .66rem;
    }

    .s11-datetime-range-shell .s11-time-free-input {
        height: 40px;
        font-size: .82rem;
    }
}
