/* Makdos AI — WhatsApp paneli. Gece modu varsayılan. */

:root {
  --bg: #0b141a;
  --panel: #111b21;
  --panel-2: #202c33;
  --hover: #2a3942;
  --line: #222d34;
  --text: #e9edef;
  --dim: #8696a0;
  --accent: #00a884;
  --accent-2: #005c4b;
  --bubble-in: #202c33;
  --bubble-out: #005c4b;
  --chat-bg: #0b141a;
  --danger: #f15c6d;
  --warn: #e6b800;
}

:root[data-theme="light"] {
  --bg: #eae6df;
  --panel: #ffffff;
  --panel-2: #f0f2f5;
  --hover: #e9edef;
  --line: #e0e0e0;
  --text: #111b21;
  --dim: #667781;
  --accent: #00a884;
  --accent-2: #d9fdd3;
  --bubble-in: #ffffff;
  --bubble-out: #d9fdd3;
  --chat-bg: #efeae2;
  --danger: #d93025;
  --warn: #b58900;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  height: 100vh;
  overflow: hidden;
}

#app { display: grid; grid-template-columns: 380px 1fr; height: 100vh; }

/* ---------------- sol panel ---------------- */

.sidebar {
  background: var(--panel);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.side-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; background: var(--panel-2); gap: 8px;
}

.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand strong { display: block; font-size: 15px; }
.brand small { display: block; color: var(--dim); font-size: 12px; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; max-width: 190px; }
.logo { font-size: 26px; color: var(--accent); line-height: 1; }

.side-actions { display: flex; gap: 2px; flex-shrink: 0; }

.icon {
  background: none; border: 0; color: var(--dim); cursor: pointer;
  font-size: 17px; padding: 7px 9px; border-radius: 50%; line-height: 1;
  transition: background .15s, color .15s;
}
.icon:hover { background: var(--hover); color: var(--text); }

.search-wrap { padding: 8px 12px; }
.search-wrap input {
  width: 100%; padding: 9px 14px; border-radius: 8px; border: 0;
  background: var(--panel-2); color: var(--text); font-size: 14px; outline: none;
}
.search-wrap input::placeholder { color: var(--dim); }

.tabs { display: flex; gap: 6px; padding: 0 12px 8px; }
.tab {
  flex: 1; background: var(--panel-2); border: 0; color: var(--dim);
  padding: 7px 10px; border-radius: 16px; cursor: pointer; font-size: 13px;
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.tab.active { background: var(--accent-2); color: var(--text); }
.badge {
  background: var(--accent); color: #04120d; border-radius: 10px;
  padding: 0 6px; font-size: 11px; font-weight: 700; min-width: 18px; text-align: center;
}

.list { flex: 1; overflow-y: auto; }

.conv {
  display: flex; gap: 12px; padding: 11px 14px; cursor: pointer;
  border-bottom: 1px solid var(--line); align-items: center;
}
.conv:hover { background: var(--hover); }
.conv.sel { background: var(--panel-2); }

.avatar {
  width: 42px; height: 42px; border-radius: 50%; background: var(--accent-2);
  display: grid; place-items: center; font-weight: 700; flex-shrink: 0;
  color: var(--text); font-size: 16px;
}

.conv-main { flex: 1; min-width: 0; }
.conv-top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.conv-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-time { color: var(--dim); font-size: 11px; flex-shrink: 0; }
.conv-prev {
  color: var(--dim); font-size: 13px; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; margin-top: 1px;
}
.conv-unread {
  background: var(--accent); color: #04120d; border-radius: 12px; padding: 1px 7px;
  font-size: 11px; font-weight: 700; flex-shrink: 0;
}

.hit { padding: 10px 14px; border-bottom: 1px solid var(--line); cursor: pointer; }
.hit:hover { background: var(--hover); }
.hit-name { font-size: 12px; color: var(--accent); }
.hit-body { font-size: 13px; color: var(--dim); }
.hit mark { background: var(--accent); color: #04120d; border-radius: 2px; }

.list-empty { padding: 30px 16px; text-align: center; color: var(--dim); font-size: 13px; }
.list-label { padding: 8px 14px 4px; font-size: 11px; color: var(--dim); text-transform: uppercase; letter-spacing: .5px; }

/* ---------------- sağ panel ---------------- */

.chat { display: flex; flex-direction: column; min-width: 0; background: var(--chat-bg); }
.hidden { display: none !important; }

.empty { flex: 1; display: grid; place-items: center; text-align: center; padding: 20px; }
.empty-logo { font-size: 64px; color: var(--accent); display: block; margin-bottom: 8px; }
.empty h2 { margin: 0 0 6px; font-weight: 500; }
.empty p { color: var(--dim); margin: 4px 0; }
.dim { color: var(--dim); font-size: 13px; }

.thread { flex: 1; display: flex; flex-direction: column; min-height: 0; }

.chat-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 16px; background: var(--panel-2); border-bottom: 1px solid var(--line);
}
.peer { display: flex; align-items: center; gap: 12px; }
.peer strong { display: block; }
.peer small { color: var(--dim); font-size: 12px; }
.chat-actions { display: flex; gap: 2px; }

.messages { flex: 1; overflow-y: auto; padding: 18px 8%; display: flex; flex-direction: column; gap: 3px; }

.day { align-self: center; background: var(--panel-2); color: var(--dim);
  font-size: 12px; padding: 4px 12px; border-radius: 8px; margin: 12px 0 6px; }

.msg {
  max-width: 68%; padding: 6px 9px 7px; border-radius: 8px; position: relative;
  word-wrap: break-word; white-space: pre-wrap; font-size: 14.2px;
}
.msg.in  { align-self: flex-start; background: var(--bubble-in); border-top-left-radius: 2px; }
.msg.out { align-self: flex-end;  background: var(--bubble-out); border-top-right-radius: 2px; }
.msg + .msg { margin-top: 2px; }

.msg img { max-width: 100%; border-radius: 6px; display: block; margin-bottom: 4px; cursor: pointer; }
.msg .doc {
  display: flex; align-items: center; gap: 8px; background: rgba(0,0,0,.18);
  padding: 8px 10px; border-radius: 6px; margin-bottom: 4px; text-decoration: none; color: inherit;
}
.msg .meta { font-size: 10.5px; color: var(--dim); float: right; margin: 6px 0 -2px 8px; user-select: none; }
.msg.out .meta { color: rgba(233,237,239,.65); }
:root[data-theme="light"] .msg.out .meta { color: #667781; }
.tick.read { color: #53bdeb; }
.tick.failed { color: var(--danger); }
.msg .err { display: block; color: var(--danger); font-size: 11.5px; margin-top: 3px; }
.msg .tag { font-size: 11px; opacity: .8; display: block; margin-bottom: 2px; }

.composer {
  display: flex; gap: 10px; padding: 10px 16px; background: var(--panel-2);
  align-items: flex-end;
}
.composer textarea {
  flex: 1; resize: none; border: 0; border-radius: 8px; padding: 10px 14px;
  background: var(--panel); color: var(--text); font: inherit; max-height: 140px; outline: none;
}
.composer textarea::placeholder { color: var(--dim); }
.send {
  background: var(--accent); color: #04120d; border: 0; width: 42px; height: 42px;
  border-radius: 50%; cursor: pointer; font-size: 17px; flex-shrink: 0;
}
.send:disabled { opacity: .45; cursor: not-allowed; }

.window-note {
  padding: 6px 16px 9px; font-size: 12px; color: var(--warn);
  background: var(--panel-2); border-top: 1px solid var(--line);
}
.window-note:empty { display: none; }

/* ---------------- modal ---------------- */

.modal { position: fixed; inset: 0; background: rgba(0,0,0,.65); display: grid;
  place-items: center; z-index: 50; padding: 20px; }
.modal-box {
  background: var(--panel); border-radius: 10px; width: 100%; max-width: 460px;
  max-height: 88vh; display: flex; flex-direction: column; overflow: hidden;
}
.modal-box.wide { max-width: 720px; }
.modal-box header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; background: var(--panel-2); border-bottom: 1px solid var(--line);
}
.modal-box h3 { margin: 0; font-size: 16px; font-weight: 600; }
.modal-body { padding: 18px; overflow-y: auto; }
.modal-body label { display: block; margin-bottom: 12px; font-size: 13px; color: var(--dim); }
.modal-body input, .modal-body select, .modal-body textarea {
  width: 100%; margin-top: 5px; padding: 9px 12px; border-radius: 7px; border: 1px solid var(--line);
  background: var(--panel-2); color: var(--text); font: inherit; outline: none;
}
.modal-body input:focus, .modal-body textarea:focus, .modal-body select:focus { border-color: var(--accent); }
.modal-body hr { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }
.modal-body h4 { margin: 0 0 6px; font-size: 14px; }
.modal-body code { background: var(--panel-2); padding: 1px 5px; border-radius: 4px; font-size: 12px; }

.primary {
  background: var(--accent); color: #04120d; border: 0; padding: 10px 18px;
  border-radius: 7px; cursor: pointer; font-weight: 600; font-size: 14px;
}
.primary:hover { filter: brightness(1.08); }

.grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 12px; }
.grid .full { grid-column: 1 / -1; }

.result {
  background: var(--panel-2); padding: 11px; border-radius: 7px; font-size: 11.5px;
  white-space: pre-wrap; word-break: break-all; max-height: 220px; overflow: auto; margin-top: 12px;
}

.tpl {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 8px;
}
.tpl-meta { font-size: 12px; color: var(--dim); margin-top: 2px; }
.pill { font-size: 10.5px; padding: 2px 8px; border-radius: 10px; font-weight: 700; }
.pill.APPROVED { background: var(--accent); color: #04120d; }
.pill.PENDING  { background: var(--warn); color: #241f00; }
.pill.REJECTED { background: var(--danger); color: #fff; }
.tpl-del { background: none; border: 1px solid var(--line); color: var(--danger);
  border-radius: 6px; padding: 5px 10px; cursor: pointer; font-size: 12px; }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--panel-2); color: var(--text); padding: 11px 20px; border-radius: 8px;
  z-index: 100; box-shadow: 0 4px 20px rgba(0,0,0,.45); font-size: 14px; max-width: 80vw;
}
.toast.err { border-left: 3px solid var(--danger); }
.toast.ok  { border-left: 3px solid var(--accent); }

@media (max-width: 820px) {
  #app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  #app.mobile-thread .sidebar { display: none; }
  #app:not(.mobile-thread) .sidebar { display: flex; }
  #app:not(.mobile-thread) .chat { display: none; }
  .messages { padding: 14px 4%; }
  .msg { max-width: 85%; }
}

/* =================== EK BİLEŞENLER =================== */

/* ---- ortak sayfa düzeni (giriş / ayarlar / admin) ---- */

body.centered { display: grid; place-items: center; padding: 20px; overflow: auto; }
body.page { overflow: auto; height: auto; min-height: 100vh; background: var(--bg); }

.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 22px; margin-bottom: 18px;
}
.card h2 { margin: 0 0 6px; font-size: 18px; }
.card h3 { margin: 18px 0 8px; font-size: 15px; }
.card > p.dim { margin-top: 0; }

.login { width: 100%; max-width: 380px; }
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.login-brand strong { display: block; font-size: 17px; }
.login-brand small { color: var(--dim); }
.login label { display: block; margin-bottom: 14px; font-size: 13px; color: var(--dim); }
.login input {
  width: 100%; margin-top: 5px; padding: 11px 13px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--panel-2); color: var(--text);
  font: inherit; outline: none;
}
.login input:focus { border-color: var(--accent); }
.err { color: var(--danger); font-size: 13px; margin: 10px 0 0; }
.tiny { font-size: 11.5px; margin-top: 14px; }
.full { width: 100%; }

.topbar {
  display: flex; align-items: center; gap: 18px; padding: 14px 24px;
  background: var(--panel-2); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10;
}
.topbar h1 { margin: 0; font-size: 17px; font-weight: 600; flex: 1; }
.back-link { color: var(--accent); text-decoration: none; font-size: 14px; }
.back-link:hover { text-decoration: underline; }
.who { color: var(--dim); font-size: 13px; }

.page-body { max-width: 940px; margin: 0 auto; padding: 22px 24px 60px; }

.pills { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.pill-tab {
  background: var(--panel-2); border: 1px solid var(--line); color: var(--dim);
  padding: 8px 16px; border-radius: 20px; cursor: pointer; font-size: 13.5px;
}
.pill-tab.active { background: var(--accent); color: #04120d; border-color: var(--accent); font-weight: 600; }

.card label { display: block; margin-bottom: 14px; font-size: 13px; color: var(--dim); }
.card input, .card select, .card textarea {
  width: 100%; margin-top: 5px; padding: 9px 12px; border-radius: 7px;
  border: 1px solid var(--line); background: var(--panel-2); color: var(--text);
  font: inherit; outline: none;
}
.card textarea { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
.card input:focus, .card select:focus, .card textarea:focus { border-color: var(--accent); }
.card small.dim { display: block; margin-top: 4px; font-size: 11.5px; }
.card hr { border: 0; border-top: 1px solid var(--line); margin: 22px 0; }
.card code { background: var(--panel-2); padding: 1px 5px; border-radius: 4px; font-size: 12px; }

/* Onay kutusu satırlarının stili dosyanın sonunda (tek yerde) tanımlıdır. */
.check.inline small { margin: 0; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.grid2 .full { grid-column: 1 / -1; }
.row { display: flex; gap: 10px; align-items: center; margin-top: 6px; }

fieldset { border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; margin-bottom: 14px; }
legend { color: var(--dim); font-size: 12px; padding: 0 6px; }
.perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 6px 14px; }
.perm-grid label { margin: 0; }

.ghost {
  background: none; border: 1px solid var(--line); color: var(--text);
  padding: 8px 14px; border-radius: 7px; cursor: pointer; font-size: 13.5px;
}
.ghost:hover { background: var(--hover); }
.ghost.danger { color: var(--danger); border-color: var(--danger); }

.item {
  display: flex; justify-content: space-between; align-items: center; gap: 14px;
  padding: 12px 14px; border: 1px solid var(--line); border-radius: 9px; margin-bottom: 8px;
}
.item.off { opacity: .55; }
.item-main { min-width: 0; flex: 1; }
.item-sub { color: var(--dim); font-size: 12px; margin-top: 3px; word-break: break-word; }
.item-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.chip {
  display: inline-block; background: var(--panel-2); color: var(--dim);
  font-size: 11px; padding: 2px 8px; border-radius: 10px; margin-left: 6px;
}
.chip.role-admin { background: var(--accent); color: #04120d; font-weight: 700; }
.chip.role-operator { background: #2d5a8a; color: #fff; }
.chip.off-chip { background: var(--danger); color: #fff; }

.switch { position: relative; display: inline-block; width: 40px; height: 22px; margin: 0; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span {
  position: absolute; inset: 0; background: var(--line); border-radius: 22px;
  cursor: pointer; transition: background .2s;
}
.switch span::before {
  content: ""; position: absolute; height: 16px; width: 16px; left: 3px; top: 3px;
  background: var(--text); border-radius: 50%; transition: transform .2s;
}
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::before { transform: translateX(18px); background: #04120d; }

.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th, .tbl td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl th { color: var(--dim); font-weight: 600; font-size: 12px; }
.tbl .nowrap { white-space: nowrap; }
.tbl .wrap { word-break: break-word; max-width: 340px; }

/* ---- panel: menü, mod rozeti, komut menüsü, bildirim ---- */

.menu {
  position: absolute; top: 56px; right: 12px; z-index: 30;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 9px;
  padding: 6px; min-width: 190px; box-shadow: 0 8px 26px rgba(0,0,0,.5);
}
.menu a, .menu button {
  display: block; width: 100%; text-align: left; background: none; border: 0;
  color: var(--text); padding: 9px 12px; border-radius: 6px; cursor: pointer;
  font-size: 13.5px; text-decoration: none; font-family: inherit;
}
.menu a:hover, .menu button:hover { background: var(--hover); }
.menu .danger { color: var(--danger); }

.sidebar { position: relative; }
.side-foot {
  padding: 8px 14px; border-top: 1px solid var(--line);
  color: var(--dim); font-size: 11.5px; background: var(--panel-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.mode-pill {
  font-size: 10.5px; font-weight: 700; padding: 3px 9px; border-radius: 10px;
  margin-right: 4px; letter-spacing: .3px;
}
.mode-pill.auto { background: var(--accent); color: #04120d; }
.mode-pill.manual { background: #2d5a8a; color: #fff; }
.mini { font-size: 10px; opacity: .8; }

.cmd-pop {
  position: absolute; bottom: 74px; left: 16px; right: 16px; z-index: 20;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px;
  max-height: 260px; overflow-y: auto; box-shadow: 0 -6px 26px rgba(0,0,0,.45);
}
.chat { position: relative; }
.cmd { padding: 9px 14px; cursor: pointer; border-bottom: 1px solid var(--line); }
.cmd:last-child { border-bottom: 0; }
.cmd:hover { background: var(--hover); }
.cmd strong { color: var(--accent); margin-right: 8px; }
.cmd span { font-size: 13px; }
.cmd small { display: block; color: var(--dim); font-size: 11.5px; margin-top: 2px; }

.notif {
  position: fixed; bottom: 22px; left: 22px; z-index: 90; cursor: pointer;
  display: flex; align-items: center; gap: 11px; max-width: 340px;
  background: var(--panel-2); border: 1px solid var(--line); border-left: 3px solid var(--accent);
  border-radius: 10px; padding: 11px 13px; box-shadow: 0 8px 28px rgba(0,0,0,.5);
  animation: slidein .25s ease-out;
}
@keyframes slidein { from { transform: translateX(-16px); opacity: 0; } to { transform: none; opacity: 1; } }
.notif-av {
  width: 36px; height: 36px; border-radius: 50%; background: var(--accent-2);
  display: grid; place-items: center; font-weight: 700; flex-shrink: 0; font-size: 14px;
}
.notif-main { min-width: 0; flex: 1; }
.notif-main strong { display: block; font-size: 13.5px; }
.notif-main span {
  display: block; color: var(--dim); font-size: 12px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ---- mesaj içi medya ---- */

.m-img { max-width: 100%; border-radius: 6px; display: block; margin-bottom: 4px; cursor: zoom-in; }
.m-vid { max-width: 100%; border-radius: 6px; display: block; margin-bottom: 4px; }
.m-aud { width: 240px; max-width: 100%; display: block; margin-bottom: 4px; }

.attach { font-size: 18px; }
.composer .icon { align-self: center; }

.file-prev { text-align: center; margin-bottom: 14px; }
.file-prev img, .file-prev video { max-width: 100%; max-height: 220px; border-radius: 8px; }
.file-prev audio { width: 100%; }
.fp-meta { margin-top: 8px; font-size: 13px; }
.fp-meta strong { display: block; word-break: break-all; }
.fp-meta span { color: var(--dim); font-size: 12px; }

.ai-out {
  background: var(--panel-2); border-radius: 8px; padding: 14px;
  white-space: pre-wrap; font-size: 14px; line-height: 1.6;
  max-height: 340px; overflow-y: auto; margin: 12px 0;
}

.back { display: none; font-size: 24px; }
@media (max-width: 820px) {
  .back { display: block; }
  .grid2, .grid { grid-template-columns: 1fr; }
  .page-body { padding: 16px 14px 50px; }
  .notif { left: 12px; right: 12px; max-width: none; }
}


/* ========================================================================== *
   Yönetim ve form ekranları — okunaklılık düzenlemeleri
   (müşteriler · ürünler · faturalar · destek · ayarlar)
 * ========================================================================== */

/* --- sayfa ritmi --- */
body.page { font-size: 15px; }
.page-body { max-width: 1080px; padding: 26px 24px 72px; display: grid; gap: 18px; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  backdrop-filter: blur(8px);
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  border-bottom: 1px solid var(--line);
  padding: 12px 20px;
}
.topbar h1 { font-size: 18px; letter-spacing: -0.01em; }
.topbar .who { color: var(--dim); font-size: 13px; }
.back-link {
  color: var(--dim); text-decoration: none; font-size: 13.5px;
  padding: 5px 10px; border-radius: 8px; border: 1px solid transparent;
}
.back-link:hover { color: var(--text); background: var(--hover); border-color: var(--line); }

/* --- kartlar --- */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 22px 24px;
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.16);
  margin: 0;
}
.card h2 {
  font-size: 17px; font-weight: 650; letter-spacing: -0.01em;
  margin: 0 0 4px; display: flex; align-items: center; gap: 8px;
}
.card h3 {
  font-size: 14px; font-weight: 650; color: var(--text);
  margin: 26px 0 10px; padding-top: 16px; border-top: 1px solid var(--line);
}
.card h3:first-of-type { border-top: 0; padding-top: 0; }
.card > p.dim { margin: 0 0 16px; max-width: 72ch; line-height: 1.6; }

/* --- sekmeler --- */
.pills { display: flex; gap: 8px; flex-wrap: wrap; margin: 0; }
.pill-tab {
  padding: 8px 16px; border-radius: 999px; font-size: 13.5px;
  border: 1px solid var(--line); background: var(--panel);
  color: var(--dim); text-decoration: none; cursor: pointer;
  transition: background .12s, color .12s, border-color .12s;
}
.pill-tab:hover { background: var(--hover); color: var(--text); }
.pill-tab.active {
  background: var(--accent); border-color: var(--accent);
  color: #04120d; font-weight: 650;
}

/* --- satırlar (liste öğeleri) --- */
.row {
  display: flex; gap: 14px; align-items: flex-start; justify-content: space-between;
  padding: 14px 16px; margin: 0 0 8px;
  background: var(--panel-2); border: 1px solid transparent; border-radius: 10px;
  transition: border-color .12s, background .12s;
}
.row:hover { border-color: var(--line); }
.row > div:first-child { min-width: 0; flex: 1; }
.row strong { font-weight: 620; }
.row .dim { font-size: 12.5px; line-height: 1.7; margin-top: 3px; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; flex-shrink: 0; }

/* --- düğmeler --- */
.btn {
  padding: 7px 14px; border-radius: 9px; font-size: 13.5px; font-weight: 550;
  border: 1px solid var(--line); background: var(--panel);
  color: var(--text); cursor: pointer; white-space: nowrap;
  transition: background .12s, border-color .12s, transform .06s;
}
.btn:hover { background: var(--hover); border-color: var(--dim); }
.btn:active { transform: translateY(1px); }
.btn.primary {
  background: var(--accent); border-color: var(--accent);
  color: #04120d; font-weight: 650;
}
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, transparent); }
.btn.danger:hover { background: color-mix(in srgb, var(--danger) 14%, transparent); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* --- formlar --- */
.card label:not(.check) {
  display: block; margin-bottom: 16px; font-size: 12.5px;
  color: var(--dim); font-weight: 550; letter-spacing: .01em;
}
/* Onay kutuları ve radyolar hariç: metin alanları tam genişlikte. */
.card input:not([type="checkbox"]):not([type="radio"]),
.card select,
.card textarea {
  display: block; width: 100%; margin-top: 6px;
  padding: 9px 12px; border-radius: 9px;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--line); font: inherit; font-size: 14px;
  transition: border-color .12s, box-shadow .12s;
}
.card input:focus, .card select:focus, .card textarea:focus {
  outline: 0; border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}
.card input::placeholder, .card textarea::placeholder { color: color-mix(in srgb, var(--dim) 75%, transparent); }
.card textarea { font-family: inherit; line-height: 1.6; resize: vertical; }

.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 0 20px; }
.grid2 label.wide, .grid2 .full { grid-column: 1 / -1; }
.form-actions {
  grid-column: 1 / -1; display: flex; gap: 12px; align-items: center;
  flex-wrap: wrap; margin-top: 4px;
}
.form-actions input { width: auto; min-width: 260px; margin-top: 0; }
.form-actions .dim { font-size: 13px; }

/* --- rozetler --- */
.chip {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600; letter-spacing: .01em;
  background: var(--hover); color: var(--dim); vertical-align: middle;
  margin-left: 6px;
}
.chip.status-active    { background: color-mix(in srgb, var(--accent) 22%, transparent); color: var(--accent); }
.chip.status-pending   { background: color-mix(in srgb, var(--warn) 22%, transparent);   color: var(--warn); }
.chip.status-suspended { background: color-mix(in srgb, var(--danger) 18%, transparent); color: var(--danger); }
.chip.status-archived  { background: var(--hover); color: var(--dim); }

/* --- anahtar-değer tabloları --- */
table.kv {
  width: 100%; border-collapse: separate; border-spacing: 0;
  margin: 4px 0 18px; font-size: 13.5px;
  border: 1px solid var(--line); border-radius: 10px; overflow: hidden;
}
table.kv td { padding: 9px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.kv tr:last-child td { border-bottom: 0; }
table.kv tr:nth-child(odd) td { background: color-mix(in srgb, var(--panel-2) 55%, transparent); }
table.kv td:first-child { width: 210px; color: var(--dim); white-space: nowrap; font-weight: 550; }
table.kv code { word-break: break-all; }

.card code {
  background: var(--panel-2); padding: 2px 6px; border-radius: 5px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px;
}

/* --- bilgi kutusu --- */
.notice {
  padding: 14px 16px; border-radius: 10px; line-height: 1.7; margin-top: 14px;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
}
.notice code { background: var(--bg); }

/* --- dar ekran --- */
@media (max-width: 720px) {
  .page-body { padding: 16px 14px 56px; }
  .card { padding: 18px 16px; border-radius: 12px; }
  .row { flex-direction: column; align-items: stretch; }
  .row-actions { justify-content: flex-start; }
  table.kv td:first-child { width: 130px; white-space: normal; }
  .form-actions input { min-width: 0; width: 100%; }
}

/* ---------------- ekran kilidi ---------------- */

body.locked { overflow: hidden; }

/* Kilitlendiğinde gövde tamamen boşaltılır; bu ekran tek içeriktir. */
body.lock-body { overflow: hidden; background: var(--bg); }
.lock-screen {
  position: fixed; inset: 0; z-index: 9999;
  display: grid; place-items: center;
  background: var(--bg);
  animation: lock-in .18s ease-out;
}
@keyframes lock-in { from { opacity: 0; } to { opacity: 1; } }

.lock-box {
  width: min(380px, 92vw);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 32px 28px 24px;
  text-align: center;
  box-shadow: 0 24px 60px rgb(0 0 0 / 0.45);
}
.lock-icon { font-size: 34px; line-height: 1; margin-bottom: 10px; }
.lock-box h2 { margin: 0 0 6px; font-size: 19px; }
.lock-box p.dim { margin: 0 0 18px; font-size: 13.5px; line-height: 1.6; }
.lock-box input {
  width: 100%; padding: 11px 14px; margin-bottom: 12px;
  border-radius: 10px; border: 1px solid var(--line);
  background: var(--bg); color: var(--text); font: inherit; font-size: 15px;
}
.lock-box input:focus {
  outline: 0; border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}
.lock-box .btn.primary { width: 100%; padding: 10px; font-size: 14.5px; }
.lock-err { color: var(--danger); font-size: 13px; margin: 10px 0 0; }
.lock-err.hidden { display: none; }
.lock-logout {
  margin-top: 16px; background: none; border: 0; color: var(--dim);
  font-size: 12.5px; text-decoration: underline; padding: 4px;
}
.lock-logout:hover { color: var(--text); background: none; }


/* ---------------- mesaj kutusu: hızlı şablon seçici ---------------- */

.window-bar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 8px 16px 10px; border-top: 1px solid var(--line);
  background: var(--panel);
}
.window-bar .window-note { flex: 1; min-width: 200px; margin: 0; padding: 0; border: 0; }

.quick-tpl { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.quick-tpl select {
  padding: 6px 10px; border-radius: 8px; font: inherit; font-size: 13px;
  background: var(--panel-2); color: var(--text); border: 1px solid var(--line);
  max-width: 230px;
}
.quick-tpl select:focus { outline: 0; border-color: var(--accent); }
.quick-tpl input {
  padding: 6px 10px; border-radius: 8px; font: inherit; font-size: 13px; width: 130px;
  background: var(--bg); color: var(--text); border: 1px solid var(--line);
}
.quick-tpl input:focus { outline: 0; border-color: var(--accent); }
.quick-tpl .btn { padding: 6px 12px; font-size: 13px; }
.quick-tpl-params { display: flex; gap: 6px; flex-wrap: wrap; }
.quick-tpl.hidden { display: none; }

@media (max-width: 720px) {
  .quick-tpl select { max-width: 150px; }
  .quick-tpl input { width: 96px; }
}


/* ---------------- onay kutusu satırları (ayarlar, admin) ---------------- */
/* Not: bilinçli olarak dosyanın sonunda — yukarıdaki genel form kuralları
   onay kutularını ezmesin diye. Yapı: <label class="check"><input> Metin <small>…</small></label>
   Metin anonim bir düğüm olduğu için esnek kutu (flex) kullanılır; grid'de
   anonim öğe hedeflenemez. */

.card label.check {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 10px;
  margin: 0 0 10px;
  padding: 13px 16px;
  background: var(--panel-2);
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--text);
  font-size: 14px;
  font-weight: 550;
  line-height: 1.4;
  cursor: pointer;
  transition: border-color .12s, background .12s;
}
.card label.check:hover { border-color: var(--line); }
.card label.check:has(input:checked) {
  border-color: color-mix(in srgb, var(--accent) 40%, transparent);
  background: color-mix(in srgb, var(--accent) 8%, var(--panel-2));
}

.card label.check input[type="checkbox"] {
  flex: 0 0 auto;
  width: 18px; height: 18px; margin: 0; padding: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

/* Açıklama satırı: kendi satırına iner, kutunun hizasında başlar. */
.card label.check small {
  flex: 1 0 100%;
  margin: 2px 0 0; padding-left: 28px;
  color: var(--dim); font-size: 12.5px; font-weight: 400; line-height: 1.6;
}


/* ---------------- şablon araç çubuğu ve sayfalama ---------------- */

.tpl-toolbar {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  margin: 0 0 16px; padding-bottom: 14px; border-bottom: 1px solid var(--line);
}
.tpl-toolbar input[type="search"] { flex: 1 1 220px; min-width: 180px; margin: 0; }
.tpl-toolbar select { width: auto; min-width: 150px; margin: 0; }
.tpl-toolbar .btn { flex-shrink: 0; }
.tpl-toolbar .dim { margin-left: auto; font-size: 12.5px; }

.pager { display: flex; gap: 12px; align-items: center; justify-content: center; margin-top: 14px; }
.pager .dim { font-size: 13px; }


/* ---------------- şablon önizlemesi (mesaj kutusu) ---------------- */

.tpl-preview { flex: 1 0 100%; margin-top: 6px; }
.tpl-preview.hidden { display: none; }

.tpl-preview-bubble {
  max-width: 560px; padding: 10px 13px; border-radius: 10px;
  background: var(--bubble-out); border: 1px solid var(--line);
  font-size: 13.5px; line-height: 1.55;
}
.tpl-preview-bubble .tpl-h { font-weight: 700; margin-bottom: 4px; }
.tpl-preview-bubble .tpl-f { margin-top: 6px; color: var(--dim); font-size: 12px; }
.tpl-preview-bubble .tpl-btns {
  display: flex; gap: 6px; flex-wrap: wrap;
  margin-top: 8px; padding-top: 8px; border-top: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}
.tpl-preview-bubble .tpl-btns span {
  padding: 3px 10px; border-radius: 999px; font-size: 12px;
  background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent);
}
.tpl-preview-bubble .tpl-ph { color: var(--dim); font-style: italic; }
.tpl-preview-bubble b { font-weight: 700; }


/* ---------------- gelişmiş alanlar (details) ---------------- */

.card details {
  margin: 4px 0 16px; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2);
}
.card details summary {
  cursor: pointer; font-size: 13px; font-weight: 600; color: var(--dim);
  list-style: none; user-select: none;
}
.card details summary::before { content: "▸ "; }
.card details[open] summary::before { content: "▾ "; }
.card details summary:hover { color: var(--text); }
.card details > .grid2 { margin-top: 14px; }


.notice.warn {
  background: color-mix(in srgb, var(--warn) 12%, transparent);
  border-color: color-mix(in srgb, var(--warn) 45%, transparent);
}
.notice ul { margin: 8px 0 0; padding-left: 20px; }
.notice li { margin-bottom: 4px; }


/* ---------------- adım adım form (WhatsApp bağlantısı) ---------------- */

.steps { display: grid; gap: 14px; }

.step {
  display: grid; grid-template-columns: 34px 1fr; gap: 14px;
  padding: 16px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--panel-2);
}
.step-no {
  width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--accent); color: #04120d; font-weight: 700; font-size: 14px;
}
.step-body label { margin-bottom: 0 !important; }
.step-body small.dim { display: block; margin-top: 6px; line-height: 1.55; }
.step-actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 12px; }
.step-actions .dim { font-size: 13px; }
.submit-row { margin-top: 2px; }

/* Bulunan numaralar — seçilebilir kartlar */
#wa-numbers:not(:empty) { margin-top: 12px; display: grid; gap: 8px; }

/* Gelişmiş bölüm tam genişlikte ve iki sütun */
.card details { grid-column: 1 / -1; }
.adv-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0 18px; margin-top: 14px;
}

/* .wide yalnız label'da değil her öğede çalışsın */
.grid2 > .wide { grid-column: 1 / -1; }

@media (max-width: 640px) {
  .step { grid-template-columns: 1fr; }
  .step-no { display: none; }
}
