/* KnittingEye Uretim Raporu
   Renk rolleri: --run (calisma), --ke (KnittingEye durdurmasi), --other (diger durus),
   --nodata (kayit yok, tarali gri). Paletin CVD/kontrast dogrulamasi yapildi. */
:root {
  color-scheme: light;
  --page: #f4f4f1;
  --surface: #fcfcfb;
  --surface-2: #f3f2ee;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #7c7a74;
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --border: rgba(11, 11, 11, 0.10);
  --accent: #1d4ed8;
  --accent-soft: #e7eefc;
  --run: #1baf7a;
  --ke: #eb6834;
  --other: #6250d6;
  --nodata-a: #e6e5df;
  --nodata-b: #f5f4f0;
  --warn: #fab219;
  --warn-ink: #8a5a00;
  --warn-soft: #fff4d6;
  --bad: #d03b3b;
  --good-ink: #006300;
  --shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 4px 16px rgba(0, 0, 0, .04);
  --radius: 14px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #0f0f0e;
    --surface: #1a1a19;
    --surface-2: #232321;
    --ink: #f0efec;
    --ink-2: #c3c2b7;
    --muted: #9a988f;
    --grid: #2c2c2a;
    --axis: #383835;
    --border: rgba(255, 255, 255, 0.10);
    --accent: #6d9cf5;
    --accent-soft: #1d2740;
    --run: #199e70;
    --ke: #d95926;
    --other: #9085e9;
    --nodata-a: #2c2c2a;
    --nodata-b: #222220;
    --warn-ink: #fab219;
    --warn-soft: #3a2d0c;
    --good-ink: #0ca30c;
    --shadow: none;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0f0f0e; --surface: #1a1a19; --surface-2: #232321; --ink: #f0efec; --ink-2: #c3c2b7;
  --muted: #9a988f; --grid: #2c2c2a; --axis: #383835; --border: rgba(255, 255, 255, 0.10);
  --accent: #6d9cf5; --accent-soft: #1d2740; --run: #199e70; --ke: #d95926; --other: #9085e9;
  --nodata-a: #2c2c2a; --nodata-b: #222220; --warn-ink: #fab219; --warn-soft: #3a2d0c;
  --good-ink: #0ca30c; --shadow: none;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--page); color: var(--ink);
  font-family: var(--font); font-size: 16px; line-height: 1.45;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select { font: inherit; color: inherit; }
.wrap { max-width: 1240px; margin: 0 auto; padding: 0 20px; }
@media (max-width: 640px) { .wrap { padding: 0 16px; } }

/* ---------------------------------------------------------------- ust bar */
.topbar { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
.topbar .wrap { display: flex; align-items: center; gap: 16px; min-height: 60px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 650; font-size: 18px; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; background: var(--ink); color: var(--surface);
  display: grid; place-items: center; font-size: 15px; font-weight: 700; }
.brand small { font-weight: 500; color: var(--muted); font-size: 15px; }
.topbar .spacer { flex: 1; }
.sync-pill { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink-2); }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; }
.dot.ok { background: var(--run); }
.dot.warn { background: var(--warn); }
.dot.bad { background: var(--bad); }
.dot.idle { background: var(--axis); }

.btn { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--border); background: var(--surface);
  border-radius: 10px; padding: 8px 14px; cursor: pointer; font-size: 15px; font-weight: 500; white-space: nowrap; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:disabled { opacity: .55; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.05); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.danger { color: var(--bad); }
.btn.sm { padding: 5px 10px; font-size: 14px; }
.spin { display: inline-block; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------- arac cubugu */
.toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin: 22px 0 6px; }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 12px; padding: 4px; gap: 2px; }
.seg button { border: 0; background: transparent; border-radius: 9px; padding: 8px 16px; cursor: pointer;
  font-size: 15px; font-weight: 500; color: var(--ink-2); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.08); font-weight: 600; }
.datenav { display: inline-flex; align-items: center; gap: 4px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 3px; }
.datenav button { border: 0; background: transparent; width: 36px; height: 36px; border-radius: 9px; cursor: pointer; font-size: 20px; color: var(--ink-2); }
.datenav button:hover:not(:disabled) { background: var(--surface-2); }
.datenav button:disabled { opacity: .3; cursor: default; }
.datenav .label { padding: 0 10px; min-width: 190px; text-align: center; line-height: 1.15; }
.datenav .label b { display: block; font-size: 16px; font-weight: 600; }
.datenav .label span { font-size: 13px; color: var(--muted); }
.custom-range { display: none; align-items: center; gap: 8px; }
.custom-range.show { display: inline-flex; }
.custom-range input { border: 1px solid var(--border); background: var(--surface); border-radius: 10px; padding: 7px 10px; }
.machine-select { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; }
.machine-select label { color: var(--muted); font-size: 14px; }
.machine-select select { border: 1px solid var(--border); background: var(--surface); border-radius: 10px; padding: 8px 12px; font-size: 15px; font-weight: 600; min-width: 190px; }
@media (max-width: 760px) { .machine-select { margin-left: 0; } .datenav .label { min-width: 150px; } }

.crumb { margin: 10px 0 0; font-size: 15px; color: var(--muted); min-height: 22px; }
.crumb a { color: var(--ink-2); }
.crumb b { color: var(--ink); }

/* ---------------------------------------------------------------- kartlar */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.section { margin-top: 22px; }
.section-head { display: flex; align-items: baseline; gap: 12px; margin: 0 0 10px; flex-wrap: wrap; }
.section-head h2 { font-size: 19px; margin: 0; font-weight: 650; }
.section-head .hint { color: var(--muted); font-size: 14px; }
.section-head .right { margin-left: auto; }

.summary { display: grid; grid-template-columns: minmax(300px, 1.25fr) 2fr; gap: 16px; margin-top: 14px; }
@media (max-width: 980px) { .summary { grid-template-columns: 1fr; } }
.hero { padding: 22px 24px; display: flex; flex-direction: column; gap: 14px; }
.hero .kicker { font-size: 15px; color: var(--ink-2); font-weight: 500; }
.hero .big { font-size: 64px; font-weight: 650; line-height: 1; letter-spacing: -1px; }
.hero .big small { font-size: 28px; font-weight: 600; margin-left: 2px; }
.hero .sentence { font-size: 16px; color: var(--ink-2); }
.hero .sentence b { color: var(--ink); font-weight: 600; }

.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
@media (max-width: 560px) { .tiles { grid-template-columns: 1fr; } }
.tile { padding: 18px 20px; display: flex; flex-direction: column; gap: 4px; min-height: 132px; }
.tile .t-label { display: flex; align-items: center; gap: 8px; font-size: 15px; color: var(--ink-2); font-weight: 500; }
.tile .t-value { font-size: 34px; font-weight: 650; line-height: 1.15; letter-spacing: -.5px; }
.tile .t-value small { font-size: 18px; font-weight: 600; color: var(--ink-2); }
.tile .t-sub { font-size: 14px; color: var(--muted); }
.tile .t-sub b { color: var(--ink-2); font-weight: 600; }
.swatch { width: 12px; height: 12px; border-radius: 3px; display: inline-block; flex: none; }
.sw-run { background: var(--run); } .sw-ke { background: var(--ke); } .sw-other { background: var(--other); }
.sw-nodata { background: repeating-linear-gradient(45deg, var(--nodata-a) 0 3px, var(--nodata-b) 3px 6px); border: 1px solid var(--grid); }

.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; padding: 3px 9px; border-radius: 999px; }
.chip.warn { background: var(--warn-soft); color: var(--warn-ink); }
.chip.muted { background: var(--surface-2); color: var(--ink-2); }

/* ---------------------------------------------------------------- oran cubugu & zaman seridi */
.propbar { display: flex; height: 18px; border-radius: 6px; overflow: hidden; gap: 2px; background: var(--surface); }
.propbar > i { display: block; height: 100%; min-width: 2px; }
.propbar.lg { height: 26px; border-radius: 8px; }
.st-run { background: var(--run); } .st-ke { background: var(--ke); } .st-other { background: var(--other); }
.st-nodata { background: repeating-linear-gradient(45deg, var(--nodata-a) 0 4px, var(--nodata-b) 4px 8px); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 14px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.legend b { color: var(--ink); font-weight: 600; }

.timeline { position: relative; height: 26px; border-radius: 6px; overflow: hidden; background: var(--surface-2); }
.timeline > i { position: absolute; top: 0; bottom: 0; }
.timeline > i.clickable { cursor: pointer; }
.timeline > i.clickable:hover { filter: brightness(1.12); outline: 2px solid var(--ink); outline-offset: -2px; z-index: 2; }
.timeline.sm { height: 18px; }
.hours { position: relative; height: 18px; font-size: 12px; color: var(--muted); margin-top: 4px; }
.hours span { position: absolute; transform: translateX(-50%); font-variant-numeric: tabular-nums; }
.hours span:first-child { transform: none; }
.hours span:last-child { transform: translateX(-100%); }

/* ---------------------------------------------------------------- makineler listesi */
.mrow { display: grid; grid-template-columns: minmax(170px, 1.1fr) minmax(220px, 3fr) repeat(3, minmax(92px, .8fr)) 28px;
  gap: 18px; align-items: center; padding: 16px 20px; border-top: 1px solid var(--border); cursor: pointer; }
.mrow:first-child { border-top: 0; }
.mrow:hover { background: var(--surface-2); }
.mrow.head { cursor: default; font-size: 13px; color: var(--muted); padding-top: 12px; padding-bottom: 8px; }
.mrow.head:hover { background: transparent; }
.mrow .name { font-weight: 650; font-size: 17px; }
.mrow .state { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 6px; margin-top: 2px; }
.mrow .num { font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; }
.mrow .num small { display: block; font-size: 12px; font-weight: 500; color: var(--muted); }
.mrow .chev { color: var(--muted); font-size: 22px; }
@media (max-width: 900px) {
  .mrow { grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
  .mrow > div:first-child { grid-column: 1 / -1; }
  .mrow .bar-cell { grid-column: 1 / -1; order: 5; }
  .mrow .chev, .mrow.head { display: none; }
}
@media (max-width: 560px) {
  .brand small { display: none; }
  .hero .big { font-size: 54px; }
}

/* ---------------------------------------------------------------- grafikler */
.chart-card { padding: 18px 20px 14px; }
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart .axis-text { fill: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.chart .grid-line { stroke: var(--grid); stroke-width: 1; }
.chart .base-line { stroke: var(--axis); stroke-width: 1; }
.chart .shift-title { fill: var(--ink); font-size: 14px; font-weight: 650; }
.chart .shift-range { fill: var(--muted); font-weight: 500; font-size: 13px; font-variant-numeric: tabular-nums; }
.chart .rpm-line { fill: none; stroke: var(--ink-2); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .col { cursor: pointer; }
.chart .col:hover rect { filter: brightness(1.08); }
.chart .hit { fill: transparent; }
.crosshair { stroke: var(--ink); stroke-width: 1; opacity: .5; pointer-events: none; }
.tooltip { position: absolute; pointer-events: none; z-index: 30; background: var(--ink); color: var(--surface);
  border-radius: 10px; padding: 9px 12px; font-size: 13px; line-height: 1.5; min-width: 150px; opacity: 0;
  transition: opacity .08s; box-shadow: 0 6px 24px rgba(0,0,0,.18); white-space: nowrap; }
.tooltip.show { opacity: 1; }
.tooltip b { font-size: 14px; }
.tooltip .row { display: flex; align-items: center; gap: 8px; }
.tooltip .row .v { margin-left: auto; padding-left: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }

/* yatay cubuklar (nedenler, devir) */
.hbars { display: flex; flex-direction: column; gap: 4px; }
.hbar { display: grid; grid-template-columns: minmax(130px, 220px) 1fr minmax(120px, auto); gap: 14px; align-items: center;
  padding: 10px 6px; border-radius: 10px; }
.hbar .lbl { font-weight: 600; }
.hbar .track { height: 22px; position: relative; }
.hbar .fill { height: 100%; border-radius: 0 4px 4px 0; min-width: 3px; }
.hbar .fill.ke { background: var(--ke); }
.hbar .fill.blue { background: #2a78d6; }
.hbar .val { font-variant-numeric: tabular-nums; font-size: 15px; color: var(--ink-2); text-align: right; }
.hbar .val b { color: var(--ink); font-size: 17px; }
@media (max-width: 640px) { .hbar { grid-template-columns: 1fr; gap: 4px; } .hbar .val { text-align: left; } }

/* ---------------------------------------------------------------- durus tablosu */
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.fchip { border: 1px solid var(--border); background: var(--surface); border-radius: 999px; padding: 6px 14px; cursor: pointer;
  font-size: 14px; font-weight: 500; display: inline-flex; align-items: center; gap: 7px; }
.fchip[aria-pressed="true"] { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.fchip .n { font-variant-numeric: tabular-nums; opacity: .75; }
.check { display: inline-flex; align-items: center; gap: 7px; font-size: 14px; color: var(--ink-2); cursor: pointer; margin-left: 6px; }
table.stops { width: 100%; border-collapse: collapse; font-size: 15px; }
table.stops th { text-align: left; font-size: 13px; color: var(--muted); font-weight: 500; padding: 12px 16px 8px; border-bottom: 1px solid var(--border); }
table.stops td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; font-variant-numeric: tabular-nums; }
table.stops tr:last-child td { border-bottom: 0; }
table.stops tbody tr { cursor: pointer; }
table.stops tbody tr:hover { background: var(--surface-2); }
table.stops .src { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; }
table.stops .wait { font-weight: 650; font-size: 16px; }
table.stops .sub { display: block; font-size: 13px; color: var(--muted); }
table.stops td.r, table.stops th.r { text-align: right; }
.table-wrap { overflow-x: auto; }
.more { text-align: center; padding: 12px; border-top: 1px solid var(--border); }
@media (max-width: 720px) { table.stops .hide-sm { display: none; } }

/* ---------------------------------------------------------------- ayrintilar */
details.more-info { margin-top: 22px; }
details.more-info > summary { cursor: pointer; font-size: 17px; font-weight: 600; padding: 14px 4px; list-style: none; display: flex; align-items: center; gap: 10px; color: var(--ink-2); }
details.more-info > summary::-webkit-details-marker { display: none; }
details.more-info > summary::before { content: "›"; font-size: 22px; transition: transform .15s; display: inline-block; width: 14px; }
details.more-info[open] > summary::before { transform: rotate(90deg); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }
.note { font-size: 14px; color: var(--ink-2); line-height: 1.55; }
.note ul { margin: 6px 0 0; padding-left: 20px; }
.note li { margin: 4px 0; }
.empty { padding: 36px 20px; text-align: center; color: var(--muted); }
.empty b { display: block; color: var(--ink); font-size: 18px; margin-bottom: 6px; }
.banner { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 12px; background: var(--warn-soft); color: var(--warn-ink); font-size: 15px; margin-top: 14px; }
.loading { opacity: .55; transition: opacity .15s; pointer-events: none; }

/* ---------------------------------------------------------------- cekmece (durus detayi) */
.drawer-bg { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 40; opacity: 0; pointer-events: none; transition: opacity .15s; }
.drawer-bg.show { opacity: 1; pointer-events: auto; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(520px, 100vw); background: var(--surface); z-index: 41;
  transform: translateX(100%); transition: transform .2s ease; display: flex; flex-direction: column; box-shadow: -8px 0 32px rgba(0,0,0,.15); }
.drawer.show { transform: none; }
.drawer header { display: flex; align-items: flex-start; gap: 12px; padding: 20px 22px 14px; border-bottom: 1px solid var(--border); }
.drawer header h3 { margin: 0; font-size: 21px; }
.drawer header p { margin: 3px 0 0; color: var(--muted); font-size: 14px; }
.drawer header .btn { margin-left: auto; }
.drawer .body { padding: 18px 22px 30px; overflow-y: auto; display: flex; flex-direction: column; gap: 18px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 10px 18px; font-size: 15px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.flow { display: flex; align-items: stretch; gap: 0; }
.flow .step { flex: 1; padding: 12px 12px; background: var(--surface-2); text-align: center; }
.flow .step:first-child { border-radius: 10px 0 0 10px; }
.flow .step:last-child { border-radius: 0 10px 10px 0; }
.flow .step.mid { background: var(--warn-soft); }
.flow .step small { display: block; color: var(--muted); font-size: 12px; }
.flow .step b { font-size: 17px; font-variant-numeric: tabular-nums; }
.shot { width: 100%; border-radius: 10px; background: var(--surface-2); min-height: 120px; display: grid; place-items: center; color: var(--muted); font-size: 14px; overflow: hidden; }
.shot img { width: 100%; display: block; }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; margin-top: 10px; }
.thumbs a { display: block; color: inherit; text-decoration: none; }
.thumbs .ph { aspect-ratio: 4 / 3; border-radius: 8px; background: var(--surface-2); overflow: hidden; display: grid; place-items: center; color: var(--muted); font-size: 12px; text-align: center; padding: 4px; }
.thumbs img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumbs small { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- formlar (cihazlar) */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }
.field { display: flex; flex-direction: column; gap: 6px; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: 14px; font-weight: 600; color: var(--ink-2); }
.field input, .field textarea { border: 1px solid var(--border); background: var(--surface); border-radius: 10px; padding: 9px 12px; font-size: 15px; }
.field input:focus, .field textarea:focus, select:focus, .custom-range input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.field .help { font-size: 13px; color: var(--muted); }
.result { padding: 12px 14px; border-radius: 10px; font-size: 14px; display: none; }
.result.show { display: block; }
.result.ok { background: #e6f6ee; color: #0b5c37; }
.result.err { background: #fde8e8; color: #8c1d1d; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .result.ok { background: #0f2c1f; color: #7ee2b0; }
  :root:not([data-theme="light"]) .result.err { background: #3a1414; color: #f5a3a3; }
}
.dev-card { padding: 18px 20px; display: grid; grid-template-columns: 1fr auto; gap: 10px 18px; align-items: center; }
.dev-card + .dev-card { margin-top: 12px; }
.dev-card h3 { margin: 0; font-size: 18px; }
.dev-card .meta { font-size: 14px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 16px; }
.dev-card .actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
footer.foot { color: var(--muted); font-size: 13px; padding: 40px 0 30px; text-align: center; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
