/* ============================================================================
   ŞANTİYE TAKİP — Koyu Füme Tema
   Renk token'ları dataviz skill'inin doğrulanmış koyu mod paletinden alınmıştır.
   ============================================================================ */

:root {
  color-scheme: dark;

  /* Yüzeyler */
  --plane:        #0d0d0d;
  --surface:      #1a1a19;
  --surface-2:    #212120;
  --surface-3:    #292927;
  --border:       rgba(255,255,255,0.10);
  --border-strong: rgba(255,255,255,0.16);

  /* Mürekkep */
  --ink-primary:   #ffffff;
  --ink-secondary: #c3c2b7;
  --ink-muted:     #898781;
  --gridline:      #2c2c2a;
  --baseline:      #383835;

  /* Marka / vurgu */
  --accent:        var(--series-1);
  --accent-strong: var(--series-1);
  --accent-wash:   color-mix(in srgb, var(--series-1) 14%, transparent);

  /* Kategorik (dataviz — sabit sıra) */
  --series-1: var(--series-1); /* mavi */
  --series-2: #d95926; /* turuncu */
  --series-3: #199e70; /* açık deniz yeşili */
  --series-4: #c98500; /* sarı */
  --series-5: #d55181; /* macenta */
  --series-6: #008300; /* yeşil */
  --series-7: #9085e9; /* mor */
  --series-8: #e66767; /* kırmızı */

  /* Durum */
  --good:     var(--good);
  --warning:  var(--warning);
  --serious:  #ec835a;
  --critical: var(--critical);

  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--plane);
  color: var(--ink-primary);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
h1,h2,h3,h4,p { margin: 0; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
input, textarea, select {
  font-family: inherit;
  font-size: 15px;
  color: var(--ink-primary);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  outline: none;
  width: 100%;
  transition: border-color .15s ease, background .15s ease;
}
input::placeholder, textarea::placeholder { color: var(--ink-muted); }
input:focus, textarea:focus, select:focus {
  border-color: var(--accent);
  background: var(--surface-3);
}
label { font-size: 13px; color: var(--ink-secondary); font-weight: 500; display: block; margin: 0 0 6px 2px; }
.field { margin-bottom: 14px; }
.tabular { font-variant-numeric: tabular-nums; }

/* ---------- Layout shell ---------- */
#app { min-height: 100%; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px;
  padding-top: max(14px, env(safe-area-inset-top));
  background: rgba(13,13,13,0.72);
  backdrop-filter: blur(20px) saturate(150%);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  border-bottom: 1px solid var(--border);
}
.topbar .title-group { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.topbar h1 { font-size: 16px; font-weight: 650; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .subtitle { font-size: 12px; color: var(--ink-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .role-chip { max-width: 42%; overflow: hidden; }
.role-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--surface-2); border: 1px solid var(--border);
  padding: 6px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 600;
  color: var(--ink-secondary); white-space: nowrap;
  font-family: inherit;
}
button.role-chip { cursor: pointer; }
button.role-chip:hover { background: var(--surface-3); color: var(--ink-primary); }

/* Üst bardaki ok yeterince görünmediği için, altında yazılı bir dönüş şeridi.
   Hedefi açıkça söyler: "Yönetim Paneli" / "Ana Ekranım". */
.back-strip {
  display: flex; align-items: center; gap: 7px;
  max-width: 880px; width: 100%; margin: 0 auto;
  padding: 9px 18px;
  font-size: 12.5px; font-weight: 600; color: var(--ink-secondary);
  background: var(--surface); border-bottom: 1px solid var(--border);
  text-decoration: none;
}
.back-strip:hover { color: var(--ink-primary); background: var(--surface-2); }
.back-strip svg { opacity: .75; }

/* Bilgilendirme şeridi (örn. eski link uyarısı) */
.notice-strip {
  display: flex; align-items: flex-start; gap: 9px;
  max-width: 880px; width: 100%; margin: 0 auto;
  padding: 11px 18px; font-size: 12.5px; line-height: 1.5;
  color: #f0c96a; background: color-mix(in srgb, var(--warning) 9%, transparent);
  border-bottom: 1px solid color-mix(in srgb, var(--warning) 22%, transparent);
}
.notice-strip svg { flex-shrink: 0; margin-top: 1px; }

main.content {
  flex: 1;
  max-width: 880px;
  width: 100%;
  margin: 0 auto;
  padding: 18px 16px 100px;
}

.progress.good > span { background: var(--good); }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; justify-content: center;
  padding: 8px max(8px, env(safe-area-inset-left)) max(8px, env(safe-area-inset-bottom));
  background: rgba(13,13,13,0.78);
  backdrop-filter: blur(20px) saturate(150%);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  border-top: 1px solid var(--border);
}
.tabbar-inner { display: flex; gap: 2px; max-width: 880px; width: 100%; overflow-x: auto; scrollbar-width: none; }
.tabbar-inner::-webkit-scrollbar { display: none; }
.tab-btn {
  flex: 1; min-width: 64px;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 7px 6px 6px; border: none; background: transparent; cursor: pointer;
  color: var(--ink-muted); border-radius: var(--radius-sm);
  transition: color .15s ease;
}
.tab-btn .ic { display: flex; align-items: center; justify-content: center; height: 20px; }
.tab-btn .lb { font-size: 10.5px; font-weight: 600; letter-spacing: -0.01em; }
.tab-btn.active { color: var(--accent-strong); }

@media (min-width: 760px) {
  main.content { padding-bottom: 40px; }
  .tabbar { position: static; background: transparent; backdrop-filter: none; border-top: none; padding: 0; margin: 0 auto 8px; }
  .tabbar-inner {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md);
    padding: 5px; margin: 14px auto 0; max-width: 880px;
  }
  .tab-btn { flex-direction: row; padding: 9px 14px; }
  .tab-btn.active { background: var(--surface-3); color: var(--ink-primary); }
}

/* ---------- Cards / primitives ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
}
.card + .card { margin-top: 12px; }
.section-title {
  font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--ink-muted); margin: 22px 2px 10px;
}
.section-title:first-child { margin-top: 0; }

.grid { display: grid; gap: 12px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 520px) {
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  /* Dar ekranda 3 kutucuk 2+1 olarak sarıyor — tek kalan kutucuk satırı doldursun */
  .grid-3 > :nth-child(3):nth-last-child(1) { grid-column: 1 / -1; }
}

.stat-tile {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 15px 16px;
}
.stat-tile .label { font-size: 12px; color: var(--ink-muted); font-weight: 600; margin-bottom: 6px; }
.stat-tile .value { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
.stat-tile .delta { font-size: 12px; margin-top: 5px; font-weight: 600; }
.stat-tile .delta.good { color: var(--good); }
.stat-tile .delta.warn { color: var(--warning); }
.stat-tile .delta.bad { color: var(--critical); }
.stat-tile.accent { background: linear-gradient(155deg, var(--accent-wash), var(--surface) 60%); border-color: color-mix(in srgb, var(--series-1) 35%, transparent); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: none; border-radius: 999px; padding: 11px 18px;
  font-size: 14.5px; font-weight: 650; cursor: pointer;
  transition: transform .08s ease, opacity .15s ease, background .15s ease;
  white-space: nowrap;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-strong); }
.btn-ghost { background: var(--surface-2); color: var(--ink-primary); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--surface-3); }
.btn-danger { background: color-mix(in srgb, var(--critical) 16%, transparent); color: #ff8a8a; }
.btn-sm { padding: 7px 13px; font-size: 13px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: 0.45; pointer-events: none; }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; font-weight: 700; padding: 4px 9px; border-radius: 999px;
  letter-spacing: 0.01em;
}
.badge-good { background: color-mix(in srgb, var(--good) 16%, transparent); color: var(--good); }
.badge-warn { background: color-mix(in srgb, var(--warning) 16%, transparent); color: var(--warning); }
.badge-serious { background: color-mix(in srgb, var(--serious) 18%, transparent); color: #ff9d76; }
.badge-critical { background: color-mix(in srgb, var(--critical) 18%, transparent); color: var(--critical); }
.badge-neutral { background: var(--surface-3); color: var(--ink-secondary); }

hr.sep { border: none; border-top: 1px solid var(--border); margin: 14px 0; }

.list-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 13px 0; border-bottom: 1px solid var(--border);
}
.list-row:last-child { border-bottom: none; }
.list-row .main { min-width: 0; }
.list-row .main .t1 {
  font-size: 14.5px; font-weight: 600; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; overflow-wrap: anywhere;
}
.list-row .main .t1 .badge { vertical-align: middle; }
.list-row .main .t2 { font-size: 12.5px; color: var(--ink-muted); margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Tek satırda kalması gereken yerler için */
.list-row .main .t1.one-line { display: block; white-space: nowrap; text-overflow: ellipsis; }
.list-row .side { text-align: right; flex-shrink: 0; }
.list-row .side .amt { font-size: 14.5px; font-weight: 700; }
.list-row .side .sub { font-size: 11.5px; color: var(--ink-muted); }

.empty-state {
  text-align: center; padding: 46px 16px; color: var(--ink-muted);
}
.empty-state .ic { display: flex; justify-content: center; margin-bottom: 12px; opacity: .5; }
.empty-state .t { font-size: 14.5px; font-weight: 600; color: var(--ink-secondary); margin-bottom: 4px; }
.empty-state .d { font-size: 13px; }

.fab {
  position: fixed; right: 18px; bottom: 92px; z-index: 25;
  width: 54px; height: 54px; border-radius: 50%;
  background: var(--accent); color: #fff; border: none;
  font-size: 26px; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 24px color-mix(in srgb, var(--series-1) 45%, transparent);
  cursor: pointer;
}
@media (min-width: 760px) { .fab { bottom: 34px; } }

/* Progress bar */
.progress { height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--accent); border-radius: 999px; transition: width .4s ease; }
.progress.over > span { background: var(--critical); }

/* Modal / sheet */
.sheet-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.55); z-index: 50;
  display: flex; align-items: flex-end; justify-content: center;
  opacity: 0; transition: opacity .18s ease;
}
/* Onay penceresi açık bir sheet'in üzerine açılabilir — üstte kalsın. */
.sheet-backdrop ~ .sheet-backdrop { z-index: 60; background: rgba(0,0,0,0.62); }
.sheet-backdrop ~ .sheet-backdrop ~ .sheet-backdrop { z-index: 70; }
.sheet-backdrop.show { opacity: 1; }
.sheet {
  background: var(--surface-2); border: 1px solid var(--border-strong);
  border-radius: 22px 22px 0 0; width: 100%; max-width: 560px;
  max-height: 88vh; overflow-y: auto; padding: 18px 18px max(18px, env(safe-area-inset-bottom));
  transform: translateY(24px); transition: transform .2s ease;
}
.sheet-backdrop.show .sheet { transform: translateY(0); }
@media (min-width: 640px) {
  .sheet-backdrop { align-items: center; }
  .sheet { border-radius: 22px; }
}
.sheet-handle { width: 36px; height: 4px; background: var(--border-strong); border-radius: 99px; margin: 0 auto 14px; }
.sheet-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.sheet-header h3 { font-size: 17px; font-weight: 700; }
.sheet-close { background: var(--surface-3); border: none; color: var(--ink-secondary); width: 30px; height: 30px; border-radius: 50%; font-size: 16px; cursor: pointer; }
.sheet-actions { display: flex; gap: 10px; margin-top: 18px; }

/* Toast */
#toast-host { position: fixed; top: max(14px, env(safe-area-inset-top)); left: 0; right: 0; z-index: 90; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast {
  background: var(--surface-3); border: 1px solid var(--border-strong); color: var(--ink-primary);
  padding: 11px 18px; border-radius: 999px; font-size: 13.5px; font-weight: 600;
  box-shadow: 0 10px 30px rgba(0,0,0,0.4);
  opacity: 0; transform: translateY(-10px); transition: all .25s ease;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast-error { background: color-mix(in srgb, var(--critical) 90%, transparent); }
.toast-success { background: color-mix(in srgb, var(--good) 85%, transparent); }

/* Access gate */
.gate-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.gate-card { max-width: 380px; width: 100%; text-align: center; }
.gate-logo { display: flex; justify-content: center; margin-bottom: 16px; opacity: .55; }

/* Chart bits */
.chart-legend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 12px; }
.chart-legend .item { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-secondary); }
.chart-legend .dot { width: 9px; height: 9px; border-radius: 3px; flex-shrink: 0; }
.chart-tooltip {
  position: absolute; pointer-events: none; background: var(--surface-3);
  border: 1px solid var(--border-strong); border-radius: 10px; padding: 8px 11px;
  font-size: 12.5px; box-shadow: 0 8px 20px rgba(0,0,0,0.45); z-index: 5; white-space: nowrap;
}
.chart-tooltip .tt-t { color: var(--ink-muted); font-size: 11px; margin-bottom: 2px; }
.chart-tooltip .tt-v { font-weight: 700; }

/* Photo thumbs */
.photo-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.photo-row img { width: 64px; height: 64px; object-fit: cover; border-radius: 10px; border: 1px solid var(--border); }

.skeleton { background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 37%, var(--surface-2) 63%); background-size: 400% 100%; animation: shimmer 1.4s ease infinite; border-radius: var(--radius-sm); }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }

.link-copy-row { display: flex; align-items: center; gap: 8px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; margin-bottom: 8px; }
.link-copy-row .role-lb { font-size: 12px; font-weight: 700; color: var(--ink-secondary); min-width: 78px; }
.link-copy-row .url { flex: 1; font-size: 12px; color: var(--ink-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.avatar-role { width: 34px; height: 34px; border-radius: 10px; background: var(--surface-3); display: flex; align-items: center; justify-content: center; font-size: 16px; flex-shrink: 0; }

.pill-tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; margin-bottom: 4px; scrollbar-width: none; }
.pill-tabs::-webkit-scrollbar { display: none; }
.pill-tab { flex-shrink: 0; padding: 7px 13px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); color: var(--ink-secondary); font-size: 12.5px; font-weight: 650; cursor: pointer; }
.pill-tab.active { background: var(--accent); color: #fff; border-color: transparent; }

.spinner { width: 22px; height: 22px; border-radius: 50%; border: 2.5px solid var(--border-strong); border-top-color: var(--accent); animation: spin .7s linear infinite; margin: 40px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

.center-screen { min-height: 70vh; display: flex; align-items: center; justify-content: center; }

/* ---------- Bildirim paneli ---------- */
.notify-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 13px 15px;
  margin-bottom: 16px;
}
.notify-panel.notify-empty { background: var(--surface); }
.notify-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-bottom: 10px;
}
.notify-title {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  color: var(--ink-secondary);
}
.notify-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  color: var(--plane);
  font-size: 11px; font-weight: 800; letter-spacing: 0;
}
.notify-toggle {
  background: none; border: none; cursor: pointer;
  font-size: 11.5px; font-weight: 650; color: var(--ink-muted);
  padding: 3px 2px;
}
.notify-toggle:hover { color: var(--ink-primary); }
.notify-empty .notify-head { margin-bottom: 4px; }
.notify-emptytext { font-size: 12.5px; color: var(--ink-muted); }

.notify-list { display: flex; flex-direction: column; }
.notify-row {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 9px 0;
  border-top: 1px solid var(--border);
}
.notify-row:first-child { border-top: none; padding-top: 2px; }
.notify-ic { display: flex; flex-shrink: 0; margin-top: 1px; }
.notify-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.notify-t {
  font-size: 13.5px; font-weight: 620; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; overflow-wrap: anywhere;
}
.notify-d {
  font-size: 12px; color: var(--ink-muted); line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden;
}
.notify-time { font-size: 11px; color: var(--ink-muted); flex-shrink: 0; margin-top: 2px; }
.notify-more {
  font-size: 11.5px; color: var(--ink-muted); text-align: center;
  padding-top: 9px; margin-top: 4px; border-top: 1px solid var(--border);
}

/* Hızlı işlem butonları (saha mesai giriş/çıkış vb.) */
.quick-actions { display: flex; gap: 10px; margin-bottom: 16px; }
.quick-btn {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 15px 10px; border-radius: var(--radius-md);
  background: var(--surface); border: 1px solid var(--border);
  color: var(--ink-primary); font-family: inherit; font-size: 12.5px; font-weight: 650;
  cursor: pointer; transition: background .15s ease, transform .08s ease;
}
.quick-btn:active { transform: scale(.97); }
.quick-btn:hover { background: var(--surface-3); }
.quick-btn.on { border-color: color-mix(in srgb, var(--good) 40%, transparent); background: color-mix(in srgb, var(--good) 8%, transparent); }
.quick-btn.off { border-color: color-mix(in srgb, var(--warning) 40%, transparent); background: color-mix(in srgb, var(--warning) 7%, transparent); }
