:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #f8f9fb;
  --border: #e4e7ec;
  --text: #101828;
  --text-2: #475467;
  --muted: #667085;
  --brand: #f6821f;
  --brand-600: #e0700f;
  --brand-soft: #fff3e8;
  --danger: #d92d20;
  --danger-soft: #fef3f2;
  --success: #079455;
  --success-soft: #ecfdf3;
  --warn: #b54708;
  --warn-soft: #fffaeb;
  --info: #1570ef;
  --sidebar: #0f1218;
  --sidebar-text: #a8b0bf;
  --sidebar-active: #1c212b;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --shadow-lg: 0 20px 40px -12px rgba(16, 24, 40, .28);
  --radius: 10px;
  --c1: #f6821f; --c2: #2e90fa; --c3: #12b76a; --c4: #9e77ed; --c5: #f04438; --c6: #0ba5ec; --c7: #ee46bc; --c8: #667085; --c9: #eaaa08;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b0d12; --surface: #13161d; --surface-2: #181c24; --border: #262b36;
    --text: #eef0f4; --text-2: #b6bdca; --muted: #8a93a3;
    --brand-soft: #2b1b0d; --danger-soft: #2c1513; --success-soft: #0d2419; --warn-soft: #2a1f0b;
    --sidebar: #090b0f; --sidebar-active: #171b23;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4); --shadow-lg: 0 20px 40px -12px rgba(0, 0, 0, .7);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b0d12; --surface: #13161d; --surface-2: #181c24; --border: #262b36;
  --text: #eef0f4; --text-2: #b6bdca; --muted: #8a93a3;
  --brand-soft: #2b1b0d; --danger-soft: #2c1513; --success-soft: #0d2419; --warn-soft: #2a1f0b;
  --sidebar: #090b0f; --sidebar-active: #171b23;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4); --shadow-lg: 0 20px 40px -12px rgba(0, 0, 0, .7);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font: 14px/1.5 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand-600); text-decoration: none; }
a:hover { text-decoration: underline; }
code, pre, .mono { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 12.5px; }
.boot { display: grid; place-items: center; height: 100vh; color: var(--muted); }
svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Layout ---------- */
.layout { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.sidebar {
  background: var(--sidebar); color: var(--sidebar-text);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; padding: 16px 12px;
}
.logo { display: flex; align-items: center; gap: 10px; padding: 6px 10px 20px; color: #fff; font-weight: 700; font-size: 16px; }
.logo-mark { width: 30px; height: 30px; border-radius: 8px; background: var(--brand); display: grid; place-items: center; font-weight: 800; color: #fff; }
.logo small { display: block; font-weight: 500; font-size: 11px; color: var(--sidebar-text); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-label { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; padding: 16px 10px 6px; color: #5d6575; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--sidebar-text); font-weight: 500; }
.nav a:hover { background: var(--sidebar-active); color: #fff; text-decoration: none; }
.nav a.active { background: var(--sidebar-active); color: #fff; box-shadow: inset 3px 0 0 var(--brand); }
.sidebar-foot { margin-top: auto; padding: 12px 10px 4px; border-top: 1px solid #1d222c; font-size: 12px; }
.sidebar-foot a { color: var(--sidebar-text); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 60px; display: flex; align-items: center; gap: 12px; padding: 0 24px;
  background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20;
}
.topbar h1 { font-size: 17px; margin: 0; font-weight: 650; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-btn { display: none; }
.user-chip { display: flex; align-items: center; gap: 8px; color: var(--text-2); font-weight: 500; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-600); display: grid; place-items: center; font-weight: 700; text-transform: uppercase; }
.content { padding: 24px; max-width: 1400px; width: 100%; }
.scrim { display: none; }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; z-index: 60; width: 260px; transform: translateX(-100%); transition: transform .2s; }
  .layout.nav-open .sidebar { transform: none; }
  .layout.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 50; }
  .menu-btn { display: inline-flex; }
  .topbar { padding: 0 16px; }
  .content { padding: 16px; }
  .user-chip span { display: none; }
}

/* ---------- Bileşenler ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.card-head h2 { font-size: 15px; margin: 0; font-weight: 650; }
.card-body { padding: 18px; }
.grid { display: grid; gap: 16px; }
.stats { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); margin-bottom: 16px; }
.two { grid-template-columns: 1.4fr 1fr; }
@media (max-width: 1100px) { .two { grid-template-columns: 1fr; } }
.stat { padding: 18px; }
.stat-label { color: var(--muted); font-size: 13px; display: flex; align-items: center; gap: 8px; }
.stat-value { font-size: 26px; font-weight: 700; margin-top: 6px; letter-spacing: -.02em; }
.stat-sub { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.stat-ico { width: 34px; height: 34px; border-radius: 9px; background: var(--brand-soft); color: var(--brand-600); display: grid; place-items: center; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px;
  border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-600); }
.btn.danger { color: var(--danger); }
.btn.danger.solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn.icon { width: 32px; height: 32px; padding: 0; }
.btn.icon.sm { width: 28px; height: 28px; }
.btn-group { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.btn-group .btn { border: 0; border-radius: 0; height: 34px; }
.btn-group .btn.on { background: var(--brand-soft); color: var(--brand-600); }

input[type=text], input[type=password], input[type=search], input[type=number], select, textarea {
  font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 0 12px; height: 36px; width: 100%; outline: none;
}
textarea { padding: 8px 12px; height: auto; min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
label.field { display: flex; flex-direction: column; gap: 6px; font-weight: 550; font-size: 13px; color: var(--text-2); }
.hint { font-weight: 400; color: var(--muted); font-size: 12px; }
.form { display: grid; gap: 14px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 600px) { .form-row { grid-template-columns: 1fr; } }
.checks { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.checks label { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; color: var(--text); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; background: var(--surface-2); white-space: nowrap; }
tbody tr:hover { background: var(--surface-2); }
tbody tr:last-child td { border-bottom: 0; }
td.actions { white-space: nowrap; text-align: right; }
.nowrap { white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty { text-align: center; padding: 48px 16px; color: var(--muted); }
.empty svg.i { width: 36px; height: 36px; margin-bottom: 8px; opacity: .6; }

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); }
.badge.ok { background: var(--success-soft); color: var(--success); border-color: transparent; }
.badge.bad { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.badge.brand { background: var(--brand-soft); color: var(--brand-600); border-color: transparent; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }

.bar { height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden; border: 1px solid var(--border); }
.bar > i { display: block; height: 100%; background: var(--brand); border-radius: 999px; }
.dist-row { display: grid; grid-template-columns: 110px 1fr 90px; gap: 12px; align-items: center; padding: 6px 0; }
.dist-row .bar > i { background: var(--dot); }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; background: var(--dot); margin-right: 6px; }

.chart { width: 100%; height: 160px; display: block; }
.chart rect.b { fill: var(--brand); opacity: .9; }
.chart rect.b:hover { opacity: 1; fill: var(--brand-600); }
.chart line { stroke: var(--border); }
.chart text { fill: var(--muted); font-size: 10px; }

.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 12px; padding: 10px 18px; border-bottom: 1px solid var(--border); min-width: 0; }
.list li:last-child { border-bottom: 0; }
.list .grow { flex: 1; min-width: 0; }

/* ---------- Dosya yöneticisi ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.toolbar .search { flex: 1 1 220px; position: relative; }
.toolbar .search svg { position: absolute; left: 10px; top: 9px; color: var(--muted); }
.toolbar .search input { padding-left: 34px; }
.toolbar select { width: auto; }
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; padding: 12px 18px; border-bottom: 1px solid var(--border); font-weight: 550; }
.crumbs a { color: var(--text-2); padding: 2px 6px; border-radius: 6px; }
.crumbs a:hover { background: var(--surface-2); text-decoration: none; }
.crumbs span.sep { color: var(--muted); }
.crumbs a.cur { color: var(--text); }

.fm { position: relative; min-height: 300px; }
.drop-overlay {
  display: none; position: absolute; inset: 8px; border: 2px dashed var(--brand); border-radius: 12px; background: color-mix(in srgb, var(--brand-soft) 85%, transparent);
  z-index: 5; place-items: center; font-weight: 700; color: var(--brand-600); font-size: 16px; pointer-events: none;
}
.fm.dragging .drop-overlay { display: grid; }
.file-cell { display: flex; align-items: center; gap: 10px; min-width: 0; }
.file-cell .name { font-weight: 550; cursor: pointer; }
.file-cell .name:hover { color: var(--brand-600); }
.ficon { width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); flex: none; overflow: hidden; }
.ficon img { width: 100%; height: 100%; object-fit: cover; }
.ficon.folder { background: var(--brand-soft); color: var(--brand-600); border-color: transparent; }
.fgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; padding: 18px; }
.tile { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--surface); cursor: pointer; display: flex; flex-direction: column; }
.tile:hover { border-color: var(--brand); box-shadow: var(--shadow); }
.tile .thumb { aspect-ratio: 4/3; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); overflow: hidden; }
.tile .thumb img { width: 100%; height: 100%; object-fit: cover; }
.tile .thumb svg.i { width: 36px; height: 36px; }
.tile.folder .thumb { background: var(--brand-soft); color: var(--brand-600); }
.tile .meta { padding: 8px 10px; min-width: 0; }
.tile .meta b { display: block; font-weight: 550; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 18px; border-top: 1px solid var(--border); flex-wrap: wrap; }

/* ---------- Modal / toast / upload ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(9, 11, 15, .55); display: grid; place-items: center; padding: 16px; z-index: 100; animation: fade .12s; }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg); width: min(560px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; }
.modal.wide { width: min(980px, 100%); }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-head h3 { margin: 0; font-size: 16px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.modal-body { padding: 20px; overflow: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--border); flex-wrap: wrap; }
@keyframes fade { from { opacity: 0; } }

.preview-layout { display: grid; grid-template-columns: 1fr 300px; gap: 20px; }
@media (max-width: 800px) { .preview-layout { grid-template-columns: 1fr; } }
.preview-box { background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; min-height: 280px; display: grid; place-items: center; overflow: hidden; }
.preview-box img, .preview-box video { max-width: 100%; max-height: 60vh; display: block; }
.preview-box iframe { width: 100%; height: 60vh; border: 0; background: #fff; }
.preview-box pre { margin: 0; padding: 14px; width: 100%; max-height: 60vh; overflow: auto; white-space: pre-wrap; word-break: break-all; align-self: stretch; }
.preview-box.checker { background-image: linear-gradient(45deg, var(--border) 25%, transparent 25%), linear-gradient(-45deg, var(--border) 25%, transparent 25%), linear-gradient(45deg, transparent 75%, var(--border) 75%), linear-gradient(-45deg, transparent 75%, var(--border) 75%); background-size: 16px 16px; background-position: 0 0, 0 8px, 8px -8px, -8px 0; }
dl.details { margin: 0; display: grid; gap: 10px; }
dl.details dt { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
dl.details dd { margin: 2px 0 0; word-break: break-all; }
.copy-field { display: flex; gap: 6px; }
.copy-field input { font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; }
.secret { background: var(--warn-soft); border: 1px solid var(--warn); color: var(--text); padding: 12px; border-radius: 8px; }

#toasts { position: fixed; top: 16px; right: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 200; max-width: calc(100vw - 32px); }
.toast { background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--success); box-shadow: var(--shadow-lg); padding: 10px 14px; border-radius: 8px; min-width: 240px; max-width: 420px; animation: fade .15s; }
.toast.error { border-left-color: var(--danger); }
.toast.warn { border-left-color: var(--warn); }

.uploads { position: fixed; right: 16px; bottom: 16px; width: min(380px, calc(100vw - 32px)); z-index: 90; }
.uploads .card-head { padding: 10px 14px; }
.uploads ul { list-style: none; margin: 0; padding: 0; max-height: 260px; overflow: auto; }
.uploads li { padding: 8px 14px; border-bottom: 1px solid var(--border); font-size: 13px; }
.uploads li .row { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 4px; }
.uploads li.err .bar > i { background: var(--danger); }
.uploads li.done .bar > i { background: var(--success); }

/* ---------- Giriş ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: radial-gradient(1200px 600px at 10% -10%, var(--brand-soft), transparent), var(--bg); }
.login .card { width: min(400px, 100%); padding: 28px; }
.login .logo { color: var(--text); padding: 0 0 18px; }
.login h2 { margin: 0 0 4px; font-size: 20px; }
.err-box { background: var(--danger-soft); color: var(--danger); padding: 10px 12px; border-radius: 8px; font-weight: 500; }

pre.code { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 14px; overflow: auto; margin: 0; }
.section-gap { margin-top: 16px; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
