/* ScoreboardAI yönetim paneli — koyu tema */
:root {
  --bg: #0b0f17;
  --bg-2: #111725;
  --panel: #151c2c;
  --panel-2: #1b2438;
  --line: #26314a;
  --line-2: #334166;
  --text: #e6ebf5;
  --muted: #8b97b0;
  --accent: #f97316;
  --accent-2: #fb923c;
  --ok: #22c55e;
  --warn: #eab308;
  --danger: #ef4444;
  --info: #38bdf8;
  --home: #e63946;
  --away: #3b82f6;
  --radius: 10px;
  --shadow: 0 8px 30px rgba(0,0,0,.35);
  --mono: "JetBrains Mono", "Cascadia Mono", Consolas, monospace;
  --c-home_score: #ef4444;
  --c-away_score: #3b82f6;
  --c-clock: #22c55e;
  --c-period: #eab308;
  --c-shot_clock: #a855f7;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font: 14px/1.45 "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-2); }
code, .mono { font-family: var(--mono); }
h1, h2, h3, h4 { margin: 0 0 .6em; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: 20px; } h2 { font-size: 16px; } h3 { font-size: 14px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin-top: 1.2em; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.hidden, [hidden] { display: none !important; }

/* ---- Yerleşim ---- */
.app { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.sidebar {
  background: var(--bg-2); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 16px 12px; position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; gap: 10px; align-items: center; margin-bottom: 22px; padding: 0 6px; }
.brand strong { display: block; font-size: 15px; }
.brand small { color: var(--muted); font-size: 11px; }
.ball {
  width: 30px; height: 30px; border-radius: 50%; flex: none;
  background: radial-gradient(circle at 35% 30%, #fdba74, var(--accent) 55%, #c2410c);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.4);
  position: relative;
}
.ball::after { content: ""; position: absolute; inset: 0; border-radius: 50%;
  background: linear-gradient(transparent 48%, rgba(0,0,0,.55) 48%, rgba(0,0,0,.55) 52%, transparent 52%),
              linear-gradient(90deg, transparent 48%, rgba(0,0,0,.55) 48%, rgba(0,0,0,.55) 52%, transparent 52%); }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar nav a {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px;
  color: var(--muted); text-decoration: none; font-weight: 500;
}
.sidebar nav a svg { width: 18px; height: 18px; fill: currentColor; flex: none; }
.sidebar nav a:hover { background: var(--panel); color: var(--text); }
.sidebar nav a.active { background: var(--panel-2); color: var(--text); box-shadow: inset 3px 0 0 var(--accent); }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.sidebar-foot .user { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 12px; padding: 0 6px; }
.sidebar-foot form { margin: 0; }
.main { padding: 18px 22px 40px; min-width: 0; }
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head h1 { margin: 0; }
.page-head .spacer { flex: 1; }

/* ---- Kartlar ---- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; min-width: 0; }
.card + .card { margin-top: 14px; }
.card-head { display: flex; align-items: center; gap: 8px; margin: -2px 0 12px; }
.card-head h2 { margin: 0; font-size: 14px; }
.card-head .spacer { flex: 1; }
.grid { display: grid; gap: 14px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px 14px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.tight { gap: 4px; }
.stack > * + * { margin-top: 10px; }

/* ---- Form ---- */
label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--muted); font-weight: 500; }
label.inline { flex-direction: row; align-items: center; gap: 8px; }
input, select, textarea {
  background: var(--bg-2); color: var(--text); border: 1px solid var(--line-2);
  border-radius: 7px; padding: 7px 9px; font: inherit; font-size: 13px; min-width: 0;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(249,115,22,.18); }
input[type=range] { padding: 0; accent-color: var(--accent); }
input[type=color] { padding: 2px; height: 32px; width: 46px; }
input[type=checkbox] { accent-color: var(--accent); width: 16px; height: 16px; }
input[type=number] { width: 100%; }
.range-row { display: grid; grid-template-columns: 90px 1fr 46px; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.range-row output { text-align: right; font-family: var(--mono); color: var(--text); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line-2); background: var(--panel-2); color: var(--text);
  padding: 7px 12px; border-radius: 7px; font: inherit; font-weight: 600; font-size: 13px;
  cursor: pointer; text-decoration: none; white-space: nowrap; user-select: none;
  transition: background .12s, border-color .12s, transform .05s;
}
.btn:hover { border-color: var(--muted); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #1a0d03; }
.btn-primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn-danger { background: #3b1414; border-color: #7f1d1d; color: #fecaca; }
.btn-success { background: #0f2e1b; border-color: #166534; color: #bbf7d0; }
.btn-ghost { background: transparent; }
.btn-sm { padding: 4px 9px; font-size: 12px; }
.btn-lg { padding: 11px 18px; font-size: 15px; }
.btn-block { width: 100%; }
.btn.active { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.link { background: none; border: 0; color: var(--accent-2); cursor: pointer; font: inherit; padding: 0; }
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: 7px; overflow: hidden; }
.seg button { border: 0; background: var(--bg-2); color: var(--muted); padding: 5px 10px; font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; }
.seg button + button { border-left: 1px solid var(--line-2); }
.seg button.on { background: var(--accent); color: #1a0d03; }

/* ---- Durum ---- */
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; padding: 3px 9px; border-radius: 999px; background: var(--bg-2); border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.badge.ok { color: #bbf7d0; border-color: #166534; } .badge.ok::before { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.badge.warn { color: #fef08a; border-color: #854d0e; } .badge.warn::before { background: var(--warn); }
.badge.danger { color: #fecaca; border-color: #7f1d1d; } .badge.danger::before { background: var(--danger); animation: blink 1s infinite; }
.badge.plain::before { display: none; }
@keyframes blink { 50% { opacity: .2; } }
.statusbar { display: flex; gap: 8px; flex-wrap: wrap; }
.alert { padding: 10px 12px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--panel-2); margin: 0 0 12px; }
.alert-danger { border-color: #7f1d1d; background: #2a1010; color: #fecaca; }
.alert-success { border-color: #166534; background: #0d2416; color: #bbf7d0; }
.alert-info { border-color: #075985; background: #0b1f2e; color: #bae6fd; }
.alert-warn { border-color: #854d0e; background: #2a200b; color: #fef08a; }

/* ---- Kamera / ROI ---- */
.cam-wrap {
  position: relative; background: #000; border-radius: 8px; overflow: hidden;
  border: 1px solid var(--line); aspect-ratio: 16 / 9; user-select: none;
}
.cam-viewport { position: absolute; inset: 0; transform-origin: 0 0; }
.cam-viewport video, .cam-viewport canvas.cam-still { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: fill; transform-origin: 50% 50%; }
.cam-empty { position: absolute; inset: 0; pointer-events: none; display: grid; place-items: center; color: var(--muted); text-align: center; padding: 20px; }
.cam-empty svg { width: 46px; height: 46px; fill: var(--line-2); display: block; margin: 0 auto 8px; }
.cam-alert { position: absolute; left: 12px; right: 12px; top: 12px; z-index: 30; }
.roi-layer { position: absolute; inset: 0; z-index: 5; cursor: default; }
.roi-layer.drawing { cursor: crosshair; }
.roi-layer.panning { cursor: grab; }
.roi {
  position: absolute; border: 2px solid var(--c); background: color-mix(in srgb, var(--c) 12%, transparent);
  cursor: move; touch-action: none;
}
.roi.selected { box-shadow: 0 0 0 1px #000, 0 0 0 3px color-mix(in srgb, var(--c) 50%, transparent); background: color-mix(in srgb, var(--c) 20%, transparent); }
.roi .roi-label {
  position: absolute; left: -2px; bottom: 100%; background: var(--c); color: #000;
  font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 4px 4px 0 0; white-space: nowrap; pointer-events: none;
}
.roi .roi-read { position: absolute; right: -2px; top: 100%; background: rgba(0,0,0,.8); color: #fff; font: 600 11px var(--mono); padding: 1px 6px; border-radius: 0 0 4px 4px; pointer-events: none; white-space: nowrap; }
.roi .cells { position: absolute; inset: 0; pointer-events: none; display: flex; }
.roi .cells span { border-right: 1px dashed color-mix(in srgb, var(--c) 60%, transparent); }
.roi .cells span:last-child { border-right: 0; }
.roi .h { position: absolute; width: 14px; height: 14px; background: #fff; border: 2px solid var(--c); border-radius: 3px; box-shadow: 0 0 0 1px rgba(0,0,0,.6); }
/* Görünmez geniş tıklama alanı: küçük tutamaç kolay yakalansın */
.roi .h::before { content: ""; position: absolute; inset: -8px; }
.roi .h[data-h=nw] { left: -8px; top: -8px; cursor: nwse-resize; }
.roi .h[data-h=n]  { left: calc(50% - 7px); top: -8px; cursor: ns-resize; }
.roi .h[data-h=ne] { right: -8px; top: -8px; cursor: nesw-resize; }
.roi .h[data-h=e]  { right: -8px; top: calc(50% - 7px); cursor: ew-resize; }
.roi .h[data-h=se] { right: -8px; bottom: -8px; cursor: nwse-resize; }
.roi .h[data-h=s]  { left: calc(50% - 7px); bottom: -8px; cursor: ns-resize; }
.roi .h[data-h=sw] { left: -8px; bottom: -8px; cursor: nesw-resize; }
.roi .h[data-h=w]  { left: -8px; top: calc(50% - 7px); cursor: ew-resize; }
.roi:not(.selected) .h { display: none; }
.roi-tools { display: flex; flex-wrap: wrap; gap: 6px; }
.roi-btn { --c: #888; border-color: color-mix(in srgb, var(--c) 60%, var(--line-2)); }
.roi-btn::before { content: ""; width: 9px; height: 9px; border-radius: 2px; background: var(--c); }
.roi-btn.active { background: color-mix(in srgb, var(--c) 25%, var(--panel-2)); border-color: var(--c); }

/* ---- Canlı panel ---- */
.dash { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.dash > * { min-width: 0; }
/* Masaüstünde kamera solda (kurulum için geniş), dar ekranda skor kontrolleri önde */
.dash-side { order: -1; }
.score-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.field-card { min-width: 0; }
.field-card .fc-actions input { width: 64px !important; }
.field-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; position: relative; }
.field-card::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 3px; background: var(--c, var(--accent)); }
.field-card .fc-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.field-card .fc-title { font-weight: 650; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.field-card .fc-value { font: 700 46px/1.05 var(--mono); letter-spacing: -.02em; text-align: center; padding: 4px 0; font-variant-numeric: tabular-nums; }
.field-card .fc-value.flash { animation: valflash .6s; }
@keyframes valflash { 0% { color: var(--accent); text-shadow: 0 0 18px var(--accent); } 100% { color: inherit; } }
.field-card .fc-ocr { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); font-family: var(--mono); border-top: 1px solid var(--line); padding-top: 6px; margin-top: 6px; gap: 6px; }
.field-card .fc-ocr .suspect { color: var(--warn); }
.field-card .fc-actions { display: flex; gap: 4px; flex-wrap: wrap; justify-content: center; margin-top: 6px; }
.field-card .fc-actions .btn { min-width: 38px; }
.field-card.wide { grid-column: 1 / -1; }
.field-card .team-name { font-size: 13px; color: var(--text); font-weight: 700; }
.conf-bar { height: 4px; border-radius: 3px; background: var(--bg-2); overflow: hidden; margin-top: 6px; }
.conf-bar i { display: block; height: 100%; background: var(--ok); width: 0; transition: width .2s; }
.mode-toggle { display: inline-flex; border-radius: 6px; overflow: hidden; border: 1px solid var(--line-2); }
.mode-toggle button { border: 0; padding: 3px 8px; font: 700 10px/1.4 inherit; letter-spacing: .05em; background: var(--bg-2); color: var(--muted); cursor: pointer; text-transform: uppercase; }
.mode-toggle button.on[data-mode=auto] { background: #14532d; color: #bbf7d0; }
.mode-toggle button.on[data-mode=manual] { background: #7c2d12; color: #fed7aa; }
.big-toggle { display: flex; gap: 10px; align-items: center; }
.queue { display: flex; flex-direction: column; gap: 6px; max-height: 260px; overflow: auto; }
.queue-item { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; background: var(--bg-2); border: 1px solid #854d0e; border-radius: 8px; padding: 8px 10px; }
.queue-item b { font-family: var(--mono); }
.queue-item small { display: block; color: var(--muted); }
.log { font: 12px/1.6 var(--mono); max-height: 220px; overflow: auto; color: var(--muted); }
.log div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.log .w { color: var(--warn); } .log .e { color: var(--danger); } .log .o { color: var(--ok); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 12px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; font-family: var(--mono); text-align: right; }
details.adv { border-top: 1px solid var(--line); margin-top: 10px; padding-top: 8px; }
details.adv summary { cursor: pointer; color: var(--muted); font-size: 12px; font-weight: 600; }

/* ---- Tablo ---- */
table.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th, .table td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--line); }
.table th { color: var(--muted); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }
.table td.mono { font-family: var(--mono); }

/* ---- Kalibrasyon ---- */
.calib { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 14px; align-items: start; }
.calib-out { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.calib-out canvas { width: 100%; image-rendering: pixelated; background: #000; border-radius: 6px; border: 1px solid var(--line); display: block; }
.seg-table { font: 11px var(--mono); width: 100%; border-collapse: collapse; margin-top: 6px; }
.seg-table td, .seg-table th { padding: 2px 4px; text-align: center; border: 1px solid var(--line); }
.seg-table td.on { background: #14532d; color: #bbf7d0; }

/* ---- Toast ---- */
.toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 1000; }
.toast { background: var(--panel-2); border: 1px solid var(--line-2); border-left: 4px solid var(--info); padding: 10px 14px; border-radius: 8px; box-shadow: var(--shadow); max-width: 380px; animation: tin .2s; }
.toast.ok { border-left-color: var(--ok); } .toast.err { border-left-color: var(--danger); } .toast.warn { border-left-color: var(--warn); }
@keyframes tin { from { transform: translateY(8px); opacity: 0; } }

/* ---- Giriş / kurulum ---- */
.auth-page { display: grid; place-items: center; min-height: 100vh; padding: 20px; background: radial-gradient(ellipse at top, #1c2540, var(--bg) 60%); }
.auth-card { width: 100%; max-width: 380px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 26px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 12px; }
.auth-card.wide { max-width: 620px; }
.auth-card form { display: flex; flex-direction: column; gap: 12px; }
.checklist { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; font-size: 13px; }
.checklist li::before { content: "✔"; margin-right: 6px; color: var(--ok); }
.checklist li.fail::before { content: "✖"; color: var(--danger); } .checklist li.fail { color: #fecaca; }
.checklist li.warn::before { content: "!"; color: var(--warn); font-weight: 800; }

/* ---- Tasarım editörü ---- */
.designer { display: grid; grid-template-columns: 220px minmax(0, 1fr) 300px; gap: 14px; align-items: start; }
.stage-outer { background: repeating-conic-gradient(#1a2031 0 25%, #121827 0 50%) 0 0 / 20px 20px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; position: relative; }
.stage { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.stage .grid-bg { position: absolute; inset: 0; pointer-events: none; }
.stage .d-el { position: absolute; outline: 1px dashed rgba(255,255,255,.25); cursor: move; touch-action: none; }
.stage .d-el.hidden-el { opacity: .25; }
.stage .d-el.sel { outline: 2px solid var(--accent); z-index: 50; }
.stage .d-el .rz { position: absolute; right: -8px; bottom: -8px; width: 16px; height: 16px; background: var(--accent); border-radius: 3px; cursor: nwse-resize; display: none; }
.stage .d-el.sel .rz { display: block; }
.stage .guide { position: absolute; background: #ff2fd1; pointer-events: none; z-index: 100; }
.stage .guide.v { width: 2px; top: 0; bottom: 0; }
.stage .guide.h { height: 2px; left: 0; right: 0; }
.el-list { display: flex; flex-direction: column; gap: 2px; }
.el-list button { text-align: left; display: flex; align-items: center; gap: 8px; background: transparent; border: 1px solid transparent; color: var(--text); padding: 6px 8px; border-radius: 6px; cursor: pointer; font: inherit; }
.el-list button:hover { background: var(--panel-2); }
.el-list button.sel { border-color: var(--accent); background: var(--panel-2); }
.el-list button .eye { margin-left: auto; opacity: .7; }
.props label { margin-bottom: 8px; }

/* Yakınlaştırmada ROI çerçeve kalınlığı ve etiket boyutu sabit kalsın */
.cam-wrap .roi { border-width: calc(2px / var(--zoom, 1)); }
.cam-wrap .roi .roi-label { transform: scale(calc(1 / var(--zoom, 1))); transform-origin: 0 100%; }
.cam-wrap .roi .roi-read { transform: scale(calc(1 / var(--zoom, 1))); transform-origin: 100% 0; }
.cam-wrap .roi .h { transform: scale(calc(1 / var(--zoom, 1))); }


/* ---- Yardım ikonu ---- */
.help {
  display: inline-grid; place-items: center; width: 17px; height: 17px; margin: 0 0 0 6px; padding: 0;
  border-radius: 50%; border: 1px solid var(--line-2); background: var(--bg-2); color: var(--muted);
  font: 700 11px/1 inherit; cursor: help; vertical-align: middle; flex: none; text-transform: none; letter-spacing: 0;
}
.help:hover, .help:focus-visible { color: #1a0d03; background: var(--accent); border-color: var(--accent); outline: none; }
.help-pop {
  position: absolute; z-index: 2000; background: #0f1524; color: var(--text); border: 1px solid var(--line-2);
  border-radius: 8px; padding: 9px 11px; font-size: 12.5px; line-height: 1.45; box-shadow: var(--shadow);
  pointer-events: auto; text-transform: none; letter-spacing: 0; font-weight: 400;
}
label > .help { margin-left: 4px; }
h2 .help, h3 .help { margin-left: 8px; }

/* ---- Kurulum adımları ---- */
.steps { list-style: none; display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; padding: 0; margin: 0 0 14px; counter-reset: st; }
.steps li { counter-increment: st; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px 9px 44px; position: relative; min-width: 0; }
.steps li::before {
  content: counter(st); position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center;
  font: 700 12px/1 var(--mono); background: var(--bg-2); color: var(--muted); border: 1px solid var(--line-2);
}
.steps li b { display: block; font-size: 13px; }
.steps li span { display: block; font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.steps li.done::before { content: "✓"; background: #14532d; border-color: #166534; color: #bbf7d0; }
.steps li.current { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.steps li.current::before { background: var(--accent); color: #1a0d03; border-color: var(--accent); }
.steps li.wait { opacity: .55; }
.steps.all-done { display: none; }

/* ---- Katlanır kart ---- */
details.fold > summary { list-style: none; display: flex; align-items: center; gap: 10px; cursor: pointer; }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary h2 { margin: 0; font-size: 14px; }
details.fold > summary::before { content: "▸"; color: var(--muted); transition: transform .15s; }
details.fold[open] > summary::before { transform: rotate(90deg); }
details.fold > summary > :last-child { margin-left: auto; }

.team-row { display: flex; gap: 6px; align-items: center; min-width: 0; }
.team-row input:not([type=color]) { flex: 1; min-width: 0; }
.team-row input[id$=Short] { flex: 0 0 74px; }
.grow { flex: 1 1 180px; min-width: 0; }
.hint { margin: 6px 0 0; }
.cam-wrap { max-width: 100%; }
.fc-ocr span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- Duyarlı yerleşim ---- */
@media (max-width: 1280px) {
  .dash { grid-template-columns: 1fr; }
  .dash-side { order: 0; }
  .calib { grid-template-columns: 1fr; }
  .designer { grid-template-columns: 1fr 1fr; grid-template-areas: "stage stage" "left right"; }
  .designer > :nth-child(1) { grid-area: left; }
  .designer > :nth-child(2) { grid-area: stage; }
  .designer > :nth-child(3) { grid-area: right; }
}
@media (max-width: 1100px) {
  .app { grid-template-columns: 64px 1fr; }
  .sidebar { padding: 14px 8px; }
  .sidebar .brand div, .sidebar nav a span, .sidebar-foot .user span, #overlayLink { display: none; }
  .sidebar .brand { justify-content: center; padding: 0; }
  .sidebar nav a { justify-content: center; padding: 10px; }
  .sidebar-foot .user { justify-content: center; }
  .steps { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: sticky; top: 0; z-index: 50; height: auto; flex-direction: row; align-items: center; padding: 8px 12px; gap: 8px; }
  .sidebar .brand { margin: 0; }
  .sidebar nav { flex-direction: row; gap: 0; overflow-x: auto; flex: 1; }
  .sidebar-foot { margin: 0; flex-direction: row; }
  .main { padding: 14px 16px 40px; }
  .page-head h1 { font-size: 18px; }
  .page-head .spacer { display: none; }
  #ocrToggle { width: 100%; }
  .score-grid, .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .designer { grid-template-columns: 1fr; grid-template-areas: "stage" "left" "right"; }
  .checklist { grid-template-columns: 1fr; }
  .steps li span { white-space: normal; }
  .field-card .fc-value { font-size: 38px; }
  .card-head { flex-wrap: wrap; }
  .table { font-size: 12px; }
}
@media (max-width: 760px) {
  .steps { grid-template-columns: repeat(2, 1fr); gap: 6px; }
  .steps li { padding: 7px 8px 7px 36px; }
  .steps li::before { left: 8px; width: 20px; height: 20px; }
  .steps li span { display: none; }
}
.table-wrap { overflow-x: auto; }

/* ---- Ayarlar ---- */
.settings { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 16px; align-items: start; }
.tabs { display: flex; flex-direction: column; gap: 2px; position: sticky; top: 16px; }
.tabs a { padding: 9px 12px; border-radius: 8px; color: var(--muted); text-decoration: none; font-weight: 600; }
.tabs a:hover { background: var(--panel); color: var(--text); }
.tabs a[aria-selected=true] { background: var(--panel-2); color: var(--text); box-shadow: inset 3px 0 0 var(--accent); }
.tab-panel { display: grid; gap: 14px; max-width: 880px; }
.tab-panel .card + .card { margin-top: 0; }
.url-box { display: flex; gap: 8px; flex-wrap: wrap; }
.url-box input { flex: 1 1 320px; min-width: 0; font-size: 12.5px; }
.how { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 8px; margin-top: 14px; }
.how div { display: flex; gap: 10px; align-items: flex-start; background: var(--bg-2); border: 1px solid var(--line); border-radius: 8px; padding: 10px; font-size: 13px; }
.how b:first-child { flex: none; width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: #1a0d03; display: grid; place-items: center; font-size: 12px; }
.rules { display: grid; gap: 0; }
.rule { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(150px, 1fr) minmax(0, .9fr); gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.rule:first-child { border-top: 0; }
.rule > label { flex-direction: row; align-items: center; color: var(--text); font-size: 13px; }
.rule-input { display: flex; gap: 8px; align-items: center; }
.rule-input input, .rule-input select { flex: 1; min-width: 0; }
.card.narrow { max-width: 460px; }
.sys { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.sys li { display: grid; gap: 2px; padding: 10px 12px 10px 38px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg-2); position: relative; }
.sys li::before { content: "✓"; position: absolute; left: 12px; top: 10px; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; background: #14532d; color: #bbf7d0; }
.sys li.fail { border-color: #7f1d1d; }
.sys li.fail::before { content: "!"; background: #7f1d1d; color: #fecaca; }
.sys li small { color: var(--muted); }
@media (max-width: 900px) {
  .settings { grid-template-columns: 1fr; }
  .tabs { flex-direction: row; overflow-x: auto; position: static; }
  .tabs a { white-space: nowrap; }
  .tabs a[aria-selected=true] { box-shadow: inset 0 -3px 0 var(--accent); }
  .rule { grid-template-columns: 1fr; gap: 6px; }
}

/* Arka plan şablonu seçiliyken bile yazıların arkasında kalır */
.stage .sb-el { z-index: 2; }
.stage .sb-background, .stage .sb-background.sel { z-index: 1; }
.stage .d-el.sel:not(.sb-background) { z-index: 50; }
