:root {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --text: #1c2027;
  --muted: #6b7280;
  --line: #e4e7ec;
  --accent: #2563eb;
  --accent-ink: #ffffff;
  --ok: #15803d;
  --ok-bg: #e8f6ee;
  --warn: #a16207;
  --warn-bg: #fdf6e3;
  --bad: #b42318;
  --bad-bg: #fdecea;
  --hl: #eef4ff;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115;
    --panel: #181b21;
    --text: #e6e8eb;
    --muted: #9aa1ab;
    --line: #2a2f38;
    --accent: #5b8cff;
    --accent-ink: #0b0d12;
    --ok: #4ade80;
    --ok-bg: #12301f;
    --warn: #facc15;
    --warn-bg: #2f2a12;
    --bad: #f87171;
    --bad-bg: #351717;
    --hl: #1a2540;
    --shadow: none;
  }
}

* { box-sizing: border-box; }
[hidden], .hidden { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
body.busy { cursor: progress; }
h1 { font-size: 20px; margin: 0; }
a { color: inherit; }
code { font: 12.5px/1.3 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; word-break: break-all; }
.muted { color: var(--muted); font-size: 13px; }

input[type=text], input[type=password], input[type=search], textarea, select {
  font: inherit;
  color: inherit;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 11px;
  width: 100%;
  min-width: 0;
}
textarea { resize: vertical; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }
select { width: auto; flex-shrink: 0; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

.btn {
  font: inherit;
  font-weight: 500;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 16px;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { border-color: var(--line); }
.btn.ok { color: var(--ok); }
.btn.danger, .danger { color: var(--bad); }
body.busy .btn.primary { opacity: .6; pointer-events: none; }
.link { background: none; border: 0; color: var(--accent); font: inherit; font-weight: 600; cursor: pointer; padding: 0 0 0 8px; }

.row { display: flex; gap: 8px; align-items: center; }
.row.end { justify-content: flex-end; margin-top: 8px; }
.row.grow { flex: 1; min-width: 240px; }

/* Giriş */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; width: 100%; max-width: 340px; display: grid; gap: 10px; box-shadow: var(--shadow); }
.login-card h1 { text-align: center; margin-bottom: 8px; }
.login-card label { font-size: 13px; color: var(--muted); }
.err { color: var(--bad); margin: 0; font-size: 14px; }

/* Düzen */
.top { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; max-width: 1040px; margin: 0 auto; }
.wrap { max-width: 1040px; margin: 0 auto; padding: 0 16px 48px; display: grid; gap: 16px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); min-width: 0; }

/* Sekmeler */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: -4px -4px 14px; padding: 0 4px; overflow-x: auto; }
.tab { font: inherit; background: none; border: 0; border-bottom: 2px solid transparent; padding: 8px 12px; color: var(--muted); cursor: pointer; white-space: nowrap; }
.tab.active { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }

.drop { display: grid; gap: 4px; place-items: center; text-align: center; border: 2px dashed var(--line); border-radius: var(--radius); padding: 28px 16px; cursor: pointer; }
.drop.over { border-color: var(--accent); background: var(--hl); }
.drop input { display: none; }

/* İlerleme ve rapor */
.progress { margin-top: 14px; display: grid; gap: 6px; }
.progress .bar { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; }
.progress .bar span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .3s; }
.progress .label { font-size: 13px; color: var(--muted); }

.report { margin-top: 14px; position: relative; display: grid; gap: 8px; }
.report .close { position: absolute; right: 4px; top: 2px; background: none; border: 0; font-size: 20px; color: var(--muted); cursor: pointer; z-index: 1; }
.rep { border-radius: 8px; padding: 10px 36px 10px 12px; font-size: 14px; }
.rep ul { margin: 6px 0 0; padding-left: 18px; max-height: 180px; overflow: auto; }
.rep li { margin: 2px 0; }
.rep.ok { background: var(--ok-bg); color: var(--ok); }
.rep.warn { background: var(--warn-bg); }
.rep.warn b { color: var(--warn); }
.rep.bad { background: var(--bad-bg); }
.rep.bad b { color: var(--bad); }

/* Filtre çubuğu */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 12px; }
.filters, .subfilters { display: flex; gap: 6px; flex-wrap: wrap; }
.subfilters { order: 3; width: 100%; }
.chip { font: inherit; font-size: 14px; background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; cursor: pointer; }
.chip b { font-weight: 600; color: var(--muted); margin-left: 2px; }
.chip.active { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.chip.active b { color: inherit; opacity: .8; }
.chip.small { font-size: 13px; padding: 4px 10px; }

.bulkbar { display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; align-items: center; background: var(--hl); border-radius: 8px; padding: 8px 12px; margin-bottom: 10px; font-size: 14px; }
.bulkbar label { display: flex; gap: 6px; align-items: center; cursor: pointer; }
.bulkbar.idle { background: transparent; padding: 0 12px; min-height: 30px; color: var(--muted); }

/* Liste */
.list { list-style: none; margin: 0; padding: 0; }
.item { display: grid; grid-template-columns: auto 160px 1fr auto; gap: 14px; align-items: center; padding: 12px 4px; border-top: 1px solid var(--line); transition: opacity .25s, background .6s; }
.item:first-child { border-top: 0; }
.item.sel { background: var(--hl); }
.item.new { animation: flash 2.4s ease-out; }
.item.leaving, .item.busy { opacity: .4; pointer-events: none; }
@keyframes flash { from { background: var(--hl); } to { background: transparent; } }

.thumb { display: block; width: 160px; aspect-ratio: 16 / 10; border-radius: 6px; overflow: hidden; background: var(--bg); border: 1px solid var(--line); position: relative; }
.thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top; display: block; }
.thumb img:not([src]) { visibility: hidden; }
.thumb.loading::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(128,128,128,.15), transparent); animation: shimmer 1.2s infinite; }
@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }

.info { min-width: 0; }
.title { font-weight: 600; text-decoration: none; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.title:hover { color: var(--accent); text-decoration: underline; }
.title:visited { color: var(--muted); }
.url { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meta { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12.5px; color: var(--muted); margin-top: 4px; align-items: center; }
.badge { font-size: 11.5px; padding: 1px 7px; border-radius: 999px; background: var(--bg); border: 1px solid var(--line); color: var(--muted); }
.badge.bad { background: var(--bad-bg); color: var(--bad); border-color: transparent; cursor: help; }
.badge.done { background: var(--ok-bg); color: var(--ok); border-color: transparent; }

.actions { display: flex; gap: 6px; align-items: center; }
.more { position: relative; }
.more summary { list-style: none; }
.more summary::-webkit-details-marker { display: none; }
.menu { position: absolute; right: 0; top: calc(100% + 4px); background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.14); display: grid; min-width: 190px; padding: 4px; z-index: 10; }
.menu button { font: inherit; font-size: 14px; text-align: left; background: none; border: 0; color: var(--text); padding: 8px 10px; border-radius: 6px; cursor: pointer; }
.menu button:hover { background: var(--bg); }
.menu button.danger { color: var(--bad); }

.empty { text-align: center; color: var(--muted); padding: 40px 0; margin: 0; }

.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 8px; font-size: 14px; box-shadow: 0 8px 24px rgba(0,0,0,.2); z-index: 20; max-width: calc(100% - 32px); }
.toast .link { color: var(--bg); text-decoration: underline; }

/* Mobil */
@media (max-width: 680px) {
  .item { grid-template-columns: auto 96px 1fr; gap: 10px; }
  .thumb { width: 96px; }
  .actions { grid-column: 2 / -1; flex-wrap: wrap; }
  .row.grow { min-width: 100%; }
  .tab-body .row:not(.end) { flex-direction: column; align-items: stretch; }
}
