:root {
  --bg: #fff6ec; --card: #ffffff; --ink: #2b1f19; --muted: #85746a; --line: #f0dfcf;
  --accent: #d4470f; --accent-ink: #ffffff; --accent-soft: #ffe6d6;
  --teal: #13806f;
  --ok: #2c9a5f; --ok-soft: #dff4e8; --warn: #b9780a; --warn-soft: #fff0cf;
  --bad: #c4392d; --bad-soft: #fde3df; --wa: #17803d;
  --shadow: 0 1px 0 rgba(43, 31, 25, .04), 0 8px 24px rgba(120, 70, 30, .08);
  --r: 18px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17110e; --card: #241a15; --ink: #f7ece3; --muted: #b9a698; --line: #3b2c23;
    --accent: #ff7a3d; --accent-ink: #2b1208; --accent-soft: #4a2a1a;
    --teal: #35b9a4;
    --ok: #4cc58a; --ok-soft: #163626; --warn: #f2b445; --warn-soft: #44340f;
    --bad: #ef7468; --bad-soft: #47201c; --wa: #3dd17a;
    --shadow: none;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { background: var(--bg); }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.45 ui-rounded, "SF Pro Rounded", "Nunito", "Segoe UI", system-ui, sans-serif;
  padding-bottom: calc(88px + env(safe-area-inset-bottom));
}
#app { max-width: 520px; margin: 0 auto; padding: 0 16px; }
h1, h2 { margin: 0; line-height: 1.2; }
h1 { font-size: 1.7rem; }
h2 { font-size: 1.1rem; margin-bottom: 10px; }
h2 em, .field em { font-style: normal; color: var(--muted); font-weight: 500; font-size: .85em; }
p { margin: 0 0 10px; }
.loading { text-align: center; color: var(--muted); padding: 40vh 0; }
.hint, small { color: var(--muted); font-size: .85rem; }
small.ok { color: var(--ok); font-weight: 600; }
.err { color: var(--bad); font-weight: 600; }

/* Üst başlık */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 0 12px; }
.brand { font-weight: 800; font-size: 1.15rem; }
.slogan { color: var(--accent); font-weight: 700; }
.pill {
  background: var(--accent-soft); color: var(--accent); border-radius: 999px;
  padding: 6px 14px; font-size: 1.05rem; white-space: nowrap;
}

/* Kartlar */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r);
  padding: 16px; margin-bottom: 14px; box-shadow: var(--shadow);
}
.card.success { background: var(--ok-soft); border-color: transparent; }
.pop { animation: pop .35s ease-out; }
@keyframes pop { from { transform: scale(.96); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .pop { animation: none; } }

.hero { display: grid; gap: 10px; }
.hero-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.big { font-size: 2.6rem; font-weight: 800; line-height: 1; color: var(--accent); }
.of { color: var(--muted); margin-left: 6px; font-weight: 600; }
.bar { height: 10px; background: var(--line); border-radius: 999px; overflow: hidden; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, #ff9a4d, var(--accent)); border-radius: 999px; transition: width .4s; }
.bar.teal i { background: var(--teal); }

.note { border-radius: 14px; padding: 10px 14px; margin-bottom: 14px; font-weight: 600; background: var(--warn-soft); color: var(--warn); }

/* Giriş */
.login { padding: 8vh 0 24px; text-align: center; }
.login .logo { font-size: 3.4rem; }
.login h1 { margin: 8px 0 4px; }
.login .slogan { font-size: 1.1rem; margin-bottom: 22px; }
.login .card { text-align: left; }

/* Form */
label { display: block; font-weight: 700; margin-bottom: 14px; }
label input, .field input {
  display: block; width: 100%; margin-top: 6px; padding: 14px; font: inherit; font-size: 1.1rem;
  color: var(--ink); background: var(--bg); border: 2px solid var(--line); border-radius: 14px;
}
input:focus-visible, button:focus-visible, a:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.field { margin-bottom: 16px; }
.field > span { display: block; font-weight: 700; }
.steps-row { display: flex; gap: 8px; align-items: stretch; }
.steps-row input { margin-top: 6px; }
.steps-row .chip { margin-top: 6px; white-space: nowrap; }

.btn {
  display: block; width: 100%; border: 0; border-radius: 16px; padding: 15px 18px; font: inherit; font-weight: 800;
  font-size: 1.05rem; background: var(--accent); color: var(--accent-ink); cursor: pointer; text-align: center; text-decoration: none;
}
.btn:active { transform: scale(.98); }
.btn[disabled] { opacity: .6; }
.btn.big { padding: 18px; font-size: 1.2rem; }
.btn.ghost { background: transparent; color: var(--ink); border: 2px solid var(--line); }
.btn.wa { background: var(--wa); color: #fff; }
@media (prefers-color-scheme: dark) { .btn.wa { color: #06210f; } }
.btn.small { width: auto; padding: 8px 14px; font-size: .9rem; border-radius: 12px; }
.stack { display: grid; gap: 10px; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }
.row.between { align-items: center; justify-content: space-between; margin-bottom: 8px; }
.row.between > * { flex: initial; }

.toggle {
  display: flex; align-items: center; gap: 12px; width: 100%; margin-bottom: 8px; padding: 14px; font: inherit; font-weight: 700;
  font-size: 1.05rem; color: var(--ink); background: var(--bg); border: 2px solid var(--line); border-radius: 14px; cursor: pointer; text-align: left;
}
.toggle .box { width: 30px; height: 30px; border-radius: 9px; border: 2px solid var(--muted); display: grid; place-items: center; font-weight: 900; }
.toggle.on { border-color: var(--ok); background: var(--ok-soft); }
.toggle.on .box { background: var(--ok); border-color: var(--ok); color: #fff; }
.link { display: inline-block; margin: 0 0 16px; color: var(--accent); font-weight: 700; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.chip {
  border: 2px solid var(--line); background: var(--bg); color: var(--ink); border-radius: 999px;
  padding: 9px 14px; font: inherit; font-weight: 600; cursor: pointer;
}
.chip.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

.seg { display: flex; gap: 6px; background: var(--bg); padding: 4px; border-radius: 14px; margin-bottom: 14px; border: 1px solid var(--line); }
.seg button { flex: 1; border: 0; background: transparent; color: var(--muted); font: inherit; font-weight: 700; padding: 10px 6px; border-radius: 10px; cursor: pointer; }
.seg button.on { background: var(--card); color: var(--accent); box-shadow: var(--shadow); }

/* Grup */
.members { list-style: none; padding: 0; margin: 14px 0 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.members li { display: flex; gap: 8px; align-items: center; padding: 8px 10px; border-radius: 12px; background: var(--bg); font-weight: 600; min-width: 0; }
.members li span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.members li.done { background: var(--ok-soft); }
.copyrow { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.sumtitle { font-weight: 700; margin: 4px 0 6px; }

/* Ben */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat { background: var(--bg); border-radius: 14px; padding: 10px 6px; text-align: center; }
.stat b { display: block; font-size: 1.35rem; }
.stat span { font-size: .75rem; color: var(--muted); font-weight: 600; }

.cal { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.day { aspect-ratio: 1; border-radius: 12px; display: grid; place-items: center; background: var(--bg); color: var(--muted); font-size: .75rem; font-weight: 700; line-height: 1.1; text-align: center; border: 2px solid transparent; }
.day b { font-size: 1rem; display: block; }
.day.full { background: var(--ok-soft); color: var(--ok); }
.day.makeup { background: var(--accent-soft); color: var(--accent); }
.day.partial, .day.open { background: var(--warn-soft); color: var(--warn); }
.day.miss { background: var(--bad-soft); color: var(--bad); }
.day.open { border-style: dashed; border-color: var(--warn); }
.day.now { border-color: var(--accent); }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 10px; }

.badges { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.badge { background: var(--bg); border-radius: 14px; padding: 12px; text-align: center; }
.badge .e { font-size: 2rem; display: block; }
.badge b { display: block; font-size: .95rem; }
.badge small { display: block; line-height: 1.25; margin-top: 2px; }
.badge.off { opacity: .45; filter: grayscale(1); }

/* Alt menü */
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; display: flex; justify-content: center; gap: 6px;
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom)); background: var(--card); border-top: 1px solid var(--line);
}
.nav button {
  flex: 1; max-width: 160px; border: 0; background: transparent; color: var(--muted); font: inherit; font-weight: 700;
  font-size: .8rem; padding: 6px 4px; border-radius: 12px; cursor: pointer; display: grid; gap: 2px; justify-items: center;
}
.nav button span { font-size: 1.4rem; line-height: 1; }
.nav button.on { color: var(--accent); background: var(--accent-soft); }

#toast {
  position: fixed; left: 50%; bottom: calc(100px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px);
  background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 14px; font-weight: 700; max-width: 88vw;
  text-align: center; opacity: 0; pointer-events: none; transition: .25s; z-index: 10;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Yönetici */
.admin table { width: 100%; border-collapse: collapse; }
.admin td { padding: 8px 4px; border-top: 1px solid var(--line); vertical-align: middle; }
.admin td:first-child { font-weight: 700; word-break: break-word; }
.admin .acts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.admin .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
