/* ============================================================
   FAAD Equipment — page styles
   Layered on top of tokens.css + fonts.css + header.css from the
   Sheridan Branding Kit. All colors/fonts come from tokens; this
   file owns page layout, form styling, table styling, and the
   HUD-scale rules for the rental check-out / check-in displays.
   ============================================================ */

/* ---- Header actions as buttons -------------------------------------
   Project-specific override of the branding kit's text-link style in
   header.css. We keep the kit file pristine and apply the button look
   here. Subtle frosted chips on the gradient bar — visible without
   competing with the wordmark, and they don't pull cyan in unless
   actively hovered (preserving "one accent at a time"). */
.header-user .header-actions {
    gap: 6px;
}
.header-user .header-action {
    background: rgba(255, 255, 255, .12);
    border: 1px solid rgba(255, 255, 255, .25);
    color: var(--white);
    padding: 5px 12px;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    transition: background .12s, border-color .12s, color .12s;
}
.header-user .header-action:hover {
    background: var(--cyan);
    border-color: var(--cyan);
    color: var(--white);
    text-decoration: none;
}
.header-user .header-action:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0,178,206,.35);
}

/* ---- Page chrome ---------------------------------------------------- */

main, content {
    display: block;
    padding: 24px 32px;
    max-width: 1600px;
    margin: 0 auto;
}

.group-heading {
    margin: 8px 0 20px;
    color: var(--blue);
    font-family: var(--font-head);
    font-weight: 400;
    font-size: 24px;
    letter-spacing: .2px;
}

/* ---- Buttons -------------------------------------------------------- */

.btn,
button.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5em;
    padding: 10px 20px;
    font-family: var(--font-body);
    font-size: 15px;
    font-weight: 500;
    border-radius: var(--radius);
    border: 1px solid transparent;
    background: var(--white);
    color: var(--blue);
    cursor: pointer;
    text-decoration: none;
    transition: background .12s, color .12s, border-color .12s, box-shadow .12s;
}
.btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0,178,206,.25);
}

.btn--primary {
    background: var(--cyan);
    color: var(--white);
    border-color: var(--cyan);
}
.btn--primary:hover { background: var(--cyan-tint); border-color: var(--cyan-tint); }

.btn--secondary {
    background: var(--white);
    color: var(--blue);
    border-color: var(--grey-3);
}
.btn--secondary:hover { background: var(--grey-1); border-color: var(--grey-4); }

.btn--block { width: 100%; }

/* Legacy admin "report buttons" use this generic <button> tag styling. */
.report-button {
    min-width: 100%;
    padding: 14px 24px;
    font-family: var(--font-body);
    font-size: 16px;
    font-weight: 500;
    background: var(--white);
    color: var(--blue);
    border: 1px solid var(--grey-3);
    border-radius: var(--radius);
    cursor: pointer;
    text-align: left;
}
.report-button:hover {
    background: var(--grey-1);
    border-color: var(--grey-4);
}
.report-button[disabled] {
    color: var(--grey-4);
    cursor: not-allowed;
}

.button-container {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 720px;
    margin: 0 auto;
}

/* ---- Admin Apps Launcher ------------------------------------------
   Used by /admin.php. Two layouts share the same .app-card markup —
   .launcher[data-view="grid"] paints them as tiles in a responsive
   grid; data-view="list" reflows them into stacked rows. Toggle state
   lives in localStorage (see admin.php script). */

.launcher-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin: 8px 0 18px;
}
.launcher-head .group-heading {
    margin: 0;
}

.launcher-controls {
    display: inline-flex;
    gap: 8px;
    align-items: center;
}

.view-toggle,
.sort-toggle {
    display: inline-flex;
    background: var(--white);
    border: 1px solid var(--grey-2);
    border-radius: var(--radius);
    padding: 3px;
    box-shadow: var(--shadow-1);
}

.sort-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 10px 6px 12px;
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 500;
    color: var(--grey-5);
    background: transparent;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background .12s, color .12s;
}
.sort-toggle-btn:hover { color: var(--blue); }
.sort-toggle-btn.is-active {
    background: var(--blue);
    color: var(--white);
}
.sort-toggle-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0,178,206,.25);
}
/* Arrow is hidden on non-active buttons. Triangle defaults to pointing up
   (asc, smallest-at-top convention); rotated 180° for desc. */
.sort-toggle-btn .sort-arrow {
    opacity: 0;
    transition: transform .15s ease, opacity .15s ease;
}
.sort-toggle-btn.is-active .sort-arrow {
    opacity: 1;
}
.sort-toggle-btn[data-dir="desc"] .sort-arrow {
    transform: rotate(180deg);
}
.view-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 500;
    color: var(--grey-5);
    background: transparent;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background .12s, color .12s;
}
.view-toggle-btn:hover { color: var(--blue); }
.view-toggle-btn.is-active {
    background: var(--blue);
    color: var(--white);
}
.view-toggle-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0,178,206,.25);
}
/* Vertical divider inside a segmented control (server-standard separator, as
   used between grouped controls in other apps) — splits Grid/List from the
   Thumbnails toggle. */
.view-toggle-divider {
    width: 1px;
    align-self: stretch;
    background: var(--grey-2);
    margin: 2px 6px;
}

/* ---- Grid layout ---- */
.launcher[data-view="grid"] .app-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 18px;
}

/* "Coming soon" group divider — visible separator between the active-apps
   group and the Coming Soon group. Positioned by JS after each sort. */
.app-group-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--grey-4);
    font-family: var(--font-body);
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: .12em;
}
.app-group-divider::before,
.app-group-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--grey-2);
}
/* In grid view, span the full row so it cleanly breaks the auto-fill flow. */
.launcher[data-view="grid"] .app-group-divider {
    grid-column: 1 / -1;
    margin: 4px 0;
}
/* In list view, sits flush with the rows above/below. */
.launcher[data-view="list"] .app-group-divider {
    margin: 6px 4px;
}

.app-card {
    display: flex;
    flex-direction: column;
    background: var(--white);
    border: 1px solid var(--grey-2);
    border-radius: 8px;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    box-shadow: var(--shadow-1);
    transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.app-card:hover:not(.is-disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-2);
    border-color: var(--cyan);
}
.app-card:focus-visible {
    outline: none;
    border-color: var(--cyan);
    box-shadow: 0 0 0 3px rgba(0,178,206,.25);
}
.app-card.is-disabled {
    opacity: .6;
    cursor: not-allowed;
    pointer-events: none;
}
/* Deprecated cards (admin-only section): no thumbnail, no Launch CTA, not
   launchable. Kept more legible than the dimmed "Coming soon" cards and tinted
   with the page-background grey so the section reads as an archive shelf. */
.app-card.is-deprecated {
    opacity: 1;
    background: var(--grey-1);
    border-style: dashed;
    /* No thumbnail here, so nothing needs corner-clipping — allow the banner's
       negative margins to paint over the card's own border instead of being
       clipped away by overflow:hidden. */
    overflow: visible;
}

.app-card-thumb {
    position: relative;
    aspect-ratio: 16 / 10;
    background: var(--grey-1);
    overflow: hidden;
    border-bottom: 1px solid var(--grey-2);
}
/* "Hide thumbnails" mode (thumbs toggle in the launcher controls): cards
   collapse to their lower half — name, description, meta. Applies in both
   grid and list view. The pinned dog-ear survives (it sits on the card). */
/* Grid animates a height collapse (the JS sets an explicit start height so the
   auto↔0 change can transition; this end-state holds it collapsed afterward).
   List hides instantly — its thumb is a fixed side column, not a height. */
.launcher[data-view="grid"][data-thumbs="hide"] .app-card-thumb {
    height: 0;
    opacity: 0;
    border-bottom-width: 0;
}
.launcher[data-view="list"][data-thumbs="hide"] .app-card-thumb {
    flex-basis: 0;
    opacity: 0;
    margin-right: -16px;   /* cancel the card's 16px gap */
    border-width: 0;
}
.app-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top left;
    display: block;
}
.app-card-thumb-fallback {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    font-family: var(--font-head);
    font-size: 56px;
    color: var(--grey-3);
    background:
        repeating-linear-gradient(
            -45deg,
            var(--grey-1) 0 12px,
            var(--white) 12px 24px
        );
}
/* Admin-chosen initials tile — wins over the screenshot when set. */
.app-card-thumb-initials {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 0 10px;
    font-family: var(--font-head);
    font-weight: 600;
    font-size: 52px;
    line-height: 1;
    letter-spacing: 2px;
    text-transform: uppercase;
    white-space: nowrap;
}
/* Initials background schemes — shared by the card tile and the modal swatches. */
.tib-grey      { color: #003767db;            background: var(--grey-2, #e7e9eb); }
.tib-striped   { color: var(--grey-3);
                 background: repeating-linear-gradient(-45deg, var(--grey-1) 0 12px, var(--white) 12px 24px); }
.tib-blue      { color: #fff;                 background: var(--blue, #003767); }
.tib-cyan      { color: #fff;                 background: var(--cyan, #00B2CE); }
.tib-rhodamine { color: #fff;                 background: var(--rhodamine, #D92880); }
/* Default grey scheme gets a faint blue frame on the card tile (inset shadow =
   crisp 1px edge, no clipping or layout shift). Top corners are rounded to the
   card's inner radius (8px border − 1px border = 7px) so the frame follows the
   card's rounded top instead of poking square corners into it. */
.app-card-thumb-initials.tib-grey {
    box-shadow: inset 0 0 0 1px rgba(0, 55, 103, 0.3);
    border-top-left-radius: 7px;
    border-top-right-radius: 7px;
}

/* "Use app initials" background picker (swatches). */
.ti-bg-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--grey-5, #737682); margin: 12px 0 6px; }
.ti-bg-picker { display: flex; gap: 8px; flex-wrap: wrap; }
.ti-swatch { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 0; border: 0; background: none; cursor: pointer; }
.ti-swatch-prev {
    width: 54px; height: 34px; border-radius: 5px;
    display: grid; place-items: center; overflow: hidden;
    font-family: var(--font-head); font-weight: 600; font-size: 15px;
    letter-spacing: 1px; text-transform: uppercase;
    border: 2px solid transparent; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}
.ti-swatch-name { font-size: 10px; color: var(--grey-5, #737682); }
.ti-swatch[aria-checked="true"] .ti-swatch-prev { border-color: var(--blue, #003767); }
.ti-swatch[aria-checked="true"] .ti-swatch-name { color: var(--ink, #1e2125); font-weight: 600; }
.app-card-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--blue);
    color: var(--white);
    font-family: var(--font-body);
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: .08em;
    /* Asymmetric padding (more top, less bottom) and line-height: 1 to
       optically center uppercase text — without this, the cap-only glyphs
       sit too high in the pill. */
    line-height: 1;
    padding: 6px 8px 4px;
    border-radius: 999px;
}

/* ---- Pinned-card dog-ear -------------------------------------------------
   The card's top-right corner looks folded over diagonally, built from paint
   only — deliberately NO clip-path / mask / filter (all engine-fragile here;
   WebKit drops clip-path corner cuts, and a filter on the pseudo escapes
   ancestor clipping in Chromium). Two layers:
     ::before — the notch: page background painted over the corner, overhanging
       the card's 1px border so the corner (incl. its rounding) reads as
       removed. The card's box-shadow is downward-biased (tokens), so there is
       no visible shadow residue around a top-right notch.
     ::after — the folded-over flap below the crease: crease line + face
       shading baked into one gradient, rounded tip, 📌 on the flap.
   Both grow from the corner when pinned (width/height transition) so pinning
   folds the corner over and unpinning unfolds it; the JS delays the re-sort
   until the fold finishes. Zero-sized when unpinned — inert on other cards. */
.app-card { position: relative; }
.app-card::before {
    content: '';
    position: absolute;
    top: -2px;
    right: -2px;
    width: 0;
    height: 0;
    z-index: 3;
    pointer-events: none;
    background: linear-gradient(225deg, var(--grey-1, #f6f7f8) 0 49.7%, transparent 50%);
    transition: width .22s ease, height .22s ease;
}
.app-card::after {
    content: '\1F4CC';
    position: absolute;
    /* -1px so the flap's outer edges sit flush on the card-edge line instead
       of a hairline inside it — blends the fold into the card silhouette. */
    top: -1px;
    right: -1px;
    width: 0;
    height: 0;
    z-index: 4;
    pointer-events: none;
    background: linear-gradient(225deg,
        transparent 0 49.6%,
        rgba(0, 55, 103, 0.45) 49.8% 51%,
        #d9e4ee 52.5%,
        #f8fbfe 100%);
    border-bottom-left-radius: 9px;
    display: flex;
    align-items: flex-end;
    justify-content: flex-start;
    padding: 0 0 3px 4px;
    font-size: 0;
    line-height: 1;
    overflow: hidden;
    transition: width .22s ease, height .22s ease, font-size .18s ease .06s;
}
.app-card[data-pinned="1"] {
    /* overflow:hidden clips pseudos to the padding box, so the notch could
       never cover the 1px border ring or the rounded-corner arc — they kept
       "showing through" the fold. Release the clip on pinned cards; the
       grid thumbnail re-rounds its own top corners below, and the notch
       (page-background paint) overhangs the border by 2px on every engine. */
    overflow: visible;
    /* box-shadow is cast from the card's full rectangle, so the standard
       centered shadows haloed above/right of the "removed" corner (worst on
       hover). Bias the pinned card's shadows down-left — nothing paints
       above the top edge or right of the right edge, so the fold corner
       stays clean; same visual weight as the shared tokens. */
    box-shadow: -1px 1px 2px rgba(0, 0, 0, 0.05), -1px 2px 3px rgba(0, 0, 0, 0.1);
}
.app-card[data-pinned="1"]:hover:not(.is-disabled) {
    box-shadow: -4px 5px 6px rgba(0, 0, 0, 0.05), -8px 12px 15px rgba(0, 0, 0, 0.1);
}
.launcher[data-view="grid"] .app-card[data-pinned="1"] .app-card-thumb {
    /* the card's overflow used to round these; the thumb clips itself */
    border-top-left-radius: 7px;
    border-top-right-radius: 7px;
}
.app-card[data-pinned="1"]::before {
    width: 38px;
    height: 38px;
}
.app-card[data-pinned="1"]::after {
    width: 32px;
    height: 32px;
    font-size: 13px;
}
@media (prefers-reduced-motion: reduce) {
    .app-card::before, .app-card::after { transition: none; }
    .launcher[data-view="list"] .app-card-thumb { transition: none; }
}
/* Keep badges clear of the dog-ear on pinned cards (badges sit top-right of
   the thumbnail, which the fold overlaps). */
.app-card[data-pinned="1"] .app-card-badge { right: 36px; }

/* ---- "New" ribbon pennant (per-user, temporary) --------------------------
   A bright-lime ribbon hanging from the card's TOP-LEFT with a fishtail (notch)
   bottom — the opposite corner from the pinned dog-ear + status badges
   (top-right), so they never collide. Shown while the app is newly granted to
   this user (data-new="1"); the JS beacon flips it off at the 10th launch, and
   the server drops it after 5 business days. pointer-events:none so the whole
   card stays clickable. */
.app-card-new {
    display: none;
    position: absolute;
    top: 0;
    left: 12px;
    width: 28px;
    z-index: 2;
    pointer-events: none;
    filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .26));
}
.app-card[data-new="1"] .app-card-new { display: block; }
.app-card-new > span {
    display: block;
    background: var(--lime, #C6D931);
    color: var(--ink, #1e2125);
    font-family: var(--font-body);
    font-size: 9.5px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: .06em;
    text-transform: uppercase;
    text-align: center;
    padding: 6px 0 11px;
    /* fishtail notch cut into the bottom edge */
    clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 76%, 0 100%);
}
/* No thumbnail at the top (thumbnails hidden) → reserve room so the hanging
   pennant clears the app name. Grid pushes the body down; list (horizontal
   row) indents the body instead. */
.launcher[data-view="grid"][data-thumbs="hide"] .app-card[data-new="1"] .app-card-body { padding-top: 36px; }
.launcher[data-view="list"][data-thumbs="hide"] .app-card[data-new="1"] .app-card-body { padding-left: 36px; }
/* List view (thumbnails shown): a smaller pennant over the mini side-thumb. */
.launcher[data-view="list"] .app-card-new { left: 9px; width: 24px; }
.launcher[data-view="list"] .app-card-new > span { font-size: 8.5px; padding: 5px 0 9px; }

/* ---- First-time Welcome modal -------------------------------------------- */
.welcome-modal { max-width: 520px; }
.welcome-body { margin: 6px 0 4px; }
.welcome-body p {
    margin: 0 0 12px;
    font-size: 14px;
    line-height: 1.5;
    color: var(--ink);
}
.welcome-body p:last-child { margin-bottom: 0; }
.welcome-body strong { color: var(--blue); }
.welcome-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: 18px;
}
.welcome-dismiss {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 12.5px;
    color: var(--grey-5);
    cursor: pointer;
    user-select: none;
}
.welcome-dismiss input { cursor: pointer; }

.app-card-body {
    padding: 14px 16px 8px;
    flex: 1;
}
.app-card-name {
    font-family: var(--font-head);
    font-size: 17px;
    color: var(--blue);
    margin-bottom: 4px;
    line-height: 1.25;
    /* Clamp to one line; long names get an ellipsis (full name available via
       the tile's title attr / hover-revealed via the host browser). */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.app-card-desc {
    font-size: 13px;
    color: var(--grey-5);
    line-height: 1.45;
    /* Clamp to two lines so every grid tile is the same height. */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.app-card-meta {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-top: 12px;
    font-size: 11px;
    color: var(--grey-4);
    font-variant-numeric: tabular-nums;
}
.app-card-meta-version {
    background: var(--grey-1);
    border: 1px solid var(--grey-2);
    color: var(--grey-5);
    padding: 1px 6px;
    border-radius: 4px;
    font-weight: 500;
}
.app-card-meta-updated::before {
    content: "";
    display: inline-block;
    width: 3px;
    height: 3px;
    background: var(--grey-3);
    border-radius: 50%;
    margin-right: 6px;
    vertical-align: middle;
}
/* "Deprecated <date>" banner — spans the top of the card as a header, with
   rounded top corners matching the card radius. Amber to flag the retired
   state without pulling in the cyan/rhodamine UI accents (same hue the old
   inline pill used). */
.app-card-deprecated-banner {
    background: rgba(185, 116, 8, .12);
    border: 1px solid #b9740840;
    border-bottom: 1px solid rgba(185, 116, 8, .35);
    color: var(--amber);
    padding: 5px 16px 1px;
    font-size: 11px;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: .06em;
    text-align: center;
    font-variant-numeric: tabular-nums;
    /* Pull out by 1px on top/left/right so the banner sits over the card's own
       1px border and covers it; the card's overflow:hidden + radius re-clip the
       corners. Radius matches the card's outer 8px so the curve lines up. */
    margin: -1px -1px 0;
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
}

.app-card-cta {
    padding: 10px 16px 14px;
    font-size: 13px;
    font-weight: 500;
    color: var(--cyan-tint);
    display: flex;
    align-items: center;
    gap: 4px;
}
.app-card-cta-arrow {
    transition: transform .15s ease;
}
.app-card:hover:not(.is-disabled) .app-card-cta-arrow {
    transform: translateX(3px);
}

/* ---- List layout (override the grid rules above) ----
   We re-flow each .app-card into a horizontal row. Thumb becomes a
   small left-side preview; description sits inline next to the name. */
.launcher[data-view="list"] .app-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.launcher[data-view="list"] .app-card {
    flex-direction: row;
    align-items: center;
    padding: 10px 16px 10px 10px;
    gap: 16px;
}
.launcher[data-view="list"] .app-card-thumb {
    flex: 0 0 120px;
    aspect-ratio: 16 / 10;
    border-radius: 4px;
    border: 1px solid var(--grey-2);
    border-bottom: 1px solid var(--grey-2);
    overflow: hidden;
    /* List thumbs have an explicit flex-basis (unlike grid's auto height), so
       the show/hide collapse animates in pure CSS — no JS. margin-right eats
       the card's 16px gap as the thumb reaches zero so no indent is left. */
    transition: flex-basis .24s ease, opacity .2s ease,
                margin-right .24s ease, border-width .24s ease;
}
.launcher[data-view="list"] .app-card-thumb-fallback {
    font-size: 28px;
}
.launcher[data-view="list"] .app-card-thumb-initials {
    font-size: 26px;
    letter-spacing: 1px;
}
/* Custom hover tooltip on launcher cards: bold app name + full description. */
.app-tooltip {
    position: fixed;
    z-index: 1200;
    max-width: 320px;
    padding: 8px 11px;
    border-radius: 6px;
    background: var(--blue, #003767);
    color: #fff;
    font-size: 12.5px;
    line-height: 1.45;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.22);
    pointer-events: none;
}
.app-tooltip[hidden] { display: none; }
.app-tooltip b { font-weight: 600; }

/* Light "callout" variant — used for the badge hover hint (anchored to the
   element with a pointing arrow), distinct from the dark cursor-following card
   tooltip. --tip-arrow-x is set by JS to point the arrow at the element. */
.app-tooltip--callout {
    background: #fff;
    color: var(--ink, #1e2125);
    border: 1px solid var(--grey-3, #ccd0d4);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
    font-weight: 500;
    text-align: center;
}
.app-tooltip--callout::before,
.app-tooltip--callout::after {
    content: '';
    position: absolute;
    left: var(--tip-arrow-x, 50%);
    transform: translateX(-50%);
    width: 0; height: 0;
    border: 8px solid transparent;
}
/* Tooltip above the element → arrow on its bottom edge, pointing down. */
.app-tooltip--callout:not(.app-tooltip--below)::before { top: 100%;             border-top-color: var(--grey-3, #ccd0d4); }
.app-tooltip--callout:not(.app-tooltip--below)::after  { top: calc(100% - 1px); border-top-color: #fff; }
/* Tooltip below the element (flipped near the top edge) → arrow points up. */
.app-tooltip--callout.app-tooltip--below::before { bottom: 100%;             border-bottom-color: var(--grey-3, #ccd0d4); }
.app-tooltip--callout.app-tooltip--below::after  { bottom: calc(100% - 1px); border-bottom-color: #fff; }

/* Quick per-app access modal: user list with grant checkboxes. */
.modal--wide { width: min(480px, 92vw); }
.access-q-list {
    max-height: 52vh;
    overflow-y: auto;
    border: 1px solid var(--grey-2, #e2e5e9);
    border-radius: 6px;
}
.access-q-empty { padding: 18px 14px; text-align: center; color: var(--grey-5, #737682); font-size: 13px; }
.access-q-row {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--grey-1, #f0f2f4);
    cursor: pointer;
    font-size: 14px;
}
.access-q-row:last-child { border-bottom: none; }
.access-q-row:hover { background: var(--grey-1, #f6f7f8); }
.access-q-row.is-saving { opacity: 0.55; }
.access-q-row input { flex: 0 0 auto; width: 16px; height: 16px; cursor: pointer; }
.access-q-text { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.access-q-name { font-weight: 500; color: var(--ink, #1e2125); }
.access-q-email { color: var(--grey-5, #737682); font-size: 12px; }
.access-q-badge {
    margin-left: auto;
    flex: 0 0 auto;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--grey-5, #737682);
    background: var(--grey-1, #eceff2);
    border-radius: 999px;
    padding: 2px 8px;
}
.access-q-fulllink { margin-right: auto; font-size: 13px; color: var(--blue, #003767); text-decoration: none; }
.access-q-fulllink:hover { text-decoration: underline; }
.launcher[data-view="list"] .app-card-badge {
    top: 4px;
    right: 4px;
    font-size: 9px;
    padding: 2px 6px;
}
.launcher[data-view="list"] .app-card::after {
    border-bottom-left-radius: 6px;
    padding: 0 0 2px 2px;
}
.launcher[data-view="list"] .app-card[data-pinned="1"]::before {
    width: 29px;
    height: 29px;
}
.launcher[data-view="list"] .app-card[data-pinned="1"]::after {
    width: 23px;
    height: 23px;
    font-size: 10px;
}
.launcher[data-view="list"] .app-card[data-pinned="1"] .app-card-badge { right: 24px; }
.launcher[data-view="list"] .app-card-body {
    padding: 0;
    flex: 1;
    min-width: 0;
}
.launcher[data-view="list"] .app-card-name {
    font-size: 15px;
    margin-bottom: 2px;
}
.launcher[data-view="list"] .app-card-desc {
    font-size: 13px;
    /* Revert the grid view's 2-line -webkit-box clamp; list rows are one
       line with classic text-overflow ellipsis. */
    display: block;
    -webkit-line-clamp: initial;
    line-clamp: initial;
    -webkit-box-orient: initial;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.launcher[data-view="list"] .app-card-cta {
    padding: 0;
    flex: 0 0 auto;
    white-space: nowrap;
}

/* In list view, demote the meta row to a single inline tail on the desc line
   so rows stay compact. */
.launcher[data-view="list"] .app-card-meta {
    margin-top: 4px;
}

/* Mobile: list rows lose the inline ellipsis and wrap the description. */
@media (max-width: 560px) {
    .launcher[data-view="list"] .app-card-desc {
        white-space: normal;
    }
    .launcher[data-view="list"] .app-card-cta span:not(.app-card-cta-arrow) {
        display: none;
    }
}

/* ---- Refresh thumbnails (discreet footer link) ---------------------- */
.launcher-foot {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 18px 4px 8px;
    color: var(--grey-4);
    font-size: 12px;
}
.text-link {
    background: none;
    border: none;
    padding: 4px 6px;
    margin: 0;
    color: var(--grey-5);
    font-family: var(--font-body);
    font-size: 12px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    border-radius: 4px;
}
.text-link:hover { color: var(--cyan-tint); }
.text-link:disabled {
    color: var(--grey-3);
    cursor: progress;
}
.text-link:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0,178,206,.20);
}
.refresh-status {
    color: var(--grey-5);
    font-size: 12px;
}
.refresh-status.is-success { color: var(--green); }
.refresh-status.is-error   { color: var(--red); }

/* ---- Forms (login etc.) -------------------------------------------- */

.form-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 14px;
}
.form-field label {
    font-size: 13px;
    color: var(--grey-5);
    font-weight: 500;
}
.form-field input[type="text"],
.form-field input[type="password"],
.form-field input[type="email"] {
    padding: 10px 12px;
    font-family: var(--font-body);
    font-size: 15px;
    color: var(--ink);
    background: var(--white);
    border: 1px solid var(--grey-3);
    border-radius: var(--radius);
}
.form-field input:focus-visible {
    outline: none;
    border-color: var(--cyan);
    box-shadow: 0 0 0 3px rgba(0,178,206,.18);
}

.error-banner {
    background: rgba(179, 38, 30, .06);
    color: var(--red);
    border: 1px solid rgba(179, 38, 30, .25);
    border-radius: var(--radius);
    padding: 10px 14px;
    font-size: 14px;
    margin-bottom: 14px;
}

/* ---- Tables (standard size — admin reports) ------------------------ */

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-family: var(--font-body);
    font-variant-numeric: tabular-nums;
    font-size: 15px;
    background: var(--white);
    border: 1px solid var(--grey-2);
    border-radius: var(--radius);
    overflow: hidden;
}
.data-table th {
    background: var(--blue);
    color: var(--white);
    font-family: var(--font-head);
    font-weight: 400;
    text-align: left;
    padding: 12px 14px;
    border-bottom: 1px solid var(--grey-3);
}
.data-table td {
    padding: 10px 14px;
    border-top: 1px solid var(--grey-2);
    vertical-align: middle;
}
.data-table tbody tr:nth-child(even) td {
    background: var(--grey-1);
}

/* ---- HUD: at-a-distance check-out / check-in displays --------------
   Everything inside .hud is scaled up for 3–5 m viewing.
   ------------------------------------------------------------------- */

.hud {
    min-height: 100vh;
    background: var(--grey-1);
    display: flex;
    flex-direction: column;
}

.hud-content {
    flex: 1;
    /* Override the generic main { max-width: 1600px; margin: 0 auto } rule —
       the HUD table needs to span the full viewport. */
    max-width: none;
    margin: 0;
    padding: 14px 12px;
    overflow: hidden;
}

.hud-heading {
    margin: 4px 8px 12px;
}
.hud-heading h1 {
    color: var(--blue);
    font-family: var(--font-head);
    font-weight: 400;
    font-size: 36px;
    letter-spacing: .2px;
}

/* Big readable table. Rental data on screens at distance.
   Border-radius is dropped here so the table can run very close to
   the screen edges without obvious rounded corners going to waste. */
.hud-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-family: var(--font-body);
    font-variant-numeric: tabular-nums;
    font-size: 30px;
    background: var(--white);
    border: 1px solid var(--grey-2);
    border-radius: 6px;
    overflow: hidden;
}
.hud-table thead th {
    background: var(--blue);
    color: var(--white);
    font-family: var(--font-head);
    font-weight: 400;
    font-size: 26px;
    text-align: left;
    padding: 14px 18px;
    letter-spacing: .3px;
}
.hud-table tbody td {
    padding: 14px 18px;
    border-top: 1px solid var(--grey-2);
    vertical-align: middle;
    line-height: 1.2;
}
.hud-table tbody tr:nth-child(even) td {
    background: var(--grey-1);
}
.hud-table .id {
    font-family: var(--font-head);
    font-weight: 400;
    color: var(--blue);
}
.hud-table .renter,
.hud-table .desc {
    font-weight: 400;
}
.hud-table .proj {
    color: var(--grey-5);
    font-size: 24px;
}
.hud-table .notes {
    color: var(--grey-5);
    font-size: 24px;
    max-width: 28ch;
}

/* Status modifiers — built from the standard status tokens. */
.hud-table .time {
    font-feature-settings: "tnum";
    color: var(--ink);
}
.hud-table .time.overdue {
    color: var(--red);
    font-weight: 500;
}
.hud-table .prep {
    text-align: right;
    color: var(--ink);
}
.hud-table .prep.prepped {
    color: var(--green);
    font-weight: 500;
}

/* When a row goes past-due we paint the whole row red so it reads
   immediately from across the room. */
.hud-table tr.pastdue td {
    background: var(--red) !important;
    color: var(--white) !important;
    border-top-color: rgba(255,255,255,.2);
}
.hud-table tr.pastdue td.proj,
.hud-table tr.pastdue td.notes {
    color: rgba(255,255,255,.85) !important;
}
.hud-table tr.pastdue td.time { color: var(--white) !important; }

/* ---- Footer (existing) --------------------------------------------- */

footer .footer {
    margin-top: 32px;
    padding: 18px 24px;
    background: var(--grey-1);
    color: var(--grey-5);
    text-align: center;
    font-size: 13px;
    border-top: 1px solid var(--grey-2);
}

/* ---- Legacy class compatibility -----------------------------------
   Older inline markup uses #data-table / .overdue / .prepped / .pastdue
   directly. Map them to the HUD classes so nothing breaks while pages
   migrate. */
#data-table { width: 100%; border-collapse: separate; border-spacing: 0; }
.unused-equip-table {
    width: 100%;
    border-collapse: collapse;
    font-family: var(--font-body);
    font-size: 14px;
}
.unused-equip-table th {
    background: var(--blue);
    color: var(--white);
    padding: 10px 12px;
    font-family: var(--font-head);
    font-weight: 400;
    text-align: left;
}
.unused-equip-table td {
    padding: 8px 12px;
    border-top: 1px solid var(--grey-2);
}

.controls {
    padding: 14px 0;
    margin-top: 14px;
    border-top: 1px solid var(--grey-2);
}

/* ---- Launcher: per-app access flash banner ---------------------- */
.launcher-flash {
    margin: 16px 24px 0;
    padding: 10px 14px;
    background: rgba(0, 178, 206, 0.08);
    border-left: 4px solid var(--cyan);
    border-radius: 0 var(--radius) var(--radius) 0;
    color: var(--blue);
    font-size: 14px;
}
.launcher-flash strong { font-weight: 600; }

/* ---- /pending.php — apps-access-in-process landing -------------- */
.pending-state {
    min-height: calc(100vh - 80px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
.pending-card {
    max-width: 520px;
    background: var(--white);
    border: 1px solid var(--grey-2);
    border-radius: var(--radius);
    padding: 32px 36px;
    box-shadow: var(--shadow-1);
}
.pending-card h1 {
    color: var(--blue);
    margin-bottom: 12px;
}
.pending-card p { margin: 0 0 10px; }
.pending-card p.muted { color: var(--grey-5); font-size: 13px; }
.pending-card code {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 13px;
    background: var(--grey-1);
    padding: 1px 5px;
    border-radius: 3px;
}

/* ---- Admin right-click card editor --------------------------------------
   Context menu (with an "Update thumbnail" flyout), the edit-description
   modal, and a transient status toast. All admin-only — the markup and JS
   are gated behind $is_admin in apps.php. */

.card-ctx {
    position: fixed;
    z-index: 200;
    min-width: 188px;
    padding: 5px;
    background: var(--white);
    border: 1px solid var(--grey-2);
    border-radius: var(--radius);
    box-shadow: var(--shadow-2);
    font-size: 13px;
    user-select: none;
}
.card-ctx[hidden] { display: none; }

.card-ctx-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 10px;
    padding: 8px 10px;
    background: none;
    border: 0;
    border-radius: 4px;
    font-family: var(--font-body);
    font-size: 13px;
    color: var(--ink);
    text-align: left;
    cursor: pointer;
}
/* The `display: flex` above otherwise defeats the [hidden] attribute, so items
   toggled hidden in JS (Assign Sling locations, Manage user access) stay visible.
   This rule restores hidden behaviour for menu items. */
.card-ctx-item[hidden] { display: none; }
.card-ctx-item:hover,
.card-ctx-item:focus-visible {
    background: var(--grey-1);
    color: var(--blue);
    outline: none;
}
.card-ctx-caret { color: var(--grey-4); font-size: 15px; line-height: 1; }

/* Flyout submenu: revealed on hover of the parent, on keyboard focus-within,
   or when JS adds .sub-open (click/touch). Flips left near the viewport edge
   via .sub-left on the menu root. */
.card-ctx-flyout { position: relative; }
.card-ctx-flyout[hidden] { display: none; }
.card-ctx-submenu {
    position: absolute;
    top: -5px;
    left: 100%;
    margin-left: 4px;
    min-width: 184px;
    padding: 5px;
    background: var(--white);
    border: 1px solid var(--grey-2);
    border-radius: var(--radius);
    box-shadow: var(--shadow-2);
    display: none;
}
.card-ctx-flyout:hover .card-ctx-submenu,
.card-ctx-flyout:focus-within .card-ctx-submenu,
.card-ctx.sub-open .card-ctx-submenu { display: block; }
.card-ctx.sub-left .card-ctx-submenu { left: auto; right: 100%; margin-left: 0; margin-right: 4px; }

/* Modal shell (edit description) — shared-ish with the branding kit's look:
   blue Produkt title, hairline divider feel via spacing, cyan primary action. */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 210;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(0, 38, 72, .45);
}
.modal-overlay[hidden] { display: none; }
.modal {
    width: 100%;
    max-width: 460px;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-2);
    padding: 22px 24px 20px;
}
.modal-title {
    color: var(--blue);
    font-family: var(--font-head);
    font-weight: 400;
    font-size: 20px;
    margin: 0 0 2px;
}
.modal-sub {
    margin: 0 0 14px;
    color: var(--grey-5);
    font-size: 13px;
    font-weight: 500;
}
.modal-textarea {
    width: 100%;
    resize: vertical;
    min-height: 84px;
    padding: 10px 12px;
    font-family: var(--font-body);
    font-size: 14px;
    color: var(--ink);
    border: 1px solid var(--grey-3);
    border-radius: var(--radius);
}
.modal-textarea:focus-visible {
    outline: none;
    border-color: var(--cyan);
    box-shadow: 0 0 0 3px rgba(0,178,206,.20);
}
.modal-meta {
    margin-top: 6px;
    text-align: right;
    color: var(--grey-4);
    font-size: 12px;
}
.modal-error {
    margin: 8px 0 0;
    color: var(--red);
    font-size: 13px;
}
.modal-error[hidden] { display: none; }
.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 16px;
}

/* Action buttons in modals AND on the maintenance page — styled explicitly with
   literal colours and a higher-specificity selector so they always render as
   solid buttons (defends against any cascade/specificity surprise or a custom-
   property that fails to resolve, which otherwise leaves a bare .btn looking
   like a plain text link). */
.modal-actions .btn,
.maint-actions .btn,
.welcome-foot .btn {
    -webkit-appearance: none;
    appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border: 1px solid transparent;
    border-radius: 6px;
    font: 500 15px/1.2 'ClassicGrotesque', -apple-system, 'Segoe UI', sans-serif;
    text-decoration: none;
    cursor: pointer;
}
.modal-actions .btn--primary,
.maint-actions .btn--primary,
.welcome-foot .btn--primary    { background: #00B2CE; color: #fff;     border-color: #00B2CE; }
.modal-actions .btn--secondary,
.maint-actions .btn--secondary { background: #fff;    color: #003767;  border-color: #ccd0d4; }
.modal-actions .btn--danger,
.maint-actions .btn--danger    { background: #D92880; color: #fff;     border-color: #D92880; }
.modal-actions .btn--primary:hover,
.maint-actions .btn--primary:hover,
.welcome-foot .btn--primary:hover    { background: #008EA5; border-color: #008EA5; }
.modal-actions .btn--secondary:hover,
.maint-actions .btn--secondary:hover { background: #f6f7f8; border-color: #8d949a; }
.modal-actions .btn--danger:hover,
.maint-actions .btn--danger:hover    { background: #b81f68; border-color: #b81f68; }

/* Toast — top-centre transient status, just under the sticky header. */
.card-toast {
    position: fixed;
    left: 50%;
    top: 104px;
    bottom: auto;
    transform: translateX(-50%);
    z-index: 220;
    max-width: 90vw;
    padding: 10px 16px;
    background: var(--blue);
    color: var(--white);
    font-size: 13px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-2);
}
.card-toast[hidden] { display: none; }
.card-toast.is-success { background: var(--green); }
.card-toast.is-error   { background: var(--red); }
.card-toast.is-pending { background: var(--grey-5); }

/* ---- Maintenance mode ---------------------------------------------------
   A maintained app is an active app temporarily taken offline. The card is
   greyed + shows an overlay, but is NOT given pointer-events:none — admins
   still need to right-click it to toggle maintenance back off. Non-clickability
   comes from rendering it as a <div> (no href) in apps.php. */
.app-card.is-maintenance {
    opacity: .72;
    cursor: not-allowed;
}
.app-card.is-maintenance:hover {
    transform: none;
    box-shadow: var(--shadow-1);
    border-color: var(--grey-2);
}
.app-card.is-maintenance .app-card-thumb img,
.app-card.is-maintenance .app-card-thumb-initials,
.app-card.is-maintenance .app-card-thumb-fallback {
    filter: grayscale(1);
}
.app-card-maint-overlay {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    background: rgba(30, 33, 37, .55);
}
.app-card-maint-overlay span {
    font-family: var(--font-head);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: #1a1a00;
    background: #ffd400;   /* same maintenance yellow as the banner + scheduled badge */
    padding: 6px 12px;
    border-radius: 999px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .3);
}

/* Danger button (rhodamine) — the "Turn on maintenance" confirm, per the
   server-wide warning-modal standard. */
.btn--danger {
    background: var(--rhodamine);
    color: var(--white);
    border-color: var(--rhodamine);
}
.btn--danger:hover { background: #b81f68; border-color: #b81f68; }

/* Danger context-menu item (the maintenance toggle when it would enable) and
   the "Publish app" item — both rendered in rhodamine. */
.card-ctx-item--danger,
.card-ctx-item--rhodamine { color: var(--rhodamine); }
.card-ctx-item--danger:hover,
.card-ctx-item--danger:focus-visible,
.card-ctx-item--rhodamine:hover,
.card-ctx-item--rhodamine:focus-visible { background: rgba(217, 40, 128, .08); color: var(--rhodamine); }
/* "Turn off maintenance mode" — cyan (back online). */
.card-ctx-item--cyan { color: var(--cyan); }
.card-ctx-item--cyan:hover,
.card-ctx-item--cyan:focus-visible { background: rgba(0, 178, 206, .08); color: var(--cyan); }

/* Maintenance confirm modal bits. */
.maint-modal-desc { color: var(--grey-5); font-size: 13px; line-height: 1.5; margin: 0 0 12px; }
#maint-modal-note-wrap { margin-bottom: 4px; }

/* maintenance.php page (reuses .pending-state / .pending-card). */
.maint-head {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 20px;
}
.maint-head h1 { margin: 0; }
.maint-icon { color: var(--amber); line-height: 0; flex: none; }
.maint-note {
    background: var(--grey-1);
    border-left: 3px solid var(--amber);
    padding: 10px 12px;
    border-radius: 4px;
    color: var(--grey-5);
    margin: 0 0 12px;
}
/* Action row: real buttons, wrapping on narrow screens. */
.maint-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-top: 18px;
}
.maint-bypass-form { margin: 0; }

/* "Maintenance scheduled" card badge — same bright yellow as the in-app warning
   banner, nudged down a little, carrying a live countdown. The app is still live
   during the 2-minute grace, so the card stays clickable; this signals the
   pending close and ticks down to it. */
.app-card-badge--warn {
    top: 20px;
    right: 4px;
    background: #ffd400;
    color: #1a1a00;
}
.app-card-badge--warn .maint-badge-count { font-variant-numeric: tabular-nums; }

/* ---- "Footer lite" — opt-in plain footer -------------------------------
   A pared-back footer (no background, just a light full-width hairline above),
   modelled on the Sling → Timesheet footer but in ClassicGrotesque (the body
   font) rather than mono. Reusable: apply `.footer-lite` to an app's footer
   ONLY where requested (currently: the launcher). */
.footer-lite {
    text-align: center;
    padding: 16px 32px;
    border-top: 1px solid var(--grey-2);
    font-family: var(--font-body);
    font-size: 12px;
    letter-spacing: .04em;
    color: var(--grey-4);
}
.footer-lite a,
.footer-lite-link {
    color: var(--grey-4);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
    text-decoration-color: color-mix(in srgb, currentColor 30%, transparent);
    font-variant-numeric: tabular-nums;
    cursor: pointer;
    transition: color .15s, text-decoration-color .15s;
}
.footer-lite a:hover,
.footer-lite-link:hover { color: var(--cyan-tint); text-decoration-color: currentColor; }
