/* Master Medya Otomasyon Bot — koyu tema */
:root {
  color-scheme: dark;
  --bg: #0d0d0d;
  --surface: #1a1a19;
  --surface-2: #222221;
  --surface-3: #2a2a28;
  --border: rgba(255, 255, 255, 0.10);
  --border-strong: rgba(255, 255, 255, 0.18);
  --text: #ffffff;
  --text-2: #c3c2b7;
  --muted: #898781;
  --grid: #2c2c2a;
  --series-1: #4c8dff;   /* toplanan */
  --series-2: #ff9f43;   /* gönderilen */
  --good: #0ca30c;
  --warn: #fab219;
  --crit: #d03b3b;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 0 rgba(255,255,255,0.03) inset, 0 8px 24px rgba(0,0,0,0.35);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
}
h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -0.01em; }
h1 { font-size: 18px; }
h2 { font-size: 16px; }
p { margin: 0; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
a { color: var(--series-1); }

/* --- üst bar --- */
.top {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px;
  background: rgba(13, 13, 13, 0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand h1 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand p { font-size: 12px; }
.brand-mark {
  flex: 0 0 auto; width: 40px; height: 40px; border-radius: 11px;
  display: grid; place-items: center; font-weight: 800; font-size: 15px; letter-spacing: 0.02em;
  background: linear-gradient(135deg, var(--series-1), #2b5fd9); color: #fff;
  box-shadow: 0 6px 18px rgba(76, 141, 255, 0.35);
}
.top-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 640px) {
  .top { flex-wrap: wrap; row-gap: 8px; padding: 10px 16px; }
  .brand { flex: 1 1 100%; }
  .brand h1 { font-size: 16px; }
  .brand p { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .top-right { flex: 1 1 100%; justify-content: flex-start; }
  .top-right form { margin-left: auto; }
}
.pill {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 11px; border-radius: 999px; font-size: 13px; color: var(--text-2);
  background: var(--surface); border: 1px solid var(--border);
}
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); flex: 0 0 auto; }
[data-live="1"] .dot { background: var(--good); box-shadow: 0 0 0 3px rgba(12, 163, 12, 0.22); }
[data-live="0"] .dot { background: var(--crit); }
[data-live="-1"] .dot { background: var(--muted); }

/* --- yerleşim --- */
.wrap { max-width: 1240px; margin: 0 auto; padding: 16px; display: grid; gap: 16px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.col { display: grid; gap: 16px; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow); display: grid; gap: 14px; min-width: 0;
}
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.card-head p { font-size: 13px; }
.banner { padding: 10px 14px; border-radius: var(--radius-sm); font-size: 14px; }
.banner.warn { background: rgba(250, 178, 25, 0.12); color: #ffd97a; border: 1px solid rgba(250, 178, 25, 0.35); }

/* --- stat kartları --- */
.stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
@media (max-width: 1000px) { .stats { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 600px) { .stats { grid-template-columns: repeat(2, 1fr); } }
.tile {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; display: grid; gap: 4px; box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.tile::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--border-strong); }
.tile.accent-1::before { background: var(--series-1); }
.tile.accent-2::before { background: var(--series-2); }
.tile-label { font-size: 12.5px; color: var(--text-2); }
.tile-value { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.tile-sub { font-size: 12px; min-height: 1em; }

/* --- grafik --- */
.chart-card { background: radial-gradient(120% 80% at 0% 0%, rgba(76, 141, 255, 0.07), transparent 55%), var(--surface); }
.chart-head { align-items: center; flex-wrap: wrap; }
.chart-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.range { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; }
.range button {
  border: 0; background: transparent; color: var(--muted); padding: 6px 12px; border-radius: 999px;
  font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; transition: background .15s, color .15s; white-space: nowrap;
}
.range button:hover { color: var(--text); }
.range button[aria-pressed="true"] { background: var(--surface-3); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.45), inset 0 0 0 1px rgba(255,255,255,.06); }
.legend { display: flex; gap: 10px; flex-wrap: wrap; }
.legend-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 12px; min-width: 200px;
  background: var(--surface-2); border: 1px solid var(--border);
}
.legend-item > div { display: grid; gap: 1px; }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c); flex: 0 0 auto; box-shadow: 0 0 0 4px rgba(255,255,255,0.08); }
@supports (color: color-mix(in srgb, red 50%, transparent)) { .legend-dot { box-shadow: 0 0 0 4px color-mix(in srgb, var(--c) 22%, transparent); } }
.legend-label { font-size: 12px; color: var(--muted); }
.legend-val { font-size: 18px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.legend-delta { margin-left: auto; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: rgba(255,255,255,0.06); color: var(--text-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.legend-delta.up { color: #4ade80; background: rgba(74, 222, 128, 0.12); }
.legend-delta.down { color: #ff8d8d; background: rgba(208, 59, 59, 0.14); }
.chart-wrap { position: relative; height: 300px; }
.chart-empty[hidden] { display: none; }
.chart-empty { position: absolute; inset: 0; display: grid; place-items: center; font-size: 13.5px; color: var(--muted); pointer-events: none; text-align: center; padding: 20px; }
@media (max-width: 600px) { .chart-wrap { height: 230px; } .legend-item { min-width: 0; flex: 1 1 45%; padding: 8px 10px; } .legend-val { font-size: 16px; } }
.table-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th, .tbl td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--grid); white-space: nowrap; }
.tbl th { color: var(--muted); font-weight: 500; font-size: 12.5px; }
.tbl td.num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr.today td { color: var(--text); font-weight: 600; }
.tbl tfoot th { color: var(--text); font-weight: 600; border-top: 1px solid var(--border-strong); }

/* --- form bileşenleri --- */
.field { display: grid; gap: 6px; }
.field.two { grid-template-columns: 1fr 1fr; gap: 12px; }
.field.two > div { display: grid; gap: 6px; }
label, .label { font-size: 13px; color: var(--text-2); }
input[type="number"], input[type="password"], select, textarea {
  width: 100%; background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: 10px 12px; font: inherit; font-size: 15px;
}
textarea { resize: vertical; min-height: 120px; line-height: 1.5; }
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 2px solid var(--series-1); outline-offset: 1px; }
.form-grid { display: grid; gap: 12px; }
.hint { font-size: 12.5px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.row-end { display: flex; justify-content: flex-end; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

.btn {
  appearance: none; border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text);
  padding: 10px 16px; border-radius: var(--radius-sm); font: inherit; font-weight: 600; font-size: 14px;
  cursor: pointer; transition: background .15s, border-color .15s, transform .05s; display: inline-flex; align-items: center; gap: 6px;
}
.btn:hover { background: var(--surface-3); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--series-1); border-color: transparent; color: #fff; }
.btn-primary:hover { background: #2a78d6; }
.btn-danger { background: rgba(208, 59, 59, 0.14); border-color: rgba(208, 59, 59, 0.5); color: #ff8d8d; }
.btn-danger:hover { background: rgba(208, 59, 59, 0.24); }
.btn-ghost { background: transparent; }
.btn-sm { padding: 7px 12px; font-size: 13px; }
.btn-xs { padding: 3px 8px; font-size: 12px; }
.btn-block { width: 100%; justify-content: center; }
.file-btn { cursor: pointer; }

.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--grid); }
.switch-row:last-of-type { border-bottom: 0; }
.switch-row.compact { padding: 6px 0; border: 0; }
.switch-row > div { display: grid; gap: 2px; }
.switch-row .muted { font-size: 12.5px; }
.switch {
  flex: 0 0 auto; width: 48px; height: 28px; border-radius: 999px; border: 0; cursor: pointer; padding: 0; position: relative;
  background: var(--surface-3); transition: background .2s;
}
.switch span { position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform .2s; }
.switch[aria-checked="true"] { background: var(--good); }
.switch[aria-checked="true"] span { transform: translateX(20px); }

.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.seg button {
  display: grid; gap: 2px; text-align: left; padding: 10px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text); cursor: pointer; font: inherit;
}
.seg button span { font-size: 12.5px; color: var(--muted); }
.seg button[aria-pressed="true"] { border-color: var(--series-1); background: rgba(57, 135, 229, 0.14); box-shadow: inset 0 0 0 1px var(--series-1); }

/* --- fotoğraf --- */
.photo-box { display: grid; grid-template-columns: 140px 1fr; gap: 14px; align-items: start; padding-top: 6px; border-top: 1px solid var(--grid); }
@media (max-width: 480px) { .photo-box { grid-template-columns: 1fr; } }
.photo-preview {
  width: 140px; height: 140px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px dashed var(--border-strong);
  display: grid; place-items: center; overflow: hidden; font-size: 12.5px; text-align: center; padding: 8px;
}
.photo-preview img { width: 100%; height: 100%; object-fit: cover; }
.photo-actions { display: grid; gap: 8px; }

/* --- botlar --- */
.bots { display: grid; gap: 10px; }
.bot { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; display: grid; gap: 4px; }
.bot-head { display: flex; align-items: center; gap: 8px; }
.bot-pm2 { margin-left: auto; font-size: 12px; }
.bot-meta { font-size: 12.5px; }
.bot-status { font-size: 13.5px; color: var(--text-2); word-break: break-word; }
.login-box { background: rgba(57, 135, 229, 0.10); border: 1px solid rgba(57, 135, 229, 0.45); border-radius: var(--radius-sm); padding: 12px 14px; display: grid; gap: 8px; }
.login-box a { word-break: break-all; font-size: 13.5px; }
.login-box.pending { background: rgba(250, 178, 25, 0.10); border-color: rgba(250, 178, 25, 0.4); }

/* --- uyarılar --- */
.alerts { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; max-height: 360px; overflow: auto; }
.alerts li { background: var(--surface-2); border-left: 3px solid var(--warn); border-radius: 6px; padding: 8px 12px; font-size: 13.5px; white-space: pre-wrap; word-break: break-word; }
.alerts li time { display: block; font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.alerts li.relogin { border-left-color: var(--series-1); }
.alerts li.plain { border-left-color: var(--border-strong); }

/* --- sistem --- */
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 14px; margin: 0; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-all; }
@media (max-width: 480px) { .kv { grid-template-columns: 1fr; gap: 2px 0; } .kv dd { margin-bottom: 8px; } }

/* --- toast --- */
.toast-box { position: fixed; right: 16px; bottom: 16px; display: grid; gap: 8px; z-index: 50; max-width: min(92vw, 380px); }
.toast { background: var(--surface-3); border: 1px solid var(--border-strong); color: var(--text); padding: 10px 14px; border-radius: var(--radius-sm); font-size: 14px; opacity: 0; transform: translateY(8px); transition: opacity .2s, transform .2s; box-shadow: var(--shadow); }
.toast.show { opacity: 1; transform: none; }
.toast.ok { border-color: rgba(12, 163, 12, 0.6); }
.toast.err { border-color: rgba(208, 59, 59, 0.7); }

/* --- giriş sayfası --- */
.login-body { display: grid; place-items: center; padding: 16px; }
.login-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; display: grid; gap: 18px; box-shadow: var(--shadow); }
.login-card form { display: grid; gap: 10px; }
.error { color: #ff8d8d; font-size: 13.5px; }
