/* Terazi: nötr bir alet, renkli insanlar. Renk sadece kişilere ait. */

:root {
  color-scheme: light;
  --canvas: #eceee9;
  --surface: #fbfbf9;
  --surface-2: #f2f3ef;
  --ink: #151714;
  --ink-2: #4a4e48;
  --muted: #676b65;
  --line: #dcdfd8;
  --line-strong: #8a8e87;
  --grid: #e4e6e0;
  --axis: #c1c4bc;
  --digit-off: #d3d6cf;
  --danger: #b42323;
  --on-ink: #f6f7f4;
  --shadow: 0 1px 0 rgba(21, 23, 20, 0.04), 0 12px 32px -18px rgba(21, 23, 20, 0.28);

  /* Kişi renkleri: sabit sıra, doğrulandı (açık yüzey #fbfbf9) */
  --s0: #2a78d6; --s1: #eb6834; --s2: #1baf7a; --s3: #eda100;
  --s4: #e87ba4; --s5: #008300; --s6: #6250d6; --s7: #e34948;

  --font-display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --font-body: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  --radius: 14px;
  --gutter: 20px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --canvas: #0f110f;
    --surface: #181a18;
    --surface-2: #1f221f;
    --ink: #eef0eb;
    --ink-2: #b8bcb4;
    --muted: #91968e;
    --line: #2b2e2b;
    --line-strong: #6d726b;
    --grid: #252825;
    --axis: #3a3e3a;
    --digit-off: #2c302c;
    --danger: #ff8a80;
    --on-ink: #121412;
    --shadow: 0 1px 0 rgba(0, 0, 0, 0.3), 0 16px 40px -20px rgba(0, 0, 0, 0.7);
    --s0: #3987e5; --s1: #d95926; --s2: #199e70; --s3: #c98500;
    --s4: #d55181; --s5: #0ca30c; --s6: #9085e9; --s7: #e66767;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --canvas: #0f110f;
  --surface: #181a18;
  --surface-2: #1f221f;
  --ink: #eef0eb;
  --ink-2: #b8bcb4;
  --muted: #91968e;
  --line: #2b2e2b;
  --line-strong: #6d726b;
  --grid: #252825;
  --axis: #3a3e3a;
  --digit-off: #2c302c;
  --danger: #ff8a80;
  --on-ink: #121412;
  --shadow: 0 1px 0 rgba(0, 0, 0, 0.3), 0 16px 40px -20px rgba(0, 0, 0, 0.7);
  --s0: #3987e5; --s1: #d95926; --s2: #199e70; --s3: #c98500;
  --s4: #d55181; --s5: #0ca30c; --s6: #9085e9; --s7: #e66767;
}

/* Kişi rengi: panel ve grafikler slot sınıflarından okur */
[data-slot="0"] { --c: var(--s0); } [data-slot="1"] { --c: var(--s1); }
[data-slot="2"] { --c: var(--s2); } [data-slot="3"] { --c: var(--s3); }
[data-slot="4"] { --c: var(--s4); } [data-slot="5"] { --c: var(--s5); }
[data-slot="6"] { --c: var(--s6); } [data-slot="7"] { --c: var(--s7); }
.k0 { stroke: var(--s0); } .k1 { stroke: var(--s1); } .k2 { stroke: var(--s2); } .k3 { stroke: var(--s3); }
.k4 { stroke: var(--s4); } .k5 { stroke: var(--s5); } .k6 { stroke: var(--s6); } .k7 { stroke: var(--s7); }
.f0 { fill: var(--s0); } .f1 { fill: var(--s1); } .f2 { fill: var(--s2); } .f3 { fill: var(--s3); }
.f4 { fill: var(--s4); } .f5 { fill: var(--s5); } .f6 { fill: var(--s6); } .f7 { fill: var(--s7); }
.b0 { background: var(--s0); } .b1 { background: var(--s1); } .b2 { background: var(--s2); } .b3 { background: var(--s3); }
.b4 { background: var(--s4); } .b5 { background: var(--s5); } .b6 { background: var(--s6); } .b7 { background: var(--s7); }

/* ---------- Temel ---------- */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--canvas);
  color: var(--ink);
  font: 400 15px/1.5 var(--font-body);
  overflow-x: hidden;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
h1, h2, h3, p { margin: 0; }
code { font: 500 12.5px/1.4 var(--font-mono); word-break: break-all; }
/* Alt bilgi yok; son kart ekranın dibine yapışmasın */
#main { padding-bottom: 40px; }
svg { display: block; }
[hidden] { display: none !important; }

:focus { outline: none; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 6px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip {
  position: absolute; left: 12px; top: -60px; z-index: 100;
  padding: 10px 14px; background: var(--ink); color: var(--on-ink);
  border-radius: 10px; text-decoration: none; font-weight: 600;
}
.skip:focus { top: 12px; }
.muted { color: var(--muted); }

/* Tek sabit ortam katmanı: iki yarıda kişilerin renginden çok hafif bir ışık */
.env {
  position: fixed; inset: -15%; z-index: -1; pointer-events: none;
  background:
    radial-gradient(38% 46% at 24% 34%, color-mix(in oklab, var(--s0) 10%, transparent), transparent 72%),
    radial-gradient(38% 46% at 76% 30%, color-mix(in oklab, var(--s1) 10%, transparent), transparent 72%);
  animation: drift 96s ease-in-out infinite alternate;
}
@keyframes drift {
  50% { transform: translate3d(2%, 3%, 0) scale(1.04); }
  100% { transform: translate3d(-2%, 1%, 0) scale(1.02); }
}

/* ---------- Butonlar ---------- */

.btn, .chip, .seg, .icon-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  border-radius: 999px;
  transition: background-color .18s ease, border-color .18s ease, color .18s ease, transform .18s ease;
}
.btn { height: 36px; padding: 0 14px; font-weight: 600; font-size: 14px; }
.btn svg, .icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn svg circle { fill: currentColor; stroke: none; }
.btn:hover:not(:disabled), .chip:hover:not(:disabled), .seg:hover, .icon-btn:hover:not(:disabled) { background: var(--surface-2); }
.btn:active:not(:disabled), .icon-btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled, .chip:disabled, .icon-btn:disabled { opacity: .45; }
.btn-primary { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }
.btn-primary:hover:not(:disabled) { background: var(--ink-2); border-color: var(--ink-2); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: var(--on-ink); }
.btn-danger:hover:not(:disabled) { filter: brightness(1.08); background: var(--danger); }
.icon-btn { width: 36px; height: 36px; padding: 0; }
.chip { height: 32px; padding: 0 12px; font-size: 13px; font-weight: 600; }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--on-ink); border-color: var(--ink); }

/* ---------- Üst çubuk ---------- */

.topbar {
  position: sticky; top: 0; z-index: 30;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px;
  padding: 10px var(--gutter);
  background: color-mix(in oklab, var(--canvas) 84%, transparent);
  backdrop-filter: blur(12px) saturate(1.2);
  -webkit-backdrop-filter: blur(12px) saturate(1.2);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark { width: 30px; height: 30px; }
.bm-beam { fill: none; stroke: var(--ink); stroke-width: 2; stroke-linecap: round; }
.brand-name { font: 800 22px/1 var(--font-display); letter-spacing: -0.02em; }

.datebar { display: flex; align-items: center; gap: 6px; justify-self: center; }
.date-wrap { position: relative; }
.date-btn {
  display: grid; justify-items: center; gap: 1px;
  min-width: 220px; padding: 5px 18px 6px;
  border: 1px solid var(--line-strong); border-radius: 14px;
  background: var(--surface);
  transition: background-color .18s ease;
}
.date-btn:hover { background: var(--surface-2); }
.date-btn[aria-expanded="true"] { background: var(--surface-2); border-color: var(--ink); }
.date-kicker { font: 500 10.5px/1.2 var(--font-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.date-main { font: 600 17px/1.2 var(--font-display); letter-spacing: -0.01em; }

.actions { display: flex; gap: 8px; justify-self: end; }

/* ---------- Takvim ---------- */

.calendar {
  position: absolute; top: calc(100% + 8px); left: 50%; transform: translateX(-50%);
  width: 316px; padding: 14px; z-index: 40;
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: var(--shadow);
  animation: pop .18s ease-out;
}
@keyframes pop { from { opacity: 0; transform: translate(-50%, -4px); } }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.cal-title { font: 600 15px/1 var(--font-display); text-transform: capitalize; }
.cal-head .icon-btn { width: 32px; height: 32px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal-wd { text-align: center; font: 500 10.5px/2 var(--font-mono); color: var(--muted); text-transform: uppercase; }
.cal-day {
  position: relative; height: 40px; border: 1px solid transparent; border-radius: 10px;
  background: none; display: grid; place-items: center; align-content: center; gap: 2px;
  font: 500 13px/1 var(--font-body); font-variant-numeric: tabular-nums;
}
.cal-day:hover:not(:disabled) { background: var(--surface-2); }
.cal-day.is-out { color: var(--muted); opacity: .55; }
.cal-day.is-today { border-color: var(--line-strong); }
.cal-day.is-selected { background: var(--ink); color: var(--on-ink); border-color: var(--ink); }
.cal-day:disabled { opacity: .3; }
.cal-dots { display: flex; gap: 2px; height: 5px; }
.cal-dots span { width: 5px; height: 5px; border-radius: 50%; }
.cal-day.is-selected .cal-dots span { box-shadow: 0 0 0 1px var(--on-ink); }
.cal-foot { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 12px; color: var(--ink-2); }
.cal-foot span { display: inline-flex; align-items: center; gap: 5px; }
.cal-foot i { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }

/* ---------- Filtre çubuğu ---------- */

.filterbar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px 16px; flex-wrap: wrap;
  padding: 10px var(--gutter);
  border-bottom: 1px solid var(--line);
}
.range { display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.filter-label { font: 500 11px/1 var(--font-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-right: 6px; }
.seg { height: 30px; padding: 0 12px; font-size: 13px; font-weight: 600; border-color: var(--line); background: transparent; }
.seg[aria-pressed="true"] { background: var(--ink); color: var(--on-ink); border-color: var(--ink); }

.status { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line-strong); }
.status[data-state="saved"] .status-dot { background: var(--ink); }
.status[data-state="saving"] .status-dot { animation: blink 1s ease-in-out infinite; background: var(--ink-2); }
.status[data-state="error"] .status-dot { background: var(--danger); }
.status[data-state="error"] { color: var(--danger); }
@keyframes blink { 50% { opacity: .2; } }

.banner {
  margin: 12px var(--gutter) 0; padding: 12px 16px;
  border: 1px solid var(--line-strong); border-radius: 12px;
  background: var(--surface); color: var(--ink-2); font-size: 14px;
}
.banner strong { color: var(--ink); }

/* ---------- Pano: ortadan bölünmüş sayfa ---------- */

.board {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(300px, 1fr);
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x proximity;
}
.panel {
  position: relative; min-width: 0;
  padding: 0 var(--gutter) 28px;
  display: flex; flex-direction: column; gap: 14px;
  scroll-snap-align: start;
}
.panel + .panel { border-left: 1px solid var(--line); }
.board-empty { margin: 24px var(--gutter); display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.band { height: 5px; margin: 0 calc(var(--gutter) * -1); background: var(--c); }

.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-top: 12px; }
.name-row { display: flex; align-items: center; gap: 2px; min-width: 0; }
.name-wrap { position: relative; min-width: 0; }
/* Negatif margin koyma: kutunun genişliğini küçültüp ismi gereksiz yere kesiyor */
.person-name {
  display: inline-flex; align-items: center; gap: 10px; max-width: 100%;
  padding: 4px 10px 4px 4px;
  border: 0; border-radius: 10px; background: none;
  font: 800 clamp(22px, 2.4vw, 30px)/1.1 var(--font-display); letter-spacing: -0.02em;
  text-align: left;
}
.edit-name { flex: none; width: 32px; height: 32px; border-color: transparent; background: transparent; color: var(--muted); }
.edit-name svg { width: 17px; height: 17px; }
.edit-name:hover:not(:disabled) { color: var(--ink); }
.person-name:hover { background: color-mix(in oklab, var(--c) 10%, transparent); }
.name-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.swatch { flex: none; width: 14px; height: 14px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 3px color-mix(in oklab, var(--c) 22%, transparent); }

.name-tip {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 25;
  width: max-content; max-width: min(320px, 80vw);
  padding: 12px 14px; border-radius: 12px;
  background: var(--ink); color: var(--on-ink);
  box-shadow: var(--shadow);
  font-size: 13px;
  animation: tipIn .14s ease-out;
}
@keyframes tipIn { from { opacity: 0; transform: translateY(-3px); } }
.tip-title { font-weight: 600; margin-bottom: 8px; }
.tip-table { border-collapse: collapse; font-variant-numeric: tabular-nums; }
.tip-table th, .tip-table td { padding: 3px 0; text-align: right; font-weight: 400; }
.tip-table thead th { font: 500 10.5px/1.4 var(--font-mono); letter-spacing: .06em; text-transform: uppercase; opacity: .7; padding-left: 18px; }
.tip-table tbody th { text-align: left; opacity: .8; }
.tip-table tbody td { padding-left: 18px; font: 600 15px/1.3 var(--font-body); }
.tip-table .na { font-weight: 400; opacity: .55; font-size: 13px; }
.name-tip.single .tip-all { display: none; }
.tip-foot { margin-top: 8px; font-size: 12px; opacity: .7; }

.menu-wrap { position: relative; flex: none; }
.menu-btn { border-color: transparent; background: transparent; }
.menu {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 25; min-width: 180px;
  padding: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow);
}
.menu-item { display: block; width: 100%; padding: 9px 10px; border: 0; border-radius: 8px; background: none; text-align: left; font-size: 14px; }
.menu-item:hover, .menu-item:focus-visible { background: var(--surface-2); }
.menu-item.danger { color: var(--danger); }

/* İmza: dev tartı göstergesi */
.score { padding: 2px 0 4px; }
.score-num { display: flex; align-items: baseline; gap: 10px; line-height: .9; }
.score-val {
  font: 800 clamp(64px, 7.4vw, 112px)/.9 var(--font-display);
  letter-spacing: -0.045em; font-variant-numeric: lining-nums tabular-nums;
}
.score-unit { font: 500 15px/1 var(--font-mono); color: var(--muted); }
.score.is-empty .score-val { color: var(--digit-off); }
.score-delta { margin-top: 10px; font-size: 14px; color: var(--ink-2); min-height: 21px; }
.score-delta b { color: var(--ink); font-weight: 600; }

/* Kartlar */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px;
}
.card-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.card-title { font: 600 14px/1.3 var(--font-body); }
.card-head .card-title { margin-right: auto; }

.entry .card-title { margin-bottom: 12px; }
.entry-date { text-transform: none; }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; }
.field label { display: block; margin-bottom: 5px; font: 500 11px/1.2 var(--font-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.input-wrap { position: relative; }
.input-wrap input {
  width: 100%; height: 44px; padding: 0 52px 0 12px;
  border: 1px solid var(--line-strong); border-radius: 10px;
  background: var(--canvas);
  font: 600 18px/1 var(--font-body); font-variant-numeric: tabular-nums;
  transition: border-color .15s ease, background-color .15s ease, box-shadow .15s ease;
}
.input-wrap input::placeholder { color: var(--muted); opacity: .55; font-weight: 400; }
.input-wrap input:hover { border-color: var(--ink-2); }
.input-wrap input:focus { border-color: var(--ink); background: var(--surface); box-shadow: 0 0 0 3px color-mix(in oklab, var(--c) 28%, transparent); }
.input-wrap input[aria-invalid="true"] { border-color: var(--danger); }
.suffix { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font: 500 12px/1 var(--font-mono); color: var(--muted); pointer-events: none; }
.err { min-height: 0; font-size: 12.5px; color: var(--danger); }
.err:not(:empty) { margin-top: 4px; }
.field.saved .input-wrap input { animation: savedFlash .9s ease-out; }
@keyframes savedFlash { 0% { box-shadow: 0 0 0 3px color-mix(in oklab, var(--c) 45%, transparent); } 100% { box-shadow: 0 0 0 3px transparent; } }

.switch { display: inline-flex; align-items: center; gap: 10px; margin-top: 14px; cursor: pointer; user-select: none; font-weight: 600; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.track {
  position: relative; width: 46px; height: 26px; border-radius: 999px;
  background: var(--canvas); border: 1px solid var(--line-strong);
  transition: background-color .2s ease, border-color .2s ease;
}
.thumb {
  position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%;
  background: var(--line-strong);
  transition: transform .22s cubic-bezier(.3, .7, .2, 1.2), background-color .2s ease;
}
.switch input:checked + .track { background: var(--c); border-color: var(--c); }
.switch input:checked + .track .thumb { transform: translateX(20px); background: #fff; }
.switch input:focus-visible + .track { outline: 2px solid var(--ink); outline-offset: 2px; }

/* Haftalık spor listesi */
.week-count { font: 600 14px/1 var(--font-body); font-variant-numeric: tabular-nums; }
.week-range { font-size: 13px; }
.week-days { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.day { position: relative; display: grid; justify-items: center; gap: 4px; padding: 6px 0 8px; border-radius: 10px; cursor: pointer; }
.day:hover { background: var(--surface-2); }
.day.is-selected { background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line-strong); }
.day.is-disabled { opacity: .35; cursor: not-allowed; }
.day-name { font: 500 10.5px/1 var(--font-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.day-num { font: 600 13px/1 var(--font-body); font-variant-numeric: tabular-nums; }
.day.is-today .day-num { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 2px; }
.day input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.tick {
  width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center;
  border: 1.5px solid var(--line-strong); background: var(--canvas);
  transition: background-color .18s ease, border-color .18s ease, transform .18s ease;
}
.tick svg { width: 16px; height: 16px; fill: none; stroke: #fff; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 24; stroke-dashoffset: 24; transition: stroke-dashoffset .25s ease .05s; }
.day input:checked + .tick { background: var(--c); border-color: var(--c); }
.day input:checked + .tick svg { stroke-dashoffset: 0; }
.day input:focus-visible + .tick { outline: 2px solid var(--ink); outline-offset: 2px; }
.day:active:not(.is-disabled) .tick { transform: scale(.92); }

/* Grafikler */
.chart-host { position: relative; height: 220px; }
.chart-lg { height: 320px; }
.chart-svg { width: 100%; height: 100%; overflow: visible; cursor: crosshair; touch-action: pan-y; }
.chart-svg:focus-visible { outline: 2px solid var(--ink); outline-offset: 4px; }
.gridline { stroke: var(--grid); stroke-width: 1; }
.axisline { stroke: var(--axis); stroke-width: 1; }
.tick-label { font: 400 11px/1 var(--font-mono); fill: var(--muted); font-variant-numeric: tabular-nums; }
.series-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.series-dot { stroke: var(--surface); stroke-width: 2; }
.sel-line { stroke: var(--line-strong); stroke-width: 1; stroke-dasharray: 3 4; }
.cross { stroke: var(--ink-2); stroke-width: 1; }
.hl-dot { stroke: var(--surface); stroke-width: 2.5; }
.end-label { font: 600 12px/1 var(--font-body); fill: var(--ink); }
.end-key { stroke-width: 2.5; stroke-linecap: round; }
.chart-empty {
  position: absolute; inset: 0; display: grid; place-items: center; padding: 20px;
  text-align: center; color: var(--muted); font-size: 14px;
  border: 1px dashed var(--line); border-radius: 10px;
}
.chart-tip {
  position: absolute; top: 4px; z-index: 5; pointer-events: none;
  min-width: 128px; padding: 8px 10px; border-radius: 10px;
  background: var(--ink); color: var(--on-ink); box-shadow: var(--shadow);
  font-size: 12.5px;
}
.chart-tip-date { font: 500 10.5px/1.4 var(--font-mono); letter-spacing: .06em; text-transform: uppercase; opacity: .7; margin-bottom: 4px; }
.chart-tip-row { display: flex; align-items: center; gap: 8px; line-height: 1.6; }
.chart-tip-row b { font-weight: 600; font-variant-numeric: tabular-nums; }
.chart-tip-row span { opacity: .72; }
.chart-tip-row i { width: 12px; height: 2.5px; border-radius: 2px; flex: none; }
.chart-tip-hint { margin-top: 4px; font-size: 11px; opacity: .55; }

/* Kayıt geçmişi */
.log summary { display: flex; align-items: baseline; gap: 8px; cursor: pointer; list-style: none; }
.log summary::-webkit-details-marker { display: none; }
.log summary::after {
  content: ""; margin-left: auto; width: 8px; height: 8px; align-self: center;
  border-right: 1.8px solid var(--ink-2); border-bottom: 1.8px solid var(--ink-2);
  transform: rotate(45deg) translate(-2px, -2px); transition: transform .2s ease;
}
.log[open] summary::after { transform: rotate(-135deg) translate(-2px, -2px); }
.log-scroll { max-height: 320px; overflow: auto; margin-top: 10px; }
.log-table { width: 100%; border-collapse: collapse; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.log-table th { position: sticky; top: 0; background: var(--surface); text-align: right; font: 500 10.5px/1.2 var(--font-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 6px 4px; border-bottom: 1px solid var(--line); }
.log-table td { text-align: right; padding: 7px 4px; border-bottom: 1px solid var(--grid); white-space: nowrap; }
.log-table th:first-child, .log-table td:first-child { text-align: left; }
.log-table tr.is-selected td { background: var(--surface-2); }
.log-date { border: 0; background: none; padding: 2px 4px; margin: -2px -4px; border-radius: 6px; font-weight: 600; text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
.log-date:hover { background: var(--surface-2); }
.log-empty { padding: 12px 0 4px; color: var(--muted); font-size: 13.5px; }
.yes { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--c); }
.no { color: var(--muted); }

/* Karşılaştırma */
.compare {
  margin: 8px var(--gutter) 0; padding: 18px 20px 20px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 18px;
}
.compare-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px 24px; flex-wrap: wrap; margin-bottom: 14px; }
.compare h2 { font: 800 22px/1.15 var(--font-display); letter-spacing: -0.02em; }
.compare-head p { font-size: 13.5px; margin-top: 2px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13.5px; }
.legend-item { display: inline-flex; align-items: center; gap: 7px; }
.legend-key { width: 16px; height: 2.5px; border-radius: 2px; }


/* Bildirim */
.toast {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 60;
  max-width: min(520px, calc(100vw - 32px)); padding: 11px 16px; border-radius: 12px;
  background: var(--ink); color: var(--on-ink); box-shadow: var(--shadow); font-size: 14px;
  animation: toastIn .2s ease-out;
}
.toast.is-error { background: var(--danger); }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 6px); } }

/* Diyaloglar */
.dlg {
  width: min(420px, calc(100vw - 32px)); padding: 0; border: 1px solid var(--line); border-radius: 18px;
  background: var(--surface); color: var(--ink); box-shadow: var(--shadow);
}
.dlg-wide { width: min(640px, calc(100vw - 32px)); }
.dlg::backdrop { background: rgba(10, 12, 10, .42); backdrop-filter: blur(2px); }
.dlg[open] { animation: dlgIn .2s ease-out; }
@keyframes dlgIn { from { opacity: 0; transform: translateY(8px) scale(.98); } }
.dlg-body { padding: 20px 22px 22px; display: grid; gap: 10px; }
.dlg h2 { font: 800 21px/1.2 var(--font-display); letter-spacing: -0.015em; }
.dlg-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.dlg-text { color: var(--ink-2); font-size: 14.5px; }
.dlg-label { font: 500 11px/1.2 var(--font-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-top: 4px; }
.dlg-input { height: 44px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--canvas); font-size: 16px; }
.dlg-input:focus { border-color: var(--ink); background: var(--surface); }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }

.backup-tools { display: flex; flex-wrap: wrap; gap: 8px; }
.file-btn { position: relative; }
.file-btn input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.file-btn:focus-within { outline: 2px solid var(--ink); outline-offset: 2px; }
.backup-list { max-height: min(46vh, 400px); overflow: auto; border-top: 1px solid var(--line); margin-top: 4px; }
.backup-row { display: flex; align-items: center; gap: 12px; padding: 10px 2px; border-bottom: 1px solid var(--grid); }
.backup-meta { min-width: 0; flex: 1; }
.backup-when { font-weight: 600; font-size: 14px; }
.backup-file { font: 400 12px/1.4 var(--font-mono); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.backup-kind { flex: none; font: 500 10.5px/1 var(--font-mono); letter-spacing: .06em; text-transform: uppercase; padding: 5px 8px; border-radius: 999px; border: 1px solid var(--line-strong); color: var(--ink-2); }
.backup-row .btn { height: 32px; font-size: 13px; flex: none; }
.backup-empty { padding: 16px 0; color: var(--muted); }

/* ---------- Sekmeler ---------- */

.tabs {
  display: inline-flex; gap: 4px; padding: 4px; margin-right: 8px;
  border-radius: 999px; background: var(--surface); border: 1px solid var(--line);
}
.tab {
  display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 16px;
  border: 0; border-radius: 999px; background: transparent;
  font: 600 15px/1 var(--font-body); color: var(--ink-2);
  transition: background-color .18s ease, color .18s ease;
}
.tab svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.tab:hover:not([aria-selected="true"]) { background: var(--surface-2); color: var(--ink); }
.tab[aria-selected="true"] { background: var(--ink); color: var(--on-ink); }
.filterbar .range { margin-right: auto; }

.link-btn {
  border: 0; background: none; padding: 0; font: inherit; font-weight: 600; color: var(--ink);
  text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 2px;
  text-decoration-color: var(--c, var(--line-strong)); cursor: pointer;
}
.link-btn:hover { text-decoration-color: var(--ink); }

/* Günlük paneldeki hareket özeti */
.week-ex {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px;
  margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--grid);
  font-size: 13.5px; color: var(--ink-2);
}
.week-ex .link-btn { margin-left: auto; font-size: 13.5px; }

/* ---------- Antrenman ---------- */

.gym { padding: 16px var(--gutter) 8px; display: grid; gap: 16px; }
.gym-people { display: flex; flex-wrap: wrap; gap: 8px; }
.gym-person {
  display: inline-flex; align-items: center; gap: 10px; height: 44px; padding: 0 18px 0 14px;
  border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface);
  font: 800 17px/1 var(--font-display); letter-spacing: -0.01em;
  transition: background-color .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.gym-person .swatch { width: 12px; height: 12px; }
.gym-person:hover { background: var(--surface-2); }
.gym-person[aria-checked="true"] {
  border-color: var(--c); box-shadow: inset 0 0 0 1px var(--c);
  background: color-mix(in oklab, var(--c) 13%, var(--surface));
}

.gym-grid {
  display: grid; gap: 16px; align-items: start;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 410px);
  grid-template-areas: "lib side";
}
.gym-lib { grid-area: lib; min-width: 0; }
.gym-side {
  grid-area: side; display: grid; gap: 16px; align-content: start;
  position: sticky; top: 80px; max-height: calc(100vh - 96px); overflow: auto;
  overscroll-behavior: contain; scrollbar-width: thin;
}
.gym-h { font: 800 22px/1.15 var(--font-display); letter-spacing: -0.02em; }
.gym-log .card-head, .gym-hist .card-head { align-items: baseline; }
.gym-log .gym-h, .gym-hist .gym-h { margin-right: auto; font-size: 19px; }
.gym-log { border-color: color-mix(in oklab, var(--c, var(--line)) 45%, var(--line)); }
.gym-log-sub { margin: -6px 0 12px; font-size: 13px; color: var(--muted); }
.gym-log-count { font-size: 13px; }
.gym-empty { font-size: 14px; color: var(--ink-2); padding: 14px; border: 1px dashed var(--line-strong); border-radius: 12px; }

.gym-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.gym-item {
  display: grid; grid-template-columns: 60px minmax(0, 1fr) auto; gap: 12px; align-items: start;
  padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--canvas);
}
.gym-item.flash { animation: rowFlash 1.1s ease-out; }
@keyframes rowFlash { 0% { box-shadow: 0 0 0 3px color-mix(in oklab, var(--c, var(--ink)) 55%, transparent); } 100% { box-shadow: 0 0 0 3px transparent; } }
.gi-thumb {
  width: 60px; aspect-ratio: 3 / 2; border-radius: 8px; overflow: hidden;
  display: grid; place-items: center; background: var(--surface-2); color: var(--muted);
}
.gi-thumb img { width: 100%; height: 100%; object-fit: cover; }
.gi-thumb svg { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.gi-title { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; margin-bottom: 8px; }
.gi-name { font-weight: 600; font-size: 15px; }
.gi-cat { font: 500 10.5px/1.2 var(--font-mono); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.gi-fields { display: flex; flex-wrap: wrap; gap: 8px; }
.gi-field { display: grid; gap: 4px; }
.gi-label { font: 500 10.5px/1 var(--font-mono); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.gi-input { position: relative; display: block; }
.gi-input input {
  width: 78px; height: 40px; padding: 0 30px 0 10px;
  border: 1px solid var(--line-strong); border-radius: 9px; background: var(--surface);
  font: 600 16px/1 var(--font-body); font-variant-numeric: tabular-nums;
}
.gi-input input:only-child { padding-right: 10px; width: 64px; }
.gi-input input:focus { border-color: var(--ink); box-shadow: 0 0 0 3px color-mix(in oklab, var(--c, var(--ink)) 28%, transparent); }
.gi-input input[aria-invalid="true"] { border-color: var(--danger); }
.gi-input input::placeholder { color: var(--muted); opacity: .5; font-weight: 400; }
.gi-unit { position: absolute; right: 9px; top: 50%; transform: translateY(-50%); font: 500 11px/1 var(--font-mono); color: var(--muted); pointer-events: none; }
.gi-last { margin-top: 8px; font-size: 12.5px; color: var(--ink-2); }
.gi-remove { width: 32px; height: 32px; border-color: transparent; background: transparent; color: var(--muted); }
.gi-remove:hover:not(:disabled) { color: var(--danger); background: var(--surface-2); }

/* Kütüphane */
.lib-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; margin-bottom: 12px; }
.lib-head .gym-h { margin-right: auto; }
.lib-search { position: relative; flex: 1 1 260px; max-width: 440px; }
.lib-search svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; }
.lib-search input {
  width: 100%; height: 44px; padding: 0 14px 0 42px;
  border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface); font-size: 15px;
}
.lib-search input:focus { border-color: var(--ink); box-shadow: 0 0 0 3px color-mix(in oklab, var(--c, var(--ink)) 25%, transparent); }
.lib-cats { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.cat-chip { gap: 7px; }
.cat-n { font: 500 11px/1 var(--font-mono); opacity: .6; }
.lib-count { font-size: 13px; margin-bottom: 10px; }
.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(196px, 1fr)); gap: 12px; }
.lib-empty { grid-column: 1 / -1; display: grid; justify-items: center; gap: 12px; padding: 28px 16px; text-align: center; color: var(--ink-2); border: 1px dashed var(--line-strong); border-radius: 14px; }
.lib-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-top: 18px; font-size: 14px; }
.lib-credit { margin-top: 14px; font-size: 11.5px; line-height: 1.5; color: var(--muted); }
.lib-credit a { color: inherit; text-underline-offset: 2px; }
.lib-credit a:hover { color: var(--ink-2); }

.ex-card {
  display: flex; flex-direction: column; min-width: 0;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden;
  transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}
.ex-card:hover { border-color: var(--line-strong); box-shadow: var(--shadow); transform: translateY(-1px); }
.ex-card.is-added { border-color: var(--c, var(--ink)); box-shadow: inset 0 0 0 1px var(--c, var(--ink)); }
.ex-media {
  position: relative; display: block; width: 100%; aspect-ratio: 3 / 2; padding: 0;
  border: 0; border-radius: 0; background: var(--surface-2); overflow: hidden; cursor: pointer;
}
.ex-media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.ex-media .f1 { opacity: 0; }
/* İki kare: hareketin başı ve sonu. Üstüne gelince sırayla oynar. */
.ex-card:hover .ex-media .f1, .ex-card.is-playing .ex-media .f1, .ex-media:focus-visible .f1 {
  animation: exFrames 1.8s ease-in-out infinite;
}
@keyframes exFrames { 0%, 40% { opacity: 0; } 50%, 90% { opacity: 1; } 100% { opacity: 0; } }
.ex-media.single { cursor: default; }
.ex-media:not(.no-photo):not(.single)::after {
  content: "2 kare"; position: absolute; right: 8px; bottom: 8px; padding: 3px 7px; border-radius: 999px;
  background: rgba(10, 12, 10, .55); color: #fff; font: 500 10px/1 var(--font-mono); letter-spacing: .04em;
  opacity: 0; transition: opacity .18s ease;
}
.ex-card:hover .ex-media::after, .ex-card.is-playing .ex-media::after { opacity: 1; }
.ex-media.no-photo { display: grid; place-items: center; align-content: center; gap: 6px; cursor: default; color: var(--muted); }
.ex-figure svg { width: 54px; height: 54px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.ex-nophoto { font: 500 10.5px/1 var(--font-mono); letter-spacing: .06em; text-transform: uppercase; }
.ex-body { padding: 10px 12px 2px; display: grid; gap: 3px; }
.ex-name { font: 600 15px/1.25 var(--font-body); }
.ex-en { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ex-tags { font-size: 12.5px; color: var(--ink-2); }
.ex-last { font-size: 12.5px; color: var(--ink); font-weight: 600; }
.ex-last:empty { display: none; }
.ex-actions { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px 12px; }
.ex-add { height: 34px; font-size: 13.5px; }
.ex-card.is-added .ex-add { background: color-mix(in oklab, var(--c, var(--ink)) 16%, var(--surface)); border-color: var(--c, var(--ink)); }
.ex-del { font-size: 13px; color: var(--danger); text-decoration-color: currentColor; }

/* Geçmiş */
.hist-summary { font-size: 14px; color: var(--ink-2); margin-bottom: 10px; }
.hist-top { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 12px; }
.hist-top:empty { display: none; }
.hist-top-label { font: 500 10.5px/1 var(--font-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-right: 2px; }
.hist-chip { display: inline-flex; align-items: baseline; gap: 6px; padding: 5px 10px; border-radius: 999px; background: var(--surface-2); font-size: 13px; }
.hist-chip b { font-variant-numeric: tabular-nums; }
.hist-list { list-style: none; margin: 0; padding: 0; }
.hist-day { border-top: 1px solid var(--grid); padding: 8px 0 10px; }
.hist-date { display: flex; justify-content: space-between; gap: 12px; width: 100%; padding: 4px 0; border: 0; background: none; font-size: 14px; font-weight: 600; text-align: left; }
.hist-date:hover span:first-child { text-decoration: underline; text-underline-offset: 3px; }
.hist-day.is-selected .hist-date span:first-child { text-decoration: underline; text-decoration-thickness: 2px; text-decoration-color: var(--c, var(--ink)); text-underline-offset: 3px; }
.hist-date .muted { font-weight: 400; font-size: 13px; }
.hist-ex { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 3px; font-size: 13.5px; }
.hist-ex li { display: flex; justify-content: space-between; gap: 12px; }
.hist-ex-name { color: var(--ink-2); min-width: 0; }
.hist-ex-sum { white-space: nowrap; font-variant-numeric: tabular-nums; }

/* Özel hareket penceresi */
.dlg-fieldset { border: 0; padding: 0; margin: 6px 0 0; min-width: 0; }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.radio-chip { position: relative; }
.radio-chip input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.radio-chip span {
  display: inline-flex; align-items: center; height: 34px; padding: 0 12px; cursor: pointer;
  border: 1px solid var(--line-strong); border-radius: 999px; font-size: 13.5px; font-weight: 600;
}
.radio-chip input:checked + span { background: var(--ink); color: var(--on-ink); border-color: var(--ink); }
.radio-chip input:focus-visible + span { outline: 2px solid var(--ink); outline-offset: 2px; }

@media (max-width: 960px) {
  .gym-grid { grid-template-columns: minmax(0, 1fr); grid-template-areas: "log" "lib" "hist"; }
  .gym-side { display: contents; }
  .gym-log { grid-area: log; }
  .gym-hist { grid-area: hist; }
}

/* ---------- Duyarlı yerleşim ---------- */

@media (max-width: 1080px) {
  .topbar { grid-template-columns: 1fr auto; }
  .datebar { grid-column: 1 / -1; grid-row: 2; }
}

@media (max-width: 760px) {
  :root { --gutter: 16px; }
  .board { grid-auto-flow: row; grid-auto-columns: auto; overflow-x: visible; }
  .panel + .panel { border-left: 0; border-top: 1px solid var(--line); margin-top: 8px; }
  .date-btn { min-width: 0; flex: 1; }
  .datebar { width: 100%; }
  .date-wrap { flex: 1; display: flex; }
  .actions .btn { padding: 0 10px; }
  .calendar { left: 50%; width: min(316px, calc(100vw - 32px)); }
  .chart-lg { height: 260px; }
  .compare { padding: 16px 14px; }
}

@media (max-width: 420px) {
  .actions .btn-label-long { display: none; }
  .brand-name { font-size: 20px; }
  .fields { grid-template-columns: 1fr 1fr; }
  .fields .field:first-child { grid-column: 1 / -1; }
}

@media (max-width: 520px) {
  .lib-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .ex-body { padding: 8px 10px 2px; }
  .ex-actions { padding: 8px 10px 10px; flex-wrap: wrap; }
  .ex-add { width: 100%; }
  .gym-item { grid-template-columns: 48px minmax(0, 1fr) auto; gap: 10px; }
  .gi-thumb { width: 48px; }
  .gi-input input { width: 70px; }
  .tabs { width: 100%; margin-right: 0; }
  .tab { flex: 1; justify-content: center; }
}

@media (pointer: coarse) {
  .btn, .chip, .seg, .tab { min-height: 44px; }
  .icon-btn { min-width: 44px; min-height: 44px; }
  .cal-day { height: 44px; }
  .ex-add { min-height: 44px; }
  .gi-input input { height: 44px; }
  .radio-chip span { height: 44px; }
  .week-ex .link-btn, .ex-del { min-height: 44px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .env { animation: none; }
  /* Oynatma yok: üstüne gelince ikinci kare sabit görünsün */
  .ex-card:hover .ex-media .f1, .ex-card.is-playing .ex-media .f1, .ex-media:focus-visible .f1 { animation: none !important; opacity: 1; }
  .ex-card:hover { transform: none; }
}

@media (forced-colors: active) {
  .series-line { stroke: CanvasText; }
  .tick, .track { border-color: CanvasText; }
}
