:root {
    /* Color Palette - Premium Dark Theme -> Light Theme adjustments for Main Content */
    --bg-dark: #0f172a;
    /* Sidebar/Login Area */
    --bg-main: #ffffff;
    /* Main Background: White */
    --card-bg: #ffffff;
    /* Cards in main area */
    --bg-sidebar: #1e293b;
    --text-primary: #000000;
    /* Pure black text */
    --text-secondary: #475569;
    /* Secondary text for light background */
    --text-light: #f8fafc;
    /* White text for sidebar/buttons */
    --accent-blue: #3b82f6;
    --accent-purple: #8b5cf6;
    --danger: #ef4444;
    --success: #22c55e;
    --border-color: rgba(0, 0, 0, 0.1);
    /* Darker border for light bg */
    --border-light: rgba(255, 255, 255, 0.1);
    /* White border for sidebar */
    --glass-blur: blur(12px);
    --transition-fast: 0.2s ease;
    --green-indicator: #22c55e;
    --purple-indicator: #a855f7;
    --blue-indicator: #3b82f6;
    --mobile-safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Pretendard Variable', -apple-system, BlinkMacSystemFont, system-ui, Roboto, sans-serif;
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
    height: 100dvh;
    height: var(--mobile-vh, 100dvh);
}

.app-container {
    display: flex;
    height: 100vh;
    height: 100dvh;
    height: var(--mobile-vh, 100dvh);
    width: 100%;
}

.header-right {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 4px;
}

/* Sidebar Styling */
.sidebar {
    width: 280px;
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    z-index: 100;
    color: var(--text-light);
    min-height: 0;
    overflow: hidden;
    user-select: none;
}

.sidebar-header {
    padding: 24px;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.logo-img {
    width: 32px;
    height: 32px;
    object-fit: contain;
    filter: drop-shadow(0 0 8px rgba(56, 189, 248, 0.5));
}

.app-title {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.app-title .accent {
    color: var(--accent-blue);
}

.user-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(129, 140, 248, 0.1);
    border: 1px solid rgba(129, 140, 248, 0.2);
    border-radius: 8px;
    font-size: 0.85rem;
    color: var(--accent-purple);
}
.sidebar-user-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.sidebar-badge-actions {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    flex-shrink: 0;
}
.sidebar-pin-btn {
    padding: 3px 7px;
    border-radius: 6px;
    border: 1px solid rgba(148, 163, 184, 0.3);
    background: transparent;
    color: rgba(148, 163, 184, 0.7);
    font-size: 0.78rem;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    flex-shrink: 0;
}
.sidebar-pin-btn:hover {
    background: rgba(96, 165, 250, 0.15);
    color: #93c5fd;
    border-color: rgba(96, 165, 250, 0.4);
}
.sidebar-pin-btn.pinned {
    background: rgba(96, 165, 250, 0.18);
    color: #60a5fa;
    border-color: rgba(96, 165, 250, 0.5);
}

.sidebar-logout-btn {
    padding: 3px 8px;
    border-radius: 6px;
    border: 1px solid rgba(248, 113, 113, 0.35);
    background: rgba(248, 113, 113, 0.12);
    color: rgba(248, 113, 113, 0.85);
    font-size: 0.78rem;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    flex-shrink: 0;
}
.sidebar-logout-btn:hover {
    background: rgba(248, 113, 113, 0.28);
    color: #f87171;
}

/* Navigation */
.sidebar-nav {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 20px 16px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(96, 165, 250, 0.35) transparent;
}
.sidebar-nav::-webkit-scrollbar {
    width: 5px;
}
.sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}
.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(96, 165, 250, 0.35);
    border-radius: 4px;
}
.sidebar-nav::-webkit-scrollbar-thumb:hover {
    background: rgba(96, 165, 250, 0.6);
}

.nav-section {
    margin-bottom: 24px;
}

.section-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.5);
    /* Force light color in sidebar */
    letter-spacing: 1px;
    padding-left: 12px;
    margin-bottom: 12px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    border-radius: 10px;
    color: rgba(255, 255, 255, 0.6);
    transition: all 0.2s ease;
    cursor: pointer;
    font-size: 0.95rem;
    border-left: 3px solid transparent;
    margin-bottom: 2px;
    user-select: none;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-light);
}

.nav-item.active {
    background: rgba(59, 130, 246, 0.08);
    border-left-color: var(--accent-blue);
    color: var(--text-light);
    outline: none;
    box-shadow: 0 0 12px rgba(59, 130, 246, 0.1);
}

.nav-item i {
    width: 20px;
    text-align: center;
    font-size: 1.1rem;
}

.nav-item.active i {
    color: var(--accent-blue);
}

/* 캐비닛 수신 알람 팝업 */
.cabinet-notify-wrap {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    pointer-events: none;
}
.cabinet-notify {
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 18px;
    background: rgba(30, 30, 40, 0.82);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(250, 204, 21, 0.45);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.35);
    font-size: 0.88rem;
    color: #f5f5f5;
    white-space: nowrap;
    animation: notifySlideIn 0.3s ease;
}
.cabinet-notify-icon {
    font-size: 1rem;
    color: #facc15;
    flex-shrink: 0;
}
.cabinet-notify-close {
    background: none;
    border: none;
    color: rgba(255,255,255,0.5);
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    padding: 0 0 0 6px;
    transition: color 0.15s;
}
.cabinet-notify-close:hover { color: #fff; }
@keyframes notifySlideIn {
    from { opacity: 0; transform: translateY(-12px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* 캐비닛 받은문서 C 뱃지 */
.cabinet-inbox-dot {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    background: transparent;
    color: #facc15;
    font-size: 13px;
    font-weight: 900;
    font-style: normal;
    font-family: Arial, sans-serif;
    line-height: 1;
    text-shadow: 0 0 6px rgba(250,204,21,0.9), 0 0 12px rgba(250,204,21,0.6);
    flex-shrink: 0;
    align-self: center;
    cursor: pointer;
    user-select: none;
    transition: transform 0.1s, text-shadow 0.1s;
}
.cabinet-inbox-dot:hover {
    transform: scale(1.2);
    text-shadow: 0 0 10px rgba(250,204,21,1), 0 0 20px rgba(250,204,21,0.8);
}

/* 비서모드 전송대상목록 부메뉴 네비게이터 */
.sec-nav-bar {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: 10px;
}
.sec-nav-arrow {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 6px;
    color: rgba(255,255,255,0.45);
    cursor: pointer;
    font-size: 0.65rem;
    transition: all 0.15s;
}
.sec-nav-arrow:hover {
    background: rgba(139,92,246,0.25);
    border-color: rgba(139,92,246,0.5);
    color: #a78bfa;
}
.sec-nav-center {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px 8px;
    background: linear-gradient(180deg, rgba(134,239,172,0.32) 0%, rgba(74,222,128,0.18) 100%);
    border: 1px solid rgba(134,239,172,0.45);
    border-bottom: 2px solid rgba(34,197,94,0.35);
    border-radius: 8px;
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.18),
        0 3px 8px rgba(34,197,94,0.18),
        0 1px 3px rgba(0,0,0,0.22);
    color: rgba(255,255,255,0.92);
    font-size: 0.74rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
    overflow: hidden;
    min-width: 0;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}
.sec-nav-center:hover {
    background: linear-gradient(180deg, rgba(134,239,172,0.48) 0%, rgba(74,222,128,0.32) 100%);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.22),
        0 5px 14px rgba(34,197,94,0.28),
        0 2px 4px rgba(0,0,0,0.2);
    transform: translateY(-1px);
    color: #fff;
}
.sec-nav-center:active {
    transform: translateY(1px);
    box-shadow:
        inset 0 1px 3px rgba(0,0,0,0.18),
        0 1px 3px rgba(34,197,94,0.15);
    border-bottom-width: 1px;
}
.sec-nav-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}
.sec-nav-count {
    margin-left: auto;
    flex-shrink: 0;
    font-size: 0.68rem;
    font-weight: 700;
    color: #86efac;
    background: rgba(34,197,94,0.22);
    padding: 1px 5px;
    border-radius: 8px;
    text-shadow: none;
}

.company-check-toolbar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 6px;
    margin-top: 4px;
}
.check-all-label {
    display: flex;
    align-items: center;
    cursor: pointer;
}
.check-all-label input[type="checkbox"] {
    width: 14px;
    height: 14px;
    cursor: pointer;
    flex-shrink: 0;
}
.check-all-count {
    flex: 1;
    font-size: 0.75rem;
    color: var(--text-secondary);
    padding-left: 6px;
}
#btnDeselectAll {
    font-size: 0.72rem;
    padding: 2px 8px;
    border-radius: 5px;
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
}
#btnDeselectAll:hover {
    background: rgba(255,255,255,0.08);
    color: var(--text-light);
}

/* 정렬 필터 스타일 */
.sort-filter-wrap {
    display: flex;
    gap: 4px;
    padding: 0 4px;
}

.btn-sort {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 0.75rem;
    padding: 6px 0;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.btn-sort i {
    font-size: 0.8rem;
}

.btn-sort:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-light);
}

.btn-sort.active {
    background: var(--accent-blue);
    color: #ffffff;
    border-color: var(--accent-blue);
}

/* 업체 검색 박스 — 아래 전체직원 select 와 동일한 높이(단일 알약)로 정렬 */
.search-wrap {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 0 10px;
    border-radius: 6px;
}
.search-wrap i {
    flex-shrink: 0;
    font-size: 0.8rem;
    color: var(--text-secondary);
}
.search-wrap input {
    flex: 1;
    min-width: 0;
    padding: 6px 2px;
    font-size: 0.75rem;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-light);
}
.search-wrap input::placeholder {
    color: var(--text-secondary);
}

/* 필터 드롭다운 스타일 */
.filter-select-wrap {
    display: flex;
    gap: 8px;
    padding: 0 4px;
}

.sidebar-select {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: #60a5fa;
    /* 밝은 파란색으로 변경 */
    font-size: 0.75rem;
    font-weight: 600;
    /* 글씨를 조금 더 굵게 */
    padding: 6px 4px;
    cursor: pointer;
    transition: all 0.2s;
    outline: none;
    appearance: none;
    /* 브라우저 기본 화살표 숨김 선택적 적용 가능 */
    text-align: center;
}

.sidebar-select:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-light);
    border-color: var(--border-light);
}

.sidebar-select option {
    background-color: var(--bg-sidebar);
    color: var(--text-light);
}

/* Company List in Sidebar */
.company-list {
    list-style: none;
    margin-top: 8px;
}

.company-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-radius: 8px;
    margin-bottom: 4px;
    cursor: pointer;
    transition: var(--transition-fast);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.14);
    position: relative;
    /* 가상 요소 배경 배치를 위해 추가 */
    z-index: 1;
}

.company-item.ready-to-send {
    background-color: rgba(16, 185, 129, 0.10);
    border-left: 6px solid var(--green-indicator);
    /* 두께 상향 4px -> 6px */
}

.company-item.all-sent {
    background-color: rgba(239, 68, 68, 0.10);
    border-left: 6px solid var(--danger);
    /* 두께 상향 4px -> 6px */
}

.company-item:hover {
    background: rgba(255, 255, 255, 0.09);
    border-color: rgba(255, 255, 255, 0.65);
    box-shadow: 0 0 0 1px rgba(255,255,255,0.12), 0 2px 8px rgba(0,0,0,0.18);
}
.company-item.ready-to-send:hover {
    border-left-color: var(--green-indicator) !important;
}
.company-item.all-sent:hover {
    border-left-color: var(--danger) !important;
}

.company-item.pinned {
    background: rgba(56, 189, 248, 0.05);
}

.company-item.active-company {
    background: transparent !important;
    /* 본체 배경은 투명하게 */
    border-color: transparent !important;
}

/* 선택된 상태에서도 상태 바 색상 강제 유지 */
.company-item.active-company.ready-to-send {
    border-left-color: var(--green-indicator) !important;
}

.company-item.active-company.all-sent {
    border-left-color: var(--danger) !important;
}

/* 선택된 업체 배경을 가상 요소로 분리하여 상태 바(6px)를 가리지 않도록 함 */
.company-item.active-company::before {
    content: '';
    position: absolute;
    top: 0;
    left: 10px;
    /* 상태 바 6px + 여백 4px = 10px */
    right: 0;
    bottom: 0;
    background-color: rgba(59, 130, 246, 0.50);
    border-radius: 8px;
    z-index: -1;
}

.company-item.active-company .company-name,
.company-item.active-company .company-ceo {
    color: #ffffff;
}

.company-info {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.company-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-light);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* C 뱃지 표시 시 자동 폰트 축소 → 한 줄 유지 */
.company-item:has(.cabinet-inbox-dot) .company-name {
    font-size: 0.78rem;
}

.company-ceo {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.6);
}

/* 닷 표시기 제거됨 (바 형식으로 대체) */

.company-checkbox {
    margin-right: 12px;
    display: flex;
    align-items: center;
}

.company-checkbox input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--accent-blue);
}

.company-actions-mini {
    display: flex;
    gap: 4px;
    opacity: 1;
    /* 압핀 식별을 위해 상시 표시로 변경 */
    transition: opacity 0.2s;
}

.btn-delete-mini,
.btn-view-mini {
    opacity: 0;
    transition: opacity 0.2s;
}

.company-item:hover .btn-delete-mini {
    opacity: 1;
}

.staff-list tbody tr:hover .btn-delete-mini,
.staff-list tbody tr:hover .btn-view-mini {
    opacity: 1;
}

.btn-pin,
.btn-delete-mini,
.btn-view-mini {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.btn-pin:hover,
.btn-pin.active {
    color: var(--accent-blue);
}

.btn-delete-mini:hover {
    color: var(--danger);
}

.btn-view-mini:hover {
    color: var(--accent-blue);
}

.btn-pin {
    opacity: 0.3;
    /* Original opacity for btn-pin */
}

.company-item:hover .btn-pin,
.btn-pin.active {
    opacity: 1;
}

.btn-pin.active {
    transform: rotate(-15deg);
    color: var(--accent-blue) !important;
    text-shadow: 0 0 8px rgba(59, 130, 246, 0.8);
}

.list-empty {
    padding: 20px;
    text-align: center;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.6);
    opacity: 0.6;
}

.section-header-flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-right: 8px;
}

.btn-add-circle {
    background: rgba(37, 99, 235, 0.65);
    border: 1px solid rgba(96, 165, 250, 0.8);
    width: 24px;
    height: 24px;
    border-radius: 50%;
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    transition: var(--transition-fast);
    position: relative;
    z-index: 10;
}

.btn-add-circle:hover {
    background: var(--accent-blue);
    color: white;
    border-color: var(--accent-blue);
}

/* Main Layout */
.main-layout {
    flex: 1;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: #ffffff;
    color: var(--text-primary);
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

.top-nav {
    min-height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0 32px;
    border-bottom: 1px solid var(--border-color);
    background: #ffffff;
    /* White Top Nav */
    backdrop-filter: var(--glass-blur);
}

#viewAsStaffBanner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 9px 16px;
    background: #1e3a8a;
    color: #fff;
    font-size: 0.85rem;
}

#viewAsStaffBanner button {
    background: #fff;
    color: #1e3a8a;
    border: none;
    border-radius: 6px;
    padding: 4px 12px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
}

#viewAsStaffBanner button:hover {
    background: #dbeafe;
}

.btn-premium {
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 8px 16px rgba(56, 189, 248, 0.2);
    transition: var(--transition-fast);
}

.btn-premium:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 20px rgba(56, 189, 248, 0.3);
}

.user-profile img {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 2px solid var(--border-color);
}

