:root {
  --bg: #0b0c0f; --surface: #191c24; --surface-hover: #20242d; --input: #101217;
  --border: #2a2e37; --border-light: #343945;
  --primary: #eb1616; --primary-hover: #c91212; --primary-soft: rgba(235,22,22,.12);
  --text: #f3f4f6; --text-2: #9ca3af; --text-3: #6b7280;
  --success: #22c55e; --warning: #f59e0b; --danger: #ef4444; --info: #0ea5e9;
  --sidebar-w: 250px; --sidebar-w-collapsed: 70px;
  --r-sm: 4px; --r-md: 6px; --r-lg: 8px;
  --mono: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
  --sans: "Inter", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 var(--sans); }
a { color: inherit; text-decoration: none; }
.muted { color: var(--text-2); } .small { font-size: 12px; } .mono { font-family: var(--mono); font-size: 12px; }
.right { text-align: right; } .nowrap { white-space: nowrap; }

/* kabuk */
#app { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar-w); background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column;
  position: fixed; inset: 0 auto 0 0; z-index: 30; transition: width .16s ease, transform .16s ease; }
.sidebar-head { display: flex; align-items: center; gap: 12px; height: 64px; padding: 0 20px; border-bottom: 1px solid var(--border); font-weight: 700; font-size: 18px; }
.brand-mark { display: inline-grid; place-items: center; width: 30px; height: 30px; background: var(--primary); border-radius: var(--r-md); font-weight: 800; flex: none; }
nav { flex: 1; padding: 8px 0; overflow-y: auto; }
.nav-group { padding: 16px 20px 6px; font-size: 11px; letter-spacing: .08em; color: var(--text-3); }
.nav-link { display: flex; align-items: center; gap: 12px; height: 44px; padding: 0 20px; color: var(--text-2); border-left: 3px solid transparent; width: 100%; background: none; border-top: 0; border-right: 0; border-bottom: 0; font: inherit; cursor: pointer; text-align: left; }
.nav-link i { width: 20px; flex: none; display: grid; place-items: center; }
.nav-link:hover { background: var(--surface-hover); color: #fff; }
.nav-link.active { color: var(--primary); background: var(--primary-soft); border-left-color: var(--primary); }
.sidebar-foot { border-top: 1px solid var(--border); padding: 8px 0; }
.main { flex: 1; margin-left: var(--sidebar-w); min-width: 0; transition: margin-left .16s ease; }
body.collapsed .sidebar { width: var(--sidebar-w-collapsed); }
body.collapsed .main { margin-left: var(--sidebar-w-collapsed); }
body.collapsed .brand-text, body.collapsed .nav-link span, body.collapsed .nav-group { display: none; }
body.collapsed .nav-link { justify-content: center; padding: 0; }
body.collapsed .sidebar-head { justify-content: center; padding: 0; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; height: 64px; padding: 0 24px; background: var(--surface); border-bottom: 1px solid var(--border); }
.topbar-title { font-size: 17px; font-weight: 600; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 16px; }
.content { padding: 24px; max-width: 1400px; }
.scrim { display: none; }

/* bileşenler */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.page-head h1 { margin: 0; font-size: 24px; font-weight: 700; } .page-head p { margin: 4px 0 0; color: var(--text-2); font-size: 13px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.grid { display: grid; gap: 16px; margin-bottom: 16px; }
.grid.kpi { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.grid.two { grid-template-columns: 2fr 1fr; } .grid.even { grid-template-columns: 1fr 1fr; }
.stat, .panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); }
.stat { padding: 20px; }
.stat .label { font-size: 11px; letter-spacing: .06em; color: var(--text-2); text-transform: uppercase; }
.stat .value { font-size: 28px; font-weight: 700; margin: 6px 0 2px; }
.stat .sub { font-size: 12px; color: var(--text-2); }
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; border-bottom: 1px solid var(--border); }
.panel-head h2 { margin: 0; font-size: 15px; font-weight: 600; }
.panel-body { padding: 18px 20px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; padding: 10px 16px; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-2); font-weight: 500; white-space: nowrap; }
td { padding: 12px 16px; border-top: 1px solid var(--border); vertical-align: middle; }
tbody tr:hover { background: var(--surface-hover); }
td .sub { display: block; font-size: 12px; color: var(--text-2); max-width: 420px; overflow: hidden; text-overflow: ellipsis; }
td .errtext { display: block; font-size: 12px; color: var(--danger); max-width: 420px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty { padding: 36px 20px; text-align: center; color: var(--text-2); }
.empty b { display: block; color: var(--text); margin-bottom: 4px; }

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 8px; border-radius: var(--r-sm); font-size: 11px; font-weight: 600; background: #262a33; color: var(--text-2); white-space: nowrap; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.ok { background: rgba(34,197,94,.14); color: var(--success); } .badge.warn { background: rgba(245,158,11,.14); color: var(--warning); }
.badge.bad { background: rgba(239,68,68,.14); color: var(--danger); } .badge.info { background: rgba(14,165,233,.14); color: var(--info); }
.badge.plain::before { display: none; }

.btn { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: var(--r-sm); border: 1px solid var(--border-light); background: var(--surface-hover); color: #e5e7eb; font: inherit; font-weight: 500; cursor: pointer; white-space: nowrap; }
.btn:hover { background: #2a2f3a; } .btn:disabled { opacity: .45; cursor: not-allowed; }
.btn:focus-visible, .icon-btn:focus-visible, .input:focus-visible, .nav-link:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; } .btn-primary:hover { background: var(--primary-hover); }
.btn-danger { background: transparent; border-color: var(--danger); color: var(--danger); } .btn-danger:hover { background: rgba(239,68,68,.14); }
.btn-solid-danger { background: var(--danger); border-color: var(--danger); color: #fff; } .btn-solid-danger:hover { background: #dc2626; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12px; }
.icon-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: var(--r-sm); background: none; border: 1px solid transparent; color: var(--text-2); cursor: pointer; }
.icon-btn:hover { background: var(--surface-hover); color: #fff; } .icon-btn:disabled { opacity: .3; cursor: default; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

.input, select.input, textarea.input { width: 100%; background: var(--input); border: 1px solid var(--border-light); color: var(--text); border-radius: var(--r-sm); padding: 8px 10px; font: inherit; }
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(235,22,22,.12); outline: none; }
label { display: block; font-size: 13px; color: var(--text-2); margin: 12px 0 4px; }
.form-err { color: var(--danger); min-height: 20px; font-size: 13px; margin-top: 8px; }
.hint { font-size: 12px; color: var(--text-3); margin-top: 4px; }
.fields { display: grid; grid-template-columns: 90px 1fr 90px 90px; gap: 8px; align-items: center; }
.fields .h { font-size: 11px; color: var(--text-3); text-transform: uppercase; }

.switch { position: relative; display: inline-block; width: 38px; height: 22px; }
.switch input { opacity: 0; width: 100%; height: 100%; position: absolute; margin: 0; cursor: pointer; z-index: 1; }
.slider { position: absolute; inset: 0; background: #343945; border-radius: 22px; transition: background .12s; }
.slider::before { content: ""; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: transform .12s; }
.switch input:checked + .slider { background: var(--primary); } .switch input:checked + .slider::before { transform: translateX(16px); }
.switch input:focus-visible + .slider { outline: 2px solid var(--primary); outline-offset: 2px; }
.switch input:disabled + .slider { opacity: .4; }
.switch-row { display: flex; align-items: center; gap: 8px; margin: 0; cursor: pointer; }

.progress { height: 6px; background: #262a33; border-radius: 3px; overflow: hidden; min-width: 90px; margin-top: 4px; }
.progress > i { display: block; height: 100%; background: var(--primary); } .progress.warn > i { background: var(--warning); } .progress.full > i { background: var(--danger); }

.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); margin-right: 6px; }
.dot.ok { background: var(--success); } .dot.warn { background: var(--warning); } .dot.bad { background: var(--danger); }
.chart { width: 100%; height: 150px; display: block; } .chart text { fill: #9ca3af; font-size: 10px; } .chart .bar { fill: var(--primary); } .chart .bar:hover { fill: #ff4b4b; } .chart .grid { stroke: rgba(255,255,255,.06); }
.code { background: var(--input); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 10px 12px; font-family: var(--mono); font-size: 12px; overflow-x: auto; white-space: pre; color: #d1d5db; }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 6px 12px; font-size: 13px; } .kv dt { color: var(--text-2); } .kv dd { margin: 0; word-break: break-all; }

#banner .bn { display: flex; align-items: center; gap: 12px; padding: 10px 24px; font-size: 13px; border-bottom: 1px solid var(--border); }
#banner .bn.bad { background: rgba(239,68,68,.12); color: #fca5a5; } #banner .bn.warn { background: rgba(245,158,11,.12); color: #fcd34d; }

.modal-back { position: fixed; inset: 0; background: rgba(0,0,0,.72); display: grid; place-items: center; z-index: 60; padding: 16px; }
.modal { width: 100%; max-width: 520px; max-height: 92vh; overflow-y: auto; background: var(--surface); border: 1px solid var(--border-light); border-radius: var(--r-lg); }
.modal.wide { max-width: 680px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 20px; border-bottom: 1px solid var(--border); font-weight: 600; }
.modal-body { padding: 8px 20px 16px; } .modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border); }
.toasts { position: fixed; top: 76px; right: 16px; z-index: 70; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--surface); border: 1px solid var(--border-light); border-left: 3px solid var(--info); border-radius: var(--r-sm); padding: 10px 14px; max-width: 360px; font-size: 13px; box-shadow: 0 2px 8px rgba(0,0,0,.4); }
.toast.ok { border-left-color: var(--success); } .toast.err { border-left-color: var(--danger); }

.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: 100%; max-width: 360px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 28px; }
.login-card .brand { display: flex; gap: 10px; align-items: center; font-size: 20px; font-weight: 700; }
.login-card .btn { width: 100%; justify-content: center; margin-top: 8px; height: 40px; }
.skeleton { height: 14px; border-radius: 3px; background: linear-gradient(90deg,#20242d,#2a2e37,#20242d); background-size: 200% 100%; animation: sk 1.2s infinite; margin: 10px 0; }
@keyframes sk { to { background-position: -200% 0; } }

@media (max-width: 991px) {
  .grid.two, .grid.even { grid-template-columns: 1fr; }
}
@media (max-width: 767px) {
  .sidebar { transform: translateX(-100%); width: var(--sidebar-w) !important; }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 25; }
  .main, body.collapsed .main { margin-left: 0; }
  body.collapsed .brand-text, body.collapsed .nav-link span, body.collapsed .nav-group { display: initial; }
  body.collapsed .nav-link { justify-content: flex-start; padding: 0 20px; }
  .content { padding: 14px; } .topbar { padding: 0 12px; }
  .fields { grid-template-columns: 70px 1fr 70px 70px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* uzun hata metni eylem düğmelerini dışarı itmesin: son sütun sağa yapışık */
td .sub, td .errtext { max-width: 340px; }
td:last-child { position: sticky; right: 0; background: var(--surface); }
tbody tr:hover td:last-child { background: var(--surface-hover); }
pre.code { background: rgba(0,0,0,.35); border: 1px solid rgba(255,255,255,.08); border-radius: 8px; padding: 12px 14px; overflow: auto; font-size: 12.5px; line-height: 1.5; margin: 0 0 16px; white-space: pre; user-select: text; }
