.v5-system-header {
    position: sticky;
    top: 0;
    z-index: 40;
    background: #ffffff;
    border-bottom: 1px solid #e5e7eb;
}

.v5-system-header--login {
    position: relative;
    overflow: hidden;
    background:
        radial-gradient(circle at 85% 20%, rgba(147, 197, 253, 0.28), transparent 40%),
        linear-gradient(135deg, #1e40af 0%, #2563eb 45%, #1d4ed8 100%);
    border-bottom-color: rgba(191, 219, 254, 0.45);
    box-shadow: 0 10px 24px rgba(30, 64, 175, 0.32);
}

.v5-system-header--login .v5-system-header-inner {
    min-height: 60px;
    justify-content: flex-start;
    position: relative;
    z-index: 1;
}

.v5-system-header--login .v5-system-header-left {
    gap: 0;
}

.v5-system-header--login .v5-system-header-title-wrap {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.v5-system-login-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.v5-system-header--login .v5-system-header-title,
.v5-system-header--login .v5-system-header-sub,
.v5-system-header--login .v5-system-menu-btn {
    color: #ffffff;
}

.v5-system-header--login .v5-system-header-sub {
    opacity: 0.95;
    color: #dbeafe;
}

.v5-system-header--login .v5-system-menu-btn {
    border-color: rgba(255, 255, 255, 0.35);
    background: rgba(255, 255, 255, 0.12);
}

.v5-system-login-badge {
    width: 28px;
    height: 28px;
    border-radius: 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #1e40af;
    background: linear-gradient(145deg, #ffffff 0%, #dbeafe 100%);
    border: 1px solid rgba(255, 255, 255, 0.78);
    box-shadow:
        0 6px 14px rgba(30, 64, 175, 0.35),
        inset 0 1px 0 rgba(255, 255, 255, 0.85);
    font-size: 13px;
}

.v5-system-header--login .v5-system-header-title {
    font-size: 18px;
    font-weight: 600;
    letter-spacing: 0.01em;
    text-shadow: 0 1px 2px rgba(30, 58, 138, 0.35);
}

.v5-system-header--login .v5-system-header-sub {
    margin-left: 34px;
}

.v5-system-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
}

.v5-system-header-left,
.v5-system-header-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.v5-system-menu-btn {
    width: 32px;
    height: 32px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #fff;
    color: #6b7280;
}

.v5-system-menu-fab {
    position: fixed;
    top: 10px;
    left: 10px;
    z-index: 45;
    width: 34px;
    height: 34px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #ffffff;
    color: #6b7280;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.v5-system-header-title {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #111827;
    line-height: 1.2;
}

.v5-system-header-sub {
    margin: 1px 0 0;
    font-size: 11px;
    color: #6b7280;
    line-height: 1.2;
}

.v5-system-user-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 8px;
    border-radius: 999px;
    background: #f8f9fb;
}

.v5-system-user-avatar {
    width: 24px;
    height: 24px;
    border-radius: 999px;
    object-fit: cover;
}

.v5-system-user-name {
    font-size: 12px;
    color: #374151;
    font-weight: 600;
}

.v5-system-logout-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 6px 10px;
    background: #fff;
    color: #4b5563;
    font-size: 12px;
    font-weight: 600;
}

/* v5 sidebar — mock spec line 237-258 (width 220, white bg, 1px right border).
 * Whole sidebar uses system fonts (overriding global Noto Sans JP) — Noto renders
 * Japanese roughly half-a-weight heavier than system fonts, which makes our items
 * look bolder than the mock at the same nominal weight.
 *
 * NOTE: scope only to TEXT containers (not `*`) so FontAwesome's icon font on
 * <i class="fas/fab/far"> stays intact. */
.v5-system-sidebar,
.v5-system-sidebar-brand,
.v5-system-sidebar-section-title,
.v5-system-sidebar-link,
.v5-system-sidebar-link span,
.v5-system-sidebar-link-text,
.v5-system-sidebar-link-title,
.v5-system-sidebar-link-sub,
.v5-system-sidebar-upgrade,
.v5-system-sidebar-user,
.v5-system-sidebar-user-name,
.v5-system-sidebar-user-plan,
.v5-system-sidebar-logout {
    font-family: 'Noto Sans JP', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif !important;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
.v5-system-sidebar {
    display: flex;
    flex-direction: column;
    width: 220px !important;
    min-width: 220px !important;
    max-width: 220px !important;
    border-right: 1px solid #E5E7EB;
    background: #FFFFFF;
}

/* Brand: padding 16/20, 32×32 gradient logo + 15/700 title */
.v5-system-sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 20px;
    border-bottom: 1px solid #E5E7EB;
    font-size: 15px;
    font-weight: 600;
    color: #111827;
}
.v5-system-sidebar-logo {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 14px;
    background: linear-gradient(135deg, #2563EB 0%, #7C3AED 100%);
    flex-shrink: 0;
}

/* Nav area — scrollable, padding 8/0, sections separated by margin only (no border) */
.v5-system-sidebar-nav {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 8px 0;
}
.v5-system-sidebar-nav-inner {
    display: flex;
    flex-direction: column;
}

/* Section wrapper — small gap below each */
.v5-system-sidebar-section {
    margin-bottom: 4px;
}
.v5-system-sidebar-section-title {
    padding: 12px 20px 4px;
    font-size: 11px;
    font-weight: 600;
    color: #6b7280;
    letter-spacing: 1px;
    text-transform: uppercase;
    /* Section titles use Latin/Hiragana mix — keep system render */
    font-feature-settings: "palt" 0;
}

/* Kicker class (legacy) — same look */
.v5-system-nav-kicker {
    font-size: 11px;
    color: #6b7280;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
}

/* Item — mock spec line 247: padding "9px 20px", margin "1px 8px", radius 8.
 * padding-x 20 makes items indent ~8px more than section title (title at x=20,
 * item content at x=28 because of the 8px margin-left).
 * Use system-only font stack (no Noto Sans JP) so Japanese renders at mock weight. */
/* 営業リスト sidebar 再電 reminder badge.
   color is !important because the active-link rule (.is-active span) would
   otherwise repaint the number blue on the red pill, making it unreadable. */
.sales-list-badge {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 99px;
    background: #ef4444;
    color: #fff !important;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    flex-shrink: 0;
    box-sizing: border-box;
    box-shadow: 0 0 0 1.5px #fff;
}

.v5-system-sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 1px 8px;
    padding: 9px 20px;
    border-radius: 8px;
    color: #6B7280 !important;
    font-size: 14px;
    font-weight: 500 !important;
    line-height: 1.2;
    text-decoration: none;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background 0.12s, color 0.12s;
}
.v5-system-sidebar-link span,
.v5-system-sidebar-link .v5-system-sidebar-link-title {
    color: inherit;
}
.v5-system-sidebar-link i {
    width: 18px;
    text-align: center;
    color: #6b7280;
    font-size: 18px;
    opacity: 1;
    flex-shrink: 0;
    margin-right: 0 !important;
}
.v5-system-sidebar-link:hover {
    background: #F3F4F6;
    color: #374151 !important;
}
.v5-system-sidebar-link:hover i {
    color: #6B7280;
}

/* Active state — primary-light bg + primary text/icon, font 600 (mock) */
.v5-system-sidebar-link.is-active {
    background: #EFF6FF !important;
    color: #2563EB !important;
    font-weight: 600 !important;
}
.v5-system-sidebar-link.is-active i,
.v5-system-sidebar-link.is-active .v5-system-sidebar-link-title {
    color: #2563EB !important;
}
.v5-system-sidebar-link.is-active span { color: #2563EB; }

/* Items with a sub-label (企業データ / AIマッチング) — stacked text */
.v5-system-sidebar-link--has-sub {
    align-items: center;
    padding: 9px 20px;
}
.v5-system-sidebar-link--has-sub i {
    margin-top: 0;
    align-self: center;
}
.v5-system-sidebar-link-text {
    display: flex;
    flex-direction: column;
    line-height: 1;
}
.v5-system-sidebar-link-title {
    font-size: 14px;
    font-weight: inherit;
    line-height: 1.25;
}
.v5-system-sidebar-link-sub {
    font-size: 10px;
    color: #6b7280;
    font-weight: 400;
    margin-top: 1px;
    opacity: 0.8;
    line-height: 1.1;
}
.v5-system-sidebar-link--has-sub.is-active .v5-system-sidebar-link-sub {
    color: #2563EB;
    opacity: 0.85;
    font-weight: 600 !important;
}

/* Upgrade row inside section wrapper (for non-call-option admin) */
.v5-system-sidebar-upgrade {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 20px;
    margin: 1px 8px;
    border-radius: 8px;
    color: #2563EB;
    font-size: 12px;
    font-weight: 500;
    text-decoration: none;
}
.v5-system-sidebar-upgrade:hover { background: #EFF6FF; }
.v5-system-sidebar-upgrade i { font-size: 11px; color: #6b7280; }
.v5-system-sidebar-upgrade-ext { margin-left: auto; font-size: 9px !important; }

.v5-system-sidebar-user {
    padding: 10px 14px;
    border-top: 1px solid #f3f4f6;
    display: flex;
    align-items: center;
    gap: 8px;
}

.v5-system-sidebar-user-avatar {
    width: 26px;
    height: 26px;
    border-radius: 999px;
    background: #dbeafe;
    color: #2563eb;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    overflow: hidden;
}

.v5-system-sidebar-user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.v5-system-sidebar-user-name {
    font-size: 12px;
    font-weight: 600;
    color: #111827;
}

.v5-system-sidebar-user-plan {
    font-size: 10px;
    color: #6b7280;
}

.v5-system-sidebar-logout {
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 8px 10px;
    background: #fff;
    color: #4b5563;
    font-size: 12px;
    font-weight: 600;
}

@media (max-width: 1023px) {
    #sidebar.v5-system-sidebar {
        width: 272px;
        max-width: 88vw;
        height: 100vh;
    }

    .v5-system-sidebar-brand {
        padding: 12px 14px;
        font-size: 14px;
    }

    .v5-system-sidebar-nav {
        padding: 6px 0;
    }

    .v5-system-sidebar-link {
        margin: 1px 6px;
        padding: 10px 10px;
        font-size: 13px;
    }

    .v5-system-sidebar-user {
        padding: 9px 12px;
    }

    .v5-system-sidebar-user-name {
        max-width: 150px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}

@media (max-width: 640px) {
    .v5-system-menu-fab {
        top: 8px;
        left: 8px;
        width: 32px;
        height: 32px;
    }

    #sidebar.v5-system-sidebar {
        width: 248px;
    }
}

@media (min-width: 1024px) {
    #sidebar.v5-system-sidebar {
        position: sticky !important;
        top: 0 !important;
        height: 100vh !important;
        width: 256px;
        flex: 0 0 256px;
        align-self: flex-start;
    }

    .v5-system-menu-fab {
        display: none !important;
    }

    .main-content {
        background: #f8f9fb;
    }
}
