body { min-height: 100vh; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
svg.i, .side svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- üst çubuk ---------- */
.bar {
  position: sticky; top: 0; z-index: 20;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px;
  height: 64px; padding: 0 20px;
  background: var(--asphalt); color: var(--white);
  border-bottom: 4px solid var(--line);
}
.bar-right { display: flex; gap: 12px; align-items: center; justify-content: flex-end; }
.bar-btn { background: transparent; color: #C9CED6; border-color: rgba(255,255,255,.2); }
.bar-btn:hover { color: var(--white); border-color: var(--white); }

.seg { display: inline-flex; background: var(--asphalt-2); border-radius: 8px; padding: 4px; gap: 4px; }
.seg button {
  font: 600 15px/1 var(--font); padding: 9px 18px; border-radius: 6px; border: 0; cursor: pointer;
  background: transparent; color: #C9CED6;
}
.seg button[aria-checked=true] { background: var(--line); color: var(--ink); }
.seg-light { background: var(--paper); }
.seg-light button { color: var(--mute); }

.wa-pill { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: #C9CED6; white-space: nowrap; }
.wa-pill i { width: 9px; height: 9px; border-radius: 50%; background: var(--bad); }
.wa-pill[data-status=connected] i { background: #4BD18C; }
.wa-pill[data-status=connecting] i, .wa-pill[data-status=qr] i { background: var(--line); }

/* ---------- iskelet ---------- */
.shell { display: grid; grid-template-columns: 228px 1fr; min-height: calc(100vh - 64px); }
.side { background: var(--white); border-right: 1px solid var(--rule); padding: 18px 12px; display: flex; flex-direction: column; gap: 2px; }
.side button {
  display: flex; align-items: center; gap: 12px;
  font: 500 15px/1 var(--font); color: var(--mute);
  padding: 12px; border: 0; border-radius: var(--r-sm); background: none; cursor: pointer; text-align: left;
}
.side button:hover { color: var(--ink); background: var(--paper); }
.side button.active { color: var(--ink); background: var(--paper); font-weight: 600; box-shadow: inset 3px 0 0 var(--line); }
.side .count { margin-left: auto; background: var(--line); color: var(--ink); font-size: 12px; padding: 3px 7px; border-radius: 10px; }

main { padding: 28px 32px 64px; min-width: 0; }
.view { max-width: 860px; }
.view-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.view-head h1 { font: 700 34px/1 var(--font-cond); margin: 0; }
.view-head select { width: auto; min-width: 220px; }
h2 { font-size: 19px; margin: 0 0 6px; }

.card { background: var(--white); border: 1px solid var(--rule); border-radius: var(--r-md); }
.card.pad { padding: 22px; margin-bottom: 16px; }
.stack { display: grid; gap: 12px; }

/* ---------- yazma alanı ---------- */
.composer { padding: 18px; }
.composer textarea { border: 0; padding: 6px 2px; min-height: 200px; font-size: 17px; box-shadow: none; }
.composer textarea:focus { box-shadow: none; }
.editing-draft { display: flex; justify-content: space-between; gap: 12px; background: #FFF6DA; border-radius: var(--r-sm); padding: 10px 12px; margin-bottom: 10px; font-size: 14px; flex-wrap: wrap; }
.vars { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 10px 0; border-top: 1px solid var(--rule); }
.vars .right { margin-left: auto; }
.chip {
  font: 500 13px/1 var(--font); padding: 7px 10px; border-radius: 20px;
  border: 1px solid var(--rule); background: var(--white); cursor: pointer; color: var(--ink);
}
.chip:hover { border-color: var(--mute); }
.chip.on { background: var(--asphalt); color: var(--white); border-color: var(--asphalt); }

.attachments { display: flex; flex-wrap: wrap; gap: 10px; }
.attachments:not(:empty) { padding: 12px 0; border-top: 1px solid var(--rule); }
.att {
  display: flex; align-items: center; gap: 10px;
  border: 1px solid var(--rule); border-radius: var(--r-sm); padding: 6px 8px 6px 6px;
  max-width: 260px; font-size: 14px; background: var(--white);
}
.att .thumb { width: 40px; height: 40px; border-radius: 4px; background: var(--paper) center/cover; flex: none; display: grid; place-items: center; font-size: 11px; font-weight: 700; color: var(--mute); }
.att .meta { min-width: 0; }
.att .meta b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.att .meta small { color: var(--mute); }
.att button { border: 0; background: none; cursor: pointer; color: var(--mute); font-size: 16px; padding: 4px; }
.att.uploading { opacity: .6; }

.loc-box { border-top: 1px solid var(--rule); padding: 14px 0 4px; }
.loc-head { display: flex; justify-content: space-between; margin-bottom: 10px; }
.loc-grid { display: grid; grid-template-columns: 1fr 2fr; gap: 12px; }
#loc-status.ok { color: var(--ok); }
#loc-status.bad { color: var(--bad); }

.tools { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 14px 0; border-top: 1px solid var(--rule); }
.tools input[type=datetime-local] { width: auto; }
.sched-toggle { display: inline-flex; gap: 8px; align-items: center; font-size: 15px; cursor: pointer; margin-left: 6px; }
.sched-toggle input, .check input { width: 18px; height: 18px; accent-color: var(--asphalt); }
.compose-actions { display: flex; justify-content: flex-end; gap: 10px; padding-top: 14px; border-top: 1px solid var(--rule); flex-wrap: wrap; }

/* ---------- gönderim satırları ---------- */
.camp { padding: 16px 18px; }
.camp-top { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; }
.camp-text { white-space: pre-wrap; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; margin: 0 0 8px; }
.camp-text.empty { color: var(--mute); font-style: italic; }
.camp-meta { display: flex; gap: 14px; flex-wrap: wrap; color: var(--mute); font-size: 14px; }
.camp-meta .tag { display: inline-flex; gap: 6px; align-items: center; }
.status { font-size: 13px; font-weight: 600; padding: 4px 9px; border-radius: 20px; background: var(--paper); white-space: nowrap; }
.status.sent { background: #E3F4EC; color: #1E7650; }
.status.partial, .status.scheduled, .status.queued { background: #FFF2CC; color: #8A5A00; }
.status.sending { background: var(--asphalt); color: var(--line); }
.status.failed { background: #FBE4E4; color: #A12C2C; }
.status.deleted, .status.cancelled { background: var(--paper); color: var(--mute); }
.progress { height: 6px; background: var(--paper); border-radius: 3px; overflow: hidden; margin: 12px 0 10px; display: flex; }
.progress i { display: block; height: 100%; }
.progress .p-ok { background: var(--ok); }
.progress .p-bad { background: var(--bad); }
.progress .p-del { background: var(--mute); }
.camp-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: space-between; }
.camp-actions .left { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.deadline { font-size: 13px; color: var(--mute); }
.deliveries { margin-top: 12px; border-top: 1px solid var(--rule); padding-top: 8px; font-size: 14px; max-height: 320px; overflow: auto; }
.deliveries table { width: 100%; border-collapse: collapse; }
.deliveries td { padding: 7px 4px; border-bottom: 1px solid var(--paper); vertical-align: top; }
.deliveries td:last-child { text-align: right; color: var(--mute); }
.d-ok { color: var(--ok); } .d-bad { color: var(--bad); } .d-mute { color: var(--mute); }

.empty-state { text-align: center; padding: 48px 20px; color: var(--mute); }
.empty-state h3 { color: var(--ink); margin: 0 0 6px; font-size: 18px; }
.empty-state .btn { margin-top: 14px; }

.item-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 18px; }
.item-row .meta { min-width: 0; }
.item-row .meta b { display: block; font-size: 16px; }
.item-row .meta small { color: var(--mute); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 52ch; }

.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; margin-top: 16px; }
.settings-grid .full { grid-column: 1 / -1; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.check { display: flex; gap: 10px; align-items: center; margin: 8px 0 18px; grid-column: 1 / -1; cursor: pointer; }

/* ---------- alıcı seçici ---------- */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(20, 24, 30, .45); z-index: 40; }
.sheet {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 41;
  width: min(480px, 100%); background: var(--white);
  display: flex; flex-direction: column;
  transform: translateX(100%); visibility: hidden;
  transition: transform .22s ease-out, visibility 0s linear .22s;
}
.sheet.open { transform: none; visibility: visible; box-shadow: -10px 0 40px rgba(0,0,0,.15); transition: transform .22s ease-out; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 20px 12px; }
.sheet-head h2 { font: 700 28px/1 var(--font-cond); margin: 0; }
.icon-btn { border: 0; background: var(--paper); width: 36px; height: 36px; border-radius: 50%; cursor: pointer; font-size: 15px; }
.sheet-sub { padding: 0 20px 10px; display: grid; gap: 12px; border-bottom: 1px solid var(--rule); }
.sheet-sub .seg { justify-self: start; }
.list-name-field { margin: 0; }
.list-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.list-chips:empty { display: none; }
.search-row { display: flex; gap: 8px; }
.select-row { display: flex; gap: 16px; font-size: 14px; flex-wrap: wrap; }
.contact-add { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; }
.picker-list { list-style: none; margin: 0; padding: 6px 8px; overflow-y: auto; flex: 1; }
.picker-list li label {
  display: grid; grid-template-columns: 22px 1fr auto; gap: 12px; align-items: center;
  padding: 10px 12px; border-radius: var(--r-sm); cursor: pointer;
}
.picker-list li label:hover { background: var(--paper); }
.picker-list input { width: 18px; height: 18px; accent-color: var(--asphalt); }
.picker-list .nm { font-weight: 500; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picker-list .nm small { display: block; color: var(--mute); font-weight: 400; font-size: 13px; }
.picker-list .sz { color: var(--mute); font-size: 13px; }
.picker-list .warn { color: var(--warn); }
.picker-empty { padding: 32px 16px; text-align: center; color: var(--mute); }
.sheet-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 20px; border-top: 1px solid var(--rule); flex-wrap: wrap; }
.sheet-foot #picker-count { font-weight: 600; }

/* ---------- QR ---------- */
.qr-screen { position: fixed; inset: 0; z-index: 60; background: var(--asphalt); display: grid; grid-template-rows: 1fr auto; }
.qr-card { align-self: center; justify-self: center; width: min(860px, calc(100% - 32px)); background: var(--white); border-radius: var(--r-md); display: grid; grid-template-columns: 1.1fr 1fr; overflow: hidden; }
.qr-text { padding: 36px; }
.qr-text h1 { font: 700 40px/1 var(--font-cond); margin: 0 0 20px; }
.qr-text ol { padding-left: 22px; margin: 0 0 20px; display: grid; gap: 10px; font-size: 17px; }
.qr-box { background: var(--paper); display: grid; place-items: center; align-content: center; gap: 16px; padding: 32px; min-height: 380px; }
.qr-box img { width: 280px; height: 280px; image-rendering: pixelated; background: var(--white); padding: 10px; border-radius: 8px; }
.qr-wait { display: grid; place-items: center; gap: 14px; color: var(--mute); text-align: center; }
.spinner { width: 34px; height: 34px; border: 4px solid var(--rule); border-top-color: var(--asphalt); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

dialog { border: 0; border-radius: var(--r-md); padding: 24px; width: min(440px, calc(100% - 32px)); box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(20, 24, 30, .45); }
dialog h2 { font-size: 20px; }
dialog p { color: var(--mute); margin: 0 0 18px; white-space: pre-line; }
dialog input { margin-bottom: 18px; }

/* ---------- mobil ---------- */
@media (max-width: 860px) {
  .bar { grid-template-columns: auto 1fr auto; padding: 0 12px; gap: 10px; }
  .bar .seg { justify-self: center; }
  .bar .seg button { padding: 8px 12px; }
  .wa-pill span { display: none; }
  .brand .brand-full { display: none; }
  .brand .brand-icon { display: block; }
  .shell { grid-template-columns: 1fr; }
  .side { flex-direction: row; overflow-x: auto; padding: 8px; border-right: 0; border-bottom: 1px solid var(--rule); position: sticky; top: 68px; z-index: 10; }
  .side button { flex: none; padding: 10px 12px; }
  .side button.active { box-shadow: inset 0 -3px 0 var(--line); }
  main { padding: 20px 16px 48px; }
  .loc-grid, .settings-grid { grid-template-columns: 1fr; }
  .qr-card { grid-template-columns: 1fr; }
  .qr-box { min-height: 0; order: -1; }
  .qr-box img { width: 240px; height: 240px; }
  .qr-text { padding: 24px; }
  .contact-add { grid-template-columns: 1fr; }
}

/* ---------- abonelik şeridi ---------- */
.sub-banner { max-width: 860px; margin-bottom: 18px; padding: 12px 16px; border-radius: var(--r-md); background: #FFF6DA; border: 1px solid #F2DC92; font-size: 15px; }
.sub-banner.bad { background: #FBE4E4; border-color: #F0B9B9; }

/* ---------- erişim ekranı ---------- */
.access-card { grid-template-columns: 1.4fr 1fr; }
.access-text { font-size: 17px; margin: 0 0 12px; max-width: 46ch; }
.access-art { gap: 18px; }

/* ---------- hız ön ayarları ---------- */
.presets { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 16px 0 4px; }
.presets button {
  text-align: left; padding: 12px 14px; border-radius: var(--r-sm); border: 1px solid var(--rule); background: var(--white);
  cursor: pointer; font: inherit; display: grid; gap: 2px;
}
.presets button small { color: var(--mute); font-size: 13px; }
.presets button[aria-checked=true] { border-color: var(--asphalt); box-shadow: inset 0 0 0 1px var(--asphalt); background: #FFFBEA; }
.custom-fields { display: contents; }
.custom-fields.off { display: none; }
.pw-form { display: grid; grid-template-columns: 1fr 1fr auto; gap: 12px; align-items: end; margin-top: 16px; }
.pw-form .field { margin: 0; }

/* ---------- temizleme ---------- */
.rule-form { margin-bottom: 16px; }
.rule-form .lbl { display: block; font-weight: 600; font-size: 14px; margin-bottom: 8px; }
.rule-form .field { margin-bottom: 18px; }
.days { display: flex; gap: 6px; flex-wrap: wrap; }
.days .chip { min-width: 52px; padding: 9px 10px; }
.quick-days { margin-top: 8px; font-size: 14px; gap: 14px; }
.time-field input { width: 140px; }
.hours-field input { width: 140px; }
.actions-set { border: 0; padding: 0; margin: 0 0 18px; }
.radio { display: grid; grid-template-columns: 22px 1fr; gap: 10px; padding: 10px 12px; border: 1px solid var(--rule); border-radius: var(--r-sm); margin-bottom: 8px; cursor: pointer; }
.radio:has(input:checked) { border-color: var(--asphalt); background: #FFFBEA; }
.radio input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--asphalt); }
.radio small { display: block; color: var(--mute); font-size: 14px; margin-top: 2px; }
.rule { padding: 16px 18px; }
.rule-top { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.rule-top h3 { margin: 0 0 4px; font-size: 17px; }
.rule-meta { color: var(--mute); font-size: 14px; display: flex; gap: 14px; flex-wrap: wrap; }
.rule-last { font-size: 14px; margin-top: 10px; color: var(--mute); }
.rule-actions { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; align-items: center; }
.switch { position: relative; width: 44px; height: 26px; flex: none; }
.switch input { position: absolute; opacity: 0; inset: 0; cursor: pointer; margin: 0; }
.switch i { position: absolute; inset: 0; border-radius: 13px; background: var(--rule); transition: background .15s; pointer-events: none; }
.switch i::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--white); transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + i { background: var(--ok); }
.switch input:checked + i::after { transform: translateX(18px); }
.switch input:focus-visible + i { outline: 3px solid var(--focus); outline-offset: 2px; }

@media (max-width: 860px) {
  .presets { grid-template-columns: 1fr 1fr; }
  .pw-form { grid-template-columns: 1fr; }
  .access-card { grid-template-columns: 1fr; }
}
.access-art img { width: 120px; height: auto; background: none; padding: 0; image-rendering: auto; }
label.field > span.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0; }
