:root {
    --bg: #f3f5f8; --surface: #fff; --ink: #16202e; --muted: #5d6b7e; --line: #dde3ea; --grid: #e8ecf1;
    --accent: #0b7a5b; --alt: #1f4f8f; --danger: #b3261e; --series: #1f6fb5;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; font-size: 16px; color: var(--ink);
}
* { box-sizing: border-box; }
html, body, #app { min-height: 100%; margin: 0; }
body { background: var(--bg); }
h1 { font-size: 1.4rem; margin: 0; }
h2 { font-size: 1.05rem; margin: 0; display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 1px solid #b8c2ce; background: var(--surface); border-radius: 8px; padding: .5rem .9rem; }
button:disabled { opacity: .5; cursor: default; }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible, .col:focus-visible { outline: 3px solid #7fb6ff; outline-offset: 1px; }
input, select { border: 1px solid #b8c2ce; border-radius: 8px; padding: .6rem .7rem; background: #fff; width: 100%; }
input[type=checkbox] { width: auto; }
label { display: block; font-size: .85rem; color: var(--muted); margin: .9rem 0 .3rem; }
label.check { display: flex; align-items: center; gap: .5rem; color: var(--ink); font-size: 1rem; }
code { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; background: #eef1f5; padding: .1rem .4rem; border-radius: 5px; font-size: .9em; }
.primary { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 600; }
.link { border: 0; background: none; padding: .3rem .4rem; color: var(--alt); text-decoration: underline; cursor: pointer; }
.error { color: var(--danger); font-weight: 600; margin: .6rem 0; }
.hint { color: var(--muted); font-size: .9rem; margin: .3rem 0 .8rem; }
.empty { color: var(--muted); text-align: center; padding: 1.5rem 0; margin: 0; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.strong { font-weight: 700; }
.boot { display: grid; place-items: center; min-height: 100vh; color: var(--muted); }

.center { min-height: 100vh; display: grid; place-items: center; padding: 1rem; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 1.75rem; width: min(100%, 24rem); }
.card.narrow { margin: 3rem auto; }
.card .primary { width: 100%; margin-top: 1.25rem; padding: .8rem; }

.top { display: flex; align-items: center; gap: 1rem; padding: .55rem 1rem; background: var(--ink); color: #fff; flex-wrap: wrap; position: sticky; top: 0; z-index: 5; }
.top nav { display: flex; gap: .25rem; flex: 1; overflow-x: auto; }
.top nav a { color: #cfd8e3; text-decoration: none; padding: .4rem .7rem; border-radius: 7px; white-space: nowrap; }
.top nav a.active { background: #2b3a4f; color: #fff; font-weight: 600; }
.top .who { color: #b9c4d2; margin-left: auto; }
.top .link { color: #cfe0ff; }
.content { max-width: 72rem; margin: 0 auto; padding: 1.25rem 1rem 3rem; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .75rem; flex-wrap: wrap; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 1rem 1.1rem; margin-top: 1rem; }
.panel > h2 { margin-bottom: .6rem; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: .75rem; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: .9rem 1rem; display: flex; flex-direction: column; gap: .2rem; }
.tile .k { color: var(--muted); font-size: .85rem; }
.tile .v { font-size: 1.55rem; font-weight: 700; font-variant-numeric: tabular-nums; }

.filters { display: flex; gap: .75rem; align-items: flex-end; flex-wrap: wrap; }
.filters label { margin-top: 0; }
.filters .grow { flex: 1; min-width: 14rem; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: .8rem; color: var(--muted); font-weight: 600; padding: .45rem .5rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
th.num { text-align: right; }
td { padding: .55rem .5rem; border-bottom: 1px solid var(--line); }
tr:last-child > td { border-bottom: 0; }
tr.inactive td { color: var(--muted); }
tr.detail > td { background: #f7f9fb; padding: .25rem 1rem .5rem 2rem; }
tr.detail td td { border: 0; padding: .2rem .5rem; font-size: .92rem; }
.badge { border-radius: 999px; padding: .15rem .6rem; font-size: .75rem; font-weight: 600; white-space: nowrap; }
.badge.ok { background: #cfeee2; color: #06513c; }
.badge.off { background: #e3e7ec; color: #3b4758; }
.badge.warn { background: #ffe9b8; color: #5c3c00; }
.badge.bad { background: #ffd9d6; color: #7a1610; }

.backdrop { position: fixed; inset: 0; background: rgba(22, 32, 46, .45); display: grid; place-items: center; padding: 1rem; z-index: 20; }
.modal { background: var(--surface); border-radius: 14px; padding: 1.25rem 1.4rem 1.4rem; width: min(100%, 34rem); max-height: 92vh; overflow: auto; }
.modal.wide { width: min(100%, 48rem); }
fieldset.variants { border: 1px solid var(--line); border-radius: 10px; margin: 1.1rem 0 0; padding: .4rem .9rem .9rem; min-width: 0; }
fieldset.variants legend { font-weight: 600; padding: 0 .4rem; }
.gen { display: grid; grid-template-columns: 1fr 1fr auto; gap: .75rem; align-items: end; margin-bottom: .6rem; }
.gen label { margin-top: 0; }
.vtable td { padding: .25rem .3rem; border-bottom: 0; }
.vtable td input:not([type=checkbox]) { padding: .4rem .5rem; min-width: 5rem; }
.vtable td.c { text-align: center; }
.modal-head { display: flex; justify-content: space-between; align-items: center; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: .75rem; }
.row3 .span2 { grid-column: span 2; align-self: end; }
.actions { display: flex; justify-content: flex-end; gap: .6rem; margin-top: 1.25rem; }
.code { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 2rem; font-weight: 700; letter-spacing: .15em; text-align: center; background: #eef1f5; border-radius: 10px; padding: .8rem; margin: .5rem 0; user-select: all; }

/* Günlük ciro grafiği: tek seri, tabana oturan ince çubuklar, geri planda kalan eksen. */
.chart { margin: 0; }
.chart figcaption { font-weight: 600; margin-bottom: .9rem; }
.plot { display: flex; gap: .6rem; height: 13rem; }
.yaxis { display: flex; flex-direction: column; justify-content: space-between; font-size: .72rem; color: var(--muted); text-align: right; padding-bottom: 1.4rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bars { flex: 1; display: flex; align-items: stretch; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 1.4rem;
        background: linear-gradient(var(--grid), var(--grid)) 0 0 / 100% 1px no-repeat, linear-gradient(var(--grid), var(--grid)) 0 50% / 100% 1px no-repeat; }
.col { flex: 1; position: relative; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; min-width: 0; border-radius: 4px; }
.bar { width: min(100%, 2.2rem); background: var(--series); border-radius: 4px 4px 0 0; min-height: 0; }
.col:hover .bar, .col:focus .bar { background: #174f82; }
.xl { position: absolute; top: 100%; margin-top: .3rem; font-size: .72rem; color: var(--muted); }
.tip { display: none; position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; border-radius: 8px; padding: .4rem .6rem; font-size: .8rem; white-space: nowrap; z-index: 3; flex-direction: column; gap: .1rem; pointer-events: none; }
.tip span { color: #c8d2de; }
.col:hover .tip, .col:focus .tip { display: flex; }
.col:first-child .tip { left: 0; transform: none; }
.col:last-child .tip { left: auto; right: 0; transform: none; }

#blazor-error-ui { display: none; position: fixed; inset: auto 0 0 0; background: #ffd9d6; color: #7a1610; padding: .7rem 1rem; z-index: 50; }

@media (max-width: 640px) {
    .top .who { display: none; }
    .top nav { order: 3; flex-basis: 100%; }
    .row3, .row2, .gen { grid-template-columns: 1fr; }
    .row3 .span2 { grid-column: auto; }
    .tile .v { font-size: 1.3rem; }
    .yaxis { display: none; }
}

input.qty { width: 5.5rem; }

/* Etiketler: ekranda gizli, yazdırırken sayfadaki tek içerik. Ölçüler gerçek milimetredir. */
.print-only { display: none; }
@media print {
    html, body, #app { min-height: 0; background: #fff; }
    .top, .backdrop, .content > *:not(.labels), #blazor-error-ui { display: none !important; }
    .content { max-width: none; margin: 0; padding: 0; }
    .labels.print-only { display: block; }
    .label { overflow: hidden; display: flex; flex-direction: column; color: #000; font-family: Arial, Helvetica, sans-serif; break-inside: avoid; }
    .l-name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .l-variant { font-weight: 700; }
    .barcode { width: 100%; flex: 1; min-height: 0; margin: 0.6mm 0; }
    .l-foot { display: flex; justify-content: space-between; align-items: baseline; }
    .l-code { font-family: "Courier New", monospace; }
    .l-price { font-weight: 700; }

    /* Rulo: her etiket ayrı sayfa. */
    .labels.roll .label { width: 50mm; height: 30mm; padding: 1.5mm 2mm; font-size: 8pt; break-after: page; }
    .labels.roll .l-price { font-size: 11pt; }
    .labels.roll .l-code { font-size: 6.5pt; }

    /* A4, 3 × 8 = 24 etiket, 70 × 37 mm; sayfa kenar boşlukları LabelSheet'teki @page kuralından gelir. */
    .labels.a4-24 { display: grid; grid-template-columns: repeat(3, 70mm); grid-auto-rows: 37mm; }
    .labels.a4-24 .label { padding: 3mm 5mm; font-size: 9pt; }
    .labels.a4-24 .l-price { font-size: 12pt; }
    .labels.a4-24 .l-code { font-size: 7pt; }
    .labels.a4-24 .label:nth-child(24n) { break-after: page; }

    /* A4, 5 × 13 = 65 etiket, 38,1 × 21,2 mm; kenarlar 4,75 mm ve 10,7 mm. */
    .labels.a4-65 { display: grid; grid-template-columns: repeat(5, 38.1mm); column-gap: 2.5mm; grid-auto-rows: 21.2mm; }
    .labels.a4-65 .label { padding: 1mm 1.5mm; font-size: 6pt; }
    .labels.a4-65 .l-price { font-size: 8pt; }
    .labels.a4-65 .l-code { font-size: 5pt; }
    .labels.a4-65 .label:nth-child(65n) { break-after: page; }
}

/* Stok */
.page-head .actions { display: flex; flex-wrap: wrap; gap: .5rem; }
h2.section { font-size: 1.05rem; margin: 1.6rem 0 .6rem; }
.matrix { width: auto; }
.matrix th, .matrix td { padding: .3rem .7rem; border-bottom: 0; }
.matrix th[scope=row] { text-align: left; font-weight: 600; }
.matrix td.zero { color: var(--muted); }
.neg { color: #b3261e; }
.matrix.entry td { padding: .2rem .25rem; }
.matrix.entry input.qty { width: 4.2rem; text-align: right; padding: .4rem .5rem; }
.picklist { list-style: none; margin: .4rem 0; padding: 0; border: 1px solid var(--line); border-radius: 8px; max-height: 12rem; overflow: auto; }
.picklist li { border-bottom: 1px solid var(--line); padding: .15rem .6rem; }
.picklist li:last-child { border-bottom: 0; }
.doclines { margin-top: .8rem; }
.muted { color: var(--muted); }
.link.danger { color: var(--danger); }

/* Düşük stok */
td.low { color: #8a4b00; font-weight: 600; }
.lowbar { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; margin: 1rem 0; padding: .6rem .9rem; border: 1px solid #f0d9a8; background: #fff8e8; border-radius: .6rem; }
.lowbar strong { color: #8a4b00; }
.costrow { display: flex; align-items: end; gap: .75rem; flex-wrap: wrap; margin-top: .6rem; }
.costrow input { width: 9rem; }

/* Kampanyalar */
.promo-badge { margin-left: .4rem; }
.chips { display: flex; flex-wrap: wrap; gap: .4rem .9rem; margin: .25rem 0 .5rem; max-height: 11rem; overflow: auto; }
.chips .picked { display: inline-flex; align-items: center; gap: .3rem; background: #e3e7ec; border-radius: 999px; padding: .15rem .3rem .15rem .7rem; font-size: .9rem; }
.kinds { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; margin-bottom: .75rem; }
.kinds button { text-align: left; padding: .6rem .75rem; }
.kinds button.on { border-color: var(--accent, #0b6bcb); box-shadow: inset 0 0 0 1px var(--accent, #0b6bcb); font-weight: 600; }
.kinds small { display: block; font-weight: 400; color: #5d6b7e; }
@media (max-width: 640px) { .kinds { grid-template-columns: 1fr; } }

/* Raporlar */
.tabs { display: flex; flex-wrap: wrap; gap: .4rem; margin: 0 0 .75rem; }
.tabs button.on { background: var(--ink, #16202e); color: #fff; border-color: var(--ink, #16202e); }
tfoot td { font-weight: 700; border-top: 2px solid #c9d1db; }
.matrix td, .matrix th { text-align: center; }
.matrix td .sold { font-weight: 700; display: block; }
.matrix td .stk { font-size: .8rem; color: #5d6b7e; }
.matrix td.zero .sold { color: #9aa5b4; font-weight: 400; }
.bar { display: inline-block; height: .5rem; background: #7fb2e6; border-radius: 3px; vertical-align: middle; margin-right: .4rem; }

/* Tara (mobil) */
.scan-video { width: 100%; max-height: 42vh; background: #000; border-radius: 12px; object-fit: cover; display: block; }
.scan-box { position: relative; margin-bottom: .75rem; }
.scan-box::after { content: ""; position: absolute; left: 8%; right: 8%; top: 50%; height: 2px; background: rgba(255, 60, 60, .8); pointer-events: none; }
.scan-card h2 { margin: 0 0 .15rem; font-size: 1.2rem; }
.scan-card .price { font-size: 1.5rem; font-weight: 700; }
tr.hit td { background: #fff6d6; font-weight: 600; }
.stepper { display: inline-flex; align-items: center; gap: .35rem; }
.stepper button { min-width: 2.4rem; min-height: 2.4rem; padding: 0; font-size: 1.1rem; }
.stepper input { width: 4rem; text-align: center; }
.pick { display: flex; flex-wrap: wrap; gap: .4rem; margin: .5rem 0; }
.transit { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .6rem 0; border-top: 1px solid #e3e7ec; }
.transit:first-of-type { border-top: 0; }
@media (max-width: 640px) {
    .top nav { display: flex; overflow-x: auto; white-space: nowrap; -webkit-overflow-scrolling: touch; }
    .tabs button, .filters button { min-height: 2.6rem; }
    #count-table th, #count-table td { padding-left: .3rem; padding-right: .3rem; }
    .stepper { gap: .2rem; }
    .stepper button { min-width: 2.1rem; }
    .stepper input { width: 2.8rem; padding-left: .2rem; padding-right: .2rem; }
}

.conds { margin: .5rem 0 .75rem; padding: .5rem .75rem; border: 1px solid #dde3ea; border-radius: 10px; }
.conds summary { cursor: pointer; font-weight: 600; margin-bottom: .4rem; }
.hours { display: flex; align-items: center; gap: .4rem; }

/* Uyarılar */
.top nav .count { display: inline-block; margin-left: .35rem; min-width: 1.25rem; padding: 0 .35rem; border-radius: 999px; background: #d93025; color: #fff; font-size: .72rem; font-weight: 700; line-height: 1.25rem; text-align: center; }
.alerts { list-style: none; margin: 0; padding: 0; }
.alerts li { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; padding: .6rem .4rem; border-bottom: 1px solid var(--line); }
.alerts li:last-child { border-bottom: 0; }
.alerts li.new { background: #fff8e6; }
.alerts .what { flex: 1; min-width: 12rem; font-weight: 600; }
.alerts .when { font-size: .85rem; }
#push-box .actions { display: flex; gap: .75rem; align-items: center; margin-top: .5rem; }
