/* Layout: sticky signage header + tab strip, one working column; equipment as dense rows with a status stripe, detail in a dialog. */
:root {
  --bg: #F1F2F0; --surface: #FFFFFF; --sunk: #E7E9E6; --ink: #1B1E1D; --muted: #5B625F; --line: #D6DAD6;
  --red: #C42B1F; --red-ink: #FFFFFF; --ok: #2C7A4C; --warn: #A86C12; --bad: #C42B1F; --fault: #6A4CA6;
  --ok-bg: #E3F1E8; --warn-bg: #F7ECD9; --bad-bg: #F8E1DE; --fault-bg: #ECE6F6;
  --f-display: "Barlow Condensed", "Arial Narrow", Arial, sans-serif;
  --f-body: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --f-mono: "IBM Plex Mono", Consolas, monospace;
}
@media (prefers-color-scheme: dark) { :root {
  --bg: #111312; --surface: #1A1D1C; --sunk: #0C0E0D; --ink: #ECEEEC; --muted: #9BA39F; --line: #2C312F;
  --red: #E8574A; --red-ink: #1A0907; --ok: #52B47F; --warn: #E2A84A; --bad: #EF6A5C; --fault: #A98DE3;
  --ok-bg: #16281E; --warn-bg: #2C2213; --bad-bg: #321816; --fault-bg: #221B33; color-scheme: dark } }

* { box-sizing: border-box }
[hidden] { display: none !important }
html { padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px) }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--f-body); font-size: 15px; line-height: 1.45; -webkit-tap-highlight-color: transparent }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--surface) }
button, input, select, textarea { font: inherit; color: inherit }
img { max-width: 100% }
.wrap { max-width: 1080px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)) }

.mark { width: 34px; height: 34px; flex: none; background: var(--red) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 3h5M12 3v3'/%3E%3Cpath d='M14 6h-4a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h4a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2z'/%3E%3Cpath d='M14 6l4-2v4'/%3E%3C/svg%3E") center / 20px no-repeat; border-radius: 6px }
.mark.big { width: 64px; height: 64px; background-size: 38px; border-radius: 14px }
.boot { min-height: 70vh; display: grid; place-content: center; justify-items: center; gap: 8px; color: var(--muted) }

header.top { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; background: var(--surface); border-bottom: 1px solid var(--line) }
.bar { display: flex; align-items: center; gap: 12px; padding-block: 12px }
.brand { min-width: 0; flex: 1 }
.brand h1 { margin: 0; font-family: var(--f-display); font-weight: 700; font-size: 22px; letter-spacing: .04em; text-transform: uppercase; line-height: 1 }
.brand small { display: block; color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line); background: var(--surface); padding: 9px 14px; border-radius: 8px; cursor: pointer; font-weight: 500; white-space: nowrap; text-decoration: none }
.btn:hover { border-color: var(--muted) }
.btn:focus-visible, .tab:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, .row:focus-visible, .stat:focus-visible { outline: 2px solid var(--red); outline-offset: 2px }
.btn.primary { background: var(--red); border-color: var(--red); color: var(--red-ink) }
.btn.ghost { border-color: transparent; background: transparent }
.btn.danger { color: var(--bad) }
.btn:disabled { opacity: .5; cursor: not-allowed }
.btn svg { width: 18px; height: 18px }
.quick { display: flex; gap: 6px; flex: 0 1 220px; min-width: 0 }
.quick input { min-width: 0; width: 100% }
nav.tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none }
.tab { border: 0; background: none; padding: 10px 12px; cursor: pointer; color: var(--muted); font-weight: 500; border-bottom: 3px solid transparent; white-space: nowrap }
.tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--red) }

main { padding-block: 20px 60px; display: grid; gap: 20px }
h2 { font-family: var(--f-display); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; font-size: 19px; margin: 0; text-wrap: balance }
.sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap }
.muted { color: var(--muted) }
.mono { font-family: var(--f-mono); font-size: .92em }
.note { font-size: 13px; color: var(--muted) }
.stack { display: grid; gap: 10px }

.stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; text-align: left; cursor: pointer; display: grid; gap: 2px }
.stat b { font-family: var(--f-display); font-size: 34px; line-height: 1; font-variant-numeric: tabular-nums }
.stat span { font-size: 12.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 500 }
.stat.s-ok b { color: var(--ok) } .stat.s-soon b { color: var(--warn) } .stat.s-overdue b { color: var(--bad) } .stat.s-fault b { color: var(--fault) }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; overflow: hidden }
.pad { padding: 16px; display: grid; gap: 12px }
.list { display: grid }
.row { display: grid; grid-template-columns: 5px minmax(0, 1.1fr) minmax(0, 1.4fr) minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 11px 14px 11px 0; border: 0; border-top: 1px solid var(--line); cursor: pointer; background: none; text-align: left; width: 100% }
.row:first-child { border-top: 0 }
.row:hover { background: var(--sunk) }
.stripe { align-self: stretch; border-radius: 0 3px 3px 0 }
.row .code { font-family: var(--f-mono); font-weight: 500 }
.row .sub { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap }
.row .cell { min-width: 0 }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; padding: 3px 9px; border-radius: 99px; white-space: nowrap }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor }
.k-ok { color: var(--ok); background: var(--ok-bg) } .k-soon { color: var(--warn); background: var(--warn-bg) }
.k-overdue { color: var(--bad); background: var(--bad-bg) } .k-fault { color: var(--fault); background: var(--fault-bg) }
.k-missing { color: var(--muted); background: var(--sunk) } .k-empty { color: var(--bad); background: var(--bad-bg); outline: 1px solid var(--bad) }
.st-ok { background: var(--ok) } .st-soon { background: var(--warn) } .st-overdue { background: var(--bad) } .st-fault { background: var(--fault) } .st-missing { background: var(--line) }
.st-empty { background: repeating-linear-gradient(45deg, var(--bad) 0 3px, var(--bad-bg) 3px 6px) }

.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center }
.filters input[type=search] { flex: 1 1 220px; min-width: 0 }
input[type=text], input[type=search], input[type=date], input[type=number], input[type=email], input[type=password], input[type=url], select, textarea { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; width: 100% }
.filters select { width: auto }
textarea { min-height: 140px; font-family: var(--f-mono); font-size: 13px }
label.f { display: grid; gap: 4px; font-size: 13px; color: var(--muted); font-weight: 500; min-width: 0 }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px }

.zones { display: grid; gap: 8px; padding: 14px }
.zone { display: grid; grid-template-columns: minmax(90px, 160px) 1fr auto; gap: 10px; align-items: center; font-size: 13.5px }
.zone .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap }
.zone .bars { display: flex; height: 10px; border-radius: 3px; overflow: hidden; background: var(--sunk) }
.zone .n { font-variant-numeric: tabular-nums; color: var(--muted) }
.legend { display: inline-flex; gap: 6px; align-items: center } .legend i { width: 10px; height: 10px; border-radius: 2px; display: inline-block }

.empty { padding: 32px 20px; text-align: center; display: grid; gap: 10px; justify-items: center }
.empty p { margin: 0; max-width: 46ch; color: var(--muted) }
.two { display: grid; grid-template-columns: 1.4fr 1fr; gap: 20px; align-items: start }
.two > * { min-width: 0 }

/* giriş ve firma kurulumu */
.auth { max-width: 420px; margin: 6vh auto 0; display: grid; gap: 18px }
.auth .head { display: flex; gap: 12px; align-items: center }
.auth h1 { margin: 0; font-family: var(--f-display); font-size: 30px; letter-spacing: .04em; text-transform: uppercase; line-height: 1 }
.or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px } .or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line) }
.err { color: var(--bad); font-size: 13.5px; margin: 0 }

dialog { border: 1px solid var(--line); border-radius: 12px; padding: 0; background: var(--surface); color: var(--ink); width: min(680px, calc(100vw - 24px)); max-height: calc(100dvh - 24px) }
dialog::backdrop { background: rgb(0 0 0 / .45) }
.dlg-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); z-index: 1 }
.dlg-head h3 { margin: 0; font-family: var(--f-display); font-size: 22px; letter-spacing: .03em; flex: 1; min-width: 0 }
.dlg-body { padding: 16px; display: grid; gap: 16px }
.dlg-foot { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; padding: 12px 16px; border-top: 1px solid var(--line); position: sticky; bottom: 0; background: var(--surface) }
dl.facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 0 }
dl.facts div { min-width: 0 } dl.facts dt { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em } dl.facts dd { margin: 2px 0 0; font-weight: 500; overflow-wrap: anywhere }
.due { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px }
.due div { border: 1px solid var(--line); border-radius: 8px; padding: 10px; display: grid; gap: 2px; font-size: 13px }
.due b { font-variant-numeric: tabular-nums; font-size: 15px }
.due .late { border-color: var(--bad); background: var(--bad-bg) } .due .near { border-color: var(--warn); background: var(--warn-bg) }
.qrbox { display: flex; gap: 14px; align-items: center; flex-wrap: wrap }
.qrbox .q { background: #fff; padding: 8px; border-radius: 6px; line-height: 0 }
.checks { display: grid; gap: 6px }
.checks label { display: flex; gap: 10px; align-items: flex-start; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer }
.checks input { width: 20px; height: 20px; margin-top: 1px; accent-color: var(--ok); flex: none }
.checks input.bad { accent-color: var(--bad) }
.seg { display: flex; flex-wrap: wrap; gap: 6px }
.seg label { border: 1px solid var(--line); border-radius: 99px; padding: 7px 13px; cursor: pointer; font-size: 13.5px; position: relative }
.seg input { position: absolute; opacity: 0; pointer-events: none }
.seg label:has(input:checked) { background: var(--ink); color: var(--bg); border-color: var(--ink) }
.seg label:has(input:focus-visible) { outline: 2px solid var(--red); outline-offset: 2px }
.hist .h { display: grid; grid-template-columns: 96px 1fr; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); font-size: 13.5px }
.hist .h:first-child { border-top: 0 }
.tourbar { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted) }
.tourbar .track { flex: 1; height: 6px; background: var(--sunk); border-radius: 3px; overflow: hidden }
.tourbar .track i { display: block; height: 100%; background: var(--ok) }
.members .m { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 10px; align-items: center; padding: 10px 14px; border-top: 1px solid var(--line) }
.members .m:first-child { border-top: 0 }
.code-big { font-family: var(--f-mono); font-size: 26px; letter-spacing: .18em; font-weight: 500 }

/* canlı QR tarayıcı */
.scanner { position: relative; background: #000; border-radius: 8px; overflow: hidden; aspect-ratio: 3 / 4; max-height: 60dvh; width: 100% }
.scanner video { width: 100%; height: 100%; object-fit: cover; display: block }
.scanner .frame { position: absolute; inset: 18%; border: 3px solid rgb(255 255 255 / .85); border-radius: 12px; box-shadow: 0 0 0 999px rgb(0 0 0 / .35) }

.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(18px + env(safe-area-inset-bottom, 0px)); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 8px; z-index: 50; font-weight: 500; max-width: calc(100vw - 32px) }
.banner { border: 1px solid var(--warn); background: var(--warn-bg); color: var(--ink); padding: 10px 14px; border-radius: 8px; font-size: 14px }
.table-wrap { overflow-x: auto } table { border-collapse: collapse; width: 100%; font-size: 13.5px } th, td { text-align: left; padding: 8px 10px; border-top: 1px solid var(--line); white-space: nowrap } th { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; border-top: 0 }

/* yazdırılabilir etiket sayfası (A4, 3 x 8, 70 x 37 mm) */
.labels-print { background: #fff; color: #000 }
.labels-print .lbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 12px 16px; border-bottom: 1px solid #ccc; font-family: var(--f-body) }
.labels-print .g { display: grid; grid-template-columns: repeat(3, 70mm); grid-auto-rows: 37mm; justify-content: center; padding: 8mm 0 }
.labels-print .l { box-sizing: border-box; border: 1px dashed #bbb; padding: 2.5mm; display: flex; gap: 2.5mm; align-items: center; overflow: hidden; break-inside: avoid }
.labels-print .l img { width: 31mm; height: 31mm; flex: none }
.labels-print .l b { display: block; font-size: 17pt; font-family: "Courier New", monospace; line-height: 1.1 }
.labels-print .l span { display: block; font-size: 8pt; color: #333 }
.labels-print .l em { display: block; font-size: 7pt; color: #c42b1f; margin-top: 1mm; font-style: normal; font-weight: bold }
body.printing > *:not(#labels) { display: none !important }
@media print {
  @page { size: A4; margin: 13mm 6mm }
  body { background: #fff }
  body > *:not(#labels) { display: none !important }
  .labels-print .lbar { display: none }
  .labels-print .g { padding: 0 }
}

@media (max-width: 760px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)) } .stats .stat:first-child { grid-column: 1 / -1 }
  .two { grid-template-columns: 1fr }
  .row { grid-template-columns: 5px minmax(0, 1fr) auto } .row .c-loc, .row .c-due { display: none }
  dl.facts, .due { grid-template-columns: repeat(2, minmax(0, 1fr)) }
  .scan-label, .brand small { display: none }
  .quick { flex: 1 1 120px } .quick .btn { display: none }
}
@media (max-width: 420px) { .grid2 { grid-template-columns: 1fr } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important } }
