/* Siyah-beyaz tema. Renk yok: durumlar şekille anlatılır (çerçeve = azalıyor, taralı = tükendi). */
:root {
  color-scheme: light;
  --paper: #fcfcfb;
  --ink: #141414;
  --mute: #5c5c5c;
  --hair: #dcdcd9;
  --wash: #f1f1ef;
  /* üst çubuk ve açılış ekranı */
  --bar: #141414;
  --bar-ink: #fcfcfb;
  --bar-edge: transparent;
  --shade: rgba(20, 20, 20, .45);
  --font: "Helvetica Neue", Helvetica, Arial, "Segoe UI", system-ui, sans-serif;
}
/* Koyu tema: saf siyah/beyaz yerine yumuşak gri tonlar, göz yormaz. */
:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #18191b;
  --ink: #e4e4e1;
  --mute: #9a9b9e;
  --hair: #313236;
  --wash: #212225;
  --bar: #212225;
  --bar-ink: #e4e4e1;
  --bar-edge: #2c2d31;
  --shade: rgba(0, 0, 0, .6);
}
/* Tema değişirken renkler yumuşakça geçsin. */
@media (prefers-reduced-motion: no-preference) {
  .theme-fade, .theme-fade *, .theme-fade *::before, .theme-fade *::after {
    transition: background-color .35s ease, color .35s ease, border-color .35s ease, fill .35s ease, stroke .35s ease !important;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 15px/1.45 var(--font); font-variant-numeric: tabular-nums;
}
h1, h2, h3, p { margin: 0; }
button, input, select { font: inherit; color: inherit; }
a { color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
.top :focus-visible, #splash :focus-visible { outline-color: var(--bar-ink); }
.muted { color: var(--mute); }
.sm { font-size: 13px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- ortak bileşenler ---------- */
label { display: grid; gap: 6px; font-size: 14px; color: var(--mute); }
input, select {
  width: 100%; background: var(--paper); border: 1.5px solid var(--ink); border-radius: 0;
  padding: 11px 12px; color: var(--ink); min-height: 44px;
}
input[type="checkbox"] { width: 20px; height: 20px; min-height: 0; accent-color: var(--ink); }
input::placeholder { color: var(--mute); opacity: .8; }
button {
  cursor: pointer; background: var(--paper); border: 1.5px solid var(--ink); border-radius: 0;
  padding: 0 16px; min-height: 44px; font-weight: 600;
  transition: background .12s, color .12s, transform .08s;
}
button:hover:not(:disabled) { background: var(--ink); color: var(--paper); }
button:active:not(:disabled) { transform: translateY(1px); }
button:disabled { opacity: .35; cursor: default; }
button.primary { background: var(--ink); color: var(--paper); }
button.primary:hover:not(:disabled) { background: var(--paper); color: var(--ink); }
button.wide { width: 100%; }
button.small { min-height: 34px; padding: 0 12px; font-size: 13px; }
button.quiet { border-color: transparent; background: none; color: var(--ink); text-decoration: underline; text-underline-offset: 3px; padding: 0 8px; }
button.quiet:hover:not(:disabled) { background: none; color: var(--ink); text-decoration-thickness: 3px; }
.btn {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; border: 1.5px solid var(--ink);
  font-weight: 600; text-decoration: none;
}
.btn:hover { background: var(--ink); color: var(--paper); }
.err { font-weight: 600; min-height: 0; }
.err:not(:empty) { border: 1.5px solid var(--ink); padding: 9px 12px; }
.tag { display: inline-block; border: 1.5px solid var(--ink); padding: 0 7px; font-size: 12px; font-weight: 700; line-height: 20px; white-space: nowrap; }
.tag.solid { background: var(--ink); color: var(--paper); }
.tag.inv { border-color: var(--paper); }
.tag.dash { border-style: dashed; }
.check { display: flex; align-items: center; gap: 10px; color: var(--ink); }
.hint { font-size: 13px; color: var(--mute); }

/* ---------- giriş ekranı ---------- */
.auth { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px 20px; }
.auth-box { width: 100%; max-width: 380px; border-top: 6px solid var(--ink); padding-top: 24px; }
.auth-box .mark { margin-bottom: 18px; }
.auth-box h1 { font-size: 34px; font-weight: 800; letter-spacing: -.03em; line-height: 1.05; }
.auth-box .lead { margin: 8px 0 24px; color: var(--mute); }
.auth-box form { display: grid; gap: 16px; }
.auth-box .switch { margin-top: 18px; width: 100%; }
.logo { display: block; max-height: 56px; max-width: 200px; width: auto; height: auto; }
.mono {
  display: inline-grid; place-items: center; width: 52px; height: 52px; background: var(--ink); color: var(--paper);
  font-weight: 800; font-size: 26px; letter-spacing: -.02em;
}
.mono.sm { width: 32px; height: 32px; font-size: 17px; background: var(--paper); color: var(--ink); }

/* ---------- üst çubuk ---------- */
.top {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 18px; background: var(--bar); color: var(--bar-ink); box-shadow: 0 1px 0 var(--bar-edge);
}
.top .tag.inv { border-color: var(--bar-ink); }
.top .mono.sm { background: var(--bar-ink); color: var(--bar); }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-name { font-weight: 800; font-size: 18px; letter-spacing: -.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.logo-tile { background: #fff; padding: 3px 7px; display: inline-flex; }
:root[data-theme="dark"] .logo-tile, :root[data-theme="dark"] .sp-logo { background: #e4e4e1; }
.logo-tile img { display: block; height: 26px; width: auto; max-width: 110px; }
.who { display: flex; align-items: center; gap: 8px; flex: none; }
.uname { font-weight: 600; }
.hbtn {
  background: none; border: 1.5px solid transparent; color: var(--bar-ink); min-height: 36px; padding: 0 10px; font-weight: 600;
  display: inline-flex; align-items: center;
}
.hbtn:hover:not(:disabled) { background: var(--bar-ink); color: var(--bar); }
.hbtn svg { transition: transform .4s cubic-bezier(.2, .8, .2, 1); }
:root[data-theme="dark"] .hbtn svg { transform: rotate(180deg); }
.live { width: 10px; height: 10px; border: 2px solid var(--bar-ink); border-radius: 50%; flex: none; }
.live.on { background: var(--bar-ink); animation: beat 2.4s ease-out infinite; }
@keyframes beat { 0% { box-shadow: 0 0 0 0 var(--bar-ink); } 70%, 100% { box-shadow: 0 0 0 8px transparent; } }

.wrap { max-width: 1060px; margin: 0 auto; padding: 22px 16px 80px; }

/* ---------- özet şeridi ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); border: 1.5px solid var(--ink); margin-bottom: 26px; }
.stat { padding: 12px 16px; border-right: 1px solid var(--hair); border-bottom: 1px solid var(--hair); margin: 0 -1px -1px 0; }
.stat span { display: block; font-size: 13px; color: var(--mute); }
.stat b { display: block; font-size: 26px; font-weight: 800; letter-spacing: -.03em; line-height: 1.15; }
.stat small { display: block; font-size: 12px; color: var(--mute); }

/* ---------- sekmeler ---------- */
.tabs { display: flex; gap: 22px; margin-bottom: 18px; border-bottom: 1.5px solid var(--ink); overflow-x: auto; }
.tabs button {
  border: 0; background: none; min-height: 44px; padding: 0 2px; font-weight: 600; color: var(--mute);
  border-bottom: 4px solid transparent; margin-bottom: -1.5px; white-space: nowrap;
}
.tabs button:hover:not(:disabled) { background: none; color: var(--ink); }
.tabs button.on { color: var(--ink); border-bottom-color: var(--ink); }
.subtabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.subtabs button { min-height: 36px; font-size: 14px; }
.subtabs button.on { background: var(--ink); color: var(--paper); }

/* ---------- araç çubuğu ---------- */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 18px; }
.toolbar input[type="search"], .toolbar input[type="text"] { flex: 1 1 200px; width: auto; }
.toolbar select { flex: 0 1 190px; width: auto; }
.toolbar input[type="date"] { flex: 0 1 160px; width: auto; }
.chip { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); min-height: 44px; cursor: pointer; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chips button { min-height: 34px; font-size: 13px; padding: 0 12px; }
.chips button.on { background: var(--ink); color: var(--paper); }

/* ---------- ürün ve beden matrisi ---------- */
.prod { border-top: 3px solid var(--ink); margin-bottom: 30px; }
.phead { display: flex; justify-content: space-between; gap: 16px; padding: 12px 0 10px; align-items: flex-start; }
.phead h3 { font-size: 21px; font-weight: 800; letter-spacing: -.02em; line-height: 1.2; }
.pmeta { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 14px; color: var(--mute); margin-top: 4px; }
.ptotal { text-align: right; flex: none; }
.ptotal b { display: block; font-size: 34px; font-weight: 800; letter-spacing: -.04em; line-height: 1; }
.ptotal span { font-size: 13px; color: var(--mute); }
.mxwrap { overflow-x: auto; margin: 0 -2px; padding: 2px; }
.mx { border-collapse: collapse; width: 100%; min-width: max-content; }
.mx th, .mx td { padding: 0; text-align: center; border: 1px solid var(--hair); }
.mx thead th { font-size: 13px; font-weight: 800; height: 34px; padding: 0 6px; border-bottom: 1.5px solid var(--ink); }
.mx tbody th {
  text-align: left; padding: 0 14px 0 4px; font-weight: 600; white-space: nowrap; border-left: 0;
  position: sticky; left: 0; background: var(--paper); z-index: 1; min-width: 92px;
}
.mx .tot { color: var(--mute); font-weight: 700; padding: 0 10px; font-size: 14px; border-right: 0; }
.mx tfoot td, .mx tfoot th { border-bottom: 0; border-top: 1.5px solid var(--ink); font-size: 14px; height: 32px; }
.mx tfoot th { text-align: left; padding: 0 4px; color: var(--mute); font-weight: 600; position: sticky; left: 0; background: var(--paper); }
.cell {
  display: grid; place-items: center; width: 100%; min-width: 54px; height: 50px; border: 0; padding: 0;
  background: none; font-weight: 800; font-size: 18px; color: var(--ink); position: relative;
}
.cell span { display: inline-block; min-width: 30px; line-height: 28px; padding: 0 4px; }
.cell:hover:not(:disabled) { background: var(--ink); color: var(--paper); }
.cell.low span { border: 2px solid currentColor; border-radius: 15px; }
.cell.out { color: var(--mute); background-image: repeating-linear-gradient(135deg, transparent 0 5px, var(--hair) 5px 6px); }
.cell.out span { font-weight: 600; background: var(--paper); border-radius: 3px; }
.cell.out:hover:not(:disabled) { color: var(--paper); }
.cell.out:hover:not(:disabled) span { background: var(--ink); }
.cell.empty { color: var(--hair); font-weight: 400; font-size: 20px; }
.cell.empty:hover:not(:disabled) { color: var(--paper); }
.cell.flash span { animation: flash 1.2s ease-out; }
@keyframes flash { 0% { background: var(--ink); color: var(--paper); transform: scale(1.35); } 100% { background: transparent; transform: none; } }
.pact { display: flex; gap: 8px; flex-wrap: wrap; padding-top: 10px; }
.empty-state { padding: 56px 0; text-align: left; }
.empty-state h3 { font-size: 22px; font-weight: 800; letter-spacing: -.02em; margin-bottom: 6px; }
.empty-state p { color: var(--mute); margin-bottom: 18px; }
.legend { display: flex; gap: 20px; flex-wrap: wrap; font-size: 13px; color: var(--mute); margin: -4px 0 18px; align-items: center; }
.legend i { display: inline-block; vertical-align: middle; margin-right: 6px; width: 26px; height: 20px; text-align: center; font-style: normal; font-weight: 800; color: var(--ink); line-height: 16px; }
.legend i.l { border: 2px solid var(--ink); border-radius: 12px; }
.legend i.o { background-image: repeating-linear-gradient(135deg, transparent 0 4px, var(--mute) 4px 5px); border: 1px solid var(--hair); }

/* ---------- tablolar ---------- */
.tblwrap { overflow-x: auto; border-top: 3px solid var(--ink); }
.tbl { width: 100%; border-collapse: collapse; min-width: 560px; }
.tbl th, .tbl td { text-align: left; padding: 10px 12px 10px 0; border-bottom: 1px solid var(--hair); vertical-align: middle; }
.tbl th { font-size: 13px; color: var(--mute); font-weight: 600; white-space: nowrap; border-bottom: 1.5px solid var(--ink); }
.tbl .r { text-align: right; }
.tbl tr.void td { color: var(--mute); text-decoration: line-through; }
.tbl tr.void td:last-child, .tbl tr.void td.keep { text-decoration: none; }
.tbl .acts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.sumline { display: flex; gap: 8px 28px; flex-wrap: wrap; padding: 12px 0; font-size: 14px; color: var(--mute); }
.sumline b { color: var(--ink); font-size: 17px; letter-spacing: -.02em; }

/* ---------- yönetici özeti ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); border-top: 3px solid var(--ink); margin-bottom: 26px; }
.kpi { padding: 12px 16px 12px 0; }
.kpi span { display: block; font-size: 13px; color: var(--mute); }
.kpi b { display: block; font-size: 28px; font-weight: 800; letter-spacing: -.04em; line-height: 1.15; }
.kpi small { font-size: 12px; color: var(--mute); }
.panel { margin-bottom: 30px; }
.panel h2 { font-size: 18px; font-weight: 800; letter-spacing: -.02em; padding-bottom: 8px; border-bottom: 1.5px solid var(--ink); margin-bottom: 12px; display: flex; justify-content: space-between; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.panel h2 .chips { font-weight: 400; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 0 40px; }
.chart { display: block; width: 100%; height: 170px; color: var(--ink); }
.chart rect { fill: currentColor; }
.chart rect:hover { opacity: .55; }
.chart line { stroke: var(--ink); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.axis { display: flex; justify-content: space-between; font-size: 12px; color: var(--mute); padding-top: 6px; }
.hb { margin-bottom: 12px; }
.hb-top { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; }
.hb-top span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hb-top b { white-space: nowrap; }
.hb-bar { height: 8px; background: var(--wash); margin-top: 4px; border: 1px solid var(--hair); }
.hb-bar i { display: block; height: 100%; width: 0; background: var(--ink); transition: width .7s cubic-bezier(.2, .8, .2, 1); }
.lowlist { list-style: none; margin: 0; padding: 0; }
.lowlist li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--hair); font-size: 14px; }
.lowlist b { min-width: 40px; text-align: right; }
.settings { display: grid; gap: 18px; max-width: 460px; }
.dl { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- pencere ---------- */
dialog {
  border: 2px solid var(--ink); border-radius: 0; background: var(--paper); color: var(--ink); padding: 0;
  width: min(94vw, 430px); max-height: 92vh;
}
dialog::backdrop { background: var(--shade); }
dialog[open] { animation: pop .18s ease-out; }
@keyframes pop { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.dlg-form { display: grid; gap: 14px; padding: 20px; }
.dlg-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.dlg-form h3 { font-size: 20px; font-weight: 800; letter-spacing: -.02em; }
.dlg-form .row { display: flex; gap: 8px; justify-content: flex-end; margin-top: 4px; flex-wrap: wrap; }
.x { border: 0; background: none; font-size: 26px; line-height: 1; min-height: 36px; width: 36px; padding: 0; margin: -6px -8px 0 0; }
.big { font-size: 64px; font-weight: 800; letter-spacing: -.05em; line-height: 1; }
.big span { font-size: 16px; font-weight: 600; letter-spacing: 0; color: var(--mute); }
.menu { display: grid; gap: 8px; }
.pwshow { font-size: 30px; font-weight: 800; letter-spacing: .06em; border: 1.5px dashed var(--ink); padding: 14px; text-align: center; user-select: all; }

#toast {
  position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translate(-50%, 16px);
  background: var(--ink); color: var(--paper); padding: 12px 18px; font-weight: 600; max-width: min(92vw, 520px);
  border: 2px solid var(--paper); outline: 2px solid var(--ink); opacity: 0; pointer-events: none; transition: .2s; z-index: 200;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- "site güncellendi" kutusu ---------- */
#update {
  position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 150;
  width: min(calc(100vw - 32px), 360px); padding: 18px 20px 16px;
  background: var(--paper); color: var(--ink); border: 2px solid var(--ink); border-top-width: 6px;
  box-shadow: 0 12px 32px var(--shade); animation: updIn .35s cubic-bezier(.2, .8, .2, 1);
}
#update h3 { font-size: 19px; font-weight: 800; letter-spacing: -.02em; }
#update p { margin: 6px 0 14px; color: var(--mute); font-size: 14px; }
#update .row { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
@keyframes updIn { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }

/* ---------- yükleniyor iskeleti ---------- */
.skel {
  height: 64px; margin-bottom: 12px;
  background: linear-gradient(90deg, var(--wash) 30%, var(--hair) 50%, var(--wash) 70%); background-size: 200% 100%;
  animation: shimmer 1.3s linear infinite;
}
.skel.tall { height: 170px; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }

/* ---------- hoş geldin animasyonu ---------- */
#splash {
  position: fixed; inset: 0; z-index: 100; background: var(--bar); color: var(--bar-ink);
  display: grid; place-items: center; padding: 24px; cursor: pointer;
  transition: transform .6s cubic-bezier(.75, 0, .2, 1);
}
#splash.out { transform: translateY(-100%); }
.sp-inner { text-align: center; max-width: 100%; }
.sp-logo { display: inline-block; background: #fff; padding: 16px 22px; animation: spLogo .8s cubic-bezier(.2, .8, .2, 1) both; }
.sp-logo img { display: block; max-height: 84px; max-width: min(60vw, 240px); width: auto; height: auto; }
.sp-mono { display: inline-grid; place-items: center; width: 84px; height: 84px; background: var(--bar-ink); color: var(--bar); font-size: 44px; font-weight: 800; animation: spLogo .8s cubic-bezier(.2, .8, .2, 1) both; }
.sp-hello { margin-top: 30px; font-size: 20px; font-weight: 500; opacity: 0; animation: spUp .6s .55s ease-out forwards; }
.sp-name {
  display: flex; justify-content: center; flex-wrap: wrap; margin-top: 2px;
  font-size: clamp(44px, 13vw, 92px); font-weight: 800; letter-spacing: -.04em; line-height: 1.05;
}
.sp-name .ch { display: inline-block; opacity: 0; transform: translateY(.45em); animation: chIn .55s cubic-bezier(.2, .8, .2, 1) forwards; }
.sp-rule { height: 4px; width: 0; background: var(--bar-ink); margin: 18px auto 0; animation: spRule .9s 1.25s cubic-bezier(.2, .8, .2, 1) forwards; }
@keyframes spLogo { from { opacity: 0; transform: scale(.8); } to { opacity: 1; transform: none; } }
@keyframes spUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes chIn { to { opacity: 1; transform: none; } }
@keyframes spRule { to { width: min(60vw, 280px); } }

@media (max-width: 560px) {
  .top { padding: 8px 12px; }
  .uname { display: none; }
  .brand-name { font-size: 16px; }
  .wrap { padding: 16px 12px 80px; }
  .stat b { font-size: 22px; }
  .stat:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .cell { min-width: 44px; height: 48px; font-size: 17px; }
  .mx tbody th { min-width: 66px; padding-right: 8px; }
  .mx .tot { padding: 0 6px; }
  .mx thead th { padding: 0 3px; }
  .phead h3 { font-size: 19px; }
  .ptotal b { font-size: 28px; }
  .toolbar select { flex: 1 1 140px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0s !important; transition-duration: .01ms !important; }
  .sp-hello, .sp-name .ch { opacity: 1; transform: none; }
  .sp-rule { width: 200px; }
}
