:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --text: #16181d;
  --muted: #5d6370;
  --border: #dfe2e7;
  --accent: #2456d6;
  --accent-text: #ffffff;
  --ok: #1f9d55;
  --off: #9aa1ad;
  --danger: #c4312b;
  --warn-bg: #fff6e0;
  --warn-text: #6b4a00;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111317;
    --surface: #1b1e24;
    --text: #e8eaee;
    --muted: #9aa1ad;
    --border: #2c3038;
    --accent: #5b86f0;
    --accent-text: #0b0d10;
    --ok: #3ccf7d;
    --off: #646b78;
    --danger: #ef6b64;
    --warn-bg: #3a2f12;
    --warn-text: #f4d58d;
    --shadow: none;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

button, input { font: inherit; }
button {
  border-radius: 8px;
  padding: 9px 16px;
  border: 1px solid var(--border);
  cursor: pointer;
}
button.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); font-weight: 600; }
button.ghost { background: var(--surface); color: var(--text); }
button.danger { background: transparent; color: var(--danger); border-color: transparent; padding: 6px 8px; }
button.small { padding: 5px 10px; font-size: 13px; }
button:disabled { opacity: .6; cursor: default; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
}
label { display: block; font-weight: 600; margin: 14px 0 6px; font-size: 14px; }

.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.brand-mark {
  width: 22px; height: 16px; border: 2.5px solid var(--accent); border-radius: 4px; position: relative;
}
.brand-mark::after {
  content: ""; position: absolute; left: 50%; bottom: -7px; width: 10px; height: 2.5px;
  background: var(--accent); transform: translateX(-50%);
}

/* Giriş */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card {
  width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; padding: 28px; box-shadow: var(--shadow);
}
.login-card h1 { font-size: 20px; margin: 18px 0 4px; }
.login-card .primary { width: 100%; margin-top: 18px; padding: 11px; }
#code { letter-spacing: .3em; font-variant-numeric: tabular-nums; }
.hint { color: var(--muted); font-size: 13px; margin: 6px 0 0; }
.error { color: var(--danger); font-size: 14px; margin: 14px 0 0; }

/* Panel */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 24px; background: var(--surface); border-bottom: 1px solid var(--border);
}
.topbar-actions { display: flex; gap: 8px; }
.dash { max-width: 1100px; margin: 0 auto; padding: 24px; }
.dash-title { font-size: 22px; margin: 0 0 18px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 8px;
  text-align: left; color: var(--text);
}
.card.clickable { cursor: pointer; }
.card.clickable:hover { border-color: var(--accent); }
.card.revoked { opacity: .65; }
.card-name { font-weight: 700; font-size: 16px; overflow-wrap: anywhere; }
.card-status { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--off); flex: none; }
.dot.on { background: var(--ok); }
.card-meta { color: var(--muted); font-size: 13px; }
.card-actions { display: flex; justify-content: flex-end; margin-top: 4px; }

.empty {
  text-align: center; padding: 56px 16px; background: var(--surface);
  border: 1px dashed var(--border); border-radius: 14px;
}
.empty h2 { margin: 12px 0 4px; font-size: 18px; }
.empty p { color: var(--muted); margin: 0; }
.empty-icon {
  width: 46px; height: 32px; margin: 0 auto; border: 3px solid var(--off); border-radius: 6px; position: relative;
}
.empty-icon::after {
  content: ""; position: absolute; left: 50%; bottom: -10px; width: 18px; height: 3px;
  background: var(--off); transform: translateX(-50%);
}

/* Diyalog */
dialog {
  border: 1px solid var(--border); border-radius: 14px; padding: 24px; width: min(440px, calc(100vw - 32px));
  background: var(--surface); color: var(--text);
}
dialog::backdrop { background: rgba(0, 0, 0, .45); }
dialog h2 { margin: 0 0 8px; font-size: 18px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.warn { background: var(--warn-bg); color: var(--warn-text); padding: 10px 12px; border-radius: 8px; font-size: 14px; }
.key {
  display: block; padding: 12px; border-radius: 8px; background: var(--bg); border: 1px solid var(--border);
  font: 13px/1.4 ui-monospace, Consolas, monospace; word-break: break-all; user-select: all;
}

/* İzleme */
.viewer { position: fixed; inset: 0; background: #000; z-index: 50; display: grid; place-items: center; }
#screen { display: block; outline: none; cursor: default; image-rendering: auto; }
.viewer-bar {
  position: fixed; top: 8px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px; padding: 6px 10px;
  background: rgba(20, 22, 26, .85); color: #e8eaee; border-radius: 10px; font-size: 13px;
  opacity: .25; transition: opacity .2s;
}
.viewer-bar:hover { opacity: 1; }
.viewer-bar button.ghost { background: #2c3038; color: #e8eaee; border-color: #3a3f48; }
.viewer-status { color: #9aa1ad; }

@media (max-width: 600px) {
  .topbar { padding: 10px 16px; }
  .dash { padding: 16px; }
  .login-card { padding: 22px; }
}
