/* Assistalent yönetim paneli */
:root {
  --bg: #f5f7f7;
  --surface: #ffffff;
  --ink: #17252a;
  --muted: #5f6f74;
  --line: #e3e9ea;
  --brand: #0f766e;
  --brand-ink: #ffffff;
  --brand-soft: #e6f4f2;
  --ok: #15803d;
  --ok-soft: #e8f6ec;
  --warn: #b45309;
  --warn-soft: #fdf3e5;
  --bad: #b91c1c;
  --bad-soft: #fdecec;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 40, 45, .06), 0 4px 16px rgba(16, 40, 45, .05);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 24px; margin: 0 0 4px; letter-spacing: -.01em; }
h2 { font-size: 18px; margin: 0 0 12px; }
h3 { font-size: 15px; margin: 0 0 8px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* üst çubuk */
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.topbar .inner { max-width: 1240px; margin: 0 auto; padding: 12px 20px; display: flex; align-items: center; gap: 20px; }
.logo { font-weight: 700; font-size: 18px; color: var(--ink); display: flex; align-items: center; gap: 8px; }
.logo span { width: 28px; height: 28px; border-radius: 8px; background: var(--brand); color: #fff; display: grid; place-items: center; font-size: 15px; }
.topbar nav { display: flex; gap: 16px; margin-left: auto; align-items: center; font-size: 14px; }
.topbar nav .who { color: var(--muted); }

main { max-width: 1240px; margin: 0 auto; padding: 24px 20px 64px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }

/* kartlar */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 20px; }
.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.stat .n { font-size: 28px; font-weight: 700; letter-spacing: -.02em; }
.stat .l { color: var(--muted); font-size: 13px; }
.stat.accent { background: var(--brand); color: #fff; border-color: var(--brand); }
.stat.accent .l { color: #d8f0ec; }

/* formlar */
label { display: block; font-size: 13px; font-weight: 600; margin: 0 0 4px; color: #33464b; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=number], input[type=search],
select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid #cfd9db; border-radius: 8px; font: inherit; background: #fff; color: var(--ink);
}
textarea { min-height: 110px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid #99d5cc; border-color: var(--brand); }
.field { margin-bottom: 14px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.row > .field { flex: 1 1 200px; margin-bottom: 0; }
.hint { font-size: 12px; color: var(--muted); margin-top: 4px; }

.btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 16px; border-radius: 8px; border: 1px solid transparent;
  background: var(--brand); color: var(--brand-ink); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { filter: brightness(1.06); text-decoration: none; }
.btn.secondary { background: #fff; color: var(--ink); border-color: #cfd9db; }
.btn.danger { background: var(--bad); }
.btn.ghost { background: transparent; color: var(--brand); padding: 6px 8px; }
.btn.sm { padding: 5px 10px; font-size: 13px; }

/* bildirim */
.flash { padding: 12px 16px; border-radius: 10px; margin-bottom: 18px; font-weight: 500; }
.flash.ok { background: var(--ok-soft); color: var(--ok); }
.flash.error { background: var(--bad-soft); color: var(--bad); }

/* sekmeler */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; }
.tabs a { padding: 10px 14px; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; font-weight: 500; }
.tabs a:hover { color: var(--ink); text-decoration: none; }
.tabs a.active { color: var(--brand); border-color: var(--brand); }
.seg { display: inline-flex; background: #e9eff0; border-radius: 10px; padding: 4px; gap: 4px; margin-bottom: 16px; flex-wrap: wrap; }
.seg a { padding: 8px 14px; border-radius: 8px; color: var(--muted); font-weight: 600; }
.seg a.active { background: #fff; color: var(--ink); box-shadow: var(--shadow); }
.seg a:hover { text-decoration: none; color: var(--ink); }
.seg .count { background: var(--brand-soft); color: var(--brand); border-radius: 10px; padding: 1px 8px; font-size: 12px; margin-left: 6px; }

/* tablolar */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); background: #fafcfc; font-weight: 600; }
th, td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
td .sub { color: var(--muted); font-size: 12.5px; }
.empty { padding: 36px; text-align: center; color: var(--muted); }

.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: #eef2f3; color: #455a5f; white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.brand { background: var(--brand-soft); color: var(--brand); }

details.inline > summary { list-style: none; cursor: pointer; color: var(--brand); font-size: 13px; font-weight: 600; }
details.inline > summary::-webkit-details-marker { display: none; }
details.inline[open] > summary { margin-bottom: 8px; }
details.inline form { min-width: 240px; }
details.inline textarea { min-height: 70px; }

.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 14px; }
.filters .field { margin: 0; flex: 0 1 170px; }
.filters .field.grow { flex: 1 1 220px; }
.dropdown { position: relative; }
.dropdown > summary { list-style: none; }
.dropdown > summary::-webkit-details-marker { display: none; }
.dropdown .menu { position: absolute; right: 0; top: calc(100% + 6px); background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); padding: 6px; z-index: 5; min-width: 170px; }
.dropdown .menu a { display: block; padding: 8px 10px; border-radius: 6px; color: var(--ink); }
.dropdown .menu a:hover { background: var(--brand-soft); text-decoration: none; }

/* kanal kartları */
.channel { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; }
.channel + .channel { border-top: 1px solid var(--line); padding-top: 18px; margin-top: 18px; }
.channel.disabled { opacity: .55; }

/* sohbet */
.chat { display: flex; flex-direction: column; height: 520px; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: #efeae2; }
.chat .log { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.bubble { max-width: 78%; padding: 8px 12px; border-radius: 10px; white-space: pre-wrap; line-height: 1.45; box-shadow: 0 1px 1px rgba(0,0,0,.06); }
.bubble.user { align-self: flex-end; background: #d9fdd3; }
.bubble.assistant { align-self: flex-start; background: #fff; }
.bubble.system { align-self: center; background: transparent; box-shadow: none; color: var(--muted); font-size: 13px; }
.bubble .time { display: block; font-size: 11px; color: var(--muted); margin-top: 3px; text-align: right; }
.chat form { display: flex; gap: 8px; padding: 10px; background: #f0f2f5; margin: 0; }
.chat input { border-radius: 20px; }

/* giriş */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.auth .card { width: 100%; max-width: 400px; padding: 28px; }
.auth .logo { margin-bottom: 18px; }

.kv { display: grid; grid-template-columns: 140px 1fr; gap: 6px 12px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

@media (max-width: 720px) {
  main { padding: 16px 12px 48px; }
  .topbar .inner { padding: 10px 12px; gap: 10px; flex-wrap: wrap; }
  .topbar nav { gap: 12px; }
  h1 { font-size: 20px; }
  th, td { padding: 9px 10px; }
  .kv { grid-template-columns: 1fr; }
  .stats { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat { padding: 12px 14px; }
  .stat .n { font-size: 22px; }
  .table-wrap table { min-width: 860px; }
  .seg { display: flex; }
  .seg a { flex: 1; text-align: center; }
}
