:root {
  --blue: #1a73e8; --blue-dark: #1765cc; --blue-bg: #e8f0fe;
  --ink: #202124; --ink-2: #3c4043; --muted: #5f6368; --faint: #80868b;
  --line: #dadce0; --line-2: #e8eaed; --bg: #f8f9fa; --card: #fff;
  --green: #188038; --green-bg: #e6f4ea; --red: #d93025; --red-bg: #fce8e6;
  --amber: #b06000; --amber-bg: #fef7e0; --gray-bg: #f1f3f4;
  --radius: 8px; --nav-w: 248px; --top-h: 56px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 14px/1.45 var(--font); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { font-weight: 500; margin: 0; }
h1 { font-size: 22px; }
h2 { font-size: 16px; }
h3 { font-size: 14px; }
code, .mono { font-family: var(--mono); font-size: 12.5px; }
hr { border: 0; border-top: 1px solid var(--line-2); margin: 16px 0; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.hidden { display: none !important; }

/* ---- Üst çubuk ---- */
.topbar { position: fixed; inset: 0 0 auto 0; height: var(--top-h); background: #fff; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; padding: 0 16px 0 8px; z-index: 30; }
.topbar .burger { width: 40px; height: 40px; border: 0; background: none; border-radius: 50%; cursor: pointer; color: var(--muted); display: grid; place-items: center; }
.topbar .burger:hover { background: var(--gray-bg); }
.brand { display: flex; align-items: center; gap: 8px; font-size: 18px; color: var(--ink-2); font-weight: 500; white-space: nowrap; }
.brand .mark { width: 26px; height: 26px; border-radius: 6px; background: var(--blue); color: #fff; display: grid; place-items: center; font-size: 13px; font-weight: 700; letter-spacing: -.5px; }
.brand small { color: var(--muted); font-weight: 400; font-size: 14px; }
.project-picker { margin-left: 16px; display: flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: #fff; border-radius: 4px; padding: 6px 10px; cursor: pointer; color: var(--ink-2); font: inherit; max-width: 260px; }
.project-picker:hover { background: var(--gray-bg); }
.project-picker span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .spacer { flex: 1; }
.chip-balance { font-size: 13px; color: var(--ink-2); border: 1px solid var(--line); border-radius: 16px; padding: 4px 12px; white-space: nowrap; }
.chip-balance.neg { color: var(--red); border-color: #f4c7c3; background: var(--red-bg); }
.user-btn { width: 34px; height: 34px; border-radius: 50%; background: #5e35b1; color: #fff; border: 0; font-weight: 600; cursor: pointer; }
.menu { position: absolute; background: #fff; border-radius: 6px; box-shadow: 0 2px 6px rgba(60,64,67,.15), 0 1px 2px rgba(60,64,67,.3); padding: 6px 0; min-width: 220px; z-index: 50; }
.menu .menu-head { padding: 10px 16px 8px; border-bottom: 1px solid var(--line-2); margin-bottom: 4px; }
.menu button, .menu a { display: block; width: 100%; text-align: left; padding: 8px 16px; background: none; border: 0; font: inherit; color: var(--ink); cursor: pointer; }
.menu button:hover, .menu a:hover { background: var(--gray-bg); text-decoration: none; }
.menu .danger { color: var(--red); }

/* ---- Sol menü ---- */
.sidenav { position: fixed; top: var(--top-h); bottom: 0; left: 0; width: var(--nav-w); background: #fff; border-right: 1px solid var(--line); overflow-y: auto; padding: 8px 0 24px; z-index: 20; transition: transform .15s; }
.sidenav .sect { font-size: 11px; font-weight: 600; letter-spacing: .6px; text-transform: uppercase; color: var(--faint); padding: 16px 24px 6px; }
.sidenav a { display: flex; align-items: center; gap: 16px; height: 36px; padding: 0 24px; color: var(--ink-2); border-radius: 0 18px 18px 0; margin-right: 8px; }
.sidenav a:hover { background: var(--gray-bg); text-decoration: none; }
.sidenav a.active { background: var(--blue-bg); color: var(--blue); font-weight: 500; }
.sidenav a svg { flex: none; width: 18px; height: 18px; }
.sidenav .badge { margin-left: auto; }
body.nav-collapsed .sidenav { transform: translateX(-100%); }
body.nav-collapsed .main { margin-left: 0; }

.main { margin-left: var(--nav-w); padding: calc(var(--top-h) + 0px) 0 48px; min-height: 100vh; transition: margin .15s; }
.page { padding: 20px 32px; max-width: 1400px; }
.page-head { display: flex; align-items: center; gap: 12px; padding: 16px 32px; background: #fff; border-bottom: 1px solid var(--line); min-height: 64px; flex-wrap: wrap; }
.page-head h1 { margin-right: 12px; }
.page-head .back { color: var(--muted); display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; }
.page-head .back:hover { background: var(--gray-bg); }
.page-head .actions { display: flex; gap: 4px; flex-wrap: wrap; }
.crumbs { font-size: 12px; color: var(--muted); width: 100%; margin-bottom: -6px; }

/* ---- Düğmeler ---- */
.btn { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 16px; border-radius: 4px; border: 1px solid var(--line); background: #fff; color: var(--blue); font: 500 14px var(--font); cursor: pointer; white-space: nowrap; }
.btn:hover { background: #f6fafe; text-decoration: none; }
.btn:disabled { color: var(--faint); background: #f8f9fa; cursor: not-allowed; }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.primary:hover { background: var(--blue-dark); box-shadow: 0 1px 2px rgba(60,64,67,.3); }
.btn.primary:disabled { background: #dadce0; border-color: #dadce0; color: #fff; }
.btn.text { border-color: transparent; background: none; padding: 0 10px; }
.btn.text:hover { background: #f6fafe; }
.btn.danger { color: var(--red); }
.btn.danger.primary { background: var(--red); border-color: var(--red); color: #fff; }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn svg { width: 18px; height: 18px; }
.icon-btn { width: 32px; height: 32px; border: 0; background: none; border-radius: 50%; cursor: pointer; color: var(--muted); display: inline-grid; place-items: center; }
.icon-btn:hover { background: var(--gray-bg); color: var(--ink); }

/* ---- Kartlar ---- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.card + .card { margin-top: 16px; }
.grid > .card + .card { margin-top: 0; }
.card-head { display: flex; align-items: center; gap: 8px; padding: 14px 20px; border-bottom: 1px solid var(--line-2); }
.card-head h2 { flex: 1; }
.card-body { padding: 16px 20px; }
.card-body.flush { padding: 0; }
.grid { display: grid; gap: 16px; }
.grid.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.side { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
.stat { padding: 16px 20px; }
.stat .label { color: var(--muted); font-size: 12.5px; }
.stat .value { font-size: 24px; margin-top: 4px; font-weight: 400; }
.stat .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.kv { display: grid; grid-template-columns: 180px 1fr; gap: 0; }
.kv > div { padding: 9px 0; border-bottom: 1px solid var(--line-2); }
.kv > div:nth-child(odd) { color: var(--muted); }
.kv > div:nth-last-child(-n+2) { border-bottom: 0; }

/* ---- Tablolar ---- */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; }
table.t th { text-align: left; font-weight: 500; color: var(--muted); font-size: 12.5px; padding: 10px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; background: #fff; }
table.t td { padding: 10px 16px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
table.t tbody tr:hover td { background: #f8f9fa; }
table.t td.num, table.t th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.t .row-actions { white-space: nowrap; text-align: right; }
.empty { padding: 40px 20px; text-align: center; color: var(--muted); }
.empty h3 { color: var(--ink-2); margin-bottom: 6px; font-size: 15px; }
.toolbar { display: flex; gap: 8px; align-items: center; padding: 10px 16px; border-bottom: 1px solid var(--line-2); flex-wrap: wrap; }
.toolbar .search { flex: 1; min-width: 220px; display: flex; align-items: center; gap: 8px; color: var(--muted); }
.toolbar .search input { border: 0; outline: 0; font: inherit; flex: 1; padding: 6px 0; }

/* ---- Durum çipleri ---- */
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; white-space: nowrap; }
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--faint); }
.status.ok::before { background: var(--green); }
.status.warn::before { background: #f9ab00; }
.status.err::before { background: var(--red); }
.status.busy::before { background: var(--blue); animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: .3; } }
.pill { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 10px; background: var(--gray-bg); color: var(--ink-2); white-space: nowrap; }
.pill.blue { background: var(--blue-bg); color: var(--blue); }
.pill.green { background: var(--green-bg); color: var(--green); }
.pill.red { background: var(--red-bg); color: var(--red); }
.pill.amber { background: var(--amber-bg); color: var(--amber); }
.badge { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--red); color: #fff; font-size: 11px; font-weight: 600; }

/* ---- Formlar ---- */
.field { margin-bottom: 16px; }
.field > label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 6px; font-weight: 500; }
.field .hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], input[type=date], input[type=datetime-local], select, textarea {
  width: 100%; font: inherit; color: var(--ink); padding: 9px 12px; border: 1px solid var(--line); border-radius: 4px; background: #fff; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--blue); box-shadow: inset 0 0 0 1px var(--blue); }
textarea { min-height: 100px; resize: vertical; }
.row { display: flex; gap: 12px; }
.row > * { flex: 1; }
.check { display: flex; align-items: flex-start; gap: 8px; cursor: pointer; margin: 6px 0; }
.check input { margin-top: 3px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 4px; overflow: hidden; }
.seg button { border: 0; background: #fff; padding: 7px 14px; font: inherit; color: var(--ink-2); cursor: pointer; border-right: 1px solid var(--line); }
.seg button:last-child { border-right: 0; }
.seg button.on { background: var(--blue-bg); color: var(--blue); font-weight: 500; }
.choices { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.choice { border: 1px solid var(--line); border-radius: 6px; padding: 12px 14px; cursor: pointer; background: #fff; text-align: left; font: inherit; color: inherit; }
.choice:hover { border-color: #aecbfa; }
.choice.on { border-color: var(--blue); box-shadow: inset 0 0 0 1px var(--blue); background: #f8fbff; }
.choice .t { font-weight: 500; }
.choice .s { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.choice .p { font-size: 13px; margin-top: 8px; color: var(--ink-2); }
.form-section { padding: 20px; border-bottom: 1px solid var(--line-2); }
.form-section:last-child { border-bottom: 0; }
.form-section > h2 { margin-bottom: 4px; }
.form-section > .desc { color: var(--muted); font-size: 13px; margin-bottom: 14px; }
.notice { padding: 12px 16px; border-radius: 6px; background: var(--blue-bg); color: #174ea6; font-size: 13.5px; margin-bottom: 16px; }
.notice.warn { background: var(--amber-bg); color: #7a4100; }
.notice.err { background: var(--red-bg); color: #a50e0e; }
.notice.ok { background: var(--green-bg); color: #0d652d; }
.secret { font-family: var(--mono); background: var(--gray-bg); padding: 8px 12px; border-radius: 4px; display: flex; justify-content: space-between; gap: 8px; align-items: center; word-break: break-all; }

/* ---- Sekmeler ---- */
.tabs { display: flex; gap: 0; background: #fff; border-bottom: 1px solid var(--line); padding: 0 24px; overflow-x: auto; }
.tabs a { padding: 12px 16px; color: var(--muted); border-bottom: 3px solid transparent; font-weight: 500; white-space: nowrap; }
.tabs a:hover { color: var(--ink); text-decoration: none; background: var(--gray-bg); }
.tabs a.on { color: var(--blue); border-bottom-color: var(--blue); }

/* ---- Modal ve bildirim ---- */
.backdrop { position: fixed; inset: 0; background: rgba(32,33,36,.45); display: grid; place-items: center; z-index: 100; padding: 16px; }
.modal { background: #fff; border-radius: 8px; width: 100%; max-width: 520px; max-height: calc(100vh - 32px); display: flex; flex-direction: column; box-shadow: 0 4px 16px rgba(0,0,0,.2); }
.modal.wide { max-width: 760px; }
.modal-head { padding: 20px 24px 8px; }
.modal-body { padding: 8px 24px 16px; overflow-y: auto; }
.modal-foot { padding: 12px 16px; display: flex; justify-content: flex-end; gap: 8px; border-top: 1px solid var(--line-2); }
.toasts { position: fixed; left: 24px; bottom: 24px; display: flex; flex-direction: column; gap: 8px; z-index: 200; }
.toast { background: #323232; color: #fff; padding: 12px 16px; border-radius: 4px; min-width: 280px; max-width: 520px; box-shadow: 0 2px 6px rgba(0,0,0,.3); font-size: 14px; }
.toast.err { background: #a50e0e; }

/* ---- Grafikler ---- */
.chart { width: 100%; height: 180px; display: block; }
.chart .grid-line { stroke: var(--line-2); }
.chart .axis { fill: var(--faint); font-size: 10px; }
.chart .series { fill: none; stroke-width: 1.6; }
.chart .area { opacity: .08; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); padding: 0 4px 6px; }
.legend i { display: inline-block; width: 10px; height: 3px; border-radius: 2px; margin-right: 5px; vertical-align: middle; }
.bar { height: 6px; background: var(--line-2); border-radius: 3px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--blue); }
.bar.warn > i { background: #f9ab00; }
.bar.err > i { background: var(--red); }

/* ---- Zaman çizelgesi (CRM) ---- */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 34px 1fr; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line-2); }
.timeline li:last-child { border-bottom: 0; }
.timeline .dot { width: 30px; height: 30px; border-radius: 50%; background: var(--gray-bg); color: var(--muted); display: grid; place-items: center; font-size: 11px; font-weight: 600; }
.timeline .dot.note { background: #fef7e0; color: var(--amber); }
.timeline .dot.call, .timeline .dot.meeting { background: var(--green-bg); color: var(--green); }
.timeline .dot.email, .timeline .dot.ticket { background: var(--blue-bg); color: var(--blue); }
.timeline .dot.billing { background: #f3e8fd; color: #8430ce; }
.timeline .meta { font-size: 12px; color: var(--muted); }
.timeline .body { white-space: pre-wrap; margin-top: 4px; color: var(--ink-2); }
.tag { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 10px; border: 1px solid var(--line); color: var(--ink-2); margin: 0 4px 4px 0; background: #fff; }

/* ---- Mesajlaşma (destek) ---- */
.thread { display: flex; flex-direction: column; gap: 12px; }
.msg { border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.msg.staff { border-color: #c6dafc; background: #f8fbff; }
.msg.internal { border-color: #fde293; background: #fffbea; }
.msg-head { padding: 10px 16px; border-bottom: 1px solid var(--line-2); font-size: 13px; display: flex; justify-content: space-between; color: var(--muted); }
.msg-head b { color: var(--ink); font-weight: 500; }
.msg-body { padding: 12px 16px; white-space: pre-wrap; }

/* ---- Giriş ekranları ---- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--bg); }
.auth-box { width: 100%; max-width: 440px; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 40px 40px 32px; }
.auth-box .brand { justify-content: center; margin-bottom: 20px; }
.auth-box h1 { text-align: center; font-size: 22px; margin-bottom: 6px; }
.auth-box .lead { text-align: center; color: var(--muted); margin-bottom: 24px; }
.auth-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 20px; }
.loading { padding: 48px; text-align: center; color: var(--muted); }

@media (max-width: 1100px) {
  .grid.c4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.side { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .sidenav { transform: translateX(-100%); box-shadow: 0 0 16px rgba(0,0,0,.2); }
  body.nav-open .sidenav { transform: none; }
  .main { margin-left: 0; }
  .page, .page-head { padding-left: 16px; padding-right: 16px; }
  .grid.c2, .grid.c3, .grid.c4 { grid-template-columns: 1fr; }
  .project-picker, .brand small { display: none; }
  .kv { grid-template-columns: 1fr; }
  .kv > div:nth-child(odd) { border-bottom: 0; padding-bottom: 0; }
}
