/* Truethinks Admin — el yazımı, build adımı yok. Marka: truethinks.co.uk ile aynı tipografi/renk. */
:root {
  --bg: #F6F4EF;
  --surface: #FFFFFF;
  --surface-2: #FBFAF7;
  --ink: #16233B;
  --ink-2: #4A5568;
  --muted: #7C8595;
  --line: #E4E0D6;
  --line-strong: #CFC9BB;
  --brand: #16233B;
  --accent: #2F5BEA;
  --bar: #3A5BA0;
  --bar-hover: #24427F;
  --good: #1F7A4D;   --good-bg: #E7F4EC;
  --warn: #9A6200;   --warn-bg: #FCF3DF;
  --bad: #B42318;    --bad-bg: #FDECEA;
  --info: #2C5282;   --info-bg: #EAF1FB;
  --radius: 10px;
  --sans: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --serif: "Newsreader", Georgia, serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0F1626; --surface: #16203A; --surface-2: #1A2542; --ink: #EEF1F7; --ink-2: #B7C0D1; --muted: #8590A6;
    --line: #26314F; --line-strong: #34426A; --brand: #EEF1F7; --accent: #7DA2FF; --bar: #7C9BE0; --bar-hover: #A9C0F5;
    --good: #5BC28C; --good-bg: #13362A; --warn: #E9B44C; --warn-bg: #3A2E12; --bad: #F2837A; --bad-bg: #42201F;
    --info: #8DB4F0; --info-bg: #1B2C4A; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 14px/1.5 var(--sans); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { font-family: var(--serif); font-weight: 500; letter-spacing: -.01em; margin: 0; }
h1 { font-size: 28px; }
h2 { font-size: 19px; }
h3 { font-size: 15px; font-family: var(--sans); font-weight: 600; }
.mono, code { font-family: var(--mono); font-size: 12.5px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }

/* Yerleşim */
.app { display: grid; grid-template-columns: 228px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--brand); color: #DDE3EE; padding: 22px 14px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .side { background: #0A101D; } }
.side .logo { display: block; padding: 0 10px 18px; }
.side .logo img { height: 22px; filter: brightness(0) invert(1); }
.side .logo span { display: block; font: 11px var(--mono); color: #8C99B3; margin-top: 6px; letter-spacing: .08em; text-transform: uppercase; }
.side nav a { display: flex; align-items: center; justify-content: space-between; color: #C9D2E3; padding: 8px 10px; border-radius: 8px; margin-bottom: 2px; }
.side nav a:hover { background: rgba(255,255,255,.07); text-decoration: none; color: #fff; }
.side nav a.on { background: rgba(255,255,255,.12); color: #fff; }
.side nav .sep { height: 1px; background: rgba(255,255,255,.1); margin: 12px 10px; }
.side .badge { background: #E5484D; color: #fff; font-size: 11px; border-radius: 99px; padding: 0 7px; line-height: 18px; }
.side form { margin-top: 18px; padding: 0 10px; }
.side form button { background: none; border: 0; color: #8C99B3; padding: 0; cursor: pointer; font: inherit; }
main { padding: 28px 32px 60px; min-width: 0; }
.head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.head p { margin: 4px 0 0; color: var(--muted); }
.menu-btn { display: none; }

@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; inset: 0 auto 0 0; width: 250px; z-index: 50; transform: translateX(-100%); transition: transform .2s; }
  .app.open .side { transform: none; }
  .menu-btn { display: inline-flex; position: sticky; top: 0; z-index: 40; margin: 0; width: 100%; background: var(--brand); color: #fff; border: 0; padding: 12px 16px; font: 600 14px var(--sans); }
  main { padding: 18px 16px 48px; }
}

/* Bileşenler */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.stack > * + *, .card + .card { margin-top: 16px; }
.grid > .card { margin-top: 0; }
.g-2-1 { align-items: start; }
.card h2 { margin-bottom: 12px; }
.card .card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.card .card-head h2 { margin: 0; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-2-1 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
@media (max-width: 1100px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g-2-1, .g3 { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 640px) { .g2, .g4 { grid-template-columns: minmax(0, 1fr); } }

.stat .label { color: var(--muted); font-size: 12.5px; }
.stat .value { font: 500 26px/1.2 var(--serif); margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat .sub { color: var(--muted); font-size: 12.5px; margin-top: 2px; }

.table-wrap { overflow-x: auto; margin: 0 -20px; padding: 0 20px; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-weight: 500; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; padding: 8px 10px; border-bottom: 1px solid var(--line-strong); white-space: nowrap; }
td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--surface-2); }
th.num { text-align: right; }
tfoot td { font-weight: 600; border-top: 1px solid var(--line-strong); }

.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; padding: 1px 8px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--line); white-space: nowrap; color: var(--ink-2); }
.pill.good { background: var(--good-bg); color: var(--good); border-color: transparent; }
.pill.warn { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.pill.bad { background: var(--bad-bg); color: var(--bad); border-color: transparent; }
.pill.info { background: var(--info-bg); color: var(--info); border-color: transparent; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.chan { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.chan img { height: 18px; width: auto; max-width: 64px; object-fit: contain; border-radius: 3px; }

.btn { display: inline-flex; align-items: center; gap: 6px; font: 500 13.5px var(--sans); padding: 7px 13px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn.primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn.primary:hover { opacity: .9; }
.btn.danger { color: var(--bad); border-color: var(--bad); }
.btn.danger.solid { background: var(--bad); color: #fff; }
.btn.sm { padding: 3px 9px; font-size: 12.5px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

input, select, textarea { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong); border-radius: 8px; padding: 7px 10px; max-width: 100%; }
input:focus, select:focus, textarea:focus, .btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
label { display: block; font-size: 12.5px; color: var(--ink-2); margin-bottom: 4px; }
.field { margin-bottom: 12px; }
.field input, .field select, .field textarea { width: 100%; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.filters input[type=search] { min-width: 220px; }
.check { display: flex; align-items: center; gap: 8px; color: var(--ink); font-size: 14px; }

.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; }
.flash.ok { background: var(--good-bg); color: var(--good); }
.flash.error { background: var(--bad-bg); color: var(--bad); }

/* Uyarılar */
.alert { display: grid; grid-template-columns: 4px 1fr auto; gap: 14px; padding: 14px 16px 14px 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.alert + .alert { margin-top: 10px; }
.alert .bar { border-radius: 0 3px 3px 0; }
.alert.danger .bar { background: var(--bad); }
.alert.warning .bar { background: var(--warn); }
.alert.info .bar { background: var(--info); }
.alert .cat { font: 11px var(--mono); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.alert.danger .cat { color: var(--bad); }
.alert.warning .cat { color: var(--warn); }
.alert h3 { margin: 2px 0 4px; }
.alert p { margin: 0; color: var(--ink-2); font-size: 13.5px; }
.alert .side-actions { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
@media (max-width: 640px) { .alert { grid-template-columns: 4px 1fr; } .alert .side-actions { grid-column: 2; flex-direction: row; align-items: center; flex-wrap: wrap; } }

/* Aylık çubuk grafik: tek seri, baseline'a oturan 4px yuvarlatılmış uçlar, 2px boşluk, üzerine gelince ipucu. */
.chart { position: relative; }
.bars { position: relative; margin-top: 18px; padding-left: 64px; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 2px; align-items: end; height: 180px; border-bottom: 1px solid var(--line-strong); }
.bars .col { position: relative; z-index: 1; height: 100%; display: flex; align-items: flex-end; cursor: default; }
.bars .col::before { content: ""; position: absolute; inset: 0; } /* çubuktan geniş hover alanı */
.bars .b { width: 100%; max-width: 38px; margin: 0 auto; background: var(--bar); border-radius: 4px 4px 0 0; min-height: 0; transition: background .1s; }
.bars .col:hover .b, .bars .col:focus .b { background: var(--bar-hover); }
.bars .tip { display: none; position: absolute; top: -8px; left: 50%; transform: translate(-50%, -100%); background: var(--ink); color: var(--bg); padding: 6px 9px; border-radius: 6px; font-size: 12px; white-space: nowrap; z-index: 5; pointer-events: none; }
.bars .col:hover .tip, .bars .col:focus .tip { display: block; }
.axis { padding-left: 64px; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 2px; margin-top: 6px; }
.axis span { text-align: center; font: 11px var(--mono); color: var(--muted); }
.gridline { position: absolute; left: 0; right: 0; border-top: 1px dashed var(--line); pointer-events: none; }
.gridline span { position: absolute; left: 0; top: -8px; line-height: 16px; font: 11px var(--mono); color: var(--muted); }

.meter { height: 8px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 99px; overflow: hidden; }
.meter > div { height: 100%; background: var(--bar); border-radius: 99px; }
.meter.warn > div { background: var(--warn); }
.meter.bad > div { background: var(--bad); }

.share { height: 6px; background: var(--surface-2); border-radius: 99px; overflow: hidden; min-width: 60px; }
.share > div { height: 100%; border-radius: 99px; }

dl.kv { display: grid; grid-template-columns: 170px 1fr; gap: 6px 14px; margin: 0; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; word-break: break-word; }
@media (max-width: 640px) { dl.kv { grid-template-columns: 1fr; } dl.kv dt { margin-top: 6px; } }

details summary { cursor: pointer; color: var(--accent); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line-strong); margin-bottom: 16px; overflow-x: auto; }
.tabs a { padding: 8px 14px; color: var(--ink-2); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a.on { color: var(--ink); border-color: var(--ink); font-weight: 600; }
.tabs a:hover { text-decoration: none; color: var(--ink); }
.pagination { margin-top: 14px; }
.pagination nav { display: flex; gap: 6px; flex-wrap: wrap; }
.empty { padding: 28px; text-align: center; color: var(--muted); }

/* Giriş sayfası */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.auth .card { width: 100%; max-width: 380px; padding: 28px; }
.auth h1 { font-size: 24px; margin-bottom: 4px; }
.auth .qr { background: #fff; padding: 12px; border-radius: 8px; display: inline-block; }
.err { color: var(--bad); font-size: 12.5px; margin-top: 4px; }
