/* =========================================================================
   신포컴시스템 통합 CRM v4.0 디자인 시스템
   - Senior Product Designer Grade Dark SaaS UI (Obsidian Slate × Warm Orange)
   - A4 인쇄 엔진(견적서·거래내역서·접수증·수리내역서 + 전자서명/검수인증) & QR 라벨 100% 보존
   ========================================================================= */
:root {
    --bg-base: #090d16;
    --bg-rail: #070a12;
    --bg-sidebar: #101726;
    --bg-surface: #141d2f;
    --bg-card: #1a253b;
    --bg-input: #0b1120;
    --brand-orange: #f97316;
    --brand-orange-light: #fb923c;
    --brand-orange-hover: #ea580c;
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --sky: #38bdf8;
    --accent-green: #10b981;
    --accent-green-hover: #059669;
    --accent-yellow: #f59e0b;
    --accent-red: #f43f5e;
    --text-main: #f1f5f9;
    --text-strong: #ffffff;
    --text-sub: #94a3b8;
    --text-muted: #64748b;
    --border-sub: rgba(148, 163, 184, 0.16);
    --border-strong: rgba(148, 163, 184, 0.28);
    --shadow-card: 0 10px 30px -12px rgba(0, 0, 0, 0.55);
    --shadow-glow-orange: 0 8px 24px -6px rgba(249, 115, 22, 0.42);
    --radius-sm: 7px;
    --radius-md: 11px;
    --radius-lg: 15px;
    --rail-width: 72px;
    --sidebar-width: 468px;
    --doc-primary: #0c4da2;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
    width: 100%; height: 100%; overflow: hidden;
    background: radial-gradient(circle at 20% 0%, #131c31 0%, var(--bg-base) 58%);
    color: var(--text-main);
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, "Malgun Gothic", sans-serif;
    font-size: 13px;
    -webkit-font-smoothing: antialiased;
}
body { display: flex; }
body.role-tech .admin-only { display: none !important; }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-thumb { background: rgba(148, 163, 184, 0.26); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: rgba(148, 163, 184, 0.45); }
::-webkit-scrollbar-track { background: transparent; }

/* 로그인 / 계정 생성 오버레이 */
#auth-overlay {
    position: fixed; inset: 0;
    background: radial-gradient(circle at 50% 15%, rgba(249, 115, 22, 0.14), rgba(7, 10, 18, 0.97) 58%);
    backdrop-filter: blur(10px);
    display: flex; align-items: center; justify-content: center; z-index: 9999;
}
.auth-card {
    background: linear-gradient(180deg, #141d2f 0%, #0f1625 100%);
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 20px; padding: 34px 32px; width: 92%; max-width: 416px;
    box-shadow: 0 28px 64px rgba(0, 0, 0, 0.65), inset 0 1px 0 rgba(255, 255, 255, 0.06);
    text-align: center;
}
.auth-logo {
    font-size: 23px; font-weight: 900; letter-spacing: -0.4px;
    color: var(--brand-orange-light); margin-bottom: 6px;
    display: flex; align-items: center; justify-content: center; gap: 8px;
}
.auth-title { font-size: 12px; color: var(--text-sub); margin-bottom: 22px; font-weight: 500; }
.auth-input-group { margin-bottom: 13px; text-align: left; }
.auth-input-group label { display: block; font-size: 11px; font-weight: 700; margin-bottom: 5px; color: #cbd5e1; }
.auth-btn {
    width: 100%; padding: 12px;
    background: linear-gradient(135deg, var(--brand-orange), var(--brand-orange-hover));
    color: #fff; border: none; border-radius: 10px;
    font-weight: 800; font-size: 13.5px; cursor: pointer; margin-top: 8px;
    box-shadow: var(--shadow-glow-orange); transition: transform 0.14s, filter 0.14s;
}
.auth-btn:hover { filter: brightness(1.08); transform: translateY(-1px); }
.auth-tabs {
    display: grid; grid-template-columns: 1fr 1fr; gap: 6px;
    background: rgba(9, 13, 22, 0.8); padding: 4px; border-radius: 11px;
    border: 1px solid var(--border-sub); margin-bottom: 16px;
}
.auth-tab-btn {
    padding: 8px 6px; border: none; border-radius: 8px; background: transparent;
    color: var(--text-sub); font-size: 12px; font-weight: 800; cursor: pointer; transition: all 0.16s;
}
.auth-tab-btn.active { background: var(--brand-orange); color: #fff; box-shadow: 0 4px 12px rgba(249,115,22,0.3); }
.auth-alert {
    display: none; text-align: left; font-size: 11.5px; font-weight: 700;
    padding: 10px 12px; border-radius: 9px; margin-bottom: 14px; line-height: 1.45;
    background: rgba(244, 63, 94, 0.14); border: 1px solid rgba(244, 63, 94, 0.42); color: #fda4af;
}
.auth-alert.show { display: block; }
.auth-alert.ok { background: rgba(16, 185, 129, 0.14); border-color: rgba(16, 185, 129, 0.42); color: #6ee7b7; }

/* 좌측 메인 네비게이션 레일 (72px) */
.app-rail {
    width: var(--rail-width); min-width: var(--rail-width); height: 100vh;
    background: linear-gradient(180deg, #0b101d 0%, var(--bg-rail) 100%);
    border-right: 1px solid var(--border-sub);
    display: flex; flex-direction: column; align-items: center; padding: 12px 0;
    z-index: 30; flex-shrink: 0;
}
.rail-brand {
    width: 44px; height: 44px; border-radius: 13px;
    background: linear-gradient(135deg, #fb923c 0%, #ea580c 100%);
    color: #fff; display: flex; align-items: center; justify-content: center;
    font-size: 18px; font-weight: 900; margin-bottom: 14px;
    box-shadow: 0 8px 22px rgba(249, 115, 22, 0.38), inset 0 1px 0 rgba(255,255,255,0.28);
    cursor: pointer; transition: transform 0.15s;
}
.rail-brand:hover { transform: scale(1.04); }
.rail-nav { display: flex; flex-direction: column; gap: 4px; width: 100%; padding: 0 7px; flex: 1; overflow-y: auto; }
.rail-btn {
    position: relative; width: 100%; padding: 8px 3px;
    background: transparent; border: 1px solid transparent; border-radius: 11px;
    color: var(--text-sub); display: flex; flex-direction: column; align-items: center; gap: 4px;
    cursor: pointer; transition: all 0.16s ease; font-size: 9.5px; font-weight: 700;
}
.rail-btn i { font-size: 15px; transition: transform 0.16s; }
.rail-btn:hover { background: rgba(255, 255, 255, 0.05); color: #fff; }
.rail-btn:hover i { transform: translateY(-1px); }
.rail-btn.active {
    background: linear-gradient(135deg, rgba(249, 115, 22, 0.2), rgba(249, 115, 22, 0.08));
    border-color: rgba(249, 115, 22, 0.36);
    color: var(--brand-orange-light);
    box-shadow: inset 3px 0 0 var(--brand-orange);
}
.rail-badge {
    position: absolute; top: 3px; right: 4px; min-width: 15px; height: 15px; padding: 0 4px;
    border-radius: 99px; background: var(--accent-red); color: #fff;
    font-size: 9px; font-weight: 800; display: none; align-items: center; justify-content: center;
    box-shadow: 0 2px 6px rgba(244,63,94,0.5);
}
.rail-badge.show { display: flex; }
.rail-badge.orange { background: var(--brand-orange); box-shadow: 0 2px 6px rgba(249,115,22,0.5); }
.rail-footer { width: 100%; padding: 8px 7px 0 7px; display: flex; flex-direction: column; gap: 4px; border-top: 1px solid var(--border-sub); }

/* 메인 워크스페이스 & 폼 / 버튼 디자인 시스템 */
.app-workspace { flex: 1; height: 100vh; overflow: hidden; display: flex; min-width: 0; }
.view-section { display: none; width: 100%; height: 100vh; overflow: hidden; }
.view-section.active { display: flex; }

input[type="text"], input[type="number"], input[type="date"], input[type="time"],
input[type="password"], input[type="email"], input[type="url"], select, textarea {
    width: 100%; padding: 8px 11px;
    border: 1px solid var(--border-sub);
    border-radius: var(--radius-sm);
    font-size: 12px; outline: none;
    background-color: var(--bg-input); color: var(--text-strong);
    font-family: inherit; transition: border-color 0.15s, box-shadow 0.15s, background-color 0.15s;
}
input:hover, select:hover, textarea:hover { border-color: var(--border-strong); }
input:focus, select:focus, textarea:focus {
    border-color: var(--brand-orange);
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.16);
    background-color: #090f1d;
}
input::placeholder, textarea::placeholder { color: var(--text-muted); }
textarea { resize: vertical; line-height: 1.5; }

.btn {
    padding: 8px 13px; border: 1px solid transparent; border-radius: 8px;
    font-size: 11.5px; font-weight: 700; cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    color: #fff; background: var(--bg-card); transition: all 0.15s ease;
    text-decoration: none; letter-spacing: -0.01em; white-space: nowrap;
}
.btn:hover { filter: brightness(1.1); transform: translateY(-0.5px); }
.btn:active { transform: translateY(0); }
.btn-primary { background: linear-gradient(135deg, #3b82f6, #2563eb); box-shadow: 0 4px 14px -4px rgba(59,130,246,0.45); }
.btn-orange { background: linear-gradient(135deg, #f97316, #ea580c); box-shadow: 0 4px 14px -4px rgba(249,115,22,0.45); }
.btn-green { background: linear-gradient(135deg, #10b981, #059669); box-shadow: 0 4px 14px -4px rgba(16,185,129,0.4); }
.btn-yellow { background: linear-gradient(135deg, #fbbf24, #f59e0b); color: #0f172a; }
.btn-purple { background: linear-gradient(135deg, #8b5cf6, #7c3aed); box-shadow: 0 4px 14px -4px rgba(139,92,246,0.45); }
.btn-red { background: linear-gradient(135deg, #f43f5e, #e11d48); }
.btn-ghost { background: rgba(255, 255, 255, 0.04); border: 1px solid var(--border-sub); color: var(--text-main); }
.btn-ghost:hover { background: rgba(255, 255, 255, 0.09); border-color: var(--border-strong); }
.btn-sm { padding: 5px 10px; font-size: 10.5px; border-radius: 7px; }
.btn-xs { padding: 3px 7px; font-size: 10px; border-radius: 6px; }

.input-with-btn { display: flex; gap: 5px; align-items: stretch; }
.input-with-btn input { flex: 1; min-width: 0; }
.input-with-btn .btn { flex-shrink: 0; }

/* 뱃지 */
.badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 8px; border-radius: 99px; font-size: 10px; font-weight: 800; white-space: nowrap;
    border: 1px solid transparent;
}
.badge-RECEIVED { background: rgba(59,130,246,0.14); border-color: rgba(59,130,246,0.28); color: #93c5fd; }
.badge-DIAGNOSING { background: rgba(168,85,247,0.14); border-color: rgba(168,85,247,0.3); color: #d8b4fe; }
.badge-WAITING_PART { background: rgba(245,158,11,0.16); border-color: rgba(245,158,11,0.32); color: #fcd34d; }
.badge-REPAIRING { background: rgba(249,115,22,0.16); border-color: rgba(249,115,22,0.32); color: #fdba74; }
.badge-COMPLETED { background: rgba(16,185,129,0.16); border-color: rgba(16,185,129,0.32); color: #6ee7b7; }
.badge-DELIVERED { background: rgba(148,163,184,0.12); border-color: rgba(148,163,184,0.24); color: #cbd5e1; }
.badge-CANCELED { background: rgba(244,63,94,0.14); border-color: rgba(244,63,94,0.3); color: #fda4af; }
.badge-PAID { background: rgba(16,185,129,0.16); border-color: rgba(16,185,129,0.3); color: #6ee7b7; }
.badge-PARTIAL { background: rgba(245,158,11,0.16); border-color: rgba(245,158,11,0.3); color: #fcd34d; }
.badge-UNPAID { background: rgba(244,63,94,0.16); border-color: rgba(244,63,94,0.32); color: #fda4af; }
.badge-PERSONAL { background: rgba(56,189,248,0.14); border-color: rgba(56,189,248,0.28); color: #7dd3fc; }
.badge-BUSINESS { background: rgba(249,115,22,0.15); border-color: rgba(249,115,22,0.3); color: #fdba74; }
.badge-NEW { background: rgba(16,185,129,0.16); border-color: rgba(16,185,129,0.3); color: #6ee7b7; }
.badge-USED_OK { background: rgba(59,130,246,0.16); border-color: rgba(59,130,246,0.3); color: #93c5fd; }
.badge-USED_HOLD { background: rgba(245,158,11,0.16); border-color: rgba(245,158,11,0.3); color: #fcd34d; }
.badge-SOLD { background: rgba(148,163,184,0.14); border-color: rgba(148,163,184,0.24); color: #cbd5e1; }
.badge-PLANNED { background: rgba(59,130,246,0.16); border-color: rgba(59,130,246,0.3); color: #93c5fd; }
.badge-DONE { background: rgba(16,185,129,0.16); border-color: rgba(16,185,129,0.3); color: #6ee7b7; }
.badge-ADMIN { background: rgba(249,115,22,0.16); border-color: rgba(249,115,22,0.32); color: #fdba74; }
.badge-TECH { background: rgba(56,189,248,0.15); border-color: rgba(56,189,248,0.3); color: #7dd3fc; }
.badge-READY { background: rgba(148,163,184,0.16); border-color: rgba(148,163,184,0.28); color: #e2e8f0; }
.badge-SENT { background: rgba(59,130,246,0.16); border-color: rgba(59,130,246,0.32); color: #93c5fd; }
.badge-ARRIVED { background: rgba(139,92,246,0.16); border-color: rgba(139,92,246,0.32); color: #c4b5fd; }
.badge-PROCESSING { background: rgba(245,158,11,0.16); border-color: rgba(245,158,11,0.32); color: #fcd34d; }
.badge-RETURNED { background: rgba(16,185,129,0.18); border-color: rgba(16,185,129,0.36); color: #6ee7b7; }
.badge-DELAYED { background: rgba(244,63,94,0.22); border-color: rgba(244,63,94,0.5); color: #fecdd3; animation: pulseWarn 2s infinite; }
@keyframes pulseWarn { 0%, 100% { opacity: 1; } 50% { opacity: 0.72; } }

/* 일반 페이지 스크롤 뷰 */
.page-scroll { flex: 1; height: 100vh; overflow-y: auto; padding: 26px 30px; }
.page-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 20px; padding-bottom: 15px; border-bottom: 1px solid var(--border-sub);
    flex-wrap: wrap; gap: 12px;
}
.page-title {
    font-size: 20px; font-weight: 900; letter-spacing: -0.025em;
    display: flex; align-items: center; gap: 10px; color: var(--text-strong);
}
.page-title i {
    width: 34px; height: 34px; border-radius: 10px;
    background: rgba(249, 115, 22, 0.14); border: 1px solid rgba(249, 115, 22, 0.28);
    color: var(--brand-orange-light); font-size: 15px;
    display: inline-flex; align-items: center; justify-content: center;
}

.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(185px, 1fr)); gap: 14px; margin-bottom: 20px; }
.kpi-card {
    position: relative; overflow: hidden;
    background: linear-gradient(180deg, #151f33 0%, #111827 100%);
    border: 1px solid var(--border-sub); border-radius: var(--radius-lg);
    padding: 16px 18px; cursor: pointer;
    box-shadow: var(--shadow-card); transition: transform 0.16s, border-color 0.16s, box-shadow 0.16s;
}
.kpi-card::before {
    content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
    background: linear-gradient(90deg, transparent, rgba(249,115,22,0.55), transparent);
    opacity: 0; transition: opacity 0.2s;
}
.kpi-card:hover { transform: translateY(-2px); border-color: rgba(249,115,22,0.45); box-shadow: 0 14px 32px -12px rgba(0,0,0,0.65); }
.kpi-card:hover::before { opacity: 1; }
.kpi-label { font-size: 11px; color: var(--text-sub); font-weight: 700; margin-bottom: 9px; display: flex; justify-content: space-between; align-items: center; }
.kpi-value { font-size: 22px; font-weight: 900; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.kpi-sub { font-size: 10.5px; color: var(--text-muted); margin-top: 6px; font-weight: 500; }

.dash-two-col { display: grid; grid-template-columns: 1.15fr 1fr; gap: 18px; margin-bottom: 18px; }
.panel-card {
    background: linear-gradient(180deg, #131c2e 0%, #101726 100%);
    border: 1px solid var(--border-sub); border-radius: var(--radius-lg);
    padding: 18px 20px; box-shadow: var(--shadow-card);
}
.panel-card-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 14px; padding-bottom: 11px; border-bottom: 1px solid var(--border-sub); gap: 8px; flex-wrap: wrap;
}
.panel-card-title { font-size: 14px; font-weight: 800; letter-spacing: -0.015em; display: flex; align-items: center; gap: 8px; color: var(--text-strong); }

.data-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.data-table th, .data-table td { padding: 10px 10px; border-bottom: 1px solid rgba(148,163,184,0.09); text-align: left; vertical-align: middle; }
.data-table th { color: var(--text-sub); font-weight: 800; font-size: 10.5px; letter-spacing: 0.02em; background: rgba(9, 13, 22, 0.55); }
.data-table th:first-child { border-radius: 7px 0 0 7px; }
.data-table th:last-child { border-radius: 0 7px 7px 0; }
.data-table tbody tr { transition: background 0.12s; }
.data-table tbody tr:hover { background: rgba(255, 255, 255, 0.035); }
.data-table tbody tr:last-child td { border-bottom: none; }
.num { text-align: right !important; font-variant-numeric: tabular-nums; }

/* 고객·장비 CRM 분할 */
.crm-split { display: flex; width: 100%; height: 100vh; overflow: hidden; }
.crm-list-pane { width: 380px; min-width: 325px; height: 100vh; background: var(--bg-sidebar); border-right: 1px solid var(--border-sub); display: flex; flex-direction: column; }
.crm-list-top { padding: 16px; border-bottom: 1px solid var(--border-sub); display: flex; flex-direction: column; gap: 9px; }
.filter-pills { display: flex; gap: 5px; flex-wrap: wrap; background: rgba(9,13,22,0.65); padding: 3px; border-radius: 9px; border: 1px solid var(--border-sub); }
.pill-btn { flex: 1; padding: 6px 11px; border-radius: 7px; border: none; background: transparent; color: var(--text-sub); font-size: 11px; font-weight: 700; cursor: pointer; white-space: nowrap; transition: all 0.15s; }
.pill-btn:hover { color: #fff; }
.pill-btn.active { background: var(--brand-orange); color: #fff; box-shadow: 0 3px 10px rgba(249,115,22,0.32); }
.crm-list-scroll { flex: 1; overflow-y: auto; padding: 11px 13px; display: flex; flex-direction: column; gap: 8px; }
.customer-card { padding: 12px 14px; border-radius: var(--radius-md); background: rgba(20, 29, 47, 0.72); border: 1px solid var(--border-sub); cursor: pointer; transition: all 0.15s; }
.customer-card:hover { border-color: rgba(56,189,248,0.45); background: rgba(26, 37, 59, 0.85); }
.customer-card.active { border-color: var(--brand-orange); background: rgba(249, 115, 22, 0.11); box-shadow: inset 3px 0 0 var(--brand-orange); }
.customer-card-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 5px; }
.customer-name { font-size: 13.5px; font-weight: 800; color: #fff; }
.customer-meta { font-size: 11px; color: var(--text-sub); display: flex; gap: 10px; flex-wrap: wrap; }

.crm-detail-pane { flex: 1; height: 100vh; overflow-y: auto; padding: 24px 28px; }
.detail-hero { background: linear-gradient(135deg, #162035 0%, #101726 100%); border: 1px solid var(--border-sub); border-radius: var(--radius-lg); padding: 18px 22px; margin-bottom: 18px; box-shadow: var(--shadow-card); }
.detail-hero-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.detail-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.detail-info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(175px, 1fr)); gap: 12px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border-sub); font-size: 12px; }
.detail-info-item span { display: block; font-size: 10.5px; color: var(--text-muted); margin-bottom: 3px; font-weight: 600; }
.sub-tabs { display: flex; gap: 7px; margin-bottom: 14px; border-bottom: 1px solid var(--border-sub); padding-bottom: 10px; }
.sub-tab-btn { padding: 7px 14px; border: 1px solid transparent; border-radius: 8px; background: transparent; color: var(--text-sub); font-size: 12px; font-weight: 800; cursor: pointer; transition: all 0.15s; }
.sub-tab-btn:hover { color: #fff; background: rgba(255,255,255,0.05); }
.sub-tab-btn.active { background: rgba(59,130,246,0.18); border-color: rgba(59,130,246,0.4); color: #93c5fd; }

.asset-card { background: var(--bg-surface); border: 1px solid var(--border-sub); border-radius: var(--radius-md); padding: 15px 17px; margin-bottom: 11px; box-shadow: var(--shadow-card); }
.asset-card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.warranty-ok { background: rgba(16,185,129,0.16); border-color: rgba(16,185,129,0.32); color: #6ee7b7; }
.warranty-soon { background: rgba(245,158,11,0.18); border-color: rgba(245,158,11,0.38); color: #fcd34d; }
.warranty-exp { background: rgba(148,163,184,0.14); border-color: rgba(148,163,184,0.24); color: #cbd5e1; }
.asset-spec-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 5px 12px; font-size: 11px; color: #cbd5e1; background: rgba(9, 13, 22, 0.58); border: 1px solid rgba(148,163,184,0.1); padding: 10px 12px; border-radius: 9px; margin-top: 8px; }
.asset-spec-row { display: flex; gap: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.asset-spec-cate { color: var(--sky); font-weight: 700; min-width: 54px; }

/* 견적기 & A/S 사이드바 (로고 박스 완전 제거) */
.sidebar { width: var(--sidebar-width); min-width: var(--sidebar-width); background: var(--bg-sidebar); border-right: 1px solid var(--border-sub); display: flex; flex-direction: column; height: 100vh; position: relative; z-index: 10; box-shadow: 6px 0 32px rgba(0,0,0,0.38); }
.sidebar-header { background: rgba(9, 13, 22, 0.85); border-bottom: 1px solid var(--border-sub); padding: 13px 18px; display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; }
.sidebar-title { font-size: 14px; font-weight: 800; letter-spacing: -0.02em; color: #fff; display: flex; align-items: center; gap: 8px; }
.sidebar-title i { color: var(--brand-orange-light); }
.version-badge { font-size: 10px; background: linear-gradient(135deg, var(--brand-orange), #ea580c); padding: 3px 9px; border-radius: 99px; color: #fff; font-weight: 800; }

.tab-menu { display: flex; background: rgba(9, 13, 22, 0.72); border-bottom: 1px solid var(--border-sub); padding: 0 10px; flex-shrink: 0; gap: 4px; }
.tab-btn { flex: 1; padding: 11px 3px; background: none; border: none; font-size: 11.5px; font-weight: 700; color: var(--text-sub); cursor: pointer; border-bottom: 2.5px solid transparent; display: flex; align-items: center; justify-content: center; gap: 5px; transition: color 0.15s; }
.tab-btn:hover { color: #fff; }
.tab-btn.active { color: var(--brand-orange-light); border-bottom-color: var(--brand-orange); }
.tab-btn.active.tab-trade-btn { color: var(--accent-green); border-bottom-color: var(--accent-green); }
.badge-count { font-size: 9.5px; background: rgba(255,255,255,0.08); padding: 1px 6px; border-radius: 99px; }

.sidebar-fixed-top { background: var(--bg-sidebar); padding: 12px 16px 11px 16px; border-bottom: 1px solid var(--border-sub); flex-shrink: 0; }
.mode-toggle-area { background: rgba(249, 115, 22, 0.08); border: 1px solid rgba(249, 115, 22, 0.28); border-radius: 9px; padding: 6px 11px; margin-bottom: 9px; display: flex; align-items: center; justify-content: space-between; }
.mode-toggle-label { font-size: 11px; font-weight: 800; color: #fdba74; display: flex; align-items: center; gap: 6px; }
.mode-select { width: auto !important; padding: 5px 10px; border: 1px solid rgba(249, 115, 22, 0.4); border-radius: 7px; background: var(--bg-input); font-size: 11px; font-weight: 800; color: #fdba74; cursor: pointer; }

.danawa-paste-box { background: rgba(56, 189, 248, 0.06); border: 1.5px dashed rgba(56, 189, 248, 0.4); border-radius: 10px; padding: 9px 10px; }
.danawa-paste-box label { display: flex; align-items: center; justify-content: space-between; font-size: 11px; font-weight: 800; color: var(--sky); margin-bottom: 6px; }
.danawa-paste-row { display: flex; gap: 7px; }
.danawa-paste-box textarea { flex: 1; height: 50px; resize: none; font-size: 11.5px; padding: 6px 9px; }
.btn-paste-add { width: 56px; background: linear-gradient(135deg, #3b82f6, #2563eb); color: #fff; border: none; border-radius: 8px; font-size: 11px; font-weight: 800; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 3px; }
.btn-paste-add:hover { filter: brightness(1.1); }

/* 호환성 진단 / 정밀 검수표 / 수리 상용구 / 전자서명 */
.compat-panel { border-radius: 10px; padding: 9px 12px; margin-bottom: 11px; font-size: 11px; line-height: 1.5; border: 1px solid var(--border-sub); background: rgba(15, 23, 42, 0.55); }
.compat-panel.ok { background: rgba(16, 185, 129, 0.09); border-color: rgba(16, 185, 129, 0.34); color: #a7f3d0; }
.compat-panel.warn { background: rgba(245, 158, 11, 0.1); border-color: rgba(245, 158, 11, 0.38); color: #fde68a; }
.compat-panel.err { background: rgba(244, 63, 94, 0.12); border-color: rgba(244, 63, 94, 0.44); color: #fecdd3; }
.compat-title { font-weight: 800; display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.compat-list { list-style: none; display: flex; flex-direction: column; gap: 3px; }
.compat-list li { display: flex; align-items: flex-start; gap: 6px; }

.qc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; background: rgba(9, 13, 22, 0.5); border: 1px solid var(--border-sub); border-radius: 9px; padding: 10px; }
.qc-item-lbl { display: flex; align-items: center; gap: 6px; font-size: 11px; color: #cbd5e1; cursor: pointer; padding: 3px 4px; border-radius: 5px; }
.qc-item-lbl:hover { background: rgba(255,255,255,0.04); color: #fff; }
.qc-item-lbl input { width: auto !important; accent-color: var(--accent-green); }

.macro-bar { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 9px; }
.macro-chip { padding: 5px 9px; border-radius: 99px; border: 1px solid rgba(249,115,22,0.34); background: rgba(249,115,22,0.1); color: #fdba74; font-size: 10.5px; font-weight: 700; cursor: pointer; transition: all 0.14s; display: inline-flex; align-items: center; gap: 4px; }
.macro-chip:hover { background: var(--brand-orange); color: #fff; border-color: var(--brand-orange); }

.sig-status-box { display: flex; align-items: center; justify-content: space-between; gap: 8px; background: rgba(15, 23, 42, 0.65); border: 1px dashed var(--border-strong); border-radius: 9px; padding: 8px 11px; margin-top: 8px; }
.sig-thumb { height: 32px; background: #fff; border-radius: 4px; padding: 2px 6px; border: 1px solid #cbd5e1; }
#sig-pad-canvas { width: 100%; height: 220px; background: #ffffff; border: 2px solid #cbd5e1; border-radius: 10px; touch-action: none; cursor: crosshair; display: block; }

.margin-calc-box { background: rgba(249, 115, 22, 0.07); border: 1px solid rgba(249, 115, 22, 0.28); border-radius: 10px; padding: 9px 11px; margin-bottom: 11px; }
.margin-calc-row { display: grid; grid-template-columns: 0.9fr 1fr 1fr auto; gap: 6px; align-items: end; }

.sidebar-scrollable-content { padding: 14px 16px; overflow-y: auto; flex: 1; }
.form-section { margin-bottom: 15px; border-bottom: 1px solid rgba(148,163,184,0.1); padding-bottom: 14px; }
.form-section:last-child { border-bottom: none; padding-bottom: 0; margin-bottom: 0; }
.section-title { font-size: 12px; font-weight: 800; color: var(--sky); margin-bottom: 9px; display: flex; align-items: center; gap: 6px; }
.form-group { margin-bottom: 8px; }
.form-group label { display: block; font-size: 10.5px; font-weight: 700; color: var(--text-sub); margin-bottom: 4px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; }

.quick-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 6px; }
.btn-quick { padding: 8px; border: 1px solid var(--border-sub); border-radius: 8px; background: rgba(255,255,255,0.03); color: var(--text-main); font-size: 11px; font-weight: 700; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 6px; transition: all 0.14s; }
.btn-quick:hover { background: rgba(249, 115, 22, 0.14); border-color: rgba(249, 115, 22, 0.45); color: #fff; }
.set-saver-box { background: rgba(16, 185, 129, 0.05); border: 1px solid rgba(16, 185, 129, 0.24); border-radius: 10px; padding: 9px 11px; margin-bottom: 13px; }
.btn-set-io { width: 100%; padding: 7.5px; border: none; border-radius: 7px; font-size: 11px; font-weight: 800; cursor: pointer; color: #fff; }
.btn-save-office { background: linear-gradient(135deg, #0d9488, #0f766e); }
.btn-save-game { background: linear-gradient(135deg, #0284c7, #0369a1); }

.internal-margin-bar { background: linear-gradient(135deg, rgba(16,185,129,0.12), rgba(15,23,42,0.65)); border: 1px solid rgba(16, 185, 129, 0.28); border-radius: 10px; padding: 9px 10px; margin-bottom: 10px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; text-align: center; }
.margin-cell span { display: block; font-size: 9.5px; color: var(--text-sub); margin-bottom: 2px; }
.margin-cell strong { font-size: 12.5px; font-variant-numeric: tabular-nums; }

.autocomplete-wrap { position: relative; }
.autocomplete-list { position: absolute; top: 100%; left: 0; right: 0; z-index: 60; background: #0f172a; border: 1px solid var(--brand-orange); border-radius: 8px; max-height: 190px; overflow-y: auto; display: none; box-shadow: 0 16px 32px rgba(0, 0, 0, 0.65); }
.autocomplete-list.open { display: block; }
.autocomplete-item { padding: 8px 11px; font-size: 11.5px; cursor: pointer; border-bottom: 1px solid rgba(255,255,255,0.06); display: flex; justify-content: space-between; }
.autocomplete-item:hover { background: rgba(249,115,22,0.18); }

.item-form-card { background: rgba(20, 29, 47, 0.68); border: 1px solid var(--border-sub); border-radius: 10px; padding: 9px 11px; margin-bottom: 8px; transition: border-color 0.14s; }
.item-form-card:hover { border-color: rgba(56, 189, 248, 0.45); }
.item-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.item-card-controls { display: flex; align-items: center; gap: 4px; }
.btn-move-item { background: rgba(255,255,255,0.06); border: 1px solid var(--border-sub); color: #cbd5e1; border-radius: 5px; width: 22px; height: 22px; font-size: 10px; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.btn-move-item:hover:not(:disabled) { background: var(--primary); color: #fff; }
.btn-move-item:disabled { opacity: 0.25; cursor: not-allowed; }
.btn-remove-item { background: rgba(244,63,94,0.12); border: 1px solid rgba(244,63,94,0.28); color: #fda4af; border-radius: 5px; width: 22px; height: 22px; font-size: 10px; cursor: pointer; display: flex; align-items: center; justify-content: center; margin-left: 3px; }
.btn-remove-item:hover { background: var(--accent-red); color: #fff; }
.btn-add-item { width: 100%; padding: 9px; background: rgba(255,255,255,0.04); color: #fff; border: 1px dashed var(--border-strong); border-radius: 9px; font-size: 11.5px; font-weight: 800; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 6px; }
.btn-add-item:hover { background: rgba(59,130,246,0.14); border-color: var(--primary); }
.internal-fields { margin-top: 7px; padding-top: 7px; border-top: 1px dashed rgba(148,163,184,0.2); }

.photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin-top: 8px; }
.photo-thumb { position: relative; aspect-ratio: 4/3; border-radius: 8px; overflow: hidden; border: 1px solid var(--border-sub); background: #090d16; cursor: pointer; }
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-thumb .photo-del { position: absolute; top: 4px; right: 4px; width: 20px; height: 20px; border-radius: 50%; border: none; background: rgba(244,63,94,0.92); color: #fff; font-size: 10px; cursor: pointer; }
.photo-thumb .photo-cap { position: absolute; bottom: 0; left: 0; right: 0; background: rgba(9,13,22,0.78); font-size: 9.5px; padding: 3px 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.month-filter-area { display: flex; gap: 6px; margin-top: 7px; }
.history-list { display: flex; flex-direction: column; gap: 8px; }
.history-item { border: 1px solid var(--border-sub); border-radius: 10px; padding: 11px 12px; background: rgba(20, 29, 47, 0.58); transition: border-color 0.14s; }
.history-item:hover { border-color: rgba(249,115,22,0.4); }
.history-info { font-size: 10.5px; color: var(--text-sub); margin-bottom: 3px; }
.history-title { font-size: 13px; font-weight: 800; color: #fff; margin-bottom: 4px; }
.history-meta { font-size: 11.5px; font-weight: 700; color: var(--text-sub); }
.history-actions { margin-top: 8px; display: flex; gap: 5px; }
.btn-hist { flex: 1; padding: 6.5px; font-size: 10.5px; font-weight: 800; border: none; border-radius: 6px; cursor: pointer; color: #fff; display: flex; align-items: center; justify-content: center; gap: 4px; }
.btn-hist-load { background: var(--primary); }
.btn-hist-del { background: var(--accent-red); width: 58px; flex: none; }

.trade-table-container { overflow-x: auto; border: 1px solid var(--border-sub); border-radius: 9px; background: rgba(9,13,22,0.5); margin-bottom: 8px; }
.trade-list-table { width: 100%; border-collapse: collapse; font-size: 10.5px; }
.trade-list-table th, .trade-list-table td { padding: 7.5px 6px; text-align: center; border-bottom: 1px solid rgba(255,255,255,0.05); }
.trade-list-table th { background: rgba(9,13,22,0.85); font-weight: 800; color: var(--accent-green); }
.trade-list-table td.cell-client { font-weight: 700; text-align: left; }
.trade-list-table td.cell-price { font-weight: 700; color: var(--accent-green); text-align: right; }
.trade-month-summary { font-size: 11px; font-weight: 800; background: rgba(16,185,129,0.1); padding: 8px 12px; border-radius: 8px; border: 1px solid rgba(16,185,129,0.28); display: flex; justify-content: space-between; }

.sidebar-footer { padding: 10px 16px 6px 16px; background: rgba(9,13,22,0.92); border-top: 1px solid var(--border-sub); display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; flex-shrink: 0; }
.sidebar-footer-sub { padding: 0 16px 11px 16px; background: rgba(9,13,22,0.92); display: flex; flex-direction: column; gap: 6px; flex-shrink: 0; }
.sidebar-footer-sub-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px; }
.btn-main { padding: 8px 5px; border-radius: 7px; font-size: 10.8px; font-weight: 800; border: none; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 4px; color: #fff; transition: filter 0.14s; }
.btn-main:hover { filter: brightness(1.1); }
.btn-print { background: linear-gradient(135deg, #3b82f6, #2563eb); }
.btn-save-est { background: linear-gradient(135deg, #0d9488, #0f766e); }
.btn-reset { background: #334155; }
.btn-share { background: linear-gradient(135deg, #fbbf24, #f59e0b); color: #0f172a; }
.btn-xlsx { background: #15803d; }
.btn-transform-save { background: linear-gradient(135deg, #10b981, #059669); width: 100%; padding: 8.5px; font-size: 11.5px; font-weight: 800; border: none; border-radius: 8px; color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 6px; box-shadow: 0 4px 14px -4px rgba(16,185,129,0.45); }

/* 캘린더 */
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-dow { text-align: center; font-size: 11px; font-weight: 800; color: var(--text-sub); padding: 6px 0; }
.cal-cell { min-height: 98px; background: rgba(9, 13, 22, 0.55); border: 1px solid var(--border-sub); border-radius: 9px; padding: 7px; display: flex; flex-direction: column; gap: 4px; cursor: pointer; }
.cal-cell:hover { border-color: var(--primary); }
.cal-cell.today { border-color: var(--brand-orange); background: rgba(249, 115, 22, 0.09); }
.cal-cell.empty { background: transparent; border-color: transparent; cursor: default; }
.cal-day-num { font-size: 11px; font-weight: 800; color: var(--text-sub); }
.cal-cell.today .cal-day-num { color: var(--brand-orange-light); }
.cal-event-pill { font-size: 10px; font-weight: 700; padding: 3px 6px; border-radius: 5px; background: rgba(59,130,246,0.2); color: #bfdbfe; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-event-pill.type-INSTALL { background: rgba(16,185,129,0.2); color: #a7f3d0; }
.cal-event-pill.type-CHECKUP { background: rgba(245,158,11,0.2); color: #fde68a; }
.cal-event-pill.done { opacity: 0.45; text-decoration: line-through; }

/* 우측 실시간 A4 미리보기 (기존 100% 픽셀 보존) */
.preview-pane { flex: 1; overflow: auto; padding: 26px 22px; background: radial-gradient(circle at 50% 0%, #151f33 0%, #090d16 70%); height: 100vh; }
.a4-paper { width: 794px; min-width: 794px; max-width: 794px; min-height: 1123px; margin: 0 auto; background: #ffffff; box-shadow: 0 20px 55px rgba(0, 0, 0, 0.6); padding: 38px 40px 38px 44px; display: flex; flex-direction: column; justify-content: space-between; position: relative; color: #000000; border-radius: 3px; }
.watermark { position: absolute; top: 52%; left: 50%; transform: translate(-50%, -50%) rotate(-15deg); width: 540px; height: auto; opacity: 0.05; pointer-events: none; z-index: 0; mix-blend-mode: multiply; }
.doc-header { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 16px; border-bottom: 3px solid var(--doc-primary); padding-bottom: 10px; position: relative; z-index: 1; }
.doc-logo { display: flex; align-items: center; height: 42px; }
.doc-logo img { height: 100%; object-fit: contain; max-height: 42px; }
.doc-title { font-size: 28px; font-weight: 900; letter-spacing: 12px; color: #0f172a; text-align: center; }
.doc-table { width: 100%; border-collapse: collapse; font-size: 11.5px; margin-bottom: 12px; position: relative; z-index: 1; background: transparent; table-layout: fixed; }
.doc-table th, .doc-table td { border: 1px solid #1e293b; padding: 5px 8px; height: 27px; text-align: center; vertical-align: middle; word-break: break-all; }
.doc-table th { background-color: #f1f5f9; font-weight: 800; color: #0f172a; text-align: center !important; }
.info-table td { text-align: center !important; font-weight: 500; }
.info-table th { width: 82px; }
#preview-biz-tel { text-align: left !important; padding-left: 10px !important; }
#preview-biz-fax, #preview-biz-item { font-size: 10px !important; letter-spacing: -0.3px; white-space: nowrap; padding: 4px !important; }
.info-container { display: grid; grid-template-columns: 0.9fr 1.3fr; gap: 12px; margin-bottom: 12px; position: relative; z-index: 1; }
.stamp-container { position: relative; display: flex; align-items: center; justify-content: center; height: 100%; }
.stamp-img { position: absolute; right: 4px; top: 50%; transform: translateY(-50%) rotate(-4deg); width: 36px; height: 36px; pointer-events: none; opacity: 0.92; mix-blend-mode: multiply; }
.items-table th { background: #e2e8f0; border-top: 2px solid #0f172a; border-bottom: 1.5px solid #0f172a; font-weight: 800; font-size: 11.5px; }
.items-table td { font-size: 11px; padding: 6px 8px; }
.items-table .col-idx { width: 38px; text-align: center !important; }
.items-table .col-cate { width: 82px; font-weight: 700; color: #1e293b; text-align: center !important; }
.items-table .col-name { width: auto; text-align: left !important; padding-left: 10px !important; font-weight: 600; }
.items-table .col-price { width: 95px; text-align: right !important; padding-right: 10px !important; font-variant-numeric: tabular-nums; }
.items-table .col-qty { width: 46px; text-align: right !important; padding-right: 10px !important; font-variant-numeric: tabular-nums; }
.items-table .col-total { width: 105px; text-align: right !important; padding-right: 10px !important; font-weight: 700; font-variant-numeric: tabular-nums; }
.total-section { border: 2px solid #0f172a; padding: 10px 18px; background: #f8fafc; margin-bottom: 10px; position: relative; z-index: 1; }
.total-row-item { display: flex; justify-content: space-between; align-items: center; }
.total-label { font-weight: 900; font-size: 15px; color: var(--doc-primary); letter-spacing: 1px; }
.total-val { font-weight: 900; font-size: 23px; color: #0f172a; font-variant-numeric: tabular-nums; }
.empty-preview-message { text-align: center !important; color: #94a3b8; font-style: italic; padding: 24px 0 !important; font-size: 12px; }
.doc-notes { border: 1px solid #1e293b; padding: 9px 14px; font-size: 11px; line-height: 1.6; background: rgba(255,255,255,0.95); margin-bottom: 8px; text-align: left; position: relative; z-index: 1; }
.note-item { display: flex; align-items: center; gap: 6px; font-weight: 600; color: #0f172a; }
.note-bullet { color: var(--doc-primary); font-size: 8px; }
.doc-terms { border: 1px solid #cbd5e1; padding: 8px 12px; font-size: 10.5px; line-height: 1.6; background: #f8fafc; margin-bottom: 10px; text-align: left; color: #1e293b; font-weight: 600; position: relative; z-index: 1; }
.trade-special-terms { border: 1.5px solid #1e293b; border-radius: 4px; background: #f8fafc; padding: 10px 14px; margin-bottom: 10px; position: relative; z-index: 1; text-align: left; }
.trade-terms-title { font-size: 11.5px; font-weight: 900; color: var(--doc-primary); border-bottom: 1px solid #cbd5e1; padding-bottom: 5px; margin-bottom: 7px; display: flex; align-items: center; gap: 6px; }
.trade-terms-list { display: flex; flex-direction: column; gap: 4.5px; }
.trade-term-row { display: flex; align-items: flex-start; font-size: 9.8px; line-height: 1.45; color: #1e293b; }
.trade-term-label { font-weight: 800; color: #0f172a; min-width: 68px; width: 68px; flex-shrink: 0; }
.trade-term-desc { flex: 1; font-weight: 500; color: #334155; word-break: keep-all; }
.doc-footer { text-align: center; font-size: 10.5px; color: #334155; border-top: 1.5px solid #cbd5e1; padding-top: 10px; line-height: 1.5; font-weight: 600; position: relative; z-index: 1; }

.a4-qc-badge { border: 1.5px solid #059669; background: #ecfdf5; color: #065f46; border-radius: 4px; padding: 7px 12px; margin-bottom: 8px; font-size: 10.2px; line-height: 1.5; text-align: left; position: relative; z-index: 1; }
.a4-qc-badge strong { color: #047857; font-weight: 900; }
.a4-sig-img { height: 34px; max-width: 140px; object-fit: contain; vertical-align: middle; margin-left: 6px; }

.as-box { border: 1.2px solid #1e293b; padding: 10px 12px; margin-bottom: 10px; background: rgba(255,255,255,0.96); position: relative; z-index: 1; text-align: left; }
.as-box-title { font-size: 11.5px; font-weight: 900; color: var(--doc-primary); border-bottom: 1px solid #cbd5e1; padding-bottom: 4px; margin-bottom: 7px; }
.as-box-content { font-size: 11.5px; line-height: 1.6; white-space: pre-wrap; color: #0f172a; min-height: 36px; }
.as-sign-row { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; padding: 9px 14px; border: 1px dashed #64748b; background: #f8fafc; font-size: 11px; position: relative; z-index: 1; }
.chip-row { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 7px; }
.chip-btn { padding: 4px 9px; border-radius: 99px; border: 1px solid var(--border-sub); background: var(--bg-input); color: var(--text-sub); font-size: 10px; font-weight: 700; cursor: pointer; }
.chip-btn:hover { color: #fff; border-color: var(--border-strong); }
.chip-btn.active { background: var(--brand-orange); border-color: var(--brand-orange); color: #fff; }

.qr-hd-preview-wrap { background: #ffffff; padding: 8px; border-radius: 10px; border: 1px solid var(--border-sub); display: inline-block; max-width: 100%; box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45); }
#qr-hd-canvas { display: block; max-width: 100%; max-height: 420px; width: auto; height: auto; image-rendering: pixelated; border: 1px dashed #cbd5e1; background: #ffffff; margin: 0 auto; }
#ba-preview-canvas { display: block; width: 100%; max-height: 380px; object-fit: contain; border-radius: 10px; border: 1px solid var(--border-sub); background: #090d16; margin: 0 auto; }
#barcode-reader-box { width: 100%; min-height: 240px; border-radius: 10px; overflow: hidden; background: #090d16; border: 1px solid var(--border-sub); }

/* 모달 & 토스트 */
.modal-backdrop { position: fixed; inset: 0; background: rgba(7, 10, 18, 0.82); backdrop-filter: blur(5px); display: none; align-items: center; justify-content: center; z-index: 5000; }
.modal-backdrop.open { display: flex; }
.modal-box { background: linear-gradient(180deg, #151f33 0%, #101726 100%); border: 1px solid var(--border-strong); border-radius: 15px; width: 92%; max-width: 550px; max-height: 90vh; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 28px 60px rgba(0, 0, 0, 0.68); }
.modal-header { padding: 14px 18px; background: rgba(9, 13, 22, 0.85); border-bottom: 1px solid var(--border-sub); display: flex; justify-content: space-between; align-items: center; font-size: 14px; font-weight: 800; color: #fff; }
.modal-body { padding: 16px 18px; overflow-y: auto; }
.modal-footer { padding: 12px 18px; background: rgba(9, 13, 22, 0.85); border-top: 1px solid var(--border-sub); display: flex; justify-content: flex-end; gap: 8px; }

#toast-box { position: fixed; bottom: 22px; right: 24px; z-index: 10050; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast-msg { background: #141d2f; border: 1px solid var(--border-strong); border-left: 4px solid var(--accent-green); color: #fff; padding: 12px 17px; border-radius: 10px; font-size: 12px; font-weight: 700; box-shadow: 0 14px 36px rgba(0, 0, 0, 0.55); }
.toast-msg.error { border-left-color: var(--accent-red); }

.price-up { color: #fb7185; font-size: 10px; font-weight: 800; }
.price-down { color: #34d399; font-size: 10px; font-weight: 800; }
.price-same { color: var(--text-sub); font-size: 10px; }
.sync-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; background: rgba(56, 189, 248, 0.08); border: 1px solid rgba(56, 189, 248, 0.28); border-radius: 12px; padding: 13px 15px; margin-bottom: 14px; }
.account-profile-banner { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; background: rgba(9, 13, 22, 0.65); border: 1px solid var(--border-sub); border-radius: 11px; padding: 13px 15px; margin-bottom: 14px; }
.bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 9px; font-size: 11.5px; }
.bar-label { width: 68px; font-weight: 700; color: var(--text-sub); }
.bar-track { flex: 1; height: 18px; background: #090d16; border-radius: 6px; overflow: hidden; display: flex; }
.bar-trade { background: linear-gradient(90deg, #10b981, #34d399); height: 100%; }
.bar-as { background: linear-gradient(90deg, #f97316, #fb923c); height: 100%; }
.bar-val { width: 105px; text-align: right; font-weight: 800; font-variant-numeric: tabular-nums; }

@media print {
    @page { size: A4 portrait; margin: 10mm 10mm 10mm 12mm; }
    html, body { width: 100% !important; height: auto !important; background: #fff !important; overflow: visible !important; position: static !important; margin: 0 !important; padding: 0 !important; display: block !important; }
    .app-rail, .sidebar, #auth-overlay, #toast-box { display: none !important; }
    .app-workspace { display: block !important; height: auto !important; overflow: visible !important; }
    .view-section { display: none !important; height: auto !important; overflow: visible !important; }
    .modal-backdrop { display: none !important; }

    body.print-mode-quote #view-quotes { display: block !important; }
    body.print-mode-as #view-as { display: block !important; }
    body.print-mode-qr #modal-qr { display: block !important; position: static !important; background: #fff !important; padding: 0 !important; margin: 0 !important; }
    body.print-mode-qr #modal-qr .modal-box { box-shadow: none !important; border: none !important; background: #fff !important; max-width: none !important; width: 100% !important; max-height: none !important; overflow: visible !important; }
    body.print-mode-qr #modal-qr .modal-body { padding: 0 !important; margin: 0 !important; overflow: visible !important; }
    body.print-mode-qr .qr-hd-preview-wrap { padding: 0 !important; margin: 0 !important; border: none !important; box-shadow: none !important; border-radius: 0 !important; display: block !important; }
    body.print-mode-qr #qr-hd-canvas { max-width: none !important; max-height: none !important; border: none !important; margin: 0 !important; page-break-after: avoid !important; }
    body.print-mode-qr #modal-qr .modal-header, body.print-mode-qr #modal-qr .modal-footer, body.print-mode-qr .no-print { display: none !important; }

    .preview-pane { padding: 0 !important; margin: 0 !important; overflow: visible !important; background: none !important; height: auto !important; display: block !important; }
    .a4-paper { box-shadow: none !important; padding: 2mm 4mm 2mm 6mm !important; margin: 0 auto !important; width: 100% !important; min-width: 0 !important; max-width: 100% !important; min-height: auto !important; page-break-inside: avoid; border-radius: 0 !important; }
    * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }
}

@media (max-width: 960px) {
    body { flex-direction: column-reverse; }
    .app-rail { width: 100%; min-width: 0; height: 60px; flex-direction: row; padding: 0 4px; border-right: none; border-top: 1px solid var(--border-sub); }
    .rail-brand, .rail-footer { display: none; }
    .rail-nav { flex-direction: row; overflow-x: auto; gap: 2px; padding: 4px; align-items: center; }
    .rail-btn { min-width: 52px; padding: 5px 2px; font-size: 9px; }
    .rail-btn.active { box-shadow: inset 0 2px 0 var(--brand-orange); }
    .app-workspace, .view-section { height: calc(100vh - 60px); }
    .page-scroll { height: calc(100vh - 60px); padding: 14px 12px; }
    .dash-two-col { grid-template-columns: 1fr; }
    .crm-split { flex-direction: column; overflow-y: auto; height: calc(100vh - 60px); }
    .crm-list-pane { width: 100%; height: auto; max-height: 44vh; }
    .view-section.active { flex-direction: column; overflow-y: auto; }
    .sidebar { width: 100% !important; min-width: 0 !important; height: auto; overflow: visible; }
    .preview-pane { height: auto; overflow-x: auto; }
    .cal-cell { min-height: 68px; padding: 4px; }
}


/* v4.2 세금계산서 상태 뱃지 & A4 2매(공급받는자 파랑 / 공급자 빨강) 출력 양식 */
.badge-DRAFT { background: rgba(245,158,11,0.16); border-color: rgba(245,158,11,0.34); color: #fcd34d; }
.badge-REQUESTED { background: rgba(56,189,248,0.16); border-color: rgba(56,189,248,0.36); color: #7dd3fc; }
.badge-ISSUED { background: rgba(16,185,129,0.18); border-color: rgba(16,185,129,0.36); color: #6ee7b7; }
.badge-FAILED { background: rgba(244,63,94,0.18); border-color: rgba(244,63,94,0.42); color: #fda4af; }

.tax-a4-sheet {
    width: 740px; margin: 0 auto; background: #ffffff; color: #0f172a;
    padding: 18px 22px; font-family: 'Pretendard', "Malgun Gothic", sans-serif;
}
.tax-slip {
    border: 2px solid var(--slip-color, #1d4ed8);
    padding: 10px 12px; margin-bottom: 10px; position: relative;
}
.tax-slip.supplier-copy { --slip-color: #dc2626; }
.tax-slip.buyer-copy { --slip-color: #1d4ed8; }
.tax-slip-head {
    display: flex; justify-content: space-between; align-items: center;
    border-bottom: 1.5px solid var(--slip-color); padding-bottom: 6px; margin-bottom: 7px;
}
.tax-slip-title { font-size: 18px; font-weight: 900; letter-spacing: 5px; color: var(--slip-color); }
.tax-slip-sub { font-size: 11px; font-weight: 800; color: var(--slip-color); }
.tax-tbl { width: 100%; border-collapse: collapse; font-size: 10px; table-layout: fixed; margin-bottom: 6px; }
.tax-tbl th, .tax-tbl td {
    border: 1px solid var(--slip-color); padding: 3.5px 5px; text-align: center;
    vertical-align: middle; word-break: break-all; color: #0f172a;
}
.tax-tbl th { background: rgba(29, 78, 216, 0.06); color: var(--slip-color); font-weight: 800; }
.tax-slip.supplier-copy .tax-tbl th { background: rgba(220, 38, 38, 0.06); }
.tax-tbl td.left { text-align: left !important; padding-left: 6px; }
.tax-tbl td.right { text-align: right !important; padding-right: 6px; font-variant-numeric: tabular-nums; }
.tax-cut-line {
    border-top: 1.5px dashed #94a3b8; margin: 12px 0; text-align: center;
    font-size: 10px; color: #64748b; position: relative;
}
.tax-cut-line span { background: #fff; padding: 0 10px; position: relative; top: -8px; }
.tax-ref-notice { font-size: 9.5px; color: #475569; text-align: center; margin-top: 4px; }
.tax-stamp-sm {
    position: absolute; right: 3px; top: 50%; transform: translateY(-50%);
    width: 26px; height: 26px; opacity: 0.9; mix-blend-mode: multiply; pointer-events: none;
}

@media print {
    body.print-mode-tax #modal-tax-print { display: block !important; position: static !important; background: #fff !important; padding: 0 !important; margin: 0 !important; }
    body.print-mode-tax #modal-tax-print .modal-box { box-shadow: none !important; border: none !important; background: #fff !important; max-width: none !important; width: 100% !important; max-height: none !important; overflow: visible !important; }
    body.print-mode-tax #modal-tax-print .modal-body { padding: 0 !important; margin: 0 !important; overflow: visible !important; }
    body.print-mode-tax #modal-tax-print .modal-header, body.print-mode-tax #modal-tax-print .modal-footer, body.print-mode-tax #modal-tax-print .no-print { display: none !important; }
    body.print-mode-tax .tax-a4-sheet { width: 100% !important; padding: 2mm 4mm !important; }
}


/* v4.3 3채널 홍보 발행 스튜디오 (네이버 블로그 · 당근 · 유튜브 쇼츠) */
.studio-channel-tabs {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px;
}
.studio-tab {
    padding: 10px 10px; border-radius: 10px; border: 1px solid var(--border-sub);
    background: rgba(9, 13, 22, 0.72); color: var(--text-sub);
    font-size: 12px; font-weight: 800; cursor: pointer;
    display: flex; align-items: center; justify-content: center; gap: 7px; transition: all 0.16s;
}
.studio-tab:hover { color: #fff; border-color: var(--border-strong); }
.studio-tab.active.tab-naver { background: rgba(3, 199, 90, 0.18); border-color: #03c75a; color: #4ade80; box-shadow: 0 4px 16px -4px rgba(3, 199, 90, 0.35); }
.studio-tab.active.tab-karrot { background: rgba(255, 111, 15, 0.2); border-color: #ff6f0f; color: #fdba74; box-shadow: 0 4px 16px -4px rgba(255, 111, 15, 0.35); }
.studio-tab.active.tab-shorts { background: rgba(239, 68, 68, 0.18); border-color: #ef4444; color: #fca5a5; box-shadow: 0 4px 16px -4px rgba(239, 68, 68, 0.35); }

.naver-rich-preview {
    background: #ffffff; color: #1e293b; border-radius: 10px; padding: 20px 24px;
    max-height: 360px; overflow-y: auto; border: 1px solid #cbd5e1;
    font-size: 13.5px; line-height: 1.75; text-align: left;
}
.studio-photo-strip {
    display: flex; gap: 8px; overflow-x: auto; padding: 8px 0 4px 0; align-items: center;
}
.studio-photo-item {
    width: 82px; height: 62px; border-radius: 7px; overflow: hidden; flex-shrink: 0;
    border: 1px solid var(--border-sub); background: #090d16; position: relative; cursor: pointer;
}
.studio-photo-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.studio-photo-item span {
    position: absolute; top: 2px; left: 2px; background: rgba(9,13,22,0.82); color: #fff;
    font-size: 9px; font-weight: 800; padding: 1px 5px; border-radius: 4px;
}
.studio-ledger-bar {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
    background: rgba(9, 13, 22, 0.62); border: 1px solid var(--border-sub);
    border-radius: 10px; padding: 10px 12px; margin-top: 10px;
}
.studio-ledger-col { display: flex; flex-direction: column; gap: 5px; }
.studio-ledger-col label { display: flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 800; cursor: pointer; margin: 0; }
.studio-ledger-col input[type="checkbox"] { width: auto !important; }
.studio-ledger-col input[type="url"] { padding: 5px 8px; font-size: 10.5px; }
.btn-naver { background: linear-gradient(135deg, #03c75a, #02a84b); color: #fff; box-shadow: 0 4px 14px -4px rgba(3,199,90,0.45); }
.btn-karrot { background: linear-gradient(135deg, #ff6f0f, #ea580c); color: #fff; box-shadow: 0 4px 14px -4px rgba(255,111,15,0.45); }
.btn-youtube { background: linear-gradient(135deg, #ef4444, #dc2626); color: #fff; box-shadow: 0 4px 14px -4px rgba(239,68,68,0.45); }
.ch-pill {
    display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 99px;
    font-size: 10px; font-weight: 800; text-decoration: none; border: 1px solid transparent;
}
.ch-pill.done-naver { background: rgba(3,199,90,0.16); border-color: rgba(3,199,90,0.38); color: #4ade80; }
.ch-pill.done-karrot { background: rgba(255,111,15,0.18); border-color: rgba(255,111,15,0.42); color: #fdba74; }
.ch-pill.done-shorts { background: rgba(239,68,68,0.16); border-color: rgba(239,68,68,0.38); color: #fca5a5; }
.ch-pill.todo { background: rgba(148,163,184,0.1); border-color: rgba(148,163,184,0.2); color: var(--text-muted); }

@media (max-width: 720px) {
    .studio-channel-tabs, .studio-ledger-bar { grid-template-columns: 1fr; }
}
