:root {
  --bg: #f1f5f9;
  --panel: #ffffff;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --accent: #0ea5a4;
  --accent-dark: #0b7c7b;
  --amber: #f59e0b;
  --red: #dc2626;
  --green: #16a34a;
  --blue: #2563eb;
  --sidebar: #0b1526;
  --sidebar-ink: #cbd5e1;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 8px 24px -12px rgba(15, 23, 42, .18);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
}
button { font: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent-dark); text-decoration: none; }
.boot-loading { display: grid; place-items: center; height: 100vh; color: var(--muted); font-size: 15px; }

/* ---------- giriş ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; background:
  radial-gradient(1200px 600px at 80% -10%, #134e4a33, transparent),
  radial-gradient(900px 500px at -10% 110%, #0ea5a422, transparent), var(--bg); }
.login-card { width: 380px; background: var(--panel); border-radius: 16px; box-shadow: var(--shadow); padding: 32px; }
.login-card .logo { display: flex; align-items: center; gap: 10px; font-size: 20px; font-weight: 700; margin-bottom: 6px; }
.logo-mark { width: 34px; height: 34px; border-radius: 9px; background: var(--accent); display: grid; place-items: center; color: #fff; font-size: 18px; }
.login-card p.sub { color: var(--muted); margin: 0 0 22px; }
.login-hint { margin-top: 18px; padding: 10px 12px; background: #f0fdfa; border: 1px solid #ccfbf1; border-radius: 8px; color: #115e59; font-size: 12.5px; }

/* ---------- kabuk ---------- */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.sidebar { background: var(--sidebar); color: var(--sidebar-ink); padding: 18px 12px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; }
.sidebar .brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 700; font-size: 16px; padding: 4px 10px 16px; }
.sidebar .brand .logo-mark { background: var(--accent); }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar nav a { color: var(--sidebar-ink); padding: 9px 12px; border-radius: 8px; display: flex; gap: 10px; align-items: center; }
.sidebar nav a:hover { background: #ffffff10; color: #fff; }
.sidebar nav a.active { background: var(--accent); color: #fff; }
.sidebar .foot { margin-top: auto; font-size: 12px; color: #64748b; padding: 10px; }
.main { padding: 0 28px 40px; min-width: 0; }
.topbar { display: flex; align-items: center; gap: 14px; padding: 16px 0; position: sticky; top: 0; background: linear-gradient(var(--bg) 85%, transparent); z-index: 20; flex-wrap: wrap; }
.topbar h1 { font-size: 20px; margin: 0 auto 0 0; }
.proj-select { min-width: 200px; }
.whoami { display: flex; align-items: center; gap: 10px; color: var(--muted); }
.whoami b { color: var(--ink); }
.role-chip { background: #e0f2f1; color: #00695c; padding: 2px 8px; border-radius: 99px; font-size: 12px; }

/* ---------- bileşenler ---------- */
.btn { border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 8px 14px; }
.btn:hover { border-color: #cbd5e1; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-dark); }
.btn.danger { color: var(--red); border-color: #fecaca; }
.btn.danger:hover { background: #fef2f2; }
.btn.sm { padding: 4px 10px; font-size: 13px; border-radius: 7px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.card { background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin-bottom: 18px; }
.card h2 { font-size: 15px; margin: 0 0 12px; }
.card h2 .right { float: right; font-weight: 400; font-size: 13px; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat { background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; }
.stat .label { color: var(--muted); font-size: 12.5px; }
.stat .value { font-size: 21px; font-weight: 700; margin-top: 3px; }
.stat .value small { font-size: 12px; color: var(--muted); font-weight: 400; }
.stat.warn .value { color: var(--red); }
.stat.good .value { color: var(--green); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid-3 { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 18px; }
@media (max-width: 1100px) { .grid-3, .grid-2 { grid-template-columns: 1fr; } }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th { text-align: left; color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 9px 10px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
.tbl tr:hover td { background: #f8fafc; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.badge { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge.musait { background: #ecfdf5; color: #047857; }
.badge.rezerve { background: #fffbeb; color: #b45309; }
.badge.satildi { background: #eef2ff; color: #4338ca; }
.badge.talep { background: #e0f2fe; color: #0369a1; }
.badge.teklif { background: #fef9c3; color: #a16207; }
.badge.opsiyon { background: #fce7f3; color: #be185d; }
.badge.satis { background: #dcfce7; color: #15803d; }
.badge.kayip { background: #f3f4f6; color: #6b7280; }
.badge.gec { background: #fee2e2; color: #b91c1c; }
.badge.ok { background: #dcfce7; color: #15803d; }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.tabs button { border: 1px solid var(--line); background: #fff; border-radius: 99px; padding: 6px 14px; }
.tabs button.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.field label { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.field input, .field select, .field textarea { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: #fff; width: 100%; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid #99f6e4; border-color: var(--accent); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.progressbar { height: 8px; background: #e2e8f0; border-radius: 99px; overflow: hidden; min-width: 80px; }
.progressbar > div { height: 100%; background: var(--accent); border-radius: 99px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.mt0 { margin-top: 0; }
.empty { color: var(--muted); text-align: center; padding: 26px 10px; }

/* ---------- modal & toast ---------- */
.modal-back { position: fixed; inset: 0; background: #0f172a66; display: grid; place-items: center; z-index: 100; padding: 20px; }
.modal { background: #fff; border-radius: 14px; width: 560px; max-width: 96vw; max-height: 90vh; overflow: auto; padding: 22px; }
.modal.wide { width: 820px; }
.modal h3 { margin: 0 0 16px; font-size: 17px; display: flex; align-items: center; }
.modal h3 .x { margin-left: auto; border: 0; background: none; font-size: 20px; color: var(--muted); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
#toast-root { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { background: #0f172a; color: #fff; padding: 10px 18px; border-radius: 99px; font-size: 13.5px; box-shadow: var(--shadow); animation: pop .18s ease; }
.toast.err { background: var(--red); }
@keyframes pop { from { transform: translateY(8px); opacity: 0; } }

/* ---------- rapor ---------- */
.report-sheet { background: #fff; max-width: 860px; margin: 0 auto; padding: 34px; border-radius: var(--radius); box-shadow: var(--shadow); }
.report-sheet h1 { font-size: 21px; margin: 0 0 2px; }
.report-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 18px 0; }
.report-kpis .kpi { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.report-kpis .kpi .l { font-size: 11.5px; color: var(--muted); text-transform: uppercase; }
.report-kpis .kpi .v { font-size: 17px; font-weight: 700; margin-top: 2px; }
.report-sheet table.tbl td, .report-sheet table.tbl th { padding: 6px 8px; }
@media print {
  body { background: #fff; }
  .sidebar, .topbar, .no-print { display: none !important; }
  .shell { display: block; }
  .main { padding: 0; }
  .report-sheet { box-shadow: none; padding: 10px; max-width: none; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; }
  .sidebar nav { flex-direction: row; flex-wrap: wrap; }
  .sidebar .foot { display: none; }
  .main { padding: 0 14px 30px; }
}
