/* Gezer ERP — arayüz stilleri
   Yön: atölye panosu. Galvaniz gri zemin, boyalı şase rengi kenar çubuğu,
   tek vurgu olarak sinyal sarısı (aktif menü, odak). Gölge yerine çizgi, süs yerine yoğunluk. */

@font-face { font-family: 'Barlow'; font-weight: 400; font-display: swap; src: url(../fonts/barlow-latin-400-normal.woff2) format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Barlow'; font-weight: 400; font-display: swap; src: url(../fonts/barlow-latin-ext-400-normal.woff2) format('woff2'); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: 'Barlow'; font-weight: 500; font-display: swap; src: url(../fonts/barlow-latin-500-normal.woff2) format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Barlow'; font-weight: 500; font-display: swap; src: url(../fonts/barlow-latin-ext-500-normal.woff2) format('woff2'); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: 'Barlow'; font-weight: 600; font-display: swap; src: url(../fonts/barlow-latin-600-normal.woff2) format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Barlow'; font-weight: 600; font-display: swap; src: url(../fonts/barlow-latin-ext-600-normal.woff2) format('woff2'); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: 'Barlow'; font-weight: 700; font-display: swap; src: url(../fonts/barlow-latin-700-normal.woff2) format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Barlow'; font-weight: 700; font-display: swap; src: url(../fonts/barlow-latin-ext-700-normal.woff2) format('woff2'); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: 'Barlow Condensed'; font-weight: 500; font-display: swap; src: url(../fonts/barlow-condensed-latin-500-normal.woff2) format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Barlow Condensed'; font-weight: 500; font-display: swap; src: url(../fonts/barlow-condensed-latin-ext-500-normal.woff2) format('woff2'); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: 'Barlow Condensed'; font-weight: 600; font-display: swap; src: url(../fonts/barlow-condensed-latin-600-normal.woff2) format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Barlow Condensed'; font-weight: 600; font-display: swap; src: url(../fonts/barlow-condensed-latin-ext-600-normal.woff2) format('woff2'); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }

:root {
  --bg: #e9edf0;          /* galvaniz */
  --surface: #ffffff;
  --surface-2: #f5f7f8;
  --ink: #17232b;
  --ink-2: #4b5b66;
  --ink-3: #7b8a94;
  --line: #d3dae0;
  --line-2: #e4e9ec;
  --chassis: #233139;     /* boyalı şase */
  --chassis-2: #2d3d46;
  --chassis-ink: #c6d1d8;
  --primary: #0e5a6b;     /* petrol */
  --primary-2: #0b4a59;
  --primary-tint: #e3eff2;
  --signal: #f2b705;      /* sinyal sarısı — tek vurgu */
  --ok: #2b7a4b;
  --ok-tint: #e5f2ea;
  --warn: #9a5b0e;
  --warn-tint: #fbf0dc;
  --bad: #b3261e;
  --bad-tint: #fbe7e5;
  --t-hammadde: #5f6b73;
  --t-ticari: #2a5c99;
  --t-parca: #0e5a6b;
  --t-alt_montaj: #66478f;
  --t-mamul: #7a5500;
  --r-sm: 3px;
  --r-md: 6px;
  --font: 'Barlow', system-ui, 'Segoe UI', sans-serif;
  --font-c: 'Barlow Condensed', 'Barlow', system-ui, sans-serif;
  --hover: #f3f7f8;
  --tree-line: #b7c3ca;
  --ok-line: #bfdcc9;
  --warn-line: #ecd3a6;
  --bad-line: #f0c1bc;
  --info-line: #c3dce2;
  --match: #fff7d6;
  --entered: #f6f9ec;
  --on-primary: #ffffff;
  --on-bad: #ffffff;
  --focus-ring: rgba(14, 90, 107, .15);
  color-scheme: light;
  --fs-1: 12px; --fs-2: 13px; --fs-3: 14px; --fs-4: 16px; --fs-5: 20px; --fs-6: 28px;
}

/* Koyu tema: ayardan seçilir ya da "Otomatik"te Windows'un ayarına uyar */
:root[data-theme="dark"] {
  --bg: #11181d;
  --surface: #19222a;
  --surface-2: #202b33;
  --ink: #e2e8ec;
  --ink-2: #a7b4bd;
  --ink-3: #7f8d97;
  --line: #2e3b44;
  --line-2: #25313a;
  --chassis: #0d1317;
  --chassis-2: #18222a;
  --chassis-ink: #b0bec7;
  --primary: #2b8ea5;
  --primary-2: #7cc9da;
  --primary-tint: #15323a;
  --ok: #63c48f;
  --ok-tint: #16301f;
  --warn: #e3a94f;
  --warn-tint: #36290f;
  --bad: #f2776c;
  --bad-tint: #3a1d1b;
  --t-hammadde: #9aa8b1;
  --t-ticari: #73a3e3;
  --t-parca: #52b6cb;
  --t-alt_montaj: #ab8fd9;
  --t-mamul: #d8a64c;
  --hover: #222e37;
  --tree-line: #3b4a54;
  --ok-line: #2a5640;
  --warn-line: #66491b;
  --bad-line: #6a2e29;
  --info-line: #234e58;
  --match: #3a3313;
  --entered: #1d2a1e;
  --on-primary: #ffffff;
  --on-bad: #2a0f0d;
  --focus-ring: rgba(82, 182, 203, .28);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
  --bg: #11181d;
  --surface: #19222a;
  --surface-2: #202b33;
  --ink: #e2e8ec;
  --ink-2: #a7b4bd;
  --ink-3: #7f8d97;
  --line: #2e3b44;
  --line-2: #25313a;
  --chassis: #0d1317;
  --chassis-2: #18222a;
  --chassis-ink: #b0bec7;
  --primary: #2b8ea5;
  --primary-2: #7cc9da;
  --primary-tint: #15323a;
  --ok: #63c48f;
  --ok-tint: #16301f;
  --warn: #e3a94f;
  --warn-tint: #36290f;
  --bad: #f2776c;
  --bad-tint: #3a1d1b;
  --t-hammadde: #9aa8b1;
  --t-ticari: #73a3e3;
  --t-parca: #52b6cb;
  --t-alt_montaj: #ab8fd9;
  --t-mamul: #d8a64c;
  --hover: #222e37;
  --tree-line: #3b4a54;
  --ok-line: #2a5640;
  --warn-line: #66491b;
  --bad-line: #6a2e29;
  --info-line: #234e58;
  --match: #3a3313;
  --entered: #1d2a1e;
  --on-primary: #ffffff;
  --on-bad: #2a0f0d;
  --focus-ring: rgba(82, 182, 203, .28);
  color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--font); font-size: var(--fs-3); line-height: 1.45; color: var(--ink); background: var(--bg);
  font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--primary); }
:focus-visible { outline: 2px solid var(--signal); outline-offset: 1px; }
.muted { color: var(--ink-2); }
.small { font-size: var(--fs-1); }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.code { font-weight: 600; letter-spacing: .01em; white-space: nowrap; }
.hidden { display: none !important; }
.grow { flex: 1; }
.row { display: flex; gap: 8px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 12px; }

/* ---------- Uygulama iskeleti ---------- */
.app { display: grid; grid-template-columns: 224px 1fr; height: 100vh; }
.side { background: var(--chassis); color: var(--chassis-ink); display: flex; flex-direction: column; min-height: 0; }
.brand { padding: 16px 18px 14px; border-bottom: 1px solid var(--chassis-2); }
.brand-name { font-family: var(--font-c); font-weight: 600; font-size: 22px; color: #fff; letter-spacing: .02em; line-height: 1; }
.brand-name b { color: var(--signal); font-weight: 600; }
.company-btn {
  margin-top: 12px; width: 100%; text-align: left; background: var(--chassis-2); border: 1px solid #3b4d57; color: #fff;
  border-radius: var(--r-sm); padding: 7px 10px; cursor: pointer; display: flex; align-items: center; gap: 8px;
}
.company-btn:hover { border-color: #56707e; }
.company-btn .cn { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.company-btn .chev { opacity: .6; font-size: 11px; }
.nav { flex: 1; overflow-y: auto; padding: 10px 0 16px; }
.nav-group { padding: 12px 18px 3px; font-size: var(--fs-1); color: #8a9ba6; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 6px 18px 6px 15px; color: var(--chassis-ink); text-decoration: none;
  border-left: 3px solid transparent;
}
.nav a:hover { background: var(--chassis-2); color: #fff; }
.nav a.active { border-left-color: var(--signal); background: var(--chassis-2); color: #fff; font-weight: 500; }
.nav a.soon { opacity: .45; pointer-events: none; }
.nav a .badge { margin-left: auto; }
.nav svg { width: 17px; height: 17px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.6; }
.side-foot { border-top: 1px solid var(--chassis-2); padding: 10px 18px; font-size: var(--fs-1); display: flex; align-items: center; gap: 8px; }
.side-foot .who { flex: 1; overflow: hidden; }
.side-foot .who b { color: #fff; font-weight: 500; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn { background: none; border: 1px solid transparent; border-radius: var(--r-sm); padding: 4px 6px; cursor: pointer; color: inherit; }
.icon-btn:hover { border-color: currentColor; }
.icon-btn svg, .chip svg { display: block; width: 17px; height: 17px; stroke: currentColor; fill: none; stroke-width: 1.7; }

.main { min-width: 0; display: flex; flex-direction: column; min-height: 0; }
.conn { background: var(--bad); color: #fff; padding: 6px 20px; font-weight: 500; }
.conn.ok { display: none; }
.page { flex: 1; overflow: auto; padding: 22px 28px 40px; }
.page-head { display: flex; align-items: flex-end; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head h1 { font-family: var(--font-c); font-weight: 600; font-size: var(--fs-6); line-height: 1; margin: 0; letter-spacing: .01em; }
.page-head .sub { color: var(--ink-2); margin-top: 6px; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
h2 { font-family: var(--font-c); font-weight: 600; font-size: var(--fs-5); margin: 0 0 10px; }
h3 { font-size: var(--fs-4); font-weight: 600; margin: 0 0 8px; }

/* ---------- Düğmeler ve form ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  padding: 6px 12px; border-radius: var(--r-sm); cursor: pointer; font-weight: 500; white-space: nowrap; line-height: 1.3;
}
.btn:hover { border-color: var(--ink-3); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn.primary:hover { background: var(--primary-2); }
.btn.danger { color: var(--bad); }
.btn.danger.solid { background: var(--bad); border-color: var(--bad); color: var(--on-bad); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); border-color: var(--line); }
.btn.sm { padding: 3px 8px; font-size: var(--fs-2); }
.btn:disabled { opacity: .5; cursor: default; }
.btn svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 1.8; }

.field { display: flex; flex-direction: column; gap: 4px; }
.field > span { font-size: var(--fs-2); color: var(--ink-2); font-weight: 500; }
.field .hint { font-size: var(--fs-1); color: var(--ink-3); }
.input, select.input, textarea.input {
  border: 1px solid var(--line); background: var(--surface); border-radius: var(--r-sm); padding: 6px 9px; min-width: 0; width: 100%;
}
.input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 2px var(--focus-ring); }
textarea.input { resize: vertical; min-height: 60px; }
.input.num { text-align: right; }
.grid-form { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px 14px; }
.grid-form .span2 { grid-column: span 2; }
.grid-form .full { grid-column: 1 / -1; }
.check { display: flex; gap: 8px; align-items: flex-start; cursor: pointer; }
.check input { margin-top: 3px; }
.search { position: relative; min-width: 240px; }
.search .input { padding-left: 30px; }
.search svg { position: absolute; left: 9px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; stroke: var(--ink-3); fill: none; stroke-width: 1.8; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--r-sm); overflow: hidden; background: var(--surface); }
.seg button { border: 0; background: none; padding: 5px 11px; cursor: pointer; border-right: 1px solid var(--line); }
.seg button:last-child { border-right: 0; }
.seg button.on { background: var(--primary-tint); color: var(--primary); font-weight: 600; }

/* ---------- Paneller ve tablolar ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); }
.panel-pad { padding: 16px 18px; }
.panel-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line-2); }
.panel-head h3 { margin: 0; }
.toolbar { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; flex-wrap: wrap; }

.tbl-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); overflow: auto; }
table.tbl { width: 100%; border-collapse: collapse; }
.tbl th {
  position: sticky; top: 0; z-index: 1; background: var(--surface-2); text-align: left; font-weight: 600; font-size: var(--fs-2);
  color: var(--ink-2); padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; user-select: none;
}
.tbl th.sortable { cursor: pointer; }
.tbl th.sortable:hover { color: var(--ink); }
.tbl th .arrow { font-size: 10px; margin-left: 3px; }
.tbl td { padding: 7px 10px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr.click { cursor: pointer; }
.tbl tbody tr.click:hover td { background: var(--hover); }
.tbl tbody tr.sel td { background: var(--primary-tint); }
.tbl tr.inactive td { color: var(--ink-3); }
.tbl .actions { text-align: right; white-space: nowrap; }
.tbl-foot { padding: 8px 12px; font-size: var(--fs-2); color: var(--ink-2); border-top: 1px solid var(--line-2); }
.empty { padding: 36px 20px; text-align: center; color: var(--ink-2); }
.empty b { display: block; color: var(--ink); font-size: var(--fs-4); margin-bottom: 4px; }

.badge {
  display: inline-block; font-size: var(--fs-1); font-weight: 600; padding: 1px 7px; border-radius: 10px; line-height: 1.5;
  background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); white-space: nowrap;
}
.badge.ok { background: var(--ok-tint); color: var(--ok); border-color: var(--ok-line); }
.badge.warn { background: var(--warn-tint); color: var(--warn); border-color: var(--warn-line); }
.badge.bad { background: var(--bad-tint); color: var(--bad); border-color: var(--bad-line); }
.badge.sig { background: var(--signal); color: var(--chassis); border-color: var(--signal); }

/* Malzeme türü etiketi: sol kenarda renkli şerit (sac üzerine boya kodu gibi) */
.type {
  display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-2); white-space: nowrap; color: var(--ink-2);
}
.type::before { content: ''; width: 9px; height: 9px; border-radius: 2px; background: var(--tc, var(--ink-3)); }
.type[data-t=hammadde] { --tc: var(--t-hammadde); }
.type[data-t=ticari] { --tc: var(--t-ticari); }
.type[data-t=parca] { --tc: var(--t-parca); }
.type[data-t=alt_montaj] { --tc: var(--t-alt_montaj); }
.type[data-t=mamul] { --tc: var(--t-mamul); }

.stock-low { color: var(--bad); font-weight: 600; }
.pos { color: var(--ok); }
.neg { color: var(--bad); }

/* ---------- Özet ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0; margin-bottom: 18px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); }
.kpi { padding: 14px 16px; border-right: 1px solid var(--line-2); }
.kpi:last-child { border-right: 0; }
.kpi .v { font-family: var(--font-c); font-size: 30px; font-weight: 600; line-height: 1; }
.kpi .l { margin-top: 6px; }
.dash-grid { display: grid; grid-template-columns: 3fr 2fr; gap: 16px; align-items: start; }
@media (max-width: 1100px) { .dash-grid { grid-template-columns: 1fr; } }

/* ---------- Çekmece (sağdan detay) ---------- */
.drawer-back { position: fixed; inset: 0; background: rgba(23, 35, 43, .28); z-index: 40; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(900px, 92vw); background: var(--bg); z-index: 41;
  display: flex; flex-direction: column; border-left: 1px solid var(--line); animation: slidein .16s ease-out;
}
@keyframes slidein { from { transform: translateX(24px); opacity: .6; } to { transform: none; opacity: 1; } }
.drawer-head { background: var(--surface); border-bottom: 1px solid var(--line); padding: 14px 20px 0; }
.drawer-title { display: flex; align-items: center; gap: 14px; }
.drawer-title .t { flex: 1; min-width: 0; }
.drawer-title .t .c { font-family: var(--font-c); font-size: 24px; font-weight: 600; line-height: 1.05; }
.drawer-title .t .n { color: var(--ink-2); margin-top: 2px; }
.tabs { display: flex; gap: 2px; margin-top: 12px; overflow-x: auto; }
.tabs button {
  border: 0; background: none; padding: 8px 12px; cursor: pointer; border-bottom: 3px solid transparent; color: var(--ink-2); white-space: nowrap;
}
.tabs button.on { border-bottom-color: var(--primary); color: var(--ink); font-weight: 600; }
.tabs button .badge { margin-left: 4px; }
.drawer-body { flex: 1; overflow: auto; padding: 18px 20px 30px; }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 0; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r-md); margin-bottom: 14px; }
.fact { padding: 10px 14px; border-right: 1px solid var(--line-2); border-bottom: 1px solid var(--line-2); }
.fact .l { font-size: var(--fs-1); color: var(--ink-2); }
.fact .v { font-size: var(--fs-4); font-weight: 600; margin-top: 2px; }

/* ---------- Ürün ağacı ---------- */
.tree { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); overflow-x: auto; }
.tree-row {
  display: grid; grid-template-columns: minmax(212px, 1fr) 96px 104px 72px 96px 64px 112px; align-items: center; min-width: 756px;
  border-bottom: 1px solid var(--line-2); min-height: 36px;
}
.tree-row.head { background: var(--surface-2); font-size: var(--fs-2); color: var(--ink-2); font-weight: 600; min-height: 32px; }
.tree-row > div { padding: 4px 10px; }
.tree-row:last-child { border-bottom: 0; }
.tree-row:not(.head):hover { background: var(--hover); }
.tree-row.root { background: var(--primary-tint); font-weight: 600; }
.tree-name { display: flex; align-items: center; min-width: 0; }
.tree-indent { display: flex; align-self: stretch; flex: none; }
.tree-indent i { width: 20px; position: relative; flex: none; }
/* Bağlantı çizgileri: teknik resimdeki parça ağacı gibi */
.tree-indent i.v::before { content: ''; position: absolute; left: 9px; top: -4px; bottom: -4px; border-left: 1px solid var(--tree-line); }
.tree-indent i.t::before { content: ''; position: absolute; left: 9px; top: -4px; bottom: -4px; border-left: 1px solid var(--tree-line); }
.tree-indent i.l::before { content: ''; position: absolute; left: 9px; top: -4px; height: calc(50% + 4px); border-left: 1px solid var(--tree-line); }
.tree-indent i.t::after, .tree-indent i.l::after { content: ''; position: absolute; left: 9px; top: 50%; width: 9px; border-top: 1px solid var(--tree-line); }
.tree-toggle { width: 20px; height: 20px; flex: none; border: 0; background: none; cursor: pointer; color: var(--ink-2); padding: 0; font-size: 11px; }
.tree-toggle.none { cursor: default; }
.tree-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-label .code { margin-right: 8px; }
.tree-row .acts { display: flex; gap: 2px; justify-content: flex-end; opacity: 0; padding-left: 4px; padding-right: 6px; }
.tree-row .acts .btn.sm { padding-left: 6px; padding-right: 6px; }
.tree-row:hover .acts, .tree-row:focus-within .acts { opacity: 1; }
.lvl { display: inline-block; min-width: 22px; text-align: center; font-size: var(--fs-1); color: var(--ink-3); border: 1px solid var(--line); border-radius: 3px; margin-right: 6px; }

.split { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 16px; align-items: start; }
.split > * { min-width: 0; }
.page-head .sub { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
@media (max-width: 1000px) { .split { grid-template-columns: 1fr; } }
.pick-list { max-height: calc(100vh - 230px); overflow: auto; }
.pick-item { padding: 7px 14px; border-bottom: 1px solid var(--line-2); cursor: pointer; display: flex; gap: 10px; align-items: center; }
.pick-item:hover { background: var(--hover); }
.pick-item.on { background: var(--primary-tint); box-shadow: inset 3px 0 0 var(--primary); }
.pick-item .n { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }

/* ---------- Diyalog ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(23, 35, 43, .4); z-index: 60; display: flex; align-items: flex-start; justify-content: center; padding: 8vh 16px; overflow: auto; }
.modal { background: var(--surface); border-radius: var(--r-md); width: min(560px, 100%); border: 1px solid var(--line); box-shadow: 0 18px 50px rgba(23, 35, 43, .25); }
.modal.wide { width: min(860px, 100%); }
.modal-head { padding: 16px 20px 0; display: flex; align-items: center; gap: 10px; }
.modal-head h2 { margin: 0; flex: 1; }
.modal-body { padding: 14px 20px; }
.modal-foot { padding: 12px 20px 16px; display: flex; gap: 8px; justify-content: flex-end; border-top: 1px solid var(--line-2); }
.modal-foot .left { margin-right: auto; }
.err-box { background: var(--bad-tint); color: var(--bad); border: 1px solid var(--bad-line); border-radius: var(--r-sm); padding: 8px 12px; margin-bottom: 10px; }
.info-box { background: var(--primary-tint); color: var(--primary-2); border: 1px solid var(--info-line); border-radius: var(--r-sm); padding: 10px 12px; }
.warn-box { background: var(--warn-tint); color: var(--warn); border: 1px solid var(--warn-line); border-radius: var(--r-sm); padding: 10px 12px; }

/* Malzeme seçici (açılır arama) */
.combo { position: relative; }
.combo-list { position: absolute; left: 0; right: 0; top: calc(100% + 2px); background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-sm); max-height: 260px; overflow: auto; z-index: 70; box-shadow: 0 8px 24px rgba(23, 35, 43, .15); }
.combo-item { padding: 6px 10px; cursor: pointer; display: flex; gap: 8px; align-items: baseline; }
.combo-item.on, .combo-item:hover { background: var(--primary-tint); }
.combo-item .n { color: var(--ink-2); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Bildirim ---------- */
.toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 90; }
.toast { background: var(--chassis); color: #fff; padding: 10px 14px; border-radius: var(--r-sm); min-width: 220px; max-width: 420px;
  border-left: 4px solid var(--signal); animation: slidein .15s ease-out; }
.toast.bad { border-left-color: #ff6b5e; }

/* ---------- Giriş ve kilit ekranları ---------- */
.gate { min-height: 100vh; display: grid; grid-template-columns: minmax(320px, 440px) 1fr; }
.gate-side { background: var(--chassis); color: var(--chassis-ink); padding: 40px 36px; display: flex; flex-direction: column; }
.gate-side .brand-name { font-size: 34px; }
.gate-side .tag { margin-top: 10px; max-width: 30ch; }
.gate-side .dev { margin-top: auto; font-size: var(--fs-2); }
.gate-side .dev b { color: #fff; font-family: var(--font-c); font-size: 22px; letter-spacing: .12em; display: block; font-weight: 600; }
.gate-main { display: flex; align-items: center; justify-content: center; padding: 30px; }
.gate-card { width: min(400px, 100%); }
.gate-card h1 { font-family: var(--font-c); font-size: var(--fs-6); margin: 0 0 4px; font-weight: 600; }
.gate-card .lead { color: var(--ink-2); margin: 0 0 20px; }
.devcode { font-family: var(--font-c); font-weight: 600; font-size: 46px; letter-spacing: .16em; color: var(--chassis);
  background: var(--surface); border: 2px dashed var(--signal); border-radius: var(--r-md); text-align: center; padding: 10px; margin: 16px 0; }
.company-list { display: flex; flex-direction: column; gap: 8px; }
.company-choice { text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px 14px; cursor: pointer; display: flex; align-items: center; gap: 10px; }
.company-choice:hover { border-color: var(--primary); }
.company-choice .cn { flex: 1; font-weight: 600; }


.overlay-full { position: fixed; inset: 0; background: rgba(35, 49, 57, .92); color: #fff; z-index: 100; display: flex; align-items: center; justify-content: center; text-align: center; padding: 30px; }
.overlay-full h2 { font-size: 30px; }
.spinner { width: 34px; height: 34px; border: 3px solid rgba(255,255,255,.25); border-top-color: var(--signal); border-radius: 50%; animation: spin 1s linear infinite; margin: 0 auto 18px; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* Kenar çubuğu kaydırma çubuğu */
.nav { scrollbar-width: thin; scrollbar-color: #3b4d57 transparent; }
.nav::-webkit-scrollbar { width: 8px; }
.nav::-webkit-scrollbar-thumb { background: #3b4d57; border-radius: 4px; }
.nav::-webkit-scrollbar-track { background: transparent; }

.register-cta { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.reg-panel { margin-bottom: 18px; border-color: var(--warn-line); }
.reg-panel .panel-head { background: var(--warn-tint); }

/* ---------- Küçük resimler ---------- */
.thumb { display: inline-flex; align-items: center; justify-content: center; flex: none; border-radius: 4px; overflow: hidden;
  background: var(--surface-2); border: 1px solid var(--line-2); vertical-align: middle; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb.ph { color: var(--tc, var(--ink-3)); border: 0; background: color-mix(in srgb, var(--tc, #7b8a94) 13%, var(--surface)); }
.thumb.ph svg { width: 58%; height: 58%; stroke: currentColor; fill: none; stroke-width: 1.7; }
.thumb.ph[data-t=hammadde] { --tc: var(--t-hammadde); }
.thumb.ph[data-t=ticari] { --tc: var(--t-ticari); }
.thumb.ph[data-t=parca] { --tc: var(--t-parca); }
.thumb.ph[data-t=alt_montaj] { --tc: var(--t-alt_montaj); }
.thumb.ph[data-t=mamul] { --tc: var(--t-mamul); }
.combo-item { align-items: center; }
.cell-mat { display: flex; align-items: center; gap: 10px; min-width: 0; }
.cell-mat .t { min-width: 0; }
.cell-mat .t .n { color: var(--ink-2); font-size: var(--fs-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 420px; }

/* ---------- Kart görünümü ---------- */
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(176px, 1fr)); gap: 12px; }
.mcard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; cursor: pointer; text-align: left; padding: 0; display: flex; flex-direction: column; }
.mcard:hover { border-color: var(--primary); }
.mcard:focus-visible { outline: 2px solid var(--signal); }
.mcard .ph-wrap { aspect-ratio: 4 / 3; background: var(--surface-2); display: flex; align-items: center; justify-content: center; border-bottom: 1px solid var(--line-2); }
.mcard .ph-wrap .thumb { width: 100% !important; height: 100% !important; border: 0; border-radius: 0; }
.mcard .ph-wrap .thumb.ph svg { width: 30%; height: 30%; stroke-width: 1.3; }
.mcard .body { padding: 9px 11px 11px; display: flex; flex-direction: column; gap: 3px; }
.mcard .body .n { font-size: var(--fs-2); color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.9em; }
.mcard .body .meta { display: flex; justify-content: space-between; align-items: center; font-size: var(--fs-1); color: var(--ink-3); margin-top: 3px; }

/* ---------- Dosyalar ---------- */
.dropzone { border: 2px dashed var(--line); border-radius: var(--r-md); padding: 16px; text-align: center; color: var(--ink-2); background: var(--surface); transition: border-color .1s, background .1s; }
.dropzone.over { border-color: var(--primary); background: var(--primary-tint); }
.dropzone .row { justify-content: center; margin-top: 8px; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.gitem { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
.gitem button.pic { display: block; width: 100%; aspect-ratio: 1; padding: 0; border: 0; background: var(--surface-2); cursor: zoom-in; }
.gitem button.pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gitem .bar { display: flex; align-items: center; gap: 2px; padding: 3px 4px; }
.gitem .bar .grow { font-size: var(--fs-1); color: var(--ink-3); padding-left: 4px; }
.gitem .main-tag { position: absolute; top: 6px; left: 6px; }
.doc-list { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); }
.doc { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-bottom: 1px solid var(--line-2); }
.doc:last-child { border-bottom: 0; }
.doc .ext { width: 42px; height: 42px; border-radius: 5px; display: flex; align-items: center; justify-content: center; flex: none;
  font-family: var(--font-c); font-weight: 600; font-size: 13px; color: #fff; background: var(--fc, var(--ink-3)); letter-spacing: .03em; }
.doc .ext[data-k=pdf] { --fc: #b3261e; }
.doc .ext[data-k=cad] { --fc: #2a5c99; }
.doc .ext[data-k=pcb] { --fc: #2b7a4b; }
.doc .ext[data-k=arsiv] { --fc: #7a5500; }
.doc .ext[data-k=ofis] { --fc: #0e5a6b; }
.doc .ext[data-k=resim] { --fc: #66478f; }
.doc .info { flex: 1; min-width: 0; }
.doc .info .nm { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc .info .mt { font-size: var(--fs-1); color: var(--ink-3); }
.doc .acts { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.progress { height: 4px; background: var(--line-2); border-radius: 2px; overflow: hidden; margin-top: 8px; }
.progress div { height: 100%; background: var(--primary); width: 0; transition: width .15s; }
.viewer-img { max-width: 100%; max-height: 72vh; display: block; margin: 0 auto; }
.viewer-pdf { width: 100%; height: 74vh; border: 1px solid var(--line); border-radius: var(--r-sm); background: #fff; }
.modal.viewer { width: min(1180px, 100%); }

/* ---------- Ağaç araçları ---------- */
.tree-tools { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; flex-wrap: wrap; }
.tree-row.match { background: var(--match); }
.tree-label .thumb { margin-right: 8px; }
.tree-label { display: flex; align-items: center; }
.tree-label .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }
.kids { font-size: var(--fs-1); color: var(--ink-3); margin-left: 8px; white-space: nowrap; }

/* Rol seçici */
.role-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.role-opt { display: flex; gap: 9px; align-items: flex-start; border: 1px solid var(--line); border-radius: var(--r-md); padding: 8px 10px; cursor: pointer; background: var(--surface); }
.role-opt:hover { border-color: var(--ink-3); }
.role-opt.on { border-color: var(--primary); background: var(--surface-2); }
.role-opt input { margin-top: 3px; }
.role-opt .t { font-weight: 600; }
.role-opt .d { font-size: var(--fs-1); color: var(--ink-3); margin-top: 2px; line-height: 1.35; }

/* Toplu sayım */
.count-bar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 10px 12px; margin-bottom: 10px; box-shadow: 0 2px 6px rgba(23, 35, 43, .06); }
.count-tbl .count-in { width: 130px; text-align: right; }
.count-tbl tr.entered td { background: var(--entered); }
.count-tbl td { padding-top: 5px; padding-bottom: 5px; }
.chip { display: inline-flex; align-items: center; gap: 4px; background: var(--primary-tint); color: var(--primary-2); border: 1px solid var(--info-line);
  border-radius: 999px; padding: 3px 4px 3px 10px; font-size: var(--fs-2); max-width: 320px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip button { border: 0; background: transparent; color: inherit; cursor: pointer; padding: 2px; display: inline-flex; border-radius: 50%; }
.chip button:hover { background: var(--hover); }
.chip button svg { width: 14px; height: 14px; }
.side-foot .icon-btn { color: var(--chassis-ink); }
.side-foot .icon-btn:hover { color: #fff; }
.warn-txt { color: var(--warn); }

/* ---------- Telefon ---------- */
.mbar, .side-back { display: none; }
@media (max-width: 760px) {
  .gate { grid-template-columns: 1fr; min-height: 100dvh; }
  .gate-side { padding: 20px 20px 16px; }
  .gate-side .brand-name { font-size: 28px; }
  .gate-side .tag { display: none; }
  .gate-side .dev { margin-top: 12px; }
  .gate-main { align-items: flex-start; padding: 20px 16px 40px; }

  .app { grid-template-columns: 1fr; height: 100dvh; }
  /* Menü soldan açılır */
  .side { position: fixed; top: 0; bottom: 0; left: 0; width: min(290px, 84vw); z-index: 80; transform: translateX(-102%);
    transition: transform .18s ease-out; box-shadow: 4px 0 24px rgba(0, 0, 0, .3); padding-bottom: env(safe-area-inset-bottom); }
  .app.nav-open .side { transform: none; }
  .app.nav-open .side-back { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .4); z-index: 79; }
  .nav a { padding-top: 11px; padding-bottom: 11px; font-size: 15px; }
  .side-foot .icon-btn { padding: 8px; }

  .mbar { display: flex; align-items: center; gap: 10px; background: var(--chassis); color: var(--chassis-ink);
    padding: 8px 12px; padding-top: max(8px, env(safe-area-inset-top)); position: sticky; top: 0; z-index: 30; }
  .mbar .icon-btn { color: #fff; padding: 7px; }
  .mbar .icon-btn svg { width: 22px; height: 22px; }
  .mbar-title { flex: 1; color: #fff; font-weight: 600; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .mbar .brand-name { font-size: 17px; }

  .page { padding: 14px 12px calc(60px + env(safe-area-inset-bottom)); }
  .page-head { margin-bottom: 12px; align-items: stretch; }
  .page-head > div:first-child { width: 100%; }
  .page-head h1 { font-size: 24px; }
  .page-head .sub { font-size: var(--fs-2); }
  .page-head .actions { margin-left: 0; width: 100%; }
  .page-head .actions .btn { flex: 1 1 auto; justify-content: center; }

  /* Dokunmatik boyutlar; 16px yazı, odaklanınca sayfanın yakınlaşmasını önler */
  .btn { min-height: 40px; padding: 8px 13px; }
  .btn.sm { min-height: 34px; padding: 5px 10px; }
  .input, select.input, textarea.input { min-height: 42px; font-size: 16px; }
  .seg button { padding: 9px 13px; }
  .toolbar { gap: 8px; }
  .toolbar > .search, .toolbar > .combo, .toolbar > input.input { flex: 1 1 100%; min-width: 0; width: 100% !important; }
  .toolbar > select.input { flex: 1 1 140px; width: auto; }
  .search { min-width: 0; }

  .grid-form { grid-template-columns: 1fr; }
  .grid-form .span2 { grid-column: auto; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .kpi { border-bottom: 1px solid var(--line-2); }
  .kpi .v { font-size: 26px; }
  .grid-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .role-grid { grid-template-columns: 1fr; }
  .pick-list { max-height: 45vh; }

  /* Pencereler tam ekran, düğmeler altta */
  /* Pencere ekranı kaplar ama içerik uzunsa onunla birlikte uzar (önceden ekran boyunda kalıp içerik dışarı taşıyordu) */
  .modal-back { padding: 0; align-items: flex-start; }
  .modal, .modal.wide, .modal.viewer { width: 100%; min-height: 100vh; min-height: 100dvh; flex: none; border-radius: 0; border: 0; display: flex; flex-direction: column; }
  .modal > form { flex: 1; display: flex; flex-direction: column; }
  .modal-body { flex: 1; padding: 14px 14px; }
  .modal-head { padding: 14px 14px 0; }
  .modal-foot { position: sticky; bottom: 0; background: var(--surface); padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); flex-wrap: wrap; }
  .modal-foot .btn { flex: 1 1 auto; justify-content: center; }
  .viewer-pdf { height: 70dvh; }

  /* Malzeme çekmecesi tam ekran */
  .drawer { width: 100vw; border-left: 0; }
  .drawer-head { padding: 10px 12px 0; padding-top: max(10px, env(safe-area-inset-top)); }
  .drawer-title { flex-wrap: wrap; gap: 10px; }
  .drawer-title .t .c { font-size: 20px; }
  .drawer-body { padding: 14px 12px 40px; }

  .toasts { left: 12px; right: 12px; bottom: calc(14px + env(safe-area-inset-bottom)); }
  .toast { max-width: none; }

  /* Toplu sayım: gereksiz sütunlar gizli, giriş kutusu büyük */
  .count-tbl .c-loc, .count-tbl .c-type, .count-tbl .c-unit { display: none; }
  .count-tbl .count-in { width: 92px; font-size: 18px; }
  .count-tbl td, .count-tbl th { padding-left: 7px; padding-right: 7px; }
  .count-tbl .thumb { display: none; }
  .count-bar { top: 52px; }
  .chip { max-width: 100%; }
  .doc { flex-wrap: wrap; }
  .doc .acts { width: 100%; justify-content: flex-end; }
}
/* Dokunmatik ekranlarda üzerine gelme olmadığı için satır düğmeleri hep görünür */
@media (hover: none) {
  .tree-row .acts { opacity: 1; }
}.m-unit { display: none; }
@media (max-width: 760px) { .count-tbl .m-unit { display: inline; color: var(--ink-3); font-size: var(--fs-1); } }
.m-diff { display: none; }
@media (max-width: 760px) {
  .count-tbl .c-diff { display: none; }
  .count-tbl .m-diff { display: block; font-size: var(--fs-1); margin-top: 2px; min-height: 1em; }
  .count-tbl .cell-mat .t { white-space: normal; }
  .count-tbl .cell-mat .n { white-space: normal; font-size: var(--fs-1); }
  .count-tbl td:nth-child(2) { width: 100%; }
}
@media (max-width: 760px) {
  /* Sayım özeti ve kaydet düğmesi telefonda ekranın altında, başparmağın yetiştiği yerde */
  .count-bar { position: fixed; left: 0; right: 0; bottom: 0; top: auto; margin: 0; border-radius: 0; border-width: 1px 0 0;
    z-index: 25; padding: 8px 12px calc(8px + env(safe-area-inset-bottom)); box-shadow: 0 -4px 14px rgba(0, 0, 0, .12); font-size: var(--fs-2); }
  .count-bar .count-sum { flex: 1 1 100%; }
  .count-bar .btn { flex: 1 1 auto; justify-content: center; }
  .page:has(.count-bar) { padding-bottom: calc(130px + env(safe-area-inset-bottom)); }
}
.tbl-more { padding: 10px; text-align: center; border-top: 1px solid var(--line-2); }
.app-banner { display: flex; align-items: center; gap: 10px; background: var(--warn-tint); color: var(--warn); border-bottom: 1px solid var(--warn-line); padding: 8px 14px; font-size: var(--fs-2); }

/* Fotoğraf görüntüleyici */
.thumb.zoomable { cursor: zoom-in; }
.lb { position: fixed; inset: 0; z-index: 95; background: rgba(8, 12, 15, .96); display: flex; flex-direction: column; user-select: none; -webkit-user-select: none; }
.lb-bar { display: flex; align-items: center; gap: 10px; padding: 10px 12px; padding-top: max(10px, env(safe-area-inset-top)); color: #fff; }
.lb-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-count { font-size: var(--fs-1); color: #9fb0ba; }
.lb-close { background: rgba(255, 255, 255, .1); border: 0; color: #fff; border-radius: 50%; width: 42px; height: 42px; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.lb-close svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 2; }
.lb-stage { flex: 1; position: relative; overflow: hidden; touch-action: none; display: flex; align-items: center; justify-content: center; }
.lb-img { max-width: 100%; max-height: 100%; object-fit: contain; transform-origin: center center; will-change: transform; pointer-events: none; }
.lb-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 46px; height: 64px; border: 0; background: rgba(255, 255, 255, .1); color: #fff; font-size: 34px; line-height: 1; cursor: pointer; border-radius: 6px; }
.lb-nav.prev { left: 10px; } .lb-nav.next { right: 10px; }
.lb-hint { text-align: center; color: #73848e; font-size: var(--fs-1); padding: 6px 0 calc(10px + env(safe-area-inset-bottom)); }
@media (hover: hover) { .lb-hint { display: none; } }

/* Hesaplayan adet kutusu */
.calc { display: flex; flex-direction: column; align-items: stretch; }
.calc-row { display: flex; gap: 4px; align-items: center; }
.calc-row .input { flex: 1; min-width: 0; }
.calc-plus { display: none; flex: none; width: 40px; height: 40px; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink);
  border-radius: var(--r-sm); font-size: 22px; font-weight: 600; line-height: 1; cursor: pointer; }
.calc-plus:active { background: var(--primary-tint); }
@media (pointer: coarse) { .calc-plus { display: block; } }
.calc-hint { font-size: var(--fs-1); color: var(--primary); text-align: right; min-height: 0; font-weight: 600; }
.calc-hint:empty { display: none; }
.move-row { display: grid; grid-template-columns: 1fr 150px 44px 120px; gap: 8px; align-items: center; }
@media (max-width: 760px) {
  .move-row { grid-template-columns: 1fr 1fr; }
  .move-row > :first-child { grid-column: 1 / -1; }
  .count-tbl .calc .count-in { width: 100%; min-width: 72px; }
  .count-tbl td.num:has(.calc) { width: 46% !important; min-width: 150px; }
  .count-tbl .calc-plus { width: 38px; }
}

/* Üretim simülasyonu */
.plan-line { display: grid; grid-template-columns: minmax(0, 1fr) 170px 50px 40px; gap: 10px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line-2); }
.plan-roots { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.plan-kpis { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.plan-kpi { text-decoration: none; color: inherit; cursor: pointer; }
.plan-kpi .l { color: var(--ink-2); }
.plan-kpi.warn .v { color: var(--warn); } .plan-kpi.bad .v { color: var(--bad); } .plan-kpi.ok .v { color: var(--ok); }
.plan-sec { margin-bottom: 22px; scroll-margin-top: 70px; }
.plan-sec h2 { display: flex; align-items: center; }
.plan-print-head { display: none; }
@media (max-width: 760px) {
  .plan-line { grid-template-columns: minmax(0, 1fr) 120px 32px; }
  .plan-line > span.small { display: none; }
}
@media print {
  .side, .mbar, .conn, .app-banner, .no-print, .toasts, .tbl-more { display: none !important; }
  .app { display: block; height: auto; }
  .main, .page { overflow: visible !important; height: auto; padding: 0; }
  body { background: #fff; color: #000; font-size: 11px; }
  .plan-print-head { display: block; margin-bottom: 10px; }
  .plan-print-head h1 { font-family: var(--font-c); font-size: 22px; margin: 0; }
  .tbl-wrap { overflow: visible; border-color: #999; }
  .tbl th { position: static; }
  .plan-sec { break-inside: auto; }
  .plan-sec h2 { break-after: avoid; font-size: 15px; }
  .tbl tr { break-inside: avoid; }
  .kpi { border-color: #999; }
  a { color: inherit; text-decoration: none; }
}
/* Simülasyon: montaj görünümü */
.kit-name { display: flex; align-items: center; gap: 8px; min-width: 0; }
.kit-name .t { min-width: 0; }
.kit-name .n { color: var(--ink-2); font-size: var(--fs-2); }
.kit-tbl tr.asm td:first-child .code { color: var(--primary); }
.kit-tbl tr.root td { background: var(--primary-tint); }
.kit-tbl td:last-child { min-width: 240px; }
.kit-name { padding-left: calc(var(--d, 0) * 18px); }
@media (max-width: 760px) {
  /* Telefonda her satır küçük bir kart: ad üstte, sayılar yan yana, durum altta */
  .kit-tbl thead { display: none; }
  .kit-tbl, .kit-tbl tbody { display: block; width: 100%; }
  .kit-tbl tr.kit-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px 10px; padding: 9px 10px 9px calc(10px + var(--d, 0) * 14px); border-bottom: 1px solid var(--line); }
  .kit-tbl tr.kit-row td { display: block; border: 0; padding: 0; min-width: 0; background: transparent; }
  .kit-tbl tr.root { background: var(--primary-tint); }
  .kit-tbl td.kit-c-name, .kit-tbl td.kit-c-st { grid-column: 1 / -1; }
  .kit-tbl td.kit-c-st { padding-left: 36px; font-size: var(--fs-2); }
  .kit-tbl .tree-toggle { width: 28px; height: 28px; font-size: 13px; }
  .kit-tbl td.num { text-align: left; padding-left: 36px; }
  .kit-tbl td.num ~ td.num { padding-left: 0; }
  .kit-tbl td.num::before { content: attr(data-l); display: block; font-size: 11px; color: var(--ink-3, var(--ink-2)); }
  .kit-name { padding-left: 0; }
  .kit-name .thumb { display: none; }
  .kit-tbl td:last-child { min-width: 0; }
}

/* Ürün ağacı telefonda: yana kaydırma yok, her satır üç katlı kart: ad / tür + temin / miktarlar + düğmeler */
@media (max-width: 760px) {
  .tree { overflow-x: visible; }
  .tree-row { grid-template-columns: calc(var(--d, 0) * 14px + 24px) auto auto auto 1fr auto; min-width: 0; padding: 6px 4px 6px; row-gap: 0; }
  .tree-row.head { display: none; }
  .tree-row > div { padding: 1px 5px; }
  .tree-row > .tree-name { grid-row: 1; grid-column: 1 / -1; }
  .tree-row > .tc-type { grid-row: 2; grid-column: 2; }
  .tree-row > .tc-sup { grid-row: 2; grid-column: 3 / -1; }
  .tree-row > div:nth-child(4) { grid-row: 3; grid-column: 2; }
  .tree-row > div:nth-child(5) { grid-row: 3; grid-column: 3; }
  .tree-row > div:nth-child(6) { grid-row: 3; grid-column: 4; }
  .tree-row > div:nth-child(7) { grid-row: 2 / 4; grid-column: 6; align-self: center; }
  .tree-row > .num:empty, .tree-row > div:nth-child(7):empty { display: none; }
  .tree-label { white-space: normal; overflow: visible; }
  .tree-label .nm { color: var(--ink-2); }
  .tree-indent i { width: 14px; }
  .tree-indent i::before, .tree-indent i::after { display: none; }
  .tree-toggle { width: 28px; height: 28px; font-size: 14px; }
  .tree-row > .num { font-size: var(--fs-2); white-space: nowrap; text-align: left; }
  .tree-row > .num::before { content: attr(data-l) ' '; color: var(--ink-3); font-weight: 400; font-size: var(--fs-1); }
  .tree-row .acts .btn { padding-left: 6px; padding-right: 6px; }
}

/* Rota düzenleyici: operasyon satırları, oklarla sıralama, süreler yerinde girilir */
.op-list { display: flex; flex-direction: column; gap: 8px; }
.op-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto auto; grid-template-areas: "move main setup run acts";
  align-items: center; gap: 6px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 8px 10px; transition: background .4s; }
.op-row.moved { background: var(--primary-tint); }
.op-move { grid-area: move; display: flex; flex-direction: column; gap: 2px; }
.op-move .icon-btn { padding: 3px 5px; color: var(--ink-2); }
.op-move .icon-btn:disabled { opacity: .25; cursor: default; border-color: transparent; }
.op-main { grid-area: main; min-width: 0; }
.op-main .n { font-weight: 600; display: flex; align-items: center; gap: 8px; }
.op-main .w { color: var(--ink-2); font-size: var(--fs-2); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.op-no { display: inline-grid; place-items: center; min-width: 22px; height: 22px; border-radius: 11px; background: var(--surface-2); border: 1px solid var(--line); font-size: var(--fs-1); color: var(--ink-2); font-weight: 600; }
.op-time { display: flex; flex-direction: column; gap: 3px; }
.op-setup { grid-area: setup; } .op-run { grid-area: run; }
.op-time .l { font-size: var(--fs-1); color: var(--ink-3); }
.op-time .pair { display: flex; gap: 4px; }
.op-time .pair .input { height: 34px; }
.op-time .pair input { width: 78px; }
.op-time .pair select { width: auto; padding-right: 22px; }
.op-time.saving .pair input { border-color: var(--ink-3); }
.op-time.saved .pair input { border-color: var(--ok, #2b7a4b); box-shadow: 0 0 0 2px color-mix(in srgb, var(--ok, #2b7a4b) 25%, transparent); }
.op-acts { grid-area: acts; display: flex; gap: 2px; }
@media (max-width: 760px) {
  .op-row { grid-template-columns: auto minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: "move main main" "move setup run"; padding: 8px; gap: 8px 10px; }
  .op-main { padding-right: 84px; }
  .op-acts { grid-area: auto; grid-row: 1; grid-column: 3; justify-self: end; align-self: start; }
  .op-move .icon-btn { padding: 6px 7px; }
  .op-move .icon-btn svg { width: 20px; height: 20px; }
  .op-time .pair input { width: 0; flex: 1 1 0; min-width: 0; }
  .op-time .pair select { flex: 0 0 74px; width: 74px; padding-left: 8px; padding-right: 18px; }
  .op-time .pair .input { height: 40px; }
}
.cut-box { border: 1px dashed var(--line); border-radius: var(--r-md); padding: 10px 12px; background: var(--surface-2); }
.cut-title { font-weight: 600; margin-bottom: 8px; }
/* Boy hesabı kartı */
.bar-card { padding: 12px 14px; margin-bottom: 10px; }
.bar-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 6px; }
.bar-kpis { display: flex; gap: 18px; flex-wrap: wrap; }
.bar-kpis > div { display: flex; flex-direction: column; align-items: flex-end; }
.bar-kpis b { font-size: 20px; font-family: var(--font-c); line-height: 1.1; }
.bar-kpis span { font-size: var(--fs-1); color: var(--ink-3); }
.bar-kpis .warn b { color: var(--warn); } .bar-kpis .ok b { color: var(--ok); }
.bar-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 16px; margin-top: 10px; }
.bar-grid h3 { margin: 0 0 6px; font-size: var(--fs-3); }
.cut-plan { margin: 0; padding-left: 20px; font-size: var(--fs-2); }
.cut-plan li { padding: 4px 0; border-bottom: 1px solid var(--line-2); }
.cut-plan li:last-child { border-bottom: 0; }
@media (max-width: 760px) {
  .bar-grid { grid-template-columns: 1fr; }
  .bar-kpis { gap: 12px; width: 100%; justify-content: space-between; }
  .bar-kpis > div { align-items: flex-start; }
}
/* Düzenleme modu şeridi */
.edit-bar { padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); margin-bottom: 12px; }
.edit-bar.on { background: var(--warn-tint, #fff4dc); border-color: var(--warn-line, #f0d49a); }
.tree-check { width: 18px; height: 18px; flex: none; margin: 0 6px 0 0; accent-color: var(--primary); }
.merge-list { margin: 6px 0 0; padding-left: 18px; font-size: var(--fs-2); max-height: 180px; overflow: auto; }
.btn .lbl:empty { display: none; }
/* Ağaç düzenlenirken (seçim kutusu + düğmeler) "Tür" sütunu gizlenir, yer kalem adına kalır; tür simgeden okunur */
@media (min-width: 761px) {
  .tree.editing .tree-row { grid-template-columns: minmax(260px, 1fr) 104px 72px 96px 64px 112px; }
  .tree.editing .tree-row > :nth-child(2) { display: none; }
}
