/* ================================================
   에코프렌드 | 폐기물 관리 플랫폼
   Design: Stripe Dashboard + Linear (Yellow Accent)
   Light/Dark Mode Support
   ================================================ */

/* ---------- DESIGN TOKENS ---------- */
:root {
    /* Yellow Brand — light mode (warm amber, readable on white) */
    --yellow-50: #fdf8ee;
    --yellow-100: #f7e8c3;
    --yellow-200: #f0d08a;
    --yellow-300: #ddb84a;
    --yellow-400: #e8a81e;
    --yellow-500: #d4920c;
    --yellow-600: #b87408;
    --yellow-700: #9a5f06;

    /* Neutrals */
    --gray-50:  #f9fafb;
    --gray-100: #f3f4f6;
    --gray-150: #eeeff2;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --gray-950: #0a0f1a;

    /* Semantic Colors */
    --green-400: #34d399;
    --green-500: #10b981;
    --green-600: #059669;
    --blue-400: #60a5fa;
    --blue-500: #3b82f6;
    --blue-600: #2563eb;
    --red-400:  #f87171;
    --red-500:  #ef4444;
    --red-600:  #dc2626;

    /* Light Mode Variables */
    --bg-app:        #f8f9fb;
    --bg-sidebar:    #ffffff;
    --bg-card:       #ffffff;
    --bg-input:      #ffffff;
    --bg-hover:      #f3f4f6;
    --bg-table-head: #f9fafb;
    --bg-tag:        #f3f4f6;

    --border:        #e5e7eb;
    --border-focus:  var(--yellow-400);

    --text-primary:   #111827;
    --text-secondary: #4b5563;
    --text-muted:     #9ca3af;
    --text-placeholder: #c0c4cc;

    --shadow-sm:  0 1px 2px rgba(0,0,0,0.05);
    --shadow-md:  0 4px 12px rgba(0,0,0,0.07);
    --shadow-lg:  0 8px 30px rgba(0,0,0,0.10);
    --shadow-input: 0 0 0 3px rgba(251,191,36,0.18);

    --sidebar-width: 240px;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 18px;

    --transition: 0.18s ease;
}

[data-theme="dark"] {
    /* Yellow Brand — dark mode (muted amber/gold, less glare) */
    --yellow-400: #c9951c;
    --yellow-500: #b07e14;
    --yellow-600: #8f640e;
    --yellow-700: #7a500a;

    --bg-app:        #0a0a0a;
    --bg-sidebar:    #141414;
    --bg-card:       #141414;
    --bg-input:      #1a1a1a;
    --bg-hover:      #1a1a1a;
    --bg-table-head: #1a1a1a;
    --bg-tag:        #1a1a1a;

    --border:        #2a2a2a;
    --border-focus:  var(--yellow-400);

    --text-primary:   #f0f0f0;
    --text-secondary: #888888;
    --text-muted:     #666666;
    --text-placeholder: #555555;

    --shadow-sm:  0 1px 2px rgba(0,0,0,0.3);
    --shadow-md:  0 4px 12px rgba(0,0,0,0.4);
    --shadow-lg:  0 8px 30px rgba(0,0,0,0.5);
    --shadow-input: 0 0 0 3px rgba(251,191,36,0.22);
}

/* ---------- RESET & BASE ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
    font-family: 'Pretendard', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-app);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background var(--transition), color var(--transition);
}

a { text-decoration: none; color: inherit; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input, select, textarea { font-family: inherit; }
ul, ol { list-style: none; }
img { max-width: 100%; display: block; }

/* ---------- LAYOUT ---------- */
#app {
    display: flex;
    min-height: 100vh;
}

/* ---------- SIDEBAR ---------- */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    transition: transform var(--transition), background var(--transition);
}

.sidebar-header {
    padding: 20px 16px 16px;
    border-bottom: 1px solid var(--border);
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-img {
    max-width: 100%;
    max-height: 52px;
    object-fit: contain;
    display: block;
}

/* ---- Nav ---- */
.sidebar-nav {
    flex: 1;
    padding: 12px 10px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 13.5px;
    font-weight: 500;
    transition: background var(--transition), color var(--transition);
    position: relative;
}

.nav-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--yellow-50);
    color: var(--yellow-600);
}

[data-theme="dark"] .nav-item.active {
    background: rgba(251,191,36,0.1);
    color: var(--yellow-400);
}

.nav-item.active svg { stroke: var(--yellow-500); }

.nav-badge {
    margin-left: auto;
    background: var(--yellow-400);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 999px;
    line-height: 1.5;
}

/* ---- Sidebar Footer ---- */
.sidebar-footer {
    padding: 12px 10px;
    border-top: 1px solid var(--border);
}

.theme-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 9px 12px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    transition: background var(--transition), color var(--transition);
}

.theme-toggle:hover { background: var(--bg-hover); color: var(--text-primary); }
.theme-toggle-mobile {
    background: none; border: none;
    color: var(--text-primary); cursor: pointer;
    padding: 4px; display: flex; align-items: center;
}

/* ---------- MOBILE HEADER ---------- */
.mobile-header {
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    height: 56px;
    background: var(--bg-sidebar);
    border-bottom: 1px solid var(--border);
    position: fixed; top: 0; left: 0; right: 0;
    z-index: 200;
}

.mobile-menu-btn {
    color: var(--text-primary);
    padding: 4px;
    display: flex; align-items: center;
}

.mobile-logo {
    font-size: 16px; font-weight: 800;
    background: linear-gradient(135deg, var(--yellow-500), var(--yellow-600));
    -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}

/* ---------- MAIN CONTENT ---------- */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    min-height: 100vh;
    padding: 32px;
    max-width: calc(100vw - var(--sidebar-width));
}

/* ---------- PAGES ---------- */
.page { display: none; }
.page.active { display: block; animation: fadein 0.25s ease; }

@keyframes fadein {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ---------- PAGE HEADER ---------- */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 28px;
    gap: 16px;
    flex-wrap: wrap;
}

.page-title {
    font-size: 22px;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.3px;
    margin-bottom: 3px;
}

.page-desc {
    font-size: 13.5px;
    color: var(--text-muted);
}

.page-header-actions { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }

/* ---------- FORM SECTIONS ---------- */
.quote-form-grid {
    display: flex;
    flex-direction: column;
    gap: 20px;
    max-width: 860px;
}

.form-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    transition: background var(--transition), border-color var(--transition);
}

.section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
}

.section-icon {
    width: 30px; height: 30px;
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}

.section-icon.yellow {
    background: var(--yellow-100);
    color: var(--yellow-600);
}

[data-theme="dark"] .section-icon.yellow {
    background: rgba(251,191,36,0.12);
    color: var(--yellow-400);
}

.section-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
}

.form-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group-full { grid-column: 1 / -1; }

.form-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}

.required { color: var(--red-500); margin-left: 1px; }

.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 9px 13px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 14px;
    transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
    outline: none;
}

.form-input::placeholder, .form-textarea::placeholder { color: var(--text-placeholder); }

.form-input:focus, .form-select:focus, .form-textarea:focus {
    border-color: var(--yellow-400);
    box-shadow: var(--shadow-input);
}

.form-textarea { resize: vertical; min-height: 80px; }

.form-hint {
    font-size: 11.5px;
    color: var(--text-muted);
    margin-top: -2px;
}

/* Completed Excel Upload Card */
.completed-excel-card {
    border-left: 3px solid var(--yellow-400);
    margin-bottom: 20px;
}

.completed-excel-preview-divider {
    border-width: 1px 0 0;
    border-style: solid;
    border-color: var(--border);
    margin: 12px 0 20px;
}

.ce-totals-row {
    display: flex;
    gap: 24px;
    padding: 12px 16px;
    background: var(--bg-hover);
    border-radius: var(--radius-md);
    font-size: 13.5px;
    font-weight: 600;
    margin-bottom: 16px;
}

.ce-totals-row span { color: var(--text-secondary); font-weight: 400; }
.ce-total-highlight { color: var(--primary); font-size: 15px; }

/* Excel Upload Zone */
.excel-upload-zone {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    margin-bottom: 16px;
}

.excel-upload-hint {
    font-size: 12.5px;
    color: var(--text-muted);
}

.excel-import-banner {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: #dcfce7;
    border: 1px solid #86efac;
    border-radius: var(--radius-md);
    color: #15803d;
    font-size: 13.5px;
    font-weight: 600;
    margin-bottom: 16px;
}

[data-theme="dark"] .excel-import-banner {
    background: rgba(21,128,61,0.15);
    border-color: rgba(21,128,61,0.4);
    color: #4ade80;
}

/* Waste Item Cards (Multi-item input) */
.waste-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px;
    margin-bottom: 12px;
    background: var(--bg-hover);
    transition: border-color var(--transition), background var(--transition);
}
.waste-card:first-child { border-color: var(--yellow-300); }
[data-theme="dark"] .waste-card:first-child { border-color: rgba(251,191,36,0.35); }

.waste-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}
.waste-card-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--primary);
}
.btn-remove-waste {
    background: none;
    border: 1px solid var(--red-400, #f87171);
    color: var(--red-500, #ef4444);
    border-radius: var(--radius-sm);
    padding: 3px 10px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--transition), color var(--transition);
}
.btn-remove-waste:hover { background: var(--red-500, #ef4444); color: #fff; }

/* Address Search */
.address-search-row {
    display: flex;
    gap: 8px;
    align-items: stretch;
}

.btn-addr-search {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 16px;
    background: #1F4E79;
    color: #fff;
    border: 1.5px solid #1F4E79;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    transition: background 0.15s, box-shadow 0.15s;
}

.btn-addr-search:hover {
    background: #163b5e;
    box-shadow: 0 2px 10px rgba(31, 78, 121, 0.35);
}

.btn-addr-search:active { transform: scale(0.97); }

.addr-readonly {
    flex: 1;
    cursor: pointer !important;
    background: var(--bg-input) !important;
}

/* Select Wrapper */
.select-wrapper {
    position: relative;
    width: 100%;
}

.select-wrapper .form-select { appearance: none; padding-right: 36px; cursor: pointer; }
.select-arrow {
    position: absolute;
    right: 10px; top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: var(--text-muted);
}

/* Input + Select inline */
.input-with-select {
    display: flex;
    gap: 0;
}

.input-with-select .form-input {
    border-radius: var(--radius-md) 0 0 var(--radius-md);
    border-right: none;
    flex: 1;
}

.inline-select { width: 100px; flex-shrink: 0; }
.inline-select .form-select {
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    border-left: 1px solid var(--border);
}

/* API Key Section */
.api-key-section {
    background: linear-gradient(135deg, #fffbeb, #fef9f0);
    border-color: var(--yellow-200);
}

[data-theme="dark"] .api-key-section {
    background: rgba(251,191,36,0.04);
    border-color: rgba(251,191,36,0.2);
}

/* Form Actions */
.form-actions { display: flex; justify-content: flex-end; }
.form-actions-row { display: flex; gap: 10px; align-items: center; margin-top: 12px; }

/* ---------- BUTTONS ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 9px 18px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    border: 1.5px solid transparent;
    transition: background var(--transition), color var(--transition),
                border-color var(--transition), box-shadow var(--transition),
                transform var(--transition);
    white-space: nowrap;
    outline: none;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
    background: var(--yellow-500);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 1px 3px rgba(0,0,0,0.18);
}

.btn-primary:hover {
    background: var(--yellow-600);
    box-shadow: 0 2px 6px rgba(0,0,0,0.22);
}

.btn-primary:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    transform: none;
}

.btn-outline {
    background: transparent;
    color: var(--text-secondary);
    border-color: var(--border);
}

.btn-outline:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--gray-300);
}

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    border-color: transparent;
    padding: 8px 12px;
}

.btn-ghost:hover {
    background: var(--bg-hover);
    color: var(--text-secondary);
}

.btn-success {
    background: linear-gradient(135deg, var(--green-500), var(--green-600));
    color: #fff;
    border-color: transparent;
    box-shadow: 0 2px 8px rgba(16,185,129,0.25);
}

.btn-success:hover {
    background: linear-gradient(135deg, var(--green-400), var(--green-500));
    box-shadow: 0 4px 14px rgba(16,185,129,0.35);
}

.btn-danger {
    background: var(--red-500);
    color: #fff;
    border-color: transparent;
}

.btn-danger:hover { background: var(--red-600); }

.btn-lg { padding: 12px 28px; font-size: 15px; }
.btn-sm { padding: 6px 12px; font-size: 12.5px; }

.cust-sort-btn {
    background: var(--bg-hover);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}
.cust-sort-btn:hover { color: var(--text-primary); border-color: var(--gray-400); }
.cust-sort-btn.cust-sort-active {
    background: #1F4E79;
    color: #fff;
    border-color: transparent;
}
.btn-xs { padding: 3px 8px; font-size: 11px; }

.btn-delete-row {
    width: 22px;
    height: 22px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: transparent;
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.btn-delete-row:hover:not(:disabled) {
    background: #fee2e2;
    border-color: #fca5a5;
    color: #dc2626;
}
.btn-delete-row:disabled {
    opacity: 0.25;
    cursor: not-allowed;
}

.text-muted { color: var(--text-muted) !important; }

/* ---------- STATUS BADGES ---------- */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    background: var(--bg-tag);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.status-badge.confirmed {
    background: #ecfdf5; color: var(--green-600);
    border-color: #a7f3d0;
}

[data-theme="dark"] .status-badge.confirmed {
    background: rgba(16,185,129,0.1); color: var(--green-400);
    border-color: rgba(16,185,129,0.2);
}

.ai-badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 3px 9px;
    background: rgba(251,191,36,0.12);
    color: var(--yellow-600);
    border: 1px solid rgba(251,191,36,0.25);
    border-radius: 999px;
    font-size: 11.5px; font-weight: 600;
}

[data-theme="dark"] .ai-badge { color: var(--yellow-400); }

/* ---------- CARD COMPONENTS ---------- */
.info-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 22px;
    box-shadow: var(--shadow-sm);
    transition: background var(--transition), border-color var(--transition);
}

.info-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    gap: 8px;
}

.info-card-header h3 {
    font-size: 14.5px;
    font-weight: 700;
    color: var(--text-primary);
}

.hint-text { font-size: 12px; color: var(--text-muted); }

.warning-card {
    border-color: var(--red-400);
    background: #fff5f5;
}

[data-theme="dark"] .warning-card {
    border-color: rgba(239,68,68,0.3);
    background: rgba(239,68,68,0.05);
}

/* Info Grid */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
}

.info-label { font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 3px; }
.info-value { font-size: 14px; color: var(--text-primary); font-weight: 500; }

/* Condition Tags */
.condition-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.condition-tag {
    padding: 4px 10px;
    background: var(--bg-tag);
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 12px;
    color: var(--text-secondary);
}

/* ---------- QUOTE TABLE ---------- */
.quote-table-wrapper { overflow-x: auto; }

.quote-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}

.quote-table th {
    padding: 10px 12px;
    background: var(--bg-table-head);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.quote-table td {
    padding: 11px 12px;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
    vertical-align: middle;
}

.quote-table tbody tr:last-child td { border-bottom: none; }

.quote-table tfoot td {
    padding: 10px 12px;
    border-top: 1px solid var(--border);
    color: var(--text-secondary);
}

.transport-row td { background: var(--bg-table-head); }
.total-row td {
    background: var(--yellow-50);
    font-size: 15px;
    color: var(--yellow-700);
}

[data-theme="dark"] .total-row td {
    background: rgba(251,191,36,0.08);
    color: var(--yellow-400);
}

/* Editable Cell */
.editable-cell { display: flex; align-items: center; gap: 6px; }
.table-input {
    padding: 5px 9px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 13.5px;
    width: 140px;
    transition: border-color var(--transition);
    outline: none;
    font-family: inherit;
}

.table-input:focus { border-color: var(--yellow-400); box-shadow: var(--shadow-input); }
.cell-unit { font-size: 12px; color: var(--text-muted); }

/* Item Editable Inputs */
.item-input {
    padding: 4px 8px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 13.5px;
    width: 100%;
    outline: none;
    font-family: inherit;
    transition: border-color var(--transition);
}
.item-input:focus { border-color: var(--yellow-400); }

/* Price Editor */
.price-editor {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 14px;
}

.price-field { display: flex; flex-direction: column; gap: 5px; }
.price-label { font-size: 12px; font-weight: 600; color: var(--text-muted); }

/* ---------- REVIEW ACTIONS ---------- */
.review-content { display: flex; flex-direction: column; gap: 16px; }

.review-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
}

.no-contract-trigger { display: flex; justify-content: center; padding-top: 4px; }

/* ---------- AI LOADING ---------- */
.ai-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 360px;
}

.ai-loading-inner {
    text-align: center;
    max-width: 360px;
}

.ai-spinner {
    position: relative;
    width: 64px; height: 64px;
    margin: 0 auto 24px;
}

.spinner-ring {
    width: 64px; height: 64px;
    border: 3px solid var(--border);
    border-top-color: var(--yellow-400);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.spinner-dot {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%,-50%);
    width: 12px; height: 12px;
    background: var(--yellow-400);
    border-radius: 50%;
    animation: pulse 0.8s ease-in-out infinite;
}

@keyframes spin  { to { transform: rotate(360deg); } }
@keyframes pulse { 0%,100% { opacity:1; transform:translate(-50%,-50%) scale(1); } 50% { opacity:0.5; transform:translate(-50%,-50%) scale(0.8); } }

.ai-loading-inner h3 { font-size: 17px; font-weight: 700; margin-bottom: 8px; }
.ai-loading-inner p  { font-size: 13.5px; color: var(--text-muted); margin-bottom: 28px; }

.loading-steps { display: flex; flex-direction: column; gap: 10px; text-align: left; }
.loading-step {
    display: flex; align-items: center; gap: 10px;
    font-size: 13px; color: var(--text-muted);
    padding: 8px 14px;
    border-radius: var(--radius-md);
    transition: color var(--transition), background var(--transition);
}
.loading-step.active { color: var(--yellow-600); background: var(--yellow-50); }
[data-theme="dark"] .loading-step.active { color: var(--yellow-400); background: rgba(251,191,36,0.08); }
.loading-step.done  { color: var(--green-500); }

.step-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--border); flex-shrink: 0;
    transition: background var(--transition);
}
.loading-step.active .step-dot { background: var(--yellow-400); animation: pulse 0.9s infinite; }
.loading-step.done  .step-dot { background: var(--green-500); }

/* ---------- EMPTY STATE ---------- */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 60px 20px;
    gap: 14px;
}

.empty-icon {
    width: 80px; height: 80px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    display: flex; align-items: center; justify-content: center;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.empty-state h3 { font-size: 17px; font-weight: 700; color: var(--text-primary); }
.empty-state p  { font-size: 13.5px; color: var(--text-muted); line-height: 1.7; }

/* ---------- DATA MANAGEMENT ---------- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px 18px;
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: var(--shadow-sm);
    transition: background var(--transition), border-color var(--transition), box-shadow var(--transition), transform var(--transition);
    cursor: pointer;
}
.stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
    border-color: var(--primary-light, #3b82f6);
}

.stat-icon {
    width: 38px; height: 38px;
    border-radius: var(--radius-md);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}

.stat-icon.yellow { background: var(--yellow-100); color: var(--yellow-600); }
.stat-icon.green  { background: #ecfdf5; color: var(--green-600); }
.stat-icon.blue   { background: #eff6ff; color: var(--blue-600); }
.stat-icon.red    { background: #fff5f5; color: var(--red-500); }

[data-theme="dark"] .stat-icon.yellow { background: rgba(251,191,36,0.12); color: var(--yellow-400); }
[data-theme="dark"] .stat-icon.green  { background: rgba(16,185,129,0.1);  color: var(--green-400); }
[data-theme="dark"] .stat-icon.blue   { background: rgba(59,130,246,0.1);  color: var(--blue-400); }
[data-theme="dark"] .stat-icon.red    { background: rgba(239,68,68,0.1);   color: var(--red-400); }

.stat-label { font-size: 11.5px; color: var(--text-muted); font-weight: 500; margin-bottom: 3px; }
.stat-value { font-size: 20px; font-weight: 800; color: var(--text-primary); }

/* Filter Bar */
.filter-bar { margin-bottom: 14px; }
.filter-tabs { display: flex; gap: 4px; }

.filter-tab {
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    background: transparent;
    border: 1.5px solid transparent;
    transition: background var(--transition), color var(--transition), border-color var(--transition);
}

.filter-tab:hover { background: var(--bg-hover); color: var(--text-primary); }
.filter-tab.active {
    background: var(--yellow-400);
    color: #fff;
    border-color: transparent;
}

/* Table Card */
.table-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: background var(--transition), border-color var(--transition);
}

.table-wrapper { overflow-x: auto; }

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
    min-width: 600px;
}

.data-table th {
    padding: 11px 14px;
    background: var(--bg-table-head);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.data-table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
}

.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td { background: var(--bg-hover); }

.empty-row { text-align: center; color: var(--text-muted); padding: 40px; }

/* Status pills in table */
.pill {
    display: inline-flex; align-items: center;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 12px; font-weight: 600;
}

.pill-yellow   { background: var(--yellow-100); color: var(--yellow-700); }
.pill-green    { background: #ecfdf5; color: var(--green-600); }
.pill-red      { background: #fff5f5; color: var(--red-600); }
.pill-blue     { background: #eff6ff; color: var(--blue-600); }
.pill-gray     { background: var(--bg-tag); color: var(--text-secondary); }

[data-theme="dark"] .pill-yellow { background: rgba(251,191,36,0.12); color: var(--yellow-400); }
[data-theme="dark"] .pill-green  { background: rgba(16,185,129,0.1);  color: var(--green-400); }
[data-theme="dark"] .pill-red    { background: rgba(239,68,68,0.1);   color: var(--red-400); }
[data-theme="dark"] .pill-blue   { background: rgba(59,130,246,0.1);  color: var(--blue-400); }
[data-theme="dark"] .pill-gray   { background: rgba(100,116,139,0.1); color: var(--text-secondary); }

/* ---------- TOAST NOTIFICATIONS ---------- */
#toast-container {
    position: fixed;
    bottom: 24px; right: 24px;
    display: flex; flex-direction: column; gap: 8px;
    z-index: 9999;
}

.toast {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 12px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    font-size: 13.5px;
    min-width: 280px; max-width: 360px;
    animation: toastin 0.3s cubic-bezier(0.34,1.56,0.64,1);
    position: relative;
    overflow: hidden;
}

.toast::before {
    content: '';
    position: absolute; left: 0; top: 0; bottom: 0;
    width: 3px;
}

.toast.success::before { background: var(--green-500); }
.toast.error::before   { background: var(--red-500); }
.toast.info::before    { background: var(--yellow-400); }

.toast-icon { flex-shrink: 0; margin-top: 1px; }
.toast.success .toast-icon { color: var(--green-500); }
.toast.error   .toast-icon { color: var(--red-500); }
.toast.info    .toast-icon { color: var(--yellow-500); }

.toast-content { flex: 1; }
.toast-title   { font-weight: 700; color: var(--text-primary); margin-bottom: 2px; }
.toast-msg     { font-size: 12.5px; color: var(--text-muted); }

.toast-close {
    color: var(--text-muted); flex-shrink: 0;
    font-size: 16px; line-height: 1;
    padding: 2px;
    transition: color var(--transition);
}
.toast-close:hover { color: var(--text-primary); }

@keyframes toastin {
    from { opacity:0; transform: translateX(60px) scale(0.95); }
    to   { opacity:1; transform: translateX(0) scale(1); }
}

.toast.removing {
    animation: toastout 0.25s ease forwards;
}

@keyframes toastout {
    to { opacity:0; transform: translateX(60px) scale(0.95); height:0; padding:0; margin:0; }
}

/* ---------- MODAL ---------- */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
    animation: fadein 0.15s ease;
}

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    width: 100%; max-width: 440px;
    overflow: hidden;
    animation: modalin 0.25s cubic-bezier(0.34,1.56,0.64,1);
}

@keyframes modalin {
    from { opacity:0; transform: scale(0.92) translateY(10px); }
    to   { opacity:1; transform: scale(1) translateY(0); }
}

.modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 15px; font-weight: 700; }
.modal-close { color: var(--text-muted); padding: 4px; border-radius: var(--radius-sm); transition: color var(--transition), background var(--transition); }
.modal-close:hover { color: var(--text-primary); background: var(--bg-hover); }

.modal-body { padding: 20px; font-size: 14px; color: var(--text-secondary); line-height: 1.7; }
.modal-footer { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }

/* ---------- PDF STYLES ---------- */
/* ---------- ENHANCED PDF STYLES ---------- */
@media print {
    @page { size: A4; margin: 10mm; }

    body { margin: 0; padding: 0; }

    /* When printing quote */
    body.printing-quote > *:not(#pdf-area) { display: none !important; }
    body.printing-quote #pdf-area { display: block !important; padding: 0 !important; margin: 0 !important; max-width: 100% !important; }
    body.printing-quote #pdf-tx-area { display: none !important; }

    /* When printing transaction */
    body.printing-tx > *:not(#pdf-tx-area) { display: none !important; }
    body.printing-tx #pdf-tx-area { display: block !important; padding: 0 !important; }
    body.printing-tx #pdf-area { display: none !important; }

    * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }

    /* CSS 변수 백스로 먹는 다크테마 배경을 흐색으로 초기화 */
    html, body {
        background: #ffffff !important;
        background-color: #ffffff !important;
        background-image: none !important;
    }

    /* 검정 서브바 인쇄 시 숨김 (제거) */

    /* A4 1장 고정 – 옐로우 테마 */
    .yellow-theme { border: none !important; box-shadow: none !important; }

    .yt-pdf-page {
        width: 210mm !important;
        height: 277mm !important;
        max-width: 210mm !important;
        min-height: unset !important;
        overflow: visible !important;
        position: relative !important;
        page-break-after: avoid !important;
    }

    .yt-body-content {
        overflow: visible !important;
        flex: 1 !important;
    }

    .yt-footer-block {
        position: absolute !important;
        bottom: 25px !important;
        left: 0 !important;
        right: 0 !important;
        margin: 0 !important;
        padding-top: 10px !important;
    }
}

#pdf-area, #pdf-tx-area {
    font-family: 'Noto Sans KR', 'Malgun Gothic', sans-serif;
    color: #1a1a1a;
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    background: #fff;
    line-height: 1.4;
    box-sizing: border-box;
}

#pdf-area *, #pdf-tx-area * {
    box-sizing: border-box;
}
.pdf-doc {
    background: #fff;
    padding: 0;
    border: 1px solid #e2e8f0;
    overflow: hidden;
}

/* Header Bar */
.pdf-header-bar {
    background-color: #1F4E79;
    color: #ffffff;
    padding: 24px 28px;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}

.pdf-header-left {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.pdf-header-company {
    font-size: 24px;
    font-weight: 700;
    display: flex;
    align-items: center;
    margin-bottom: 4px;
}

.pdf-header-address {
    font-size: 13.5px;
    opacity: 0.9;
}

.pdf-header-contact {
    font-size: 11.5px;
    line-height: 1.6;
    opacity: 0.8;
    margin-top: 4px;
}

.pdf-header-right {
    text-align: right;
}

.pdf-main-title {
    font-size: 38px;
    font-weight: 800;
    letter-spacing: 4px; 
    margin: 0;
    padding-bottom: 5px;
    color: #ffffff;
    border-bottom: none; 
}

.pdf-quote-no {
    font-size: 14px;
    opacity: 0.9;
    margin-top: 10px;
    font-weight: 500;
}

/* Body Content */
.pdf-body-content {
    padding: 24px;
    background: #ffffff;
}

/* Meta Cards */
.pdf-meta-cards {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
}

.pdf-meta-card {
    flex: 1;
    background-color: #f8fafc;
    border-radius: 8px;
    padding: 15px 20px;
    border: 1px solid #e2e8f0;
}

.meta-label {
    font-size: 12.5px;
    font-weight: 700;
    color: #64748b;
    margin-bottom: 12px;
}

.pdf-client-info {
    display: flex;
    align-items: baseline;
    gap: 15px;
    flex-wrap: wrap;
}

.pdf-client-name {
    font-size: 20px;
    font-weight: 800;
    color: #0f172a;
}

.pdf-client-contact {
    color: #0f172a;
}

.meta-info-table {
    width: 100%;
    border-collapse: collapse;
}

.meta-info-table td {
    padding: 6px 0;
    font-size: 14px;
}

.meta-info-table .lbl {
    color: #475569;
    width: 40%;
    font-weight: 500;
}

.meta-info-table .val {
    font-weight: 700;
    color: #0f172a;
    text-align: right;
}

.pdf-vat-notice {
    text-align: right; 
    font-size: 12.5px; 
    font-weight: 600; 
    color: #475569; 
    margin-bottom: 10px;
}

/* Main Table */
.pdf-main-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    text-align: center;
    border: 1px solid #cbd5e1;
}

.pdf-main-table th {
    background: #1F4E79;
    padding: 12px 6px;
    border: 1px solid #1F4E79; 
    border-right-color: #cbd5e1;
    font-weight: 600; 
    color: #ffffff;
}
.pdf-main-table th:last-child {
    border-right-color: #1F4E79;
}

.pdf-main-table td {
    padding: 0 6px;
    height: 36px;
    border: 1px solid #cbd5e1; 
    color: #0f172a;
}
.pdf-main-table td[align="right"] { padding-right: 15px; text-align: right; }
.pdf-main-table td[align="left"] { padding-left: 10px; text-align: left; }

.pdf-total-row {
    background: #f1f5f9;
}
.pdf-total-row td {
    border-top: 2px solid #1F4E79;
}
.total-lbl { font-weight: 700; font-size: 15px; letter-spacing: 4px; text-align: center !important; }
.total-val { font-weight: 800; font-size: 18px; text-align: right; padding-right: 15px !important; color: #1F4E79 !important; }

/* Conditions Table */
.pdf-conditions {
    margin-top: 15px;
}

.pdf-cond-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.pdf-cond-table td { padding: 12px 14px; vertical-align: top; border: 1px solid #e2e8f0; }
.cond-lbl { background: #f8fafc; font-weight: 700; text-align: center; color: #334155; }
.cond-body p { margin: 3px 0; color: #475569; line-height: 1.5; }

/* Digital Stamp (Image) */
.real-stamp {
    width: 55px; 
    height: 55px;
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    margin-left: 8px;
    object-fit: contain;
    mix-blend-mode: multiply;
    opacity: 0.95;
    pointer-events: none;
}

/* Real Logo Image */
.real-logo {
    height: 22px;
    vertical-align: middle;
    margin-left: 10px;
    background: rgba(255,255,255,0.9);
    padding: 3px 6px;
    border-radius: 4px;
}
.real-logo-footer {
    height: 32px;
    vertical-align: middle;
}

/* ---------- RESPONSIVE ---------- */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-lg); }

    .mobile-header { display: flex; }

    .main-content {
        margin-left: 0;
        padding: 16px;
        padding-top: calc(56px + 16px);
        max-width: 100vw;
    }

    .form-grid-2 { grid-template-columns: 1fr; }
    .form-group-full { grid-column: auto; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .review-actions { flex-direction: column; }
    .info-grid { grid-template-columns: 1fr 1fr; }
    .price-editor { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .filter-tabs { flex-wrap: wrap; }
    .info-grid { grid-template-columns: 1fr; }
    .page-header { flex-direction: column; }
}

/* ---- Mobile nav overlay ---- */
.sidebar-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 99;
}
.sidebar-overlay.visible { display: block; }

/* ---- Inline Status Select (고객 목록 인라인 드롭다운) ---- */
.inline-status-select {
    appearance: none;
    -webkit-appearance: none;
    border: none;
    border-radius: 999px;
    padding: 4px 24px 4px 10px;
    font-size: 12px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    outline: none;
    transition: background 0.15s, color 0.15s, box-shadow 0.15s;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 7px center;
    min-width: 80px;
}
.inline-status-select:hover  { box-shadow: 0 0 0 2px rgba(0,0,0,0.08); }
.inline-status-select:focus  { box-shadow: 0 0 0 2px rgba(31,78,121,0.25); }
[data-theme="dark"] .inline-status-select { filter: brightness(0.85); }

/* ============================================================ */
/* 옐로우 풀 페이지 A-2 스타일 (단가/산출 견적서) */
/* ============================================================ */

.yellow-theme {
    font-family: 'Pretendard', 'Noto Sans KR', sans-serif;
    color: #1a1a1a;
    width: 100%;
}

.yt-header {
    background: #F4C430;
    padding: 20px 20px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.yt-header-left { display: flex; gap: 12px; align-items: center; }

.yt-logo-box {
    width: 54px; height: 52px;
    background: #ffffff;
    border-radius: 6px;
    display: flex; align-items: center; justify-content: center;
}

.yt-logo-box img {
    width: 48px; height: 38px;
    object-fit: contain;
}

.yt-company-info { display: flex; flex-direction: column; gap: 2px; }

.yt-company-name {
    font-size: 16px;
    font-weight: 700;
    color: #1a1a1a;
}

.yt-company-address {
    font-size: 11px;
    color: #4a3800;
}

.yt-header-right { text-align: right; }

.yt-title {
    font-size: 26px;
    font-weight: 700;
    letter-spacing: 6px;
    color: #1a1a1a;
    margin: 0 0 6px 0;
}

.yt-quote-no { font-size: 11px; color: #4a3800; font-weight: 500; }

.yt-sub-bar {
    background: #1a1a1a;
    color: #F4C430;
    font-size: 10px;
    padding: 5px 20px;
    text-align: left;
}

.yt-pdf-page {
    display: flex;
    flex-direction: column;
    max-width: 794px;
    min-height: 1123px;
    box-sizing: border-box;
    position: relative;
    background: #FFFDE7;
}

.yt-body-content {
    background: #FFFDE7;
    padding: 16px 24px 56px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.yt-meta-cards { display: flex; gap: 12px; margin-bottom: 12px; }

.yt-meta-card {
    flex: 1;
    background: #fff;
    border: 1px solid #d4a800;
    border-radius: 6px;
    padding: 8px 12px;
}

.yt-meta-label {
    font-size: 10px;
    color: #7D6608;
    margin-bottom: 8px;
    font-weight: 700;
}

.yt-client-info { display: flex; align-items: baseline; gap: 6px; }

.yt-client-name {
    font-size: 16px;
    font-weight: 700;
    color: #1a1a1a;
}
.yt-client-contact { font-size: 14px; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; margin-left: 6px; }
.yt-client-suffix { font-size: 12px; margin-left: 2px; }

.yt-meta-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.yt-meta-table td { padding: 3px 0; }
.yt-lbl { color: #4a3800; width: 40%; font-weight: 500; }
.yt-val { font-weight: 700; text-align: right; }

.yt-vat-notice { font-size: 11px; color: #4a3800; text-align: right; margin-bottom: 6px; font-weight: 600; }

.yt-main-table { width: 100%; border-collapse: collapse; font-size: 12px; text-align: center; margin-bottom: 16px; border: 1px solid #d4a800; }
.yt-main-table th { background: #1a1a1a; color: #F4C430; padding: 10px 6px; font-weight: 600; font-size: 11px; border: 1px solid #1a1a1a; border-right-color: #333; }
.yt-main-table th:last-child { border-right-color: #1a1a1a; }
.yt-main-table td { background: #fff; border: 1px solid #d4a800; height: 36px; padding: 0 6px; color: #1a1a1a; }
.yt-main-table td[align="right"] { padding-right: 12px; text-align: right; }
.yt-main-table td[align="left"] { padding-left: 10px; text-align: left; }

.yt-main-table tfoot td { background: #F4C430; font-weight: 700; color: #1a1a1a; border: 1px solid #d4a800; }
.yt-total-lbl { letter-spacing: 4px; text-align: center !important; }
.yt-total-val { text-align: right !important; padding-right: 12px !important; font-size: 14px; }

.yt-conditions { background: #fff; border: 1px solid #d4a800; border-radius: 6px; padding: 6px 12px; display: flex; gap: 12px; align-items: flex-start; margin-bottom: 16px; }
.yt-cond-label { font-size: 12px; font-weight: 700; color: #7D6608; min-width: 60px; padding-top: 2px; }
.yt-cond-body { font-size: 11.5px; color: #1a1a1a; flex: 1; }
.yt-cond-body p { margin: 2px 0; }

.yt-footer-block { text-align: center; margin-top: 80px; margin-bottom: 10px; padding-top: 16px; }
.yt-signature-text { font-size: 15px; font-weight: 600; margin-bottom: 12px; }
.yt-signature-company { font-size: 22px; font-weight: 700; position: relative; display: inline-flex; align-items: center; justify-content: center; left: -10px; }
.yt-stamp { width: 55px; height: 55px; position: absolute; left: 100%; top: 50%; transform: translateY(-50%); margin-left: 4px; object-fit: contain; mix-blend-mode: multiply; pointer-events: none; }

/* ================================================
   Google Drive 서류 관리
   ================================================ */
.drive-loading {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 4px;
    color: var(--text-secondary);
    font-size: 13.5px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.spin { animation: spin 1s linear infinite; }

.drive-doc-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}
.drive-upload-btn {
    display: inline-flex !important;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    border-color: var(--primary) !important;
    color: var(--primary) !important;
    cursor: pointer;
}
.drive-upload-btn:hover { background: var(--primary) !important; color: #fff !important; }
.drive-file-count {
    margin-left: auto;
    font-size: 12px;
    color: var(--text-secondary);
}

.drive-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px 20px;
    border: 1.5px dashed var(--border);
    border-radius: 10px;
    color: var(--text-secondary);
    font-size: 13.5px;
    gap: 4px;
    background: var(--bg-input);
}

.drive-file-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.drive-file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg-input);
    transition: box-shadow 0.15s;
}
.drive-file-item:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.06); }

.drive-file-info {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1;
}

.drive-file-icon-wrap {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: var(--bg-page);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
}

.drive-file-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.drive-file-name {
    font-size: 13.5px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 260px;
}

.drive-file-date {
    font-size: 11.5px;
    color: var(--text-secondary);
}

.drive-file-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

/* 서류 섹션 (사업자등록증 / 신고서류) */
.drive-doc-sections {
    display: flex;
    flex-direction: column;
    gap: 0;
}
.doc-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 14px 4px;
}
.doc-section-header {
    display: flex;
    align-items: center;
    gap: 10px;
}
.doc-section-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 0.02em;
    flex: 1;
}
.doc-section-empty {
    font-size: 13px;
    color: var(--text-secondary);
    padding: 10px 2px;
}
.doc-section-divider {
    height: 1px;
    background: var(--border);
    margin: 0 2px;
}
#doc-mgmt-inner .btn-danger {
    background: transparent;
    border: 1px solid #dc2626;
    color: #dc2626;
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
#doc-mgmt-inner .btn-danger:hover { background: #dc2626; color: #fff; }

@media (max-width: 600px) {
    .drive-file-item { flex-direction: column; align-items: flex-start; }
    .drive-file-actions { width: 100%; justify-content: flex-end; }
    .drive-file-name { max-width: 200px; }
}

/* ================================================
   거래내역 입력 모달 — 계산 박스
   ================================================ */
.tx-calc-box {
    background: var(--bg-page);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.tx-calc-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-size: 13.5px;
}
.tx-calc-label { color: var(--text-secondary); }
.tx-calc-val   { font-weight: 500; }
.tx-calc-transport { align-items: center; }
.tx-transport-input {
    width: 130px !important;
    height: 32px !important;
    padding: 4px 10px !important;
    font-size: 13px !important;
    text-align: right;
}
.tx-total-row {
    border-top: 1px solid var(--border);
    padding-top: 8px;
    margin-top: 2px;
}

/* ================================================
   거래내역서 PDF 템플릿 (Yellow-Gold 시안 A)
   ================================================ */
.tx-pdf-page {
    width: 100%;
    background: #fff;
    font-family: 'Pretendard', 'Apple SD Gothic Neo', sans-serif;
    color: #1a1a1a;
    font-size: 12px;
    display: block;
    box-sizing: border-box;
    overflow: visible;
}

/* 헤더 (노란 골드) */
.tx-hdr {
    background: #F5C842;
    padding: 16px 24px;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    box-sizing: border-box;
    width: 100%;
    gap: 12px;
}
.tx-hdr-left {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    flex-shrink: 1;
    min-width: 0;
}
.tx-logo-img {
    width: 46px;
    height: 46px;
    object-fit: contain;
    flex-shrink: 0;
    background: #ffffff;
    border-radius: 5px;
    padding: 4px;
    box-sizing: border-box;
}
.tx-company-info { line-height: 1.6; min-width: 0; }
.tx-company-name { font-size: 14px; font-weight: 800; color: #1a1a1a; display: block; }
.tx-company-addr { font-size: 10px; color: #3a3a3a; display: block; }
.tx-hdr-right    { text-align: right; flex-shrink: 0; display: flex; flex-direction: column; align-items: flex-end; justify-content: center; }
.tx-doc-title    { font-size: 20px; font-weight: 900; letter-spacing: 6px; color: #1a1a1a; line-height: 1.2; display: block; white-space: nowrap; }
.tx-doc-no       { font-size: 10px; color: #3a3a3a; margin-top: 4px; display: block; }

/* 서브바 (검정 배경) */
.tx-sub-bar {
    background: #1a1a1a;
    color: #e0e0e0;
    font-size: 10px;
    padding: 5px 24px;
    display: flex;
    align-items: center;
    white-space: nowrap;
    box-sizing: border-box;
    width: 100%;
}

/* 수신/발행 2열 */
.tx-meta-grid {
    display: flex;
    flex-direction: row;
    border-bottom: 2px solid #1a1a1a;
    box-sizing: border-box;
}
.tx-meta-cell {
    padding: 14px 20px;
    flex: 1;
    border-right: 1px solid #d0d0d0;
    box-sizing: border-box;
}
.tx-issue-cell { border-right: none; }
.tx-meta-label {
    font-size: 9px;
    font-weight: 700;
    color: #888;
    letter-spacing: 1px;
    margin-bottom: 4px;
    display: block;
}
.tx-client-name { font-size: 18px; font-weight: 800; margin-bottom: 4px; display: block; }
.tx-bill-notice { font-size: 10px; color: #555; display: block; }
.tx-issue-table { border-collapse: collapse; width: 100%; font-size: 11px; display: table; }
.tx-issue-table tr  { border-bottom: 1px solid #eee; display: table-row; }
.tx-issue-table tr:last-child { border-bottom: none; }
.tx-issue-table td  { display: table-cell; }
.tx-issue-lbl       { color: #777; padding: 5px 0; width: 90px; font-size: 10px; white-space: nowrap; }
.tx-issue-table td:last-child { font-weight: 600; padding-left: 8px; }

/* 메인 테이블 */
.tx-main-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    display: table;
    box-sizing: border-box;
}
.tx-main-table thead         { display: table-header-group; }
.tx-main-table thead tr      { background: #1a1a1a; color: #fff; display: table-row; }
.tx-main-table th            { padding: 8px 6px; font-size: 11px; font-weight: 600; text-align: center; display: table-cell; vertical-align: middle; line-height: 1; }
.tx-main-table th:nth-child(1) { width: 9%; }
.tx-main-table th:nth-child(2) { width: 26%; text-align: left; padding-left: 8px; }
.tx-main-table th:nth-child(3) { width: 8%; }
.tx-main-table th:nth-child(4) { width: 8%; }
.tx-main-table th:nth-child(5) { width: 17%; }
.tx-main-table th:nth-child(6) { width: 17%; }
.tx-main-table th:nth-child(7) { width: 15%; }
.tx-main-table tbody         { display: table-row-group; }
.tx-main-table tbody tr      { display: table-row; }
.tx-main-table tbody td      { padding: 7px 6px; text-align: center; border-bottom: 0.5px solid #ddd; font-size: 11.5px; display: table-cell; vertical-align: middle; }
.tx-main-table tbody tr:nth-child(even) { background: #fafafa; }
.tx-main-table tfoot         { display: table-footer-group; }
.tx-tfoot-row                { background: #f0f0f0; display: table-row; }
.tx-tfoot-row td             { padding: 8px 6px; font-size: 12px; font-weight: 700; border-top: 2px solid #1a1a1a; text-align: right; display: table-cell; vertical-align: middle; }
.tx-tfoot-lbl                { text-align: center !important; letter-spacing: 2px; }
.tx-tfoot-num                { text-align: right; }

/* 비고 */
.tx-pdf-memo {
    padding: 10px 20px;
    font-size: 11px;
    color: #555;
    min-height: 24px;
    border-bottom: 1px solid #e0e0e0;
    display: block;
    box-sizing: border-box;
}

/* 하단 서명 */
.tx-pdf-footer {
    padding: 20px 24px 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    box-sizing: border-box;
}
.tx-footer-text {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 10px;
    text-align: center;
}
.tx-footer-company {
    font-size: 18px;
    font-weight: 800;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.tx-stamp {
    width: 52px;
    height: 52px;
    object-fit: contain;
    mix-blend-mode: multiply;
    flex-shrink: 0;
    display: block;
}

/* ============================================================
   DASHBOARD — 탭 토글
   ============================================================ */
.dash-tab-toggle {
    display: flex;
    gap: 3px;
    background: var(--bg-hover);
    border-radius: 8px;
    padding: 3px;
}
.dash-tab {
    padding: 5px 18px;
    border-radius: 6px;
    border: none;
    background: transparent;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.15s;
}
.dash-tab.active {
    background: var(--bg-card);
    color: var(--primary, #1F4E79);
    box-shadow: 0 1px 4px rgba(0,0,0,0.09);
}
[data-theme="dark"] .dash-tab.active {
    color: var(--text-primary);
    box-shadow: none;
}

/* ============================================================
   CALENDAR — 공통
   ============================================================ */
.cal-badges {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.cal-badge {
    display: block;
    background: #1F4E79;
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 5px;
    border-radius: 4px;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    line-height: 1.5;
    transition: background 0.12s;
}
.cal-badge:hover { background: #163d63; }

/* ============================================================
   CALENDAR — 월간 뷰
   ============================================================ */
.cal-monthly { overflow-x: auto; }
.cal-month-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 10px;
    padding-left: 2px;
}
.cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}
.cal-day-hd {
    text-align: center;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-secondary);
    padding: 5px 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 2px;
}
.cal-day-hd.cal-sun { color: #ef4444; }
.cal-day-hd.cal-sat { color: #3b82f6; }
.cal-cell {
    min-height: 68px;
    border-radius: 5px;
    border: 1px solid transparent;
    padding: 4px 5px;
    background: #fff;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
[data-theme="dark"] .cal-cell {
    background: var(--bg-card);
    border-color: var(--border);
}
.cal-cell.cal-other {
    background: transparent;
    border-color: transparent;
}
[data-theme="dark"] .cal-cell.cal-other {
    background: transparent;
    border-color: transparent;
}
.cal-cell.cal-today {
    background: #eff6ff;
    border-color: #1F4E79;
}
[data-theme="dark"] .cal-cell.cal-today {
    background: #1f1f1f;
    border-color: #3b82f6;
}
.cal-cell.cal-sun .cal-num { color: #ef4444; }
.cal-cell.cal-sat .cal-num { color: #3b82f6; }
.cal-num {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1;
    margin-bottom: 2px;
}
.cal-cell.cal-today .cal-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    background: #1F4E79;
    color: #fff;
    border-radius: 50%;
    font-size: 10px;
}

/* ============================================================
   CALENDAR — 주간 뷰
   ============================================================ */
.cal-weekly { overflow-x: auto; }
.cal-week-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
    gap: 10px;
}
.cal-week-range {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    text-align: center;
    flex: 1;
}
.cal-week-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
    min-width: 560px;
}
.cal-week-col {
    min-height: 110px;
    border-radius: 7px;
    border: 1px solid var(--border);
    padding: 8px 6px;
    background: #fff;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
[data-theme="dark"] .cal-week-col {
    background: var(--bg-card);
    border-color: var(--border);
}
.cal-week-col.cal-today {
    background: #eff6ff;
    border-color: #1F4E79;
}
[data-theme="dark"] .cal-week-col.cal-today {
    background: #1f1f1f;
    border-color: #3b82f6;
}
.cal-week-dname {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-secondary);
    text-align: center;
}
.cal-week-date {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    text-align: center;
    margin-bottom: 4px;
}
.cal-week-col.cal-today .cal-week-date { color: #1F4E79; }
.cal-week-col.cal-sat .cal-week-dname,
.cal-week-col.cal-sat .cal-week-date { color: #3b82f6; }
.cal-week-col.cal-sun .cal-week-dname,
.cal-week-col.cal-sun .cal-week-date { color: #ef4444; }
