:root {
  --bg: #f6f7fb; --card: #ffffff; --text: #1c1f2a; --muted: #6b7183; --line: #e4e6ef;
  --accent: #7c3aed; --accent-soft: #efe9fe; --danger: #dc2626; --danger-soft: #fdecec;
  --warn: #b45309; --warn-soft: #fef3e2; --ok: #15803d; --ok-soft: #e7f6ec;
  --radius: 14px; --shadow: 0 1px 2px rgba(20,24,40,.06), 0 2px 8px rgba(20,24,40,.04);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a0a12; --card: #16161f; --text: #e8eaf2; --muted: #9aa0b4; --line: #2a2a38;
    --accent: #a78bfa; --accent-soft: #2a2145; --danger: #f87171; --danger-soft: #3a1d1f;
    --warn: #fbbf24; --warn-soft: #3a2f16; --ok: #4ade80; --ok-soft: #173123;
    --shadow: none; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }

.app { display: flex; min-height: 100vh; min-height: 100dvh; }
main { flex: 1; min-width: 0; padding: calc(16px + env(safe-area-inset-top)) 16px 96px; max-width: 980px; margin: 0 auto; }

/* Gezinme: masaüstünde yan menü, telefonda alt bar */
.tabs { position: sticky; top: 0; height: 100vh; height: 100dvh; width: calc(210px + env(safe-area-inset-left)); flex-shrink: 0;
  padding: calc(20px + env(safe-area-inset-top)) 12px 20px calc(12px + env(safe-area-inset-left));
  background: var(--card); border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; }
.brand { font-weight: 700; font-size: 18px; padding: 4px 12px 16px; }
.tabs button { display: flex; align-items: center; gap: 10px; border: 0; background: none; padding: 10px 12px;
  border-radius: 10px; cursor: pointer; text-align: left; color: var(--muted); }
.tabs button:hover { background: var(--bg); }
.tabs button.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.ic { font-size: 18px; }
@media (max-width: 760px) {
  .app { display: block; }
  .tabs { position: fixed; top: auto; bottom: 0; left: 0; right: 0; height: auto; width: auto; z-index: 10;
    flex-direction: row; padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); border-right: 0; border-top: 1px solid var(--line); }
  .brand { display: none; }
  .tabs button { flex: 1; min-width: 0; flex-direction: column; gap: 2px; padding: 6px 0; font-size: 10.5px; text-align: center; }
}
main { padding-right: calc(16px + env(safe-area-inset-right)); }
/* iPad dikey/yatay: yan menü biraz daralır, içerik genişler */
@media (min-width: 761px) and (max-width: 1100px) {
  .tabs { width: calc(180px + env(safe-area-inset-left)); }
  main { padding-left: 20px; padding-right: calc(20px + env(safe-area-inset-right)); }
}
/* Dokunmatik ekranlar (iPhone, iPad): daha büyük dokunma alanları */
@media (pointer: coarse) {
  .btn { min-height: 40px; }
  .btn.sm { min-height: 34px; padding: 6px 12px; }
  .icon-btn { padding: 10px; }
  .chip { padding: 8px 14px; }
  .tabs button { min-height: 44px; }
  input, select, textarea { font-size: 16px; } /* iOS'ta odaklanınca yakınlaştırmayı engeller */
}
@media (hover: none) { .tabs button:hover, .icon-btn:hover { background: none; } .tabs button.active { background: var(--accent-soft); } }


h1 { font-size: 24px; margin: 4px 0 2px; }
h2 { font-size: 16px; margin: 0 0 10px; }
.sub { color: var(--muted); margin: 0 0 18px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); margin-bottom: 14px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; }
.grid2 > .card { margin-bottom: 0; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.empty { color: var(--muted); text-align: center; padding: 18px 8px; }

.btn { border: 1px solid var(--line); background: var(--card); padding: 8px 14px; border-radius: 10px; cursor: pointer; }
.btn:hover { border-color: var(--accent); }
a.btn { text-decoration: none; color: inherit; display: inline-flex; align-items: center; }
.btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 600; }
.btn.danger { color: var(--danger); }
.btn.sm { padding: 4px 10px; font-size: 13px; }
.icon-btn { border: 0; background: none; cursor: pointer; padding: 6px; border-radius: 8px; color: var(--muted); font-size: 15px; }
.icon-btn:hover { background: var(--bg); color: var(--text); }
.row-actions { display: flex; gap: 2px; }

.list { list-style: none; margin: 0; padding: 0; }
.item { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.item:first-child { border-top: 0; }
.item .grow { flex: 1; min-width: 0; }
.item .title { font-weight: 600; overflow-wrap: anywhere; }
.done .title { text-decoration: line-through; color: var(--muted); }
.dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.bar { width: 4px; align-self: stretch; border-radius: 4px; flex-shrink: 0; }
.time { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 13px; min-width: 88px; }

.badge { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 99px; background: var(--bg); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; }
.badge.danger { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.badge.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.badge.accent { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.now { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 8px; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.chip { border: 1px solid var(--line); background: var(--card); border-radius: 99px; padding: 5px 12px; cursor: pointer; font-size: 13px; }
.chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }

table { width: 100%; border-collapse: collapse; }
td, th { padding: 8px 6px; border-top: 1px solid var(--line); text-align: left; }
th { font-size: 12px; color: var(--muted); font-weight: 600; border-top: 0; }

/* Formlar */
label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 4px; }
input, select, textarea { width: 100%; padding: 9px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--accent); flex-shrink: 0; }
input[type=color] { padding: 2px; height: 40px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form-row > div > label { margin-top: 10px; }
textarea { min-height: 70px; resize: vertical; }
pre { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px; overflow-x: auto; font-size: 12px; white-space: pre; }

dialog { border: 0; border-radius: 18px; padding: 0; width: min(460px, calc(100vw - 32px)); background: var(--card); color: var(--text); box-shadow: 0 20px 60px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(10,12,20,.45); }
dialog form { padding: 20px; max-height: 85vh; overflow-y: auto; }
dialog h2 { font-size: 18px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; flex-wrap: wrap; }
.modal-actions .left { margin-right: auto; }

.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(84px + env(safe-area-inset-bottom)); background: var(--text); color: var(--bg);
  padding: 10px 16px; border-radius: 10px; z-index: 50; font-size: 14px; max-width: calc(100vw - 32px); }
@media (min-width: 761px) { .toast { bottom: 24px; } }
.sync-pill { font-size: 12px; }
.caps-warning { margin-top: 6px; font-size: 13px; font-weight: 600; color: var(--warn); background: var(--warn-soft); padding: 6px 10px; border-radius: 8px; display: inline-block; }
.caps-warning[hidden] { display: none; }
label.check { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 14px; margin-top: 12px; cursor: pointer; }

/* ---------- Takviyem ---------- */
.big { font-size: 34px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.progress { height: 8px; background: var(--bg); border-radius: 99px; overflow: hidden; margin-top: 8px; border: 1px solid var(--line); }
.progress > i { display: block; height: 100%; background: var(--accent); transition: width .25s; }
.progress.warn > i { background: var(--warn); }
.progress.danger > i { background: var(--danger); }

.daynav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0 0 16px; }
.daynav .when { font-weight: 600; min-width: 0; }
.summary { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.summary .grow { flex: 1; min-width: 180px; }

.slot-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.slot-head h2 { margin: 0; flex: 1; }
.slot-head .time { min-width: 0; }
.take { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); cursor: pointer; user-select: none; -webkit-user-select: none; }
.take:first-of-type { border-top: 0; }
.take .grow { flex: 1; min-width: 0; }
.take .title { font-weight: 600; overflow-wrap: anywhere; }
.tick { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--line); flex-shrink: 0; display: grid; place-items: center;
  font-size: 16px; color: transparent; background: var(--card); transition: background .15s, border-color .15s; }
.take.taken .tick { background: var(--accent); border-color: var(--accent); color: #fff; }
.take.taken .title { color: var(--muted); }
.take:hover .tick { border-color: var(--accent); }
@media (pointer: coarse) { .tick { width: 34px; height: 34px; } .take { padding: 12px 0; } }

.supp-ic { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; font-size: 20px; flex-shrink: 0; }
.item.paused { opacity: .6; }
.cat-pills { display: flex; gap: 6px; flex-wrap: wrap; }

/* Seçim kutucukları (zamanlar, günler) */
.pickers { display: flex; gap: 6px; flex-wrap: wrap; }
.pick { position: relative; }
.pick input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.pick span { display: inline-block; border: 1px solid var(--line); background: var(--bg); border-radius: 99px; padding: 6px 12px; font-size: 13px; cursor: pointer; }
.pick input:checked + span { background: var(--accent); border-color: var(--accent); color: #fff; }
.pick input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (pointer: coarse) { .pick span { padding: 9px 14px; } }

.presets { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.preset { display: flex; align-items: center; gap: 8px; text-align: left; border: 1px solid var(--line); background: var(--bg); border-radius: 12px; padding: 10px; cursor: pointer; }
.preset:hover { border-color: var(--accent); }
.preset small { display: block; color: var(--muted); font-size: 12px; }

/* Takvim */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.cal .wd { font-size: 12px; color: var(--muted); text-align: center; font-weight: 600; }
.cal button { aspect-ratio: 1; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); cursor: pointer; padding: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-variant-numeric: tabular-nums; min-width: 0; }
.cal button small { font-size: 10px; color: var(--muted); }
.cal button.full { background: var(--accent); border-color: var(--accent); color: #fff; }
.cal button.full small { color: #fff; opacity: .85; }
.cal button.part { background: var(--warn-soft); border-color: transparent; color: var(--warn); }
.cal button.none { background: var(--danger-soft); border-color: transparent; color: var(--danger); }
.cal button.today { outline: 2px solid var(--accent); outline-offset: 1px; }
.cal button:disabled { cursor: default; opacity: .45; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 10px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.stat-row { display: grid; grid-template-columns: minmax(0, 1fr) 120px 48px; gap: 10px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); }
.stat-row:first-child { border-top: 0; }
.stat-row .progress { margin-top: 0; }
.stat-row b { text-align: right; font-variant-numeric: tabular-nums; }
.week-dots { display: flex; gap: 4px; }
.week-dots i { width: 10px; height: 10px; border-radius: 3px; background: var(--line); }
.week-dots i.y { background: var(--accent); }
.week-dots i.n { background: var(--danger); opacity: .55; }
.time-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 0 12px; }
.brand { display: flex; align-items: center; gap: 10px; } .logo { width: 30px; height: 30px; border-radius: 8px; }
