:root {
  --bg: #f4f6fb;
  --panel: #ffffff;
  --text: #1f2a3d;
  --muted: #6b778c;
  --line: #e2e7f0;
  --primary: #5d3fd3;
  --primary-dark: #4a2fb5;
  --pink: #d63384;
  --success: #198754;
  --danger: #c0392b;
  --warn-bg: #fff6e0;
  --warn-line: #f0c36d;
  --stage: #0d1117;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
}

header.top {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 18px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
header.top .brand { font-weight: 700; font-size: 16px; color: var(--primary); }
header.top .sub { color: var(--muted); }
header.top .spacer { flex: 1; }

main.wrap { max-width: 980px; margin: 18px auto; padding: 0 16px; }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 14px;
}
.card h2 { margin: 0 0 10px; font-size: 15px; }

label { display: block; margin: 8px 0 4px; color: var(--muted); font-size: 12px; }
input[type=text], input[type=password], input[type=number], select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 14px;
  background: #fff;
}
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.row > * { flex: 1; min-width: 140px; }
.check { display: flex; align-items: center; gap: 6px; margin: 6px 0; color: var(--text); font-size: 13px; }
.check input { width: auto; }

.btn {
  border: 0;
  border-radius: 6px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  color: #fff;
  white-space: nowrap;
}
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--primary); }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); }
.btn-pink { background: var(--pink); }
.btn-success { background: var(--success); }
.btn-danger { background: var(--danger); }
.btn-light { background: #e9ecf3; color: var(--text); }

.warn {
  background: var(--warn-bg);
  border: 1px solid var(--warn-line);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
}
.muted { color: var(--muted); }
.mono { font-family: Consolas, "Cascadia Mono", monospace; font-size: 12px; word-break: break-all; }

ul.plist { list-style: none; margin: 0; padding: 0; }
ul.plist li { padding: 6px 0; border-bottom: 1px solid var(--line); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
ul.plist li small { color: var(--muted); }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.dot.on { background: var(--success); }
.dot.off { background: #b8c0cc; }

#log {
  max-height: 180px;
  overflow: auto;
  font-family: Consolas, monospace;
  font-size: 12px;
  color: var(--muted);
}
.log-error { color: var(--danger); }
.log-ok { color: var(--success); }

/* Onay penceresi */
.modal-back {
  position: fixed; inset: 0; background: rgba(15, 20, 30, .55);
  display: none; align-items: center; justify-content: center; z-index: 50;
}
.modal-back.show { display: flex; }
.modal {
  background: #fff; border-radius: 12px; padding: 20px; width: min(460px, 92vw);
  box-shadow: 0 10px 40px rgba(0, 0, 0, .25);
}
.modal h3 { margin: 0 0 8px; }
.modal .actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 14px; }

/* Operatör görüntüleyici */
body.viewer { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }
.toolbar {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  padding: 8px 12px; background: var(--panel); border-bottom: 1px solid var(--line);
}
.toolbar select { width: auto; padding: 5px 8px; font-size: 13px; }
.toolbar .sep { width: 1px; height: 22px; background: var(--line); }
.layout { flex: 1; display: flex; min-height: 0; }
.stage-wrap { flex: 1; background: var(--stage); overflow: hidden; position: relative; }
.stage-wrap.actual { overflow: auto; }
.stage {
  position: absolute; inset: 0; outline: none; cursor: default;
}
.stage-wrap.actual .stage { position: relative; inset: auto; }
.stage video, .stage canvas {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain;
  pointer-events: none; image-rendering: auto;
}
.stage:focus { box-shadow: inset 0 0 0 2px var(--primary); }
.stage-msg {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: #c9d1d9; font-size: 15px; text-align: center; padding: 20px; pointer-events: none;
}
aside.side {
  width: 300px; background: var(--panel); border-left: 1px solid var(--line);
  overflow: auto; padding: 12px;
}
aside.side h4 { margin: 12px 0 6px; font-size: 13px; }
table.stats { width: 100%; border-collapse: collapse; font-size: 12px; }
table.stats td { padding: 3px 0; border-bottom: 1px solid var(--line); }
table.stats td:last-child { text-align: right; font-family: Consolas, monospace; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; }
.badge.direct { background: #d1f2df; color: #0f5132; }
.badge.relay { background: #fde2e1; color: #842029; }
.badge.wait { background: #e9ecf3; color: var(--muted); }
