/* ============================================================================
   CountrPro — application shell
   A two-tier sidebar: a narrow always-dark icon rail of contexts (Business,
   Sales Channels, Reports, Search) and a nav panel showing the links for the
   selected context. Content keeps the MudBlazor theme; the chrome stays dark
   in both light and dark mode so the workspace reads the same all day.

   The sidebars are position:fixed so the document keeps its normal scroll —
   MudBlazor popovers anchor to the viewport and would drift inside a nested
   scroll container.
   ============================================================================ */

:root {
    --cp-rail-w: 56px;
    --cp-nav-w: 232px;
    --cp-rail-bg: #05070C;
    --cp-nav-bg: #0D1117;
    --cp-nav-border: rgba(255, 255, 255, 0.07);
    --cp-nav-text: #C2C8D4;
    --cp-nav-muted: #7A8194;
    --cp-nav-active: #232A38;
    --cp-accent: #6E7BFF;
}

/* ---- Rail --------------------------------------------------------------- */
.cp-rail {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: var(--cp-rail-w);
    z-index: 1101;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 10px 0 12px;
    background: var(--cp-rail-bg);
    transition: transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.cp-rail .cp-icon { font-size: 20px; }

.cp-rail__toggle,
.cp-rail__btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 9px;
    background: none;
    color: var(--cp-nav-muted);
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.cp-rail__toggle:hover,
.cp-rail__btn:hover { background: rgba(255, 255, 255, 0.07); color: #EDEFF4; }
.cp-rail__btn.active { color: #FFFFFF; background: rgba(110, 123, 255, 0.18); }
.cp-rail__btn .cp-icon { font-size: 18px; }

.cp-rail__sep {
    width: 26px;
    height: 1px;
    margin: 6px 0;
    background: rgba(255, 255, 255, 0.09);
}

.cp-rail__spacer { flex: 1 1 auto; }

.cp-rail__item {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    width: 100%;
    padding: 9px 2px;
    border: 0;
    background: none;
    color: #868D9E;
    font: inherit;
    cursor: pointer;
    transition: color 0.15s ease, background-color 0.15s ease;
}

.cp-rail__caption {
    font-size: 9.5px;
    line-height: 1.15;
    letter-spacing: -0.01em;
    text-align: center;
}

.cp-rail__item:hover { color: #E6E9F0; }

.cp-rail__item.active {
    color: #FFFFFF;
    background: linear-gradient(90deg, rgba(110, 123, 255, 0.16), transparent);
}

.cp-rail__item.active::before {
    content: "";
    position: absolute;
    left: 0;
    top: 6px;
    bottom: 6px;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: var(--cp-accent);
}

.cp-rail__avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    margin-top: 4px;
    border-radius: 50%;
    background: linear-gradient(135deg, #7C3AED, #C026D3);
    color: #FFFFFF;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

/* ---- Nav panel ---------------------------------------------------------- */
.cp-nav {
    position: fixed;
    top: 0;
    bottom: 0;
    left: var(--cp-rail-w);
    width: var(--cp-nav-w);
    z-index: 1100;
    display: flex;
    flex-direction: column;
    background: var(--cp-nav-bg);
    border-right: 1px solid var(--cp-nav-border);
    transition: transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.cp-shell--collapsed .cp-nav { transform: translateX(-100%); }

.cp-nav .cp-icon { font-size: 18px; }

.cp-nav__brand {
    display: flex;
    align-items: center;
    padding: 14px 16px 12px;
    border-bottom: 1px solid var(--cp-nav-border);
}

.cp-nav__org { padding: 14px 16px 8px; }

.cp-nav__org-name {
    overflow: hidden;
    color: #F2F4F8;
    font-size: 14.5px;
    font-weight: 650;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cp-nav__org-name::after {
    content: "";
    display: block;
    width: 26px;
    height: 2px;
    margin-top: 6px;
    border-radius: 2px;
    background: var(--cp-accent);
}

.cp-nav__branch {
    width: 100%;
    margin-top: 10px;
    padding: 6px 8px;
    border: 1px solid var(--cp-nav-border);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--cp-nav-text);
    font: inherit;
    font-size: 12.5px;
    cursor: pointer;
}

.cp-nav__branch option { background: #1A1F2A; color: #E6E9F0; }

.cp-nav__branch-static {
    margin-top: 6px;
    color: var(--cp-nav-muted);
    font-size: 12px;
}

.cp-nav__list {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 6px 8px 12px;
}

.cp-nav__list::-webkit-scrollbar { width: 6px; }
.cp-nav__list::-webkit-scrollbar-thumb { border-radius: 3px; background: rgba(255, 255, 255, 0.12); }

.cp-nav__link {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 10px;
    border: 0;
    border-radius: 8px;
    background: none;
    color: var(--cp-nav-text);
    font: inherit;
    font-size: 13.5px;
    font-weight: 500;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.14s ease, color 0.14s ease;
}

.cp-nav__link:hover { background: rgba(255, 255, 255, 0.05); color: #FFFFFF; }
.cp-nav__link.active { background: var(--cp-nav-active); color: #FFFFFF; }

.cp-nav__label {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cp-nav__chevron { flex: 0 0 auto; opacity: 0.55; }
.cp-nav__group.open { color: #FFFFFF; }
.cp-nav__children { padding: 2px 0 6px; }

.cp-nav__child {
    padding-left: 38px;
    color: #99A0B1;
    font-size: 13px;
    font-weight: 450;
}

.cp-nav__link--soon { color: #5C6375; cursor: default; }
.cp-nav__link--soon:hover { background: none; color: #5C6375; }

.cp-nav__badge {
    padding: 2px 6px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.07);
    color: #8A90A0;
    font-size: 9px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

/* The nav's own search panel lived here. Screen search moved into the global
   search overlay (.cp-gsearch in ui.css), which searches records too. */

/* ---- Plan card ---------------------------------------------------------- */
.cp-nav__plan {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 10px;
    padding: 12px 14px;
    border-radius: 12px;
    background: linear-gradient(135deg, #4F46E5, #7C3AED);
    color: #FFFFFF;
    font-size: 12.5px;
    line-height: 1.35;
    text-decoration: none;
}

.cp-nav__plan-cta { font-weight: 600; opacity: 0.92; }
.cp-nav__plan:hover { filter: brightness(1.06); }

/* Same card without a contact route configured — nothing to click, so nothing
   should look clickable. */
.cp-nav__plan--static { cursor: default; }
.cp-nav__plan--static:hover { filter: none; }

/* ---- Content ------------------------------------------------------------ */
.cp-main {
    min-height: 100vh;
    margin-left: calc(var(--cp-rail-w) + var(--cp-nav-w));
    padding: 24px 28px 56px;
    transition: margin-left 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.cp-shell--collapsed .cp-main { margin-left: var(--cp-rail-w); }

/* ---- Rail popovers ------------------------------------------------------ */
.cp-account { padding: 10px 16px 8px; }
.cp-account__name { font-size: 13.5px; font-weight: 600; }
.cp-account__role { color: var(--cp-text-2); font-size: 11.5px; }

.cp-alerts { min-width: 260px; max-width: 320px; padding: 4px 0; }
.cp-alerts__head { padding: 6px 14px 8px; font-size: 12px; font-weight: 600; }
.cp-alerts__empty { padding: 8px 14px 12px; color: var(--cp-text-2); font-size: 12.5px; }

.cp-alerts__row {
    display: flex;
    gap: 10px;
    padding: 8px 14px;
    border-top: 1px solid var(--cp-line);
}

.cp-alerts__msg { font-size: 12.5px; }
.cp-alerts__time { color: var(--cp-text-2); font-size: 11px; }
.cp-alerts__row .cp-icon { color: var(--cp-warning); }

/* Unread count sitting on the notifications icon. */
.cp-railbadge { position: relative; display: inline-flex; }

.cp-railbadge__dot {
    position: absolute;
    top: -5px;
    right: -7px;
    min-width: 15px;
    height: 15px;
    padding: 0 4px;
    border-radius: 999px;
    background: var(--cp-critical);
    color: #FFFFFF;
    font-size: 10px;
    font-weight: 650;
    line-height: 15px;
    text-align: center;
}

/* ---- Mobile: sidebars slide over the content ---------------------------- */
.cp-shell__mobile-toggle {
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 1102;
    display: none;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border: 1px solid var(--cp-line);
    border-radius: 10px;
    background: var(--cp-surface);
    color: var(--cp-text);
    cursor: pointer;
}

.cp-shell__scrim {
    position: fixed;
    inset: 0;
    z-index: 1099;
    display: none;
    background: rgba(0, 0, 0, 0.45);
}

@media (max-width: 960px) {
    .cp-rail { transform: translateX(-100%); }
    .cp-nav { transform: translateX(calc(-1 * (var(--cp-rail-w) + var(--cp-nav-w)))); }
    .cp-shell--mobile-open .cp-rail { transform: none; }
    .cp-shell--mobile-open .cp-nav { transform: none; }
    .cp-shell--mobile-open .cp-shell__scrim { display: block; }
    .cp-shell__mobile-toggle { display: flex; }
    .cp-main,
    .cp-shell--collapsed .cp-main { margin-left: 0; padding: 62px 16px 40px; }
}

/* ---- Print: chrome off, content full-bleed (label sheets, reports) ------ */
@media print {
    .cp-rail,
    .cp-nav,
    .cp-shell__mobile-toggle,
    .cp-shell__scrim { display: none !important; }

    .cp-main,
    .cp-shell--collapsed .cp-main { margin-left: 0 !important; padding: 0 !important; }
}
