/* LightPane Desktop — placeholder CDE-style chrome.
   Visual polish is a later Claude Design pass; keep classes
   layout-centric so the pass can re-skin without touching JS. */

:root {
    --lpd-grid: 20px;
    --lpd-dock-h: 48px;
    --lpd-titlebar-h: 28px;

    /* Desktop backdrop — neutral dark grey (windows + dock sit on it). */
    --lpd-bg:        #2f3238;
    --lpd-bg-hatch:  #363a41;

    /* Dock / menus chrome — Tailwind blue (lightened). */
    --lpd-chrome:    #2563eb;   /* blue-600 — dock bar + buttons + menus */
    --lpd-chrome-hi: #60a5fa;   /* blue-400 — bright button/menu edges + highlights */
    --lpd-chrome-lo: #1e3a8a;   /* blue-900 — insets / bevel shadows / fields */
    --lpd-ink:       #f4f8ff;
    --lpd-ink-dim:   #c7d7f0;   /* brighter — search placeholder + clock legible */
    --lpd-accent:    #7dd3fc;   /* sky-300 accent */

    /* Window chrome — neutral GREY when inactive, blue when active. */
    --lpd-win:          #4b5563;   /* gray-600 */
    --lpd-win-hi:       #6b7280;   /* gray-500 */
    --lpd-win-lo:       #374151;   /* gray-700 */
    --lpd-win-active:      #2563eb; /* blue-600 */
    --lpd-win-active-hi:   #3b82f6; /* blue-500 */
    --lpd-win-active-lo:   #1d4ed8; /* blue-700 */
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    overflow: hidden;
    background: var(--lpd-bg);
    color: var(--lpd-ink);
    font: 13px/1.3 system-ui, -apple-system, "Segoe UI", sans-serif;
    user-select: none;
}

#lpd-root {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
}

/* Desktop area (viewport minus dock) ----------------------------- */

.lpd-area {
    flex: 1 1 auto;
    position: relative;
    overflow: hidden;
    /* Contain window z-indexes: a raised window (click-to-front) sets a positive
       z-index; without a stacking context here those compete at the root level
       and could paint OVER the dock + its launcher/search menus (intermittently,
       once any window was raised). Isolating keeps window stacking inside the
       area, so the dock — a later sibling — always paints above. */
    isolation: isolate;
    background:
        repeating-linear-gradient(
            45deg,
            var(--lpd-bg)       0px,
            var(--lpd-bg)       2px,
            var(--lpd-bg-hatch) 2px,
            var(--lpd-bg-hatch) 3px
        );
}

.lpd-desktop {
    position: absolute;
    inset: 0;
}

/* LightPane wordmark — top-left watermark on the desktop backdrop. Sits behind
   the (transparent) desktop sections + windows; a raised window (z-index ≥ 10)
   covers it as it moves over. Non-interactive. */
.lpd-brand {
    position: absolute;
    top: 24px;
    left: 36px;
    height: 102px;
    width: auto;
    z-index: 0;
    pointer-events: none;
    user-select: none;
    opacity: 0.95;
}

.lpd-desktop[hidden] { display: none; }

/* Dock ----------------------------------------------------------- */

.lpd-dock {
    flex: 0 0 var(--lpd-dock-h);
    height: var(--lpd-dock-h);
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: stretch;
    padding: 0 10px;
    background: var(--lpd-chrome);
    border-top: 2px solid var(--lpd-chrome-hi);
    box-shadow: inset 0 -2px 0 var(--lpd-chrome-lo);
    gap: 12px;
}

.lpd-dock__slot {
    display: flex;
    align-items: center;
    gap: 8px;
}

.lpd-dock__slot--left   { justify-content: flex-start; }
.lpd-dock__slot--centre { justify-content: center; }
.lpd-dock__slot--right  { justify-content: flex-end; }

.lpd-dock__button {
    font: inherit;
    color: var(--lpd-ink);
    background: linear-gradient(to bottom, var(--lpd-chrome-hi), var(--lpd-chrome));
    border: 1px solid var(--lpd-chrome-lo);
    border-top-color: var(--lpd-chrome-hi);
    border-left-color: var(--lpd-chrome-hi);
    border-radius: 4px;
    /* Edge emphasis — a top inner highlight + a soft drop so buttons read as
       raised against the lighter bar. */
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22),
                0 1px 2px rgba(15, 30, 61, 0.45);
    padding: 6px 14px;
    cursor: pointer;
    min-height: 32px;
}

.lpd-dock__button:hover:not(:disabled) {
    background: var(--lpd-chrome-hi);
}

.lpd-dock__button:active:not(:disabled) {
    border-top-color: var(--lpd-chrome-lo);
    border-left-color: var(--lpd-chrome-lo);
    border-right-color: var(--lpd-chrome-hi);
    border-bottom-color: var(--lpd-chrome-hi);
}

.lpd-dock__button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

/* ---- Dock resource search (prototype) -------------------------- */
.lpd-search { position: relative; margin-left: 6px; }
.lpd-search__bar { display: flex; align-items: center; gap: 6px; }

/* Account chip — opens the account-selector menu. */
.lpd-search__account {
    display: flex; align-items: center; gap: 5px;
    height: 30px; padding: 0 10px; max-width: 210px;
    background: var(--lpd-chrome-lo);
    border: 1px solid var(--lpd-chrome);
    border-radius: 15px;
    color: var(--lpd-ink); font: inherit; font-size: 12px;
    cursor: pointer; white-space: nowrap;
}
.lpd-search__account:hover { border-color: var(--lpd-chrome-hi); }
.lpd-search--acctopen .lpd-search__account { border-color: var(--lpd-accent); background: #33333a; }
.lpd-search__account-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lpd-search__account-caret { color: var(--lpd-ink-dim); flex: 0 0 auto; font-size: 10px; }

/* Account menu — rises from the account chip. */
.lpd-search__accountmenu {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 0;
    min-width: 250px; max-width: 340px;
    max-height: 60vh; overflow-y: auto;
    background: #fbfbf8; color: #2a2a30;
    border: 1px solid var(--lpd-chrome-lo);
    border-radius: 8px;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
    padding: 4px 0;
    z-index: 61;
}
.lpd-search__acct-group {
    padding: 7px 12px 3px;
    font-size: 10px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.06em;
    color: #92400e;
}
.lpd-search__acct {
    display: flex; align-items: center; gap: 8px; width: 100%;
    text-align: left; background: transparent; border: 0;
    padding: 7px 12px; cursor: pointer; font: inherit; color: inherit;
}
.lpd-search__acct:hover:not(:disabled),
.lpd-search__acct:focus-visible { background: #fef3c7; outline: none; }
.lpd-search__acct[aria-checked="true"] { background: #fdf3d6; }
.lpd-search__acct:disabled { opacity: 0.55; cursor: default; }
.lpd-search__acct-badge {
    flex: 0 0 auto; width: 30px; text-align: center;
    font-size: 9px; font-weight: 700; letter-spacing: 0.02em;
    color: #fff; border-radius: 3px; padding: 2px 0;
}
.lpd-search__acct-badge--aws   { background: #ff9900; color: #232f3e; }
.lpd-search__acct-badge--gcp   { background: #4285f4; }
.lpd-search__acct-badge--azure { background: #0078d4; }
.lpd-search__acct-name { flex: 1 1 auto; overflow-wrap: anywhere; font-size: 12.5px; }
.lpd-search__acct-name b { font-weight: 600; }
.lpd-search__acct-region { font-size: 10px; color: #6a6a72; white-space: nowrap; }
.lpd-search__acct-soon {
    font-size: 9px; text-transform: uppercase; letter-spacing: 0.04em;
    color: #92400e; background: #fdf3d6; border-radius: 3px; padding: 1px 5px;
    white-space: nowrap;
}

.lpd-search__field {
    display: flex;
    align-items: center;
    gap: 6px;
    height: 30px;
    padding: 0 10px;
    min-width: 220px;
    background: var(--lpd-chrome-lo);
    border: 1px solid var(--lpd-chrome);
    border-radius: 15px;
    transition: border-color 120ms ease, background 120ms ease;
}
.lpd-search--open .lpd-search__field,
.lpd-search__field:focus-within {
    border-color: var(--lpd-accent);
    background: #33333a;
}
.lpd-search__icon { width: 14px; height: 14px; flex: 0 0 auto; color: #fff; }
.lpd-search__input {
    flex: 1 1 auto;
    min-width: 0;
    background: transparent;
    border: 0;
    outline: none;
    color: var(--lpd-ink);
    font: inherit;
    font-size: 13px;
}
/* opacity:1 — browsers dim ::placeholder by default, which read as low-contrast
   against the dark field even with a light colour. */
.lpd-search__input::placeholder { color: #fff; opacity: 1; }
.lpd-search__input::-webkit-search-cancel-button { -webkit-appearance: none; }

/* Results panel — anchored to the box, rises upward out of the dock. */
.lpd-search__popup {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 0;
    width: 380px;
    max-width: 92vw;
    max-height: 62vh;
    overflow-y: auto;
    background: #fbfbf8;
    color: #2a2a30;
    border: 1px solid var(--lpd-chrome-lo);
    border-radius: 8px;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
    padding: 4px 0;
    user-select: text;   /* results are copyable */
    z-index: 60;
}
.lpd-search__meta {
    padding: 8px 12px 6px;
    font-size: 11px; color: #6a6a72;
    text-transform: uppercase; letter-spacing: 0.04em;
}
.lpd-search__group {
    position: sticky; top: 0;
    background: #f0ede4;
    color: #92400e;
    padding: 4px 12px;
    font-size: 10px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.06em;
    border-top: 1px solid #e6e2d6;
}
.lpd-search__row {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas: "name region" "attrs region" "tags tags";
    gap: 0 10px;
    width: 100%;
    text-align: left;
    background: transparent;
    border: 0;
    border-bottom: 1px solid #f0eee6;
    padding: 7px 12px;
    cursor: pointer;
    font: inherit;
    color: inherit;
}
.lpd-search__row:hover,
.lpd-search__row:focus-visible { background: #fef3c7; outline: none; }
.lpd-search__row-name {
    grid-area: name;
    font-size: 12.5px; font-weight: 600;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    overflow-wrap: anywhere;
}
.lpd-search__row-attrs { grid-area: attrs; font-size: 11px; color: #6a6a72; }
.lpd-search__row-region {
    grid-area: region; align-self: center;
    font-size: 10px; color: #92400e;
    background: #fdf3d6; border-radius: 3px;
    padding: 1px 6px; white-space: nowrap;
}
/* Matched tag(s) — key:value chip shown when a tag hit put this row in the
   results, so a tag match is explained rather than mysterious. */
.lpd-search__row-tags {
    grid-area: tags;
    display: flex; flex-wrap: wrap; gap: 4px;
    margin-top: 4px;
}
.lpd-search__tag {
    display: inline-flex; align-items: stretch;
    font-size: 10px; border-radius: 3px; overflow: hidden;
    border: 1px solid #e4dcc4;
}
.lpd-search__tag-k {
    background: #efe9d6; color: #6a5a2a;
    padding: 1px 5px; font-weight: 600;
}
.lpd-search__tag-v { background: #fbf7ea; color: #3a3a30; padding: 1px 5px; }

/* Match highlight — used across the dock search results (name / attrs /
   service header / tag key+value). */
.lpd-search__popup .lp-hl {
    background: #fde047; color: inherit;
    border-radius: 2px; padding: 0 1px;
}
.lpd-search__empty {
    padding: 18px 12px; text-align: center;
    font-size: 12.5px; color: #6a6a72; font-style: italic;
}

@media (max-width: 680px) {
    .lpd-search__field { min-width: 130px; }
    .lpd-search__popup { width: 300px; }
}

.lpd-dock__fullscreen {
    padding: 6px 10px;
    font-size: 16px;
    line-height: 1;
}

.lpd-dock__fullscreen--on {
    color: var(--lpd-accent);
    border-top-color: var(--lpd-chrome-lo);
    border-left-color: var(--lpd-chrome-lo);
    border-right-color: var(--lpd-chrome-hi);
    border-bottom-color: var(--lpd-chrome-hi);
    background: var(--lpd-chrome-hi);
}

.lpd-dock__clock {
    font-variant-numeric: tabular-nums;
    color: var(--lpd-ink-dim);
    padding: 0 4px;
    min-width: 44px;
    text-align: right;
}

/* Desktop pager (1-2-3-4) --------------------------------------- */

.lpd-pager {
    display: flex;
    gap: 4px;
    padding: 4px;
    background: var(--lpd-chrome-lo);
    border: 1px solid var(--lpd-chrome-lo);
    border-top-color: #000;
    border-left-color: #000;
}

.lpd-pager__button {
    font: inherit;
    color: var(--lpd-ink);
    background: var(--lpd-chrome);
    border: 1px solid transparent;
    border-top-color: var(--lpd-chrome-hi);
    border-left-color: var(--lpd-chrome-hi);
    border-right-color: var(--lpd-chrome-lo);
    border-bottom-color: var(--lpd-chrome-lo);
    width: 32px;
    height: 28px;
    cursor: pointer;
    font-variant-numeric: tabular-nums;
}

.lpd-pager__button:hover {
    background: var(--lpd-chrome-hi);
}

.lpd-pager__button--active {
    background: var(--lpd-chrome-lo);
    color: var(--lpd-accent);
    border-top-color: #000;
    border-left-color: #000;
    border-right-color: var(--lpd-chrome-hi);
    border-bottom-color: var(--lpd-chrome-hi);
}

/* Demo dashboards — a second pager group with a "Demo" reset button. Same
   cut-out chrome as the desktop pager. */
.lpd-demo {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px;
    margin-left: 12px;
    background: var(--lpd-chrome-lo);
    border: 1px solid var(--lpd-chrome-lo);
    border-top-color: #000;
    border-left-color: #000;
}
.lpd-demo__reset {
    font: inherit;
    color: var(--lpd-ink);
    background: var(--lpd-chrome);
    border: 1px solid transparent;
    border-top-color: var(--lpd-chrome-hi);
    border-left-color: var(--lpd-chrome-hi);
    border-right-color: var(--lpd-chrome-lo);
    border-bottom-color: var(--lpd-chrome-lo);
    height: 28px;
    padding: 0 12px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}
.lpd-demo__reset:hover { background: var(--lpd-chrome-hi); }
.lpd-demo__reset:active {
    background: var(--lpd-chrome-lo);
    border-top-color: #000;
    border-left-color: #000;
    border-right-color: var(--lpd-chrome-hi);
    border-bottom-color: var(--lpd-chrome-hi);
}

/* Window --------------------------------------------------------- */

.lpd-window {
    position: absolute;
    display: flex;
    flex-direction: column;
    background: var(--lpd-win);
    border: 1px solid var(--lpd-win-lo);
    border-top-color: var(--lpd-win-hi);
    border-left-color: var(--lpd-win-hi);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

/* Active (focused / most-recently-opened) window — title bar + secondary
   (binding) bar go blue; inactive windows stay grey. */
.lpd-window--active {
    border-color: var(--lpd-win-active-lo);
    border-top-color: var(--lpd-win-active-hi);
    border-left-color: var(--lpd-win-active-hi);
    box-shadow: 0 3px 14px rgba(0, 0, 0, 0.5);
}

.lpd-window--dragging,
.lpd-window--resizing {
    opacity: 0.9;
    z-index: 10;
}

.lpd-window--invalid {
    box-shadow: 0 0 0 2px rgba(200, 70, 70, 0.85), 0 1px 3px rgba(0, 0, 0, 0.35);
    transition: box-shadow 0.12s ease-out;
}

.lpd-window__titlebar {
    flex: 0 0 var(--lpd-titlebar-h);
    height: var(--lpd-titlebar-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    padding: 0 4px 0 8px;
    background: linear-gradient(to bottom, var(--lpd-win-hi), var(--lpd-win));
    border-bottom: 1px solid var(--lpd-win-lo);
    cursor: move;
    touch-action: none;
}
.lpd-window--active .lpd-window__titlebar {
    background: linear-gradient(to bottom, var(--lpd-win-active-hi), var(--lpd-win-active));
    border-bottom-color: var(--lpd-win-active-lo);
}

.lpd-window__title {
    flex: 1 1 auto;
    color: var(--lpd-ink);
    font-size: 12px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    letter-spacing: 0.02em;
}

.lpd-window__titlebar-actions {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 4px;
}

.lpd-window__close {
    font: inherit;
    font-size: 14px;
    line-height: 1;
    color: var(--lpd-ink);
    background: var(--lpd-chrome);
    border: 1px solid transparent;
    border-top-color: var(--lpd-chrome-hi);
    border-left-color: var(--lpd-chrome-hi);
    border-right-color: var(--lpd-chrome-lo);
    border-bottom-color: var(--lpd-chrome-lo);
    width: 20px;
    height: 20px;
    padding: 0;
    cursor: pointer;
}

.lpd-window__close:hover { background: var(--lpd-chrome-hi); }
.lpd-window__close:active {
    border-top-color: var(--lpd-chrome-lo);
    border-left-color: var(--lpd-chrome-lo);
    border-right-color: var(--lpd-chrome-hi);
    border-bottom-color: var(--lpd-chrome-hi);
}

.lpd-window__body {
    flex: 1 1 auto;
    overflow-y: auto;
    overflow-x: hidden;
    background: #fbfbf8;
    color: #2a2a30;
    padding: 8px;
    font-size: 12px;
    /* Re-enable text selection for PANE CONTENT. The desktop shell sets
       user-select:none globally on <body> so dragging windows by their
       titlebar (or across the desktop) never selects chrome text; but pane
       content — resource IDs, ARNs, names — must be copyable, as it is in the
       iframe/inline embeds. The chrome (titlebar, dock) stays non-selectable
       via the body default; only this content area opts back in. */
    user-select: text;
    -webkit-user-select: text;
}

/* Pane target div (sd-embed.js writes here). sd-embed.css provides
   all .lp-pane-* styling; lp-desktop.css does not dictate the pane's
   internal look, with one local exception below. */

/* Square the outer pane corners inside a desktop window so they
   align with the window chrome's square corners. Overriding the
   sd-embed CSS custom property leaves inner rounded elements
   (badges, pills, avatars — which use --lp-pane-radius-sm or
   explicit radii) untouched. */
.lpd-window__pane {
    --lp-pane-radius: 0;
}

/* Attributes menu (per window) ---------------------------------- */

.lpd-attrs {
    position: relative;
}

.lpd-attrs[hidden] { display: none; }

.lpd-attrs__toggle {
    font: inherit;
    font-size: 11px;
    line-height: 1.4;
    color: var(--lpd-ink);
    background: var(--lpd-chrome);
    border: 1px solid transparent;
    border-top-color: var(--lpd-chrome-hi);
    border-left-color: var(--lpd-chrome-hi);
    border-right-color: var(--lpd-chrome-lo);
    border-bottom-color: var(--lpd-chrome-lo);
    padding: 3px 7px;
    cursor: pointer;
    white-space: nowrap;
}

.lpd-attrs__toggle:hover { background: var(--lpd-chrome-hi); }

.lpd-attrs__toggle[aria-expanded="true"] {
    background: var(--lpd-chrome-hi);
    border-top-color: var(--lpd-chrome-lo);
    border-left-color: var(--lpd-chrome-lo);
    border-right-color: var(--lpd-chrome-hi);
    border-bottom-color: var(--lpd-chrome-hi);
}

.lpd-attrs__menu {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    min-width: 200px;
    max-height: 280px;
    overflow-y: auto;
    background: var(--lpd-chrome);
    border: 1px solid var(--lpd-chrome-lo);
    border-top-color: var(--lpd-chrome-hi);
    border-left-color: var(--lpd-chrome-hi);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
    padding: 2px;
    z-index: 50;
}

.lpd-attrs__menu[hidden] { display: none; }

.lpd-attrs__option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 8px;
    font-size: 12px;
    color: var(--lpd-ink);
    cursor: pointer;
    white-space: nowrap;
}

.lpd-attrs__option:hover {
    background: var(--lpd-chrome-hi);
}

.lpd-attrs__option input {
    flex-shrink: 0;
    margin: 0;
}

/* Resize handles ------------------------------------------------- */

.lpd-window__handle {
    position: absolute;
    background: transparent;
    touch-action: none;
}

.lpd-window__handle--n  { top: -3px;    left: 10px;   right: 10px;  height: 6px;  cursor: ns-resize; }
.lpd-window__handle--s  { bottom: -3px; left: 10px;   right: 10px;  height: 6px;  cursor: ns-resize; }
.lpd-window__handle--e  { top: 10px;    right: -3px;  bottom: 10px; width: 6px;   cursor: ew-resize; }
.lpd-window__handle--w  { top: 10px;    left: -3px;   bottom: 10px; width: 6px;   cursor: ew-resize; }
.lpd-window__handle--nw { top: -4px;    left: -4px;   width: 12px;  height: 12px; cursor: nwse-resize; }
.lpd-window__handle--ne { top: -4px;    right: -4px;  width: 12px;  height: 12px; cursor: nesw-resize; }
.lpd-window__handle--sw { bottom: -4px; left: -4px;   width: 12px;  height: 12px; cursor: nesw-resize; }
.lpd-window__handle--se { bottom: -4px; right: -4px;  width: 12px;  height: 12px; cursor: nwse-resize; }

/* "New" menu ----------------------------------------------------- */

.lpd-new {
    position: relative;
}

.lpd-new__toggle[aria-expanded="true"] {
    border-top-color: var(--lpd-chrome-lo);
    border-left-color: var(--lpd-chrome-lo);
    border-right-color: var(--lpd-chrome-hi);
    border-bottom-color: var(--lpd-chrome-hi);
    background: var(--lpd-chrome-hi);
}

.lpd-new__menu {
    position: absolute;
    bottom: calc(100% + 6px);
    left: 0;
    min-width: 220px;
    background: var(--lpd-chrome);
    border: 1px solid var(--lpd-chrome-lo);
    border-top-color: var(--lpd-chrome-hi);
    border-left-color: var(--lpd-chrome-hi);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
    padding: 2px;
    z-index: 50;
}

.lpd-new__menu[hidden] { display: none; }

/* Category row — hover reveals the submenu. The arrow on the
   right hints at the affordance. */
.lpd-new__cat {
    position: relative;
}

.lpd-new__cat-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 7px 10px 7px 14px;
    font: inherit;
    text-align: left;
    color: var(--lpd-ink);
    background: transparent;
    border: 0;
    cursor: default;
    white-space: nowrap;
    gap: 24px;
}

.lpd-new__cat:hover > .lpd-new__cat-btn,
.lpd-new__cat:focus-within > .lpd-new__cat-btn {
    background: var(--lpd-chrome-hi);
}

.lpd-new__cat-arrow {
    color: var(--lpd-ink-dim);
    font-size: 10px;
    line-height: 1;
}

/* Submenu — slides out to the right of the parent menu on hover.
   Anchored to the BOTTOM of the parent row so a long submenu
   grows upward from the corresponding category, never beyond
   the top of the viewport for the entries near the bottom of
   the parent menu. */
.lpd-new__sub {
    position: absolute;
    left: 100%;
    bottom: 0;
    min-width: 240px;
    max-height: 70vh;
    overflow-y: auto;
    background: var(--lpd-chrome);
    border: 1px solid var(--lpd-chrome-lo);
    border-top-color: var(--lpd-chrome-hi);
    border-left-color: var(--lpd-chrome-hi);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
    padding: 2px;
    display: none;
    z-index: 51;
    /* Small overlap so the cursor crossing the hover gap doesn't
       collapse the submenu. */
    margin-left: -2px;
}

.lpd-new__cat:hover > .lpd-new__sub,
.lpd-new__cat:focus-within > .lpd-new__sub {
    display: block;
}

/* When a submenu itself contains nested category groups (e.g. AWS
   "Compound views" → Cost / Inventory / ...), the default
   max-height+overflow-y:auto from .lpd-new__sub clips the third-
   level popout INSIDE its own scroll box — the user sees it
   rendered inline with a scrollbar instead of flying out to the
   right. Turn off the clip on any sub that has a direct child
   category row; leaf submenus (a flat list of options) keep their
   scroll behaviour so a very long list still bounds itself.
   Selector applies recursively, so adding a fourth level later
   Just Works. */
.lpd-new__sub:has(> .lpd-new__cat) {
    max-height: none;
    overflow: visible;
}

.lpd-new__option {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 6px 12px;
    font: inherit;
    text-align: left;
    color: var(--lpd-ink);
    background: transparent;
    border: 0;
    cursor: pointer;
    white-space: nowrap;
    gap: 16px;
}

.lpd-new__option:hover,
.lpd-new__option:focus-visible {
    background: var(--lpd-chrome-hi);
    outline: none;
}

.lpd-new__option__service {
    color: var(--lpd-ink-dim);
    font-size: 11px;
    font-family: ui-monospace, 'JetBrains Mono', SFMono-Regular, Menlo, monospace;
}

/* Toast ---------------------------------------------------------- */

.lpd-toast {
    position: absolute;
    top: 24px;
    left: 50%;
    transform: translateX(-50%);
    padding: 8px 16px;
    background: rgba(30, 30, 34, 0.92);
    color: var(--lpd-ink);
    border: 1px solid var(--lpd-chrome-lo);
    border-top-color: var(--lpd-chrome-hi);
    font-size: 12px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease-out;
    z-index: 100;
}

.lpd-toast--visible {
    opacity: 1;
}

.lpd-toast[hidden] { display: none; }

/* Access-key modal ---------------------------------------------- */

.lpd-modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.55);
    z-index: 200;
}

.lpd-modal__panel {
    width: 380px;
    max-width: 90vw;
    padding: 16px 20px;
    background: var(--lpd-chrome);
    color: var(--lpd-ink);
    border: 1px solid var(--lpd-chrome-lo);
    border-top-color: var(--lpd-chrome-hi);
    border-left-color: var(--lpd-chrome-hi);
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.55);
}

.lpd-modal__title {
    margin: 0 0 8px;
    font-size: 14px;
    font-weight: 600;
}

.lpd-modal__body {
    margin: 0 0 12px;
    font-size: 12px;
    line-height: 1.5;
    color: var(--lpd-ink-dim);
}

.lpd-modal__body code {
    padding: 1px 5px;
    background: var(--lpd-chrome-lo);
    color: var(--lpd-ink);
    border-radius: 2px;
    font-size: 11px;
}

.lpd-modal__input {
    width: 100%;
    padding: 6px 8px;
    margin-bottom: 14px;
    font: inherit;
    color: var(--lpd-ink);
    background: var(--lpd-chrome-lo);
    border: 1px solid #000;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.45);
}

.lpd-modal__input:focus {
    outline: 1px solid var(--lpd-accent);
    outline-offset: -1px;
}

.lpd-modal__actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.lpd-modal__cancel,
.lpd-modal__ok {
    font: inherit;
    color: var(--lpd-ink);
    background: var(--lpd-chrome);
    border: 1px solid transparent;
    border-top-color: var(--lpd-chrome-hi);
    border-left-color: var(--lpd-chrome-hi);
    border-right-color: var(--lpd-chrome-lo);
    border-bottom-color: var(--lpd-chrome-lo);
    padding: 6px 14px;
    cursor: pointer;
}

.lpd-modal__ok { color: var(--lpd-accent); font-weight: 600; }

.lpd-modal__cancel:hover,
.lpd-modal__ok:hover {
    background: var(--lpd-chrome-hi);
}

/* ─── No-cloud-account hero (session-mode only) ──────────────
   Rendered by lp-desktop.js when /user/profile returns zero
   bindings. Sits inside .lpd-area, replacing the (otherwise
   empty) desktop canvas with actionable copy. */
.lpd-no-bindings-hero {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
}
.lpd-no-bindings-card {
    max-width: 520px;
    background: #ffffff;
    border: 1px solid #e9e3d6;
    border-radius: 14px;
    padding: 36px 32px;
    color: #1a1814;
    font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif;
}
.lpd-no-bindings-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 999px;
    background: #fde9a6;
    color: #5a4500;
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.04em;
    margin-bottom: 16px;
}
.lpd-no-bindings-card h2 {
    margin: 0 0 10px;
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.01em;
}
.lpd-no-bindings-card p {
    margin: 0 0 24px;
    color: #4a4339;
    font-size: 14px;
    line-height: 1.6;
}
.lpd-no-bindings-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
.lpd-no-bindings-btn {
    display: inline-block;
    padding: 10px 18px;
    border-radius: 10px;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
}
.lpd-no-bindings-btn--primary {
    background: #f5c518;
    color: #1a1814;
    border: 1px solid #c79f0a;
}
.lpd-no-bindings-btn--ghost {
    background: transparent;
    color: #1a1814;
    border: 1px solid #e9e3d6;
}

/* ─── Yellow "Dashboard" dock button ──────────────────────────
   Same chrome geometry as .lpd-dock__button (so it reads as a
   peer of the "New ▾" launcher on the left), with a yellow
   background to draw the eye. The 4-box icon mirrors the
   active state of the Aqua switcher on /dashboard/, so the
   round trip reads as the same control in two places. */
.lpd-dock__button--accent {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    /* Same raised treatment as the Build button (gradient + bevel + shadow
       inherited from .lpd-dock__button), re-tinted to LightPane amber. */
    background: linear-gradient(to bottom, #ffd75a, #f5c518);
    color: #1a120a;                 /* dark ink for contrast */
    border-color: #b8860b;          /* dark amber — bottom/right bevel */
    border-top-color: #ffe27a;      /* light amber — top bevel */
    border-left-color: #ffe27a;     /* light amber — left bevel */
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5),
                0 1px 2px rgba(15, 30, 61, 0.45);
    text-decoration: none;
    margin-left: 8px;
}
.lpd-dock__button--accent:hover:not(:disabled) {
    background: linear-gradient(to bottom, #ffe27a, #ffd33d);   /* brighter on hover */
}
.lpd-dock__btn-icon {
    width: 13px;
    height: 13px;
    display: inline-block;
    flex: 0 0 13px;
    color: currentColor;
}

/* ─── Handoff switcher overlay ────────────────────────────────
   Rendered briefly at the top-centre of /desktop/ when the user
   arrived from /dashboard/ via the Aqua switcher. The bubble is
   already in its right-hand (Desktop) position when shown;
   after ~1 second the whole overlay fades out, leaving the dock
   button as the persistent way back. */
.lpd-handoff-switcher {
    position: fixed;
    top: 18px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9000;
    pointer-events: none; /* purely visual — not interactive */
    opacity: 0;
    transition: opacity 420ms ease-out;
}
.lpd-handoff-switcher[data-visible="true"] {
    opacity: 1;
}
.lpd-handoff-switcher[data-fading="true"] {
    opacity: 0;
}

/* Duplicate of the Aqua switcher styles (kept inline here so the
   /desktop/ page doesn't depend on /dashboard/'s stylesheet). */
.lpd-handoff-switcher .lens-modeswitch {
    position: relative;
    display: inline-flex;
    align-items: center;
    background: linear-gradient(to bottom, #f0e6c4 0%, #fef7d8 100%);
    border: 1px solid #d9c281;
    border-radius: 999px;
    padding: 3px;
    box-shadow:
        inset 0 1px 2px rgba(0, 0, 0, 0.15),
        0 1px 0 rgba(255, 255, 255, 0.6),
        0 4px 16px rgba(0, 0, 0, 0.18);
}
.lpd-handoff-switcher .lens-modeswitch__btn {
    position: relative;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 26px;
    background: transparent;
    border-radius: 999px;
    font: inherit;
    font-size: 13.5px;
    font-weight: 600;
    color: #6b4a17;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
    min-width: 140px;
    justify-content: center;
}
.lpd-handoff-switcher .lens-modeswitch__btn[aria-selected="true"] {
    color: #1a120a;
}
.lpd-handoff-switcher .lens-modeswitch__icon {
    width: 14px;
    height: 14px;
    display: inline-block;
}
.lpd-handoff-switcher .lens-modeswitch__bubble {
    position: absolute;
    top: 3px;
    bottom: 3px;
    left: 3px;
    width: calc(50% - 3px);
    border-radius: 999px;
    background: linear-gradient(to bottom,
        #ffe79a 0%,
        #f5c518 55%,
        #d9a800 100%);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.6),
        inset 0 -1px 0 rgba(0, 0, 0, 0.08),
        0 1px 3px rgba(0, 0, 0, 0.18);
    z-index: 0;
}
.lpd-handoff-switcher .lens-modeswitch[data-mode="desktop"] .lens-modeswitch__bubble {
    transform: translateX(100%);
}

/* Per-window binding strip ------------------------------------------
   Sits between titlebar and body. Always-visible chips so a glance
   tells you which account + region this pane is showing — essential
   for the side-by-side comparison use case (no Mac-OS-style "active
   window" hidden-control indirection). */

.lpd-window__binding.lpd-binding {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 6px;
    background: linear-gradient(to bottom, var(--lpd-win), var(--lpd-win-lo));
    border-bottom: 1px solid var(--lpd-win-lo);
    font-size: 11px;
    color: var(--lpd-ink);
    /* Do NOT set overflow:hidden — the chip dropdowns anchor
       `top: 100% + 4px` and need to escape downward into the
       pane body. Per-element ellipsis on the button labels
       handles long-name truncation without needing the strip
       itself to clip. */
}

.lpd-window--active .lpd-window__binding.lpd-binding {
    background: linear-gradient(to bottom, var(--lpd-win-active), var(--lpd-win-active-lo));
    border-bottom-color: var(--lpd-win-active-lo);
}
.lpd-window__binding[hidden] { display: none; }

.lpd-binding__provider {
    display: inline-flex;
    align-items: center;
    padding: 2px 6px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: var(--lpd-ink);
    background: rgba(255, 153, 0, 0.85);  /* AWS amber by default */
    border-radius: 2px;
    text-transform: uppercase;
}

/* Provider tinting for the badge — future hook for the user's
   "background/pane colouring per provider" idea. For now the only
   visible provider is AWS; GCP / Azure values exist so the badge
   doesn't read as AWS on a hypothetical future GCP launch. */
.lpd-binding__provider[data-provider="aws"]   { background: #ff9900; color: #1a1814; }
.lpd-binding__provider[data-provider="gcp"]   { background: #4285f4; color: #fff; }
.lpd-binding__provider[data-provider="azure"] { background: #0078d4; color: #fff; }

.lpd-binding__chip {
    position: relative;
    display: inline-flex;
    align-items: center;
    min-width: 0;
}

/* Without this, the class's `display: inline-flex` overrides the
   user-agent `[hidden] { display: none }` and the chip stays
   visible even after JS sets `hidden=true` (compound panes hide
   the region chip this way). */
.lpd-binding__chip[hidden] { display: none; }

.lpd-binding__btn {
    font: inherit;
    font-size: 11px;
    /* 1.4 line-height so descenders (g, j, p, q, y) clear the
       button bottom edge — line-height:1 was clipping them. */
    line-height: 1.4;
    color: var(--lpd-ink);
    background: var(--lpd-chrome);
    border: 1px solid transparent;
    border-top-color: var(--lpd-chrome-hi);
    border-left-color: var(--lpd-chrome-hi);
    border-right-color: var(--lpd-chrome-lo);
    border-bottom-color: var(--lpd-chrome-lo);
    padding: 3px 7px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    max-width: 180px;
    white-space: nowrap;
}

.lpd-binding__btn-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 140px;
}

.lpd-binding__btn-arrow {
    flex-shrink: 0;
    font-size: 8px;
    opacity: 0.85;
}

.lpd-binding__btn:hover { background: var(--lpd-chrome-hi); }

.lpd-binding__btn[aria-expanded="true"] {
    background: var(--lpd-chrome-hi);
    border-top-color: var(--lpd-chrome-lo);
    border-left-color: var(--lpd-chrome-lo);
    border-right-color: var(--lpd-chrome-hi);
    border-bottom-color: var(--lpd-chrome-hi);
}

.lpd-binding__menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    min-width: 180px;
    max-height: 280px;
    overflow-y: auto;
    background: var(--lpd-chrome);
    border: 1px solid var(--lpd-chrome-lo);
    border-top-color: var(--lpd-chrome-hi);
    border-left-color: var(--lpd-chrome-hi);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
    padding: 2px;
    z-index: 50;
}

.lpd-binding__menu[hidden] { display: none; }

.lpd-binding__menu-row {
    width: 100%;
    text-align: left;
    background: transparent;
    border: 0;
    color: var(--lpd-ink);
    font: inherit;
    font-size: 11px;
    padding: 4px 8px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    gap: 8px;
}

.lpd-binding__menu-row:hover {
    background: var(--lpd-chrome-hi);
}

.lpd-binding__menu-row--selected {
    background: rgba(0, 0, 0, 0.18);
}

.lpd-binding__menu-row-meta {
    opacity: 0.7;
    font-size: 10px;
    align-self: center;
}

.lpd-binding__menu-empty {
    padding: 8px;
    font-size: 11px;
    color: var(--lpd-ink-dim);
    font-style: italic;
}

/* Attributes button stays styled by its existing rules, but inside
   the binding strip it shares the row layout. Stretch the existing
   .lpd-attrs container so its dropdown still anchors right. */
.lpd-binding .lpd-attrs {
    margin-left: auto;
}
