*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
/* Formularele native (input/select/textarea/button) nu mostenesc fontul paginii by default in browser - fortam acelasi font peste tot */
input, select, textarea, button { font-family: inherit; }

:root {
  --sidebar-w: 220px;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --danger: #dc2626;
  --success: #16a34a;
  --warning-bg: #fef3c7;
  --warning-border: #f59e0b;
  --warning-text: #92400e;
  --bg: #f8f9fa;
  --surface: #ffffff;
  --border: #e5e7eb;
  --text: #111827;
  --text-muted: #6b7280;
  --text-light: #9ca3af;
  --sidebar-bg: #f8fafc;
  --sidebar-text: #64748b;
  --sidebar-active: #2563eb;
  --sidebar-active-bg: #eff6ff;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --cat-header-bg: #eff6ff;
  --cat-header-color: #1d4ed8;
  --bg-alt: #f8faff;
  --border-light: #e9edf2;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-7: 32px;
  --space-8: 40px;
}

/* Un singur font in toata aplicatia; cifrele au toate aceeasi latime, ca preturile si cantitatile sa se alinieze pe coloane (inclusiv in campurile editabile). */
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; font-variant-numeric: tabular-nums; background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5; }
code, kbd, samp { font-family: inherit; }

/* Fara sageti de increment/decrement pe campurile numerice (inconsistente ca precizie zecimala si stau in drum la editare) */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input[type="number"] { -moz-appearance: textfield; appearance: textfield; }

.screen { width: 100%; min-height: 100vh; }
.hidden { display: none !important; }

/* ─── LOGIN ─────────────────────────────────────────────────────────────────── */
#login-screen { display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%); }
.login-box { background: var(--surface); border-radius: var(--radius-lg); padding: 2.5rem; width: 100%; max-width: 380px; box-shadow: 0 20px 60px rgba(0,0,0,0.3); }
.login-logo { text-align: center; margin-bottom: 2rem; }
.logo-icon { width: 56px; height: 56px; background: var(--accent); color: white; border-radius: var(--radius-lg); display: flex; align-items: center; justify-content: center; font-size: 24px; font-weight: 700; margin: 0 auto 1rem; }
.logo-icon.sm { width: 32px; height: 32px; font-size: 14px; border-radius: 6px; }
.login-logo h1 { font-size: 22px; font-weight: 700; color: var(--text); }
.login-logo p { color: var(--text-muted); font-size: 13px; margin-top: 4px; }
.login-code-info { font-size: 13px; color: var(--text-muted); margin-bottom: 1rem; }
.login-code-input { text-align: center; font-size: 24px !important; letter-spacing: 8px; font-weight: 600; }
.login-remember { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-muted); cursor: pointer; }
.login-remember input { width: auto; }
.login-code-actions { display: flex; justify-content: space-between; margin-top: 0.75rem; }
.btn-link { background: none; border: none; color: var(--accent); font-size: 13px; cursor: pointer; padding: 4px 0; }
.btn-link:disabled { color: var(--text-light); cursor: default; }

/* ─── MAIN LAYOUT ───────────────────────────────────────────────────────────── */
#main-screen { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar-w); background: var(--sidebar-bg); display: flex; flex-direction: column; flex-shrink: 0; position: fixed; top: 0; left: 0; height: 100vh; z-index: 10; border-right: 1px solid #e2e8f0; }
.sidebar-logo { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 1.25rem 1rem; border-bottom: 1px solid #e2e8f0; color: #1e293b; font-weight: 600; font-size: 15px; text-align: center; }
.sidebar-logo-img { max-width: 140px; max-height: 80px; width: auto; height: auto; object-fit: contain; display: block; }
.sidebar-nav { flex: 1; padding: 1rem 0.5rem; display: flex; flex-direction: column; gap: 2px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 0.6rem 0.75rem; color: var(--sidebar-text); text-decoration: none; border-radius: var(--radius); font-size: 14px; transition: all 0.15s; cursor: pointer; background: none; border: none; width: 100%; text-align: left; }
.nav-item:hover { background: #f1f5f9; color: #374151; }
.nav-item.active { background: var(--sidebar-active-bg); color: var(--sidebar-active); font-weight: 500; }
.sidebar-footer { padding: 1rem; border-top: 1px solid #e2e8f0; display: flex; align-items: center; gap: 8px; }
.user-info { flex: 1; display: flex; align-items: center; gap: 8px; min-width: 0; overflow: hidden; }
.avatar { width: 32px; height: 32px; background: var(--accent); border-radius: 50%; display: flex; align-items: center; justify-content: center; color: white; font-size: 12px; font-weight: 600; flex-shrink: 0; }
.user-text { flex: 1; min-width: 0; overflow: hidden; }
.user-name { font-size: 13px; color: #1e293b; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 11px; color: var(--sidebar-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.content { margin-left: var(--sidebar-w); flex: 1; padding: 2rem; min-height: 100vh; }

/* Meniu lateral restrans (doar calculator): numai iconite, 60px. Butonul de jos il comuta. */
.sidebar-collapse-btn { width: auto; margin: 0 0.5rem 0.5rem; color: var(--text-light); font-size: 12.5px; }
@media (min-width: 1025px) {
  body.sidebar-collapsed { --sidebar-w: 60px; }
  .sidebar-collapsed .sidebar .nav-label,
  .sidebar-collapsed .sidebar-logo-img,
  .sidebar-collapsed .user-text { display: none; }
  .sidebar-collapsed .sidebar-logo { padding: 1rem 0; }
  .sidebar-collapsed .sidebar-nav { padding: 0.75rem 0.4rem; }
  .sidebar-collapsed .nav-item { justify-content: center; padding: 0.6rem 0; gap: 0; }
  .sidebar-collapsed .nav-item .ico { width: 18px; height: 18px; }
  .sidebar-collapsed .sidebar-collapse-btn { margin: 0 0.4rem 0.5rem; }
  .sidebar-collapsed .sidebar-collapse-btn .ico { transform: rotate(180deg); }
  .sidebar-collapsed .sidebar-footer { flex-direction: column; padding: 0.75rem 0; gap: 6px; }
  .sidebar-collapsed .user-info { flex: none; }
}
@media (max-width: 1024px) { .sidebar-collapse-btn { display: none; } }

/* ─── PAGES ─────────────────────────────────────────────────────────────────── */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.5rem; flex-wrap: wrap; gap: 0.75rem; }
.page-header h2 { font-size: 20px; font-weight: 600; }
.badge-count { font-size: 12px; color: var(--text-muted); margin-top: 2px; display: block; }

/* ─── FILTERS ────────────────────────────────────────────────────────────────── */
.filters { display: flex; gap: 8px; margin-bottom: 1.25rem; flex-wrap: wrap; align-items: center; }
.filters input, .filters select { padding: 0.45rem 0.75rem; border: 1px solid var(--border); border-radius: var(--radius); font-size: 13px; background: var(--surface); color: var(--text); outline: none; transition: border 0.15s; }
.filters input { width: 200px; }
.filters input:focus, .filters select:focus { border-color: var(--accent); }
.filters label.filter-disabled { opacity: 0.45; cursor: not-allowed !important; }

/* ─── TABLE ─────────────────────────────────────────────────────────────────── */
.table-wrapper { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow-x: auto; box-shadow: var(--shadow); }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { background: #f9fafb; padding: 0.75rem 1rem; text-align: left; font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; border-bottom: 1px solid var(--border); white-space: nowrap; }
.data-table th[data-sort] { cursor: pointer; user-select: none; }
.data-table th[data-sort]:hover { color: var(--text); }
.sort-icon { display: inline-block; width: 10px; font-style: normal; text-transform: none; }
.data-table td { padding: 0.75rem 1rem; border-bottom: 1px solid #f3f4f6; vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: #f0f4ff; cursor: pointer; }
.empty-state { text-align: center; color: var(--text-light); padding: 3rem 1rem !important; cursor: default !important; }
.data-table tbody tr.empty-state:hover { background: transparent; }
.data-table input, .data-table select { padding: 4px 7px; border: 1px solid var(--border); border-radius: 4px; font-size: 13px; font-family: inherit; background: var(--surface); color: var(--text); outline: none; }
.data-table input:focus, .data-table select:focus { border-color: var(--accent); }
/* Tabele cu latimi de coloana explicite (pe <th>): table-layout fixed obliga coloanele sa respecte acele latimi, altfel browserul le recalculeaza dupa continut si header-ul nu mai cade pe aceeasi coloana cu valoarea. */
.data-table-fixed { table-layout: fixed; }
.data-table-fixed .ro-cell { padding-left: var(--space-2); display: inline-block; }

/* ─── CATEGORII PRODUSE (carduri) ────────────────────────────────────────── */
.pc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; align-items: start; }
.pc-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column; }
.pc-card-header { display: flex; align-items: center; gap: 8px; padding: 10px 12px; background: var(--bg-alt); border-bottom: 1px solid var(--border); }
.pc-card-header input.pc-name { flex: 1; min-width: 0; font-weight: 600; font-size: 14px; border: 1px solid transparent; background: transparent; padding: 5px 7px; border-radius: 4px; color: var(--text); font-family: inherit; outline: none; }
.pc-card-header input.pc-name:hover, .pc-card-header input.pc-name:focus { border-color: var(--border); background: var(--surface); }
.pc-pif-field { display: flex; align-items: center; gap: 5px; font-size: 11px; color: var(--text-muted); white-space: nowrap; flex-shrink: 0; }
.pc-pif-field input { width: 52px; border: 1px solid var(--border); border-radius: 4px; padding: 4px 5px; font-size: 12px; font-family: inherit; background: var(--surface); color: var(--text); outline: none; text-align: right; }
.pc-pif-field input:focus { border-color: var(--accent); }
.pc-card-actions { display: flex; gap: 2px; flex-shrink: 0; }
.pc-card-body { padding: 10px 12px 12px; }
.pcc-head-row { display: grid; grid-template-columns: 1fr 48px 64px 56px 44px; gap: 6px; padding: 0 4px 4px; font-size: 10px; font-weight: 700; color: var(--text-light); text-transform: uppercase; letter-spacing: 0.04em; }
.pcc-head-row span:not(:first-child) { text-align: right; }
.pcc-row { display: grid; grid-template-columns: 1fr 48px 64px 56px 44px; gap: 6px; align-items: center; padding: 3px 4px; border-radius: 6px; }
.pcc-row:hover { background: var(--bg-alt); }
.pcc-row input { width: 100%; box-sizing: border-box; border: 1px solid var(--border); border-radius: 4px; padding: 4px 6px; font-size: 12.5px; font-family: inherit; background: var(--surface); color: var(--text); outline: none; text-align: right; }
.pcc-row input.pcc-complexity { text-align: left; }
.pcc-row input:hover { border-color: var(--accent); }
.pcc-row input:focus { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(37,99,235,0.1); }
.pcc-total-badge { text-align: right; font-size: 12.5px; color: var(--text-muted); padding-right: 4px; }
.pcc-row-actions { display: flex; gap: 2px; justify-content: flex-end; }
.pc-add-cx-btn { margin-top: 8px; width: 100%; }
.pc-empty-cx { padding: 14px 4px; text-align: center; color: var(--text-light); font-size: 12px; }

/* ─── STOCURI ────────────────────────────────────────────────────────────── */
.num-cell { text-align: right; font-variant-numeric: tabular-nums; }
.sub-text { display: block; font-size: 11px; color: var(--text-muted); font-weight: 400; }
.num-pos { color: var(--success); }
.num-neg { color: var(--danger); }
.modal-section-title { font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; margin: 1.25rem 0 0.75rem; }
.modal-section-title:first-child { margin-top: 0; }
.pagination { display: flex; align-items: center; justify-content: center; gap: 1rem; margin-top: 1rem; font-size: 13px; color: var(--text-muted); }
.pc-field { padding: 4px 7px; border: 1px solid var(--border); border-radius: 4px; font-size: 13px; font-family: inherit; background: var(--surface); color: var(--text); outline: none; }
.pc-field:focus { border-color: var(--accent); }

/* ─── BADGES ─────────────────────────────────────────────────────────────────── */
.badge { display: inline-flex; align-items: center; padding: 2px 10px; border-radius: 99px; font-size: 12px; font-weight: 500; }
.badge-draft       { background: #dbeafe; color: #1d4ed8; }
.badge-trimisa     { background: #e0e7ff; color: #4338ca; }
.badge-acceptata   { background: #dcfce7; color: #15803d; }
.badge-respinsa    { background: #fef2f2; color: #dc2626; }
.badge-expirata    { background: #f1f5f9; color: #475569; }
.badge-inlocuita   { background: #f1f5f9; color: #94a3b8; text-decoration: line-through; }
.badge-ordered     { background: #fef3c7; color: #92400e; }
.badge-not-ordered { background: #f3f4f6; color: #6b7280; }
.badge-admin       { background: #dcfce7; color: #15803d; }
.badge-pm          { background: #dbeafe; color: #1d4ed8; }
.badge-achizitii   { background: #fef3c7; color: #92400e; }
.badge-vizualizare { background: #f1f5f9; color: #475569; }
.badge-success     { background: #dcfce7; color: #15803d; }
.badge-danger      { background: #fef2f2; color: #dc2626; }

/* ─── ROW ACTIONS ────────────────────────────────────────────────────────────── */
.row-actions { display: flex; gap: 4px; justify-content: flex-end; opacity: 0; transition: opacity 0.15s; }
tr:hover .row-actions { opacity: 1; }

/* ─── BUTTONS ────────────────────────────────────────────────────────────────── */
.btn { padding: 0.5rem 1rem; border-radius: var(--radius); border: 1px solid transparent; font-size: 14px; font-weight: 500; cursor: pointer; transition: all 0.15s; display: inline-flex; align-items: center; gap: 6px; }
.btn-primary { background: var(--accent); color: white; border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: var(--bg); }
.btn-ghost { background: transparent; color: var(--text-muted); border-color: var(--border); }
.btn-ghost:hover { background: var(--bg); color: var(--text); }
.btn-danger { background: var(--danger); color: white; border-color: var(--danger); }
.btn-danger:hover { background: #b91c1c; }
.btn-success { background: var(--success); color: white; border-color: var(--success); }
.btn-success:hover { background: #15803d; }
.btn-full { width: 100%; justify-content: center; padding: 0.65rem 1rem; }
.btn-icon { background: transparent; border: none; cursor: pointer; padding: 6px; border-radius: 6px; color: var(--text-muted); display: inline-flex; align-items: center; justify-content: center; transition: all 0.15s; }
.btn-icon:hover { background: var(--bg); color: var(--text); }
.btn-sm { padding: 0.3rem 0.6rem; font-size: 12px; }

/* ─── FORMS ──────────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-size: 13px; font-weight: 500; color: var(--text); margin-bottom: 4px; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 0.5rem 0.75rem; border: 1px solid var(--border); border-radius: var(--radius);
  font-size: 14px; color: var(--text); background: var(--surface); outline: none; transition: border 0.15s; font-family: inherit;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1rem; }
.form-row-4 { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 1rem; }
.form-section-title { font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; margin: 1.25rem 0 0.75rem; padding-bottom: 0.5rem; border-bottom: 1px solid var(--border); }
.required { color: var(--danger); }

/* ─── ALERTS ─────────────────────────────────────────────────────────────────── */
.alert { padding: 0.6rem 0.75rem; border-radius: var(--radius); font-size: 13px; margin-top: 0.5rem; }
.alert-danger { background: #fef2f2; border: 1px solid #fca5a5; color: #991b1b; }
.alert-success { background: #f0fdf4; border: 1px solid #86efac; color: #166534; }
.alert-warning { background: var(--warning-bg); border: 1px solid var(--warning-border); color: var(--warning-text); }
.alert-info { background: #eff6ff; border: 1px solid #bfdbfe; color: #1d4ed8; }

/* ─── MODALS ─────────────────────────────────────────────────────────────────── */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 300; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.modal { background: var(--surface); border-radius: var(--radius-lg); width: 100%; max-width: 600px; box-shadow: 0 20px 60px rgba(0,0,0,0.2); max-height: 90vh; display: flex; flex-direction: column; }
.modal-lg { max-width: 860px; }
.modal-xl { max-width: 1100px; }
.modal-sm { max-width: 420px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.modal-header h3 { font-size: 16px; font-weight: 600; }
.modal-body { padding: 1.5rem; overflow-y: auto; flex: 1; }
.modal-footer { padding: 1rem 1.5rem; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; flex-shrink: 0; }

/* ─── SETTINGS PAGE ──────────────────────────────────────────────────────────── */
.settings-tabs { display: flex; border-bottom: 1px solid var(--border); margin-bottom: 1.5rem; flex-wrap: wrap; gap: 2px; overflow-x: auto; }
.stab-btn { padding: 0.65rem 1.25rem; border: none; background: transparent; font-size: 14px; font-weight: 500; color: var(--text-muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; transition: all 0.15s; white-space: nowrap; }
.stab-btn:hover { color: var(--text); }
.stab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }
.settings-content { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1.5rem; box-shadow: var(--shadow); }
.settings-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 1.25rem; }
.settings-item { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); }
.settings-item-value { flex: 1; font-size: 14px; }
.settings-add-form { display: flex; gap: 8px; align-items: center; }
.settings-add-form .form-group { margin-bottom: 0; flex: 1; }
.drag-handle { cursor: grab; color: var(--text-muted); font-size: 15px; padding: 0 4px; user-select: none; flex-shrink: 0; }
.drag-handle:active { cursor: grabbing; }
.settings-item.dragging { opacity: 0.35; }
.settings-item.drag-over { background: #eff6ff !important; border-color: #2563eb !important; }

/* ─── TAGS (multi-select PM) ─────────────────────────────────────────────────── */
.tags-wrap { display: flex; flex-wrap: wrap; gap: 5px; min-height: 36px; padding: 5px 8px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.tag { display: inline-flex; align-items: center; gap: 5px; background: #eff6ff; border: 1px solid #bfdbfe; color: #1d4ed8; border-radius: 99px; padding: 2px 6px 2px 10px; font-size: 12px; font-weight: 500; white-space: nowrap; }
.tag-remove { background: none; border: none; cursor: pointer; color: #93c5fd; font-size: 15px; line-height: 1; padding: 0 1px; display: flex; align-items: center; }
.tag-remove:hover { color: #1d4ed8; }

/* ─── OFFER HEADER CARD ──────────────────────────────────────────────────────── */
.offer-header-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1.5rem; margin-bottom: 1.5rem; box-shadow: var(--shadow); }
.offer-number-display { font-size: 28px; font-weight: 700; color: var(--accent); letter-spacing: 1px; }
.offer-number-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.offer-version-tag { display: inline-block; font-size: 12px; font-weight: 600; color: var(--text-muted); background: var(--bg-alt); border: 1px solid var(--border); border-radius: 99px; padding: 1px 8px; margin-left: 8px; vertical-align: middle; }
.offer-status-control select { padding: 5px 10px; border: 1px solid var(--border); border-radius: 99px; font-size: 12px; font-weight: 500; background: var(--surface); color: var(--text); outline: none; cursor: pointer; }
.offer-status-control select:focus { border-color: var(--accent); }

/* ─── EXCHANGE RATE PANEL ────────────────────────────────────────────────────── */
.rates-panel { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; margin-bottom: 1rem; }
.rates-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.75rem; }
.rate-item label { font-size: 11px; color: var(--text-muted); font-weight: 600; text-transform: uppercase; display: block; margin-bottom: 3px; }
.rate-item input { width: 100%; padding: 0.4rem 0.6rem; border: 1px solid var(--border); border-radius: var(--radius); font-size: 13px; font-family: inherit; background: var(--surface); color: var(--text); outline: none; }
.rate-item input:focus { border-color: var(--accent); }

.gp-good { color: var(--success); }
.gp-medium { color: #d97706; }
.gp-poor { color: var(--danger); }

/* ─── LINE LIST (offer lines, compact + expandable rows) ─────────────────────── */
.lines-section { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); margin-bottom: 1.5rem; box-shadow: var(--shadow); overflow: hidden; }
.lines-section-header { padding: 0.75rem 1rem; background: var(--cat-header-bg); border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.lines-section-title { font-weight: 600; color: var(--cat-header-color); font-size: 14px; }
.lines-cat-markup { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-muted); }
.lines-cat-markup input { width: 70px; padding: 3px 6px; border: 1px solid var(--border); border-radius: 4px; font-size: 13px; text-align: center; }

.line-grid-cols { grid-template-columns: 20px minmax(100px,1fr) 110px 50px 56px 120px 110px 95px 54px 54px 120px 120px 60px 40px 22px 22px 22px; }
.line-head-row { display: grid; gap: 8px; padding: 0 14px 6px; font-size: 10.5px; font-weight: 700; color: var(--text-light); text-transform: uppercase; letter-spacing: 0.05em; }
.line-head-row span:nth-child(5), .line-head-row span:nth-child(6), .line-head-row span:nth-child(7),
.line-head-row span:nth-child(8), .line-head-row span:nth-child(9), .line-head-row span:nth-child(10),
.line-head-row span:nth-child(11), .line-head-row span:nth-child(12) { text-align: right; }
.line-head-row span:nth-child(4), .line-head-row span:nth-child(13), .line-head-row span:nth-child(14) { text-align: center; }

.cat-band { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; background: var(--cat-header-bg); color: var(--cat-header-color); padding: 8px 14px; font-weight: 700; font-size: 12.5px; text-transform: uppercase; letter-spacing: 0.05em; }
.cat-line-count { font-weight: 400; opacity: 0.7; text-transform: none; letter-spacing: 0; margin-left: 6px; font-size: 11px; }
.cat-band-right { display: flex; align-items: center; gap: 14px; text-transform: none; letter-spacing: 0; font-weight: 500; color: var(--text-muted); font-size: 12.5px; }
.cat-band-right input { width: 50px; padding: 3px 6px; border: 1px solid var(--border); border-radius: 5px; font-size: 12px; text-align: center; background: var(--surface); color: var(--text); }
.cat-band-total { font-family: inherit; font-weight: 700; color: var(--text); }

.line-block { border-bottom: 1px solid var(--border-light); }
.line-block.drag-row-over { border-top: 2px solid var(--accent); }
.line-block.dragging { opacity: 0.4; }

.line-row-compact { display: grid; gap: 8px; align-items: center; padding: 7px 14px; }
.line-row-compact:hover { background: var(--bg-alt); }
.line-row-compact.type-cable { background: #f0fdf4; }
.line-type-icon { width: 24px; height: 24px; border-radius: 6px; display: flex; align-items: center; justify-content: center; font-size: 9px; font-weight: 700; color: var(--text-light); border: 1px solid var(--border); }
.lr-name-code { min-width: 0; display: flex; align-items: flex-start; gap: 6px; }
.lr-name-code textarea.lr-name-input { flex: 1; min-width: 0; width: auto; font-weight: 600; font-size: 13px; resize: vertical; min-height: 26px; max-height: 160px; line-height: 1.4; overflow-y: auto; }
.lr-name-code .ro-cell.lr-name-ro { font-weight: 600; font-size: 13px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lr-code-input { font-size: 11px; color: var(--text-muted); }
.lr-code-ro { font-size: 11px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.lr-achiz { display: flex; align-items: center; gap: 3px; }
.lr-achiz input { flex: 1; min-width: 0; }
.lr-achiz select { flex: 0 0 48px; width: 48px; font-size: 10.5px; padding-left: 2px; padding-right: 0; }
.line-row-compact input[type="number"] { text-align: right; }
/* Celulele read-only (span simplu, fara input) trebuie aliniate la fel ca header-ul, indiferent de tipul liniei (produs/manopera/transport) */
.line-row-compact > span:nth-child(4) { text-align: center; }
.line-row-compact > span:nth-child(5),
.line-row-compact > span:nth-child(6),
.line-row-compact > span:nth-child(7),
.line-row-compact > span:nth-child(8),
.line-row-compact > span:nth-child(9),
.line-row-compact > span:nth-child(10) { text-align: right; }
.lr-conv-price, .lr-cost-eur { color: var(--text-muted); }
.lr-hide-check { justify-self: center; width: 15px; height: 15px; cursor: pointer; }
/* Coloana export: 👁 ascunsa + 🎁 gratuita, una langa alta */
.lr-flags { display: flex; align-items: center; justify-content: center; gap: 5px; }
.lr-flags .lr-hide-check { width: 14px; height: 14px; margin: 0; }
.lr-free-check { accent-color: #15803d; }
/* Linie gratuita: discret -- o bara verde la stanga si pretul "GRATUIT" in verde */
.line-row-compact.is-free { box-shadow: inset 3px 0 0 #86efac; }
.lr-val.lr-free-price { color: #15803d; font-weight: 600; font-size: 11.5px; letter-spacing: 0.04em; text-align: center; background: #f0fdf4; border-color: #bbf7d0; }
/* Campul editabil (GRATUIT implicit, ex. CUSTODIE): textul implicit apare ca placeholder verde */
input.lr-val.lr-free-price { cursor: text; }
input.lr-val.lr-free-price::placeholder { color: #15803d; opacity: 0.85; }
@media (prefers-color-scheme: dark) {
  .line-row-compact.is-free { box-shadow: inset 3px 0 0 #166534; }
  .lr-val.lr-free-price { color: #4ade80; background: rgba(34,197,94,0.08); border-color: rgba(34,197,94,0.3); }
  input.lr-val.lr-free-price::placeholder { color: #4ade80; }
}
.lr-val { display: block; text-align: right; font-family: inherit; font-size: 12.5px; white-space: nowrap; padding: 3px 6px; border: 1px solid var(--border); border-radius: 4px; background: var(--bg); box-sizing: border-box; width: 100%; overflow: hidden; text-overflow: ellipsis; }
.lr-val.lr-price { font-weight: 500; color: var(--text); }
.lr-val.lr-value { font-weight: 700; color: var(--text); }
.lr-price-input { background: var(--surface); border-color: var(--accent); cursor: text; }
.lr-price-input:focus { box-shadow: 0 0 0 2px rgba(37,99,235,0.15); }
.lr-gp { display: flex; align-items: center; justify-content: center; padding: 3px 6px; border: 1px solid var(--border); border-radius: 4px; background: var(--bg); box-sizing: border-box; width: 100%; }
.lr-expand-btn { background: none; border: none; cursor: pointer; color: var(--text-light); font-size: 11px; padding: 2px; line-height: 1; }
.lr-expand-btn:hover { color: var(--accent); }
.lr-reprice-slot { display: flex; align-items: center; justify-content: center; }
.lr-reprice { color: var(--accent); font-size: 13px; padding: 1px 3px; line-height: 1; }
.line-row-compact input, .line-row-compact select, .line-row-compact textarea { border: 1px solid var(--border); border-radius: 4px; padding: 3px 5px; font-size: 13px; font-family: inherit; background: var(--surface); color: var(--text); outline: none; width: 100%; box-sizing: border-box; }
.line-row-compact input:hover, .line-row-compact select:hover, .line-row-compact textarea:hover { border-color: var(--accent); }
.line-row-compact input:focus, .line-row-compact select:focus, .line-row-compact textarea:focus { border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 2px rgba(37,99,235,0.1); }
/* Celulele needitabile (span simplu) arata ca un camp dezactivat, la fel ca input-urile editabile din acelasi rand */
.line-row-compact .ro-cell { display: block; padding: 3px 6px; border: 1px solid var(--border); border-radius: 4px; background: var(--bg); color: var(--text-muted); box-sizing: border-box; width: 100%; }

.line-row-detail { padding: 12px 14px 16px 62px; background: var(--bg-alt); border-top: 1px dashed var(--border-light); display: flex; flex-direction: column; gap: 12px; }
.lrd-group-title { font-size: 10px; font-weight: 700; color: var(--text-light); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 6px; padding-bottom: 4px; border-bottom: 1px solid var(--border-light); }
.lrd-group-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px 14px; }
.lrd-field label { display: block; font-size: 10.5px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 3px; }
.lrd-field input, .lrd-field select { width: 100%; padding: 5px 8px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px; font-family: inherit; background: var(--surface); color: var(--text); outline: none; }
.lrd-field input:focus, .lrd-field select:focus { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(37,99,235,0.1); }
.lrd-field-full { grid-column: 1 / -1; }
.lrd-field.mkp-from-cat input { background: #f0f9ff; }
.lrd-field.mkp-from-global input { background: #f9fafb; }
.lrd-hint { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

.line-add-ghost { padding: 8px 14px 12px; display: flex; flex-wrap: wrap; gap: 4px 12px; }
/* Pachete (kit): linia pachetului + panoul cu componente */
.kit-badge { background: #ede9fe; color: #5b21b6; font-size: 10px; flex: 0 0 auto; }
.kit-panel { margin: 0 10px 8px 34px; padding: 8px 10px; border: 1px dashed #c4b5fd; border-radius: var(--radius); background: rgba(139,92,246,0.05); }
.kit-panel-head { display: flex; justify-content: space-between; align-items: center; gap: 8px 16px; flex-wrap: wrap; font-size: 12.5px; margin-bottom: 6px; }
.kit-panel-title { color: var(--text-muted); }
.kit-panel-title strong { color: var(--text); }
.kit-show { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-muted); cursor: pointer; }
.kit-show input { width: auto; }
.kit-comp-row { display: grid; grid-template-columns: 110px minmax(160px, 1fr) 120px 150px 64px 130px 100px 105px 60px; gap: 6px; align-items: center; padding: 3px 0; font-size: 12.5px; }
.kit-comp-row input, .kit-comp-row select { width: 100%; box-sizing: border-box; border: 1px solid var(--border); border-radius: 4px; padding: 3px 5px; font-size: 12.5px; background: var(--surface); color: var(--text); }
.kit-comp-row .kc-qty, .kit-comp-row .lr-achiz { display: flex; gap: 4px; }
.kit-comp-row .kc-qty input[type=number] { min-width: 0; flex: 1; }
.kit-comp-row .kc-unit { width: 46px; flex: 0 0 46px; }
.kit-comp-row .lr-achiz select { width: 58px; flex: 0 0 58px; }
.kit-comp-row .kc-num { text-align: right; font-variant-numeric: tabular-nums; }
.kit-comp-row .kc-act { display: flex; gap: 4px; justify-content: flex-end; }
.kit-comp-head { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; color: var(--text-muted); border-bottom: 1px solid var(--border); }
.kit-comp-head span:nth-child(5), .kit-comp-head span:nth-child(n+7) { text-align: right; }
.kit-empty { font-size: 12px; color: var(--text-muted); padding: 6px 0; }
.kit-actions { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 6px; }
.kp-list { max-height: 50vh; overflow-y: auto; }
.kp-item { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border-light); }
.kp-name { font-weight: 600; font-size: 13.5px; }
.kp-comps { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.kp-act { display: flex; gap: 6px; flex-shrink: 0; }
@media (max-width: 900px) {
  .kit-panel { margin-left: 10px; }
  .kit-comp-head { display: none; }
  .kit-comp-row { grid-template-columns: 1fr 1fr; border-bottom: 1px solid var(--border-light); padding: 6px 0; }
  .kit-comp-row .kc-name { grid-column: 1 / -1; }
}
.cat-empty-drop { margin: 8px 10px 0; padding: 14px; border: 1px dashed var(--border); border-radius: var(--radius); font-size: 12.5px; color: var(--text-muted); text-align: center; }
.line-cat-section.drag-row-over { outline: 2px dashed var(--accent); outline-offset: -2px; }
.line-cat-section.drag-row-over .cat-empty-drop { border-color: var(--accent); color: var(--accent); }
.btn-add-line { color: var(--accent); background: none; border: none; cursor: pointer; font-size: 13px; display: flex; align-items: center; gap: 5px; padding: 4px 6px; border-radius: 4px; }
.btn-add-line:hover { background: var(--cat-header-bg); }

/* ─── LABOR (manopera) BLOCK ──────────────────────────────────────────────────── */
.labor-block { border-bottom: 1px solid var(--border-light); padding-bottom: 4px; }
.labor-formula { display: flex; align-items: flex-end; gap: 8px; flex-wrap: wrap; margin: 10px 14px 12px; }
.labor-field { display: flex; flex-direction: column; gap: 3px; }
.labor-field label { font-size: 10px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; white-space: nowrap; }
.labor-field input, .labor-field select { padding: 5px 8px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 13px; font-family: inherit; background: var(--surface); color: var(--text); outline: none; width: 68px; }
.labor-field select { width: auto; }
.labor-field input:focus, .labor-field select:focus { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(37,99,235,0.1); }
.labor-field input[readonly] { background: var(--bg); color: var(--text-muted); cursor: default; }
.labor-field-ro { display: inline-flex; align-items: center; padding: 5px 8px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 13px; background: var(--bg); color: var(--text-muted); width: 68px; box-sizing: border-box; }
.labor-op { color: var(--text-light); font-size: 14px; padding-bottom: 7px; }
.labor-total-field label { font-size: 10px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; white-space: nowrap; }
.labor-total-value { display: block; padding: 5px 0; font-size: 13.5px; font-weight: 700; color: var(--text); white-space: nowrap; }
.labor-hint { padding: 0 14px 10px 14px; font-size: 11.5px; color: var(--text-muted); margin-top: -4px; }
.reco-banner { display: flex; align-items: flex-start; gap: 10px; background: var(--surface); border: 1px solid #bbf7d0; border-radius: 8px; padding: 10px 14px; margin: 0 14px 10px; flex-wrap: wrap; }
.reco-banner.reco-warn { border-color: #fde68a; }
.reco-banner.reco-over { border-color: #fca5a5; }
.reco-icon { width: 10px; height: 10px; border-radius: 50%; background: #16a34a; flex-shrink: 0; margin-top: 6px; }
.reco-icon.reco-warn { background: #d97706; }
.reco-icon.reco-over { background: #dc2626; }
.reco-text { flex: 1; min-width: 220px; font-size: 12.5px; color: var(--text-muted); line-height: 1.5; }
.reco-actions { display: flex; gap: 6px; }

/* ─── FINANCIAL SUMMARY ──────────────────────────────────────────────────────── */
.financial-summary { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1.5rem; margin-bottom: 1.5rem; box-shadow: var(--shadow); }
.financial-summary h3 { font-size: 16px; font-weight: 600; margin-bottom: 1rem; }
/* .fin-grid is defined in LINE EDITOR EXTRAS section below */
.fin-table { width: 100%; border-collapse: collapse; }
.fin-table td { padding: 5px 8px; border-bottom: 1px solid #f3f4f6; font-size: 13px; }
.fin-table td:first-child { color: var(--text-muted); }
.fin-table td:last-child { text-align: right; font-family: inherit; font-weight: 500; }
.fin-table tr.fin-total td { font-weight: 700; font-size: 14px; border-top: 2px solid var(--border); border-bottom: 2px solid var(--border); }
.fin-table tr.fin-highlight td { background: #f0fdf4; color: var(--success); font-weight: 600; }
.fin-table tr.fin-highlight-danger td { background: #fef2f2; color: var(--danger); font-weight: 600; }
.fin-editable-pct { display: flex; align-items: center; gap: 4px; }
.fin-editable-pct input { width: 55px; padding: 2px 4px; border: 1px solid var(--border); border-radius: 4px; font-size: 12px; text-align: center; }

.fin-input { padding: 4px 7px; border: 1px solid var(--border); border-radius: 4px; font-size: 13px; font-family: inherit; background: var(--surface); color: var(--text); outline: none; }
.fin-input:focus { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(37,99,235,0.1); }
.fin-input:disabled { background: var(--bg); color: var(--text-muted); }

/* ─── COMMERCIAL TERMS ───────────────────────────────────────────────────────── */
.terms-section { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1.5rem; margin-bottom: 1.5rem; box-shadow: var(--shadow); }
.terms-section h3 { font-size: 16px; font-weight: 600; margin-bottom: 1rem; }
.terms-list { display: flex; flex-direction: column; gap: 6px; }
.term-item { display: flex; align-items: flex-start; gap: 8px; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); }
.term-num { font-weight: 600; color: var(--text-muted); font-size: 13px; min-width: 20px; }
.term-text { flex: 1; font-size: 13px; cursor: text; border: 1px solid transparent; border-radius: 4px; padding: 2px 4px; outline: none; }
.term-text:focus { border-color: var(--accent); background: var(--surface); }
.terms-actions { display: flex; gap: 8px; margin-top: 0.75rem; }
.terms-lang-tabs { display: flex; gap: 4px; margin-bottom: 0.75rem; }
.terms-lang-btn { padding: 4px 12px; border: 1px solid var(--border); border-radius: 99px; font-size: 12px; cursor: pointer; background: transparent; color: var(--text-muted); }
.terms-lang-btn.active { background: var(--accent); color: white; border-color: var(--accent); }

/* ─── PRODUCT MODAL ──────────────────────────────────────────────────────────── */
.product-search-input { width: 100%; padding: 0.65rem 1rem; border: 1px solid var(--border); border-radius: var(--radius); font-size: 15px; margin-bottom: 1rem; outline: none; }
.product-search-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }
.product-results { display: flex; flex-direction: column; gap: 4px; max-height: 400px; overflow-y: auto; }
.product-result-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer; transition: all 0.12s; }
.product-result-item:hover, .product-result-item.selected { background: #eff6ff; border-color: var(--accent); }
.product-result-img { width: 40px; height: 40px; object-fit: contain; border-radius: 4px; flex-shrink: 0; }
.product-result-info { flex: 1; min-width: 0; }
.product-result-code { font-size: 11px; color: var(--text-muted); font-weight: 600; }
.product-result-name { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.product-result-supplier { font-size: 12px; color: var(--text-muted); }
.product-result-stock { flex-shrink: 0; text-align: right; font-size: 12px; }
.stock-ok    { color: var(--success); font-weight: 600; }
.stock-low   { color: #d97706; font-weight: 600; }
.stock-empty { color: var(--danger); }

/* ─── TOAST NOTIFICATIONS ────────────────────────────────────────────────────── */
.terms-preview { margin: 0; padding-left: 18px; font-size: 13px; line-height: 1.6; color: var(--text); }
/* Conditii cu bife: fara buline, conditia debifata ramane vizibila dar taiata si estompata */
.terms-checklist { list-style: none; padding-left: 0; }
.terms-checklist li label { display: flex; align-items: flex-start; gap: 8px; cursor: pointer; padding: 2px 0; font-weight: 400; margin: 0; }
.terms-checklist li input { width: auto; margin-top: 4px; flex-shrink: 0; cursor: pointer; }
.terms-checklist li input:disabled { cursor: default; }
.terms-checklist li.is-excluded span { color: var(--text-muted); text-decoration: line-through; opacity: 0.7; }
.bnr-today-note { margin-top: 8px; padding: 8px 12px; border: 1px solid #93c5fd; border-left-width: 4px; border-radius: var(--radius); background: rgba(59,130,246,0.08); font-size: 12.5px; display: flex; align-items: center; justify-content: space-between; gap: 8px 12px; flex-wrap: wrap; }
.badge-pm-select { background: #e0f2fe; color: #075985; font-size: 10px; }
.offer-locked-banner { margin: 0 0 1rem; padding: 10px 14px; border: 1px solid #f59e0b; border-left-width: 4px; border-radius: var(--radius); background: rgba(245,158,11,0.12); color: var(--text); font-size: 13px; line-height: 1.5; }
/* Vechimea listelor de preturi (Setari › Furnizori + cautarea de produse) */
.list-age-ok { background: rgba(22,163,74,0.14); color: #15803d; }
.list-age-soon { background: rgba(245,158,11,0.16); color: #b45309; }
.list-age-old { background: rgba(220,38,38,0.14); color: #b91c1c; }
.list-age-banner { margin-bottom: 1rem; padding: 10px 14px; border: 1px solid #f59e0b; border-left-width: 4px; border-radius: var(--radius); background: rgba(245,158,11,0.10); font-size: 13px; line-height: 1.6; }
.row-list-old td { background: rgba(220,38,38,0.05); }
.pf-age-old { color: #dc2626; font-weight: 600; }
.pf-age-soon { color: #d97706; }
@media (prefers-color-scheme: dark) { .list-age-ok { color: #4ade80; } .list-age-soon { color: #fbbf24; } .list-age-old { color: #f87171; } .pf-age-old { color: #f87171; } .pf-age-soon { color: #fbbf24; } }
/* Conditii de garantie: companie (Setari) + bifa pe oferta, langa Export PDF */
.warranty-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.warranty-lang { min-width: 130px; font-weight: 600; }
.warranty-toggle { display: inline-flex; align-items: center; gap: 5px; padding: 3px 8px; border: 1px dashed var(--border); border-radius: var(--radius); font-size: 12px; cursor: pointer; white-space: nowrap; }
.warranty-toggle.on { border-style: solid; border-color: var(--primary); background: rgba(99,102,241,0.10); }
.warranty-toggle.disabled { opacity: .55; cursor: not-allowed; }
/* Oferta atipica + documente atasate */
.offer-atypical-banner { margin: 0 0 1rem; padding: 10px 14px; border: 1px solid #6366f1; border-left-width: 4px; border-radius: var(--radius); background: rgba(99,102,241,0.10); color: var(--text); font-size: 13px; line-height: 1.5; }
.link-like { color: var(--primary); text-decoration: underline; cursor: pointer; }
.atypical-check { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; margin: 0.25rem 0 0.75rem; cursor: pointer; line-height: 1.4; }
.atypical-check input { margin-top: 2px; }
.badge-atypical { background: rgba(99,102,241,0.15); color: #4f46e5; }
.badge-deviz { background: rgba(13,148,136,0.15); color: #0f766e; }
.files-count { display: inline-block; min-width: 18px; padding: 0 6px; border-radius: 9px; background: var(--border); font-size: 11px; text-align: center; margin-left: 4px; }
.files-warn { margin-bottom: 0.75rem; padding: 8px 12px; border-radius: var(--radius); background: rgba(245,158,11,0.12); border: 1px solid #f59e0b; font-size: 13px; }
.files-empty { font-size: 13px; color: var(--text-muted); margin-bottom: 0.75rem; }
.files-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 0.75rem; }
.file-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); }
.file-icon { font-size: 20px; flex-shrink: 0; }
.annex-no { min-width: 22px; height: 22px; border-radius: 50%; background: var(--border); font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.file-main { flex: 1; min-width: 0; }
.file-name { font-weight: 600; text-align: left; word-break: break-word; }
.file-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.file-meta select { max-width: 100%; font-size: 12px; padding: 1px 4px; border: 1px solid var(--border); border-radius: 4px; background: var(--surface); color: var(--text); }
.file-note { font-style: italic; }
.file-actions { display: flex; gap: 4px; flex-shrink: 0; }
.files-upload { border: 1px dashed var(--border); border-radius: var(--radius); padding: 10px; transition: background .15s, border-color .15s; }
.files-upload.dragover { border-color: var(--primary); background: rgba(99,102,241,0.08); }
.files-upload.uploading { opacity: .6; pointer-events: none; }
.files-upload-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.files-upload-row select, .files-upload-row input[type=text] { padding: 5px 8px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 13px; background: var(--surface); color: var(--text); }
.files-upload-row input[type=text] { flex: 1; min-width: 160px; }
.files-pick { cursor: pointer; margin: 0; }
.files-hint { font-size: 12px; color: var(--text-muted); margin-top: 6px; }
@media (max-width: 640px) { .file-row { flex-wrap: wrap; } .file-actions { width: 100%; justify-content: flex-end; } }
/* Dropdown cu cautare (select.searchable-select, vezi utils.js) */
.ss-popup { position: fixed; z-index: 1100; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(0,0,0,0.25); display: flex; flex-direction: column; max-height: 300px; }
.ss-search { margin: 6px; padding: 6px 8px; border: 1px solid var(--border); border-radius: 4px; font-size: 13px; background: var(--bg); color: var(--text); outline: none; }
.ss-search:focus { border-color: var(--accent); }
.ss-list { overflow-y: auto; padding: 0 0 6px; }
.ss-opt { padding: 5px 10px; font-size: 13px; cursor: pointer; color: var(--text); }
.ss-opt.active { background: rgba(37,99,235,0.14); }
.ss-opt.selected { font-weight: 600; }
.ss-empty { padding: 8px 10px; font-size: 12px; color: var(--text-muted); }
select.searchable-select { cursor: pointer; }
.ac-popup .ss-list { padding: 4px 0; }
.ac-name { font-weight: 600; font-size: 13px; }
.ac-meta { font-size: 11.5px; color: var(--text-muted); margin-top: 1px; }
.ac-tag { display: inline-block; font-size: 10.5px; font-weight: 600; padding: 0 5px; border-radius: 3px; margin-left: 6px; vertical-align: 1px; }
.ac-tag.erp { color: #166534; background: #dcfce7; }
.ac-tag.manual { color: #92400e; background: #fef3c7; }
.ac-tag.registru { color: #1e40af; background: #dbeafe; }
/* Titlul grupului „Din registrele oficiale” (in primul rezultat al grupului) */
.ac-group { margin: -5px -10px 5px; padding: 6px 10px 4px; border-top: 1px solid var(--border); background: var(--bg, transparent);
  font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); cursor: default; }
.ss-opt.active .ac-group { background: var(--surface, #fff); }
.field-source { font-size: 11.5px; color: var(--text-muted); margin-top: 3px; min-height: 15px; }
.field-source .btn-link { font-size: 11.5px; }
.client-unconfirmed { color: #b45309; font-weight: 600; }
.ac-add { font-size: 13px; color: var(--accent); }
.ac-popup .ss-opt:last-child:has(.ac-add) { border-top: 1px dashed var(--border); margin-top: 2px; }
.client-section-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.client-erp-actions { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; text-transform: none; letter-spacing: 0; }
.client-erp-status { font-size: 11.5px; font-weight: 400; color: var(--text-muted); }
.update-banner { position: fixed; top: 0; left: 0; right: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; padding: 8px 16px; background: #1e3a8a; color: #fff; font-size: 13px; box-shadow: 0 2px 10px rgba(0,0,0,0.25); }
.toast-container { position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 999; display: flex; flex-direction: column; gap: 8px; }
.toast { background: #1e293b; color: #f1f5f9; padding: 0.75rem 1.25rem; border-radius: var(--radius); font-size: 13px; box-shadow: 0 4px 20px rgba(0,0,0,0.25); display: flex; align-items: center; gap: 8px; min-width: 240px; max-width: 380px; animation: slideIn 0.25s ease; }
.toast.success { background: #14532d; }
.toast.error   { background: #7f1d1d; }
.toast.warning { background: #78350f; }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ─── LOADING ────────────────────────────────────────────────────────────────── */
.loading-overlay { position: fixed; inset: 0; background: rgba(255,255,255,0.7); z-index: 500; display: flex; align-items: center; justify-content: center; }
.spinner { width: 40px; height: 40px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── CONFIRM DIALOG ─────────────────────────────────────────────────────────── */
.confirm-text { font-size: 15px; color: var(--text); margin-bottom: 1.5rem; }

/* ─── MOBILE TOPBAR ──────────────────────────────────────────────────────────── */
.mobile-topbar { display: none; position: fixed; top: 0; left: 0; right: 0; height: 56px; background: var(--sidebar-bg); z-index: 50; align-items: center; padding: 0 1rem; gap: 12px; box-shadow: 0 2px 8px rgba(0,0,0,0.1); border-bottom: 1px solid var(--border); }
.mobile-menu-btn { background: transparent; border: none; color: #64748b; padding: 8px; cursor: pointer; border-radius: var(--radius); display: flex; align-items: center; justify-content: center; }
.mobile-topbar-title { color: #1e293b; font-weight: 600; font-size: 16px; flex: 1; }
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 390; }
.sidebar-overlay.open { display: block; }

/* ─── RESPONSIVE ─────────────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .mobile-topbar { display: flex; }
  .sidebar { transform: translateX(-100%); transition: transform 0.25s ease; z-index: 400; }
  .sidebar.open { transform: translateX(0); }
  .content { margin-left: 0; padding: 1rem; padding-top: calc(56px + 1rem); }
  .table-wrapper { overflow-x: auto; }
  .data-table { min-width: 800px; }
  .row-actions { opacity: 1; }
  .form-row { grid-template-columns: 1fr; }
  .form-row-3 { grid-template-columns: 1fr 1fr; }
  .form-row-4 { grid-template-columns: 1fr 1fr; }
  .modal-overlay { align-items: flex-end; padding: 0; }
  .modal { max-height: 92vh; border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
  .modal-lg, .modal-sm, .modal-xl { max-width: 100%; }
  .modal-body { padding: 1rem; }
  .modal-header { padding: 1rem; }
  .modal-footer { padding: 0.75rem 1rem; flex-wrap: wrap; }
  .fin-grid { grid-template-columns: 1fr; }
  .rates-grid { grid-template-columns: 1fr 1fr; }
}

/* ─── TELEFON: tabelele devin carduri (portat din Stocuri) ───────────────────── */
@media (max-width: 900px) {
  .filters input, .filters select { flex: 1 1 100%; width: 100%; font-size: 16px; } /* 16px: iOS nu mai face zoom la focus */
  .filters label { flex: 0 0 auto; margin-right: 1rem; font-size: 14px !important; padding: 4px 0; }
  .filters input[type="checkbox"] { flex: none; width: auto; }

  #stock-table, #history-table, #sync-table, #audit-table { min-width: 0; }
  #stock-table thead, #history-table thead, #sync-table thead, #audit-table thead { display: none; }
  #stock-table tbody tr[data-cod-mat], #history-table tbody tr, #sync-table tbody tr, #audit-table tbody tr {
    display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px;
    padding: 0.75rem 1rem; border-bottom: 1px solid var(--border);
  }
  #stock-table tbody tr:last-child, #history-table tbody tr:last-child,
  #sync-table tbody tr:last-child, #audit-table tbody tr:last-child { border-bottom: none; }
  #stock-table td, #history-table td, #sync-table td, #audit-table td { display: block; padding: 0; border: none; }
  #stock-table td.empty-state, #history-table td.empty-state,
  #sync-table td.empty-state, #audit-table td.empty-state { flex: 1 1 100%; }

  /* ordinea vizuala pe card: cod + cantitate sus, apoi restul in ordinea din tabel */
  #stock-table td { order: 3; }
  #history-table td { order: 3; }
  .c-cod, .h-data { order: 1 !important; }
  .c-cant, .h-cant { order: 2 !important; }
  .c-cod { flex: 1 1 auto; font-weight: 600; }
  .c-cant { flex: 0 0 auto; font-size: 16px; font-weight: 600; }
  .c-cant::after { content: ' buc'; font-size: 12px; font-weight: 400; color: var(--text-muted); }
  .c-den { flex: 1 1 100%; }
  .c-codgest, .c-gest, .c-comp { font-size: 12px; color: var(--text-muted); }
  .c-codgest:empty, .c-gest:empty { display: none !important; }
  .c-codgest::after, .c-gest::after { content: ' ·'; }
  .c-comp { flex: 1 1 auto; }
  .c-pret, .h-pret, .h-doc { flex: 1 1 100%; text-align: left; white-space: normal; font-size: 13px; }
  .c-pret::before, .h-pret::before, .h-doc::before, .h-cant::before {
    content: attr(data-label) ': '; font-family: inherit; font-size: 12px; color: var(--text-muted);
  }
  .c-pret .sub-text { display: inline; margin-left: 4px; }

  .h-data { flex: 1 1 auto; font-weight: 600; }
  .h-cant { flex: 0 0 auto; }
  .h-furn { flex: 1 1 100%; }

  /* Admin: audit, istoric sincronizari -- tot carduri */
  .a-date { flex: 1 1 auto; font-size: 12px; color: var(--text-muted); }
  .a-app { flex: 0 0 auto; order: 1; }
  .a-user { flex: 0 0 auto; font-size: 12px; font-weight: 600; }
  .a-action { flex: 1 1 100%; }
  .a-details { flex: 1 1 100%; word-break: break-word; }

  .s-start { order: 1; flex: 1 1 auto; font-weight: 600; }
  .s-status { order: 2; }
  .s-type { order: 3; flex: 1 1 100%; font-size: 12px; color: var(--text-muted); }
  .s-end { order: 4; flex: 1 1 100%; font-size: 12px; color: var(--text-muted); }
  .s-num { order: 5; font-family: inherit !important; font-size: 12px; color: var(--text-muted); text-align: left; }
  .s-end::before, .s-num::before { content: attr(data-label) ': '; }

  .settings-content { padding: 1rem; }
  .admin-tabs { padding-left: 0.5rem; }
}

/* ─── DARK MODE ──────────────────────────────────────────────────────────────── */
@media (prefers-color-scheme: dark) {
  html { color-scheme: dark; }
  :root {
    --bg: #0f172a;
    --surface: #1e293b;
    --border: #334155;
    --text: #e2e8f0;
    --text-muted: #94a3b8;
    --text-light: #475569;
    --sidebar-bg: #0b1120;
    --sidebar-text: #64748b;
    --sidebar-active: #f1f5f9;
    --sidebar-active-bg: #1d4ed8;
    --shadow: 0 1px 3px rgba(0,0,0,0.5);
    --cat-header-bg: #1e3a5f;
    --cat-header-color: #93c5fd;
    --bg-alt: #1a2840;
    --border-light: #2d3f58;
  }
  select { color-scheme: dark; background: var(--surface); color: var(--text); border-color: var(--border); }
  option { background: #1e293b; color: #e2e8f0; }
  .data-table th { background: #111e2e; }
  .data-table tbody tr:hover { background: #172133; }
  .data-table td { border-bottom-color: #1e2d42; }
  .badge-draft { background: #1e3a5f; color: #93c5fd; }
  .badge-acceptata { background: #14532d; color: #86efac; }
  .badge-respinsa { background: #450a0a; color: #fca5a5; }
  .badge-expirata { background: #1e293b; color: #94a3b8; }
  .badge-inlocuita { background: #1e293b; color: #64748b; }
  .badge-ordered { background: #78350f; color: #fde68a; }
  .badge-admin { background: #14532d; color: #86efac; }
  .badge-pm { background: #1e3a5f; color: #93c5fd; }
  .alert-danger { background: #450a0a; border-color: #991b1b; color: #fca5a5; }
  .alert-success { background: #052e16; border-color: #166534; color: #86efac; }
  .alert-info { background: #1e3a5f; border-color: #2563eb; color: #93c5fd; }
  .modal-overlay { background: rgba(0,0,0,0.7); }
  .sidebar-overlay { background: rgba(0,0,0,0.75); }
  .sidebar { border-right-color: transparent; }
  .sidebar-logo { border-bottom-color: #1e293b; color: #f1f5f9; }
  .nav-item:hover { background: #334155; color: #cbd5e1; }
  .sidebar-footer { border-top-color: #1e293b; }
  .user-name { color: #e2e8f0; }
  .line-row-compact.type-cable { background: #052e16; }
  .reco-banner { border-color: #166534; }
  .reco-icon { background: #22c55e; }
  .product-result-item:hover, .product-result-item.selected { background: #1e3a5f; border-color: var(--accent); }
  .tag { background: #1e3a5f; border-color: #2563eb; color: #93c5fd; }
  .settings-item.drag-over { background: #1e3a5f !important; border-color: var(--accent) !important; }
  .btn-ghost { color: var(--text-muted); border-color: var(--border); }
  .btn-ghost:hover { background: var(--border); color: var(--text); }
  .btn-icon:hover { background: rgba(255,255,255,0.08); }
  .form-group input:focus, .form-group select:focus, .form-group textarea:focus { box-shadow: 0 0 0 3px rgba(37,99,235,0.3); }
  .offer-header-card { border-color: var(--border); }
  .rates-panel { background: var(--bg); }
  .financial-summary { border-color: var(--border); }
  .terms-section { border-color: var(--border); }
  .fin-table tr.fin-highlight td { background: #052e16; color: #86efac; }
  .fin-table tr.fin-highlight-danger td { background: #450a0a; color: #fca5a5; }
  .admin-tabs { background: var(--surface); }
  .admin-tab-btn.active { background: var(--bg); color: var(--text); border-bottom-color: var(--bg); }
  .markup-bar { background: var(--bg); border-color: var(--border); }
  .fin-section { background: var(--surface); border-color: var(--border); }
  .lrd-field.mkp-from-cat input { background: #1e3a5f; }
  .lrd-field.mkp-from-global input { background: #1e2d3a; }
  .btn-icon-sm.btn-danger:hover { background: #450a0a; border-color: #991b1b; color: #fca5a5; }
}

/* ─── LINE EDITOR EXTRAS ─────────────────────────────────────────────────────── */
.calc-val { text-align: right; font-family: inherit; font-size: 12px; font-weight: 500; padding-right: 6px; white-space: nowrap; }

.drag-handle { cursor: grab; color: var(--text-muted); font-size: 13px; user-select: none; padding: 0 4px; }
.drag-handle:active { cursor: grabbing; }

.btn-icon-sm { background: none; border: 1px solid transparent; border-radius: 4px; cursor: pointer; padding: 2px 5px; font-size: 13px; color: var(--text-muted); line-height: 1; transition: all 0.1s; }
.btn-icon-sm:hover { border-color: var(--border); background: var(--bg-alt); }
.btn-icon-sm.btn-danger:hover { border-color: #fca5a5; background: #fef2f2; color: #dc2626; }

.ro-cell { font-size: 13px; color: var(--text); }

/* ─── MARKUP BAR ─────────────────────────────────────────────────────────────── */
.markup-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 8px 12px; background: var(--bg-alt, #f8faff); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 0.75rem; }
.markup-bar-item { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.markup-bar-item label { color: var(--text-muted); font-size: 12px; white-space: nowrap; }
.markup-bar-item input { padding: 3px 6px; border: 1px solid var(--border); border-radius: 4px; font-size: 13px; background: var(--surface); color: var(--text); }

/* ─── FINANCIAL SUMMARY EXTRAS ───────────────────────────────────────────────── */
.fin-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; }
.fin-section { background: var(--bg-alt, #f8faff); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; }
.fin-section-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); margin-bottom: 0.75rem; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.fin-row { display: flex; justify-content: space-between; align-items: center; padding: 4px 0; font-size: 13px; }
.fin-row label { color: var(--text-muted); flex: 1; }
.fin-value { font-family: inherit; font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.fin-value-lg { font-family: inherit; font-size: 14px; font-weight: 600; white-space: nowrap; }
.fin-total-row { border-top: 1px solid var(--border); margin-top: 4px; padding-top: 6px; }
/* Primul rand de total direct sub titlul sectiunii (ex. Gross Profit sub Profitabilitate): titlul are deja linia lui */
.fin-section-title + .fin-total-row { border-top: none; margin-top: 0; padding-top: 4px; }
.fin-badge { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 11px; font-weight: 600; }

/* ─── CALCUL RAPID ───────────────────────────────────────────────────────────── */
.qc-head { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 2fr) minmax(0, 0.6fr) minmax(0, 0.8fr) minmax(0, 0.8fr) minmax(0, 0.8fr); gap: 12px; align-items: start; }
.qc-head .form-group { margin-bottom: 0; }
#qc-summary .fin-grid { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 1100px) { .qc-head { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } #qc-summary .fin-grid { grid-template-columns: 1fr; } }
/* ─── ADMIN TABS ─────────────────────────────────────────────────────────────── */
.admin-tabs { display: flex; flex-wrap: wrap; gap: 0; border-bottom: 1px solid var(--border); background: var(--bg-alt, #f8faff); padding-top: 8px; padding-left: 1rem; }
.admin-tab-btn { background: none; border: 1px solid transparent; border-bottom: none; padding: 6px 14px; font-size: 13px; cursor: pointer; color: var(--text-muted); border-radius: var(--radius) var(--radius) 0 0; margin-right: 2px; margin-bottom: -1px; transition: all 0.12s; }
.admin-tab-btn:hover { background: var(--surface); color: var(--text); }
.admin-tab-btn.active { background: var(--surface); color: var(--text); font-weight: 600; border-color: var(--border); border-bottom-color: var(--surface); }

/* ─── GESTIUNI BIFABILE (Stoc la liber / Gestiuni excluse) — portate din Stocuri ── */
.liber-filter { width: 100%; padding: 0.45rem 0.75rem; border: 1px solid var(--border); border-radius: var(--radius); font-size: 13px; background: var(--surface); color: var(--text); margin-bottom: 0.5rem; outline: none; }
.liber-filter:focus { border-color: var(--accent); }
.liber-list { max-height: 280px; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius); padding: 0.25rem 0; }
.liber-item { display: flex; align-items: center; gap: 8px; padding: 0.4rem 0.75rem; font-size: 13px; cursor: pointer; }
.liber-item:hover { background: var(--bg); }
.liber-item input { width: auto; flex-shrink: 0; }
.gestgrp-row { display: flex; gap: 8px; align-items: center; margin-bottom: 0.5rem; }
.gestgrp-row input { padding: 0.45rem 0.75rem; border: 1px solid var(--border); border-radius: var(--radius); font-size: 13px; background: var(--surface); color: var(--text); outline: none; }
.gestgrp-row input:focus { border-color: var(--accent); }
.gestgrp-name { flex: 0 0 34%; min-width: 0; }
.gestgrp-patterns { flex: 1 1 auto; min-width: 0; }
.gestgrp-count { flex: 0 0 auto; white-space: nowrap; }

/* ─── COMPANY CARD ───────────────────────────────────────────────────────────── */
.company-card { transition: box-shadow 0.12s; }
.company-card:hover { box-shadow: var(--shadow); }

@media (max-width: 1024px) {
  .fin-grid { grid-template-columns: 1fr; }
  .markup-bar { gap: 8px; }
}


/* ─── STOCURI: diferente fata de stilul ofertare, ca pagina sa arate identic cu
   aplicatia Stocuri (style.css de acolo). Restrânse la pagina/modalul de stoc ca
   sa nu schimbe paginile de oferte. ───────────────────────────────────────────── */
/* in Stocuri .content avea min-width:0 -- tabelul lat derula in interiorul
   chenarului, nu impingea antetul (butonul de reimprospatare) in afara ecranului */
.content:has(> #page-stock:not(.hidden)) { min-width: 0; }
#stock-search { width: 240px; }
#stock-table .num-cell, #history-table .num-cell, #rulaj-table .num-cell, #locatii-table .num-cell { white-space: nowrap; }
#stock-table .num-cell .sub-text { white-space: normal; min-width: 160px; }
#stock-pagination { justify-content: flex-end; gap: 10px; padding: 0.75rem 1rem; margin-top: 0; }
#history-modal .modal-section-title { font-size: 13px; letter-spacing: 0.04em; margin: 0 0 0.5rem; }
.rulaj-wrapper { margin-bottom: 1.5rem; }
.rulaj-table tbody tr:hover { background: transparent; cursor: default; }

@media (max-width: 768px) {
  .data-table.rulaj-table { min-width: 0; }
}

@media (max-width: 900px) {
  #page-stock .page-header > div:last-child { width: 100%; justify-content: space-between; }
  #stock-search { width: 100%; }
  .rulaj-table th, .rulaj-table td { padding: 0.6rem 0.6rem; }
  .rulaj-table th { font-size: 11px; letter-spacing: 0; }
  #history-modal.modal-overlay { padding: 0; }
  #history-modal .modal-lg { max-height: 100dvh; height: 100dvh; border-radius: 0; }
  #history-modal .modal-header h3 { font-size: 15px; padding-right: 8px; }
  #history-modal .modal-footer { display: none; } /* pe ecran mic inchidem din X, castigam spatiu */
  .toast-container { left: 1rem; right: 1rem; bottom: 1rem; }
  .toast { min-width: 0; max-width: none; }
}

@media (prefers-color-scheme: dark) {
  .rulaj-table tbody tr:hover { background: transparent; }
}

/* ─── OFERTE / ACHIZITII / SETARI: acelasi comportament ca Stocuri ─────────────
   Pe calculator tabele normale; sub 900px fiecare rand devine card (ca in Stocuri).
   Clasele de pe <td> (o-*, p-*, tc-*) stabilesc ordinea si marimea pe card. */
.content:has(> #page-dashboard:not(.hidden)),
.content:has(> #page-procurement:not(.hidden)),
.content:has(> #page-admin:not(.hidden)) { min-width: 0; }

.cell-muted { color: var(--text-muted); }
.cell-ellipsis { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.text-success { color: #166534; }
.text-danger { color: #991b1b; }
.gp-none { color: var(--text-muted); }
.company-dot-label { display: inline-flex; align-items: center; gap: 5px; }
.company-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.page-header-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.filter-check { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-muted); cursor: pointer; }
.filter-check input { width: auto; }
.filter-note { font-size: 13px; color: var(--text-muted); }

#offers-table .o-by, #offers-table .o-pm, #offers-table .o-gp, #offers-table .o-rent, #proc-table .p-by, #proc-table .p-pm { font-size: 12px; }
#offers-table .o-pm, #proc-table .p-pm { max-width: 100px; }
#offers-table .o-val { font-size: 12px; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* Lista de oferte pe laptopuri (1920x1080 la 125% = 1536px): cele 15 coloane incap fara derulare
   laterala -- spatiere mai mica, badge-uri mai mici, coloanele text taiate cu "..." (textul
   intreg ramane in tooltip) */
@media (min-width: 901px) and (max-width: 1680px) {
  #offers-table th, #offers-table td { padding: 0.55rem 0.5rem; }
  #offers-table th { font-size: 11px; letter-spacing: 0.02em; }
  #offers-table td { font-size: 13px; }
  #offers-table .o-loc { max-width: 100px; }
  #offers-table .o-by, #offers-table .o-pm { max-width: 85px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  #offers-table .o-sys, #offers-table .o-type { max-width: 78px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  #offers-table .o-sys, #offers-table .o-type, #offers-table .o-date { font-size: 12px; }
  #offers-table .o-status .badge, #offers-table .o-ord .badge { font-size: 11px; padding: 2px 7px; }
  #offers-table .row-actions { gap: 2px; }
  #offers-table .o-act .btn-sm { padding: 4px 6px; }
  #offers-table td.o-act { padding-left: 0.25rem; padding-right: 0.25rem; }
}

#proc-search { flex: 1; min-width: 180px; }
.col-check { width: 40px; text-align: center; }
#proc-table tr.row-selected, #proc-table tr.row-selected:hover { background: rgba(37,99,235,0.14); }

.admin-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.admin-table th { text-align: left; padding: 8px; border-bottom: 2px solid var(--border); font-weight: 600; }
.admin-table td { padding: 8px; border-bottom: 1px solid var(--border-light); }
.admin-table th.num-cell { text-align: right; }
.admin-table .col-actions { width: 120px; }
.admin-table .col-actions-wide { width: 230px; }
.admin-table td.tc-actions { display: flex; gap: 4px; flex-wrap: wrap; }
#products-table .tc-title { font-size: 12px; }

.pc-grid { grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr)); }

@media (max-width: 900px) {
  .page-header-actions { width: 100%; }
  .page-header-actions .btn-primary { margin-left: auto; }
  #proc-search { flex: 1 1 100%; }

  /* bara cu 14 tab-uri din Setari: deruleaza orizontal in loc sa ocupe jumatate de ecran */
  .admin-tabs { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .admin-tab-btn { white-space: nowrap; flex-shrink: 0; }

  /* tabele -> carduri */
  #offers-table, #proc-table, .table-cards { min-width: 0; }
  #offers-table thead, #proc-table thead, .table-cards thead { display: none; }
  #offers-table tbody tr[data-id], #proc-table tbody tr[data-proc-id], .table-cards tbody tr {
    display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px;
    padding: 0.75rem 1rem; border-bottom: 1px solid var(--border);
  }
  #offers-table tbody tr:last-child, #proc-table tbody tr:last-child, .table-cards tbody tr:last-child { border-bottom: none; }
  #offers-table td, #proc-table td, .table-cards td { display: block; padding: 0; border: none; }
  #offers-table td.empty-state, #proc-table td.empty-state, .table-cards td.empty-state { flex: 1 1 100%; padding: 2rem 0 !important; }
  td[data-label]::before { content: attr(data-label) ': '; font-size: 12px; color: var(--text-muted); font-weight: 400; }

  /* Oferte: nr + status sus, client, apoi detalii mici, la final GP / comandat / actiuni */
  #offers-table td { order: 6; font-size: 12px; color: var(--text-muted); }
  #offers-table .o-num { order: 1; flex: 1 1 auto; font-size: 15px; color: var(--text); }
  #offers-table .o-status { order: 2; }
  #offers-table .o-client { order: 3; flex: 1 1 100%; font-size: 14px; color: var(--text); }
  #offers-table .o-comp { order: 4; }
  #offers-table .o-loc { order: 4; max-width: none; white-space: normal; }
  #offers-table .o-date { order: 4; }
  /* separatori intre detalii; celulele goale (is-empty) nu apar pe card */
  #offers-table td.is-empty { display: none; }
  #offers-table .o-comp::before, #offers-table .o-loc::before { content: '· '; }
  #offers-table .o-sys, #offers-table .o-type { order: 5; }
  #offers-table .o-sys::before, #offers-table .o-type::before { content: '· '; }
  #offers-table .o-by, #offers-table .o-pm { order: 6; flex: 1 1 100%; max-width: none; white-space: normal; }
  #offers-table .o-val, #offers-table .o-gp, #offers-table .o-rent { order: 7; text-align: left; font-weight: 600; font-size: 13px; }
  #offers-table .o-gp.gp-none, #offers-table .o-rent.gp-none { font-weight: 400; }
  #offers-table .o-ord { order: 8; }
  #offers-table .o-act { order: 9; margin-left: auto; }
  #offers-table .row-actions { opacity: 1; }

  /* Achizitii: bifa + nr + status, client, detalii */
  #proc-table td { order: 5; font-size: 12px; color: var(--text-muted); }
  #proc-table .p-check { order: 1; width: auto; }
  #proc-table .p-check input { width: 18px; height: 18px; }
  #proc-table .p-num { order: 2; flex: 1 1 auto; font-size: 15px; color: var(--text); }
  #proc-table .p-status { order: 3; }
  #proc-table .p-client { order: 4; flex: 1 1 100%; font-size: 14px; color: var(--text); }
  #proc-table td.is-empty { display: none; }
  #proc-table .p-comp::before, #proc-table .p-loc::before, #proc-table .p-sys::before, #proc-table .p-type::before { content: '· '; }
  #proc-table .p-by, #proc-table .p-pm { order: 6; flex: 1 1 100%; max-width: none; white-space: normal; }
  #proc-table .p-ord { order: 7; margin-left: auto; }

  /* Setari (utilizatori, furnizori, produse): titlu + stare sus, rand lat, detalii, actiuni */
  .table-cards td { order: 4; font-size: 12px; }
  .table-cards td.num-cell { text-align: left; }
  .table-cards .tc-title { order: 1; flex: 1 1 auto; font-size: 14px; font-weight: 600; }
  .table-cards .tc-side { order: 2; }
  .table-cards .tc-full { order: 3; flex: 1 1 100%; font-size: 13px; }
  .table-cards td.tc-actions { order: 5; flex: 1 1 100%; display: flex; gap: 4px; justify-content: flex-end; margin-top: 4px; }
}

@media (max-width: 600px) {
  .form-row-3, .form-row-4 { grid-template-columns: 1fr; }
  /* categorii produse: mai mult loc pentru numele complexitatii */
  .pcc-head-row, .pcc-row { grid-template-columns: minmax(80px, 1fr) 36px 48px 34px 40px; gap: 4px; }
  .pc-card-header { flex-wrap: wrap; }
}

@media (prefers-color-scheme: dark) {
  .text-success { color: #86efac; }
  .text-danger { color: #fca5a5; }
}

/* ─── EDITOR OFERTA: celulele liniilor (lrCell in line-editor.js) ──────────────── */
.lr-cell { min-width: 0; }
.lr-cell.c-right { text-align: right; }
.lr-cell.c-center { text-align: center; }
.lr-budget-group { margin: 0 14px 10px; }

/* ─── EDITOR OFERTA PE TELEFON / TABLETA ────────────────────────────────────────
   Sub 1024px (meniul lateral e ascuns) grila de 16 coloane nu mai incape: fiecare
   linie devine card cu 3 coloane si eticheta deasupra fiecarei valori. Ordinea
   pe card: denumire; cod, UM, cantitate; achizitie, pret in valuta; cost, transport,
   markup; pret vanzare, valoare, GP; ascunsa / detalii / sterge. */
@media (max-width: 1024px) {
  .content:has(> #page-offer:not(.hidden)) { min-width: 0; }
  .offer-header-card { padding: 1rem; }
  .offer-number-display { font-size: 22px; }
  .offer-editor-actions { width: 100%; }
  .offer-editor-actions #btn-save-offer { margin-left: auto; }

  .line-head-row { display: none; }
  .line-row-compact.line-grid-cols { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px 10px; padding: 12px; align-items: end; }
  .line-row-compact > .drag-handle, .line-row-compact > span:empty { display: none; }
  .line-row-compact > .lr-name-code { grid-column: 1 / -1; }
  .lr-cell.is-empty { display: none; }
  .lr-cell, .lr-cell.c-right, .lr-cell.c-center { text-align: left; }
  .lr-cell::before { content: attr(data-label); display: block; font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); margin-bottom: 3px; }
  .lr-c-achiz { grid-column: span 2; }
  .line-row-compact input[type="number"], .lr-val { text-align: left; }
  .line-row-compact input, .line-row-compact select, .line-row-compact textarea { font-size: 16px; padding: 6px 8px; } /* 16px: iOS nu face zoom la focus */
  .lr-val, .line-row-compact .ro-cell { padding: 6px 8px; font-size: 14px; }
  .lr-achiz select { flex: 0 0 76px; width: 76px; font-size: 14px; }
  /* denumirea se vede intreaga: campul creste cu textul */
  .lr-name-code textarea.lr-name-input { field-sizing: content; min-height: 40px; max-height: none; }
  .lr-name-code .ro-cell.lr-name-ro { white-space: normal; }
  .lr-c-hide .lr-hide-check { width: 20px; height: 20px; }
  .lr-c-hide .lr-flags { justify-content: flex-start; gap: 14px; }
  .lr-expand-btn { justify-self: start; font-size: 13px; padding: 8px 0; color: var(--accent); }
  .lr-expand-btn::after { content: ' Detalii'; }
  .line-row-compact > .btn-icon-sm.btn-danger { grid-column: -2 / -1; justify-self: end; padding: 8px 12px; font-size: 15px; }

  .line-row-detail { padding: 12px; }
  .lrd-group-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .lrd-field input, .lrd-field select { font-size: 16px; }
  .labor-formula { margin: 8px 12px 12px; }
  .labor-field input, .labor-field select { font-size: 16px; }
  .labor-hint { padding: 0 12px 10px; }
  .lr-budget-group { margin: 0 12px 10px; }
  .lr-budget-group .lrd-group-grid { grid-template-columns: minmax(0, 1fr) !important; }

  .cat-band { padding: 8px 12px; }
  .markup-bar-item input { font-size: 16px; }
  .data-table.labor-breakdown-table { min-width: 0; }
  .fin-cat-table { overflow-x: auto; }
  .fin-cat-table th, .fin-cat-table td { padding-left: 4px !important; padding-right: 4px !important; }
}

@media (max-width: 600px) {
  .line-row-compact.line-grid-cols { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lr-c-achiz { grid-column: 1 / -1; }
  .lrd-group-grid { grid-template-columns: minmax(0, 1fr) !important; }
  .rates-grid { grid-template-columns: 1fr; }
}

/* ─── CALCULATOR CU SCALARE 125% / 150% (1920x1080 => 1536px / 1280px "CSS") ────
   La 100% (≈1905px) totul incape cum era. Sub 1600px liniile ofertei trec pe doua
   randuri in aceeasi linie (codul sub denumire), sub 1366px si costul EUR sub
   pretul convertit -- aceleasi informatii, fara derulare laterala. Pozitia fiecarei
   celule (nth-child) e aceeasi la antet si la randuri: drag, denumire, cod, UM,
   cant., achizitie, pret valuta, cost EUR, transp., markup, pret vanz., valoare,
   GP, ascunsa, detalii, sterge. */
@media (min-width: 1025px) and (max-width: 1440px) {
  :root { --sidebar-w: 190px; }
  .content { padding: 1.25rem; }
  .data-table th, .data-table td { padding: 0.6rem 0.6rem; }
  #stock-table .num-cell .sub-text { min-width: 110px; }
  #stock-table th { white-space: normal; }
  .offer-header-card { padding: 1rem; }
}

@media (min-width: 1025px) and (max-width: 1600px) {
  .line-grid-cols {
    grid-template-columns: 20px minmax(160px, 1fr) 50px 56px 108px 92px 88px 52px 54px 100px 104px 54px 40px 22px 22px 22px;
    grid-template-areas:
      "drag name um qty achiz conv cost tr mkp sale val gp hide exp del rp"
      "drag code .  .   .     .    .    .  .   .    .   .  .    .   .   .";
    column-gap: 6px; row-gap: 3px;
  }
  .line-grid-cols > :nth-child(1)  { grid-area: drag; }
  .line-grid-cols > :nth-child(2)  { grid-area: name; }
  .line-grid-cols > :nth-child(3)  { grid-area: code; }
  .line-grid-cols > :nth-child(4)  { grid-area: um; }
  .line-grid-cols > :nth-child(5)  { grid-area: qty; }
  .line-grid-cols > :nth-child(6)  { grid-area: achiz; }
  .line-grid-cols > :nth-child(7)  { grid-area: conv; }
  .line-grid-cols > :nth-child(8)  { grid-area: cost; }
  .line-grid-cols > :nth-child(9)  { grid-area: tr; }
  .line-grid-cols > :nth-child(10) { grid-area: mkp; }
  .line-grid-cols > :nth-child(11) { grid-area: sale; }
  .line-grid-cols > :nth-child(12) { grid-area: val; }
  .line-grid-cols > :nth-child(13) { grid-area: gp; }
  .line-grid-cols > :nth-child(14) { grid-area: hide; }
  .line-grid-cols > :nth-child(15) { grid-area: exp; }
  .line-grid-cols > :nth-child(16) { grid-area: del; }
  .line-grid-cols > :nth-child(17) { grid-area: rp; }
  .line-head-row { padding: 0 8px 6px; align-items: end; }
  .line-head-row > :nth-child(3) { text-align: left; }
  .line-row-compact { padding: 6px 8px; }
  .lr-val { padding: 3px 5px; }
}

@media (min-width: 1025px) and (max-width: 1366px) {
  .line-grid-cols {
    grid-template-columns: 18px minmax(140px, 1fr) 54px 52px 118px 90px 46px 60px 92px 94px 50px 38px 20px 20px 20px;
    grid-template-areas:
      "drag name um qty achiz conv tr mkp sale val gp hide exp del rp"
      "drag code .  .   .     cost .  .   .    .   .  .    .   .   .";
  }
  .line-head-row > :nth-child(8) { text-align: right; }
  .line-head-row { font-size: 9.5px; letter-spacing: 0.02em; }
  .lr-val { font-size: 12px; padding: 3px 4px; }
  .line-row-compact input, .line-row-compact select { padding-left: 4px; padding-right: 2px; font-size: 12.5px; }
  .lr-achiz select { flex: 0 0 52px; width: 52px; }
}

/* ─── PRETURI AGREATE ──────────────────────────────────────────────────────── */
.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 3px; }
#pai-table .tc-side .badge, #pa-table .badge { white-space: nowrap; }

/* Linie cu pret agreat: eticheta (click = desprindere) si pretul fix evidentiat */
.badge-agreed { background: #dcfce7; color: #166534; font-size: 10px; flex: 0 0 auto; border: 1px solid #86efac; cursor: pointer; font-family: inherit; line-height: 1.4; }
span.badge-agreed { cursor: default; }
.badge-agreed:hover { border-color: #16a34a; }
.badge-agreed-warn { background: #fef3c7; color: #92400e; border-color: #fbbf24; }
.lr-val.lr-agreed-price { border-color: #86efac; }
@media (prefers-color-scheme: dark) {
  .badge-agreed { background: #052e16; color: #86efac; border-color: #166534; }
  .badge-agreed-warn { background: #451a03; color: #fcd34d; border-color: #92400e; }
  .lr-val.lr-agreed-price { border-color: #166534; }
}
/* ─── CAUTARE PRODUSE (product-modal.js) ───────────────────────────────────────── */
.pf-modal { height: min(86vh, 900px); }
.pf-toolbar { padding: 0.75rem 1.5rem; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; flex-shrink: 0; }
.pf-toolbar .product-search-input { margin-bottom: 0; }
.pf-filters { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.pf-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border: 1px solid var(--border); border-radius: 99px; font-size: 12.5px; color: var(--text-muted); cursor: pointer; user-select: none; background: var(--surface); }
.pf-chip input { width: auto; margin: 0; }
.pf-chip:has(input:checked) { border-color: var(--accent); color: var(--text); background: var(--sidebar-active-bg); }
.pf-chip-agreed:has(input:checked) { border-color: #16a34a; background: #dcfce7; color: #166534; }
.pf-n { font-size: 11px; opacity: 0.8; }
.pf-sep { width: 1px; align-self: stretch; background: var(--border); }
.pf-context { font-size: 12px; color: var(--text-muted); }
.pf-context:empty { display: none; }
.pf-body { padding: 0; }
.pf-results { transition: opacity 0.15s; }
.pf-results.pf-loading { opacity: 0.5; }
.pf-empty { color: var(--text-muted); font-size: 13px; text-align: center; padding: 2.5rem 1rem; }
.pf-group-title { position: sticky; top: 0; z-index: 1; background: var(--bg-alt); border-bottom: 1px solid var(--border); padding: 6px 1.5rem; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); }
.pf-group-title span { font-weight: 400; margin-left: 4px; }
.pf-group-agreed .pf-group-title { color: #166534; background: #f0fdf4; }
.pf-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 4px 16px; align-items: center; padding: 10px 1.5rem; border-bottom: 1px solid var(--border-light); cursor: default; }
.pf-row.active { background: rgba(37,99,235,0.14); outline: 1px solid rgba(37,99,235,0.45); outline-offset: -1px; }
.pf-row-agreed { box-shadow: inset 3px 0 0 #16a34a; }
.pf-name { font-size: 13.5px; font-weight: 500; overflow-wrap: anywhere; }
.pf-code { font-weight: 700; margin-right: 8px; }
.pf-meta { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; margin-top: 3px; font-size: 12px; color: var(--text-muted); }
.pf-warn { color: #b45309; font-weight: 600; }
.pf-stock { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.pf-stock-chip { font-size: 11px; padding: 1px 6px; border-radius: 3px; }
.pf-stock-chip.in { color: #166534; background: #f0fdf4; }
.pf-stock-chip.out { color: #991b1b; background: #fef2f2; }
.pf-stock-chip.pf-stock-nod { outline: 1px dashed currentColor; outline-offset: -1px; } /* stoc la distribuitor, nu al nostru */
.pf-price { text-align: right; display: flex; flex-direction: column; font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.pf-price strong { font-size: 14px; color: var(--text); }
.pf-cost { font-size: 11px; }
.pf-noprice { font-style: italic; }
.pf-act .btn { min-width: 84px; justify-content: center; }
.pf-alts { margin-top: 6px; border-top: 1px dashed var(--border); padding-top: 4px; }
.pf-alt { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 3px 0; font-size: 12px; }
.pf-results mark { background: #fef08a; color: inherit; border-radius: 2px; padding: 0 1px; }
/* Varianta "pret de achizitie" sub un articol agreat (secundara, pretul agreat ramane recomandat) */
.pf-purchase { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 2px; margin-top: 2px; padding-top: 4px; border-top: 1px dashed var(--border); font-size: 12px; color: var(--text-muted); }
.pf-purchase strong { color: var(--text); font-size: 12.5px; }
.pf-purchase .pf-alt > span { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; }
.pf-purchase .pf-more { align-self: flex-start; margin: 2px 0; }
.pf-purchase .pf-alts { margin-top: 0; }
.pf-purchase-label { font-weight: 600; }
.pf-margin { font-weight: 600; padding: 1px 6px; border-radius: 3px; }
.pf-diff { font-weight: 600; }
.pf-diff-big { color: #b45309; }
.pf-keys { margin-right: auto; font-size: 12px; color: var(--text-muted); }
.pf-select { width: auto; max-width: 220px; padding: 4px 8px; font-size: 12.5px; border: 1px solid var(--border); border-radius: 99px; background: var(--surface); color: var(--text); }
.pf-select.pf-select-on { border-color: var(--accent); background: var(--sidebar-active-bg); }
.pf-filter-note { color: var(--text); }
/* Tabelul de comparatie a furnizorilor (sub un produs cu pret de la mai multi furnizori) */
.pf-compare { margin: 4px 0 2px; overflow-x: auto; }
.pf-compare table { width: 100%; border-collapse: collapse; font-size: 12px; }
.pf-compare th { text-align: left; font-weight: 600; color: var(--text-muted); padding: 3px 8px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.pf-compare td { padding: 3px 8px; border-bottom: 1px solid var(--border-light); white-space: nowrap; color: var(--text); }
.pf-compare .num { text-align: right; }
.pf-compare tr.is-ref td { background: rgba(22,163,74,0.08); }
.pf-compare .btn { padding: 1px 8px; }
@media (max-width: 700px) {
  /* Telefon: fiecare furnizor devine un card compact (fara scroll orizontal) */
  .pf-compare thead { display: none; }
  .pf-compare table, .pf-compare tbody { display: block; }
  .pf-compare tr { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 10px; padding: 6px 4px; border-bottom: 1px solid var(--border-light); }
  .pf-compare td { display: inline; padding: 0; border: none; white-space: normal; }
  .pf-compare td:first-child { flex-basis: 100%; }
  .pf-compare td:last-child { margin-left: auto; }
  .pf-compare td:nth-child(4)::before { content: 'cost '; color: var(--text-muted); font-weight: 400; }
}

@media (max-width: 900px) {
  .pf-modal { height: 100dvh; max-height: 100dvh; border-radius: 0; }
  .pf-toolbar { padding: 0.75rem 1rem; }
  .pf-toolbar .product-search-input { font-size: 16px; }
  .pf-sep, .pf-keys { display: none; }
  .pf-group-title { padding: 6px 1rem; }
  .pf-row { grid-template-columns: minmax(0, 1fr) auto; padding: 10px 1rem; }
  .pf-main { grid-column: 1 / -1; }
  .pf-price { text-align: left; }
}

@media (prefers-color-scheme: dark) {
  .pf-chip-agreed:has(input:checked) { background: #052e16; color: #86efac; border-color: #166534; }
  .pf-group-agreed .pf-group-title { color: #86efac; background: #052e16; }
  .pf-stock-chip.in { color: #86efac; background: #052e16; }
  .pf-stock-chip.out { color: #fca5a5; background: #450a0a; }
  .pf-results mark { background: #854d0e; }
  .pf-warn, .pf-diff-big { color: #fcd34d; }
}
/* ─── LINII OFERTA CA CARDURI ───────────────────────────────────────────────────
   Fiecare linie (cu detaliile ei extinse) e un card separat pe fundalul categoriei,
   ca sa se vada clar unde incepe si unde se termina. Antetul coloanelor e decalat
   cu marginea + chenarul cardului (10px + 1px), ca sa ramana aliniat cu valorile. */
#line-tbody .line-cat-section, #qc-lines .line-cat-section { background: var(--bg); padding-bottom: 2px; }
.line-block, .labor-block {
  margin: 6px 10px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); box-shadow: 0 1px 2px rgba(0,0,0,0.05); overflow: hidden;
  padding-bottom: 0; transition: border-color 0.12s;
}
.line-block:hover { border-color: rgba(37,99,235,0.45); }
.line-block:focus-within { border-color: var(--accent); }
.line-block.drag-row-over { border-top: 1px solid var(--border); box-shadow: 0 -3px 0 var(--accent); }
.line-row-compact:hover { background: transparent; }
.line-row-compact.type-cable { background: #f0fdf4; }
.line-block .labor-formula { margin-bottom: 10px; }
.line-head-row { padding-left: 25px; padding-right: 25px; }
.line-add-ghost { padding: 4px 14px 10px; }

/* ─── ANTETUL COLOANELOR ────────────────────────────────────────────────────────
   Bara de antet "lipita" de tabel (acelasi fundal ca benzile categoriilor, colturi rotunjite
   sus) si fixata sus la derulare -- pe o oferta lunga ramane vizibil ce coloana e ce.
   Fiecare eticheta e aliniata ca valoarea de sub ea: numerele la dreapta, la acelasi
   padding ca textul din campuri (6px), denumirea deasupra campului (dupa iconite). */
.line-head-row {
  position: sticky; top: 0; z-index: 6;
  background: var(--surface); border-bottom: 2px solid var(--border);
  padding-top: 9px; padding-bottom: 7px; margin-bottom: 0;
  font-size: 10.5px; font-weight: 700; color: var(--text-muted); letter-spacing: 0.04em;
}
.line-head-row > span { white-space: nowrap; min-width: 0; position: relative; }
/* Separatoare verticale discrete intre coloane, la mijlocul spatiului dintre ele
   (gap 8px; 6px sub 1600px). Fara separator inainte de denumire si intre butoanele de la capat. */
.line-head-row { --head-gap: 8px; }
.line-head-row > span:nth-child(n+3):nth-child(-n+14)::before {
  content: ''; position: absolute; left: calc(var(--head-gap) / -2 - 0.5px); top: -4px; bottom: -4px;
  width: 1px; background: var(--border);
}
.line-head-row > span:nth-child(n+5):nth-child(-n+12) { padding-right: 6px; }
.line-head-row > span:nth-child(2) { padding-left: 71px; }
.line-head-row > span:nth-child(3) { padding-left: 6px; }
.line-head-row > span:nth-child(14) { letter-spacing: 0; }
/* Achizitie: deasupra numarului, nu a selectului de valuta (48px + 3px spatiu) */
.line-head-row.line-grid-cols > span:nth-child(6) { padding-right: 57px; }
/* Coloanele inguste (transport, markup): litere mai mici, fara spatiere, ca sa incapa intregi */
.line-head-row.line-grid-cols > span:nth-child(9), .line-head-row.line-grid-cols > span:nth-child(10) { letter-spacing: 0; padding-right: 2px; font-size: 9.5px; }
.line-head-row > span[title] { cursor: help; }
@media (min-width: 1025px) and (max-width: 1600px) {
  .line-head-row { --head-gap: 6px; }
  /* Pe doua randuri, "Cod" sta sub "Denumire": fara separator in fata lui */
  .line-head-row > span:nth-child(3)::before { display: none; }
  .line-head-row > span:nth-child(2) { padding-left: 53px; }
  /* coloana Achizitie e mai ingusta: eticheta pana la marginea campului, fara spatiere */
  .line-head-row.line-grid-cols > span:nth-child(6) { padding-right: 51px; letter-spacing: 0; }
  .line-head-row.line-grid-cols > span:nth-child(9), .line-head-row.line-grid-cols > span:nth-child(10) { padding-right: 0; }
}

/* Laptop 1920x1080 cu scalare 125% (1536px) / 150% (1280px): mai putin spatiu pierdut in
   margini (pagina, cardul liniilor, cardul fiecarei linii), ca denumirea sa aiba loc.
   Antetul coloanelor = marginea cardului (4px) + chenar (1px) + padding-ul randului (8px). */
@media (min-width: 1025px) and (max-width: 1600px) {
  .content:has(> #page-offer:not(.hidden)) { padding: 14px 16px; }
  #offer-lines-container > .offer-header-card { padding: 14px 10px; }
  .line-block, .labor-block { margin: 5px 4px; }
  .line-head-row { padding-left: 13px; padding-right: 13px; }
  /* Iconitele din fata denumirii (cautare, tip) mai mici */
  .lr-name-code { gap: 3px; }
  .lr-name-code > .btn-icon-sm { padding: 2px; }
}
/* Selecturile inguste din linii (UM, valuta), pe orice calculator: fara sageata nativa lata --
   "buc" / "EUR" / "USD" incap intregi */
@media (min-width: 1025px) {
  .line-row-compact select {
    -webkit-appearance: none; appearance: none; padding-left: 4px; padding-right: 13px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='5' viewBox='0 0 8 5'%3E%3Cpath d='M0 0l4 5 4-5z' fill='%2394a3b8'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 4px center; background-size: 7px 4px;
  }
  .lr-achiz select { padding-left: 3px; padding-right: 11px; background-position: right 3px center; }
}
/* 1441-1600px (ex. 1920 la 125% = 1536px): cu meniul restrans e destul loc pentru un singur
   rand pe linie, cu codul in coloana lui (ca la 100%) */
@media (min-width: 1441px) and (max-width: 1600px) {
  .sidebar-collapsed .line-grid-cols {
    grid-template-columns: 20px minmax(180px, 1fr) 112px 50px 56px 108px 92px 88px 52px 54px 100px 104px 54px 40px 22px 22px 22px;
    grid-template-areas: "drag name code um qty achiz conv cost tr mkp sale val gp hide exp del rp";
  }
  .sidebar-collapsed .line-head-row > span:nth-child(3)::before { display: block; }
}
/* Sub 1366px "Cost EUR" sta sub "Pret": fara separator in fata lui */
@media (min-width: 1025px) and (max-width: 1366px) {
  .line-head-row > span:nth-child(8)::before { display: none; }
}
@media (max-width: 1024px) {
  .line-block, .labor-block { margin: 8px; }
}
@media (prefers-color-scheme: dark) {
  .line-block, .labor-block { box-shadow: none; }
  .line-row-compact.type-cable { background: #052e16; }
}
/* Mod luminos: fundalul implicit al categoriei (#f8f9fa) era aproape identic cu cardul alb --
   fundal gri-albastrui, chenar mai inchis si umbra, ca liniile sa se distinga clar. */
@media (prefers-color-scheme: light) {
  #line-tbody .line-cat-section, #qc-lines .line-cat-section { background: #e9eef5; }
  .line-block, .labor-block { border-color: #c5cfdc; box-shadow: 0 1px 3px rgba(15, 23, 42, 0.10); }
}
/* ─── INSTRUMENTE PDF ──────────────────────────────────────────────────────── */
.pt-modes { display: inline-flex; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 3px; gap: 2px; }
.pt-mode { border: none; background: transparent; color: var(--text-muted); font-size: 13px; font-weight: 500; padding: 0.4rem 0.9rem; border-radius: 6px; cursor: pointer; }
.pt-mode:hover { color: var(--text); }
.pt-mode.active { background: var(--surface); color: var(--accent); box-shadow: var(--shadow); }
.pt-privacy { font-size: 12px; color: var(--text-muted); margin: -0.75rem 0 1rem; }
.pt-drop { border: 2px dashed var(--border); border-radius: var(--radius-lg); background: var(--surface); padding: 3.5rem 1rem; text-align: center; cursor: pointer; color: var(--text-muted); transition: all 0.15s; display: flex; flex-direction: column; align-items: center; gap: 0.6rem; }
.pt-drop:hover, .pt-drop:focus-visible, #page-pdf-tools.pt-drag-files .pt-drop { border-color: var(--accent); background: var(--sidebar-active-bg); color: var(--accent); outline: none; }
.pt-drop-title { font-size: 16px; font-weight: 600; color: var(--text); }
.pt-drop-sub { font-size: 13px; }
.pt-link { color: var(--accent); text-decoration: underline; }
.pt-steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0.75rem; margin-top: 1rem; font-size: 13px; color: var(--text-muted); }
.pt-steps > div { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.75rem 1rem; }
.pt-steps b { color: var(--accent); }
#page-pdf-tools.pt-drag-files .pt-layout { outline: 2px dashed var(--accent); outline-offset: 6px; border-radius: var(--radius-lg); }
.pt-layout { display: grid; grid-template-columns: 300px 1fr; gap: 1.25rem; align-items: start; }
.pt-side { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1rem; position: sticky; top: 1rem; display: flex; flex-direction: column; gap: 0.6rem; max-height: calc(100vh - 2rem); overflow-y: auto; }
.pt-side-head { display: flex; align-items: center; justify-content: space-between; font-size: 13px; font-weight: 600; }
.pt-files { display: flex; flex-direction: column; gap: 4px; }
.pt-file { display: flex; align-items: center; gap: 6px; padding: 6px 6px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); position: relative; }
.pt-file[draggable="true"] { cursor: grab; }
.pt-file.pt-dragging { opacity: 0.4; }
.pt-file.drop-before { box-shadow: 0 -3px 0 var(--accent); }
.pt-file.drop-after { box-shadow: 0 3px 0 var(--accent); }
.pt-grip { color: var(--text-light); display: inline-flex; }
.pt-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; display: inline-block; }
.pt-file-info { flex: 1; min-width: 0; }
.pt-file-name { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pt-file-meta { font-size: 11px; color: var(--text-muted); }
.pt-warn { color: var(--warning-border); font-weight: 600; }
.pt-mini { padding: 3px; }
.pt-mini:disabled { opacity: 0.3; cursor: default; }
.pt-hint { font-size: 12px; color: var(--text-muted); }
.pt-out { border-top: 1px solid var(--border); padding-top: 0.75rem; margin-top: 0.25rem; display: flex; flex-direction: column; gap: 0.5rem; }
.pt-label { font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.pt-radio { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; cursor: pointer; padding: 6px 8px; border: 1px solid var(--border); border-radius: var(--radius); }
.pt-radio:has(input:checked) { border-color: var(--accent); background: var(--sidebar-active-bg); }
.pt-radio input { margin-top: 3px; }
.pt-radio span { display: flex; flex-direction: column; }
.pt-radio small { color: var(--text-muted); font-size: 11px; }
.pt-name-wrap { display: flex; align-items: center; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.pt-name-wrap input { flex: 1; border: none; padding: 0.5rem 0.6rem; font-size: 13px; background: transparent; color: var(--text); min-width: 0; outline: none; }
.pt-name-wrap:focus-within { border-color: var(--accent); }
.pt-name-wrap span { padding: 0 0.6rem; font-size: 12px; color: var(--text-muted); background: var(--bg); align-self: stretch; display: flex; align-items: center; border-left: 1px solid var(--border); }
.pt-summary { font-size: 12px; color: var(--text-muted); min-height: 1em; }
.pt-go { justify-content: center; width: 100%; }
.pt-go:disabled { opacity: 0.5; cursor: not-allowed; }
.pt-reset { align-self: center; color: var(--text-muted); }
.pt-spin { width: 14px; height: 14px; border: 2px solid rgba(255,255,255,0.4); border-top-color: #fff; border-radius: 50%; animation: pt-spin 0.8s linear infinite; display: inline-block; }
@keyframes pt-spin { to { transform: rotate(360deg); } }
.pt-main { min-width: 0; }
.pt-toolbar { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-bottom: 0.75rem; min-height: 32px; }
.pt-toolbar input { padding: 0.3rem 0.6rem; font-size: 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); width: 200px; }
.pt-group-title { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; margin: 1rem 0 0.5rem; }
.pt-group-title:first-child { margin-top: 0; }
.pt-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 14px; }
.pt-empty { grid-column: 1 / -1; padding: 2rem; text-align: center; color: var(--text-muted); font-size: 13px; border: 1px dashed var(--border); border-radius: var(--radius-lg); }
.pt-page { position: relative; background: var(--surface); border: 2px solid var(--border); border-radius: var(--radius); padding: 8px 8px 4px; cursor: pointer; transition: border-color 0.12s, box-shadow 0.12s, opacity 0.12s; outline: none; user-select: none; }
.pt-page[draggable="true"] { cursor: grab; }
.pt-page:hover { border-color: var(--text-light); }
.pt-page:focus-visible { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37,99,235,0.25); }
.pt-page.selected { border-color: var(--accent); background: var(--sidebar-active-bg); }
.pt-page.pt-dragging { opacity: 0.35; }
.pt-page.drop-before::before, .pt-page.drop-after::after { content: ''; position: absolute; top: 4px; bottom: 4px; width: 4px; border-radius: 2px; background: var(--accent); }
.pt-page.drop-before::before { left: -10px; }
.pt-page.drop-after::after { right: -10px; }
.pt-thumb { height: 170px; display: flex; align-items: center; justify-content: center; position: relative; }
.pt-thumb img { max-width: 100%; max-height: 170px; box-shadow: 0 1px 4px rgba(0,0,0,0.25); background: #fff; transition: transform 0.2s; min-width: 60px; min-height: 80px; }
.pt-thumb.rot-side img { max-width: 170px; max-height: 120px; }
.pt-thumb img:not([src]) { width: 120px; height: 160px; background: var(--bg); box-shadow: none; animation: pt-pulse 1.2s ease-in-out infinite; }
@keyframes pt-pulse { 50% { opacity: 0.5; } }
.pt-thumb-err::after { content: 'Pagina nu poate fi afisata'; position: absolute; font-size: 11px; color: var(--danger); text-align: center; }
.pt-check { position: absolute; top: -2px; left: -2px; width: 22px; height: 22px; border-radius: 6px; border: 2px solid var(--text-light); background: var(--surface); display: flex; align-items: center; justify-content: center; color: transparent; }
.pt-page.selected .pt-check { background: var(--accent); border-color: var(--accent); color: #fff; }
.pt-tools { position: absolute; bottom: 4px; left: 50%; transform: translateX(-50%); display: flex; gap: 2px; background: rgba(15,23,42,0.85); border-radius: 6px; padding: 2px; opacity: 0; transition: opacity 0.12s; }
.pt-page:hover .pt-tools, .pt-page:focus-within .pt-tools { opacity: 1; }
.pt-tool { border: none; background: transparent; color: #f1f5f9; padding: 5px; border-radius: 4px; cursor: pointer; display: inline-flex; }
.pt-tool:hover { background: rgba(255,255,255,0.18); }
.pt-tool.danger:hover { background: #dc2626; }
.pt-page-label { display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 13px; font-weight: 600; padding-top: 6px; }
.pt-page-label small { font-weight: 400; color: var(--text-muted); font-size: 11px; }
.pt-preview { z-index: 400; background: rgba(0,0,0,0.75); }
.pt-preview-box { display: flex; flex-direction: column; max-width: 96vw; max-height: 96vh; gap: 8px; }
.pt-preview-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; color: #f1f5f9; font-size: 14px; }
.pt-preview-head .btn-icon { color: #f1f5f9; }
.pt-preview-head .btn-icon:hover { background: rgba(255,255,255,0.15); color: #fff; }
.pt-preview-head .btn-ghost { color: #f1f5f9; border-color: rgba(255,255,255,0.4); }
.pt-pv-actions { display: flex; gap: 8px; align-items: center; }
.pt-preview-stage { display: flex; align-items: center; gap: 12px; }
.pt-pv-canvas { display: flex; align-items: center; justify-content: center; min-width: 200px; min-height: 300px; }
.pt-pv-canvas canvas, .pt-pv-canvas img { max-width: 80vw; max-height: calc(100vh - 140px); background: #fff; box-shadow: 0 8px 30px rgba(0,0,0,0.5); transition: transform 0.2s; }
.pt-pv-canvas .rot-side { max-width: calc(100vh - 140px); max-height: 80vw; }
.pt-pv-nav { background: rgba(255,255,255,0.12); border: none; color: #fff; font-size: 36px; width: 48px; height: 72px; border-radius: 8px; cursor: pointer; line-height: 1; }
.pt-pv-nav:hover:not(:disabled) { background: rgba(255,255,255,0.25); }
.pt-pv-nav:disabled { opacity: 0.2; cursor: default; }
@media (max-width: 900px) {
  .pt-layout { grid-template-columns: 1fr; }
  .pt-side { position: static; max-height: none; }
  .pt-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
  .pt-thumb { height: 130px; }
  .pt-thumb img { max-height: 130px; }
  .pt-tools { opacity: 1; }
}
