/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; font-size: 14px; background: #f5f5f3; color: #1a1a1a; }

/* ── Layout ── */
.app { display: flex; height: 100vh; overflow: hidden; }
.sidebar { width: 200px; background: #fff; border-right: 1px solid #e8e8e4; display: flex; flex-direction: column; flex-shrink: 0; }
.main { flex: 1; overflow-y: auto; padding: 24px 28px; }

/* ── Sidebar ── */
.sidebar-logo { display: flex; align-items: center; gap: 10px; padding: 18px 16px 16px; border-bottom: 1px solid #e8e8e4; }
.logo-icon { width: 30px; height: 30px; background: #1D9E75; border-radius: 8px; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 16px; flex-shrink: 0; }
.logo-title { font-size: 13px; font-weight: 600; color: #1a1a1a; }
.logo-sub { font-size: 10px; color: #888; margin-top: 1px; }
.sidebar-nav { flex: 1; padding: 10px 0; overflow-y: auto; }
.nav-group-label { font-size: 10px; color: #aaa; text-transform: uppercase; letter-spacing: 0.6px; padding: 10px 16px 3px; }
.nav-item { display: flex; align-items: center; gap: 8px; padding: 8px 16px; font-size: 12.5px; color: #555; cursor: pointer; border-right: 2px solid transparent; transition: all 0.1s; }
.nav-item:hover { background: #f5f5f3; color: #1a1a1a; }
.nav-item.active { background: #f0faf6; color: #1D9E75; font-weight: 500; border-right-color: #1D9E75; }
.nav-item i { font-size: 15px; }

/* ── Sidebar Footer ── */
.sidebar-footer { padding: 12px; border-top: 1px solid #e8e8e4; }
.drive-status { display: flex; align-items: center; gap: 6px; font-size: 11px; color: #888; margin-bottom: 6px; }
.drive-status i { font-size: 14px; color: #4285f4; }
.drive-btn { width: 100%; padding: 7px; font-size: 11px; background: #fff; border: 1px solid #e8e8e4; border-radius: 8px; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 5px; color: #333; margin-bottom: 10px; }
.drive-btn:hover { background: #f5f5f3; }
.drive-btn.connected { background: #f0faf6; border-color: #1D9E75; color: #1D9E75; }
.role-switcher { background: #f5f5f3; border-radius: 8px; padding: 8px 10px; }
.role-label { font-size: 10px; color: #888; }
.role-name { font-size: 12px; font-weight: 500; color: #1a1a1a; margin: 1px 0 6px; }
.role-btns { display: flex; gap: 4px; }
.role-btn { flex: 1; font-size: 10px; padding: 4px; border: 1px solid #e8e8e4; background: #fff; border-radius: 6px; cursor: pointer; color: #555; }
.role-btn.active { background: #1D9E75; color: #fff; border-color: #1D9E75; }

/* ── Page ── */
.page { display: none; }
.page.active { display: block; }
.page-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 20px; }
.page-title { font-size: 20px; font-weight: 600; color: #1a1a1a; }
.page-sub { font-size: 12px; color: #888; margin-top: 3px; }

/* ── Buttons ── */
.btn-primary { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; background: #1D9E75; color: #fff; border: none; border-radius: 8px; font-size: 12px; font-weight: 500; cursor: pointer; }
.btn-primary:hover { background: #178a64; }
.btn-secondary { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; background: #fff; color: #555; border: 1px solid #e8e8e4; border-radius: 8px; font-size: 12px; cursor: pointer; }
.btn-secondary:hover { background: #f5f5f3; }
.back-btn { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; background: #fff; color: #555; border: 1px solid #e8e8e4; border-radius: 8px; font-size: 12px; cursor: pointer; margin-bottom: 14px; }
.back-btn:hover { background: #f5f5f3; }

/* ── Cards ── */
.card { background: #fff; border: 1px solid #e8e8e4; border-radius: 12px; padding: 16px; margin-bottom: 14px; }
.card-title { font-size: 12px; font-weight: 600; color: #1a1a1a; margin-bottom: 12px; display: flex; align-items: center; gap: 7px; }
.card-title i { font-size: 14px; color: #888; }
.section-label { font-size: 11px; font-weight: 600; color: #888; margin-bottom: 10px; text-transform: uppercase; letter-spacing: 0.4px; }

/* ── Metrics ── */
.metrics-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 18px; }
.metric-card { background: #fff; border: 1px solid #e8e8e4; border-radius: 12px; padding: 14px 16px; }
.metric-label { font-size: 11px; color: #888; margin-bottom: 5px; }
.metric-value { font-size: 22px; font-weight: 600; color: #1a1a1a; }
.metric-value.red { color: #D85A30; }
.metric-value.green { color: #1D9E75; }
.metric-trend { font-size: 10px; color: #888; margin-top: 3px; }
.metric-trend.up { color: #1D9E75; }
.metric-trend.down { color: #D85A30; }

/* ── Two col ── */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* ── List items ── */
.list-item { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid #f0f0ec; }
.list-item:last-child { border-bottom: none; }
.li-main { flex: 1; }
.li-name { font-size: 12.5px; color: #1a1a1a; font-weight: 500; }
.li-sub { font-size: 11px; color: #888; margin-top: 1px; }

/* ── Tasks ── */
.task-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid #f0f0ec; }
.task-row:last-child { border-bottom: none; }
.task-check { width: 16px; height: 16px; border: 1.5px solid #ccc; border-radius: 4px; flex-shrink: 0; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.task-check.done { background: #1D9E75; border-color: #1D9E75; }
.task-check.done::after { content: ''; width: 8px; height: 5px; border-left: 1.5px solid #fff; border-bottom: 1.5px solid #fff; transform: rotate(-45deg) translateY(-1px); display: block; }
.done-text { text-decoration: line-through; color: #bbb; }

/* ── Badges ── */
.badge { font-size: 10px; padding: 2px 8px; border-radius: 20px; font-weight: 500; white-space: nowrap; }
.badge-quote { background: #E6F1FB; color: #185FA5; }
.badge-prod { background: #FAEEDA; color: #854F0B; }
.badge-ship { background: #EAF3DE; color: #3B6D11; }
.badge-qa { background: #FBEAF0; color: #993556; }
.badge-done { background: #E1F5EE; color: #0F6E56; }
.badge-urgent { background: #FCEBEB; color: #A32D2D; }
.badge-med { background: #FAEEDA; color: #854F0B; }
.badge-low { background: #EAF3DE; color: #3B6D11; }
.badge-paid { background: #E1F5EE; color: #0F6E56; }
.badge-pending { background: #FAEEDA; color: #854F0B; }
.badge-overdue { background: #FCEBEB; color: #A32D2D; }

/* ── Search ── */
.search-bar { display: flex; align-items: center; gap: 8px; background: #fff; border: 1px solid #e8e8e4; border-radius: 8px; padding: 8px 12px; margin-bottom: 14px; }
.search-bar i { color: #aaa; font-size: 15px; }
.search-bar input { border: none; outline: none; font-size: 13px; color: #1a1a1a; width: 100%; background: transparent; }

/* ── Clients list ── */
.client-card { background: #fff; border: 1px solid #e8e8e4; border-radius: 12px; padding: 14px 16px; display: flex; align-items: center; gap: 14px; margin-bottom: 8px; cursor: pointer; transition: border-color 0.15s; }
.client-card:hover { border-color: #1D9E75; }
.client-avatar { width: 38px; height: 38px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; flex-shrink: 0; }
.client-info { flex: 1; }
.client-name { font-size: 13.5px; font-weight: 600; color: #1a1a1a; }
.client-meta { font-size: 11px; color: #888; margin-top: 2px; }
.client-value { text-align: right; margin-right: 6px; }
.client-value .amount { font-size: 13px; font-weight: 600; color: #1D9E75; }
.client-value .label { font-size: 10px; color: #888; }

/* ── Client Detail ── */
.client-profile { background: #fff; border: 1px solid #e8e8e4; border-radius: 12px; padding: 18px; margin-bottom: 14px; }
.client-profile-header { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.info-field label { font-size: 10px; color: #888; display: block; margin-bottom: 3px; }
.info-field label i { font-size: 11px; margin-right: 2px; }
.info-field span { font-size: 12px; color: #1a1a1a; white-space: pre-line; }
.info-field span.link { color: #185FA5; }
.year-group { margin-bottom: 18px; }
.year-title { font-size: 14px; font-weight: 600; color: #1a1a1a; padding-bottom: 8px; border-bottom: 1px solid #e8e8e4; margin-bottom: 10px; }
.month-group { margin-bottom: 10px; padding-left: 10px; }
.month-title { font-size: 10px; font-weight: 600; color: #888; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 5px; }
.proj-line { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 8px; cursor: pointer; }
.proj-line:hover { background: #f5f5f3; }
.proj-line-name { flex: 1; font-size: 12.5px; color: #1a1a1a; }
.proj-line-value { font-size: 12px; font-weight: 500; color: #1D9E75; }

/* ── Pipeline ── */
.pipeline-board { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.pipeline-col { background: #f5f5f3; border-radius: 10px; padding: 10px; }
.pipeline-col-header { font-size: 11px; font-weight: 600; color: #555; margin-bottom: 8px; display: flex; align-items: center; justify-content: space-between; }
.pipeline-count { background: #fff; border: 1px solid #e8e8e4; border-radius: 20px; font-size: 10px; padding: 0 6px; color: #888; }
.proj-card-item { background: #fff; border: 1px solid #e8e8e4; border-radius: 8px; padding: 10px; margin-bottom: 6px; cursor: pointer; transition: border-color 0.15s; }
.proj-card-item:hover { border-color: #1D9E75; }
.proj-card-name { font-size: 12px; font-weight: 500; color: #1a1a1a; }
.proj-card-client { font-size: 10px; color: #888; margin-top: 2px; }
.proj-card-value { font-size: 11px; color: #1D9E75; margin-top: 5px; font-weight: 500; }

/* ── Project Detail ── */
.proj-detail-header { background: #fff; border: 1px solid #e8e8e4; border-radius: 12px; padding: 18px; margin-bottom: 14px; }
.proj-detail-title { font-size: 17px; font-weight: 600; color: #1a1a1a; }
.proj-detail-sub { font-size: 12px; color: #888; margin-top: 3px; display: flex; align-items: center; gap: 8px; }
.detail-fields { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; margin-top: 14px; }
.detail-field label { font-size: 10px; color: #888; display: block; margin-bottom: 3px; }
.detail-field label i { font-size: 11px; margin-right: 2px; }
.detail-field span { font-size: 12px; font-weight: 500; color: #1a1a1a; }
.detail-field .sub-text { font-size: 10px; color: #888; margin-top: 1px; }
.note-box { background: #f5f5f3; border-radius: 8px; padding: 10px 12px; font-size: 12px; color: #555; margin-top: 12px; }

/* ── Timeline ── */
.timeline { display: flex; border: 1px solid #e8e8e4; border-radius: 12px; overflow: hidden; margin-bottom: 14px; }
.tl-step { flex: 1; padding: 10px 8px; text-align: center; border-right: 1px solid #e8e8e4; background: #fff; }
.tl-step:last-child { border-right: none; }
.tl-step.done { background: #f0faf6; }
.tl-step.current { background: #fef9ef; }
.tl-step-label { font-size: 9px; color: #888; text-transform: uppercase; letter-spacing: 0.3px; }
.tl-step-date { font-size: 11px; font-weight: 600; margin-top: 3px; }
.tl-step.done .tl-step-date { color: #1D9E75; }
.tl-step.current .tl-step-date { color: #854F0B; }
.tl-step.future .tl-step-date { color: #ccc; }

/* ── Files ── */
.files-card { background: #fff; border: 1px solid #e8e8e4; border-radius: 12px; padding: 16px; }
.files-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.file-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid #f0f0ec; }
.file-row:last-child { border-bottom: none; }
.file-icon { width: 32px; height: 32px; border-radius: 7px; display: flex; align-items: center; justify-content: center; font-size: 15px; flex-shrink: 0; }
.file-icon.pdf { background: #FCEBEB; color: #A32D2D; }
.file-icon.xlsx { background: #EAF3DE; color: #3B6D11; }
.file-icon.folder { background: #E6F1FB; color: #185FA5; }
.file-info { flex: 1; }
.file-name { font-size: 12px; font-weight: 500; color: #1a1a1a; }
.file-meta { font-size: 10px; color: #888; margin-top: 1px; }
.file-size { font-size: 10px; color: #888; min-width: 50px; text-align: right; }
.file-actions { display: flex; gap: 4px; }
.file-btn { display: inline-flex; align-items: center; gap: 3px; font-size: 10px; padding: 4px 8px; border: 1px solid #e8e8e4; border-radius: 6px; background: #fff; color: #555; cursor: pointer; }
.file-btn:hover { background: #f5f5f3; }
.file-btn.edit { color: #185FA5; border-color: #b5d4f4; }
.file-btn.edit:hover { background: #E6F1FB; }
.file-btn.open { color: #1D9E75; border-color: #9FE1CB; }
.file-btn.open:hover { background: #f0faf6; }
.upload-zone { border: 1.5px dashed #ccc; border-radius: 8px; padding: 16px; text-align: center; color: #aaa; font-size: 12px; cursor: pointer; margin-top: 12px; }
.upload-zone:hover { background: #f5f5f3; border-color: #aaa; }
.upload-zone i { display: block; font-size: 22px; margin-bottom: 5px; }

/* ── Logistics ── */
.tab-bar { display: flex; gap: 0; margin-bottom: 16px; border: 1px solid #e8e8e4; border-radius: 8px; overflow: hidden; width: fit-content; background: #fff; }
.tab { padding: 8px 18px; font-size: 12px; cursor: pointer; color: #555; background: transparent; border: none; display: flex; align-items: center; gap: 6px; }
.tab:hover { background: #f5f5f3; }
.tab.active { background: #1D9E75; color: #fff; font-weight: 500; }
.log-year-group { margin-bottom: 20px; }
.log-year-title { font-size: 15px; font-weight: 600; color: #1a1a1a; padding-bottom: 8px; border-bottom: 1px solid #e8e8e4; margin-bottom: 12px; }
.log-month-section { margin-bottom: 12px; }
.log-month-title { font-size: 10px; font-weight: 600; color: #888; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px; padding-left: 4px; }
.log-item { display: flex; align-items: center; gap: 12px; background: #fff; border: 1px solid #e8e8e4; border-radius: 10px; padding: 10px 12px; margin-bottom: 6px; }
.log-item:hover { border-color: #ccc; }
.log-icon { font-size: 18px; color: #888; }
.log-info { flex: 1; }
.log-name { font-size: 12.5px; font-weight: 500; color: #1a1a1a; }
.log-client { font-size: 11px; color: #888; margin-top: 1px; }
.log-files { display: flex; gap: 4px; }
.log-file-btn { font-size: 10px; padding: 3px 7px; border: 1px solid #e8e8e4; border-radius: 5px; background: #fff; color: #555; cursor: pointer; display: flex; align-items: center; gap: 3px; }
.log-file-btn:hover { background: #f5f5f3; }
.log-status { font-size: 10px; padding: 3px 8px; border-radius: 20px; }
.log-transit { background: #E6F1FB; color: #185FA5; }
.log-customs { background: #FAEEDA; color: #854F0B; }
.log-delivered { background: #E1F5EE; color: #0F6E56; }
.log-booked { background: #EEEDFE; color: #534AB7; }

/* ── Finance ── */
.fin-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid #f0f0ec; font-size: 12px; }
.fin-row:last-child { border-bottom: none; }
.fin-row.header-row { font-size: 10px; font-weight: 600; color: #888; text-transform: uppercase; }
.fi-main { flex: 1; }
.fi-date { color: #888; min-width: 55px; }
.fi-amt { font-weight: 600; min-width: 70px; text-align: right; }
.fi-amt.green { color: #1D9E75; }
.fi-amt.red { color: #D85A30; }
.red { color: #D85A30; }
.green { color: #1D9E75; }

/* ── Locked ── */
.locked-banner { display: flex; align-items: center; gap: 8px; background: #f5f5f3; border: 1px solid #e8e8e4; border-radius: 10px; padding: 12px 16px; color: #888; font-size: 13px; margin-bottom: 16px; }

/* ── Messages ── */
.msg-thread { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; max-height: 300px; overflow-y: auto; padding: 4px; }
.msg-group { display: flex; flex-direction: column; }
.msg-group.align-right { align-items: flex-end; }
.msg-sender { font-size: 10px; color: #888; margin-bottom: 3px; }
.msg { max-width: 75%; padding: 9px 13px; border-radius: 14px; font-size: 12.5px; line-height: 1.5; }
.msg-in { background: #f0f0ec; color: #1a1a1a; border-bottom-left-radius: 4px; }
.msg-out { background: #1D9E75; color: #fff; border-bottom-right-radius: 4px; }
.msg-time { font-size: 10px; color: #aaa; margin-top: 3px; }
.msg-input-row { display: flex; gap: 8px; }
.msg-input-row input { flex: 1; border: 1px solid #e8e8e4; border-radius: 8px; padding: 9px 12px; font-size: 13px; outline: none; }
.msg-input-row input:focus { border-color: #1D9E75; }
.send-btn { background: #1D9E75; color: #fff; border: none; border-radius: 8px; padding: 0 16px; font-size: 16px; cursor: pointer; }

/* ── Modal ── */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.45); display: flex; align-items: center; justify-content: center; z-index: 100; }
.modal-box { background: #fff; border-radius: 14px; width: 560px; max-width: 95vw; overflow: hidden; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid #e8e8e4; }
.modal-title { font-size: 14px; font-weight: 600; color: #1a1a1a; }
.modal-close { background: none; border: none; font-size: 18px; cursor: pointer; color: #888; }
.modal-body { padding: 20px; min-height: 120px; }
.modal-body .drive-info { text-align: center; padding: 20px; }
.modal-body .drive-info i { font-size: 48px; color: #4285f4; display: block; margin-bottom: 12px; }
.modal-body .drive-info p { font-size: 13px; color: #555; line-height: 1.6; }
.modal-footer { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid #e8e8e4; }

/* ── Drive setup banner ── */
.setup-banner { background: #fffbf0; border: 1px solid #f0d58c; border-radius: 10px; padding: 14px 16px; margin-bottom: 18px; display: flex; align-items: flex-start; gap: 10px; }
.setup-banner i { font-size: 18px; color: #854F0B; flex-shrink: 0; margin-top: 1px; }
.setup-banner-text { font-size: 12px; color: #555; line-height: 1.6; }
.setup-banner-text strong { color: #1a1a1a; }
.setup-banner-text a { color: #185FA5; }

/* ── Logo ── */
.logo-img { width: 32px; height: 32px; object-fit: contain; border-radius: 6px; flex-shrink: 0; }

/* ── Sourcing Table ── */
.sourcing-table-wrap { overflow-x: auto; margin-bottom: 20px; border: 1px solid #e8e8e4; border-radius: 12px; }
.sourcing-table { width: 100%; border-collapse: collapse; font-size: 12px; min-width: 900px; }
.sourcing-table thead th { background: #f5f5f3; padding: 10px 12px; text-align: left; font-size: 10px; font-weight: 600; color: #888; text-transform: uppercase; letter-spacing: 0.4px; border-bottom: 1px solid #e8e8e4; white-space: nowrap; }
.sourcing-table tbody tr { border-bottom: 1px solid #f0f0ec; transition: background 0.1s; }
.sourcing-table tbody tr:last-child { border-bottom: none; }
.sourcing-table tbody tr:hover { background: #fafaf8; }
.sourcing-table td { padding: 9px 12px; color: #1a1a1a; vertical-align: middle; }
.sourcing-table td.editable { cursor: text; }
.sourcing-table td.editable:hover { background: #f0faf6; }
.sourcing-table td input, .sourcing-table td textarea { border: none; background: transparent; width: 100%; font-size: 12px; font-family: inherit; color: #1a1a1a; outline: none; resize: none; }
.sourcing-table td input:focus, .sourcing-table td textarea:focus { background: #fff; border-bottom: 1.5px solid #1D9E75; }
.factory-link { color: #185FA5; cursor: pointer; text-decoration: underline; font-size: 12px; }
.factory-link:hover { color: #0f4a8a; }
.row-actions { display: flex; gap: 4px; }
.row-btn { background: none; border: 1px solid #e8e8e4; border-radius: 5px; padding: 4px 7px; cursor: pointer; font-size: 11px; color: #888; }
.row-btn:hover { background: #f5f5f3; color: #1a1a1a; }
.row-btn.del:hover { background: #FCEBEB; color: #A32D2D; border-color: #f5c6c6; }
.price-best { color: #1D9E75; font-weight: 700; }
.price-high { color: #D85A30; }

/* ── Price Comparison ── */
.sourcing-suppliers-mini { background: #fff; border: 1px solid #e8e8e4; border-radius: 12px; padding: 16px; }
.price-comp-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.price-comp-table th { background: #f5f5f3; padding: 8px 12px; text-align: left; font-size: 10px; font-weight: 600; color: #888; text-transform: uppercase; border-bottom: 1px solid #e8e8e4; }
.price-comp-table td { padding: 8px 12px; border-bottom: 1px solid #f0f0ec; }
.price-comp-table tr:last-child td { border-bottom: none; }

/* ── Supplier Cards ── */
.suppliers-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.supplier-card { background: #fff; border: 1px solid #e8e8e4; border-radius: 12px; padding: 16px; }
.supplier-card-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 12px; }
.supplier-card-name { font-size: 13px; font-weight: 600; color: #1a1a1a; }
.supplier-card-cn { font-size: 11px; color: #888; margin-top: 2px; }
.supplier-field { margin-bottom: 8px; }
.supplier-field label { font-size: 10px; color: #888; display: block; margin-bottom: 2px; }
.supplier-field span { font-size: 12px; color: #1a1a1a; }
.supplier-field span.link { color: #185FA5; }
.supplier-field input { border: 1px solid #e8e8e4; border-radius: 6px; padding: 5px 8px; font-size: 12px; width: 100%; outline: none; }
.supplier-field input:focus { border-color: #1D9E75; }

/* ── Finance Nav ── */
.finance-nav { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.finance-nav-years { display: flex; gap: 6px; }
.finance-nav-months { display: flex; gap: 6px; flex-wrap: wrap; }
.year-btn, .month-btn { padding: 5px 14px; border: 1px solid #e8e8e4; border-radius: 20px; background: #fff; font-size: 12px; cursor: pointer; color: #555; }
.year-btn:hover, .month-btn:hover { background: #f5f5f3; }
.year-btn.active, .month-btn.active { background: #1D9E75; color: #fff; border-color: #1D9E75; font-weight: 500; }

/* ── Finance Tables ── */
.finance-col-title { font-size: 13px; font-weight: 600; margin-bottom: 10px; display: flex; align-items: center; gap: 6px; }
.finance-col-title.income { color: #1D9E75; }
.finance-col-title.expense { color: #D85A30; }
.finance-add-row { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-top: 1px dashed #e8e8e4; margin-top: 8px; }
.finance-add-row input { border: 1px solid #e8e8e4; border-radius: 6px; padding: 5px 8px; font-size: 12px; outline: none; }
.finance-add-row input:focus { border-color: #1D9E75; }
.finance-add-row input.wide { flex: 1; }
.finance-add-row input.amount { width: 90px; }
.fin-row-editable { cursor: pointer; }
.fin-row-editable:hover { background: #fafaf8; }

/* ── Toast ── */
.toast { position: fixed; bottom: 24px; right: 24px; background: #1a1a1a; color: #fff; padding: 10px 16px; border-radius: 8px; font-size: 12px; display: none; align-items: center; gap: 8px; z-index: 200; }
.toast.show { display: flex; }

/* ── Modal wide ── */
.modal-wide { width: 680px; }
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.4); display: flex; align-items: center; justify-content: center; z-index: 100; }
.modal-box { background: #fff; border-radius: 14px; max-width: 95vw; overflow: hidden; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid #e8e8e4; }
.modal-title { font-size: 14px; font-weight: 600; }
.modal-close { background: none; border: none; font-size: 18px; cursor: pointer; color: #888; }
.modal-body { padding: 20px; max-height: 60vh; overflow-y: auto; }
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid #e8e8e4; }

/* ── Task enhancements ── */
.task-overdue { background: #fffaf9; border-left: 3px solid #D85A30; padding-left: 10px; border-radius: 0 8px 8px 0; }
.overdue-text { color: #D85A30; font-weight: 600; }
.assignee-tag { display: inline-block; font-size: 10px; padding: 1px 7px; border-radius: 20px; font-weight: 500; }
.assignee-dana { background: #E6F1FB; color: #185FA5; }
.assignee-me { background: #E1F5EE; color: #0F6E56; }

/* ── Auth / Login ── */
.user-avatar-sm { width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 700; flex-shrink: 0; }

/* ── Sourcing Tasks ── */
.sourcing-task-card { background:#fff; border:1px solid #e8e8e4; border-radius:12px; padding:14px 16px; margin-bottom:8px; cursor:pointer; transition:border-color 0.15s; }
.sourcing-task-card:hover { border-color:#1D9E75; }
.sourcing-task-name { font-size:14px; font-weight:600; color:#1a1a1a; }
.sourcing-task-meta { font-size:11px; color:#888; margin-top:3px; }
.sourcing-task-note { font-size:11px; color:#555; margin-top:5px; font-style:italic; }

/* ── Quotes Grid ── */
.quotes-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(180px,1fr)); gap:10px; }
.quote-card { background:#f5f5f3; border:1px solid #e8e8e4; border-radius:10px; padding:12px; }
.quote-card.quote-best { background:#f0faf6; border-color:#9FE1CB; }
.quote-card.quote-high { background:#fff9f5; border-color:#f5c6a0; }
.quote-factory { font-size:11px; color:#185FA5; cursor:pointer; font-weight:500; margin-bottom:6px; line-height:1.4; }
.quote-factory:hover { text-decoration:underline; }
.quote-price { font-size:18px; font-weight:700; color:#1a1a1a; margin-bottom:4px; }
.quote-card.quote-best .quote-price { color:#1D9E75; }
.quote-card.quote-high .quote-price { color:#D85A30; }
.quote-note { font-size:10px; color:#888; line-height:1.4; }
.quote-tag { font-size:10px; color:#1D9E75; font-weight:600; margin-top:6px; }

/* ── Factories Grid ── */
.factories-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(300px,1fr)); gap:12px; }
.factory-card { background:#fff; border:1px solid #e8e8e4; border-radius:12px; padding:14px; cursor:pointer; transition:border-color 0.15s; }
.factory-card:hover { border-color:#1D9E75; }
.factory-card-top { display:flex; align-items:flex-start; gap:10px; margin-bottom:10px; }
.factory-avatar { width:38px; height:38px; border-radius:10px; display:flex; align-items:center; justify-content:center; font-size:12px; font-weight:700; flex-shrink:0; }
.factory-name { font-size:12.5px; font-weight:600; color:#1a1a1a; line-height:1.4; }
.factory-meta { font-size:10px; color:#888; margin-top:2px; }
.factory-card-body { display:flex; flex-direction:column; gap:4px; }
.factory-field { font-size:11px; color:#555; display:flex; align-items:center; gap:5px; }
.factory-field i { font-size:12px; color:#aaa; flex-shrink:0; }
.factory-note { font-size:10px; color:#888; background:#f5f5f3; padding:3px 8px; border-radius:4px; margin-top:4px; align-self:flex-start; }
.rel-badge { font-size:9px; padding:2px 8px; border-radius:20px; font-weight:600; white-space:nowrap; flex-shrink:0; }
.rel-production { background:#E1F5EE; color:#0F6E56; }
.rel-qc { background:#E6F1FB; color:#185FA5; }
.rel-sourcing { background:#FAEEDA; color:#854F0B; }
.rel-checking { background:#EEEDFE; color:#534AB7; }
.factory-link { display:inline-flex; align-items:center; color:#185FA5; cursor:pointer; margin-left:4px; }

/* ── Full card helper ── */
.full-card { background:#fff; border:1px solid #e8e8e4; border-radius:12px; padding:14px; margin-bottom:14px; }

/* ── Sourcing Tasks ── */
.sourcing-task-card { background:#fff; border:1px solid #e8e8e4; border-radius:12px; padding:16px; cursor:pointer; transition:border-color 0.15s; }
.sourcing-task-card:hover { border-color:#1D9E75; }
.sourcing-task-icon { width:38px; height:38px; background:#f0faf6; border-radius:10px; display:flex; align-items:center; justify-content:center; color:#1D9E75; font-size:18px; flex-shrink:0; }
.field-mini-label { font-size:10px; font-weight:600; color:#888; text-transform:uppercase; letter-spacing:0.4px; display:block; margin-bottom:3px; }
.field-mini { border:1px solid #e8e8e4; border-radius:6px; padding:6px 8px; font-size:12px; width:100%; outline:none; background:#fff; font-family:inherit; }
.field-mini:focus { border-color:#1D9E75; }
select.field-mini { cursor:pointer; }

/* ── Factory Cards ── */
.factory-card { transition:border-color 0.15s; }
.factory-card:hover { border-color:#ccc; }

/* ── Sourcing v2 ── */
.st-card { background:#fff; border:1px solid #e8e8e4; border-radius:12px; padding:16px; cursor:pointer; display:flex; align-items:center; gap:14px; transition:border-color 0.15s; }
.st-card:hover { border-color:#1D9E75; }
.st-card-icon { width:40px; height:40px; background:#f0faf6; border-radius:10px; display:flex; align-items:center; justify-content:center; color:#1D9E75; font-size:18px; flex-shrink:0; }
.st-card-title { font-size:14px; font-weight:600; color:#1a1a1a; }
.st-card-meta { display:flex; flex-wrap:wrap; gap:10px; font-size:11px; color:#888; margin-top:3px; }
.st-card-meta span { display:flex; align-items:center; gap:3px; }
.st-card-note { font-size:11px; color:#aaa; margin-top:3px; }
.item-card { background:#fff; border:1px solid #e8e8e4; border-radius:12px; padding:16px; margin-bottom:12px; }
.item-num { width:28px; height:28px; background:#f0faf6; border-radius:7px; display:flex; align-items:center; justify-content:center; font-size:12px; font-weight:700; color:#1D9E75; flex-shrink:0; }
.item-fields-grid { display:grid; grid-template-columns:2fr 1fr 1fr 1fr 1fr; gap:8px; }
.fl { font-size:10px; font-weight:600; color:#888; text-transform:uppercase; letter-spacing:0.4px; display:block; margin-bottom:3px; }
.fi { border:1px solid #e8e8e4; border-radius:6px; padding:7px 9px; font-size:12px; width:100%; outline:none; background:#fff; font-family:inherit; color:#1a1a1a; }
.fi:focus { border-color:#1D9E75; }
select.fi { cursor:pointer; }
.factory-link { color:#185FA5; cursor:pointer; text-decoration:underline; font-weight:500; font-size:12px; }
.factory-link:hover { color:#0f4a8a; }
.quote-tag { font-size:9px; padding:2px 6px; border-radius:20px; font-weight:600; }
.quote-tag.best { background:#E1F5EE; color:#0F6E56; }
.quote-tag.worst { background:#FCEBEB; color:#A32D2D; }
.empty-state { text-align:center; padding:50px 20px; color:#aaa; }
.empty-state i { font-size:40px; display:block; margin-bottom:10px; }
.empty-state div { font-size:14px; font-weight:500; color:#888; margin-bottom:4px; }
.empty-state p { font-size:12px; }

/* ── Relation badges ── */
.rel-badge { font-size:9px; padding:2px 7px; border-radius:20px; font-weight:600; display:inline-block; }
.rel-production { background:#E1F5EE; color:#0F6E56; }
.rel-qc { background:#E6F1FB; color:#185FA5; }
.rel-sourcing { background:#FAEEDA; color:#854F0B; }
.rel-checking { background:#EEEDFE; color:#534AB7; }
.rel-notanymore { background:#f0f0ec; color:#888; }
.factory-card { transition:border-color 0.15s; }
.factory-card:hover { border-color:#ccc; }

/* ── Factory Relation Tabs ── */
.rel-tab { padding:7px 14px; border:1.5px solid #e8e8e4; border-radius:20px; background:#fff; font-size:11px; font-weight:500; cursor:pointer; color:#555; display:inline-flex; align-items:center; gap:5px; transition:all 0.15s; }
.rel-tab:hover { border-color:#ccc; background:#f5f5f3; }
.rel-tab.active { background:#1a1a1a; color:#fff; border-color:#1a1a1a; }
.rel-tab-production.active { background:#0F6E56; border-color:#0F6E56; }
.rel-tab-qc.active { background:#185FA5; border-color:#185FA5; }
.rel-tab-sourcing.active { background:#854F0B; border-color:#854F0B; }
.rel-tab-checking.active { background:#534AB7; border-color:#534AB7; }
.rel-tab-notanymore.active { background:#888; border-color:#888; }

/* ── Sourcing table header cells ── */
.th-cell { padding:9px 12px; text-align:left; font-size:10px; font-weight:700; color:#888; text-transform:uppercase; letter-spacing:0.4px; border-bottom:1px solid #e8e8e4; white-space:nowrap; }

/* ── Modal inputs ── */
.modal-input { border:1px solid #e8e8e4; border-radius:6px; padding:8px 10px; font-size:13px; width:100%; outline:none; font-family:inherit; color:#1a1a1a; background:#fff; }
.modal-input:focus { border-color:#1D9E75; }
select.modal-input { cursor:pointer; }
.supplier-field label { font-size:10px; font-weight:600; color:#888; text-transform:uppercase; letter-spacing:0.4px; display:block; margin-bottom:4px; }

/* ── Timeline editable ── */
.tl-step:hover .tl-step-date { opacity:0.8; }
.tl-empty { color:#ccc !important; font-style:italic; font-size:10px !important; }

/* ── Invoice filters ── */
.inv-filter-btn { padding:6px 14px; border:1.5px solid #e8e8e4; border-radius:20px; background:#fff; font-size:11px; font-weight:500; cursor:pointer; color:#555; transition:all 0.15s; }
.inv-filter-btn:hover { border-color:#ccc; background:#f5f5f3; }
.inv-filter-btn.active { background:#1a1a1a; color:#fff; border-color:#1a1a1a; }
.fin-row-editable:hover { background:#fafaf8; }

/* ── Finance rows clickable ── */
.fin-row-click { cursor:pointer; transition:background 0.1s; }
.fin-row-click:hover { background:#fafaf8; }

/* ── Logout button ── */
.logout-btn { width:100%; margin-top:8px; padding:8px; font-size:12px; background:none; border:1px solid #e8e8e4; border-radius:8px; cursor:pointer; display:flex; align-items:center; justify-content:center; gap:6px; color:#888; transition:all 0.15s; }
.logout-btn:hover { background:#FCEBEB; color:#A32D2D; border-color:#f5c6c6; }
