/* Asistmodu paneli */
:root {
  --paper: #f3f1ec;
  --paper-2: #ebe8e1;
  --card: #fffefb;
  --ink: #141614;
  --ink-2: #4a4f4a;
  --ink-3: #868b85;
  --line: #dcd8cf;
  --em: #0e8f63;
  --em-deep: #0a6b4a;
  --em-soft: #dcefe5;
  --amber: #b7791f;
  --amber-soft: #f6ead3;
  --red: #b4372e;
  --side: #111311;
  --r: 7px;
  --head: 'Bricolage Grotesque', 'Instrument Sans', system-ui, sans-serif;
  --body: 'Instrument Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 15px/1.5 var(--body); color: var(--ink); background: var(--paper); -webkit-font-smoothing: antialiased; }
a { color: var(--em-deep); }
h1, h2 { font-family: var(--head); font-weight: 700; letter-spacing: -0.02em; margin: 0; }
h1 { font-size: 28px; line-height: 1.15; }
h2 { font-size: 18px; }
.muted { color: var(--ink-3); }
.center { text-align: center; }
.hint { font-size: 13px; color: var(--ink-3); margin: 0; }
code { font-family: var(--mono); font-size: 13px; background: var(--paper-2); padding: 2px 6px; border-radius: 4px; word-break: break-all; }
.logo { width: 30px; height: 30px; color: var(--em); flex: none; }

/* ---------- Form öğeleri ---------- */
label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
label small { font-weight: 400; color: var(--ink-3); }
input, select, textarea {
  font: 15px/1.4 var(--body); color: var(--ink); background: var(--card);
  border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px; width: 100%;
  transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--em); box-shadow: 0 0 0 3px var(--em-soft); }
.btn {
  font: 600 14px/1 var(--body); display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 16px; border-radius: var(--r); border: 1px solid var(--line); background: var(--card); color: var(--ink);
  cursor: pointer; text-decoration: none; transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { border-color: var(--ink-3); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.primary:hover { background: var(--em-deep); border-color: var(--em-deep); }
.btn.danger { color: var(--red); }
.btn.small { padding: 7px 11px; font-size: 13px; }
.btn.full { width: 100%; }
.btn:disabled { opacity: .5; cursor: default; }
.linkish { background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.linkish.danger { color: var(--red); }

.switch { flex-direction: row; align-items: center; gap: 10px; cursor: pointer; font-size: 14px; color: var(--ink); }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch span { width: 38px; height: 22px; border-radius: 11px; background: var(--line); position: relative; transition: background .2s; flex: none; }
.switch span::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + span { background: var(--em); }
.switch input:checked + span::after { transform: translateX(16px); }
.switch input:focus-visible + span { box-shadow: 0 0 0 3px var(--em-soft); }
.switch.small { font-size: 13px; font-weight: 600; }

.flash { padding: 11px 14px; border-radius: var(--r); margin-bottom: 18px; font-size: 14px; border-left: 3px solid var(--em); background: var(--em-soft); }
.flash-err { border-color: var(--red); background: #f6e2df; }

.pill { display: inline-block; font: 500 11px/1 var(--mono); text-transform: uppercase; letter-spacing: .04em; padding: 5px 8px; border-radius: 4px; background: var(--paper-2); color: var(--ink-2); vertical-align: middle; }
.pill.ok { background: var(--em-soft); color: var(--em-deep); }
.pill.wait { background: var(--amber-soft); color: var(--amber); }

/* ---------- Giriş / kayıt ---------- */
.portal-tag { font: 500 10px/1 var(--mono); font-style: normal; text-transform: uppercase; letter-spacing: .1em; color: var(--em); border: 1px solid currentColor; padding: 4px 6px; border-radius: 4px; margin-left: 2px; }
.portal-mark { display: flex; flex-direction: column; gap: 10px; max-width: 360px; border-left: 2px solid var(--em); padding-left: 18px; }
.portal-mark b { font: 700 34px/1.05 var(--head); color: #fff; letter-spacing: -0.02em; }
.portal-mark span { color: #9aa09a; }
body.portal .auth-art::before { border-color: rgba(14,143,99,.18); }
body.auth { display: grid; grid-template-columns: minmax(320px, 46%) 1fr; min-height: 100vh; }
.auth-art { background: var(--side); color: #e9ebe8; padding: 40px 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-art::before { content: ''; position: absolute; inset: auto -120px -160px auto; width: 420px; height: 420px; border-radius: 50%; border: 1px solid rgba(255,255,255,.07); box-shadow: 0 0 0 60px rgba(255,255,255,.02), 0 0 0 120px rgba(255,255,255,.015); }
.brand { display: inline-flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; font: 700 19px/1 var(--head); letter-spacing: -0.02em; }
.brand.big { font-size: 22px; }
.brand.big .logo { width: 36px; height: 36px; }
.auth-quote { display: flex; flex-direction: column; gap: 10px; max-width: 360px; }
.auth-quote p { margin: 0; padding: 11px 14px; border-radius: 14px; font-size: 15px; width: fit-content; max-width: 90%; }
.q-in { background: #262a26; border-bottom-left-radius: 4px; }
.q-out { background: var(--em); color: #fff; align-self: flex-end; border-bottom-right-radius: 4px; }
.q-dots { background: #262a26; display: flex; gap: 5px; border-bottom-left-radius: 4px; }
.q-dots i, .dots i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .35; animation: blink 1.2s infinite; }
.q-dots i:nth-child(2), .dots i:nth-child(2) { animation-delay: .2s; }
.q-dots i:nth-child(3), .dots i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 60%, 100% { opacity: .3; } 30% { opacity: 1; } }
.auth-foot { margin: 0; color: #9aa09a; font-size: 14px; max-width: 320px; }
.auth-form { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.card-form { width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 16px; }
.card-form h1 { margin-bottom: 4px; }
.card-form p { margin: 0; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* ---------- Uygulama iskeleti ---------- */
body.app { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.side { background: var(--side); color: #c9cdc8; display: flex; flex-direction: column; padding: 22px 14px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side .brand { color: #fff; padding: 0 8px 20px; justify-content: flex-start; }
.side .brand:hover { background: none; }
.firm-chip { margin: 0 4px 18px; padding: 10px 12px; border: 1px solid #2a2e2a; border-radius: var(--r); }
.firm-chip small { display: block; font: 500 10px/1.4 var(--mono); text-transform: uppercase; letter-spacing: .06em; color: #7d837c; }
.firm-chip b { color: #fff; font-weight: 600; font-size: 14px; }
.nav-group { display: flex; flex-direction: column; margin-bottom: 18px; }
.nav-label { font: 500 10px/1 var(--mono); text-transform: uppercase; letter-spacing: .08em; color: #6b716a; padding: 0 10px 8px; }
.side a { color: #c9cdc8; text-decoration: none; padding: 8px 10px; border-radius: 6px; font-size: 14px; display: flex; justify-content: space-between; align-items: center; }
.side a:hover { background: #1c1f1c; color: #fff; }
.side a.on { background: #1f2420; color: #fff; box-shadow: inset 2px 0 0 var(--em); }
.badge { background: var(--em); color: #fff; font: 600 11px/1 var(--mono); padding: 3px 6px; border-radius: 9px; }
.badge:empty { display: none; }
.side-foot { margin-top: auto; border-top: 1px solid #252925; padding-top: 12px; display: flex; flex-direction: column; gap: 2px; }
.side-foot form { padding: 6px 10px; font-size: 13px; color: #7d837c; }

.main { padding: 32px 40px 60px; max-width: 1180px; width: 100%; }
.main.wide { max-width: none; padding: 0; }
.viewbar { background: var(--amber-soft); color: #6b4a12; padding: 9px 16px; font-size: 13px; display: flex; gap: 10px; align-items: center; }
.viewbar b { font-weight: 600; }
.viewbar form { margin-left: auto; }
.main:not(.wide) .viewbar { margin: -32px -40px 24px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin-bottom: 26px; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.page-head p { margin: 6px 0 0; max-width: 620px; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 22px; }
.panel.flush { padding: 0; overflow-x: auto; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.narrow { max-width: 680px; }
fieldset { margin: 0; }
legend { font: 700 16px/1 var(--head); padding: 0 6px; margin-left: -6px; display: flex; gap: 10px; align-items: center; }
form.stack > fieldset + fieldset { margin-top: 0; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; }
.two-col { display: grid; grid-template-columns: 1fr 360px; gap: 24px; align-items: start; }
.sticky { position: sticky; top: 24px; }
.empty-box { border: 1px dashed var(--line); border-radius: 10px; padding: 32px; text-align: center; }
.empty-box p { margin: 4px 0; }
.info-box { margin-bottom: 18px; background: var(--paper-2); border-style: dashed; }
.info-box p { margin: 0 0 10px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; margin: 0; font-size: 14px; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; }

/* Bilgi bankası */
.kb-item { background: var(--card); border: 1px solid var(--line); border-radius: 10px; margin-bottom: 10px; }
.kb-item summary { cursor: pointer; padding: 14px 18px; list-style: none; display: flex; flex-direction: column; gap: 2px; }
.kb-item summary::-webkit-details-marker { display: none; }
.kb-item summary span { font-weight: 600; }
.kb-item summary small { color: var(--ink-3); }
.kb-item[open] summary { border-bottom: 1px solid var(--line); }
.kb-item form { padding: 18px; }

/* Tablo */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font: 500 11px/1 var(--mono); text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); padding: 14px 16px; border-bottom: 1px solid var(--line); }
.table td { padding: 13px 16px; border-bottom: 1px solid var(--paper-2); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-family: var(--mono); font-size: 13px; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.st-bekliyor td:first-child { box-shadow: inset 3px 0 0 var(--amber); }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; margin-bottom: 20px; }
.stats div { background: var(--card); padding: 18px 20px; display: flex; flex-direction: column; }
.stats b { font: 700 30px/1 var(--head); }
.stats span { color: var(--ink-3); font-size: 13px; margin-top: 6px; }
.inline-add { display: flex; gap: 8px; }
.inline-add input { width: 220px; }

/* ---------- Gelen kutusu ---------- */
.inbox { display: grid; grid-template-columns: 360px 1fr; height: 100vh; }
.viewbar + .inbox, .flash + .inbox { height: calc(100vh - 40px); }
.conv-col { border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; background: var(--paper); }
.conv-head { padding: 24px 18px 12px; display: flex; flex-direction: column; gap: 12px; border-bottom: 1px solid var(--line); }
.conv-head h1 { font-size: 24px; }
.filters { display: flex; gap: 4px; flex-wrap: wrap; }
.filters button { font: 500 12px/1 var(--body); padding: 7px 10px; border-radius: 6px; border: 1px solid var(--line); background: transparent; cursor: pointer; color: var(--ink-2); }
.filters button.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.conv-head input { padding: 8px 11px; font-size: 14px; }
.conv-list { list-style: none; margin: 0; padding: 6px; overflow-y: auto; flex: 1; }
.conv-list .empty { padding: 30px 18px; color: var(--ink-3); font-size: 14px; text-align: center; }
.conv { width: 100%; display: flex; gap: 12px; align-items: flex-start; text-align: left; padding: 11px 10px; border: 0; background: transparent; border-radius: 8px; cursor: pointer; font: inherit; color: inherit; }
.conv:hover { background: var(--paper-2); }
.conv.on { background: var(--card); box-shadow: 0 0 0 1px var(--line); }
.ava { width: 40px; height: 40px; border-radius: 50%; background: var(--paper-2); display: grid; place-items: center; font: 600 13px/1 var(--body); color: var(--ink-2); position: relative; flex: none; border: 1px solid var(--line); }
.ch { position: absolute; right: -5px; bottom: -3px; font: 500 8px/1 var(--mono); font-style: normal; padding: 3px 3px; border-radius: 3px; color: #fff; background: var(--ink); }
.ch-whatsapp { background: #1f8f4e; }
.ch-instagram { background: #b5367a; }
.ch-messenger { background: #2f5fd0; }
.conv-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.conv-top { display: flex; justify-content: space-between; gap: 8px; }
.conv-top b { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-top time { font: 500 11px/1.8 var(--mono); color: var(--ink-3); flex: none; }
.conv-prev { font-size: 13px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv.unread .conv-top b, .conv.unread .conv-prev { color: var(--ink); }
.tag-human { font-style: normal; color: var(--amber); font-weight: 600; margin-right: 6px; }
.count { background: var(--em); color: #fff; font: 600 11px/1 var(--mono); border-radius: 9px; padding: 4px 6px; align-self: center; }

.thread { display: flex; flex-direction: column; min-height: 0; background: var(--card); }
.thread-empty { margin: auto; text-align: center; color: var(--ink-3); }
.thread-empty .logo { width: 44px; height: 44px; opacity: .25; color: var(--ink); }
.warn-text { color: var(--amber); }
.thread-head { display: flex; align-items: center; gap: 14px; padding: 16px 22px; border-bottom: 1px solid var(--line); }
.thread-head > div:first-of-type { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.thread-head small { color: var(--ink-3); font-size: 12px; font-family: var(--mono); }
.thread-actions { display: flex; gap: 14px; align-items: center; flex: none; }
.back { display: none; border: 0; background: none; font-size: 20px; cursor: pointer; padding: 0 4px; }
.bubbles { flex: 1; overflow-y: auto; padding: 24px 22px; display: flex; flex-direction: column; gap: 8px; background:
  radial-gradient(circle at 1px 1px, rgba(20,22,20,.05) 1px, transparent 0) 0 0 / 18px 18px, var(--paper); }
.msg { max-width: min(560px, 78%); display: flex; flex-direction: column; }
.msg p { margin: 0; padding: 10px 13px; border-radius: 14px; font-size: 14.5px; line-height: 1.45; overflow-wrap: anywhere; }
.msg.in { align-self: flex-start; }
.msg.in p { background: var(--card); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.msg.out { align-self: flex-end; align-items: flex-end; }
.msg.out.asistan p { background: var(--em-soft); color: #0b3f2d; border-bottom-right-radius: 4px; }
.msg.out.personel p { background: var(--ink); color: #fff; border-bottom-right-radius: 4px; }
.msg .who { font: 500 10px/1 var(--mono); text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); margin: 6px 4px 4px; }
.msg .meta { font: 500 10.5px/1 var(--mono); color: var(--ink-3); margin: 4px 4px 0; }
.msg.failed p { opacity: .55; }
.msg.failed .meta b { color: var(--red); }
.msg.note { align-self: center; max-width: 90%; }
.msg.note p { background: var(--amber-soft); color: #6b4a12; font-size: 13px; text-align: center; }
.dots { display: flex; gap: 5px; color: var(--em-deep); padding: 14px 16px !important; }
.ai-off { margin: 0; padding: 8px 22px; font-size: 13px; color: var(--amber); background: var(--amber-soft); }
.composer { display: flex; gap: 10px; align-items: flex-end; padding: 14px 22px 18px; border-top: 1px solid var(--line); background: var(--card); }
.composer textarea { resize: none; min-height: 44px; max-height: 160px; }

/* Deneme */
.tester { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; display: flex; flex-direction: column; height: calc(100vh - 220px); min-height: 420px; max-width: 760px; }
.tester .bubbles { background: radial-gradient(circle at 1px 1px, rgba(20,22,20,.05) 1px, transparent 0) 0 0 / 18px 18px, var(--paper); }

/* ---------- Mobil ---------- */
@media (max-width: 900px) {
  body.app { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 10px 12px; gap: 6px; }
  .side .brand { padding: 0 8px 0 4px; }
  .firm-chip, .nav-label { display: none; }
  .side nav { display: flex; overflow-x: auto; gap: 2px; width: 100%; order: 3; }
  .nav-group { flex-direction: row; margin: 0; }
  .side a { white-space: nowrap; font-size: 13px; }
  .side-foot { margin: 0 0 0 auto; border: 0; padding: 0; flex-direction: row; align-items: center; }
  .side-foot a { display: none; }
  .main { padding: 22px 16px 40px; }
  .main:not(.wide) .viewbar { margin: -22px -16px 18px; }
  .two-col, .row2 { grid-template-columns: 1fr; }
  .sticky { position: static; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .page-head { flex-direction: column; align-items: flex-start; }
  .inbox { grid-template-columns: 1fr; height: calc(100vh - 96px); }
  .inbox .thread { display: none; }
  .inbox.has-thread .conv-col { display: none; }
  .inbox.has-thread .thread { display: flex; }
  .back { display: block; }
  .thread-head { padding: 12px 14px; }
  .bubbles { padding: 16px 12px; }
  .composer { padding: 10px 12px 14px; }
  .msg { max-width: 88%; }
  body.auth { grid-template-columns: 1fr; }
  .auth-art { padding: 24px; min-height: auto; gap: 24px; }
  .auth-quote, .auth-foot { display: none; }
  .table { min-width: 720px; }
}
