:root {
  --bg: #f3f1ec;
  --panel: #fbfaf7;
  --ink: #1e1d1b;
  --ink-2: #5d5a54;
  --line: #dcd7cc;
  --line-2: #ebe7de;
  --accent: #7a2e2e;
  --accent-soft: #f1e2df;
  --good: #2f6b4f;
  --warn-bg: #fbeee0;
  --bar: #b9897c;
  --prev: #a7a39a;
  --fc: #7a2e2e;
  --radius: 6px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #171614; --panel: #1f1e1b; --ink: #ece8df; --ink-2: #a8a399; --line: #3a3732; --line-2: #2b2925;
    --accent: #e09a8c; --accent-soft: #3b2724; --good: #8cc7a6; --warn-bg: #3a2a1c; --bar: #9a6a5e; --prev: #6f6b63; --fc: #e09a8c;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #171614; --panel: #1f1e1b; --ink: #ece8df; --ink-2: #a8a399; --line: #3a3732; --line-2: #2b2925;
  --accent: #e09a8c; --accent-soft: #3b2724; --good: #8cc7a6; --warn-bg: #3a2a1c; --bar: #9a6a5e; --prev: #6f6b63; --fc: #e09a8c;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 14px/1.45 var(--font); }
a { color: var(--accent); }
h1 { font-size: 26px; line-height: 1.2; margin: 0 0 8px; font-weight: 650; letter-spacing: -0.01em; }
h2 { font-size: 17px; margin: 28px 0 10px; font-weight: 620; }
h3 { font-size: 14px; margin: 0 0 6px; font-weight: 600; }
.lead { font-size: 15px; max-width: 78ch; margin: 0 0 14px; }
.quiet { color: var(--ink-2); }
.note { background: var(--warn-bg); padding: 8px 12px; border-radius: var(--radius); max-width: 78ch; }
.strong { font-weight: 700; }

.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px; padding: 10px 20px; background: var(--panel); border-bottom: 1px solid var(--line); }
.brand { font-weight: 750; font-size: 16px; color: var(--ink); text-decoration: none; }
.filemeta { color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 1; }
.filemeta span { opacity: .85; }
.searchbtn { display: flex; align-items: center; gap: 24px; padding: 7px 10px 7px 12px; border: 1px solid var(--line); background: var(--bg); color: var(--ink-2); border-radius: var(--radius); font: inherit; cursor: pointer; min-width: 260px; justify-content: space-between; }
.searchbtn:hover { border-color: var(--ink-2); }
kbd { font: 12px var(--font); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; background: var(--panel); }
.btn { font: inherit; padding: 7px 14px; border-radius: var(--radius); border: 1px solid var(--accent); background: var(--accent); color: #fff; cursor: pointer; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn:hover { filter: brightness(1.08); }

.shell { display: grid; grid-template-columns: 210px minmax(0, 1fr); min-height: calc(100vh - 53px); }
.side { border-right: 1px solid var(--line); padding: 14px 10px; position: sticky; top: 53px; align-self: start; max-height: calc(100vh - 53px); overflow: auto; }
.side a { display: flex; justify-content: space-between; padding: 6px 10px; border-radius: var(--radius); color: var(--ink); text-decoration: none; }
.side a i { font-style: normal; color: var(--ink-2); margin-left: 8px; }
.side a:hover { background: var(--line-2); }
.side a.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.side:empty { display: none; }
.shell:has(.side:empty) { grid-template-columns: minmax(0, 1fr); }
.navgroup { margin: 16px 10px 4px; color: var(--ink-2); font-size: 13px; }
main { padding: 22px 28px 60px; min-width: 0; }
.pagehead { margin-bottom: 8px; }

.controls { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: end; margin: 6px 0 14px; }
.controls label { display: flex; flex-direction: column; gap: 3px; font-size: 13px; color: var(--ink-2); }
.controls label.grow { flex: 1; min-width: 180px; max-width: 320px; }
.controls select, .controls input[type=search] { font: inherit; color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 8px; }
.controls fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 12px 8px; margin: 0; display: flex; flex-wrap: wrap; gap: 4px 16px; }
.controls legend { color: var(--ink-2); font-size: 13px; padding: 0 4px; }
.controls label.radio { flex-direction: row; align-items: center; gap: 6px; color: var(--ink); font-size: 14px; }
.controls output { color: var(--ink); }

.scroll { overflow: auto; max-height: calc(100vh - 230px); border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
table.grid { border-collapse: separate; border-spacing: 0; width: 100%; background: var(--panel); font-variant-numeric: tabular-nums; }
.grid th, .grid td { padding: 7px 10px; border-bottom: 1px solid var(--line-2); text-align: left; vertical-align: middle; }
.grid thead th { position: sticky; top: 0; z-index: 2; background: var(--panel); font-weight: 600; font-size: 13px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.grid th[data-sort] { cursor: pointer; }
.grid th[data-sort]:hover { color: var(--accent); }
.grid .r { text-align: right; white-space: nowrap; }
.grid tfoot td { font-weight: 650; border-top: 1px solid var(--line); border-bottom: 0; }
.grid tr.tot td { font-weight: 600; background: var(--line-2); }
.grid tr.link { cursor: pointer; }
.grid tr.link:hover td { background: var(--accent-soft); }
.grid tr.warn td.r:nth-child(8) { color: var(--accent); font-weight: 650; }
.grid tr.hit td { background: var(--accent-soft); }
table.cats, table.matrix, table.sizes, table.stock { border: 1px solid var(--line); border-radius: var(--radius); }
.bar-h { width: 16%; min-width: 80px; }
.bar { display: block; height: 10px; background: var(--bar); border-radius: 2px; }
.list .imgcell { width: 64px; padding: 4px 6px 4px 10px; position: sticky; left: 0; background: inherit; }
.list .namecell { min-width: 220px; }
.namecell strong { display: block; font-weight: 600; }
.namecell span { color: var(--ink-2); font-size: 13px; }
.ff { display: inline-block; min-width: 30px; text-align: center; border-radius: 3px; padding: 0 6px; font-weight: 600; }
.ff.ok { color: var(--good); border: 1px solid currentColor; }
.ff.no { color: var(--ink-2); }

.row-img, .spot-thumb { width: 48px; height: 62px; object-fit: cover; border-radius: 3px; display: block; background: var(--line-2); }
.spot-thumb { width: 38px; height: 48px; }
.noimg { display: flex; align-items: center; justify-content: center; text-align: center; font-size: 10px; line-height: 1.1; color: var(--ink-2); background: var(--line-2); border-radius: 3px; padding: 2px; }
.tile-img { width: 54px; height: 70px; object-fit: cover; border-radius: 3px; flex: none; background: var(--line-2); }
.hero-img { width: 100%; max-width: 340px; aspect-ratio: 3 / 4; object-fit: cover; border-radius: var(--radius); display: flex; background: var(--line-2); }

.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 28px; }
ol.tiles { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.tiles a { display: flex; gap: 12px; align-items: center; padding: 6px; border-radius: var(--radius); text-decoration: none; color: var(--ink); border: 1px solid transparent; }
.tiles a:hover { border-color: var(--line); background: var(--panel); }
.tiles strong { display: block; font-weight: 600; }
.tiles em { display: block; font-style: normal; color: var(--ink-2); font-size: 13px; }
.tiles b { display: block; font-weight: 600; color: var(--accent); }

.crumbs { margin-bottom: 10px; }
.product { display: grid; grid-template-columns: minmax(200px, 340px) minmax(0, 1fr); gap: 28px; align-items: start; }
.code { color: var(--ink-2); margin: 0 0 14px; }
.facts dl { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px 20px; margin: 0; }
.facts dt, dl.extra dt { color: var(--ink-2); font-size: 13px; }
.facts dd, dl.extra dd { margin: 0; font-weight: 600; }
dl.extra { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px 20px; }
.notes { margin-top: 18px; border-left: 3px solid var(--accent); padding: 2px 0 2px 14px; }
.notes p { margin: 4px 0; }
.notes span { color: var(--ink-2); margin-right: 6px; }
.kv { margin: 8px 0; }
.hscroll { overflow-x: auto; }
.stockbox { max-width: 640px; }
.fc { margin-top: 10px; }
.chartwrap { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; max-width: 640px; }
.chart { width: 100%; height: auto; display: block; }
.chart .axis { stroke: var(--line); }
.chart .b-obs { fill: var(--bar); }
.chart .b-prev { fill: var(--prev); }
.chart .b-fc { fill: var(--fc); }
.chart .val { font: 600 12px var(--font); fill: var(--ink); text-anchor: middle; }
.chart .xl { font: 11.5px/1.25 var(--font); color: var(--ink-2); text-align: center; padding: 0 3px; }

.empty { max-width: 720px; margin: 40px auto; }
.drop { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 44px 20px; border: 2px dashed var(--line); border-radius: 10px; background: var(--panel); cursor: pointer; color: var(--ink-2); margin: 14px 0; text-align: center; }
.drop:hover { border-color: var(--accent); }
.drop-big { font-size: 19px; font-weight: 650; color: var(--ink); }
.watch { margin: 10px 0 0; }
.hist { padding-left: 18px; }
.doc { max-width: 80ch; }
.doc li { margin: 4px 0; }
.methods div { margin: 0 0 12px; }
.methods dt { font-weight: 650; }
.methods dd { margin: 2px 0 0; }
.sheet th { background: var(--line-2); font-weight: 600; text-align: center; }

.spot { position: fixed; inset: 0; z-index: 50; background: rgba(20, 18, 16, .38); display: flex; justify-content: center; align-items: flex-start; padding-top: 12vh; }
.spot[hidden] { display: none; }
.spot-box { width: min(640px, calc(100vw - 32px)); background: var(--panel); border-radius: 10px; box-shadow: 0 18px 60px rgba(0, 0, 0, .28); overflow: hidden; border: 1px solid var(--line); }
.spot-box input { width: 100%; border: 0; border-bottom: 1px solid var(--line); padding: 16px 18px; font: 17px var(--font); background: transparent; color: var(--ink); outline: none; }
.spot-list { max-height: 54vh; overflow: auto; padding: 6px; }
.spot-item { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 6px 10px; border: 0; background: transparent; border-radius: var(--radius); font: inherit; color: var(--ink); cursor: pointer; }
.spot-item.on { background: var(--accent-soft); }
.spot-text { flex: 1; min-width: 0; }
.spot-title { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.spot-title b { color: var(--accent); }
.spot-sub { display: block; color: var(--ink-2); font-size: 13px; }
.spot-type { color: var(--ink-2); font-size: 13px; }
.spot-glyph { width: 38px; height: 38px; display: flex; align-items: center; justify-content: center; color: var(--accent); font-size: 18px; }
.spot-hint { color: var(--ink-2); padding: 10px 12px; margin: 0; }
.spot-keys { margin: 0; padding: 8px 14px; border-top: 1px solid var(--line-2); color: var(--ink-2); font-size: 12.5px; }

.busy { position: fixed; inset: auto 20px 20px auto; z-index: 60; background: var(--ink); color: var(--bg); padding: 10px 14px; border-radius: var(--radius); }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 30px); opacity: 0; transition: .2s; z-index: 60; background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: var(--radius); max-width: min(680px, calc(100vw - 32px)); pointer-events: none; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: var(--accent); color: #fff; }
.dropveil { display: none; }
body.dragging .dropveil { display: flex; position: fixed; inset: 0; z-index: 70; align-items: center; justify-content: center; font-size: 22px; font-weight: 650; background: rgba(122, 46, 46, .82); color: #fff; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; max-height: none; border-right: 0; border-bottom: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 2px; padding: 8px 12px; }
  .navgroup { display: none; }
  main { padding: 16px; }
  .top { flex-wrap: wrap; padding: 10px 16px; }
  .searchbtn { min-width: 0; flex: 1; }
  .filemeta { order: 3; flex-basis: 100%; }
  .two, .product { grid-template-columns: 1fr; }
  .scroll { max-height: none; }
}

/* görünüm geçişi */
.modes { display: flex; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; flex: none; }
.modes button { font: inherit; border: 0; background: transparent; color: var(--ink-2); padding: 7px 12px; cursor: pointer; }
.modes button + button { border-left: 1px solid var(--line); }
.modes button[aria-pressed="true"] { background: var(--accent); color: #fff; }

/* SFS görünümü: raporun Excel'deki hâli */
body.mode-sfs .side { display: none; }
body.mode-sfs .shell { grid-template-columns: minmax(0, 1fr); }
body.mode-sfs main { padding: 0; }
.sfsbar { display: flex; align-items: center; gap: 14px; padding: 8px 16px; border-bottom: 1px solid var(--line); background: var(--panel); flex-wrap: wrap; }
.sfsbar .quiet { flex: 1; min-width: 200px; }
.sfsbar select { font: inherit; margin-left: 6px; padding: 4px 6px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); color: var(--ink); }
.xlwrap { overflow: auto; height: calc(100vh - 53px - 45px - 38px); background: #fff; }
.xltabs { position: sticky; bottom: 0; display: flex; gap: 2px; padding: 0 12px; background: #e9e9e9; border-top: 1px solid #c8c8c8; overflow-x: auto; height: 38px; align-items: stretch; }
.xltabs a { padding: 8px 16px; color: #333; text-decoration: none; white-space: nowrap; border-bottom: 3px solid transparent; }
.xltabs a:hover { background: #dedede; }
.xltabs a.on { background: #fff; color: #1e6b3a; font-weight: 600; border-bottom-color: #1e6b3a; }
table.xl { border-collapse: separate; border-spacing: 0; table-layout: fixed; color: #000; background: #fff; line-height: 1.15; }
.xl td { padding: 1px 3px; overflow: hidden; white-space: nowrap; vertical-align: bottom; background: #fff; border: 0; text-overflow: clip; }
.xl.grid-on td { border-right: 1px solid #e2e2e2; border-bottom: 1px solid #e2e2e2; }
.xl th { background: #f3f3f3; color: #555; font: 11px var(--font); font-weight: 400; border-right: 1px solid #d4d4d4; border-bottom: 1px solid #d4d4d4; padding: 0; text-align: center; }
.xl thead th { position: sticky; top: 0; z-index: 4; }
.xl thead th.fz { z-index: 5; }
.xl th.xl-corner { left: 0; z-index: 6; }
.xl th.xl-rowh { position: sticky; left: 0; z-index: 3; }
.xl th.xl-rowh.fzr { z-index: 5; }
.xl td.fz, .xl td.fzr { position: sticky; z-index: 1; }
.xl td.fz.fzr { z-index: 2; }
.xl tr.xl-hit td, .xl tr.xl-hit th { box-shadow: inset 0 2px 0 #1e6b3a, inset 0 -2px 0 #1e6b3a; }
.xl tr.xl-hit th { background: #1e6b3a; color: #fff; }
.xl td:has(> .xl-img) { vertical-align: middle !important; }
.xl-img { display: block; margin: 0 auto; max-width: 100%; object-fit: contain; }
.xl-link { color: inherit; text-decoration: none; }
.xl-link:hover { text-decoration: underline; color: #1e6b3a; }
@media (max-width: 900px) {
  .modes button { padding: 6px 8px; }
  .xlwrap { height: calc(100vh - 150px); }
}
