/* ============================================================
   Evrenkaya Sipariş — krem zemin + yumurta sarısı vurgu
   ============================================================ */
:root {
  --bg: #FAF6EE;
  --panel: #FFFFFF;
  --ink: #2B2722;
  --ink-soft: #6B6258;
  --line: #E5DCCB;
  --accent: #C97B12;       /* yumurta sarısı koyu */
  --accent-soft: #F5E3C2;
  --green: #2E7D32;
  --green-soft: #E3F1E4;
  --warn: #B3541E;
  --warn-soft: #FBEadd;
  --red: #C00000;          /* rapor çerçevesi (Excel taslağı) */
  --navy: #1F3864;         /* rapor başlığı */
  --radius: 10px;
  --firm1: #C97B12;        /* sipariş ekranında firma temasıyla ezilir */
  --firm2: #F5E3C2;
  --firm1-ink: #FFFFFF;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", "Inter", system-ui, sans-serif;
  font-size: 15px;
}

/* ---------- Üst bar ---------- */
.topbar {
  display: flex; align-items: center; gap: 24px;
  background: var(--ink);
  color: #F5EFE3;
  padding: 0 20px;
  position: sticky; top: 0; z-index: 50;
}
.brand { display: flex; align-items: center; gap: 9px; color: inherit; text-decoration: none; padding: 12px 0; }
.brand-egg { width: 18px; height: 23px; background: #E8A13D; border-radius: 50% 50% 50% 50% / 60% 60% 42% 42%; display: inline-block; }
.brand-text { font-size: 17px; letter-spacing: .3px; }
.brand-text strong { color: #E8A13D; }
#mainNav { display: flex; gap: 2px; flex-wrap: wrap; }
#mainNav a {
  color: #D8CFC0; text-decoration: none; padding: 14px 13px; font-size: 14px;
  border-bottom: 3px solid transparent;
}
#mainNav a:hover { color: #fff; }
#mainNav a.active { color: #fff; border-bottom-color: #E8A13D; }

main { max-width: 1180px; margin: 0 auto; padding: 26px 20px 80px; }

h1 { font-size: 24px; margin: 0 0 4px; }
.sub { color: var(--ink-soft); margin: 0 0 22px; font-size: 14px; }
h2 { font-size: 17px; margin: 0 0 12px; }

/* ---------- Kartlar / paneller ---------- */
.grid { display: grid; gap: 18px; }
.grid.cols-2 { grid-template-columns: 1fr 1fr; }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 860px) { .grid.cols-2, .grid.cols-3 { grid-template-columns: 1fr; } }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
}

.dash-card {
  display: block; text-decoration: none; color: inherit;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; transition: border-color .15s, transform .15s;
}
.dash-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.dash-card .num { font-size: 30px; font-weight: 700; color: var(--accent); }
.dash-card .lbl { font-size: 14px; color: var(--ink-soft); margin-top: 2px; }
.dash-card .go { font-size: 13px; margin-top: 10px; color: var(--accent); font-weight: 600; }

/* ---------- Form ---------- */
label.fld { display: block; margin-bottom: 13px; font-size: 13.5px; color: var(--ink-soft); font-weight: 600; }
label.fld > span { display: block; margin-bottom: 5px; }
input[type="text"], input[type="number"], input[type="date"], select {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 7px;
  font: inherit; color: var(--ink); background: #fff;
}
input:focus, select:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
input[readonly] { background: var(--accent-soft); border-color: transparent; font-weight: 700; color: var(--ink); }
input[type="color"] { width: 52px; height: 36px; padding: 2px; border: 1px solid var(--line); border-radius: 7px; background: #fff; }
.row { display: flex; gap: 12px; align-items: end; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 130px; }
.row > .narrow { flex: 0 0 auto; min-width: 0; }

.btn {
  display: inline-block; border: none; cursor: pointer; font: inherit; font-weight: 700;
  background: var(--accent); color: #fff; padding: 10px 20px; border-radius: 8px;
}
.btn:hover { filter: brightness(1.08); }
.btn.secondary { background: transparent; color: var(--ink-soft); border: 1px solid var(--line); font-weight: 600; }
.btn.small { padding: 5px 11px; font-size: 13px; font-weight: 600; }
.btn.danger { background: transparent; border: 1px solid #E2B4B4; color: #A33; }
.btn.danger:hover { background: #FBEDED; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- Tablolar ---------- */
table.list { width: 100%; border-collapse: collapse; }
table.list th {
  text-align: left; font-size: 12.5px; text-transform: uppercase; letter-spacing: .4px;
  color: var(--ink-soft); padding: 8px 10px; border-bottom: 2px solid var(--line);
}
table.list td { padding: 9px 10px; border-bottom: 1px solid var(--line); }
table.list tr:last-child td { border-bottom: none; }
table.list td.r, table.list th.r { text-align: right; }
.muted { color: var(--ink-soft); font-size: 13px; }
.empty { color: var(--ink-soft); padding: 26px; text-align: center; }

.swatch { display: inline-block; width: 17px; height: 17px; border-radius: 5px; vertical-align: -3px; border: 1px solid rgba(0,0,0,.12); }
.chip {
  display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 12.5px; font-weight: 600;
  background: var(--accent-soft); color: var(--ink);
}

/* ---------- Sipariş formu (firma teması) ---------- */
.order-head {
  background: var(--firm1); color: var(--firm1-ink);
  border-radius: var(--radius); padding: 16px 20px; margin-bottom: 18px;
  display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  border-bottom: 5px solid var(--firm2);
}
.order-head .t { font-size: 19px; font-weight: 800; }
.order-head .d { font-size: 13.5px; opacity: .9; }
.order-lines td input { max-width: 140px; text-align: right; font-weight: 700; }
.unit-tag { font-weight: 700; color: var(--accent); margin-left: 7px; font-size: 13px; }
.calc { font-size: 12.5px; color: var(--ink-soft); white-space: nowrap; }

.palet-note {
  border: 2px dashed var(--accent); border-radius: var(--radius); background: var(--accent-soft);
  padding: 13px 16px; font-size: 14px;
}
.palet-note .big { font-size: 23px; font-weight: 800; letter-spacing: .3px; }
.palet-note.whole { border-color: var(--green); background: var(--green-soft); }
.palet-note.whole .big { color: var(--green); }
.palet-note .hint { font-size: 12.5px; color: var(--ink-soft); margin-top: 3px; }

.order-grid { grid-template-columns: 2fr 1fr; align-items: start; }

.summary-box { position: sticky; top: 70px; }
.summary-box .line { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.summary-box .line:last-of-type { border-bottom: none; }
.summary-box .line b { font-variant-numeric: tabular-nums; }

/* ---------- Haftalık Program (Excel taslağı görünümü) ---------- */
.report-controls { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.week-nav { display: flex; align-items: center; gap: 8px; }
.week-nav .wk { font-weight: 800; min-width: 210px; text-align: center; }
.toggle { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; }
.toggle button { border: none; background: none; font: inherit; font-size: 13px; padding: 8px 13px; cursor: pointer; color: var(--ink-soft); }
.toggle button.on { background: var(--ink); color: #fff; font-weight: 700; }

.report-title { text-align: center; color: var(--navy); font-size: 21px; font-weight: 800; text-decoration: underline; margin: 6px 0 14px; letter-spacing: .5px; }

/* Tablo genişliği sabit kalır; çok depo varsa sayfa içinde sağa-sola kaydırılır */
.haftalik-wrap { overflow-x: auto; padding-bottom: 8px; }
table.haftalik { border-collapse: collapse; background: #fff; width: auto; }
table.haftalik td, table.haftalik th { border: 1px solid #BFBFBF; padding: 6px 10px; font-size: 15px; }
table.haftalik td.day {
  border: 2.5px solid var(--red); text-align: center;
  width: 96px; min-width: 96px; font-size: 14px; background: #fff;
}
table.haftalik td.day .dt { font-weight: 700; }
table.haftalik td.day .dn { font-weight: 800; margin-top: 5px; }
/* Gün ayracı: kırmızı çizgi tablonun tamamı boyunca devam eder */
table.haftalik td.day-top { border-top: 2.5px solid var(--red); }
table.haftalik tr.weektotal td { border-top: 2.5px solid var(--red); }
table.haftalik td.rowlabel { font-weight: 800; width: 62px; min-width: 62px; background: #FBF9F4; }
table.haftalik td.val {
  text-align: right; font-variant-numeric: tabular-nums; font-weight: 800;
  width: 110px; min-width: 110px; max-width: 110px;
}
table.haftalik td.val.zero, table.haftalik td.tot.zero { font-weight: 400; color: var(--ink-soft); }
table.haftalik td.yer {
  font-weight: 800; width: 110px; min-width: 110px; max-width: 110px;
  overflow-wrap: break-word; line-height: 1.25; vertical-align: middle;
}
table.haftalik td.yer .dep { font-size: 14px; }
table.haftalik td.yer .firm { font-size: 11.5px; font-weight: 600; opacity: .9; margin-top: 2px; }
table.haftalik td.tot {
  text-align: right; font-weight: 800; background: var(--accent-soft);
  width: 104px; min-width: 104px;
}
table.haftalik tr.weektotal td { background: var(--ink); color: #fff; font-weight: 800; border-color: var(--ink); border-top-color: var(--red); }

/* ---------- Giriş ekranı ---------- */
body.locked #mainNav { display: none; }
.login-wrap { display: flex; justify-content: center; padding-top: 9vh; }
.login-box { width: 100%; max-width: 370px; }
.login-brand { display: flex; align-items: center; gap: 10px; font-size: 21px; margin-bottom: 4px; }
.login-brand b { color: var(--accent); }
.login-err {
  margin-top: 12px; color: #8E2A2A; background: #FBEDED;
  padding: 9px 13px; border-radius: 7px; font-size: 13.5px;
}

/* ---------- Bildirim ---------- */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 11px 22px; border-radius: 9px;
  font-size: 14px; z-index: 99; box-shadow: 0 6px 24px rgba(0,0,0,.25);
}
.toast.err { background: #8E2A2A; }

/* ---------- Siparişler: tamamlandı durumu ---------- */
tr.done-row td { opacity: .55; }
tr.done-row td:last-child { opacity: 1; }
.chip.done { background: var(--green-soft); color: var(--green); }
.btn.complete { background: var(--green); }

/* ---------- Sipariş fişi (GEÇİCİ yazdırma formatı) ---------- */
.print-only { display: none; }
.fis { page-break-after: always; padding: 10mm 4mm; font-size: 13px; color: #000; }
.fis-head { display: flex; justify-content: space-between; align-items: baseline; border-bottom: 2.5px solid #000; padding-bottom: 6px; margin-bottom: 10px; }
.fis-brand { font-size: 17px; font-weight: 800; letter-spacing: .5px; }
.fis-no { font-size: 14px; }
.fis-meta { width: 100%; border-collapse: collapse; margin-bottom: 12px; }
.fis-meta td { border: 1px solid #888; padding: 6px 10px; }
.fis-meta td span { display: block; font-size: 10.5px; color: #555; }
.fis-meta td b { font-size: 13.5px; }
.fis-lines { width: 100%; border-collapse: collapse; }
.fis-lines th { border: 1px solid #555; background: #EEE; padding: 5px 8px; text-align: left; font-size: 11.5px; }
.fis-lines th.r, .fis-lines td.r { text-align: right; }
.fis-lines td { border: 1px solid #888; padding: 5px 8px; }
.fis-lines tr.fis-total td { font-weight: 800; background: #F4F4F4; border-top: 2px solid #000; }
.fis-foot { margin-top: 8px; font-size: 11.5px; color: #444; }

/* ---------- Mobil (telefon) ---------- */
@media (max-width: 760px) {
  body { font-size: 14px; }
  .topbar { padding: 0 10px; gap: 10px; }
  .brand-text { font-size: 15px; }
  #mainNav { overflow-x: auto; flex-wrap: nowrap; white-space: nowrap; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  #mainNav::-webkit-scrollbar { display: none; }
  #mainNav a { padding: 13px 9px; font-size: 13px; }
  main { padding: 16px 12px 60px; }
  h1 { font-size: 20px; }
  .panel { padding: 13px; overflow-x: auto; }
  .order-grid { grid-template-columns: 1fr; }
  .summary-box { position: static; }
  .order-head { padding: 12px 14px; }
  .order-lines td input { max-width: 96px; }
  .order-lines .meta-extra { display: none; }
  .report-controls { gap: 8px; }
  .week-nav .wk { min-width: 0; font-size: 14px; }
  table.list th, table.list td { padding: 7px 6px; font-size: 13.5px; }
  table.haftalik td, table.haftalik th { padding: 5px 7px; font-size: 14px; }
  table.haftalik td.val, table.haftalik td.yer { width: 96px; min-width: 96px; max-width: 96px; }
  .btn { padding: 9px 14px; }
  input[type="text"], input[type="number"], input[type="date"], select { font-size: 16px; } /* iOS zoom engeli */
}

/* ---------- Yazdırma ---------- */
@media print {
  .topbar, .report-controls, .no-print, .orders-screen { display: none !important; }
  .print-only { display: block; }
  main { max-width: none; padding: 0; }
  body { background: #fff; }
}
