/* =========================================================================
   히트판 백오피스 v2 — 워크스페이스 콘솔 (사장님 결재 2026-06-01)
   - 디자인 언어: 토스(여백·그림자) + 노션(섹션·뱃지) + 리니어(단축키)
   - 디자인 토큰: design-tokens.css와 정합 (그린 #0F6E56)
   - 8pt grid + 라운드 8px
   ========================================================================= */

:root {
    --bo2-green: #0F6E56;
    --bo2-green-50: #E6F2EE;
    --bo2-green-100: #C5E2D8;
    --bo2-green-700: #0B5743;
    --bo2-bg: #F8FAFC;
    --bo2-surface: #FFFFFF;
    --bo2-border: #E5E7EB;
    --bo2-border-soft: #F1F5F9;
    --bo2-text: #0F172A;
    --bo2-text-soft: #475569;
    --bo2-text-mute: #94A3B8;
    --bo2-danger: #DC2626;
    --bo2-warn: #F59E0B;
    --bo2-shadow-1: 0 1px 2px rgba(15, 23, 42, 0.04), 0 1px 3px rgba(15, 23, 42, 0.06);
    --bo2-shadow-2: 0 4px 12px rgba(15, 23, 42, 0.08);
    --bo2-sidebar-w: 240px;
    --bo2-topbar-h: 56px;
    --bo2-radius: 8px;
    --bo2-ease: cubic-bezier(0.4, 0, 0.2, 1);
}

/* =========================================================================
   Shell — 그리드 골격
   ========================================================================= */
.bo2-shell {
    display: grid;
    grid-template-columns: var(--bo2-sidebar-w) 1fr;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    background: var(--bo2-bg);
    font-family: 'Pretendard Variable', Pretendard, 'Noto Sans KR', -apple-system, sans-serif;
    color: var(--bo2-text);
}

.bo2-main {
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
}

.bo2-content {
    flex: 1;
    overflow-y: auto;
    background: var(--bo2-bg);
}

.bo2-content-inner {
    max-width: 1440px;
    margin: 0 auto;
    padding: 24px;
}

/* =========================================================================
   Sidebar
   ========================================================================= */
.bo2-sidebar {
    background: var(--bo2-surface);
    border-right: 1px solid var(--bo2-border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: 100vh;
    transition: transform 0.24s var(--bo2-ease);
}

.bo2-sidebar-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.bo2-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--bo2-border-soft);
    min-height: var(--bo2-topbar-h);
    box-sizing: border-box;
}

.bo2-brand-logo {
    width: 32px;
    height: 32px;
    border-radius: var(--bo2-radius);
    background: var(--bo2-green);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    letter-spacing: -0.02em;
    flex-shrink: 0;
}

.bo2-brand-text { min-width: 0; }

.bo2-brand-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--bo2-text);
    line-height: 1.2;
}

.bo2-brand-sub {
    font-size: 12px;
    color: var(--bo2-text-mute);
    line-height: 1.4;
    margin-top: 2px;
}

.bo2-nav {
    flex: 1;
    overflow-y: auto;
    padding: 12px 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.bo2-nav-section {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 8px 0 4px;
}

.bo2-nav-section + .bo2-nav-section {
    border-top: 1px solid var(--bo2-border-soft);
    margin-top: 4px;
}

.bo2-nav-section-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--bo2-text-mute);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 8px 12px 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.bo2-owner-tag {
    background: var(--bo2-green-50);
    color: var(--bo2-green-700);
    font-size: 9px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    letter-spacing: 0.05em;
}

.bo2-nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: var(--bo2-radius);
    color: var(--bo2-text-soft);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    position: relative;
    transition: background 0.12s var(--bo2-ease), color 0.12s var(--bo2-ease);
    cursor: pointer;
}

.bo2-nav-link:hover {
    background: var(--bo2-border-soft);
    color: var(--bo2-text);
}

.bo2-nav-link.active {
    background: var(--bo2-green-50);
    color: var(--bo2-green-700);
    font-weight: 600;
}

.bo2-nav-link.active::before {
    content: '';
    position: absolute;
    left: -8px;
    top: 6px;
    bottom: 6px;
    width: 4px;
    border-radius: 0 4px 4px 0;
    background: var(--bo2-green);
}

.bo2-nav-icon {
    font-size: 20px !important;
    width: 24px;
    flex-shrink: 0;
    color: inherit;
}

.bo2-nav-label {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bo2-nav-count {
    font-size: 11px;
    font-weight: 600;
    color: var(--bo2-text-mute);
    background: var(--bo2-border-soft);
    padding: 2px 7px;
    border-radius: 10px;
    line-height: 1.4;
    min-width: 18px;
    text-align: center;
}

.bo2-nav-link.active .bo2-nav-count {
    background: var(--bo2-green-100);
    color: var(--bo2-green-700);
}

.bo2-sidebar-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--bo2-border-soft);
}

.bo2-sidebar-env {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--bo2-text-mute);
}

.bo2-env-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #22C55E;
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.15);
}

/* =========================================================================
   Top Bar
   ========================================================================= */
.bo2-topbar {
    height: var(--bo2-topbar-h);
    background: var(--bo2-surface);
    border-bottom: 1px solid var(--bo2-border);
    box-shadow: var(--bo2-shadow-1);
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 16px;
    padding: 0 24px;
    flex-shrink: 0;
    z-index: 10;
    position: relative;
}

.bo2-topbar-left { display: flex; align-items: center; gap: 12px; }
.bo2-topbar-center { display: flex; justify-content: center; }
.bo2-topbar-right { display: flex; align-items: center; gap: 8px; }

.bo2-hamburger {
    display: none;
    background: transparent;
    border: 0;
    width: 36px;
    height: 36px;
    border-radius: var(--bo2-radius);
    color: var(--bo2-text-soft);
    cursor: pointer;
    align-items: center;
    justify-content: center;
}

.bo2-hamburger:hover { background: var(--bo2-border-soft); }

.bo2-topbar-brand {
    display: none;
    align-items: center;
    gap: 10px;
}

.bo2-topbar-logo {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: var(--bo2-green);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 12px;
}

.bo2-topbar-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--bo2-text);
}

/* Search */
.bo2-search {
    position: relative;
    width: 100%;
    max-width: 480px;
    display: flex;
    align-items: center;
    background: var(--bo2-bg);
    border: 1px solid var(--bo2-border);
    border-radius: var(--bo2-radius);
    padding: 0 12px;
    height: 36px;
    transition: border 0.12s var(--bo2-ease), box-shadow 0.12s var(--bo2-ease);
}

.bo2-search:focus-within {
    border-color: var(--bo2-green);
    box-shadow: 0 0 0 3px rgba(15, 110, 86, 0.12);
    background: #fff;
}

.bo2-search-icon {
    font-size: 18px !important;
    color: var(--bo2-text-mute);
    margin-right: 8px;
}

.bo2-search-input {
    flex: 1;
    border: 0;
    outline: none;
    background: transparent;
    font-size: 14px;
    color: var(--bo2-text);
    font-family: inherit;
    min-width: 0;
}

.bo2-search-input::placeholder { color: var(--bo2-text-mute); }

.bo2-search-kbd {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    font-weight: 500;
    color: var(--bo2-text-mute);
    background: #fff;
    border: 1px solid var(--bo2-border);
    border-radius: 4px;
    padding: 2px 6px;
    line-height: 1.2;
    flex-shrink: 0;
}

/* Right icons */
.bo2-icon-btn {
    position: relative;
    background: transparent;
    border: 0;
    width: 36px;
    height: 36px;
    border-radius: var(--bo2-radius);
    color: var(--bo2-text-soft);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.12s var(--bo2-ease);
}

.bo2-icon-btn:hover { background: var(--bo2-border-soft); color: var(--bo2-text); }
.bo2-icon-btn .material-icons { font-size: 20px !important; }

.bo2-badge-dot {
    position: absolute;
    top: 4px;
    right: 4px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    background: var(--bo2-danger);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    border: 2px solid #fff;
    box-sizing: content-box;
}

/* Profile */
.bo2-profile {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 8px 4px 4px;
    border-radius: var(--bo2-radius);
    cursor: pointer;
    transition: background 0.12s var(--bo2-ease);
    user-select: none;
}

.bo2-profile:hover { background: var(--bo2-border-soft); }

.bo2-profile-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bo2-green);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 13px;
    flex-shrink: 0;
}

.bo2-profile-info { line-height: 1.2; }

.bo2-profile-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--bo2-text);
}

.bo2-profile-role {
    font-size: 11px;
    color: var(--bo2-text-mute);
    margin-top: 2px;
}

.bo2-profile-chevron {
    font-size: 18px !important;
    color: var(--bo2-text-mute);
}

.bo2-profile-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 220px;
    background: var(--bo2-surface);
    border: 1px solid var(--bo2-border);
    border-radius: var(--bo2-radius);
    box-shadow: var(--bo2-shadow-2);
    overflow: hidden;
    z-index: 100;
}

.bo2-profile-menu-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--bo2-border-soft);
}

.bo2-profile-menu-item {
    width: 100%;
    background: transparent;
    border: 0;
    text-align: left;
    padding: 10px 16px;
    font-size: 14px;
    color: var(--bo2-text);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: inherit;
}

.bo2-profile-menu-item:hover { background: var(--bo2-border-soft); }
.bo2-profile-menu-item .material-icons { font-size: 18px !important; color: var(--bo2-text-mute); }

/* Scrim for mobile */
.bo2-scrim {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    z-index: 20;
}

/* =========================================================================
   Responsive
   ========================================================================= */
@media (max-width: 1024px) {
    .bo2-shell {
        grid-template-columns: 1fr;
    }

    .bo2-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: var(--bo2-sidebar-w);
        z-index: 30;
        transform: translateX(-100%);
        box-shadow: var(--bo2-shadow-2);
    }

    .bo2-sidebar.open {
        transform: translateX(0);
    }

    .bo2-scrim {
        display: block;
    }

    .bo2-hamburger { display: inline-flex; }
    .bo2-topbar-brand { display: flex; }

    .bo2-search {
        max-width: none;
    }

    .bo2-profile-info { display: none; }
    .bo2-profile-chevron { display: none; }
}

@media (max-width: 640px) {
    .bo2-content-inner { padding: 16px; }
    .bo2-topbar { padding: 0 12px; gap: 8px; }
    .bo2-search-kbd { display: none; }
    .bo2-topbar-title { display: none; }
}
