:root {
  --bg: #f4f6f9; --panel: #ffffff; --panel2: #f0f2f6; --line: #e2e6ec;
  --text: #1b2230; --muted: #6b7280; --accent: #2f6fed;
  --good: #128a5b; --mid: #b57d16; --bad: #c9453f;
  --bcb: #c25aa6; --wam: #2f6fed; --dk: #2e9e57; --cjet: #d9773a; --aph: #5b6470; --total: #a9861f;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--text); font-size: 14px; }
.hidden { display: none !important; }

/* Login */
.login-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 32px; width: 320px; display: flex; flex-direction: column; gap: 12px;
  box-shadow: 0 6px 24px rgba(20, 30, 50, 0.08); }
.login-card h1 { margin: 0; font-size: 22px; }
.login-card .sub { margin: 0 0 8px; color: var(--muted); }
.login-card input { padding: 11px 12px; background: #fff; border: 1px solid var(--line);
  border-radius: 8px; color: var(--text); font-size: 14px; }
.login-card input:focus { outline: none; border-color: var(--accent); }
.login-card button { padding: 11px; background: var(--accent); color: #fff; border: 0;
  border-radius: 8px; font-weight: 600; cursor: pointer; font-size: 14px; }
tr.talep-vurgu td { background: #fff3c4; }
.google-btn { display: block; padding: 10px; text-align: center; border: 1px solid var(--line); border-radius: 8px;
  color: inherit; text-decoration: none; font-weight: 600; background: #fff; }
.google-btn:hover { border-color: var(--accent); }
.err { color: var(--bad); font-size: 13px; min-height: 16px; }

/* Topbar */
.topbar { display: flex; align-items: center; gap: 20px; padding: 12px 20px;
  background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.brand { font-weight: 700; letter-spacing: .3px; }
.tabs { display: flex; gap: 6px; }
.tab { background: transparent; border: 1px solid transparent; color: var(--muted);
  padding: 7px 14px; border-radius: 8px; cursor: pointer; font-size: 14px; transition: all .15s ease; }
.tab:hover { color: var(--text); background: var(--panel2); }
.tab.active { background: var(--panel2); color: var(--text); border-color: var(--line); }
.user-area { margin-left: auto; display: flex; align-items: center; gap: 10px; color: var(--muted); }
.user-area button { background: var(--panel2); border: 1px solid var(--line); color: var(--text);
  padding: 7px 12px; border-radius: 8px; cursor: pointer; }
.user-area button:hover { background: #e7ebf2; }
main { padding: 20px; max-width: 1200px; margin: 0 auto; }

/* Preset pills */
.preset-group { display: inline-flex; background: var(--panel2); border: 1px solid var(--line);
  border-radius: 10px; padding: 3px; gap: 2px; }
.preset { background: transparent; border: 0; color: var(--muted); padding: 7px 13px;
  border-radius: 8px; cursor: pointer; font-size: 13px; font-weight: 600; transition: all .15s ease; }
.preset:hover { color: var(--text); }
.preset.active { background: var(--panel); color: var(--accent); box-shadow: 0 1px 3px rgba(20,30,50,.12); }

/* KPI tiles */
.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 20px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px;
  box-shadow: 0 1px 3px rgba(20,30,50,.06); transition: transform .15s ease, box-shadow .15s ease;
  animation: rise .3s ease both; }
.kpi:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(20,30,50,.10); }
.kpi:nth-child(1){animation-delay:.02s}.kpi:nth-child(2){animation-delay:.05s}.kpi:nth-child(3){animation-delay:.08s}
.kpi:nth-child(4){animation-delay:.11s}.kpi:nth-child(5){animation-delay:.14s}.kpi:nth-child(6){animation-delay:.17s}
.kpi:nth-child(7){animation-delay:.20s}.kpi:nth-child(8){animation-delay:.23s}
.kpi:nth-child(9){animation-delay:.26s}.kpi:nth-child(10){animation-delay:.29s}
.kpi-label { color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .4px; margin-bottom: 6px; }
.kpi-val { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.kpi-val.roas.good { color: var(--good); } .kpi-val.roas.mid { color: var(--mid); } .kpi-val.roas.bad { color: var(--bad); }
.kpi-val.muted { color: var(--muted); font-size: 18px; }

@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.view:not(.hidden) { animation: fade .25s ease both; }
.month-block { animation: rise .3s ease both; }

/* Controls */
.controls { display: flex; gap: 12px; align-items: end; margin-bottom: 16px; flex-wrap: wrap; }
.controls label { display: flex; flex-direction: column; gap: 4px; color: var(--muted); font-size: 12px; }
.controls select, .controls input { padding: 8px 10px; background: #fff;
  border: 1px solid var(--line); border-radius: 8px; color: var(--text); font-size: 14px; }
.controls button { padding: 9px 16px; background: var(--accent); color: #fff; border: 0;
  border-radius: 8px; font-weight: 600; cursor: pointer; }

/* Tables */
.month-block { margin-bottom: 28px; }
.month-title { font-size: 16px; font-weight: 700; margin: 0 0 10px; color: var(--text); }
table { width: 100%; border-collapse: collapse; background: var(--panel); border-radius: 10px;
  overflow: hidden; box-shadow: 0 1px 3px rgba(20, 30, 50, 0.06); }
th, td { padding: 10px 12px; text-align: right; border-bottom: 1px solid var(--line); }
th:first-child, td:first-child { text-align: left; }
thead th { background: var(--panel2); color: var(--muted); font-weight: 600; font-size: 12px;
  text-transform: uppercase; letter-spacing: .4px; }
tbody tr:hover { background: #f7f9fc; }
tr.total-row td { font-weight: 700; border-top: 2px solid var(--line); background: #eef3fd; }
.store-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 8px; }
.brand-cell { white-space: nowrap; }
.brand-logo { width: 22px; height: 22px; border-radius: 5px; object-fit: contain; background: #fff;
  border: 1px solid var(--line); margin-right: 8px; vertical-align: middle; padding: 1px; }
.dot-bcb { background: var(--bcb); } .dot-wam { background: var(--wam); }
.dot-dk { background: var(--dk); } .dot-cjet { background: var(--cjet); }
.dot-aph { background: var(--aph); } .dot-total { background: var(--total); }
.num { font-variant-numeric: tabular-nums; }
.roas { font-weight: 700; }
.roas.good { color: var(--good); } .roas.mid { color: var(--mid); } .roas.bad { color: var(--bad); }
.muted { color: var(--muted); }
th.sep, td.sep { border-left: 2px solid var(--line); }
th.sep { color: #9aa1ad; }
thead th.grp { text-align: center; color: var(--text); font-size: 11px; border-bottom: 1px solid var(--line); }
thead th.sub { font-size: 10px; font-weight: 600; }
.warn { background: #fdf5e3; border: 1px solid #ecd39a; color: #8a6414; padding: 10px 14px;
  border-radius: 8px; margin-bottom: 16px; font-size: 13px; }
.empty { color: var(--muted); padding: 40px; text-align: center; }
.scroll { overflow-x: auto; }

/* Audit request panel */
.request-panel { background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 16px; margin-bottom: 20px; box-shadow: 0 1px 3px rgba(20,30,50,.06); animation: rise .3s ease both; }
.rp-head { font-weight: 700; font-size: 15px; margin-bottom: 12px; }
.rp-controls { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.rp-buttons { display: flex; gap: 8px; flex-wrap: wrap; }
.req-btn { background: var(--panel2); border: 1px solid var(--line); color: var(--text);
  padding: 9px 15px; border-radius: 9px; cursor: pointer; font-size: 13px; font-weight: 600;
  transition: all .15s ease; }
.req-btn:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-1px); }
.req-btn.compare { background: var(--accent); color: #fff; border-color: var(--accent); }
.req-btn.compare:hover { filter: brightness(1.08); color: #fff; }
.req-btn:disabled { opacity: .5; cursor: default; }
.rp-msg { margin-top: 12px; font-size: 13px; min-height: 18px; }
.rp-msg.ok { color: var(--good); } .rp-msg.err { color: var(--bad); }
.sec-title { font-size: 15px; font-weight: 700; margin: 22px 0 10px; }
.empty.small { padding: 20px; }
.status { display: inline-block; padding: 3px 11px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.st-prep { background: #fdf5e3; color: #a5760f; }
.st-ready { background: #e7f6ec; color: #128a5b; }
.st-fail { background: #fdeceb; color: #c9453f; }

/* Audits */
.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.badge-meta { background: #e9f0fe; color: #2f6fed; }
.badge-gads { background: #e7f6ec; color: #128a5b; }
.audit-actions { display: flex; gap: 8px; justify-content: flex-end; }
.btn-view { background: var(--accent); color: #fff; border: 0; padding: 6px 14px; border-radius: 7px;
  cursor: pointer; font-size: 13px; font-weight: 600; transition: filter .15s ease; }
.btn-view:hover { filter: brightness(1.08); }
.btn-pdf-sm, .btn-pdf { display: inline-block; background: var(--panel2); border: 1px solid var(--line);
  color: var(--text); padding: 6px 12px; border-radius: 7px; cursor: pointer; font-size: 13px;
  font-weight: 600; text-decoration: none; transition: background .15s ease; }
.btn-pdf-sm:hover, .btn-pdf:hover { background: #e7ebf2; }

/* Modal viewer */
.modal { position: fixed; inset: 0; background: rgba(15,22,35,.55); display: flex;
  align-items: center; justify-content: center; z-index: 50; padding: 24px; animation: fade .2s ease both; }
.modal-inner { background: var(--panel); border-radius: 14px; width: min(960px, 100%); height: 90vh;
  display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 20px 60px rgba(10,15,30,.4); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px; border-bottom: 1px solid var(--line); font-weight: 600; }
.modal-actions { display: flex; align-items: center; gap: 10px; }
#audit-close { background: var(--panel2); border: 1px solid var(--line); color: var(--text);
  width: 30px; height: 30px; border-radius: 8px; cursor: pointer; font-size: 15px; }
.audit-frame { flex: 1; border: 0; width: 100%; background: #fff; }

/* Trend chart */
.trend-panel { background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 16px 16px 8px; margin-bottom: 28px; box-shadow: 0 1px 3px rgba(20,30,50,0.06); }
.trend-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.mbtns { display: flex; gap: 6px; }
.mbtn { background: var(--panel2); border: 1px solid var(--line); color: var(--muted);
  padding: 6px 12px; border-radius: 8px; cursor: pointer; font-size: 13px; font-weight: 600; }
.mbtn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; }
.lg { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; }
.lg-line { display: inline-block; width: 14px; height: 3px; border-radius: 2px; }
.chart-wrap { position: relative; width: 100%; }
.chart { width: 100%; height: auto; display: block; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis { stroke: #cfd5de; stroke-width: 1; }
.chart .axlab { fill: var(--muted); font-size: 11px; }
.chart .endlab { font-size: 11px; font-weight: 700; }
.chart .crosshair { stroke: #b9c0cc; stroke-width: 1; stroke-dasharray: 3 3; }
.chart .hband { cursor: crosshair; }
.chart-tip { position: absolute; top: 6px; transform: translateX(-50%); pointer-events: none;
  background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px;
  box-shadow: 0 4px 16px rgba(20,30,50,0.14); font-size: 12px; white-space: nowrap; z-index: 3; }
.tip-title { font-weight: 700; margin-bottom: 4px; }
.tip-row { display: flex; align-items: center; gap: 6px; padding: 1px 0; color: var(--text); }
.tip-row b { margin-left: auto; padding-left: 10px; }
@media (max-width: 640px) {
  .topbar { flex-wrap: wrap; gap: 10px; }
  .brand { width: 100%; }
}

.dot-cj { background: #ad7621; }
