:root {
  --bg: #eef1ef;
  --surface: #ffffff;
  --ink: #1f2a25;
  --muted: #5d6a64;
  --line: #d6ddd9;
  --send: #12784a;
  --send-ink: #ffffff;
  --sent: #2a5db0;
  --warn-bg: #fff4d6;
  --warn-ink: #6b4d00;
  --radius-s: 4px;
  --radius-m: 8px;
  font-family: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-size: 15px;
  line-height: 1.5;
}
* { box-sizing: border-box; }
body { margin: 0; }
a { color: var(--ink); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid #7fb89b; outline-offset: 2px; }
main { max-width: 1180px; margin: 0 auto; padding: 20px 16px 64px; }
h1 { font-size: 1.6rem; font-weight: 600; margin: 8px 0 4px; letter-spacing: -0.01em; }
h2 { font-size: 1.15rem; font-weight: 600; margin: 32px 0 8px; }
.lead { color: var(--muted); max-width: 70ch; margin: 0 0 20px; }
code { background: #e3e8e5; padding: 1px 5px; border-radius: var(--radius-s); font-size: 0.9em; }

/* Ust cubuk */
.top { display: flex; align-items: center; gap: 24px; padding: 10px 16px; background: var(--ink); color: #fff; flex-wrap: wrap; }
.top a, .top .link { color: #cfe0d7; text-decoration: none; }
.brand { font-family: "IBM Plex Sans Condensed", "IBM Plex Sans", sans-serif; font-weight: 600; font-size: 1.15rem; color: #fff !important; }
.top nav { display: flex; gap: 18px; flex: 1; }
.top nav a[aria-current="page"] { color: #fff; box-shadow: inset 0 -2px 0 #6fcf9d; }
.logout { margin-left: auto; }
.alert { background: var(--warn-bg); color: var(--warn-ink); padding: 10px 16px; border-bottom: 1px solid #ecd9a0; }
.alert a { color: var(--warn-ink); font-weight: 600; }
.flash { background: #e1f1e8; border-left: 4px solid var(--send); padding: 8px 12px; margin: 0 0 16px; }
.error { color: #a12d2d; }
.muted { color: var(--muted); }

/* Form ogeleri */
label { display: flex; flex-direction: column; gap: 4px; font-size: 0.85rem; color: var(--muted); }
label small { color: var(--muted); }
input, select, textarea, button, .button { font: inherit; font-size: 0.95rem; }
input, select, textarea { border: 1px solid var(--line); border-radius: var(--radius-s); padding: 7px 9px; background: #fff; color: var(--ink); min-width: 0; }
textarea { resize: vertical; line-height: 1.5; }
button, .button { border: 1px solid var(--line); background: #fff; color: var(--ink); border-radius: var(--radius-s); padding: 7px 14px; cursor: pointer; text-decoration: none; display: inline-block; }
button.primary { background: var(--ink); border-color: var(--ink); color: #fff; }
button.link { border: 0; background: none; padding: 0; text-decoration: underline; cursor: pointer; }
button.link.danger { color: #a12d2d; }
label.check { flex-direction: row; align-items: center; gap: 8px; color: var(--ink); font-size: 0.9rem; }

/* Giris */
.login { max-width: 360px; margin: 12vh auto; background: var(--surface); padding: 28px; border-radius: var(--radius-m); display: grid; gap: 14px; border: 1px solid var(--line); }
.login h1 { margin: 0 0 4px; }

/* Durum sayaclari */
.counts { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 16px; }
.count { flex: 0 0 auto; text-decoration: none; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 8px 14px; display: flex; flex-direction: column; font-size: 0.85rem; color: var(--muted); }
.count b { font-family: "IBM Plex Sans Condensed", "IBM Plex Sans", sans-serif; font-size: 1.5rem; color: var(--ink); line-height: 1.1; font-variant-numeric: tabular-nums; }
.count.on { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }

/* Filtreler */
.filters { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px 12px; align-items: end; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 14px; }
.filter-actions { display: flex; gap: 8px; }
.total { color: var(--muted); margin: 18px 0 8px; }
.empty { background: var(--surface); border: 1px dashed var(--line); padding: 24px; border-radius: var(--radius-m); }

/* Hesap listesi */
.list { display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius-m); overflow: hidden; }
.acc { background: var(--surface); display: grid; grid-template-columns: minmax(200px, 2.2fr) 110px 90px minmax(180px, 2fr) minmax(190px, 1.6fr); gap: 16px; padding: 14px 16px; align-items: center; }
.who { display: flex; flex-direction: column; min-width: 0; }
.user { font-weight: 600; text-decoration: none; overflow-wrap: anywhere; }
.user:hover { text-decoration: underline; }
.name { overflow-wrap: anywhere; }
.meta { color: var(--muted); font-size: 0.85rem; }
.stat { display: flex; flex-direction: column; }
.stat b { font-family: "IBM Plex Sans Condensed", "IBM Plex Sans", sans-serif; font-size: 1.35rem; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.15; }
.stat span { color: var(--muted); font-size: 0.8rem; }
.contact { display: flex; flex-direction: column; font-size: 0.9rem; min-width: 0; overflow-wrap: anywhere; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: flex-end; }
.actions form { margin: 0; }
.send { background: var(--send); border-color: var(--send); color: var(--send-ink); font-weight: 500; }
.status-form select { font-size: 0.85rem; padding: 5px 6px; color: var(--muted); }
.reason { font-size: 0.8rem; color: var(--muted); }

/* Durum etiketleri */
.chip { font-size: 0.8rem; padding: 2px 8px; border-radius: 999px; background: #e7ebe9; color: var(--muted); white-space: nowrap; }
.chip.s-iletisime_hazir { background: #dcefe4; color: #0d5c38; }
.chip.s-mesaj_gonderildi { background: #e0e8f6; color: var(--sent); }
.chip.s-yanit_verdi { background: #efe3f6; color: #6a2e8a; }
.chip.s-anlasildi { background: var(--send); color: #fff; }
.chip.s-reddetti, .chip.s-elendi { background: #f3e4e2; color: #8a3a31; }

.pager { display: flex; gap: 12px; align-items: center; justify-content: center; margin-top: 18px; }

/* Kaynaklar, sablonlar, ayarlar */
.card-form { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; align-items: end; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 16px; margin-bottom: 20px; }
.card-form .wide { grid-column: span 2; }
.grid { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); overflow: hidden; display: block; overflow-x: auto; }
.grid th, .grid td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.grid th { font-weight: 500; color: var(--muted); font-size: 0.85rem; }
.grid td.n { text-align: right; font-variant-numeric: tabular-nums; }
.grid td.note { white-space: normal; min-width: 220px; color: var(--muted); font-size: 0.85rem; }
.grid tr.off td { color: var(--muted); }
.grid tr.run-durduruldu td, .grid tr.run-hata td { background: #fbf1ef; }
.row-actions { display: flex; gap: 14px; }
.tpl { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 16px; display: grid; gap: 12px; margin-bottom: 16px; max-width: 760px; }
.tpl button { justify-self: start; }
.state { display: flex; gap: 16px; align-items: center; justify-content: space-between; padding: 14px 16px; border-radius: var(--radius-m); margin: 12px 0 16px; border: 1px solid var(--line); background: var(--surface); }
.state p { margin: 0; }
.state.paused { background: var(--warn-bg); border-color: #ecd9a0; color: var(--warn-ink); }

/* Telefon */
@media (max-width: 860px) {
  .top nav { order: 3; flex-basis: 100%; overflow-x: auto; }
  .acc { grid-template-columns: 1fr auto auto; gap: 8px 16px; }
  .who { grid-column: 1 / -1; }
  .contact { grid-column: 1 / -1; }
  .actions { grid-column: 1 / -1; justify-content: flex-start; }
  .acc .stat { grid-row: 2; }
  .send { flex: 1 1 100%; padding: 11px 14px; font-size: 1rem; }
  .card-form .wide { grid-column: 1 / -1; }
  .state { flex-direction: column; align-items: flex-start; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* v2: tarama plani, telefon dugmeleri */
.plan-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 16px; margin: 12px 0 8px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 14px 16px; }
.panel h2 { margin-top: 0; }
.plan { list-style: none; padding: 0; margin: 0; }
.plan li { display: grid; grid-template-columns: 116px 1fr; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.plan li:last-child { border-bottom: 0; }
.plan .when { font-variant-numeric: tabular-nums; color: var(--muted); }
.plan small { color: var(--muted); }
.grid.compact td, .grid.compact th { padding: 6px 10px; }
form.inline { display: flex; gap: 6px; align-items: center; }
form.inline select, form.inline input { padding: 4px 6px; font-size: 0.85rem; }
input.days { width: 52px; }
.send.try { background: #fff; color: var(--send); border-color: var(--send); }
.button.call { border-color: var(--ink); }
@media (max-width: 860px) {
  .plan-grid { grid-template-columns: 1fr; }
  .button.call { flex: 1 1 40%; text-align: center; padding: 11px 14px; }
  .send.try { flex: 1 1 50%; }
}
