/* 2026-05-28: only the fleet-wide AUTO-INJECTOR (shared-topnav.js) was retired —
   THIS STYLESHEET IS STILL LIVE and load-bearing. It is the canonical company-navbar
   look, now consumed by tools that EMBED the navbar themselves (opt-in, static markup;
   e.g. Mail's #ttnav). Do not delete. Standard: techtools-4/.claude/rules/company-navbar.md
   The :root{--tt-topnav-h:0px} below is a SAFE DEFAULT for pages that load this CSS but
   render no navbar (so var(--tt-topnav-h,…) collapses to a top:0/100vh layout). A tool that
   does embed the navbar overrides it (seed in its own :root loaded after this file, then
   publish the measured px on <html> at runtime). */
:root {
    --tt-topnav-h: 0px;
    /* z-index layer contract (company-navbar standard §7b) — AS CODE, not just doc.
       Declared on :root (not .tt-scope) so a TOOL'S OWN stylesheet can build its
       overlays on top of the documented layers instead of guessing magic numbers:
           .my-modal-overlay { z-index: calc(var(--tt-z-modal, 1000) + 10); }
           .my-toast         { z-index: calc(var(--tt-z-toast, 1100) + 100); }
       Ladder: navbar 900 · in-bar dropdowns 200 · shared modal 1000 · shared toast 1100. */
    --tt-z-navbar: 900;
    --tt-z-dropdown: 200;
    --tt-z-modal: 1000;
    --tt-z-toast: 1100;
}

/* ============================================================================
   TechTools Shared Top Navbar — drop-in, sticky, theme-independent.
   ----------------------------------------------------------------------------
   One sticky navbar (brand · product · Tools/search · actions · account) shared
   by EVERY tool and by Mail, so the chrome is identical everywhere. Since v2
   (2026-06-07) markup + behaviour are rendered by /tt-navbar.js into an explicit
   tool-placed `<nav data-tt-navbar>` placeholder (.claude/rules/navbar-v2-design.md);
   this file is the ONE canonical stylesheet, for the homepage and tools alike.

   Isolation: every rule is scoped under `.tt-scope` (the class on the tool's
   <nav> placeholder and the overlays host), and the TechTools brand palette is
   re-declared on `.tt-scope` so the navbar looks the same regardless of the host
   tool's own theme/variables. The ONLY rule that touches the page outside the
   component is `body.tt-modal-open { overflow:hidden }`.
   ============================================================================ */

.tt-scope {
    /* Brand palette — pinned so a tool's own --vars never bleed into the navbar */
    --primary-bg: #0a0a0f;
    --secondary-bg: #1a1a24;
    --card-bg: #232338;
    --accent-primary: #6366f1;
    --accent-secondary: #8b5cf6;
    --accent-tertiary: #06b6d4;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --border: #334155;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --glow: 0 0 20px rgba(99, 102, 241, 0.3);
    --transition-fast: 0.15s ease;
    --transition-base: 0.3s ease;

    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--text-primary);
}
.tt-scope, .tt-scope *, .tt-scope *::before, .tt-scope *::after { box-sizing: border-box; }
.tt-scope .hidden { display: none !important; }

/* ---------------------------------------------------------------------------
   1. TOP NAVBAR
   --------------------------------------------------------------------------- */
.tt-scope.topnav {
    position: sticky;          /* sticks across the page scroll, no body padding hack */
    top: 0;
    z-index: var(--tt-z-navbar, 900);
    background: rgba(10, 10, 15, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    width: 100%;
}

.tt-scope .topnav-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 56px;
}

.tt-scope .topnav-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 700;
    font-size: 1rem;
    line-height: 1;
    min-height: 44px;
    padding: 6px 10px 6px 6px;
    border-radius: 10px;
    transition: background var(--transition-base);
    flex-shrink: 0;
}
.tt-scope .topnav-brand:hover { background: rgba(255, 255, 255, 0.05); }
.tt-scope .topnav-brand-img { display: block; height: 32px; width: auto; }
.tt-scope .topnav-brand-name {
    font-weight: 800;
    font-size: 1.2rem;
    letter-spacing: -0.02em;
    line-height: 1;
    white-space: nowrap;
    color: var(--text-primary);
}

.tt-scope .topnav-links {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: 4px;
    flex-shrink: 0;
}

.tt-scope .topnav-search {
    position: relative;
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 0;
    max-width: 460px;
    margin: 0 8px;
}
.tt-scope .topnav-search-icon {
    position: absolute;
    left: 12px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    pointer-events: none;
    transition: color var(--transition-base);
}
.tt-scope .topnav-search-input {
    width: 100%;
    min-height: 44px;
    padding: 8px 40px 8px 36px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: inherit;
    outline: none;
    transition: background var(--transition-base), border-color var(--transition-base), box-shadow var(--transition-base);
}
.tt-scope .topnav-search-input::placeholder { color: var(--text-secondary); opacity: 0.7; }
.tt-scope .topnav-search-input:focus {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}
.tt-scope .topnav-search:focus-within .topnav-search-icon { color: var(--accent-primary); }
.tt-scope .topnav-search-clear {
    position: absolute;
    right: 8px;
    background: none;
    border: 0;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 6px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: color var(--transition-base), background var(--transition-base);
}
.tt-scope .topnav-search-clear:hover { color: var(--text-primary); background: rgba(255, 255, 255, 0.1); }

.tt-scope .topnav-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    padding: 8px 12px;
    min-height: 44px;
    border-radius: 10px;
    transition: background var(--transition-base), color var(--transition-base);
    white-space: nowrap;
}
.tt-scope .topnav-link i { font-size: 0.95rem; }
.tt-scope .topnav-link:hover { background: rgba(255, 255, 255, 0.05); color: var(--text-primary); }

.tt-scope .topnav-account { margin-left: auto; position: relative; flex-shrink: 0; }

.tt-scope .topnav-signin {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: #fff;
    border: 0;
    padding: 10px 16px;
    min-height: 44px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: transform var(--transition-base), box-shadow var(--transition-base);
}
.tt-scope .topnav-signin:hover { transform: translateY(-1px); box-shadow: var(--glow); }
.tt-scope .topnav-signin:active { transform: translateY(0); }

.tt-scope .topnav-user-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 6px 10px 6px 6px;
    min-height: 44px;
    border-radius: 999px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: background var(--transition-base), border-color var(--transition-base);
}
.tt-scope .topnav-user-btn:hover { background: rgba(255, 255, 255, 0.08); border-color: var(--accent-primary); }

.tt-scope .topnav-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.78rem;
    letter-spacing: 0.5px;
    flex-shrink: 0;
}
.tt-scope .topnav-user-name {
    font-size: 0.9rem;
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.tt-scope .topnav-user-caret { font-size: 0.7rem; color: var(--text-secondary); transition: transform var(--transition-base); }
.tt-scope .topnav-user-btn[aria-expanded="true"] .topnav-user-caret { transform: rotate(180deg); }

.tt-scope .topnav-user-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 260px;
    background: var(--secondary-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 8px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: opacity var(--transition-base), transform var(--transition-base), visibility var(--transition-base);
    z-index: var(--tt-z-dropdown, 200);
}
.tt-scope .topnav-user-menu.open { opacity: 1; visibility: visible; transform: translateY(0); }

.tt-scope .topnav-user-info { padding: 10px 12px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.tt-scope .topnav-user-info-name {
    color: var(--text-primary); font-weight: 600; font-size: 0.95rem;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tt-scope .topnav-user-info-email {
    color: var(--text-secondary); font-size: 0.8rem; margin-top: 2px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Optional section label (used by Mail's mailbox switcher slot) */
.tt-scope .topnav-menu-section-label {
    color: var(--text-secondary);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 6px 12px 4px;
}

.tt-scope .topnav-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    background: transparent;
    border: 0;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.9rem;
    font-family: inherit;
    padding: 10px 12px;
    min-height: 44px;
    border-radius: 8px;
    cursor: pointer;
    text-align: left;
    transition: background var(--transition-base);
}
.tt-scope .topnav-menu-item i { width: 18px; text-align: center; color: var(--text-secondary); }
.tt-scope .topnav-menu-item:hover { background: rgba(255, 255, 255, 0.06); }
.tt-scope .topnav-menu-item:hover i { color: var(--accent-primary); }
.tt-scope .topnav-menu-item-danger { color: var(--danger); }
.tt-scope .topnav-menu-item-danger i { color: var(--danger); }
.tt-scope .topnav-menu-item-danger:hover { background: rgba(239, 68, 68, 0.1); }
.tt-scope .topnav-menu-divider { height: 1px; background: var(--border); margin: 6px 4px; }

/* Phone hamburger — the single account/links menu trigger on small screens.
   Folds Contact/Mail + the account actions into one dropdown so the search input
   keeps the row width. Hidden on desktop (shown in the ≤600px block below). */
.tt-scope .topnav-menu-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    color: var(--text-primary);
    width: 44px;
    min-height: 44px;
    border-radius: 10px;
    cursor: pointer;
    flex-shrink: 0;
    transition: background var(--transition-base), border-color var(--transition-base);
}
.tt-scope .topnav-menu-toggle:hover { background: rgba(255, 255, 255, 0.08); border-color: var(--accent-primary); }
.tt-scope .topnav-menu-toggle i { font-size: 1.05rem; }

/* Contact/Mail folded into the dropdown — shown on phone only (desktop keeps the
   flat .topnav-links row); see the ≤600px block. */
.tt-scope .topnav-menu-links { display: none; }

/* Auth-state visibility inside the ONE shared dropdown: the user header, account
   actions and any tool extras show only when signed in; the in-menu Sign In shows
   only when signed out. .tt-authed is toggled by setUser() in tt-navbar.js. */
.tt-scope .topnav-user-menu:not(.tt-authed) .topnav-menu-authed,
.tt-scope .topnav-user-menu:not(.tt-authed) .topnav-user-info,
.tt-scope .topnav-user-menu:not(.tt-authed) #topnav-menu-extras,
.tt-scope .topnav-user-menu.tt-authed .topnav-menu-anon { display: none; }

/* Mobile navbar: collapse labels to icons so the search keeps a usable width.
   Verified at 360 / 375 / 390 px viewports. */
@media (max-width: 600px) {
    .tt-scope .topnav-inner { padding: 8px 10px; gap: 4px; }
    .tt-scope .topnav-brand span { display: none; }
    .tt-scope .topnav-brand { padding: 4px 8px; min-width: 44px; justify-content: center; }
    .tt-scope .topnav-link span { display: none; }
    .tt-scope .topnav-link { padding: 8px 10px; min-width: 44px; justify-content: center; }
    .tt-scope .topnav-user-name { max-width: 90px; }
    .tt-scope .topnav-search { margin: 0; }
    .tt-scope .topnav-search-input { padding-left: 32px; padding-right: 36px; font-size: 0.85rem; }
    .tt-scope .topnav-search-icon { left: 10px; }
    /* Phone: the account cluster collapses into the single hamburger dropdown.
       The flat Contact/Mail links + the desktop sign-in/avatar pills give way; the
       links reappear inside the menu and the search keeps the freed width. Scoped
       via :has(.topnav-menu-toggle) so it only affects shared-auth pages (the
       hamburger only exists there) — account:'none' tools are untouched. */
    .tt-scope .topnav-menu-toggle { display: inline-flex; }
    .tt-scope .topnav-inner:has(.topnav-menu-toggle) .topnav-links,
    .tt-scope .topnav-inner:has(.topnav-menu-toggle) .topnav-user,
    .tt-scope .topnav-inner:has(.topnav-menu-toggle) .topnav-signin { display: none; }
    .tt-scope .topnav-menu-links { display: block; }
    .tt-scope .topnav-menu-links:not(:empty) {
        border-bottom: 1px solid var(--border);
        margin-bottom: 6px;
        padding-bottom: 6px;
    }
    .tt-scope .topnav-user-menu { max-width: calc(100vw - 20px); }
}
@media (max-width: 420px) {
    .tt-scope .topnav-signin span { display: none; }
    .tt-scope .topnav-signin { padding: 10px 12px; min-width: 44px; justify-content: center; }
}
@media (max-width: 380px) {
    .tt-scope .topnav-user-name { display: none; }
    .tt-scope .topnav-search-input::placeholder { font-size: 0.8rem; }
}

/* ---------------------------------------------------------------------------
   2. MODALS (Auth + Account)
   --------------------------------------------------------------------------- */
body.tt-modal-open { overflow: hidden; }

.tt-scope .tt-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(2, 4, 14, 0.7);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: var(--tt-z-modal, 1000);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 0;
}
.tt-scope .tt-modal {
    background: var(--secondary-bg);
    border: 1px solid var(--border);
    border-radius: 16px 16px 0 0;
    width: 100%;
    max-width: 520px;
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: ttModalSlideUp 0.25s ease;
}
@keyframes ttModalSlideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
.tt-scope .tt-modal-header {
    padding: 16px 18px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.tt-scope .tt-modal-header h2 {
    font-size: 1.1rem; font-weight: 600; color: var(--text-primary);
    display: flex; align-items: center; gap: 10px; margin: 0;
}
.tt-scope .tt-modal-header h2 i { color: var(--accent-primary); }
.tt-scope .tt-modal-close {
    background: transparent; border: 0; color: var(--text-secondary);
    font-size: 1.1rem; width: 36px; height: 36px; border-radius: 8px; cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
    transition: background var(--transition-base);
}
.tt-scope .tt-modal-close:hover { background: rgba(255, 255, 255, 0.08); color: var(--text-primary); }
.tt-scope .tt-modal-body { padding: 18px; overflow-y: auto; flex: 1; }
.tt-scope .tt-modal-footer {
    padding: 14px 18px; border-top: 1px solid var(--border);
    display: flex; justify-content: flex-end; gap: 10px;
}

.tt-scope .tt-auth-tabs {
    display: flex; flex-wrap: wrap; gap: 6px;
    background: rgba(255, 255, 255, 0.04); padding: 4px; border-radius: 10px; margin-bottom: 18px;
}
.tt-scope .tt-auth-tab {
    flex: 1; background: transparent; border: 0; color: var(--text-secondary);
    padding: 10px 8px; min-height: 44px; border-radius: 8px; font-size: 0.85rem; font-weight: 500;
    cursor: pointer; font-family: inherit;
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    transition: background var(--transition-base), color var(--transition-base);
}
.tt-scope .tt-auth-tab i { font-size: 0.85rem; }
.tt-scope .tt-auth-tab.active {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: #fff; box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}
.tt-scope .tt-auth-pane { display: none; }
.tt-scope .tt-auth-pane.active { display: block; }
@media (max-width: 480px) { .tt-scope .tt-auth-tab { flex: 1 1 calc(50% - 3px); } }

.tt-scope .tt-addr-group { display: flex; align-items: stretch; }
.tt-scope .tt-addr-group input { border-top-right-radius: 0; border-bottom-right-radius: 0; min-width: 0; }
.tt-scope .tt-addr-suffix {
    display: flex; align-items: center; padding: 0 12px; white-space: nowrap;
    background: rgba(255, 255, 255, 0.04); border: 1px solid var(--border); border-left: 0;
    border-top-right-radius: 8px; border-bottom-right-radius: 8px;
    color: var(--text-secondary); font-size: 0.85rem;
}
.tt-scope .tt-hp-field { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

.tt-scope .tt-auth-blurb { color: var(--text-secondary); font-size: 0.9rem; line-height: 1.5; margin-bottom: 16px; }

.tt-scope .tt-form-group { margin-bottom: 12px; }
.tt-scope .tt-form-group label {
    display: block; color: var(--text-secondary); font-size: 0.82rem; margin-bottom: 6px; font-weight: 500;
}
.tt-scope .tt-form-group input {
    width: 100%; background: var(--card-bg); border: 1px solid var(--border); color: var(--text-primary);
    padding: 11px 12px; min-height: 44px; border-radius: 8px; font-size: 0.95rem; font-family: inherit;
    transition: border-color var(--transition-base), box-shadow var(--transition-base);
}
.tt-scope .tt-form-group input:focus {
    outline: none; border-color: var(--accent-primary); box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}
.tt-scope .tt-muted { color: var(--text-secondary); font-weight: 400; font-size: 0.78rem; }

.tt-scope .tt-form-divider {
    text-align: center; margin: 18px 0 12px; position: relative;
    color: var(--text-secondary); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em;
}
.tt-scope .tt-form-divider::before, .tt-scope .tt-form-divider::after {
    content: ""; position: absolute; top: 50%; width: calc(50% - 60px); height: 1px; background: var(--border);
}
.tt-scope .tt-form-divider::before { left: 0; }
.tt-scope .tt-form-divider::after { right: 0; }

.tt-scope .tt-auth-error { color: var(--danger); font-size: 0.85rem; margin-top: 10px; min-height: 18px; line-height: 1.4; }

/* Standard terms notice — required next to every account-creation CTA (Critical
   Rule 7.4): creating an account (incl. one-click Quick Start) = agreeing to the
   rules. Same look as the homepage's un-scoped .tt-terms-note in styles.css. */
.tt-scope .tt-terms-note { color: var(--text-secondary); font-size: 0.78rem; line-height: 1.5; text-align: center; margin-top: 12px; }
.tt-scope .tt-terms-note a { color: var(--accent-primary); text-decoration: underline; text-underline-offset: 2px; }
.tt-scope .tt-terms-note a:hover { color: var(--accent-secondary); }

.tt-scope .tt-account-meta {
    background: var(--card-bg); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px;
}
.tt-scope .tt-account-meta-row { display: flex; justify-content: space-between; align-items: center; padding: 4px 0; font-size: 0.85rem; }
.tt-scope .tt-account-meta-label { color: var(--text-secondary); }
.tt-scope .tt-account-meta-value { color: var(--text-primary); font-weight: 500; }

.tt-scope .tt-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0;
    padding: 11px 18px; min-height: 44px; border-radius: 10px; font-size: 0.92rem; font-weight: 600;
    cursor: pointer; font-family: inherit;
    transition: transform var(--transition-base), box-shadow var(--transition-base), background var(--transition-base);
}
.tt-scope .tt-btn-primary { background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary)); color: #fff; }
.tt-scope .tt-btn-primary:hover { transform: translateY(-1px); box-shadow: var(--glow); }
.tt-scope .tt-btn-ghost { background: transparent; border: 1px solid var(--border); color: var(--text-primary); }
.tt-scope .tt-btn-ghost:hover { background: rgba(255, 255, 255, 0.05); }
.tt-scope .tt-btn-block { width: 100%; }

@media (min-width: 600px) {
    .tt-scope .tt-modal-overlay { align-items: center; padding: 16px; }
    .tt-scope .tt-modal { border-radius: 16px; max-height: 90vh; }
}

/* ---------------------------------------------------------------------------
   3. TOASTS
   --------------------------------------------------------------------------- */
.tt-scope.tt-toast-container,
.tt-scope .tt-toast-container {
    position: fixed; bottom: 16px; right: 16px; z-index: var(--tt-z-toast, 1100);
    display: flex; flex-direction: column; align-items: flex-end; gap: 10px;
    pointer-events: none; max-width: calc(100vw - 32px);
}
.tt-scope .tt-toast {
    pointer-events: auto; background: var(--secondary-bg); border: 1px solid var(--border); color: var(--text-primary);
    padding: 12px 14px; border-radius: 10px; display: flex; align-items: center; gap: 10px; font-size: 0.9rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4); transform: translateX(20px); opacity: 0;
    transition: opacity 0.25s ease, transform 0.25s ease; max-width: 360px;
}
.tt-scope .tt-toast.show { transform: translateX(0); opacity: 1; }
.tt-scope .tt-toast i { font-size: 1rem; }
.tt-scope .tt-toast-success { border-left: 3px solid var(--success); }
.tt-scope .tt-toast-success i { color: var(--success); }
.tt-scope .tt-toast-error { border-left: 3px solid var(--danger); }
.tt-scope .tt-toast-error i { color: var(--danger); }
.tt-scope .tt-toast-info { border-left: 3px solid var(--accent-tertiary); }
.tt-scope .tt-toast-info i { color: var(--accent-tertiary); }
.tt-scope .tt-toast-credentials {
    flex-direction: column; align-items: stretch; padding: 16px 18px 14px;
    border: 1px solid var(--warning); border-left: 4px solid var(--warning); background: #15151f;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(245, 158, 11, 0.15);
    position: relative; max-width: 360px; gap: 6px;
}
.tt-scope .tt-toast-cred-title { font-weight: 600; color: var(--warning); display: flex; align-items: center; gap: 8px; margin-bottom: 4px; font-size: 0.95rem; }
.tt-scope .tt-toast-cred-title i { color: var(--warning); }
.tt-scope .tt-toast-cred-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 0.85rem; }
.tt-scope .tt-toast-cred-row span { color: var(--text-secondary); }
.tt-scope .tt-toast-cred-row code {
    background: rgba(0, 0, 0, 0.3); border: 1px solid var(--border); padding: 3px 8px; border-radius: 6px;
    color: var(--text-primary); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.85rem; user-select: all;
}
.tt-scope .tt-toast-cred-hint { color: var(--text-secondary); font-size: 0.75rem; margin-top: 4px; }
.tt-scope .tt-toast-close {
    position: absolute; top: 6px; right: 8px; background: transparent; border: 0; color: var(--text-secondary);
    font-size: 1.2rem; cursor: pointer; line-height: 1; padding: 4px 8px; border-radius: 6px;
}
.tt-scope .tt-toast-close:hover { background: rgba(255, 255, 255, 0.08); color: var(--text-primary); }

@media (prefers-reduced-motion: reduce) {
    .tt-scope .tt-modal { animation: none; }
    .tt-scope .tt-toast { transition: opacity 0.2s ease; transform: none; }
}

/* ---------------------------------------------------------------------------
   3. TOOL-NAV — the shared "Tools" sections menu + tool search with preview
      suggestions, mounted by /shared-tool-nav.js (bump both ?v= together).
   --------------------------------------------------------------------------- */
.tt-scope .topnav-toolnav { position: relative; flex-shrink: 0; margin-left: 4px; }
.tt-scope .topnav-tools-btn {
    display: inline-flex; align-items: center; gap: 8px;
    background: none; border: 0; cursor: pointer;
    color: var(--text-secondary); font-family: inherit;
    font-weight: 500; font-size: 0.9rem; white-space: nowrap;
    padding: 8px 12px; min-height: 44px; border-radius: 10px;
    transition: background var(--transition-base), color var(--transition-base);
}
.tt-scope .topnav-tools-btn:hover { background: rgba(255, 255, 255, 0.05); color: var(--text-primary); }
.tt-scope .topnav-tools-btn .tools-caret { font-size: 0.7rem; opacity: 0.7; }

/* Sections menu — same dropdown language as .topnav-user-menu, just wider. */
.tt-scope .topnav-tools-menu {
    position: absolute; top: calc(100% + 8px); left: 0;
    width: min(620px, calc(100vw - 24px));
    max-height: min(70vh, 640px); overflow-y: auto;
    background: var(--secondary-bg); border: 1px solid var(--border);
    border-radius: 12px; padding: 10px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
    opacity: 0; visibility: hidden; transform: translateY(-6px);
    transition: opacity var(--transition-base), transform var(--transition-base), visibility var(--transition-base);
    z-index: var(--tt-z-dropdown, 200);
}
.tt-scope .topnav-tools-menu.open { opacity: 1; visibility: visible; transform: translateY(0); }
.tt-scope .tools-menu-head {
    display: flex; align-items: center; gap: 8px;
    padding: 10px 8px 6px; color: var(--text-secondary);
    font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
}
.tt-scope .tools-menu-head i { color: var(--accent-primary); font-size: 0.8rem; width: 16px; text-align: center; }
.tt-scope .tools-menu-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 2px; }
.tt-scope .tools-menu-item {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 10px; min-height: 44px; border-radius: 8px;
    color: var(--text-primary); text-decoration: none; font-size: 0.88rem;
    transition: background var(--transition-base);
}
.tt-scope .tools-menu-item:hover { background: rgba(255, 255, 255, 0.06); }
.tt-scope .tmi-icon {
    flex: none; width: 30px; height: 30px; border-radius: 8px;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--accent-primary); color: #fff; font-size: 0.8rem;
}
.tt-scope .tmi-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Search PREVIEW suggestions — icon bubble + name + description + category. */
.tt-scope .topnav-search-results {
    position: absolute; top: calc(100% + 8px); left: 0;
    width: min(520px, calc(100vw - 24px)); min-width: 100%;
    max-height: min(60vh, 520px); overflow-y: auto;
    background: var(--secondary-bg); border: 1px solid var(--border);
    border-radius: 12px; padding: 6px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
    opacity: 0; visibility: hidden; transform: translateY(-6px);
    transition: opacity var(--transition-base), transform var(--transition-base), visibility var(--transition-base);
    z-index: var(--tt-z-dropdown, 200);
}
.tt-scope .topnav-search-results.open { opacity: 1; visibility: visible; transform: translateY(0); }
.tt-scope .search-result {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 10px; min-height: 48px; border-radius: 8px;
    color: var(--text-primary); text-decoration: none;
    transition: background var(--transition-base);
}
.tt-scope .search-result:hover, .tt-scope .search-result.active { background: rgba(255, 255, 255, 0.06); }
.tt-scope .sr-icon {
    flex: none; width: 36px; height: 36px; border-radius: 9px;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--accent-primary); color: #fff; font-size: 0.95rem;
}
.tt-scope .sr-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.tt-scope .sr-name { font-size: 0.9rem; font-weight: 600; }
.tt-scope .sr-desc {
    font-size: 0.78rem; color: var(--text-secondary);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tt-scope .sr-cat {
    flex: none; font-size: 0.68rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
    color: var(--text-secondary); border: 1px solid var(--border);
    border-radius: 999px; padding: 3px 8px;
}
.tt-scope .sr-all {
    color: var(--accent-primary); font-size: 0.85rem; font-weight: 600;
    border-top: 1px solid var(--border); border-radius: 0 0 8px 8px; margin-top: 4px;
}
.tt-scope .sr-all i { width: 36px; text-align: center; }
.tt-scope .sr-empty { padding: 12px 10px 6px; color: var(--text-secondary); font-size: 0.85rem; }

/* The phone search toggle (shared-tool-nav.js) — hidden on desktop, where the
   inline input shows instead. */
.tt-scope .topnav-search-toggle {
    display: none; align-items: center; justify-content: center;
    background: none; border: 0; cursor: pointer;
    color: var(--text-secondary); font-size: 0.95rem;
    padding: 8px 10px; min-width: 44px; min-height: 44px; border-radius: 10px;
    transition: background var(--transition-base), color var(--transition-base);
}
.tt-scope .topnav-search-toggle:hover { background: rgba(255, 255, 255, 0.05); color: var(--text-primary); }

/* Phones: Tools collapses to its icon, and the inline search collapses to the
   toggle above — there's no row space next to the account cluster at 390px.
   Tapping the toggle expands the search as a full-width sheet under the navbar
   (.expanded); the results panel anchors inside that fixed sheet. The Tools
   menu becomes a full-width sheet too. */
@media (max-width: 600px) {
    .tt-scope .topnav-tools-btn .tools-label, .tt-scope .topnav-tools-btn .tools-caret { display: none; }
    .tt-scope .topnav-tools-btn { padding: 8px 10px; min-width: 44px; justify-content: center; }
    .tt-scope .topnav-toolnav { margin-left: 0; }
    .tt-scope .topnav-search-toggle { display: inline-flex; }
    .tt-scope .topnav-toolsearch { display: none; }
    .tt-scope .topnav-toolsearch.expanded {
        display: flex; position: fixed; left: 8px; right: 8px;
        top: calc(var(--tt-topnav-h, 56px) + 6px);
        margin: 0; max-width: none; z-index: var(--tt-z-dropdown, 200);
    }
    /* The sheet floats over page content — the navbar input's translucent
       background isn't enough there; make it solid + lifted. */
    .tt-scope .topnav-toolsearch.expanded .topnav-search-input {
        background: var(--secondary-bg);
        border-color: var(--accent-primary);
        box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
    }
    .tt-scope .topnav-tools-menu {
        position: fixed; left: 8px; right: 8px; top: calc(var(--tt-topnav-h, 56px) + 6px);
        width: auto; min-width: 0;
        max-height: calc(100dvh - var(--tt-topnav-h, 56px) - 16px);
    }
    .tt-scope .topnav-toolsearch .topnav-search-results {
        position: absolute; top: calc(100% + 6px); left: 0; right: 0;
        width: auto; min-width: 0;
        max-height: calc(100dvh - var(--tt-topnav-h, 56px) - 76px);
    }
    .tt-scope .tools-menu-grid { grid-template-columns: 1fr; }
    .tt-scope .sr-cat { display: none; }
    /* With Tools + the search toggle in the row there's no width left for the
       account/mailbox NAME at 390px — avatar-only (the standard mobile pattern).
       Scoped via :has() to pages that actually mount the toolnav. */
    .tt-scope .topnav-inner:has(.topnav-toolnav) .topnav-user-name { display: none; }
}

/* ---------------------------------------------------------------------------
   4. NAVBAR v2 SLOTS (tt-navbar.js, 2026-06-07) — product lockup, tool actions,
      lang switcher, full-bleed + strip modifiers, degraded account state.
      Additive section: nothing above this line changed behaviour for the
      pre-v2 adopters (mail/broker). Standard: .claude/rules/navbar-v2-design.md
   --------------------------------------------------------------------------- */

/* Product lockup — "TechTools · Mail". Generalizes Mail's hand-built .ttmail-tag. */
.tt-scope .topnav-product {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 1.05rem;
    line-height: 1;
    white-space: nowrap;
    /* The lockup is the first thing to give way on narrow rows — it shrinks
       and the name ellipsizes (verified: a non-shrinking "Broker Statements"
       pushed Sign-In off a 390px viewport). */
    flex-shrink: 1;
    min-width: 0;
}
.tt-scope .topnav-product-name { overflow: hidden; text-overflow: ellipsis; }
.tt-scope .topnav-product-sep {
    display: inline-block;
    width: 1px;
    height: 18px;
    background: var(--border);
    margin-right: 0.15rem;
}
.tt-scope .topnav-product i { color: var(--accent-primary); font-size: 0.95rem; }
.tt-scope .topnav-product-name { color: var(--text-primary); font-weight: 700; }

/* Tool-actions cluster (trail position) + generated action buttons. */
.tt-scope .topnav-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}
.tt-scope .topnav-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: none;
    border: 0;
    color: var(--text-secondary);
    font-family: inherit;
    font-weight: 500;
    font-size: 0.9rem;
    padding: 8px 12px;
    min-height: 44px;
    min-width: 44px;
    justify-content: center;
    border-radius: 10px;
    cursor: pointer;
    transition: background var(--transition-base), color var(--transition-base);
    white-space: nowrap;
}
.tt-scope .topnav-action-btn:hover { background: rgba(255, 255, 255, 0.05); color: var(--text-primary); }

/* Language switcher slot — 🌐 EN / CS. */
.tt-scope .topnav-lang {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-family: inherit;
    font-weight: 600;
    font-size: 0.82rem;
    letter-spacing: 0.04em;
    padding: 8px 12px;
    min-height: 44px;
    border-radius: 999px;
    cursor: pointer;
    transition: background var(--transition-base), color var(--transition-base), border-color var(--transition-base);
    flex-shrink: 0;
}
.tt-scope .topnav-lang:hover { background: rgba(255, 255, 255, 0.08); color: var(--text-primary); border-color: var(--accent-primary); }
.tt-scope .topnav-lang i { font-size: 0.9rem; }

/* Full-bleed modifier — replaces the per-tool `#ttnav .topnav-inner{max-width:none}`
   override (Mail). Set via config `bleed:true` / `data-bleed`. */
.tt-scope.topnav--bleed .topnav-inner { max-width: none; }

/* Solid modifier — opaque brand background for LIGHT-themed tools (white/#f8fafc
   body: painting, diff-checker, pdf-editor). The default rgba(10,10,15,.85) +
   backdrop blur is frosted glass that assumes the dark brand background behind
   it; over a light page it washes out to slate-gray (≈rgb(47,47,51)) — the wrong
   brand color. Add `topnav--solid` to the static placeholder's class list so the
   bar stays the same near-black everywhere (theme independence). */
.tt-scope.topnav--solid {
    background: rgb(10, 10, 15);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

/* Strip mode — the ONE sanctioned reduced tier (games / running canvas surfaces):
   a ~40px brand-only strip. No account, no search, no links → cannot conflict
   with a tool's own chrome. Set via `mode:'strip'` / `data-mode="strip"`. */
.tt-scope.topnav--strip .topnav-inner { min-height: 40px; padding: 4px 10px; }
.tt-scope.topnav--strip .topnav-brand { min-height: 32px; padding: 2px 8px 2px 4px; }
.tt-scope.topnav--strip .topnav-brand-img { height: 24px; }
.tt-scope.topnav--strip .topnav-brand-name { font-size: 1rem; }
.tt-scope .topnav-strip-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.85rem;
    padding: 6px 10px;
    border-radius: 8px;
    transition: background var(--transition-base), color var(--transition-base);
    white-space: nowrap;
}
.tt-scope .topnav-strip-back:hover { background: rgba(255, 255, 255, 0.05); color: var(--text-primary); }

/* Degraded account state — shown when the account slot throws (never a dead
   Sign-in pill that looks healthy). Clicking reloads the page. */
.tt-scope .topnav-acct-degraded {
    background: none;
    border: 1px dashed var(--border);
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.8rem;
    padding: 8px 12px;
    min-height: 44px;
    border-radius: 10px;
    cursor: pointer;
}
.tt-scope .topnav-acct-degraded:hover { color: var(--text-primary); border-color: var(--danger); }

/* v2 slots — mobile collapse order (red-team MINOR-2; verify at 360/375/390px):
   search → toggle sheet (§3) · Tools → icon-only (§3) · lang stays (short label)
   · account name → avatar-only (§1/§3) · product keeps NAME, drops separator+icon
   · brand wordmark hides ≤600px (§1). */
@media (max-width: 600px) {
    .tt-scope .topnav-product { font-size: 0.95rem; max-width: 34vw; }
    .tt-scope .topnav-product i { display: none; }
    .tt-scope .topnav-action-btn span { display: none; }   /* icon-only actions */
    .tt-scope .topnav-lang { padding: 8px 10px; }
}
@media (max-width: 420px) {
    .tt-scope .topnav-product { max-width: 26vw; }
    .tt-scope .topnav-product-sep { display: none; }
    .tt-scope .topnav-lang i { display: none; }            /* "EN" text only */
}
