:root {
  --brand: #0f3d4c;
  --brand-2: #14708a;
  --accent: #f59e0b;
  --sel: #ff2d55;
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-2: #f0f3f6;
  --text: #13202b;
  --muted: #5d6b78;
  --line: #dde3e9;
  --shadow: 0 6px 24px rgba(15, 30, 45, .16);
  --radius: 14px;
  --top-h: 56px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1418;
    --surface: #152027;
    --surface-2: #1c2a33;
    --text: #e6edf2;
    --muted: #93a4b1;
    --line: #273843;
    --shadow: 0 6px 24px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
button { font: inherit; color: inherit; cursor: pointer; }
[hidden] { display: none !important; }
.muted { color: var(--muted); font-size: 13px; }

/* ---------- Üst çubuk ---------- */
.topbar {
  height: calc(var(--top-h) + env(safe-area-inset-top, 0px));
  padding: env(safe-area-inset-top, 0px) 12px 0;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  background: var(--brand); color: #fff;
  position: relative; z-index: 1001;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand img { border-radius: 7px; }
.brand-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.brand-text strong { font-size: 15px; }
.brand-text span { font-size: 12px; opacity: .8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 46vw; }
.top-actions { display: flex; gap: 8px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 40px; padding: 0 14px; border-radius: 10px; border: 1px solid transparent;
  font-weight: 600; font-size: 14px; white-space: nowrap;
}
.btn.sm { height: 34px; padding: 0 10px; font-size: 13px; }
.btn.lg { height: 48px; padding: 0 22px; font-size: 16px; }
.btn.primary { background: var(--accent); color: #1b1300; }
.btn.primary:disabled { opacity: .45; cursor: default; }
.btn.ghost { background: transparent; border-color: currentColor; }
.topbar .btn.ghost { border-color: rgba(255,255,255,.4); color: #fff; }
.panel .btn.ghost, .dlg .btn.ghost, .measure-card .btn.ghost { border-color: var(--line); color: var(--text); background: var(--surface); }
.icon-btn { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 9px; border: 0; background: transparent; }
.icon-btn:hover { background: var(--surface-2); }

/* ---------- Yerleşim ---------- */
.layout { position: relative; height: calc(100% - var(--top-h) - env(safe-area-inset-top, 0px)); display: flex; }
.map-wrap { position: relative; flex: 1; min-width: 0; z-index: 0; } /* Leaflet kontrolleri panelin altında kalsın */
#map { position: absolute; inset: 0; background: #e9edf0; }
#map.blank { background: #fbfbfa; }
@media (prefers-color-scheme: dark) { #map.blank { background: #f5f5f2; } }

/* ---------- Panel ---------- */
.panel {
  background: var(--surface); display: flex; flex-direction: column; z-index: 1000;
}
.sheet-handle { display: none; }
.tabs { display: flex; border-bottom: 1px solid var(--line); padding: 0 6px; flex: none; }
.tabs button {
  flex: 1; border: 0; background: none; padding: 10px 4px 9px; font-size: 14px; font-weight: 600; color: var(--muted);
  border-bottom: 2.5px solid transparent;
}
.tabs button[aria-selected="true"] { color: var(--brand-2); border-bottom-color: var(--brand-2); }
@media (prefers-color-scheme: dark) { .tabs button[aria-selected="true"] { color: #5cc6e0; border-bottom-color: #5cc6e0; } }
.tab-body { flex: 1; overflow: auto; overscroll-behavior: contain; padding: 14px 16px calc(16px + var(--safe-b)); }

@media (min-width: 900px) {
  .panel { width: 380px; border-right: 1px solid var(--line); }
  .desktop-hide { display: none !important; }
}
@media (max-width: 899px) {
  .desktop-only { display: none !important; }
  .panel {
    position: absolute; left: 0; right: 0; bottom: 0;
    border-radius: 18px 18px 0 0; box-shadow: var(--shadow);
    height: 62%; transform: translateY(calc(100% - 70px - var(--safe-b)));
    transition: transform .25s ease;
  }
  .panel[data-state="half"] { transform: translateY(0); }
  .panel[data-state="full"] { transform: translateY(0); height: calc(100% - 8px); }
  .panel[data-state="hidden"] { transform: translateY(100%); }
  .sheet-handle {
    display: grid; place-items: center; height: 20px; border: 0; background: none; flex: none; padding: 0;
  }
  .sheet-handle span { width: 42px; height: 5px; border-radius: 3px; background: var(--line); }
  .map-tools { bottom: calc(84px + var(--safe-b)) !important; }
  .chip { bottom: calc(84px + var(--safe-b)) !important; }
  .measure-card { bottom: calc(82px + var(--safe-b)) !important; }
}

/* ---------- Harita araçları ---------- */
.map-tools { position: absolute; right: 12px; bottom: 28px; z-index: 900; display: flex; flex-direction: column; gap: 10px; }
.fab {
  width: 46px; height: 46px; border-radius: 50%; border: 0; display: grid; place-items: center;
  background: var(--surface); color: var(--text); box-shadow: var(--shadow);
}
.fab.on { background: var(--brand-2); color: #fff; }
.fab.busy svg { animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .3; } }
.base-menu {
  position: absolute; right: 68px; bottom: 28px; z-index: 950; background: var(--surface); border-radius: 12px;
  box-shadow: var(--shadow); padding: 6px; display: flex; flex-direction: column; min-width: 190px;
}
@media (max-width: 899px) { .base-menu { bottom: calc(84px + var(--safe-b)); } }
.base-menu button { text-align: left; border: 0; background: none; padding: 10px 12px; border-radius: 8px; }
.base-menu button.on { background: var(--surface-2); font-weight: 700; }

.chip {
  position: absolute; left: 12px; bottom: 28px; z-index: 900; max-width: calc(100% - 90px);
  background: var(--brand); color: #fff; padding: 8px 12px; border-radius: 999px; font-size: 13px; font-weight: 600;
  box-shadow: var(--shadow); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.coords {
  position: absolute; left: 50%; transform: translateX(-50%); bottom: 6px; z-index: 900;
  background: rgba(19, 32, 43, .78); color: #fff; font: 12px/1.3 ui-monospace, Consolas, monospace;
  padding: 4px 10px; border-radius: 6px; pointer-events: none;
}

/* ---------- Ölçüm ---------- */
.measure-card {
  position: absolute; left: 12px; bottom: 28px; z-index: 950; width: min(340px, calc(100% - 84px));
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px;
}
.m-vals { display: flex; gap: 16px; }
.m-vals div { flex: 1; }
.m-vals small { display: block; color: var(--muted); font-size: 12px; }
.m-vals b { font-size: 17px; font-variant-numeric: tabular-nums; }
.m-actions { display: flex; gap: 6px; margin-top: 10px; }
.m-actions .btn { flex: 1; }
.hint { margin: 8px 0 0; font-size: 12px; color: var(--muted); }

/* ---------- Karşılama ---------- */
.welcome { position: absolute; inset: 0; z-index: 980; display: grid; place-items: center; padding: 20px; background: var(--bg); overflow: auto; }
.welcome-card { max-width: 440px; width: 100%; text-align: center; }
.welcome-card h1 { font-size: 22px; margin: 14px 0 6px; }
.welcome-card p { color: var(--muted); margin: 0 0 18px; }
.recent { margin-top: 26px; text-align: left; }
.recent h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 8px; }
.recent-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 12px; margin-bottom: 8px; width: 100%; text-align: left;
}
.recent-item .ri-main { flex: 1; min-width: 0; }
.recent-item b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recent-item small { color: var(--muted); }
.drop-overlay {
  position: absolute; inset: 10px; z-index: 990; border: 3px dashed var(--accent); border-radius: 18px;
  background: rgba(15, 61, 76, .82); color: #fff; display: grid; place-items: center; font-size: 22px; font-weight: 700;
}

/* ---------- Panel içerikleri ---------- */
.empty { color: var(--muted); text-align: center; padding: 18px 8px; font-size: 14px; }
.feat-head { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 10px; }
.feat-head .sw { width: 14px; height: 14px; border-radius: 4px; margin-top: 6px; flex: none; }
.feat-head h2 { font-size: 20px; margin: 0; line-height: 1.25; word-break: break-word; }
.feat-head p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); gap: 8px; margin: 10px 0 12px; }
.stat { background: var(--surface-2); border-radius: 10px; padding: 8px 10px; }
.stat small { display: block; color: var(--muted); font-size: 11.5px; }
.stat b { font-size: 15px; font-variant-numeric: tabular-nums; word-break: break-word; }
.actions { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.actions .btn { flex: 1 1 auto; }
.kv { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.kv td { padding: 6px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.kv td:first-child { color: var(--muted); width: 42%; }
h3.sec { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 18px 0 8px; display: flex; align-items: center; justify-content: space-between; }
.seg-mini { display: inline-flex; background: var(--surface-2); border-radius: 8px; padding: 2px; text-transform: none; letter-spacing: 0; }
.seg-mini button { border: 0; background: none; font-size: 12px; padding: 4px 8px; border-radius: 6px; color: var(--muted); }
.seg-mini button.on { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.1); }
.coord-table { width: 100%; border-collapse: collapse; font: 12.5px/1.35 ui-monospace, Consolas, monospace; font-variant-numeric: tabular-nums; }
.coord-table th { text-align: left; font: 600 11.5px system-ui, sans-serif; color: var(--muted); padding: 4px 4px; border-bottom: 1px solid var(--line); position: sticky; top: -14px; background: var(--surface); }
.coord-table td { padding: 5px 4px; border-bottom: 1px solid var(--line); }
.coord-table td.num { text-align: right; }
.coord-table tr.edge td { color: var(--muted); font-size: 11.5px; padding-top: 0; padding-bottom: 3px; }

.layer-tools { display: flex; gap: 6px; margin-bottom: 10px; flex-wrap: wrap; }
.layer-row { display: flex; align-items: center; gap: 10px; padding: 9px 2px; border-bottom: 1px solid var(--line); }
.layer-row input { width: 18px; height: 18px; accent-color: var(--brand-2); }
.layer-row .sw { width: 16px; height: 16px; border-radius: 4px; border: 1px solid rgba(0,0,0,.15); flex: none; }
.layer-row .ln { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.layer-row .cnt { color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.layer-row .solo { border: 0; background: none; color: var(--brand-2); font-size: 12px; padding: 2px 4px; }
.toggles label { display: flex; align-items: center; gap: 10px; padding: 8px 2px; }
.toggles input { width: 18px; height: 18px; accent-color: var(--brand-2); }

.search { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 12px; padding: 0 12px; background: var(--surface-2); }
.search input { flex: 1; border: 0; background: none; outline: none; height: 44px; font: inherit; color: var(--text); min-width: 0; }
.results { margin-top: 10px; }
.res {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 10px 6px; border: 0; border-bottom: 1px solid var(--line); background: none;
}
.res:hover { background: var(--surface-2); }
.res .sw { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.res .rm { flex: 1; min-width: 0; }
.res b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.res small { color: var(--muted); }
.res .ra { color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }

.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; flex: 1; }
.field label { font-size: 12px; color: var(--muted); }
.field select { height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); padding: 0 10px; font: inherit; }
.row2 { display: flex; gap: 10px; }
.warn { background: #fff7e6; color: #7a4b00; border-radius: 10px; padding: 8px 10px; font-size: 13px; margin: 8px 0; }
@media (prefers-color-scheme: dark) { .warn { background: #3a2a0c; color: #ffd38a; } }
.export-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }

/* ---------- Diyalog ---------- */
.dlg { border: 0; border-radius: 18px; padding: 0; width: min(520px, calc(100vw - 24px)); background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.dlg::backdrop { background: rgba(10, 20, 28, .5); }
.dlg form { padding: 16px 18px 18px; }
.dlg header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.dlg h2 { margin: 0; font-size: 18px; }
.dlg fieldset { border: 0; padding: 0; margin: 10px 0; }
.dlg legend { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 6px; }
.opt-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.opt-grid label, .seg label { position: relative; cursor: pointer; }
.opt-grid input, .seg input { position: absolute; opacity: 0; pointer-events: none; }
.opt-grid span { display: block; border: 1.5px solid var(--line); border-radius: 12px; padding: 9px 11px; height: 100%; }
.opt-grid b { display: block; font-size: 14px; }
.opt-grid small { color: var(--muted); font-size: 12px; }
.opt-grid input:checked + span, .seg input:checked + span { border-color: var(--brand-2); background: color-mix(in srgb, var(--brand-2) 10%, transparent); }
.opt-grid input:focus-visible + span, .seg input:focus-visible + span { outline: 2px solid var(--brand-2); }
.seg { display: flex; gap: 6px; flex-wrap: wrap; }
.seg span { display: block; border: 1.5px solid var(--line); border-radius: 999px; padding: 7px 12px; font-size: 13.5px; }
.seg input:disabled + span { opacity: .4; }
.dlg footer { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; }
@media (max-width: 480px) { .opt-grid { grid-template-columns: 1fr; } .dlg footer .btn { flex: 1; } }

/* ---------- Bildirim ---------- */
.toast {
  position: fixed; left: 50%; top: calc(var(--top-h) + 12px + env(safe-area-inset-top, 0px)); transform: translate(-50%, -20px);
  background: #13202b; color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 14px; z-index: 2000;
  opacity: 0; pointer-events: none; transition: .2s; max-width: calc(100vw - 32px); box-shadow: var(--shadow);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Leaflet uyarlamaları ---------- */
.leaflet-container { font: inherit; }
.leaflet-popup-content { margin: 10px 12px; font-size: 13px; }
.leaflet-popup-content .pc-title { font-weight: 700; margin-bottom: 4px; }
.leaflet-popup-content table { border-collapse: collapse; font: 12px ui-monospace, Consolas, monospace; }
.leaflet-popup-content td { padding: 1px 6px 1px 0; }
.leaflet-popup-content .pc-actions { display: flex; gap: 6px; margin-top: 8px; }
.leaflet-popup-content .pc-actions button { border: 1px solid #ccd5dc; background: #fff; border-radius: 7px; padding: 4px 8px; font-size: 12px; }
.leaflet-control-scale { margin-left: 12px !important; }
@media (max-width: 899px) { .leaflet-bottom { bottom: calc(70px + var(--safe-b)); } }
.vtx { position: absolute; transform: translate(6px, -22px); background: #ff2d55; color: #fff; font: 700 11px/1 system-ui, sans-serif; padding: 3px 5px; border-radius: 6px; white-space: nowrap; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.gps-dot { width: 18px; height: 18px; border-radius: 50%; background: #1a73e8; border: 3px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.2), 0 2px 6px rgba(0,0,0,.35); }
.leaflet-text-canvas { position: absolute; left: 0; top: 0; pointer-events: none; z-index: 450; }

/* ---------- Koordinat sistemi diyaloğu ---------- */
.crs-intro { margin: 0 0 4px; font-size: 14px; color: var(--muted); }
.crs-intro b { color: var(--text); }
.zone-list { display: flex; flex-direction: column; gap: 6px; max-height: 38vh; overflow: auto; }
.zone-list label { position: relative; cursor: pointer; }
.zone-list input { position: absolute; opacity: 0; pointer-events: none; }
.zone-list span { display: flex; gap: 10px; align-items: baseline; border: 1.5px solid var(--line); border-radius: 12px; padding: 8px 12px; }
.zone-list b { min-width: 64px; font-variant-numeric: tabular-nums; }
.zone-list small { color: var(--muted); font-size: 12.5px; }
.zone-list input:checked + span { border-color: var(--brand-2); background: color-mix(in srgb, var(--brand-2) 10%, transparent); }
.zone-list input:focus-visible + span { outline: 2px solid var(--brand-2); }
.crs-preview { margin-top: 12px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); font-size: 13.5px; }
.crs-preview.bad { background: #fde8e8; color: #8a1c1c; }
@media (prefers-color-scheme: dark) { .crs-preview.bad { background: #3b1717; color: #ffb4b4; } }
/* Uzun diyaloglarda düğmeler hep görünsün */
.dlg { max-height: calc(100dvh - 24px); }
.dlg footer { position: sticky; bottom: 0; margin: 14px -18px -18px; padding: 12px 18px 18px; background: var(--surface); border-top: 1px solid var(--line); }
.zone-list { max-height: 30vh; }

/* ---------- Yükleniyor ---------- */
.busy { position: absolute; inset: 0; z-index: 995; display: grid; place-items: center; background: rgba(10, 20, 28, .25); }
.busy-card { display: flex; align-items: center; gap: 12px; background: var(--surface); color: var(--text); padding: 14px 18px; border-radius: 14px; box-shadow: var(--shadow); font-weight: 600; }
.spin { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--brand-2); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.note { white-space: pre-wrap; font-size: 13px; background: var(--surface-2); border-radius: 10px; padding: 10px 12px; max-height: 40vh; overflow: auto; }

/* Çoklu seçim listesi */
.res-row { display: flex; align-items: center; border-bottom: 1px solid var(--line); }
.res-row .res { border-bottom: 0; flex: 1; min-width: 0; }
.layer-row .solo + .solo { margin-left: -6px; }

/* ---------- Hakkında ---------- */
.btn.icon-only { width: 40px; padding: 0; }
.link-btn { margin-top: 18px; border: 0; background: none; color: var(--brand-2); font-weight: 600; font-size: 14px; text-decoration: underline; }
.about p { font-size: 14px; margin: 8px 0; }
.about-hero { display: flex; gap: 14px; align-items: center; margin: 6px 0 10px; }
.about-hero img { border-radius: 12px; }
.about-hero div { display: flex; flex-direction: column; line-height: 1.35; }
.about-hero strong { font-size: 17px; }
.about-hero span { font-size: 13px; color: var(--muted); }
.about details { border: 1px solid var(--line); border-radius: 12px; margin-bottom: 8px; }
.about summary { cursor: pointer; padding: 10px 12px; font-weight: 600; font-size: 14px; }
.about details[open] summary { border-bottom: 1px solid var(--line); }
.about ul { margin: 8px 0 10px; padding: 0 14px 0 30px; font-size: 13.5px; }
.about li { margin: 5px 0; }
.about a { color: var(--brand-2); }
.about-foot { text-align: center; color: var(--muted); font-size: 12.5px !important; margin-top: 16px !important; }
@media (max-width: 480px) { .topbar .btn span { display: none; } .topbar .btn { padding: 0 11px; } }
.about-site { display: flex; margin: 16px 0 0; text-decoration: none; }

/* ---------- Köşe bulma ---------- */
.find-card {
  position: absolute; left: 12px; bottom: 28px; z-index: 950; width: min(360px, calc(100% - 84px));
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px; border: 2px solid transparent;
}
.find-card.near { border-color: #22c55e; }
@media (max-width: 899px) { .find-card { bottom: calc(82px + var(--safe-b)) !important; } }
.find-top { display: flex; align-items: center; gap: 8px; }
.find-title { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
.find-title small { color: var(--muted); font-size: 11.5px; }
.find-title b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.find-top select { height: 34px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); font: inherit; padding: 0 6px; }
.find-main { display: flex; align-items: center; gap: 14px; margin: 10px 0 4px; }
.find-arrow { width: 64px; height: 64px; flex: none; fill: #f59e0b; stroke: #9a5b00; stroke-width: 1.5; transition: transform .35s ease; }
.find-card.near .find-arrow { fill: #22c55e; stroke: #15803d; }
.find-vals { display: flex; flex-direction: column; min-width: 0; }
.find-vals b { font-size: 26px; font-variant-numeric: tabular-nums; line-height: 1.1; }
.find-vals small { color: var(--muted); font-size: 12.5px; }
.vtx.find { background: #f59e0b; color: #1b1300; }

/* ---------- Sembol kütüphaneleri ---------- */
.libs { list-style: none; padding: 0; margin: 6px 0; font-size: 13.5px; }
.libs li { display: flex; align-items: center; gap: 8px; padding: 4px 0; border-bottom: 1px solid var(--line); }
.libs li small { color: var(--muted); margin-left: auto; }
.libs .ok { color: #16a34a; font-weight: 700; }
.libs .miss { color: var(--muted); }
.welcome-card .formats { margin: -10px 0 16px; }
.export-grid { grid-template-columns: repeat(4, 1fr); }

/* ---------- Çap ---------- */
.cap-dlg { border: 0; padding: 0; width: calc(100vw - 32px); height: calc(100vh - 32px); max-width: none; max-height: none; border-radius: 16px; background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.cap-dlg::backdrop { background: rgba(10, 20, 28, .55); }
.cap-wrap { display: flex; height: 100%; }
.cap-form { width: 400px; flex: none; overflow: auto; padding: 14px 16px 20px; border-right: 1px solid var(--line); }
.cap-form header { display: flex; align-items: center; justify-content: space-between; }
.cap-form h2 { margin: 0; font-size: 18px; }
.cap-form textarea { width: 100%; font: 13px/1.4 system-ui, sans-serif; border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; background: var(--surface-2); color: var(--text); resize: vertical; }
.cap-status { font-size: 12.5px; padding: 8px 10px; border-radius: 8px; margin: 8px 0; background: #fff7e6; color: #7a4b00; }
.cap-status.ok { background: #e8f7ee; color: #146c35; }
@media (prefers-color-scheme: dark) { .cap-status { background: #3a2a0c; color: #ffd38a; } .cap-status.ok { background: #12301f; color: #8be0a8; } }
.cgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 8px; }
.cf { display: flex; flex-direction: column; gap: 2px; font-size: 11.5px; color: var(--muted); min-width: 0; }
.cf.wide { grid-column: 1 / -1; }
.cf input, .cf select { height: 32px; border: 1px solid var(--line); border-radius: 7px; padding: 0 8px; background: var(--surface-2); color: var(--text); font: 13px system-ui, sans-serif; min-width: 0; }
.cap-view { flex: 1; min-width: 0; display: flex; flex-direction: column; background: #e9edf0; }
@media (prefers-color-scheme: dark) { .cap-view { background: #0b1216; } }
.cap-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 8px 12px; background: var(--surface); border-bottom: 1px solid var(--line); font-size: 13px; }
.cap-bar select { height: 32px; border-radius: 7px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); }
.cap-bar .pan button { width: 30px; height: 30px; border: 1px solid var(--line); background: var(--surface-2); border-radius: 7px; }
.cap-bar .btn { margin-left: auto; }
.cap-canvas { flex: 1; min-height: 0; position: relative; display: grid; place-items: center; overflow: auto; padding: 12px; }
.cap-canvas canvas { box-shadow: 0 4px 18px rgba(0,0,0,.25); background: #fff; }
.cap-wait { position: absolute; top: 16px; left: 50%; transform: translateX(-50%); background: #13202b; color: #fff; padding: 6px 12px; border-radius: 8px; font-size: 13px; }

.cap-tkgm { font-size: 12.5px; padding: 8px 10px; border-radius: 8px; margin: 0 0 8px; background: var(--surface-2); }
.cap-tkgm.ok { background: #e8f7ee; color: #146c35; }
.cap-tkgm.bad { background: #fde8e8; color: #8a1c1c; }
@media (prefers-color-scheme: dark) { .cap-tkgm.ok { background: #12301f; color: #8be0a8; } .cap-tkgm.bad { background: #3b1717; color: #ffb4b4; } }
.cap-tkgm table { width: 100%; border-collapse: collapse; margin: 6px 0 4px; color: var(--text); }
.cap-tkgm td, .cap-tkgm th { text-align: left; padding: 2px 4px; border-bottom: 1px solid rgba(0,0,0,.06); font-weight: 400; }
.cap-tkgm th { color: var(--muted); font-size: 11px; }
.cap-tkgm .ok { color: #16a34a; font-weight: 700; } .cap-tkgm .miss { color: #dc2626; font-weight: 700; }
.field input { height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); padding: 0 10px; font: inherit; }

/* ---------- Kroki ekranı ---------- */
.kgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 10px; }
.kchk { display: flex; align-items: center; gap: 8px; font-size: 13.5px; padding: 5px 0; }
.kchk input { width: 17px; height: 17px; accent-color: var(--brand-2); }
.cf input[type=color] { padding: 2px; height: 32px; }
.ktext { display: flex; gap: 6px; align-items: center; margin-bottom: 6px; }
.ktext input[data-f=text] { flex: 1; min-width: 0; height: 32px; border: 1px solid var(--line); border-radius: 7px; padding: 0 8px; background: var(--surface-2); color: var(--text); font: 13px system-ui, sans-serif; }
.ktext select { height: 32px; border-radius: 7px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); }
.ktext input[type=color] { width: 36px; height: 32px; padding: 2px; border: 1px solid var(--line); border-radius: 7px; }
#kCanvas { touch-action: none; cursor: grab; }
h3.sec .btn { text-transform: none; letter-spacing: 0; }
@media (max-width: 899px) {
  .cap-dlg { width: 100vw; height: 100dvh; border-radius: 0; }
  .cap-wrap { flex-direction: column; }
  .cap-form { width: auto; max-height: 45%; border-right: 0; border-bottom: 1px solid var(--line); }
}
.cap-bar .pan { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.cap-bar .pan button[data-x] { width: auto; padding: 0 10px; white-space: nowrap; font-size: 12.5px; }
