/* 06-sidebar.css — Sidebar (icon strip + menu panel) and the Ctrl+K search palette.
   Loaded after the files with a smaller number (later rules win). */

/* ---------- Sidebar: floating glass rail + module panel ---------- */
.sidebar { padding: 0; background: transparent; border: 0; }
@media (min-width: 992px) { .sidebar.offcanvas-lg { position: sticky; top: 0; height: 100vh; overflow: visible; width: auto; z-index: 45; padding: 6px 0 6px 6px; } }
.sidebar.offcanvas-lg { --bs-offcanvas-width: min(90vw, 350px); --bs-offcanvas-bg: #e9eef6; }
@media (max-width: 991.98px) { .sidebar.offcanvas-lg { padding: 10px; } }
.side-inner { display: flex; gap: 6px; height: 100%; }

/* shared glass surface */
.rail, .side-panel { background: rgba(255, 255, 255, .72); -webkit-backdrop-filter: blur(22px) saturate(1.5); backdrop-filter: blur(22px) saturate(1.5); border: 1px solid rgba(255, 255, 255, .85); border-radius: 24px; box-shadow: 0 18px 40px -22px rgba(15, 23, 42, .38), 0 2px 6px rgba(15, 23, 42, .04), inset 0 1px 0 rgba(255, 255, 255, .95); }

/* ----- rail ----- */
.rail { width: 58px; flex: none; display: flex; flex-direction: column; align-items: center; padding: .8rem 0 .7rem; }
.rail-brand { width: 40px; height: 40px; border-radius: 14px; display: grid; place-items: center; overflow: hidden; background: var(--grad-ai); color: #fff; font-weight: 800; font-size: 1.15rem; text-decoration: none; box-shadow: 0 10px 20px -8px rgba(123, 60, 255, .7); flex: none; transition: transform .2s; }
.rail-brand:hover { transform: rotate(-6deg) scale(1.06); }
.rail-brand img { width: 100%; height: 100%; object-fit: contain; background: #fff; padding: 4px; color: transparent; font-size: 0; }
.rail-list, .rail-bottom { display: flex; flex-direction: column; align-items: center; gap: .35rem; }
.rail-list { margin-top: .8rem; padding-top: .8rem; border-top: 1px solid rgba(15, 23, 42, .06); width: 34px; }
.rail-bottom { margin-top: auto; }
.rail-item { position: relative; width: 44px; height: 44px; border: 0; border-radius: 16px; display: grid; place-items: center; background: transparent; padding: 0; text-decoration: none; transition: background .2s, box-shadow .2s; }
.rail-item .ri { width: 34px; height: 34px; border-radius: 12px; display: grid; place-items: center; color: #fff; font-size: 1.08rem; box-shadow: 0 8px 14px -8px rgba(15, 23, 42, .55); transition: transform .22s cubic-bezier(.2, .9, .3, 1.35), box-shadow .22s; }
.rail-item .ri.plain { background: transparent; color: var(--muted); box-shadow: none; }
.rail-item:hover { background: rgba(255, 255, 255, .9); }
.rail-item:hover .ri { transform: translateY(-1px) scale(1.1); }
.rail-item.active { background: #fff; box-shadow: 0 10px 22px -12px rgba(15, 23, 42, .45), 0 0 0 1px rgba(15, 23, 42, .05); }
.rail-item.active .ri { box-shadow: 0 10px 20px -6px var(--g, rgba(24, 119, 242, .7)); }
.rail-item:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.rail-bar { position: absolute; left: -9px; top: 50%; width: 4px; height: 0; border-radius: 0 4px 4px 0; background: var(--g, var(--blue)); transform: translateY(-50%); transition: height .25s cubic-bezier(.2, .9, .3, 1.2); }
.rail-item.active .rail-bar { height: 22px; }
.rail-badge { position: absolute; top: 3px; right: 2px; min-width: 18px; height: 18px; padding: 0 .3rem; border-radius: 999px; background: linear-gradient(135deg, #ffb020, #ff7a45); color: #fff; font-size: .62rem; font-weight: 800; display: grid; place-items: center; box-shadow: 0 0 0 2px #fff, 0 4px 10px -2px rgba(255, 122, 69, .7); animation: pulseBadge 2.4s ease-in-out infinite; }
@keyframes pulseBadge { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.12); } }
.rail-item::after { content: attr(data-label) "  " attr(data-key); position: absolute; left: calc(100% + 14px); top: 50%; transform: translate(-6px, -50%) scale(.96); padding: .4rem .7rem; border-radius: 11px; background: rgba(17, 24, 39, .94); color: #fff; font-size: .78rem; font-weight: 600; white-space: pre; opacity: 0; pointer-events: none; transition: opacity .16s, transform .16s; z-index: 200; box-shadow: 0 14px 28px -10px rgba(0, 0, 0, .55); }
.rail-item:hover::after, .rail-item:focus-visible::after { opacity: 1; transform: translate(0, -50%) scale(1); }
.rail-expand { display: none; }
.shell.side-collapsed .rail-expand { display: grid; }

/* ----- panel ----- */
.side-panel { width: 200px; flex: none; display: flex; flex-direction: column; padding: .95rem .6rem .6rem; overflow-y: auto; overflow-x: hidden; background-image: linear-gradient(180deg, color-mix(in srgb, var(--mod, #1877f2) 15%, rgba(255, 255, 255, .78)) 0%, rgba(255, 255, 255, .72) 42%); scrollbar-width: thin; scrollbar-color: rgba(15, 23, 42, .15) transparent; }
.sp-head { display: flex; align-items: center; gap: .7rem; margin: 0 .25rem 1rem; }
.sp-ic { width: 42px; height: 42px; flex: none; border-radius: 16px; display: grid; place-items: center; color: #fff; font-size: 1.35rem; box-shadow: 0 14px 24px -12px var(--mod, #1877f2); }
@keyframes icPop { from { transform: scale(.6) rotate(-12deg); opacity: 0; } to { transform: none; opacity: 1; } }
.sp-title { min-width: 0; }
.sp-title small { display: block; font-size: .66rem; font-weight: 600; color: var(--muted); max-width: 96px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 1.2; }
.sp-title h2 { margin: 0; font-size: 1.2rem; font-weight: 800; letter-spacing: -.025em; line-height: 1.12; }
.sp-collapse { margin-left: auto; width: 30px; height: 30px; flex: none; border: 0; border-radius: 10px; background: transparent; color: var(--muted); place-items: center; transition: background .15s, color .15s; }
.sp-collapse:hover { background: rgba(15, 23, 42, .06); color: var(--text); }

.sp-search { display: flex; align-items: center; gap: .55rem; width: 100%; height: 38px; margin: 0 0 1rem; padding: 0 .55rem 0 .75rem; border: 1px solid transparent; border-radius: 13px; background: rgba(15, 23, 42, .05); color: var(--muted); font-size: .85rem; text-align: left; transition: background .15s, border-color .15s, box-shadow .15s; }
.sp-search i { font-size: .9rem; }
.sp-search span { flex: 1; }
.sp-search kbd { font-family: var(--mono); font-size: .64rem; font-weight: 600; color: var(--muted); background: #fff; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 6px; padding: .05rem .38rem; box-shadow: none; }
.sp-search:hover { background: #fff; border-color: var(--border-strong); box-shadow: 0 6px 16px -10px rgba(15, 23, 42, .35); color: var(--text); }

.sp-list { display: grid; gap: .18rem; }
.sp-row { position: relative; animation: spIn .45s cubic-bezier(.2, .8, .3, 1) both; animation-delay: calc(var(--i, 0) * 45ms); }
@keyframes spIn { from { opacity: 0; transform: translateX(-8px); } to { opacity: 1; transform: none; } }
.sp-item { position: relative; display: flex; align-items: center; gap: .6rem; padding: .34rem .5rem; border-radius: 12px; color: var(--text); text-decoration: none; font-weight: 500; font-size: .84rem; transition: background .18s, box-shadow .18s, transform .18s; }
.sp-quick .sp-item { animation: spIn .45s cubic-bezier(.2, .8, .3, 1) both; animation-delay: calc(var(--i, 0) * 45ms); }
.sp-item .spi { width: 28px; height: 28px; flex: none; border-radius: 10px; display: grid; place-items: center; font-size: .86rem; transition: transform .2s cubic-bezier(.2, .9, .3, 1.35); }
.sp-item .spi.plain { background: rgba(255, 255, 255, .9); color: var(--mod, var(--blue)); box-shadow: inset 0 0 0 1px rgba(15, 23, 42, .06); }
.sp-item .spl { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-item:hover { background: rgba(255, 255, 255, .7); color: var(--text); }
.sp-item:hover .spi { transform: scale(1.06); }
.sp-item.active { background: #fff; box-shadow: 0 10px 22px -14px rgba(15, 23, 42, .45), 0 0 0 1px rgba(15, 23, 42, .05); font-weight: 600; }
.sp-item.active .spi.plain { background: var(--mod, var(--blue)); color: #fff; box-shadow: 0 6px 14px -6px var(--mod, rgba(24, 119, 242, .7)); }
.sp-count { flex: none; min-width: 22px; height: 20px; padding: 0 .42rem; border-radius: 999px; background: rgba(15, 23, 42, .07); color: var(--muted); font-size: .68rem; font-weight: 800; display: grid; place-items: center; transition: opacity .15s; }
.sp-count.warn { background: linear-gradient(135deg, #ffe7b3, #ffd0a8); color: #8a4a00; }
.sp-pin { position: absolute; right: .35rem; top: 50%; transform: translateY(-50%) scale(.8); width: 26px; height: 26px; border: 0; border-radius: 9px; background: rgba(255, 255, 255, .95); color: var(--muted); font-size: .8rem; display: grid; place-items: center; opacity: 0; transition: opacity .15s, transform .15s, color .15s; box-shadow: 0 4px 10px -4px rgba(15, 23, 42, .35); }
.sp-row:hover .sp-pin, .sp-pin:focus-visible, .sp-pin.on { opacity: 1; transform: translateY(-50%) scale(1); }
.sp-row:hover .sp-count { opacity: 0; }
.sp-pin.on { color: var(--mod, var(--blue)); }
.sp-pin:hover { color: var(--mod, var(--blue)); }
@media (hover: none) { .sp-pin { opacity: 1; transform: translateY(-50%); } .sp-row:hover .sp-count { opacity: 1; } }
.sp-label { margin: 1.3rem .75rem .4rem; font-size: .66rem; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); display: flex; align-items: center; gap: .35rem; }
.sp-label i { font-size: .72rem; color: var(--mod, var(--blue)); }
.sp-quick .sp-item, .sp-recent .sp-item { font-weight: 500; font-size: .84rem; padding: .34rem .5rem; }
.sp-quick .spi, .sp-recent .spi { width: 28px; height: 28px; font-size: .86rem; border-radius: 10px; }

.sp-card { display: flex; align-items: center; gap: .6rem; margin: 1.1rem .1rem 0; padding: .55rem .6rem; border-radius: 16px; text-decoration: none; color: var(--text); transition: transform .18s, box-shadow .18s; }
.sp-card b { display: block; font-size: .84rem; line-height: 1.2; }
.sp-card small { display: block; font-size: .72rem; color: var(--muted); }
.sp-card .sc-ic { width: 32px; height: 32px; border-radius: 11px; display: grid; place-items: center; font-size: 1.05rem; color: #fff; flex: none; }
.sp-card.ok { background: linear-gradient(135deg, rgba(46, 204, 113, .16), rgba(23, 166, 115, .1)); box-shadow: inset 0 0 0 1px rgba(46, 204, 113, .25); }
.sp-card.ok .sc-ic { background: linear-gradient(135deg, #2ecc71, #17a673); box-shadow: 0 8px 14px -8px rgba(23, 166, 115, .9); }
.sp-card.bad { background: linear-gradient(135deg, rgba(228, 30, 63, .13), rgba(255, 94, 98, .08)); box-shadow: inset 0 0 0 1px rgba(228, 30, 63, .25); }
.sp-card.bad .sc-ic { background: linear-gradient(135deg, #e41e3f, #ff5e62); box-shadow: 0 8px 14px -8px rgba(228, 30, 63, .9); }
.sp-card:hover { transform: translateY(-1px); box-shadow: 0 12px 22px -14px rgba(15, 23, 42, .45); color: var(--text); }

.sp-user { display: flex; align-items: center; gap: .6rem; margin: auto -.1rem 0; padding: .65rem .55rem .15rem; border-top: 1px solid rgba(15, 23, 42, .07); }
.sp-panel-fill { flex: 1; }
.side-panel > .sp-user { margin-top: auto; }
.side-panel > .sp-card + .sp-user, .side-panel > #spRecentBox + .sp-user { margin-top: auto; }
.sp-user .av { width: 32px; height: 32px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--grad); color: #fff; font-weight: 800; font-size: .85rem; box-shadow: 0 8px 14px -8px rgba(24, 119, 242, .8); }
.sp-user .who { min-width: 0; display: block; line-height: 1.2; }
.sp-user .who b { display: block; font-size: .82rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 78px; }
.sp-user .who small { display: block; font-size: .68rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 78px; }
.sp-out { width: 32px; height: 32px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); display: grid; place-items: center; transition: background .15s, color .15s; }
.sp-out:hover { background: var(--red-soft); color: var(--red); }

@media (min-width: 992px) { .shell.side-collapsed .side-panel { display: none; } }
@media (max-width: 991.98px) { .side-panel { flex: 1; width: auto; } .rail-item::after { display: none; } }
@media (prefers-reduced-motion: reduce) { .sp-row, .sp-quick .sp-item, .sp-ic, .rail-badge { animation: none; } }
@media print { .sidebar, .cmd { display: none !important; } }

/* ---------- Search palette ---------- */
.cmd { position: fixed; inset: 0; z-index: 2000; display: grid; place-items: start center; padding: 11vh 1rem 1rem; }
.cmd[hidden] { display: none; }
.cmd-backdrop { position: absolute; inset: 0; background: rgba(15, 23, 42, .35); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); animation: cmdFade .18s ease-out; }
.cmd-box { position: relative; width: min(640px, 100%); border-radius: 24px; background: rgba(255, 255, 255, .92); -webkit-backdrop-filter: blur(26px) saturate(1.5); backdrop-filter: blur(26px) saturate(1.5); border: 1px solid rgba(255, 255, 255, .9); box-shadow: 0 40px 90px -30px rgba(15, 23, 42, .6), 0 4px 14px rgba(15, 23, 42, .08); overflow: hidden; animation: cmdPop .22s cubic-bezier(.2, .9, .3, 1.2); }
@keyframes cmdFade { from { opacity: 0; } }
@keyframes cmdPop { from { opacity: 0; transform: translateY(-14px) scale(.97); } }
.cmd-input { display: flex; align-items: center; gap: .75rem; padding: 1rem 1.2rem; border-bottom: 1px solid var(--border); }
.cmd-input > i { font-size: 1.1rem; color: var(--blue); }
.cmd-input input { flex: 1; border: 0; outline: 0; background: transparent; font-size: 1.05rem; font-weight: 500; min-width: 0; }
.cmd-input input::placeholder { color: #9aa0a8; font-weight: 400; }
.cmd kbd { font-family: var(--mono); font-size: .66rem; font-weight: 600; color: var(--muted); background: #fff; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 6px; padding: .08rem .4rem; box-shadow: none; }
.cmd-list { max-height: min(52vh, 440px); overflow-y: auto; padding: .4rem .6rem .6rem; }
.cmd-group { margin: .8rem .5rem .3rem; font-size: .66rem; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; color: var(--subtle); display: flex; align-items: center; gap: .35rem; }
.cmd-item { display: flex; align-items: center; gap: .75rem; padding: .5rem .6rem; border-radius: 14px; color: var(--text); text-decoration: none; }
.cmd-item .ci { width: 34px; height: 34px; flex: none; border-radius: 11px; display: grid; place-items: center; color: #fff; font-size: .98rem; box-shadow: 0 8px 14px -9px rgba(15, 23, 42, .6); }
.cmd-item .ct { flex: 1; min-width: 0; line-height: 1.25; }
.cmd-item .ct b { display: block; font-weight: 600; font-size: .92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmd-item .ct small { display: block; font-size: .75rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmd-item .go { color: var(--subtle); opacity: 0; transition: opacity .12s; }
.cmd-item.on { background: var(--blue-soft); }
.cmd-item.on .go { opacity: 1; color: var(--blue); }
.cmd-empty, .cmd-loading { padding: 1.4rem; text-align: center; color: var(--muted); font-size: .88rem; display: flex; align-items: center; justify-content: center; gap: .5rem; }
.cmd-foot { display: flex; flex-wrap: wrap; gap: .4rem 1rem; align-items: center; padding: .6rem 1.1rem; border-top: 1px solid var(--border); background: rgba(246, 248, 251, .8); font-size: .74rem; color: var(--muted); }
.cmd-foot kbd { margin-right: .2rem; }
body.cmd-open { overflow: hidden; }

@media (min-width: 992px) { .content { padding-left: 1.25rem; padding-right: 1.25rem; } }

/* ---------- Sidebar: flat version (no floating rounded cards) ---------- */
@media (min-width: 992px) { .sidebar.offcanvas-lg { padding: 0; } }
@media (max-width: 991.98px) { .sidebar.offcanvas-lg { padding: 0; } }
.side-inner { gap: 0; }
.rail, .side-panel { border-radius: 0; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; border: 0; border-right: 1px solid var(--border); }
.rail { background: #f7f9fc; }
.side-panel { background: #fff; background-image: linear-gradient(180deg, color-mix(in srgb, var(--mod, #1877f2) 9%, #fff) 0%, #fff 34%); }
.rail-brand { border-radius: 10px; }
.rail-list { border-top-color: var(--border); }
.rail-item { border-radius: 10px; }
.rail-item.active { background: #fff; box-shadow: inset 0 0 0 1px var(--border); }
.rail-item .ri { border-radius: 9px; box-shadow: none; }
.rail-item.active .ri { box-shadow: none; }
.rail-item:hover { background: #eef2f7; }
.rail-item:hover .ri { transform: none; }
.rail-badge { box-shadow: 0 0 0 2px #f7f9fc; animation: none; }
.rail-item::after { border-radius: 7px; }
.sp-ic { border-radius: 10px; box-shadow: none; }
.sp-search { border-radius: 8px; background: #f3f5f8; }
.sp-search:hover { box-shadow: none; }
.sp-item { border-radius: 8px; }
.sp-item .spi { border-radius: 8px; box-shadow: none; }
.sp-item:hover { background: #f1f4f8; }
.sp-item:hover .spi { transform: none; }
.sp-item.active { background: color-mix(in srgb, var(--mod, #1877f2) 11%, #fff); box-shadow: none; color: var(--text); }
.sp-count, .sp-pin { border-radius: 6px; box-shadow: none; }
.sp-pin { background: #fff; border: 1px solid var(--border); }
.sp-card { border-radius: 8px; }
.sp-card .sc-ic { border-radius: 8px; box-shadow: none; }
.sp-card:hover { transform: none; box-shadow: none; }
.sp-user .av { box-shadow: none; }
.sp-out, .sp-collapse { border-radius: 8px; }
.sp-row, .sp-quick .sp-item { animation: none; }
.cmd-box { border-radius: 12px; }
.cmd-item, .cmd-item .ci { border-radius: 8px; }
@media (min-width: 992px) { .content { padding-left: 1.5rem; padding-right: 1.5rem; } }

/* Search + hide-menu buttons share one row (the header has no room for the arrow) */
.sp-tools { display: flex; gap: .4rem; margin: 0 0 1rem; }
.sp-tools .sp-search { margin: 0; flex: 1; min-width: 0; }
.sp-tools .sp-search kbd { display: none; }
.sp-tools .sp-collapse { margin: 0; width: 36px; height: 36px; flex: none; background: #f3f5f8; border-radius: 8px; color: var(--muted); }
.sp-tools .sp-collapse:hover { background: #e6e9ee; color: var(--text); }
.sp-head .sp-collapse { margin-left: auto; }

/* Sidebar is static on load: no entrance pops/slides that look like a broken layout for a moment */
.sp-ic, .sp-row, .sp-quick .sp-item, .rail-badge { animation: none !important; }

