:root {
  --bg: #ffffff;
  --menu: #f3f4f6;
  --panel: #f9fafb;
  --active: #e2e4e7;
  --border: #e5e7eb;
  --input: #d2d5db;
  --title: #111827;
  --text: #4d5562;
  --muted: #6d727f;
  --indigo: #4e47dd;
  --blue: #3762e3;
  --green: #43946c;
  --green-bg: #d9f9e6;
  --orange: #b4620f;
  --orange-bg: #fdf0e3;
  --red: #ca3a32;
  --red-bg: #fbf3f2;
  --teal: #55b5a6;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; font: 15px/1.5 Inter, Roboto, system-ui, sans-serif; color: var(--text); background: var(--bg); }
h1 { margin: 0; font-size: 24px; color: var(--title); }
h2 { margin: 0 0 12px; font-size: 18px; color: var(--title); }
.muted { color: var(--muted); }
.error { color: var(--red); margin: 0; }

.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 20px; white-space: nowrap; color: var(--title); }
.brand-logo { width: 30px; height: auto; flex: none; }
.brand span { color: var(--indigo); }

.btn {
  display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 16px;
  border-radius: 8px; border: 1px solid var(--input); background: #fff; color: var(--text);
  font: inherit; font-weight: 500; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn.primary { background: var(--indigo); border-color: var(--indigo); color: #fff; }
.btn.blue { background: var(--blue); border-color: var(--blue); }
.btn.danger { color: var(--red); border-color: var(--red); }
.btn.ghost { background: #fff; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.icon-btn { width: 32px; height: 32px; border-radius: 6px; border: 0; color: #fff; cursor: pointer; font-size: 14px; }
.icon-btn.edit { background: #4ca154; }
.icon-btn.del { background: var(--red); }

input, textarea {
  width: 100%; font: inherit; color: var(--title); padding: 9px 12px;
  border: 1px solid var(--input); border-radius: 8px; background: #fff;
}
textarea { resize: vertical; }
label { display: grid; gap: 6px; font-weight: 500; color: var(--title); font-size: 14px; }
th.check input, td.check input { width: 18px; height: 18px; }

/* Giriş */
.login { min-height: 100vh; display: grid; place-items: center; background: var(--menu); padding: 16px; }
.login-card { width: min(380px, 100%); background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 28px; display: grid; gap: 14px; }

/* Kabuk */
.shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.side { background: var(--menu); padding: 24px 16px; display: grid; align-content: start; gap: 24px; }
.side nav { display: grid; gap: 4px; }
.side a { padding: 10px 12px; border-radius: 8px; color: var(--text); text-decoration: none; font-weight: 500; }
.side a.active { background: var(--active); color: var(--title); }
.main { min-width: 0; }
.top { height: 64px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; padding: 0 24px; }
.spacer { flex: 1; }
.user { display: flex; align-items: center; gap: 8px; font-weight: 500; color: var(--title); }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--teal); color: #fff; display: grid; place-items: center; font-size: 13px; font-weight: 600; }
.warning { background: var(--orange-bg); color: var(--orange); padding: 6px 12px; border-radius: 8px; font-size: 14px; }
.content { padding: 28px 32px; display: grid; gap: 16px; max-width: 1200px; }

.title-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: space-between; }
.row-actions { display: flex; gap: 8px; }
.footer-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

.stepper { list-style: none; display: flex; gap: 8px; padding: 0; margin: 0; counter-reset: s; flex-wrap: wrap; }
.stepper li { counter-increment: s; display: flex; align-items: center; gap: 8px; padding: 6px 14px 6px 6px; border-radius: 999px; background: var(--panel); border: 1px solid var(--border); color: var(--muted); font-weight: 500; font-size: 14px; }
.stepper li::before { content: counter(s); width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--active); color: var(--text); font-size: 12px; }
.stepper li.active { color: var(--title); border-color: var(--indigo); }
.stepper li.active::before, .stepper li.done::before, .stepper.done li::before { background: var(--indigo); color: #fff; }

.table-card, .card { border: 1px solid var(--border); border-radius: 8px; background: #fff; overflow-x: auto; }
.card.form, .form { padding: 20px; display: grid; gap: 16px; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 13px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); padding: 12px 16px; border-bottom: 1px solid var(--border); }
td { padding: 14px 16px; border-bottom: 1px solid var(--border); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
th.check, td.check { width: 44px; }
th.actions, td.actions { width: 96px; white-space: nowrap; }
td.actions > div { display: flex; gap: 6px; }
.item-title { font-weight: 600; color: var(--title); }
.item-steps { white-space: pre-line; color: var(--muted); font-size: 14px; margin-top: 4px; }
tr.off .item-title, tr.off .item-steps, tr.off td:nth-child(3) { opacity: 0.5; }
tbody tr.link { cursor: pointer; }
tbody tr.link:hover { background: var(--panel); }

.drop { border: 2px dashed var(--input); border-radius: 10px; padding: 28px; text-align: center; cursor: pointer; background: var(--panel); }
.drop.over { border-color: var(--indigo); }
.drop input { display: none; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 13px; font-weight: 500; background: var(--panel); color: var(--text); border: 1px solid var(--border); }
.badge.gecti, .badge.tamamlandı { background: var(--green-bg); color: var(--green); border-color: transparent; }
.badge.kaldi, .badge.hata { background: var(--red-bg); color: var(--red); border-color: transparent; }
.badge.engellendi, .badge.iptal { background: var(--orange-bg); color: var(--orange); border-color: transparent; }
.badge.çalışıyor, .badge.hazırlanıyor { background: #eceafd; color: var(--indigo); border-color: transparent; }

.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.kpi { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; }
.kpi .label { font-size: 12px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.kpi .value { font-size: 28px; font-weight: 700; color: var(--title); }

.result { border: 1px solid var(--border); border-radius: 10px; margin-bottom: 12px; overflow: hidden; }
.result > summary { list-style: none; display: flex; align-items: center; gap: 12px; padding: 14px 16px; cursor: pointer; }
.result > summary::-webkit-details-marker { display: none; }
.result > summary .item-title { flex: 1; }
.result .body { padding: 0 16px 16px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.summary-text { white-space: pre-line; overflow-wrap: anywhere; color: var(--title); background: var(--panel); border-radius: 8px; padding: 10px 12px; margin: 0; }
.steps { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 6px; }
.step { flex: 0 0 120px; font-size: 12px; color: var(--muted); }
.step img { width: 120px; border-radius: 8px; border: 1px solid var(--border); display: block; cursor: zoom-in; }
.step.note { flex-basis: 220px; background: var(--panel); border-radius: 8px; padding: 8px; color: var(--title); }
/* Uzun adım yazıları birkaç satırda kesilir; tamamı üzerine gelince ya da büyük görüntüde okunur. */
.step-text { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; overflow-wrap: anywhere; margin-top: 4px; }
.step.note .step-text { -webkit-line-clamp: 5; margin-top: 0; }
.shot-caption { margin: 8px 0 0; max-width: 480px; text-align: left; color: var(--title); font-size: 14px; overflow-wrap: anywhere; }
.shot-caption:empty { display: none; }
.crash { white-space: pre-wrap; font: 12px/1.4 ui-monospace, monospace; background: var(--red-bg); color: var(--red); padding: 10px; border-radius: 8px; margin: 0; overflow-x: auto; }

dialog { border: 1px solid var(--border); border-radius: 12px; padding: 0; width: min(560px, calc(100% - 32px)); }
dialog::backdrop { background: rgb(17 24 39 / 0.4); }
.shot-dialog { width: auto; max-width: calc(100% - 32px); padding: 12px; text-align: right; }
.shot-dialog img { display: block; max-height: 85vh; max-width: 100%; margin-top: 8px; border-radius: 8px; }

@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .side { padding: 12px 16px; grid-auto-flow: column; justify-content: space-between; align-items: center; }
  .side nav { grid-auto-flow: column; }
  .top { padding: 0 16px; }
  .content { padding: 20px 16px; }
  .grid2, .kpis { grid-template-columns: 1fr 1fr; }
  th:nth-child(3), td:nth-child(3) { display: none; }
}

/* APK kütüphanesi */
.apk-list { display: grid; gap: 8px; }
.apk { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; cursor: pointer; font-weight: 400; color: var(--text); }
.apk:has(input:checked) { border-color: var(--indigo); background: #f5f4fe; }
.apk input { width: 18px; height: 18px; accent-color: var(--indigo); }
.apk .grow { flex: 1; min-width: 0; }
.apk .apk-rename { width: 100%; padding: 4px 8px; font-weight: 600; }
.apk .del-apk { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 18px; }
select { width: 100%; font: inherit; color: var(--title); padding: 9px 12px; border: 1px solid var(--input); border-radius: 8px; background: #fff; }
.inline-check { display: flex; align-items: center; gap: 8px; font-weight: 400; }
.inline-check input { width: 18px; height: 18px; }
.small { font-size: 13px; font-weight: 400; }
.rec-badge { font-size: 13px; white-space: nowrap; }
.rec-badge.yes { color: var(--green); font-weight: 600; }
.icon-btn.rec { background: var(--indigo); width: auto; padding: 0 10px; }

/* Kayıt ekranı */
.recorder { display: grid; grid-template-columns: minmax(260px, 360px) 1fr; gap: 24px; align-items: start; }
.phone { position: sticky; top: 16px; border: 10px solid #1f2937; border-radius: 28px; overflow: hidden; background: #000; }
.phone img { display: block; width: 100%; cursor: crosshair; user-select: none; }
.phone.check img { cursor: help; }
.phone-status { position: absolute; inset: auto 0 0 0; background: rgb(17 24 39 / 0.75); color: #fff; font-size: 13px; padding: 6px 10px; }
.phone-status:empty { display: none; }
.rec-panel { display: grid; gap: 12px; }
.mode-row, .tool-row { display: flex; gap: 8px; flex-wrap: wrap; }
.btn.mode.active { background: var(--indigo); border-color: var(--indigo); color: #fff; }
.type-row { display: flex; gap: 8px; }
.rec-steps { margin: 0; padding-left: 22px; display: grid; gap: 4px; max-height: 320px; overflow-y: auto; }
.rec-steps li { color: var(--title); }
@media (max-width: 760px) {
  .recorder { grid-template-columns: 1fr; }
  .phone { position: static; max-width: 340px; }
  th:nth-child(4), td:nth-child(4) { display: none; }
}

.confirm-text { margin: 0; color: var(--title); font-size: 16px; }

/* Düzenlenebilir adım listesi */
.rec-steps.editable { list-style: none; padding: 0; counter-reset: st; max-height: 420px; }
.rec-steps.editable li { counter-increment: st; display: flex; align-items: center; gap: 8px; padding: 6px 8px; border: 1px solid var(--border); border-radius: 8px; background: #fff; }
.rec-steps.editable li::before { content: counter(st); min-width: 22px; height: 22px; border-radius: 50%; background: var(--active); color: var(--text); font-size: 12px; display: grid; place-items: center; }
.rec-steps.editable li.muted::before { display: none; }
.step-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.step-tools { display: flex; gap: 4px; }
.drag-handle { cursor: grab; color: var(--muted, #9aa0a6); font-size: 16px; line-height: 1; user-select: none; }
.rec-steps.editable li[draggable] { cursor: grab; }
.rec-steps.editable li.dragging { opacity: 0.4; }
.rec-steps.editable li.drop-before { box-shadow: 0 -3px 0 var(--indigo); }
.rec-steps.editable li.drop-after { box-shadow: 0 3px 0 var(--indigo); }
.tool { width: 30px; height: 30px; border: 1px solid var(--border); border-radius: 6px; background: var(--panel); color: var(--text); cursor: pointer; font-size: 14px; }
.tool:hover:not(:disabled) { border-color: var(--indigo); color: var(--indigo); }
.tool.del:hover:not(:disabled) { border-color: var(--red); color: var(--red); }
.tool:disabled { opacity: 0.35; cursor: default; }
.tool.on { border-color: var(--indigo); background: #eef0ff; }
.tool.on:disabled { opacity: 0.7; }
.rec-steps.editable li.editing input { flex: 1; padding: 6px 10px; }
.small-btn { height: 32px; padding: 0 10px; font-size: 14px; }

a.drop { display: grid; gap: 4px; text-decoration: none; color: var(--title); }
.drop { display: grid; gap: 4px; align-content: center; }
.install-state { margin: 0; font-weight: 500; color: var(--muted); }
.install-state.ok { color: var(--green); }
code { background: var(--panel); padding: 1px 5px; border-radius: 4px; font-size: 13px; }

.group-bar { display: flex; gap: 12px; align-items: end; flex-wrap: wrap; padding: 16px 20px; margin-bottom: 16px; }
.group-pick { flex: 1 1 260px; display: grid; gap: 6px; font-weight: 600; color: var(--title); }
.group-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.group-copy-opts { display: grid; gap: 10px; }
.group-copy-opts .inline-check { display: grid; grid-template-columns: auto 1fr; column-gap: 8px; align-items: start; }
.group-copy-opts .inline-check .small { grid-column: 2; }
.pick-dialog { width: min(640px, calc(100vw - 32px)); }
.pick-list { max-height: 50vh; overflow-y: auto; display: grid; gap: 14px; }
.pick-list h3 { margin: 0 0 6px; font-size: 14px; color: var(--muted); }
.pick-list label { display: flex; gap: 10px; align-items: flex-start; padding: 6px 0; cursor: pointer; }
.pick-list .in-group { opacity: 0.5; cursor: default; }
.shared-badge { font-size: 12px; color: var(--indigo); white-space: nowrap; }
.pick-list label input, .group-copy-opts input { width: auto; flex: none; margin-top: 3px; }
.pick-list label > span { flex: 1; text-align: left; font-weight: 400; }

.rec-steps.editable li.played { background: #f1f8f2; border-color: #cfe7d2; }
.rec-steps.editable li.played::before { background: var(--green); color: #fff; }
.rec-steps.editable li.current { border-color: var(--indigo); box-shadow: 0 0 0 2px rgba(78, 71, 221, 0.15); }
.rec-steps.editable li.current::before { background: var(--indigo); color: #fff; }
.rec-steps.editable li.pending { opacity: 0.55; }
.step-mark { margin-left: auto; color: var(--green); font-weight: 700; }
