:root {
  --bg: #f1f4f9;
  --surface: #ffffff;
  --surface-2: #f7f9fc;
  --border: #dfe5ee;
  --text: #16202e;
  --text-muted: #66758c;
  --accent: #1a6ef0;
  --accent-dark: #1558c4;
  --accent-soft: #e8f0ff;
  --danger: #d6455c;
  --danger-soft: #fdecef;
  --warn: #b7791f;
  --warn-soft: #fdf3e0;
  --ok: #1f8a5b;
  --ok-soft: #e6f6ee;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(20, 35, 60, .06), 0 8px 24px rgba(20, 35, 60, .06);
  color-scheme: light;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
p { margin: 0; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .92em; background: var(--surface-2); padding: 1px 5px; border-radius: 5px; }

.muted { color: var(--text-muted); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.link { color: var(--accent); font-weight: 600; }

/* ---------- ortak bilesenler ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}

.card-title { font-size: 16px; display: flex; align-items: center; gap: 8px; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 16px; }
.section-title { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); }

.form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 13px; font-weight: 600; color: var(--text-muted); }

input[type="text"], input[type="password"], select, textarea {
  width: 100%;
  padding: 10px 12px;
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 9px;
  transition: border-color .15s, box-shadow .15s;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 16px;
  font: inherit; font-weight: 600;
  border: 1px solid transparent;
  border-radius: 9px;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s, border-color .15s, opacity .15s;
  white-space: nowrap;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent-dark); }
.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); }
.btn-ghost.danger { color: var(--danger); }
.btn-ghost.danger:hover:not(:disabled) { background: var(--danger-soft); border-color: var(--danger); }
.btn-small { padding: 7px 12px; font-size: 13px; }
.btn-block { width: 100%; }
@keyframes spin { to { transform: rotate(360deg); } }

.alert { padding: 10px 14px; border-radius: 9px; font-size: 14px; }
.alert-error { background: var(--danger-soft); color: var(--danger); }

/* ---------- login ---------- */

.centered { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.login-bg { background: radial-gradient(1200px 600px at 50% -10%, #dce8ff 0%, var(--bg) 60%); }
.login-card { width: min(420px, 100%); padding: 28px; }
.narrow { width: min(460px, 100%); text-align: center; display: grid; gap: 14px; justify-items: center; }

.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.brand-mark {
  display: grid; place-items: center;
  width: 44px; height: 44px; flex: none;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), #6b3df0);
  color: #fff; font-weight: 800; letter-spacing: -.02em;
}
.brand-mark.small { width: 34px; height: 34px; font-size: 13px; border-radius: 10px; }
.brand-title { font-size: 18px; line-height: 1.2; }
.login-brand { display: flex; flex-direction: column; gap: 4px; margin-bottom: 22px; }
.login-hint { margin-top: 18px; text-align: center; }

/* ---------- topbar ---------- */

.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 12px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.topbar-left { display: flex; align-items: center; gap: 12px; }
.topbar-title { font-size: 15px; }
.topbar-right { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.user-chip { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; }
.avatar {
  display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent); font-size: 13px;
}

/* ---------- workspace ---------- */

.workspace {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 20px;
  padding: 20px;
  align-items: start;
  max-width: 1400px;
  margin: 0 auto;
}

.sidebar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
  position: sticky; top: 82px;
  max-height: calc(100dvh - 104px);
  display: flex; flex-direction: column; gap: 12px;
}
.sidebar-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }

.report-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.report-item {
  padding: 10px 12px; border-radius: 9px; cursor: pointer;
  border: 1px solid transparent; background: var(--surface-2);
  display: flex; flex-direction: column; gap: 4px;
  transition: background .15s, border-color .15s;
}
.report-item:hover { border-color: var(--border); }
.report-item.active { background: var(--accent-soft); border-color: var(--accent); }
.report-item-title { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.report-item-meta { display: flex; justify-content: space-between; gap: 8px; font-size: 11.5px; color: var(--text-muted); }
.list-empty { padding: 18px 8px; text-align: center; color: var(--text-muted); font-size: 13px; }

.content { display: flex; flex-direction: column; gap: 20px; min-width: 0; }

.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%);
  padding: 11px 18px; border-radius: 10px;
  background: #16202e; color: #fff; font-size: 14px; font-weight: 500;
  box-shadow: 0 10px 30px rgba(0,0,0,.2);
  z-index: 50;
}
.toast[data-kind="error"] { background: var(--danger); }
.toast[data-kind="ok"] { background: var(--ok); }
[hidden] { display: none !important; }

@media (max-width: 900px) {
  .workspace { grid-template-columns: 1fr; padding: 14px; }
  .sidebar { position: static; max-height: 320px; }

  .topbar { padding: 10px 14px; }
}

/* ---------- yukleme alani ---------- */

.dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 46px 20px;
  text-align: center;
  cursor: pointer;
  background: var(--surface-2);
  transition: border-color .15s, background .15s;
  display: grid; gap: 6px; justify-items: center;
}
.dropzone:hover, .dropzone:focus-visible, .dropzone.dragover { border-color: var(--accent); background: var(--accent-soft); outline: none; }
.dropzone-icon { font-size: 34px; }
.dropzone-title { font-size: 17px; font-weight: 650; }

/* ---------- isleniyor ekrani ---------- */

.process-card { display: flex; flex-direction: column; gap: 20px; }
.process-head { display: flex; align-items: center; gap: 14px; }
.process-title { flex: 1; min-width: 0; }
.process-elapsed {
  font-variant-numeric: tabular-nums;
  font-size: 15px; font-weight: 650; color: var(--text-muted);
  padding: 4px 10px; border-radius: 999px; background: var(--surface-2);
}

.spinner {
  width: 26px; height: 26px; flex: none;
  border: 3px solid var(--accent-soft);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

.stages { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }

.stage {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 9px;
  color: var(--text-muted); font-size: 14px;
  transition: background .2s, color .2s;
}
.stage-dot {
  width: 10px; height: 10px; flex: none; border-radius: 50%;
  border: 2px solid var(--border); background: transparent;
  transition: background .2s, border-color .2s;
}
.stage.is-done { color: var(--text); }
.stage.is-done .stage-dot { background: var(--ok); border-color: var(--ok); }
.stage.is-active { background: var(--accent-soft); color: var(--accent); font-weight: 650; }
.stage.is-active .stage-dot {
  background: var(--accent); border-color: var(--accent);
  animation: pulse 1.3s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(26, 110, 240, .45); }
  50% { box-shadow: 0 0 0 6px rgba(26, 110, 240, 0); }
}

/* ---------- sonuc: indirme kartlari ---------- */

.detail-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.results { display: flex; flex-direction: column; gap: 10px; }

.result-card {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface-2);
  transition: border-color .15s, background .15s;
}
.result-card:hover { border-color: var(--accent); background: var(--accent-soft); }

.result-icon {
  display: grid; place-items: center;
  width: 38px; height: 38px; flex: none;
  border-radius: 9px;
  background: #1a4fa8; color: #fff;
  font-weight: 800; font-size: 16px;
}
.result-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.result-name { font-weight: 650; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.result-meta { font-size: 12.5px; color: var(--text-muted); }

/* ---------- /stats: herkese acik ozet ---------- */

.stats-page { max-width: 1000px; margin: 0 auto; padding: 28px 20px; display: flex; flex-direction: column; gap: 20px; }
.stats-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.stats-title { font-size: 22px; }

.stat-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.stat-tile {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px 18px;
  display: flex; flex-direction: column; gap: 2px;
}
.stat-value { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.stat-label { font-size: 12.5px; color: var(--text-muted); }

.table-scroll { overflow-x: auto; }
.stats-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.stats-table th, .stats-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
.stats-table th { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); font-weight: 650; }
.stats-table tbody tr:last-child td { border-bottom: none; }
.stats-table tbody tr:hover { background: var(--surface-2); }
.stats-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.stats-table .strong { font-weight: 700; }
.stats-table .center { text-align: center; }
.stats-note { text-align: center; }
