:root {
  --ink: #12233a;
  --muted: #64748b;
  --line: #e2eaf3;
  --surface: #ffffff;
  --canvas: #f3f7fb;
  --primary: #2e5f8a;
  --primary-dark: #21476b;
  --accent: #e0a44e;
  --green: #2f9e6f;
  --red: #c85656;
  --sidebar: #0c1a29;
  --radius: 18px;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: "Avenir Next", "Segoe UI", system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: var(--canvas);
  font-size: 14px;
  line-height: 1.5;
}
a { color: inherit; text-decoration: none; }
button, input { font: inherit; }
code { background: #edf3f9; padding: 2px 6px; border-radius: 6px; font-size: 12px; color: #274b6b; }

/* ---------- Auth ---------- */
.auth-page { min-height: 100vh; display: grid; grid-template-columns: 1.02fr .98fr; }
.auth-aside {
  background:
    radial-gradient(800px 500px at 10% 0%, rgba(224,164,78,.25), transparent 55%),
    radial-gradient(700px 500px at 100% 100%, rgba(79,131,176,.35), transparent 50%),
    linear-gradient(150deg, #0c1a29, #173a5b 60%, #2e5f8a);
  color: #fff;
  padding: 46px 50px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.auth-brand { display: flex; align-items: center; gap: 11px; font-weight: 750; font-size: 16px; }
.brand-mark {
  width: 40px; height: 40px; border-radius: 13px; display: grid; place-items: center;
  background: linear-gradient(145deg, #5b8fbb, #2e5f8a); color: #fff; font-weight: 800;
  box-shadow: 0 12px 26px rgba(0,0,0,.25);
}
.auth-copy { max-width: 520px; padding: 40px 0; }
.auth-copy span.eyebrow { font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: #e0a44e; font-weight: 800; }
.auth-copy h1 { font-size: clamp(34px, 3.6vw, 50px); line-height: 1.04; letter-spacing: -.04em; margin: 14px 0 16px; }
.auth-copy p { color: #c3d4e4; font-size: 15px; max-width: 460px; }
.auth-points { display: grid; gap: 13px; margin-top: 28px; }
.auth-point { display: flex; gap: 11px; align-items: start; }
.auth-point i {
  flex: 0 0 24px; height: 24px; border-radius: 8px; display: grid; place-items: center;
  background: rgba(255,255,255,.12); color: #e0a44e; font-style: normal; font-size: 12px; font-weight: 800;
}
.auth-point strong { display: block; font-size: 13px; }
.auth-point small { color: #a9bfd3; font-size: 11.5px; }
.auth-foot { color: #8199b0; font-size: 11px; }
.auth-main { display: grid; place-items: center; padding: 34px; }
.auth-card {
  width: min(430px, 100%); background: #fff; border: 1px solid var(--line);
  border-radius: 24px; padding: 30px; box-shadow: 0 30px 70px rgba(16,40,66,.12);
}
.auth-card h2 { margin: 0 0 5px; font-size: 22px; letter-spacing: -.03em; }
.auth-card .sub { margin: 0 0 20px; color: var(--muted); font-size: 12.5px; }
.tabs { display: flex; background: #f1f5fa; border-radius: 11px; padding: 4px; margin-bottom: 20px; }
.tab {
  flex: 1; border: 0; background: transparent; padding: 9px; border-radius: 8px;
  cursor: pointer; color: var(--muted); font-weight: 650; font-size: 12.5px;
}
.tab.active { background: #fff; color: var(--ink); box-shadow: 0 4px 12px rgba(18,35,58,.08); }
.form { display: grid; gap: 13px; }
.field { display: grid; gap: 5px; }
.field span { font-size: 11px; color: var(--muted); font-weight: 650; }
.field input {
  width: 100%; border: 1px solid var(--line); border-radius: 11px; padding: 11px 13px;
  outline: none; background: #fff; color: var(--ink); font-size: 13px;
}
.field input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(46,95,138,.1); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  border-radius: 11px; padding: 10px 16px; cursor: pointer; font-weight: 650; font-size: 12.5px;
  transition: transform .15s ease, background .15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-block { width: 100%; }
.btn:disabled { opacity: .6; cursor: not-allowed; transform: none; }
.auth-error {
  display: none; background: #fdf0f0; border: 1px solid #f2d2d2; color: #9b3535;
  border-radius: 10px; padding: 9px 11px; font-size: 11.5px; margin-bottom: 4px;
}
.auth-error.show { display: block; }
.auth-note { margin-top: 17px; text-align: center; font-size: 11px; color: var(--muted); }
.auth-note a { color: var(--primary); font-weight: 700; }
.demo-box {
  margin-top: 18px; background: #f7fafd; border: 1px dashed #cbdbea; border-radius: 11px;
  padding: 11px 13px; font-size: 11px; color: var(--muted);
}
.demo-box strong { color: var(--ink); }
.auth-success {
  display: none; background: #eef8f3; border: 1px solid #cfeadd; color: #1f6f4d;
  border-radius: 10px; padding: 9px 11px; font-size: 11.5px; margin-bottom: 4px;
}
.auth-success.show { display: block; }

/* ---------- Portal ---------- */
.portal { display: grid; grid-template-columns: 242px 1fr; min-height: 100vh; }
.p-sidebar {
  background: var(--sidebar); color: #d7e3ef; padding: 22px 15px;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.p-brand { display: flex; align-items: center; gap: 11px; padding: 0 6px 20px; border-bottom: 1px solid rgba(255,255,255,.09); }
.p-brand strong { display: block; color: #fff; font-size: 14px; letter-spacing: -.02em; }
.p-brand small { color: #7e93a8; font-size: 10.5px; }
.p-nav { display: flex; flex-direction: column; gap: 3px; margin-top: 16px; }
.p-nav-item {
  display: flex; align-items: center; gap: 10px; border: 0; background: transparent;
  color: #a4b6c8; padding: 10px 11px; border-radius: 10px; cursor: pointer;
  text-align: left; font-size: 12.5px;
}
.p-nav-item svg { width: 17px; height: 17px; flex: 0 0 17px; opacity: .9; }
.p-nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.p-nav-item.active { background: rgba(79,131,176,.2); color: #fff; box-shadow: inset 0 0 0 1px rgba(122,174,220,.22); }
.p-side-foot { margin-top: auto; border-top: 1px solid rgba(255,255,255,.09); padding-top: 14px; display: grid; gap: 8px; }
.credit-mini { background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.08); border-radius: 11px; padding: 11px; }
.credit-mini span { font-size: 10px; color: #8ea3b8; display: block; }
.credit-mini strong { font-size: 19px; color: #fff; letter-spacing: -.03em; }
.credit-mini small { font-size: 9.5px; color: #7e93a8; }
.p-side-link { font-size: 11.5px; color: #8ea3b8; }
.p-side-link:hover { color: #fff; }

.p-main { padding: 24px 30px 50px; min-width: 0; }
.p-top { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 20px; }
.p-top h1 { margin: 0; font-size: 23px; letter-spacing: -.03em; }
.p-top p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.p-user { display: flex; align-items: center; gap: 10px; }
.p-avatar {
  width: 36px; height: 36px; border-radius: 12px; background: linear-gradient(145deg, #5b8fbb, #2e5f8a);
  color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 13px;
}
.p-user strong { display: block; font-size: 12px; }
.p-user small { color: var(--muted); font-size: 10.5px; }
.p-view { display: none; }
.p-view.active { display: block; }

.credit-hero {
  background:
    radial-gradient(500px 260px at 100% 0%, rgba(224,164,78,.3), transparent 55%),
    linear-gradient(135deg, #173b5c, #2e5f8a);
  color: #fff; border-radius: 20px; padding: 24px; display: flex;
  justify-content: space-between; align-items: center; gap: 24px; margin-bottom: 16px;
  box-shadow: 0 24px 45px rgba(20,48,75,.18);
}
.credit-hero span.label { font-size: 11px; text-transform: uppercase; letter-spacing: .12em; color: #b9cee1; font-weight: 750; }
.credit-hero .amount { font-size: 52px; font-weight: 800; letter-spacing: -.06em; line-height: 1; margin: 8px 0 4px; }
.credit-hero .amount small { font-size: 14px; font-weight: 600; letter-spacing: 0; color: #cfe0ee; margin-left: 6px; }
.credit-hero p { margin: 0; color: #c2d5e6; font-size: 11.5px; }
.credit-hero .side { text-align: right; display: grid; gap: 8px; justify-items: end; }
.credit-hero .btn { background: #fff; color: var(--ink); border-color: transparent; }
.credit-hero .meta { font-size: 10.5px; color: #b9cee1; }
.credit-bar { height: 6px; width: 220px; background: rgba(255,255,255,.16); border-radius: 99px; overflow: hidden; margin-top: 10px; }
.credit-bar > i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 15px 16px; }
.stat span { font-size: 10.5px; color: var(--muted); font-weight: 650; }
.stat strong { display: block; font-size: 24px; letter-spacing: -.04em; margin-top: 3px; }
.stat small { font-size: 10px; color: #8a99ab; }

.p-grid { display: grid; grid-template-columns: 1.25fr .75fr; gap: 16px; margin-bottom: 16px; }
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; min-width: 0; }
.card-head { display: flex; align-items: start; justify-content: space-between; gap: 12px; margin-bottom: 13px; }
.card-head h2 { margin: 0; font-size: 14.5px; letter-spacing: -.01em; }
.card-head p { margin: 3px 0 0; color: var(--muted); font-size: 11px; }
.btn-sm { padding: 7px 11px; font-size: 11.5px; border-radius: 9px; }
.embed-box { background: #f7fafd; border: 1px solid var(--line); border-radius: 11px; padding: 12px; position: relative; }
.embed-box code { display: block; white-space: pre-wrap; word-break: break-all; font-size: 10.5px; line-height: 1.6; background: transparent; padding: 0 74px 0 0; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; color: #274b6b; }
.copy-btn { position: absolute; right: 9px; top: 9px; }
.hint { font-size: 10.5px; color: #8a99ab; line-height: 1.55; margin: 10px 0 0; }
.low-credit { display: none; background: #fdf3e3; border: 1px solid #f0dcb8; color: #8a5a12; border-radius: 11px; padding: 10px 12px; font-size: 11.5px; margin-bottom: 14px; }
.low-credit.show { display: block; }

.test-chat { display: flex; flex-direction: column; gap: 9px; background: #f8fafc; border: 1px solid var(--line); border-radius: 12px; padding: 12px; height: 300px; overflow-y: auto; }
.tc-empty { margin: auto; text-align: center; color: #9aabbe; font-size: 11.5px; }
.tc-msg { max-width: 88%; padding: 9px 12px; border-radius: 12px; font-size: 12.5px; white-space: pre-wrap; line-height: 1.5; }
.tc-msg.user { align-self: flex-end; background: var(--primary); color: #fff; border-bottom-right-radius: 4px; }
.tc-msg.bot { align-self: flex-start; background: #fff; border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.tc-msg .src { display: block; margin-top: 6px; font-size: 10px; color: var(--primary); font-weight: 700; }
.tc-form { display: flex; gap: 8px; margin-top: 10px; }
.tc-form input { flex: 1; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; outline: none; font-size: 12.5px; }
.tc-form input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(46,95,138,.1); }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 9.5px; letter-spacing: .06em; text-transform: uppercase; color: #8a99ab; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 10px; border-bottom: 1px solid #eef3f8; font-size: 12px; }
.table tbody tr[data-id] { cursor: pointer; }
.table tbody tr[data-id]:hover { background: #f8fbfe; }
.table .empty { text-align: center; color: var(--muted); padding: 22px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10.5px; color: #5b7290; }
.status { font-size: 9.5px; font-weight: 700; padding: 3px 8px; border-radius: 99px; display: inline-block; }
.status.open { background: #eaf5ef; color: #237a55; }
.status.handover { background: #fdf1e0; color: #9a6416; }
.status.resolved { background: #eaf2f9; color: #2e5f8a; }
.muted { color: var(--muted); }
.tiny { font-size: 10.5px; }
.plus { color: var(--green); font-weight: 700; }
.minus { color: var(--red); font-weight: 700; }

.doc-grid { display: grid; grid-template-columns: .8fr 1.2fr; gap: 16px; }
.stack { display: grid; gap: 11px; }
.field textarea, textarea.input {
  width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
  font: inherit; font-size: 12.5px; outline: none; resize: vertical;
}
.field input[type=file] { padding: 8px; color: var(--muted); }
.divider { display: flex; align-items: center; gap: 10px; margin: 13px 0; color: #9aabbe; font-size: 10px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.callout { background: #f7fafd; border: 1px solid var(--line); border-radius: 11px; padding: 12px; margin-top: 13px; }
.callout strong { font-size: 11.5px; }
.callout p { margin: 4px 0 0; font-size: 10.5px; color: var(--muted); }

.modal { position: fixed; inset: 0; background: rgba(8,18,30,.55); display: none; place-items: center; z-index: 40; padding: 20px; }
.modal.open { display: grid; }
.modal-card { width: min(700px, 100%); max-height: 86vh; background: #fff; border-radius: 18px; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 30px 80px rgba(0,0,0,.3); }
.modal-head { display: flex; align-items: start; justify-content: space-between; padding: 17px 19px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font-size: 15px; }
.modal-head p { margin: 3px 0 0; color: var(--muted); font-size: 10.5px; }
.icon-btn { border: 0; background: #f1f5f9; width: 30px; height: 30px; border-radius: 9px; font-size: 18px; line-height: 1; cursor: pointer; color: #52657a; }
.modal-body { padding: 17px 19px; overflow-y: auto; display: flex; flex-direction: column; gap: 9px; background: #f7fafd; }
.m-msg { max-width: 88%; padding: 9px 12px; border-radius: 12px; font-size: 12.5px; white-space: pre-wrap; }
.m-msg.user { align-self: flex-end; background: var(--primary); color: #fff; }
.m-msg.assistant { align-self: flex-start; background: #fff; border: 1px solid var(--line); }
.m-meta { display: flex; gap: 7px; flex-wrap: wrap; font-size: 9.5px; color: var(--muted); margin-top: 5px; }
.m-cite { font-size: 9.5px; color: var(--primary); background: #eaf2f9; padding: 2px 6px; border-radius: 6px; }

.toast { position: fixed; right: 22px; bottom: 22px; background: #0c1a29; color: #fff; padding: 11px 15px; border-radius: 11px; font-size: 12px; opacity: 0; transform: translateY(8px); transition: all .2s ease; pointer-events: none; z-index: 60; }
.toast.show { opacity: 1; transform: translateY(0); }

/* ---------- Integration studio ---------- */
.platform-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 16px; }
.platform-tab {
  display: flex; align-items: center; gap: 10px; border: 1px solid var(--line);
  background: #fff; border-radius: 13px; padding: 12px; cursor: pointer; text-align: left;
}
.platform-tab:hover { border-color: #b9cee1; }
.platform-tab.active { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(46,95,138,.1); }
.platform-tab .pt-ico {
  width: 34px; height: 34px; flex: 0 0 34px; border-radius: 10px; display: grid;
  place-items: center; background: #eaf2f9; color: var(--primary); font-weight: 800; font-size: 12px;
}
.platform-tab strong { display: block; font-size: 12px; }
.platform-tab small { display: block; font-size: 10px; color: var(--muted); }

.integration-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.preset-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; margin-bottom: 16px; }
.preset {
  border: 1px solid var(--line); background: #fff; border-radius: 11px; padding: 9px;
  text-align: left; cursor: pointer; display: grid; gap: 3px;
}
.preset:hover { border-color: #b9cee1; }
.preset.active { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(46,95,138,.12); }
.preset strong { font-size: 11px; line-height: 1.25; }
.preset small { font-size: 9px; color: var(--muted); line-height: 1.3; }
.preset-preview { height: 38px; border-radius: 7px; background: #f1f6fb; position: relative; display: block; overflow: hidden; margin-bottom: 2px; }
.preset-preview::after {
  content: ""; position: absolute; right: 7px; bottom: 7px; width: 16px; height: 16px;
  border-radius: 6px; background: #2E5F8A; box-shadow: 0 3px 7px rgba(0,0,0,.18);
}
.preset-preview.p-teaser::before {
  content: "Merhaba!"; position: absolute; right: 6px; top: 6px; font-size: 7px; color: #2E5F8A;
  background: #fff; border: 1px solid #dce8f3; border-radius: 5px; padding: 2px 4px;
}
.preset-preview.p-delayed::after { background: #2E5F8A; animation: none; }
.preset-preview.p-delayed::before {
  content: "5s"; position: absolute; right: 11px; bottom: 11px; z-index: 2; color: #fff;
  font-size: 6.5px; font-weight: 800;
}
.preset-preview.p-pill::after { width: 34px; height: 13px; border-radius: 99px; }
.preset-preview.p-minimal::after { width: 13px; height: 13px; border-radius: 5px; }
.preset-preview.p-dark { background: #0f1b2a; }
.preset-preview.p-dark::after { background: #4F83B0; }

.cfg-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; margin-bottom: 11px; }
.field select {
  width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
  background: #fff; color: var(--ink); outline: none; font-size: 12.5px;
}
.field select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(46,95,138,.1); }
.field input[type=color] { padding: 4px; height: 41px; cursor: pointer; }
.field input[type=range] { padding: 0; height: 41px; accent-color: var(--primary); }
.check {
  display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--muted);
  margin: 9px 0; cursor: pointer;
}
.check input { width: 16px; height: 16px; accent-color: var(--primary); }
.integration-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.preview-frame-wrap {
  height: 440px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #f8fafc;
}
#widget-preview { width: 100%; height: 100%; border: 0; background: #fff; }

.soon-panel {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 30px; max-width: 720px;
}
.soon-panel h2 { margin: 10px 0 6px; font-size: 20px; letter-spacing: -.03em; }
.soon-panel p { margin: 0; color: var(--muted); font-size: 12.5px; max-width: 560px; }
.soon-badge {
  display: inline-block; font-size: 10px; font-weight: 800; letter-spacing: .08em;
  text-transform: uppercase; color: #9a6416; background: #fdf1e0; border: 1px solid #f0dcb8;
  padding: 4px 9px; border-radius: 99px;
}
.soon-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 18px; }
.soon-grid > div { background: #f7fafd; border: 1px solid var(--line); border-radius: 10px; padding: 12px; }
.soon-grid strong { display: block; font-size: 11.5px; }
.soon-grid small { display: block; font-size: 10px; color: var(--muted); margin-top: 3px; }

@media (max-width: 1180px) {
  .integration-grid { grid-template-columns: 1fr; }
}
@media (max-width: 1080px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .p-grid, .doc-grid { grid-template-columns: 1fr; }
  .platform-tabs { grid-template-columns: 1fr; }
  .soon-grid { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .auth-page { grid-template-columns: 1fr; }
  .auth-aside { display: none; }
  .portal { grid-template-columns: 1fr; }
  .p-sidebar { position: static; height: auto; padding: 14px; }
  .p-nav { flex-direction: row; overflow-x: auto; margin-top: 12px; }
  .p-nav-item { white-space: nowrap; }
  .p-side-foot { display: none; }
  .p-main { padding: 18px 14px 40px; }
  .p-top { flex-wrap: wrap; }
  .credit-hero { flex-direction: column; align-items: start; }
  .credit-hero .side { justify-items: start; text-align: left; }
}
@media (max-width: 540px) {
  .stat-grid { grid-template-columns: 1fr; }
  .preset-grid, .cfg-grid { grid-template-columns: 1fr 1fr; }
  .preview-frame-wrap { height: 360px; }
  .auth-main { padding: 18px; }
  .auth-card { padding: 22px; }
  .credit-hero .amount { font-size: 42px; }
}
