/* ═══════════════════════════════════════════════════════════
   Navigation — extracted from TNonline (Sidebar / MainLayout)
   Dark vertical sidebar: brand, section labels, nav items with
   icons, active/hover states, and a user footer. Built to sit
   in a fixed-width column (var(--tn-sidebar-width)).
   ═══════════════════════════════════════════════════════════ */

.tn-sidebar {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: var(--tn-sidebar-width);
    background-color: var(--tn-sidebar-bg);
    color: var(--tn-text-on-dark);
    font-family: var(--tn-font-family);
}

/* ── Brand ── */
.tn-sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 28px 22px 20px;
}

/* On phones the sidebar is used as a full-width top bar / drawer, not a
   252px column. Without this it stays 252px wide inside a full-width
   container, so a `margin-left:auto` toggler lands mid-screen instead of
   the corner (the "off-center hamburger"). Fill the width and sit the
   brand row on the page gutter so the toggler aligns to the screen edge. */
@media (max-width: 640px) {
    .tn-sidebar {
        width: 100%;
    }

    .tn-sidebar-brand {
        padding: 16px var(--tn-page-pad-x);
    }
}

.tn-brand-text {
    font-size: var(--tn-font-size-lg);
    font-weight: 700;
    color: var(--tn-text-on-dark-bright);
    letter-spacing: -0.01em;
}

/* ── Section labels ── */
.tn-nav-label {
    padding: 24px 22px 6px;
    font-size: 0.625rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: rgba(255, 255, 255, 0.28);
}

.tn-nav-section {
    display: flex;
    flex-direction: column;
}

/* ── Nav items ── */
.tn-nav-item {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 9px 22px;
    margin: 1px 10px;
    color: var(--tn-text-on-dark);
    text-decoration: none;
    font-size: var(--tn-font-size-sm);
    font-weight: 400;
    transition: background 0.12s ease, color 0.12s ease;
    cursor: pointer;
    border: none;
    background: none;
    border-radius: 5px;
    font-family: inherit;
    width: calc(100% - 20px);
    box-sizing: border-box;
}

.tn-nav-item:hover {
    background: var(--tn-sidebar-hover);
    color: var(--tn-text-on-dark-bright);
    text-decoration: none;
}

.tn-nav-item:focus-visible {
    outline: none;
    box-shadow: inset 0 0 0 2px var(--tn-accent);
}

.tn-nav-item.is-active {
    background: var(--tn-sidebar-active);
    color: #fff;
    font-weight: 500;
}

.tn-nav-item i {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    width: 20px;
    min-width: 20px;
    flex-shrink: 0;
    opacity: 0.55;
}

.tn-nav-item:hover i,
.tn-nav-item.is-active i {
    opacity: 1;
}

.tn-nav-item span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tn-sidebar-spacer {
    flex: 1;
}

/* ── User footer ── */
.tn-sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 22px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.tn-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background: var(--tn-accent);
    color: var(--tn-accent-contrast, #fff);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    flex-shrink: 0;
}

.tn-user-info {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.tn-user-name {
    font-size: var(--tn-font-size-sm);
    font-weight: 500;
    color: var(--tn-text-on-dark-bright);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tn-user-email {
    font-size: var(--tn-font-size-xs);
    color: rgba(255, 255, 255, 0.35);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 1px;
}

/* ── Light variant ──
   .tn-sidebar above is app-level dark chrome (the full-height, always-
   present sidebar). This variant is the same column shape on a light
   surface instead, for two different use cases:
     - an IN-PAGE column beside content (a Settings sub-nav, an Orders
       filter rail) — pair it with lists.css for the rows (.tn-list--flush
       + .tn-list-item--action + .tn-list-item-trail + .is-active).
     - app-level chrome itself in light (a full sidebar built from
       .tn-nav-item rows, brand, and user footer) — the overrides below
       repaint .tn-nav-item/.tn-nav-label/.tn-user-email/etc. for this
       surface, since their default colors (white-alpha overlays, #fff
       active text) are tuned for the dark chrome and invisible here.
   This declaration itself is only the column (background, width,
   border) either way. */
.tn-sidebar--light {
    display: flex;
    flex-direction: column;
    width: var(--tn-sidebar-width);
    background: var(--tn-bg-card);
    color: var(--tn-text-primary);
    border-right: 1px solid var(--tn-border);
}

@media (max-width: 640px) {
    .tn-sidebar--light {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--tn-border);
    }
}

/* Nav items inside a light sidebar — for the OTHER case: app-level chrome
   (brand + section labels + nav rows + user footer) that needs to be
   light, not just an in-page column. .tn-nav-item's dark-chrome hover/
   active/label/footer colors (white-alpha overlays, #fff active text)
   are invisible on this surface, so this reuses the pair lists.css
   already established for a light interactive row — hover ->
   --tn-bg-hover, active -> --tn-accent-light bg / --tn-accent text —
   instead of inventing new values. Structure, icons, and truncation are
   untouched; only color changes. Found missing by colibriauth-coder
   (ColibriAuth's portal sidebar is .tn-nav-item-built app chrome, wanted
   light) after first asking for this variant for the in-page case above;
   additive, so the lists.css pairing documented above still works
   unchanged for products already using it that way. */
.tn-sidebar--light .tn-brand-text,
.tn-sidebar--light .tn-user-name {
    color: var(--tn-text-primary);
}

.tn-sidebar--light .tn-nav-label,
.tn-sidebar--light .tn-user-email {
    color: var(--tn-text-secondary);
}

.tn-sidebar--light .tn-sidebar-user {
    border-top: 1px solid var(--tn-border);
}

.tn-sidebar--light .tn-nav-item {
    color: var(--tn-text-primary);
}

.tn-sidebar--light .tn-nav-item:hover {
    background: var(--tn-bg-hover);
    color: var(--tn-text-primary);
}

.tn-sidebar--light .tn-nav-item.is-active {
    background: var(--tn-accent-light);
    color: var(--tn-accent);
}

/* ── Horizontal tab nav (page-level sub-navigation) ── */
.tn-tabs {
    display: flex;
    gap: 2px;
    border-bottom: 1px solid var(--tn-border);
}

.tn-tab {
    padding: 10px 16px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--tn-text-secondary);
    font-size: var(--tn-font-size-sm);
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: color var(--tn-transition), border-color var(--tn-transition);
}

.tn-tab:hover {
    color: var(--tn-text-primary);
}

.tn-tab.is-active {
    color: var(--tn-accent);
    border-bottom-color: var(--tn-accent);
}
