/* =========================================================
   CoreLog — Karot Loglama Sistemi
   Tablet öncelikli, masaüstü ve telefonda da çalışan arayüz
   ========================================================= */
:root {
  --bg: #f1f5f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --text: #0f172a;
  --text-2: #475569;
  --text-3: #94a3b8;
  --primary: #0284c7;
  --primary-2: #0ea5e9;
  --primary-soft: #e0f2fe;
  --accent: #f59e0b;
  --ok: #16a34a;
  --ok-soft: #dcfce7;
  --warn: #d97706;
  --warn-soft: #fef3c7;
  --err: #dc2626;
  --err-soft: #fee2e2;
  --rail-bg: #0f172a;
  --rail-text: #cbd5e1;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(15,23,42,.06), 0 4px 16px rgba(15,23,42,.06);
  --shadow-lg: 0 10px 40px rgba(15,23,42,.18);
  --touch: 46px;
  --rail-w: 84px;
  --guide-w: 360px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Menlo, Consolas, monospace;
}
:root { --note-bg: #fffbeb; --note-border: #fde68a; --note-text: #92400e; --note-title: #b45309; color-scheme: light; }
/* Karanlık tema: Ayarlar'dan seçilir ya da sistem tercihi */
:root[data-theme="dark"] {
  --bg: #0b1220; --surface: #111a2b; --surface-2: #17213a; --border: #253150; --border-strong: #33415e;
  --text: #e5e9f2; --text-2: #b7c0d3; --text-3: #7d8aa5;
  --primary: #38bdf8; --primary-2: #7dd3fc; --primary-soft: #0c2a3d;
  --ok: #4ade80; --ok-soft: #0b2e1a; --warn: #fbbf24; --warn-soft: #3a2a05; --err: #f87171; --err-soft: #3b1111;
  --rail-bg: #060b16; --rail-text: #b7c0d3;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 4px 16px rgba(0,0,0,.35); --shadow-lg: 0 10px 40px rgba(0,0,0,.6);
  --note-bg: #2a2208; --note-border: #5b4a12; --note-text: #fcd34d; --note-title: #fbbf24;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #0b1220; --surface: #111a2b; --surface-2: #17213a; --border: #253150; --border-strong: #33415e;
  --text: #e5e9f2; --text-2: #b7c0d3; --text-3: #7d8aa5;
  --primary: #38bdf8; --primary-2: #7dd3fc; --primary-soft: #0c2a3d;
  --ok: #4ade80; --ok-soft: #0b2e1a; --warn: #fbbf24; --warn-soft: #3a2a05; --err: #f87171; --err-soft: #3b1111;
  --rail-bg: #060b16; --rail-text: #b7c0d3;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 4px 16px rgba(0,0,0,.35); --shadow-lg: 0 10px 40px rgba(0,0,0,.6);
  --note-bg: #2a2208; --note-border: #5b4a12; --note-text: #fcd34d; --note-title: #fbbf24;
  color-scheme: dark;
} }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font); font-size: 15px; color: var(--text); background: var(--bg);
  -webkit-text-size-adjust: 100%; overscroll-behavior: none; -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { fill: currentColor; }
a { color: var(--primary); }
h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: -.01em; }
h1 { font-size: 24px; } h2 { font-size: 19px; } h3 { font-size: 16px; } h4 { font-size: 13px; color: var(--text-2); text-transform: uppercase; letter-spacing: .06em; }
p { margin: 0 0 8px; line-height: 1.5; }
.muted { color: var(--text-2); } .small { font-size: 13px; } .mono { font-family: var(--mono); }
.hidden { display: none !important; }

/* ---------- Uygulama iskeleti ---------- */
.app { display: grid; grid-template-columns: var(--rail-w) 1fr 0; height: 100vh; height: 100dvh; overflow: hidden; }
.app.guide-open { grid-template-columns: var(--rail-w) 1fr var(--guide-w); }

.rail { background: var(--rail-bg); color: var(--rail-text); display: flex; flex-direction: column; align-items: stretch; padding: 8px 6px; gap: 2px; overflow-y: auto; }
.rail-brand { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0 14px; color: #fff; }
.rail-brand-text { font-weight: 800; font-size: 12px; letter-spacing: .04em; }
.rail-btn { background: transparent; border: 0; color: var(--rail-text); border-radius: 10px; min-height: 60px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-size: 11.5px; font-weight: 600; }
.rail-btn svg { width: 24px; height: 24px; }
.rail-btn:hover { background: rgba(255,255,255,.08); color: #fff; }
.rail-btn.active { background: var(--primary); color: #fff; }
.rail-btn:disabled { opacity: .35; cursor: not-allowed; }
.rail-spacer { flex: 1; }
.rail-status { font-size: 10.5px; text-align: center; padding: 8px 0 4px; display: flex; flex-direction: column; align-items: center; gap: 3px; color: var(--text-3); }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; background: var(--text-3); }
.dot.ok { background: #22c55e; } .dot.busy { background: var(--accent); animation: pulse 1s infinite; } .dot.err { background: #ef4444; }
@keyframes pulse { 50% { opacity: .3; } }

.main { display: flex; flex-direction: column; min-width: 0; overflow: hidden; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 8px 16px; background: var(--surface); border-bottom: 1px solid var(--border); min-height: 58px; }
.crumbs { display: flex; align-items: center; gap: 6px; font-weight: 600; font-size: 15px; min-width: 0; overflow: hidden; white-space: nowrap; }
.crumbs .sep { color: var(--text-3); }
.crumbs .crumb-link { color: var(--text-2); background: none; border: 0; padding: 4px 6px; border-radius: 6px; font-weight: 600; }
.crumbs .crumb-link:hover { background: var(--surface-2); color: var(--text); }
.crumbs .current { color: var(--text); font-size: 17px; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.search-box { display: flex; align-items: center; gap: 6px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 0 12px; height: 40px; width: 240px; }
.search-box svg { width: 18px; height: 18px; color: var(--text-3); flex: none; }
.search-box input { border: 0; background: transparent; outline: 0; width: 100%; font-size: 14px; }
.online-badge { font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px; background: var(--ok-soft); color: var(--ok); }
.online-badge.off { background: var(--warn-soft); color: var(--warn); }

.content { flex: 1; overflow: auto; padding: 16px; -webkit-overflow-scrolling: touch; }
.content.no-pad { padding: 0; }

/* ---------- Rehber paneli ---------- */
.guide-head strong { flex: 1; }
.guide { background: var(--surface); border-left: 1px solid var(--border); display: none; flex-direction: column; overflow: hidden; }
.app.guide-open .guide { display: flex; }
.guide-head { display: flex; align-items: center; gap: 8px; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--border); font-size: 15px; }
.guide-body { overflow: auto; padding: 16px; line-height: 1.55; font-size: 14px; }
.guide-body h3 { margin: 0 0 6px; font-size: 16px; }
.guide-body h4 { margin: 14px 0 6px; }
.guide-body .g-fig { margin: 10px 0 14px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; }
.guide-body .g-fig svg { width: 100%; height: auto; display: block; background: #fff; border-radius: 6px; }
.guide-body .g-fig figcaption { font-size: 12.5px; color: var(--text-2); margin-top: 6px; }
.guide-body ul { padding-left: 18px; margin: 6px 0; }
.guide-body li { margin: 3px 0; }
.guide-body .g-field { border-left: 3px solid var(--primary-2); padding: 6px 10px; margin: 8px 0; background: var(--surface-2); border-radius: 0 8px 8px 0; }
.guide-body .g-field b { display: block; color: var(--primary); }
.guide-body code { background: var(--surface-2); padding: 1px 5px; border-radius: 4px; font-family: var(--mono); font-size: 12.5px; }
.guide-body .tip { background: var(--warn-soft); border-radius: 8px; padding: 8px 10px; margin: 8px 0; font-size: 13px; }
.guide-body .example { background: var(--ok-soft); border-radius: 8px; padding: 8px 10px; margin: 8px 0; font-size: 13px; }
/* "Bu ekranda ne var?" bloğu */
.guide-body .g-screen { background: var(--note-bg); border: 1px solid var(--note-border); border-radius: 10px; padding: 8px 12px; margin: 8px 0 14px; }
.guide-body .g-screen summary { cursor: pointer; font-size: 14px; list-style: none; display: flex; align-items: center; gap: 8px; }
.guide-body .g-screen summary::before { content: '▸'; color: var(--note-title); transition: transform .15s; }
.guide-body .g-screen[open] summary::before { transform: rotate(90deg); }
.guide-body .g-screen summary span { font-size: 12px; color: var(--note-title); font-weight: 600; }
.guide-body .g-screen ul { padding-left: 16px; margin: 8px 0 2px; }
.guide-body .g-screen li { margin: 5px 0; font-size: 13.5px; line-height: 1.45; }
.guide-body .g-screen li b { color: var(--note-text); }
.guide-body .g-screen h4 { margin: 10px 0 4px; }
.guide-body .g-screen-cols li b { color: var(--primary); }
.guide-body .g-screen-cols li i { color: var(--text-3); font-size: 12px; }
/* belge tarzı şekiller */
.guide-body .g-fig.doc { padding: 12px; }
.guide-body figure.g-fig { cursor: zoom-in; }
.guide-body figure.g-fig.zoomed { cursor: default; margin: 0; }
.guide-body figure.g-fig.zoomed svg { max-width: 900px; margin: 0 auto; }
@media (min-width: 1500px) { :root { --guide-w: 440px; } }
.guide-body .g-fig figcaption.top { margin: 0 0 10px; font-size: 13.5px; color: var(--text); line-height: 1.45; }
.guide-body .g-fig figcaption.top b { color: var(--text); }
.guide-body .fig-n { font-family: var(--mono); font-size: 12px; color: var(--primary); font-weight: 700; }
.guide-body .g-fig .note { margin-top: 8px; font-size: 12.5px; color: var(--text-2); line-height: 1.45; border-top: 1px dashed var(--border); padding-top: 6px; }
.guide-body .g-rule { display: flex; gap: 10px; align-items: flex-start; margin: 8px 0; font-size: 13.5px; line-height: 1.45; }
.guide-body .g-rule .n { flex: none; width: 22px; height: 22px; border-radius: 50%; background: var(--text); color: var(--surface); font-weight: 800; font-size: 12px; display: inline-flex; align-items: center; justify-content: center; margin-top: 1px; }
.guide-body .g-rule b { color: var(--text); }
.guide-body p b:first-child { color: var(--text); }

/* ---------- Genel bileşenler ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: var(--touch); padding: 0 18px; border-radius: var(--radius); border: 1px solid var(--border-strong); background: var(--surface); font-weight: 600; font-size: 15px; white-space: nowrap; }
.btn svg { width: 20px; height: 20px; }
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
:root[data-theme="dark"] .btn.primary, :root[data-theme="dark"] .rail-btn.active { color: #06121f; }
.btn.primary:hover { filter: brightness(.92); }
.btn.danger { color: var(--err); border-color: #fca5a5; }
.btn.danger:hover { background: var(--err-soft); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.sm { min-height: 36px; padding: 0 12px; font-size: 13.5px; border-radius: 8px; }
.btn.lg { min-height: 54px; font-size: 16px; padding: 0 24px; }
.btn.block { width: 100%; }
.icon-btn { background: transparent; border: 0; width: 42px; height: 42px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; color: var(--text-2); }
.icon-btn svg { width: 22px; height: 22px; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn.danger:hover { background: var(--err-soft); color: var(--err); }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow); }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.card-b { padding: 16px 18px; }
.grid { display: grid; gap: 16px; }
.grid.c2 { grid-template-columns: repeat(2, 1fr); } .grid.c3 { grid-template-columns: repeat(3, 1fr); } .grid.c4 { grid-template-columns: repeat(4, 1fr); }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 10px; }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); }
.badge.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.badge.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge.err { background: var(--err-soft); color: var(--err); border-color: transparent; }
.badge.info { background: var(--primary-soft); color: var(--primary); border-color: transparent; }
.swatch { width: 14px; height: 14px; border-radius: 3px; display: inline-block; border: 1px solid rgba(0,0,0,.15); flex: none; }

/* Form alanları */
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field label { font-size: 13px; font-weight: 600; color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.field label .req { color: var(--err); }
.help-dot { width: 18px; height: 18px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); font-size: 11px; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; border: 0; padding: 0; cursor: pointer; flex: none; }
.help-dot:hover { background: var(--primary); color: #fff; }
.input, .select, .textarea { min-height: var(--touch); padding: 8px 12px; border: 1.5px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); width: 100%; outline: 0; font-size: 15px; }
.textarea { min-height: 80px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--primary-2); box-shadow: 0 0 0 3px var(--primary-soft); }
.input.err { border-color: var(--err); background: var(--err-soft); }
.input.warn { border-color: var(--warn); }
.input[readonly] { background: var(--surface-2); color: var(--text-2); }
.field .hint { font-size: 12px; color: var(--text-3); }
.field .error { font-size: 12.5px; color: var(--err); font-weight: 600; }

/* ---------- Sekmeler ---------- */
.tabs { display: flex; gap: 2px; overflow-x: auto; border-bottom: 1px solid var(--border); background: var(--surface); padding: 0 12px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { flex: none; background: none; border: 0; border-bottom: 3px solid transparent; padding: 0 14px; min-height: 50px; font-weight: 600; color: var(--text-2); font-size: 14.5px; display: inline-flex; align-items: center; gap: 7px; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab .cnt { background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 0 7px; font-size: 11.5px; min-width: 20px; text-align: center; color: var(--text-2); }
.tab.has-err .cnt { background: var(--err-soft); color: var(--err); border-color: transparent; }

/* ---------- Loglama düzeni ---------- */
.log-layout { display: grid; grid-template-columns: 1fr 300px; height: 100%; min-height: 0; }
.log-layout.strip-hidden { grid-template-columns: 1fr; }
.log-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.log-head { background: var(--surface); padding: 10px 16px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; border-bottom: 1px solid var(--border); }
.log-head .hole-id { font-size: 22px; font-weight: 800; }
.log-head .progress { flex: 1; min-width: 160px; display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); }
.progress-bar { flex: 1; height: 8px; background: var(--border); border-radius: 999px; overflow: hidden; }
.progress-bar > i { display: block; height: 100%; background: var(--ok); border-radius: 999px; }
.log-body { flex: 1; overflow: auto; padding: 12px 16px 0; }
.log-strip { border-left: 1px solid var(--border); background: var(--surface); overflow: auto; }

.infostrip { display: flex; gap: 14px; align-items: flex-start; background: var(--primary-soft); border: 1px solid color-mix(in srgb, var(--primary) 35%, transparent); border-radius: 12px; padding: 12px 14px; margin-bottom: 12px; font-size: 14px; line-height: 1.5; }
.infostrip .is-icon { flex: none; width: 34px; height: 34px; border-radius: 50%; background: var(--surface); display: flex; align-items: center; justify-content: center; color: var(--primary); font-weight: 800; }
.infostrip .is-body { flex: 1; min-width: 0; }
.infostrip .is-body > b { display: block; margin-bottom: 2px; }
.infostrip .is-actions { display: flex; gap: 6px; flex: none; }
.infostrip.collapsed .is-body p { display: none; }

/* Tablo (grid) */
.tbl-wrap { overflow: auto; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
table.grid-t { border-collapse: separate; border-spacing: 0; width: 100%; min-width: 720px; }
.grid-t th { position: sticky; top: 0; z-index: 2; background: var(--surface-2); text-align: left; font-size: 12.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-2); padding: 10px 8px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.grid-t th .help-dot { margin-left: 4px; vertical-align: middle; }
.grid-t td { padding: 5px 4px; border-bottom: 1px solid var(--border); vertical-align: top; }
.grid-t tr:last-child td { border-bottom: 0; }
.grid-t tr.selected td { background: var(--primary-soft); }
.grid-t tr.has-err td { background: var(--err-soft); }
.grid-t td .input, .grid-t td .select { min-height: 42px; padding: 6px 10px; font-size: 14.5px; }
.grid-t td .input.num { text-align: right; font-family: var(--mono); width: 96px; }
.grid-t td .input.txt { min-width: 180px; }
.grid-t td .rowno { color: var(--text-3); font-size: 12px; padding-top: 12px; text-align: center; font-family: var(--mono); }
.grid-t td .calc { display: inline-block; min-height: 42px; line-height: 42px; padding: 0 10px; font-family: var(--mono); color: var(--text-2); background: var(--surface-2); border-radius: 8px; min-width: 70px; text-align: right; white-space: nowrap; }
.grid-t td.actions { white-space: nowrap; }
.row-err { font-size: 12px; color: var(--err); padding: 2px 8px 4px; font-weight: 600; }
.row-warn { font-size: 12px; color: var(--warn); padding: 2px 8px 4px; font-weight: 600; }
.tbl-empty { padding: 36px 16px; text-align: center; color: var(--text-2); }
.tbl-empty b { display: block; font-size: 16px; color: var(--text); margin-bottom: 4px; }

/* Kod seçici butonu (dokunmatik) */
.pick { min-height: 42px; border: 1.5px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); padding: 4px 10px; display: inline-flex; align-items: center; gap: 8px; min-width: 120px; text-align: left; font-size: 14.5px; }
.pick:hover { border-color: var(--primary-2); }
.pick .pk-code { font-weight: 700; font-family: var(--mono); }
.pick .pk-name { color: var(--text-2); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 130px; }
.pick .pk-empty { color: var(--text-3); }
.pick.err { border-color: var(--err); }
.pick .chev { margin-left: auto; width: 16px; height: 16px; color: var(--text-3); flex: none; }
.int-bars { display: inline-flex; gap: 2px; align-items: flex-end; height: 16px; }
.int-bars i { width: 5px; background: var(--border-strong); border-radius: 1px; display: block; }
.int-bars i.on { background: var(--primary); }

/* Alt işlem çubuğu */
.actionbar { position: sticky; bottom: 0; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(8px); border-top: 1px solid var(--border); padding: 10px 16px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; z-index: 5; margin: 12px -16px 0; }
.actionbar .grow { flex: 1; }

/* ---------- Bottom sheet (kod seçim) ---------- */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(2,6,23,.55); z-index: 50; display: flex; align-items: flex-end; justify-content: center; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.sheet { background: var(--surface); width: min(860px, 100%); max-height: 88dvh; border-radius: 18px 18px 0 0; display: flex; flex-direction: column; box-shadow: var(--shadow-lg); animation: up .2s ease-out; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
.sheet-h { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.sheet-h h3 { flex: 1; }
.sheet-search { padding: 10px 18px; border-bottom: 1px solid var(--border); }
.sheet-b { overflow: auto; padding: 14px 18px 24px; }
.chips { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
.chip { display: flex; align-items: center; gap: 10px; min-height: 56px; padding: 6px 12px; border: 1.5px solid var(--border); border-radius: 12px; background: var(--surface); text-align: left; }
.chip:hover { border-color: var(--primary-2); background: var(--primary-soft); }
.chip.selected { border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 0 0 2px var(--primary-soft); }
.chip .swatch { width: 22px; height: 22px; border-radius: 6px; }
.chip .c-code { font-weight: 800; font-family: var(--mono); font-size: 15px; }
.chip .c-name { font-size: 12.5px; color: var(--text-2); line-height: 1.2; }
.chip .c-desc { font-size: 11.5px; color: var(--text-3); }
.chip-group-title { grid-column: 1/-1; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); margin-top: 8px; }
.sheet-guide { background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 10px 14px; margin-bottom: 12px; font-size: 13.5px; line-height: 1.5; display: flex; gap: 12px; align-items: flex-start; }
.sheet-guide svg { width: 200px; height: auto; flex: none; }

/* Modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(2,6,23,.6); z-index: 60; display: flex; align-items: center; justify-content: center; padding: 16px; animation: fade .15s; }
.modal { background: var(--surface); border-radius: 16px; width: min(640px, 100%); max-height: 92dvh; display: flex; flex-direction: column; box-shadow: var(--shadow-lg); }
.modal.wide { width: min(980px, 100%); }
.modal-h { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; }
.modal-h h3 { flex: 1; font-size: 18px; }
.modal-b { padding: 18px 20px; overflow: auto; }
.modal-f { padding: 12px 20px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }

/* Toast */
.toast-root { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast { background: var(--text); color: var(--surface); padding: 12px 18px; border-radius: 10px; font-weight: 600; font-size: 14px; box-shadow: var(--shadow-lg); animation: up .2s; }
.toast.ok { background: var(--ok); } .toast.err { background: var(--err); } .toast.warn { background: var(--warn); }

/* ---------- Panel (dashboard) ---------- */
.stat { padding: 16px 18px; }
.stat .v { font-size: 30px; font-weight: 800; letter-spacing: -.02em; }
.stat .l { font-size: 13px; color: var(--text-2); font-weight: 600; }
.hole-card { padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; cursor: pointer; transition: transform .1s; }
.hole-card:hover { transform: translateY(-1px); border-color: var(--primary-2); }
.hole-card .hc-id { font-size: 18px; font-weight: 800; }
.mini-strip { height: 14px; border-radius: 4px; overflow: hidden; display: flex; background: var(--border); }
.mini-strip i { display: block; height: 100%; }

/* Onboarding */
.onb-steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.onb-step { background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 12px; font-size: 13px; line-height: 1.45; }
.onb-step .n { width: 28px; height: 28px; border-radius: 50%; background: var(--primary); color: var(--surface); font-weight: 800; display: flex; align-items: center; justify-content: center; margin-bottom: 8px; }
.onb-step svg { width: 100%; height: 70px; margin: 6px 0; }

/* Şerit log (striplog) */
.strip-tools { display: flex; align-items: center; gap: 6px; padding: 8px 10px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); z-index: 2; font-size: 12.5px; flex-wrap: wrap; }
.strip-svg { display: block; }
.strip-svg .clickable { cursor: pointer; }
.strip-svg .clickable:hover { opacity: .8; }
.strip-legend { padding: 8px 10px; font-size: 11.5px; display: flex; flex-wrap: wrap; gap: 6px 10px; border-top: 1px solid var(--border); }
.strip-legend span { display: inline-flex; align-items: center; gap: 4px; }

/* Fotoğraf ızgarası */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.photo { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--surface); }
.photo img { width: 100%; aspect-ratio: 4/3; object-fit: cover; display: block; background: #000; }
.photo .p-b { padding: 8px 10px; font-size: 13px; }
.dropzone { border: 2px dashed var(--border-strong); border-radius: 14px; padding: 26px; text-align: center; color: var(--text-2); background: var(--surface); }
.dropzone.drag { border-color: var(--primary); background: var(--primary-soft); }

/* Kod kütüphanesi */
.lib-table { width: 100%; border-collapse: collapse; }
.lib-table td, .lib-table th { padding: 8px 10px; border-bottom: 1px solid var(--border); text-align: left; font-size: 14px; }
.lib-table th { font-size: 12px; text-transform: uppercase; color: var(--text-2); }

/* Yazdırma */
@media print {
  :root, :root[data-theme="dark"] { --bg: #fff; --surface: #fff; --surface-2: #f8fafc; --border: #e2e8f0; --border-strong: #cbd5e1; --text: #0f172a; --text-2: #475569; --text-3: #94a3b8; --primary-soft: #e0f2fe; --ok-soft: #dcfce7; --warn-soft: #fef3c7; --err-soft: #fee2e2; color-scheme: light; }
  html, body { height: auto; background: #fff; }
  .rail, .topbar, .guide, .actionbar, .strip-tools, .no-print, #toastRoot, #sheetRoot, #modalRoot { display: none !important; }
  .app { display: block; height: auto; overflow: visible; }
  .main { display: block; overflow: visible; }
  .content, .log-body { overflow: visible; padding: 0; height: auto; }
  .card { box-shadow: none; }
}

/* ---------- Duyarlı düzen ---------- */
.only-mobile { display: none; }
@media (max-width: 1180px) {
  .app.guide-open { grid-template-columns: var(--rail-w) 1fr; }
  .app.guide-open .guide { position: fixed; right: 0; top: 0; bottom: 0; width: min(420px, 92vw); z-index: 40; box-shadow: var(--shadow-lg); }
  .log-layout { grid-template-columns: 1fr 240px; }
  .grid.c4 { grid-template-columns: repeat(2, 1fr); }
  .onb-steps { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
  .log-layout { grid-template-columns: 1fr; }
  .log-strip { display: none; }
  .log-layout.strip-shown .log-strip { display: block; position: fixed; right: 0; top: 58px; bottom: 0; width: min(300px, 85vw); z-index: 30; box-shadow: var(--shadow-lg); }
  .grid.c3 { grid-template-columns: repeat(2, 1fr); }
  .search-box { width: 170px; }
}
@media (max-width: 680px) {
  :root { --rail-w: 0px; }
  .app, .app.guide-open { grid-template-columns: 1fr; } /* ray ve rehber sabit konumlu: akışta sadece ana alan kalır */
  .rail { position: fixed; left: 0; top: 0; bottom: 0; width: 220px; z-index: 45; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow-lg); }
  .rail.open { transform: none; }
  .rail-btn { flex-direction: row; justify-content: flex-start; min-height: 50px; padding: 0 14px; gap: 12px; font-size: 14px; }
  .only-mobile { display: inline-flex; }
  .grid.c2, .grid.c3, .grid.c4 { grid-template-columns: 1fr; }
  .onb-steps { grid-template-columns: 1fr; }
  .search-box { display: none; }
  .content { padding: 12px; }
  .log-body { padding: 10px 10px 0; }
  .actionbar { margin: 12px -10px 0; padding: 10px; }
  .chips { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .infostrip { flex-wrap: wrap; gap: 10px; }
  .infostrip .is-icon { display: none; }
  .infostrip .is-actions { width: 100%; justify-content: flex-end; }
  .log-head .hole-id { font-size: 19px; }
}
