/* ================================================================
   AGILE BUSINESS — Admin Panel Styles
   Red & White Minimalist Design with Rounded Forms
   ================================================================ */

:root {
    --primary: #D32F2F;
    --primary-dark: #B71C1C;
    --primary-light: #EF5350;
    --primary-50: #FFEBEE;
    --primary-100: #FFCDD2;
    --white: #FFFFFF;
    --bg: #F8F9FA;
    --bg-card: #FFFFFF;
    --text: #212121;
    --text-secondary: #757575;
    --text-muted: #9E9E9E;
    --border: #E8E8E8;
    --border-light: #F0F0F0;
    --success: #4CAF50;
    --warning: #FF9800;
    --danger: #F44336;
    --info: #2196F3;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
    --shadow: 0 2px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
    --radius: 14px;
    --radius-sm: 10px;
    --radius-lg: 20px;
    --sidebar-w: 260px;
    --topbar-h: 60px;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --transition: 0.25s cubic-bezier(.4,0,.2,1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; font-family: var(--font); background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--primary); text-decoration: none; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; font-size: 14px; }

/* ── LOGIN SCREEN ─────────────────────────────────── */
.login-screen {
    display: flex; align-items: center; justify-content: center;
    min-height: 100vh; background: linear-gradient(135deg, var(--primary-50) 0%, #fff 50%, var(--primary-50) 100%);
    padding: 20px;
}
.login-card {
    background: var(--white); border-radius: var(--radius-lg); padding: 48px 40px;
    box-shadow: var(--shadow-lg); max-width: 420px; width: 100%; text-align: center;
}
.login-logo { margin-bottom: 24px; }
.login-logo img { width: 64px; height: 64px; border-radius: 16px; }
.login-typing {
    font-size: 20px; font-weight: 600; color: var(--text); min-height: 32px; margin-bottom: 32px;
}
.login-typing .cursor-blink {
    display: inline-block; width: 2px; height: 22px; background: var(--primary); margin-left: 2px;
    vertical-align: text-bottom; animation: blink 0.7s infinite;
}
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:0} }
.login-form { text-align: left; }
.form-group { margin-bottom: 20px; }
.form-group label { display: block; font-size: 13px; font-weight: 500; color: var(--text-secondary); margin-bottom: 6px; }
.form-group input, .form-group select, .form-group textarea {
    width: 100%; padding: 12px 16px; border: 1.5px solid var(--border); border-radius: var(--radius-sm);
    background: var(--bg); transition: var(--transition); outline: none; font-size: 14px;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    border-color: var(--primary); box-shadow: 0 0 0 3px rgba(211,47,47,0.1);
}
.login-error { color: var(--danger); font-size: 13px; margin-top: 12px; min-height: 18px; text-align: center; }

/* ── BUTTONS ──────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; gap: 8px; padding: 10px 20px; font-size: 14px;
    font-weight: 500; border: none; border-radius: var(--radius-sm); transition: var(--transition);
    cursor: pointer; line-height: 1.4;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: var(--shadow); }
.btn-secondary { background: var(--bg); color: var(--text); border: 1.5px solid var(--border); }
.btn-secondary:hover { border-color: var(--primary); color: var(--primary); }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 6px 14px; font-size: 13px; border-radius: 8px; }
.btn-full { width: 100%; justify-content: center; }
.btn-icon {
    display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px;
    border: none; background: transparent; border-radius: 10px; color: var(--text-secondary); transition: var(--transition);
}
.btn-icon:hover { background: var(--primary-50); color: var(--primary); }

/* ── ADMIN SHELL ──────────────────────────────────── */
.admin-shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; grid-template-rows: var(--topbar-h) 1fr; min-height: 100vh; }

/* ── TOPBAR ───────────────────────────────────────── */
.topbar {
    grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between;
    padding: 0 24px; background: var(--white); border-bottom: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm); z-index: 100; height: var(--topbar-h);
}
.topbar-left { display: flex; align-items: center; gap: 16px; }
.topbar-brand { font-weight: 700; font-size: 16px; color: var(--primary); }
.sidebar-toggle { display: none; background: none; border: none; color: var(--text-secondary); padding: 4px; }
.topbar-center { display: flex; align-items: center; }
.topbar-clock {
    font-size: 14px; font-weight: 500; color: var(--text); background: var(--bg);
    padding: 6px 16px; border-radius: 10px; cursor: pointer; white-space: nowrap;
}
.topbar-right { display: flex; align-items: center; gap: 12px; }
.topbar-user { display: flex; align-items: center; gap: 10px; cursor: pointer; padding: 4px 8px; border-radius: 10px; transition: var(--transition); }
.topbar-user:hover { background: var(--bg); }
.topbar-avatar {
    width: 34px; height: 34px; border-radius: 10px; background: var(--primary);
    color: #fff; display: flex; align-items: center; justify-content: center;
    font-weight: 600; font-size: 14px;
}
.topbar-name { font-weight: 500; font-size: 14px; }
.topbar-role {
    font-size: 11px; background: var(--primary-50); color: var(--primary);
    padding: 2px 8px; border-radius: 6px; font-weight: 500;
}

/* ── SIDEBAR ──────────────────────────────────────── */
.sidebar {
    grid-row: 2; background: var(--white); border-right: 1px solid var(--border-light);
    overflow-y: auto; padding: 16px 12px;
}
.sidebar-nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar-link {
    display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: var(--radius-sm);
    color: var(--text-secondary); font-size: 14px; font-weight: 500; transition: var(--transition);
    text-decoration: none;
}
.sidebar-link:hover { background: var(--primary-50); color: var(--primary); }
.sidebar-link.active { background: var(--primary); color: #fff; }
.sidebar-link.active svg { stroke: #fff; }
.sidebar-link.sub { padding-left: 46px; font-size: 13px; }
.sidebar-group-toggle {
    display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: var(--radius-sm);
    background: none; border: none; width: 100%; font-size: 14px; font-weight: 500;
    color: var(--text-secondary); transition: var(--transition); text-align: left;
}
.sidebar-group-toggle:hover { background: var(--primary-50); color: var(--primary); }
.sidebar-group-toggle .chevron { margin-left: auto; transition: transform 0.2s; }
.sidebar-group.open .sidebar-group-toggle .chevron { transform: rotate(180deg); }
.sidebar-group-items {
    max-height: 0; overflow: hidden; transition: max-height 0.3s ease;
}
.sidebar-group.open .sidebar-group-items { max-height: 500px; }
.sidebar-divider { height: 1px; background: var(--border-light); margin: 8px 0; }

/* ── MAIN CONTENT ─────────────────────────────────── */
.main-content { grid-row: 2; padding: 24px; overflow-y: auto; background: var(--bg); }
.content-area { max-width: 1400px; margin: 0 auto; }

/* ── CARDS ────────────────────────────────────────── */
.card {
    background: var(--bg-card); border-radius: var(--radius); padding: 24px;
    box-shadow: var(--shadow-sm); border: 1px solid var(--border-light);
}
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.card-title { font-size: 16px; font-weight: 600; color: var(--text); }

/* ── STATS GRID ───────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card {
    background: var(--bg-card); border-radius: var(--radius); padding: 20px;
    border: 1px solid var(--border-light); box-shadow: var(--shadow-sm);
    display: flex; align-items: flex-start; gap: 16px;
}
.stat-icon {
    width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center;
    justify-content: center; flex-shrink: 0;
}
.stat-icon.red { background: var(--primary-50); color: var(--primary); }
.stat-icon.green { background: #E8F5E9; color: var(--success); }
.stat-icon.blue { background: #E3F2FD; color: var(--info); }
.stat-icon.orange { background: #FFF3E0; color: var(--warning); }
.stat-info { flex: 1; }
.stat-value { font-size: 24px; font-weight: 700; color: var(--text); line-height: 1.2; }
.stat-label { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

/* ── CHARTS ───────────────────────────────────────── */
.charts-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(400px, 1fr)); gap: 20px; margin-bottom: 24px; }
.chart-card { background: var(--bg-card); border-radius: var(--radius); padding: 24px; border: 1px solid var(--border-light); }
.chart-title { font-size: 15px; font-weight: 600; margin-bottom: 16px; }
.chart-wrap { position: relative; height: 260px; }
.chart-wrap canvas { width: 100% !important; height: 100% !important; }

/* ── MAP ──────────────────────────────────────────── */
.map-card { border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border-light); margin-bottom: 24px; }
.map-card .leaflet-container { height: 360px; border-radius: var(--radius); }

/* ── TABLE ────────────────────────────────────────── */
.table-card { background: var(--bg-card); border-radius: var(--radius); border: 1px solid var(--border-light); overflow: hidden; }
.table-header {
    display: flex; align-items: center; justify-content: space-between; padding: 16px 20px;
    border-bottom: 1px solid var(--border-light);
}
.table-title { font-size: 15px; font-weight: 600; }
.table-actions { display: flex; gap: 8px; align-items: center; }
.table-search {
    padding: 8px 14px; border: 1.5px solid var(--border); border-radius: 10px;
    background: var(--bg); outline: none; font-size: 13px; width: 220px; transition: var(--transition);
}
.table-search:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(211,47,47,0.08); }
.table-filters { display: flex; gap: 8px; padding: 12px 20px; border-bottom: 1px solid var(--border-light); flex-wrap: wrap; }
.filter-btn {
    padding: 5px 14px; border-radius: 8px; border: 1px solid var(--border);
    background: var(--white); font-size: 12px; font-weight: 500; color: var(--text-secondary);
    cursor: pointer; transition: var(--transition);
}
.filter-btn:hover, .filter-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }

table { width: 100%; border-collapse: collapse; }
th { text-align: left; padding: 12px 16px; font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; background: var(--bg); border-bottom: 1px solid var(--border-light); }
td { padding: 12px 16px; font-size: 13px; border-bottom: 1px solid var(--border-light); vertical-align: middle; }
tr:hover td { background: var(--primary-50); }

.badge {
    display: inline-flex; padding: 3px 10px; border-radius: 6px; font-size: 11px; font-weight: 600;
}
.badge-new { background: #E3F2FD; color: #1565C0; }
.badge-processing { background: #FFF3E0; color: #E65100; }
.badge-accepted, .badge-in_progress { background: #E8F5E9; color: #2E7D32; }
.badge-completed { background: #E8F5E9; color: #1B5E20; }
.badge-rejected, .badge-cancelled { background: #FFEBEE; color: #C62828; }
.badge-on_hold { background: #F3E5F5; color: #6A1B9A; }

.pagination { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 16px 20px; }
.page-btn {
    padding: 6px 12px; border-radius: 8px; border: 1px solid var(--border);
    background: var(--white); font-size: 13px; cursor: pointer; transition: var(--transition);
}
.page-btn:hover, .page-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.page-btn:disabled { opacity: 0.5; cursor: default; }

/* ── DETAIL PANEL ─────────────────────────────────── */
.detail-panel { background: var(--bg-card); border-radius: var(--radius); padding: 24px; border: 1px solid var(--border-light); }
.detail-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.detail-title { font-size: 18px; font-weight: 600; }
.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; margin-bottom: 20px; }
.detail-field label { display: block; font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.detail-field .value { font-size: 14px; font-weight: 500; color: var(--text); }
.detail-actions { display: flex; gap: 12px; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--border-light); }

/* ── EDITOR ───────────────────────────────────────── */
.editor-container { margin-bottom: 24px; }
.lang-tabs { display: flex; gap: 4px; margin-bottom: 16px; flex-wrap: wrap; }
.lang-tab {
    display: flex; align-items: center; gap: 6px; padding: 6px 14px; border-radius: 8px;
    border: 1.5px solid var(--border); background: var(--white); font-size: 13px;
    font-weight: 500; cursor: pointer; transition: var(--transition);
}
.lang-tab:hover { border-color: var(--primary); color: var(--primary); }
.lang-tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.lang-tab img { width: 18px; height: 13px; border-radius: 2px; }
.editor-pane { display: none; }
.editor-pane.active { display: block; }
.quill-editor { background: var(--white); border-radius: 0 0 var(--radius-sm) var(--radius-sm); min-height: 300px; }
.ql-toolbar.ql-snow { border-radius: var(--radius-sm) var(--radius-sm) 0 0; border-color: var(--border); }
.ql-container.ql-snow { border-color: var(--border); border-radius: 0 0 var(--radius-sm) var(--radius-sm); font-size: 14px; }

/* ── FORM LAYOUTS ─────────────────────────────────── */
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; margin-bottom: 16px; }
.form-group textarea { min-height: 100px; resize: vertical; }
.form-actions { display: flex; gap: 12px; margin-top: 24px; }
.form-section { margin-bottom: 32px; }
.form-section-title { font-size: 15px; font-weight: 600; margin-bottom: 16px; padding-bottom: 8px; border-bottom: 1px solid var(--border-light); }

/* ── PRICING EDITOR ───────────────────────────────── */
.pricing-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.pricing-card {
    background: var(--bg); border-radius: var(--radius); padding: 20px;
    border: 1px solid var(--border-light);
}
.pricing-card h4 { font-size: 14px; font-weight: 600; margin-bottom: 12px; color: var(--primary); }
.pricing-input {
    display: flex; align-items: center; gap: 8px; margin-bottom: 8px;
}
.pricing-input label { flex: 1; font-size: 13px; color: var(--text-secondary); }
.pricing-input input {
    width: 120px; padding: 6px 10px; border: 1.5px solid var(--border);
    border-radius: 8px; text-align: right; font-size: 13px;
}

/* ── TOAST ────────────────────────────────────────── */
.toast-container { position: fixed; top: 20px; right: 20px; z-index: 10000; display: flex; flex-direction: column; gap: 8px; }
.toast {
    padding: 12px 20px; border-radius: var(--radius-sm); color: #fff; font-size: 13px;
    font-weight: 500; box-shadow: var(--shadow-lg); animation: toastIn 0.3s ease;
    display: flex; align-items: center; gap: 8px; max-width: 360px;
}
.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-info { background: var(--info); }
@keyframes toastIn { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: translateX(0); } }
@keyframes toastOut { from { opacity: 1; } to { opacity: 0; transform: translateX(30px); } }

/* ── RESPONSIVE ───────────────────────────────────── */
@media (max-width: 900px) {
    .admin-shell { grid-template-columns: 1fr; }
    .sidebar { position: fixed; left: -280px; top: var(--topbar-h); bottom: 0; width: 280px; z-index: 200; transition: left 0.3s; box-shadow: var(--shadow-lg); }
    .sidebar.open { left: 0; }
    .sidebar-toggle { display: inline-flex; }
    .charts-grid { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
    .stats-grid { grid-template-columns: 1fr; }
    .topbar-name, .topbar-role { display: none; }
    .main-content { padding: 16px; }
    .table-search { width: 140px; }
}

/* ── LOADING ──────────────────────────────────────── */
.loading-spinner {
    display: flex; align-items: center; justify-content: center; padding: 60px;
}
.spinner {
    width: 36px; height: 36px; border: 3px solid var(--border); border-top-color: var(--primary);
    border-radius: 50%; animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── SECTION HEADERS ──────────────────────────────── */
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.section-title { font-size: 22px; font-weight: 700; color: var(--text); }
.section-subtitle { font-size: 14px; color: var(--text-muted); margin-top: 4px; }

/* ── EMPTY STATE ──────────────────────────────────── */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-state svg { width: 48px; height: 48px; margin-bottom: 16px; opacity: 0.4; }
.empty-state p { font-size: 15px; }

/* ── MISC ─────────────────────────────────────────── */
.text-muted { color: var(--text-muted); }
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.inline-flex { display: inline-flex; align-items: center; }
.gap-8 { gap: 8px; }
.line-through { text-decoration: line-through; }

/* ── CALENDAR POPUP ───────────────────────────────── */
.calendar-popup {
    position: fixed; background: var(--white); border-radius: var(--radius); padding: 16px;
    box-shadow: var(--shadow-lg); border: 1px solid var(--border-light); z-index: 1000; min-width: 280px;
    opacity: 0; transform: translateY(-8px); transition: var(--transition);
}
.calendar-popup.show { opacity: 1; transform: translateY(0); }
.calendar-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; font-weight: 600; font-size: 14px; }
.calendar-header button { background: none; border: none; padding: 4px 8px; border-radius: 6px; font-size: 16px; cursor: pointer; color: var(--text-secondary); }
.calendar-header button:hover { background: var(--primary-50); color: var(--primary); }
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; }
.calendar-grid .day-name { font-size: 11px; font-weight: 600; color: var(--text-muted); padding: 4px; }
.calendar-grid .day { font-size: 13px; padding: 6px; border-radius: 8px; cursor: default; }
.calendar-grid .day.today { background: var(--primary); color: #fff; font-weight: 600; }
.calendar-grid .day.other-month { opacity: 0.3; }

/* ── PIPELINE (KANBAN) ────────────────────────────── */
.pipeline-board {
    display: grid; grid-template-columns: repeat(6, minmax(200px, 1fr)); gap: 12px;
    overflow-x: auto; padding-bottom: 8px;
}
.pipeline-column {
    background: var(--bg); border-radius: var(--radius); padding: 12px; min-height: 200px;
    border: 1px solid var(--border-light);
}
.pipeline-col-header {
    display: flex; align-items: center; justify-content: space-between;
    font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 12px;
    padding-bottom: 8px; border-bottom: 2px solid var(--primary);
}
.pipeline-count {
    background: var(--primary-50); color: var(--primary); padding: 2px 8px;
    border-radius: 10px; font-size: 11px; font-weight: 700;
}
.pipeline-cards { display: flex; flex-direction: column; gap: 8px; }
.pipeline-card {
    background: var(--white); border-radius: var(--radius-sm); padding: 12px;
    border: 1px solid var(--border-light); cursor: pointer; transition: var(--transition);
}
.pipeline-card:hover { box-shadow: var(--shadow); border-color: var(--primary-100); }
.pipeline-card-name { font-weight: 600; font-size: 13px; margin-bottom: 4px; }
.pipeline-card-info { font-size: 12px; color: var(--text-secondary); }
.pipeline-card-price { font-size: 13px; font-weight: 600; color: var(--primary); margin-top: 4px; }
.pipeline-card-date { font-size: 11px; color: var(--text-muted); margin-top: 4px; }
.pipeline-empty { text-align: center; color: var(--text-muted); font-size: 12px; padding: 20px 0; }

/* ── PIPELINE STAGE BAR ───────────────────────────── */
.pipeline-stages-bar { display: flex; gap: 6px; flex-wrap: wrap; }
.stage-chip {
    padding: 6px 14px; border-radius: 20px; border: 1.5px solid var(--border);
    background: var(--white); font-size: 12px; font-weight: 500;
    color: var(--text-secondary); cursor: pointer; transition: var(--transition);
}
.stage-chip:hover { border-color: var(--primary); color: var(--primary); }
.stage-chip.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ── TASKS ────────────────────────────────────────── */
.task-row {
    display: flex; align-items: center; gap: 12px; padding: 10px 0;
    border-bottom: 1px solid var(--border-light); font-size: 13px;
}
.task-row:last-child { border-bottom: none; }
.task-check { cursor: pointer; font-size: 18px; color: var(--text-muted); width: 24px; text-align: center; }
.task-check.done { color: var(--success); }

/* ── COMMENTS ─────────────────────────────────────── */
.comment-item { padding: 12px 0; border-bottom: 1px solid var(--border-light); }
.comment-item:last-child { border-bottom: none; }
.comment-header { font-size: 13px; margin-bottom: 4px; }
.comment-text { font-size: 14px; color: var(--text); white-space: pre-wrap; }

/* ── TIMELINE ─────────────────────────────────────── */
.timeline { padding: 8px 0; }
.timeline-item { display: flex; align-items: center; gap: 12px; padding: 8px 0; }
.timeline-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); flex-shrink: 0; }
.timeline-content { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; font-size: 13px; }

/* ── LINE ITEMS (Proposals/Invoices) ──────────────── */
.line-items-header {
    display: flex; align-items: center; gap: 8px; padding: 8px 0;
    font-size: 12px; font-weight: 600; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-light); margin-bottom: 8px;
}
.line-item {
    display: flex; align-items: center; gap: 8px; padding: 6px 0;
    border-bottom: 1px solid var(--border-light);
}
.line-item:last-child { border-bottom: none; }
.line-item input {
    padding: 8px 10px; border: 1.5px solid var(--border); border-radius: 8px;
    font-size: 13px; background: var(--bg);
}
.line-item input:focus { border-color: var(--primary); outline: none; }
.line-items-total {
    display: flex; justify-content: flex-end; gap: 8px;
    padding: 12px 0; font-size: 16px; font-weight: 700;
    border-top: 2px solid var(--text); margin-top: 8px;
}

/* ── ADDITIONAL BADGES ────────────────────────────── */
.badge-draft { background: #F5F5F5; color: #616161; }
.badge-sent { background: #E3F2FD; color: #1565C0; }
.badge-paid { background: #E8F5E9; color: #2E7D32; }
.badge-overdue { background: #FFEBEE; color: #C62828; }
.badge-expired { background: #FFF3E0; color: #E65100; }
.badge-won { background: #E8F5E9; color: #1B5E20; }
.badge-lost { background: #FFEBEE; color: #B71C1C; }
.badge-pending { background: #E3F2FD; color: #1565C0; }
.badge-done { background: #E8F5E9; color: #2E7D32; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.inline-flex { display: inline-flex; align-items: center; }

/* ── CALENDAR POPUP ───────────────────────────────── */
.calendar-popup {
    position: fixed; z-index: 999; background: var(--white); border-radius: var(--radius);
    box-shadow: var(--shadow-lg); padding: 16px; display: none; min-width: 280px;
}
.calendar-popup.show { display: block; }
.calendar-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.calendar-header button { background: none; border: none; font-size: 18px; cursor: pointer; padding: 4px 8px; border-radius: 6px; }
.calendar-header button:hover { background: var(--bg); }
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; }
.calendar-grid .day-name { font-size: 11px; font-weight: 600; color: var(--text-muted); padding: 4px; }
.calendar-grid .day {
    padding: 6px; font-size: 13px; border-radius: 8px; cursor: pointer; transition: var(--transition);
}
.calendar-grid .day:hover { background: var(--primary-50); }
.calendar-grid .day.today { background: var(--primary); color: #fff; font-weight: 600; }
.calendar-grid .day.other-month { color: var(--text-muted); }

/* ── SCROLLBAR ────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── TOGGLE SWITCH ───────────────────────────────── */
.toggle-switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.toggle-switch__track {
    position: relative; width: 44px; height: 24px;
    background: var(--border); border-radius: 12px;
    transition: background .25s;
}
.toggle-switch__track::after {
    content: ''; position: absolute; top: 2px; left: 2px;
    width: 20px; height: 20px; border-radius: 50%;
    background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.15);
    transition: transform .25s;
}
.toggle-switch.active .toggle-switch__track { background: var(--primary); }
.toggle-switch.active .toggle-switch__track::after { transform: translateX(20px); }
.toggle-switch__label { font-size: 13px; font-weight: 500; color: var(--text); user-select: none; }

/* ── UPLOAD DROPZONE ─────────────────────────────── */
.upload-dropzone {
    border: 2px dashed var(--border); border-radius: var(--radius);
    padding: 24px; text-align: center; cursor: pointer;
    transition: border-color .25s, background .25s;
    background: var(--bg);
}
.upload-dropzone:hover, .upload-dropzone.dragover {
    border-color: var(--primary); background: rgba(200,16,46,.03);
}
.upload-dropzone__icon { font-size: 32px; margin-bottom: 8px; color: var(--text-muted); }
.upload-dropzone__text { font-size: 13px; color: var(--text-muted); }
.upload-dropzone__text strong { color: var(--primary); }
.upload-dropzone input[type="file"] { display: none; }

.upload-preview {
    position: relative; display: inline-block; margin-top: 12px;
    border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--border-light);
}
.upload-preview img { display: block; max-height: 140px; max-width: 100%; object-fit: cover; }
.upload-preview__remove {
    position: absolute; top: 4px; right: 4px; width: 22px; height: 22px;
    border-radius: 50%; background: rgba(0,0,0,.6); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; cursor: pointer; border: none; line-height: 1;
    transition: background .2s;
}
.upload-preview__remove:hover { background: rgba(200,16,46,.85); }

/* ── GALLERY GRID ────────────────────────────────── */
.gallery-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px; margin-top: 12px;
}
.gallery-item {
    position: relative; aspect-ratio: 1; border-radius: var(--radius-sm);
    overflow: hidden; border: 1px solid var(--border-light);
    background: var(--bg);
}
.gallery-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gallery-item__remove {
    position: absolute; top: 4px; right: 4px; width: 20px; height: 20px;
    border-radius: 50%; background: rgba(0,0,0,.6); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; cursor: pointer; border: none; line-height: 1;
    transition: background .2s;
}
.gallery-item__remove:hover { background: rgba(200,16,46,.85); }

/* ── STACK SELECTOR ──────────────────────────────── */
.stack-group { margin-bottom: 20px; }
.stack-group__title { font-size: 13px; font-weight: 600; margin-bottom: 8px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; }
.stack-search { margin-bottom: 8px; }
.stack-search input {
    width: 100%; padding: 6px 12px; border: 1px solid var(--border);
    border-radius: var(--radius-sm); font-size: 13px; background: var(--white);
}
.stack-options {
    display: flex; flex-wrap: wrap; gap: 6px; max-height: 180px; overflow-y: auto;
    padding: 4px 0;
}
.stack-option {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 4px 10px; border-radius: 16px; font-size: 12px; font-weight: 500;
    border: 1px solid var(--border); background: var(--bg);
    cursor: pointer; transition: all .2s; user-select: none;
}
.stack-option:hover { border-color: var(--primary); }
.stack-option.selected { background: var(--primary); color: #fff; border-color: var(--primary); }
.stack-option.selected i { color: inherit; }
.stack-option img, .stack-option i { width: 16px; height: 16px; flex-shrink: 0; }
.stack-pills { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.stack-pill {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 4px 8px 4px 10px; border-radius: 16px; font-size: 12px; font-weight: 500;
    background: var(--primary-50); color: var(--primary); border: 1px solid rgba(200,16,46,.15);
}
.stack-pill__remove {
    width: 16px; height: 16px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 11px; cursor: pointer; border: none; background: rgba(200,16,46,.12);
    color: var(--primary); line-height: 1;
}

/* ── REVIEW EDITOR ───────────────────────────────── */
.review-editor { margin-top: 16px; }
.review-item {
    display: grid; grid-template-columns: 100px 1fr; gap: 16px; align-items: start;
    padding: 16px; border: 1px solid var(--border-light); border-radius: var(--radius);
    margin-bottom: 12px; background: var(--bg);
}
.review-logo-preview {
    width: 80px; height: 80px; border-radius: var(--radius-sm);
    border: 1px solid var(--border-light); overflow: hidden;
    display: flex; align-items: center; justify-content: center;
    background: var(--white);
}
.review-logo-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
.review-fields { display: flex; flex-direction: column; gap: 10px; }
.review-fields .form-row { margin-bottom: 0; }
.star-rating { display: inline-flex; gap: 2px; }
.star-rating__star {
    font-size: 20px; cursor: pointer; color: var(--border);
    transition: color .15s; user-select: none;
}
.star-rating__star:hover { color: #fbbf24; }
.star-rating__star.active { color: #f59e0b; }

/* ── 2FA LOGIN STEP ─────────────────────────────── */
#login2faGroup { animation: fadeSlideUp .3s ease; }
@keyframes fadeSlideUp {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}
#login2faCode:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(200,16,46,.12);
}

/* ── QUILL OVERRIDES ─────────────────────────────── */
.ql-editor { min-height: 300px; }
.ql-editor img { max-width: 100%; border-radius: 8px; margin: 8px 0; }
