:root {
  --sidebar-width: 240px;
  --sidebar-bg: #1a1f2e;
  --sidebar-text: #a8b2d0;
  --sidebar-active-bg: #2d3654;
  --sidebar-active-text: #ffffff;
  --accent: #4f7ef8;
  --accent-green: #22c55e;
  --accent-red: #ef4444;
  --accent-orange: #f59e0b;
  --topbar-h: 56px;
  --bg: #f0f2f7;
  --card-bg: #ffffff;
}

* { box-sizing: border-box; }
body { margin: 0; font-family: 'Segoe UI', system-ui, sans-serif; background: var(--bg); }

/* === WRAPPER === */
.wrapper { display: flex; min-height: 100vh; }

/* === SIDEBAR === */
#sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  overflow-y: auto;
  z-index: 1000;
  transition: transform 0.3s;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 18px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.brand-icon { font-size: 22px; color: var(--accent); }
.brand-text { font-size: 16px; font-weight: 700; color: #fff; letter-spacing: 0.3px; }

#sidebar .nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 18px;
  color: var(--sidebar-text);
  border-radius: 8px;
  margin: 1px 8px;
  font-size: 14px;
  transition: background 0.15s, color 0.15s;
  text-decoration: none;
}
#sidebar .nav-link:hover { background: rgba(255,255,255,0.07); color: #fff; }
#sidebar .nav-link.active { background: var(--accent); color: #fff; font-weight: 600; }
#sidebar .nav-link i { font-size: 16px; width: 18px; }

.nav-section {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.2px;
  color: rgba(255,255,255,0.3);
  padding: 14px 18px 4px;
  text-transform: uppercase;
}
.coming-soon { color: rgba(255,255,255,0.15); }
.disabled-nav .nav-link { cursor: default; opacity: 0.5; }

.sidebar-bottom {
  margin-top: auto;
  border-top: 1px solid rgba(255,255,255,0.08);
  padding: 8px;
}

/* === MAIN === */
#main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  height: var(--topbar-h);
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.topbar-right { margin-left: auto; }

.page-content { padding: 28px 28px 40px; }

/* === CARDS === */
.card {
  border: none;
  border-radius: 12px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.card-header {
  background: #fff;
  border-bottom: 1px solid #f0f0f0;
  padding: 16px 20px;
  border-radius: 12px 12px 0 0 !important;
  font-weight: 600;
  font-size: 15px;
}

/* === STAT CARDS === */
.stat-card {
  border-radius: 12px;
  padding: 20px;
  color: #fff;
  position: relative;
  overflow: hidden;
}
.stat-card .stat-icon {
  position: absolute;
  right: 16px;
  top: 16px;
  font-size: 36px;
  opacity: 0.25;
}
.stat-card .stat-value { font-size: 28px; font-weight: 700; line-height: 1; }
.stat-card .stat-label { font-size: 13px; opacity: 0.85; margin-top: 4px; }
.bg-accent { background: linear-gradient(135deg, #4f7ef8, #3b63d4); }
.bg-green { background: linear-gradient(135deg, #22c55e, #16a34a); }
.bg-orange { background: linear-gradient(135deg, #f59e0b, #d97706); }
.bg-purple { background: linear-gradient(135deg, #a855f7, #7c3aed); }

/* === PAGE HEADER === */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.page-header h2 { margin: 0; font-size: 22px; font-weight: 700; color: #1a1f2e; }

/* === QUOTE EDITOR === */
.quote-editor-card { border-radius: 12px; overflow: visible; }

/* Items table */
.items-table th { font-size: 12px; font-weight: 600; color: #6b7280; text-transform: uppercase; letter-spacing: 0.5px; padding: 10px 8px; background: #f8f9fc; }
.items-table td { padding: 6px 6px; vertical-align: middle; }
.items-table .form-control, .items-table .form-select {
  font-size: 13px;
  padding: 5px 8px;
  border-color: #e5e7eb;
  border-radius: 6px;
}
.items-table .form-control:focus, .items-table .form-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(79,126,248,0.15);
}

/* profit badge per row */
.profit-badge {
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 20px;
  font-weight: 600;
  white-space: nowrap;
}
.profit-pos { background: #dcfce7; color: #16a34a; }
.profit-neg { background: #fee2e2; color: #dc2626; }
.profit-zero { background: #f3f4f6; color: #6b7280; }

/* Summary panel */
.summary-panel {
  border-radius: 12px;
  background: #fff;
  border: 1px solid #e5e7eb;
  padding: 20px;
  position: sticky;
  top: 70px;
}
.summary-row { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid #f0f0f0; font-size: 14px; }
.summary-row:last-child { border-bottom: none; }
.summary-row.total { font-size: 16px; font-weight: 700; }
.summary-row.profit-row .val { font-weight: 700; font-size: 15px; }
.profit-positive { color: var(--accent-green); }
.profit-negative { color: var(--accent-red); }
.margin-bar { height: 6px; background: #e5e7eb; border-radius: 3px; margin-top: 12px; overflow: hidden; }
.margin-fill { height: 100%; border-radius: 3px; transition: width 0.3s; background: var(--accent-green); }

/* === STATUS BADGES === */
.status-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}
.status-taslak { background: #f3f4f6; color: #6b7280; }
.status-gonderildi { background: #dbeafe; color: #1d4ed8; }
.status-onaylandi { background: #dcfce7; color: #16a34a; }
.status-reddedildi { background: #fee2e2; color: #dc2626; }

/* === TABLE === */
.table-card table { margin: 0; }
.table-card table thead th { background: #f8f9fc; font-size: 12px; font-weight: 600; color: #6b7280; text-transform: uppercase; border-bottom: 1px solid #e5e7eb; padding: 12px 16px; }
.table-card table tbody td { padding: 12px 16px; vertical-align: middle; font-size: 14px; }
.table-card table tbody tr:hover { background: #f8f9fc; }

/* === PRINT === */
@media print {
  #sidebar, .topbar, .no-print { display: none !important; }
  #main-content { margin: 0; }
  .page-content { padding: 0; }
  body { background: #fff; }
}

/* === PRINT TEMPLATE === */
.print-page {
  max-width: 850px;
  margin: 0 auto;
  background: #fff;
  padding: 40px;
}
.print-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 32px; }
.print-company { font-size: 13px; color: #444; line-height: 1.7; }
.print-company strong { font-size: 20px; color: #1a1f2e; display: block; margin-bottom: 4px; }
.print-title { text-align: right; }
.print-title h1 { font-size: 32px; font-weight: 800; color: var(--accent); letter-spacing: 2px; margin: 0; }
.print-title .quote-num { font-size: 14px; color: #888; margin-top: 4px; }
.print-meta { display: flex; justify-content: space-between; gap: 20px; margin-bottom: 28px; }
.print-box { border: 1px solid #e5e7eb; border-radius: 8px; padding: 14px 18px; flex: 1; }
.print-box h4 { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: #888; margin: 0 0 8px; }
.print-box p { margin: 0; font-size: 13px; line-height: 1.7; color: #333; }
.print-table { width: 100%; border-collapse: collapse; margin-bottom: 20px; }
.print-table th { background: #1a1f2e; color: #fff; padding: 10px 12px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; font-weight: 600; }
.print-table td { padding: 10px 12px; border-bottom: 1px solid #e5e7eb; font-size: 13px; color: #333; }
.print-table tr:last-child td { border-bottom: none; }
.print-table tr:nth-child(even) td { background: #f8f9fc; }
.print-totals { width: 260px; margin-left: auto; }
.print-totals table { width: 100%; }
.print-totals td { padding: 6px 8px; font-size: 13px; }
.print-totals .grand-total td { font-size: 16px; font-weight: 700; color: var(--accent); border-top: 2px solid var(--accent); }
.print-footer { margin-top: 40px; border-top: 1px solid #e5e7eb; padding-top: 20px; display: flex; justify-content: space-between; font-size: 12px; color: #888; }
.print-notes { background: #f8f9fc; border-radius: 8px; padding: 14px 18px; margin-bottom: 24px; font-size: 13px; color: #555; }

/* Add row button */
.btn-add-row { font-size: 13px; border-style: dashed; }

/* Responsive */
@media (max-width: 768px) {
  #sidebar { transform: translateX(-100%); }
  #sidebar.open { transform: translateX(0); }
  #main-content { margin-left: 0; }
}
