/* AI Ralen yönetim paneli */
:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --border: #e3e6eb;
  --text: #1c2330;
  --muted: #667085;
  --accent: #3b5bdb;
  --accent-soft: #e8edff;
  --side-bg: #141a24;
  --side-text: #aab4c3;
  --side-active: #ffffff;
  --ok: #1f8a4c;   --ok-bg: #e5f5ec;
  --err: #c92a2a;  --err-bg: #fdecec;
  --warn: #b25e09; --warn-bg: #fff3e0;
  --run: #1864ab;  --run-bg: #e7f1fb;
  --idle: #495057; --idle-bg: #eef0f3;
  --radius: 10px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f131a;
    --surface: #161c26;
    --surface-2: #1c2330;
    --border: #273042;
    --text: #e4e8ef;
    --muted: #8d98aa;
    --accent: #7c95ff;
    --accent-soft: #1e2748;
    --side-bg: #0b0f15;
    --ok: #4cc27f;   --ok-bg: #12301f;
    --err: #ff6b6b;  --err-bg: #3a1618;
    --warn: #f0a44b; --warn-bg: #3a2810;
    --run: #6aaeff;  --run-bg: #132a45;
    --idle: #adb5bd; --idle-bg: #232a36;
  }
}

html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code, .mono { font-family: var(--mono); font-size: 12.5px; }

/* Düzen */
.shell { display: flex; min-height: 100vh; }
.side {
  width: 232px; flex: 0 0 232px; background: var(--side-bg); color: var(--side-text);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.side .brand { padding: 20px 20px 14px; color: #fff; font-weight: 700; font-size: 16px; letter-spacing: .2px; }
.side .brand small { display: block; font-weight: 400; color: var(--side-text); font-size: 11.5px; margin-top: 2px; }
.side nav { flex: 1; overflow-y: auto; padding: 6px 10px; }
.side nav .sect { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: #6b778a; margin: 16px 10px 6px; }
.side nav a {
  display: flex; align-items: center; gap: 10px; color: var(--side-text); padding: 8px 10px; border-radius: 8px;
  font-weight: 500;
}
.side nav a:hover { background: rgba(255,255,255,.06); color: #fff; text-decoration: none; }
.side nav a.active { background: rgba(124,149,255,.16); color: var(--side-active); }
.side nav a .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .5; }
.side .foot { padding: 12px 16px; border-top: 1px solid rgba(255,255,255,.06); font-size: 12px; }
.side .foot form { display: inline; }
.side .foot button { background: none; border: 0; color: var(--side-text); padding: 0; }
.side .foot button:hover { color: #fff; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 12px; padding: 10px 28px; border-bottom: 1px solid var(--border);
  background: var(--surface); position: sticky; top: 0; z-index: 10; min-height: 52px;
}
.topbar .grow { flex: 1; }
.live { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.live .led { width: 8px; height: 8px; border-radius: 50%; background: var(--idle); }
.live.on .led { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-bg); }
.content { padding: 24px 28px 48px; max-width: 1480px; width: 100%; }
.menu-toggle { display: none; }

.page-head { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1 { font-size: 22px; font-weight: 700; margin: 0; }
.page-head .sub { color: var(--muted); margin-top: 4px; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

/* Kartlar */
.card-x { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 18px; }
.card-x > h2, .card-x > .h2 { font-size: 15px; font-weight: 650; margin: 0 0 12px; display: flex; align-items: center; gap: 8px; }
.card-x > h2 .right { margin-left: auto; font-weight: 400; font-size: 13px; }
.card-x.flush { padding: 0; }
.card-x.flush > h2 { padding: 16px 20px 0; }
.grid { display: grid; gap: 18px; }
.grid > * { min-width: 0; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); }
.grid.three { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid .card-x:has(> .tbl) { overflow-x: auto; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.kpi .v { font-size: 26px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi .l { color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.kpi.ok .v { color: var(--ok); } .kpi.err .v { color: var(--err); } .kpi.warn .v { color: var(--warn); } .kpi.run .v { color: var(--run); }
a.kpi:hover { text-decoration: none; border-color: var(--accent); }

/* Durum rozetleri */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.st-ok { color: var(--ok); background: var(--ok-bg); }
.st-err { color: var(--err); background: var(--err-bg); }
.st-warn { color: var(--warn); background: var(--warn-bg); }
.st-run { color: var(--run); background: var(--run-bg); }
.st-run.pill::before { animation: pulse 1.4s infinite; }
.st-idle { color: var(--idle); background: var(--idle-bg); }
.st-muted { color: var(--muted); background: var(--surface-2); }
@keyframes pulse { 0%,100% { opacity: 1 } 50% { opacity: .3 } }
.tag { display: inline-block; padding: 1px 7px; border-radius: 6px; background: var(--surface-2); color: var(--muted); font-size: 11.5px; border: 1px solid var(--border); }

/* Tablolar */
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; text-align: left;
  padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; background: var(--surface); }
.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr:hover td { background: var(--surface-2); }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl-wrap { overflow-x: auto; }
.clip { max-width: 420px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }

/* İlerleme çubuğu (batch sayıları) */
.stack { display: flex; height: 8px; border-radius: 4px; overflow: hidden; background: var(--surface-2); min-width: 120px; }
.stack span { display: block; height: 100%; }
.stack .s-ok { background: var(--ok); } .stack .s-err { background: var(--err); } .stack .s-run { background: var(--run); }
.stack .s-warn { background: var(--warn); } .stack .s-muted { background: var(--idle); opacity: .5; }

/* Uyarı kutuları */
.alert-x { border-radius: var(--radius); padding: 12px 16px; margin-bottom: 16px; border: 1px solid transparent; }
.alert-x.ok { background: var(--ok-bg); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 25%, transparent); }
.alert-x.err { background: var(--err-bg); color: var(--err); border-color: color-mix(in srgb, var(--err) 25%, transparent); }
.alert-x.warn { background: var(--warn-bg); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 25%, transparent); }
.alert-x.info { background: var(--run-bg); color: var(--run); border-color: color-mix(in srgb, var(--run) 25%, transparent); }
.alert-x b { font-weight: 700; }

/* Tanım listesi */
.dl { display: grid; grid-template-columns: 180px 1fr; gap: 8px 16px; margin: 0; }
.dl dt { color: var(--muted); font-weight: 500; }
.dl dd { margin: 0; word-break: break-word; }

/* Zaman çizelgesi */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 150px 1fr; gap: 12px; padding: 8px 0; border-bottom: 1px dashed var(--border); }
.timeline li:last-child { border-bottom: 0; }
.timeline .t { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.timeline .c { font-family: var(--mono); font-size: 11.5px; color: var(--muted); }
.timeline li > div { min-width: 0; overflow-wrap: anywhere; }

/* Video galerisi */
.videos { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.vcard { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; }
.vcard video { width: 100%; aspect-ratio: 16/9; background: #000; display: block; object-fit: contain; }
.vcard .b { padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.vcard .p { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.vcard .meta { display: flex; flex-wrap: wrap; gap: 6px; }
.vcard .acts { display: flex; gap: 6px; margin-top: auto; padding-top: 6px; }

/* Form */
.form-control, .form-select { background-color: var(--surface); color: var(--text); border-color: var(--border); }
.form-control:focus, .form-select:focus { background-color: var(--surface); color: var(--text); border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.form-label { font-weight: 600; font-size: 13px; margin-bottom: 4px; }
.form-text { color: var(--muted); }
textarea.code { font-family: var(--mono); font-size: 12px; min-height: 220px; }
.opt-disabled { color: var(--muted); }
.btn { font-weight: 600; font-size: 13px; border-radius: 8px; }
.btn-primary { background: var(--accent); border-color: var(--accent); }
.btn-ghost { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-xs { padding: 2px 8px; font-size: 12px; }
.inline-form { display: inline; }
.check-list { display: grid; gap: 6px; max-height: 360px; overflow-y: auto; border: 1px solid var(--border); border-radius: 8px; padding: 10px; }
.check-list label { display: flex; gap: 10px; align-items: flex-start; padding: 6px; border-radius: 6px; cursor: pointer; }
.check-list label:hover { background: var(--surface-2); }
.reso-note { font-size: 12.5px; color: var(--muted); margin-top: 6px; min-height: 18px; }
.secret { font-family: var(--mono); background: var(--surface-2); border: 1px dashed var(--accent); padding: 10px 12px; border-radius: 8px; word-break: break-all; }

.pager { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 12px; }
.empty { text-align: center; color: var(--muted); padding: 36px 12px; }

/* Toast */
.toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast-x { background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--accent); border-radius: 8px;
  padding: 10px 14px; box-shadow: 0 6px 24px rgba(0,0,0,.12); font-size: 13px; max-width: 360px; }

@media (max-width: 900px) {
  .side { position: fixed; left: -240px; z-index: 50; transition: left .2s; }
  .side.open { left: 0; }
  .menu-toggle { display: inline-flex; }
  .content { padding: 16px; }
  .topbar { padding: 10px 16px; }
  .grid.two { grid-template-columns: 1fr; }
  .dl { grid-template-columns: 1fr; }
  .timeline li { grid-template-columns: 1fr; }
}

/* SeedVR2 yükseltme: sahne çözünürlük rozetleri ve batch kartı */
.res-badges { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.res { display: inline-block; padding: 1px 7px; border-radius: 6px; font-size: 11.5px; font-weight: 600; white-space: nowrap; border: 1px solid var(--border); text-decoration: none; }
.res-ok { color: var(--ok); background: var(--ok-bg); }
.res-run { color: var(--run); background: var(--run-bg); }
.res-err { color: var(--err); background: var(--err-bg); }
.res-none { color: var(--muted); background: var(--surface-2); }
.upscale-card .targets { display: flex; flex-wrap: wrap; gap: 14px; }
.upscale-card .estimate { min-height: 1.5em; }
