:root {
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Inter, Roboto, sans-serif;
  --round: "SF Pro Rounded", ui-rounded, -apple-system, "Segoe UI", sans-serif;
  --r: 20px;
  --sel: #3F7DA8; --sel-soft: rgba(63,125,168,.14);
  --dil: #D06A86; --dil-soft: rgba(208,106,134,.14);
  --sha: #D9952F; --sha-soft: rgba(217,149,47,.16);
  --ok: #3E9B6E;
  --danger: #D2503F;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}
[data-theme="light"] {
  --bg: #FBF6EF; --bg2: #F4ECE1; --card: #FFFFFF; --card2: #FBF8F4;
  --ink: #2B2421; --ink2: #6F6560; --ink3: #A79D96; --line: rgba(60,40,30,.09);
  --shadow: 0 1px 2px rgba(60,40,30,.05), 0 8px 24px rgba(60,40,30,.06);
  --nav: rgba(255,255,255,.82);
  --morning: linear-gradient(135deg, #FFD9A8 0%, #FFB79A 55%, #F59FA3 100%);
  --evening: linear-gradient(135deg, #3B3A6E 0%, #5B4C8A 55%, #8A5E92 100%);
  color-scheme: light;
}
[data-theme="dark"] {
  --bg: #14121A; --bg2: #1B1922; --card: #211E29; --card2: #26222F;
  --ink: #F2EEF0; --ink2: #B3ABB4; --ink3: #7C7482; --line: rgba(255,255,255,.08);
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25);
  --nav: rgba(27,25,34,.86);
  --morning: linear-gradient(135deg, #7A4E3A 0%, #8E5546 55%, #8C4B5A 100%);
  --evening: linear-gradient(135deg, #252552 0%, #3A2F63 55%, #573B66 100%);
  --sel-soft: rgba(110,165,205,.18); --dil-soft: rgba(230,130,160,.18); --sha-soft: rgba(230,170,80,.18);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.45 var(--font); -webkit-font-smoothing: antialiased; }
body { min-height: 100vh; min-height: 100dvh; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
a { color: inherit; }
svg { display: block; }
.hidden { display: none !important; }

/* ---------- layout ---------- */
.shell { display: flex; min-height: 100dvh; }
.side { display: none; }
.main { flex: 1; min-width: 0; padding: calc(var(--safe-t) + 14px) 18px calc(170px + var(--safe-b)); max-width: 760px; margin: 0 auto; width: 100%; }
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; justify-content: space-around;
  padding: 8px 6px calc(8px + var(--safe-b)); background: var(--nav); backdrop-filter: saturate(1.6) blur(18px); -webkit-backdrop-filter: saturate(1.6) blur(18px);
  border-top: 1px solid var(--line); }
.tab { display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 58px; padding: 4px 6px; color: var(--ink3); font-size: 11px; font-weight: 600; border-radius: 12px; }
.tab svg { width: 24px; height: 24px; }
.tab.on { color: var(--accent); }

@media (min-width: 900px) {
  .tabbar { display: none; }
  .side { display: flex; flex-direction: column; gap: 4px; width: 232px; flex: none; padding: 28px 16px; position: sticky; top: 0; height: 100vh;
    border-right: 1px solid var(--line); background: var(--bg2); }
  .side .brand { font: 700 26px/1 var(--round); letter-spacing: -.5px; padding: 4px 12px 22px; }
  .side .tab { flex-direction: row; justify-content: flex-start; gap: 12px; font-size: 15px; padding: 11px 12px; min-width: 0; color: var(--ink2); }
  .side .tab.on { background: var(--card); color: var(--accent); box-shadow: var(--shadow); }
  .main { padding: 34px 40px 60px; }
}

/* ---------- header ---------- */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.hello { font: 700 28px/1.1 var(--round); letter-spacing: -.6px; margin: 0; }
.sub { color: var(--ink2); font-size: 14px; margin-top: 4px; }
.who { display: flex; gap: 6px; background: var(--card); padding: 4px; border-radius: 999px; box-shadow: var(--shadow); }
.who button { height: 34px; min-width: 40px; padding: 0 11px; border-radius: 999px; font-size: 13px; font-weight: 700; color: var(--ink2); }
.who button.on { color: #fff; }
.who button.on.selcuk { background: var(--sel); } .who button.on.dilay { background: var(--dil); } .who button.on.shared { background: var(--sha); }

.p-selcuk { --accent: var(--sel); --accent-soft: var(--sel-soft); }
.p-dilay { --accent: var(--dil); --accent-soft: var(--dil-soft); }
.p-shared { --accent: var(--sha); --accent-soft: var(--sha-soft); }

h2.sec { font: 700 13px/1 var(--font); letter-spacing: .6px; text-transform: uppercase; color: var(--ink3); margin: 26px 4px 10px; display: flex; justify-content: space-between; align-items: center; }
h2.sec .act { text-transform: none; letter-spacing: 0; font-size: 14px; color: var(--accent); font-weight: 600; }

/* ---------- progress ---------- */
.progress { display: flex; align-items: center; gap: 14px; background: var(--card); border-radius: var(--r); padding: 14px 16px; box-shadow: var(--shadow); }
.ring { width: 52px; height: 52px; flex: none; }
.ring circle { fill: none; stroke-width: 6; }
.ring .bg { stroke: var(--line); } .ring .fg { stroke: var(--accent); stroke-linecap: round; transition: stroke-dashoffset .5s; }
.progress b { font: 700 18px/1.2 var(--round); display: block; }
.progress span { color: var(--ink2); font-size: 14px; }

/* ---------- routine hero cards ---------- */
.heroes { display: grid; gap: 12px; margin-top: 14px; }
@media (min-width: 600px) { .heroes { grid-template-columns: 1fr 1fr; } }
.hero { position: relative; border-radius: 24px; padding: 18px 18px 16px; color: #fff; overflow: hidden; min-height: 168px; display: flex; flex-direction: column; box-shadow: var(--shadow); }
.hero.morning { background: var(--morning); color: #4A2A22; }
[data-theme="dark"] .hero.morning { color: #FFEDE3; }
.hero.evening { background: var(--evening); }
.hero .deco { position: absolute; right: -18px; top: -18px; width: 120px; height: 120px; opacity: .35; }
.hero .label { font-size: 13px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase; opacity: .8; display: flex; gap: 6px; align-items: center; }
.hero .title { font: 700 22px/1.15 var(--round); margin: 4px 0 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: 13px; font-weight: 600; padding: 6px 10px; border-radius: 999px; background: rgba(255,255,255,.28); backdrop-filter: blur(4px); }
.hero .foot { margin-top: auto; padding-top: 14px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.bigcheck { display: flex; align-items: center; gap: 8px; height: 44px; padding: 0 16px 0 8px; border-radius: 999px; background: rgba(255,255,255,.9); color: #2B2421; font-weight: 700; font-size: 15px; }
.bigcheck .dot { width: 30px; height: 30px; border-radius: 50%; border: 2px solid currentColor; display: grid; place-items: center; opacity: .5; }
.hero.done .bigcheck { background: rgba(255,255,255,.22); color: inherit; }
.hero.done .bigcheck .dot { background: #fff; color: var(--ok); opacity: 1; border-color: #fff; }
.hero.done .chip { text-decoration: line-through; opacity: .8; }
.ghost { height: 36px; padding: 0 12px; border-radius: 999px; font-size: 14px; font-weight: 600; background: rgba(255,255,255,.18); color: inherit; }

/* ---------- list rows ---------- */
.list { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; }
.row { display: flex; align-items: center; gap: 12px; padding: 13px 14px; min-height: 60px; border-top: 1px solid var(--line); }
.row:first-child { border-top: 0; }
.row .time { font: 700 15px/1 var(--round); color: var(--ink2); width: 46px; flex: none; font-variant-numeric: tabular-nums; }
.row .body { flex: 1; min-width: 0; }
.row .t { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.row .s { font-size: 13px; color: var(--ink2); margin-top: 2px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.row.done .t { text-decoration: line-through; color: var(--ink3); }
.check { width: 30px; height: 30px; flex: none; border-radius: 50%; border: 2px solid var(--ink3); display: grid; place-items: center; color: #fff; transition: all .15s; }
.check svg { width: 16px; height: 16px; opacity: 0; }
.done .check, .check.on { background: var(--accent); border-color: var(--accent); }
.done .check svg, .check.on svg { opacity: 1; }
.tag { font-size: 11.5px; font-weight: 700; padding: 3px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }
.tag.c-is { background: rgba(90,110,220,.14); color: #5A6EDC; }
[data-theme="dark"] .tag.c-is { background: rgba(130,150,255,.18); color: #9DACFF; }
[data-theme="dark"] .tag.c-ev { color: #F0B45A; }
.tag.c-kisisel { background: rgba(62,155,110,.14); color: var(--ok); }
.tag.c-instagram { background: rgba(214,72,140,.14); color: #D6488C; }
.tag.c-ev { background: rgba(217,149,47,.16); color: #C0801F; }
.tag.c-alisveris { background: rgba(32,160,170,.14); color: #1E9AA4; }
.tag.c-diger { background: var(--line); color: var(--ink2); }
.who-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--sha); display: inline-block; }
.iconbtn { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; color: var(--ink2); flex: none; }
.iconbtn:hover { background: var(--bg2); }
.iconbtn svg { width: 20px; height: 20px; }

.empty { text-align: center; padding: 34px 20px; color: var(--ink2); background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); }
.empty .ico { width: 56px; height: 56px; margin: 0 auto 10px; border-radius: 18px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; }
.empty .ico svg { width: 28px; height: 28px; }
.empty b { color: var(--ink); display: block; font-size: 17px; margin-bottom: 4px; }

.fab { position: fixed; right: 18px; bottom: calc(84px + var(--safe-b)); z-index: 19; width: 58px; height: 58px; border-radius: 20px; background: var(--accent); color: #fff; display: grid; place-items: center; box-shadow: 0 10px 28px rgba(0,0,0,.22); }
.fab svg { width: 26px; height: 26px; }
@media (min-width: 900px) { .fab { bottom: 32px; right: 32px; } }

/* ---------- segmented / day chips ---------- */
.seg { display: flex; background: var(--bg2); border-radius: 14px; padding: 3px; gap: 3px; }
.seg button { flex: 1; height: 38px; border-radius: 11px; font-weight: 600; font-size: 14px; color: var(--ink2); }
.seg button.on { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.days { display: flex; gap: 5px; flex-wrap: wrap; }
.days button { width: 38px; height: 34px; border-radius: 10px; font-size: 12.5px; font-weight: 700; background: var(--bg2); color: var(--ink3); }
.days button.on { background: var(--accent); color: #fff; }
.days.sm button { width: 30px; height: 28px; font-size: 11px; border-radius: 8px; }

/* ---------- routine editor ---------- */
.card { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); padding: 16px; }
.card + .card { margin-top: 12px; }
.slotbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.timebox { display: flex; align-items: center; gap: 10px; }
/* 24h time picker */
.tpick { display: inline-flex; align-items: center; gap: 2px; background: var(--bg2); border-radius: 14px; padding: 4px 6px; }
.tpick select { appearance: none; -webkit-appearance: none; border: 0; background: transparent; height: 40px; width: auto; padding: 0 6px; font: 700 22px/1 var(--round); color: var(--ink); text-align: center; cursor: pointer; }
.tpick b { font: 700 22px/1 var(--round); color: var(--ink3); }
.card .tpick select, .card .tpick b { font-size: 26px; }
.unused-time { font: 700 26px/1 var(--round); background: var(--bg2); border: 0; color: var(--ink); padding: 6px 10px; border-radius: 12px; width: auto; min-width: 110px; height: auto; }
input[type="time"].big::-webkit-calendar-picker-indicator { opacity: .5; }
.switch { width: 50px; height: 30px; border-radius: 999px; background: var(--ink3); position: relative; flex: none; transition: background .15s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.switch.on { background: var(--ok); } .switch.on::after { transform: translateX(20px); }
.prod { display: flex; align-items: center; gap: 10px; padding: 12px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.prod:first-child { border-top: 0; }
.prod .name { flex: 1; min-width: 120px; font-weight: 600; }
.prod .grip { width: 34px; height: 34px; border-radius: 11px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; flex: none; }
.prod .grip svg { width: 18px; height: 18px; }
.addline { display: flex; gap: 8px; margin-top: 10px; }
.addline input { flex: 1; min-width: 0; }

.strip { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 10px; scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; }
.strip::-webkit-scrollbar { display: none; }
.day { scroll-snap-align: start; flex: none; width: 118px; border-radius: 18px; padding: 10px; background: var(--card); box-shadow: var(--shadow); text-align: left; display: flex; flex-direction: column; gap: 6px; border: 2px solid transparent; }
.day.today { border-color: var(--accent); }
.day .d { font-size: 12px; font-weight: 700; color: var(--ink3); text-transform: uppercase; letter-spacing: .4px; display: flex; justify-content: space-between; }
.day .n { font: 700 22px/1 var(--round); }
.day .mini { font-size: 12px; color: var(--ink2); line-height: 1.3; display: flex; gap: 5px; align-items: flex-start; }
.day .mini svg { width: 13px; height: 13px; flex: none; margin-top: 1px; }
.day .ov { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
@media (min-width: 900px) { .strip { flex-wrap: wrap; overflow: visible; } }

/* ---------- forms ---------- */
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 13px; font-weight: 600; color: var(--ink2); margin: 0 0 6px 2px; }
.input, input[type="text"], input[type="password"], input[type="url"], input[type="date"], input[type="time"]:not(.big), textarea, select {
  width: 100%; height: 48px; padding: 0 14px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--card2); color: var(--ink); outline: none; font-size: 16px; }
textarea { height: 84px; padding: 12px 14px; resize: vertical; }
input:focus, textarea:focus, select:focus { border-color: var(--accent); }
.btn { height: 50px; padding: 0 20px; border-radius: 15px; font-weight: 700; font-size: 16px; background: var(--accent); color: #fff; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn.block { width: 100%; }
.btn.soft { background: var(--accent-soft); color: var(--accent); }
.btn.plain { background: var(--bg2); color: var(--ink); }
.btn.danger { background: rgba(210,80,63,.12); color: var(--danger); }
.btn:disabled { opacity: .5; }
.btn.sm { height: 40px; font-size: 14px; padding: 0 14px; border-radius: 12px; }
.row2 { display: flex; gap: 10px; } .row2 > * { flex: 1; min-width: 0; }
.pills { display: flex; gap: 6px; flex-wrap: wrap; }
.pills button { height: 36px; padding: 0 13px; border-radius: 999px; font-size: 14px; font-weight: 600; background: var(--bg2); color: var(--ink2); }
.pills button.on { background: var(--accent); color: #fff; }

/* ---------- sheets / dialogs ---------- */
.scrim { position: fixed; inset: 0; z-index: 50; background: rgba(15,10,20,.42); display: flex; align-items: flex-end; justify-content: center; animation: fade .18s; }
.sheet { width: 100%; max-width: 560px; max-height: 92dvh; overflow-y: auto; background: var(--bg); border-radius: 26px 26px 0 0; padding: 10px 20px calc(22px + var(--safe-b)); animation: up .22s cubic-bezier(.2,.8,.2,1); }
.sheet .grab { width: 40px; height: 5px; border-radius: 3px; background: var(--ink3); opacity: .4; margin: 0 auto 12px; }
.sheet h3 { font: 700 21px/1.2 var(--round); margin: 4px 0 16px; }
.sheet .acts { display: flex; gap: 10px; margin-top: 8px; }
.sheet .acts > * { flex: 1; }
@media (min-width: 600px) { .scrim { align-items: center; } .sheet { border-radius: 26px; padding-bottom: 22px; } }
.dialog { max-width: 380px; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }
.toast { position: fixed; left: 50%; bottom: calc(96px + var(--safe-b)); transform: translateX(-50%); z-index: 60; background: var(--ink); color: var(--bg); padding: 11px 18px; border-radius: 14px; font-weight: 600; font-size: 14px; box-shadow: var(--shadow); animation: up .2s; max-width: 90vw; }

/* ---------- auth ---------- */
.auth { min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth .box { width: 100%; max-width: 380px; text-align: center; }
.logo { width: 84px; height: 84px; border-radius: 26px; margin: 0 auto 18px; box-shadow: var(--shadow); }
.auth h1 { font: 700 34px/1 var(--round); letter-spacing: -1px; margin: 0 0 6px; }
.auth p { color: var(--ink2); margin: 0 0 24px; }
.pick { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 18px; }
.pick button { padding: 20px 10px; border-radius: 22px; background: var(--card); box-shadow: var(--shadow); border: 2.5px solid transparent; display: flex; flex-direction: column; align-items: center; gap: 10px; font-weight: 700; }
.pick button .av { width: 58px; height: 58px; border-radius: 50%; display: grid; place-items: center; color: #fff; font: 700 18px/1 var(--round); }
.pick .selcuk .av { background: var(--sel); } .pick .dilay .av { background: var(--dil); }
.pick button.on.selcuk { border-color: var(--sel); } .pick button.on.dilay { border-color: var(--dil); }
.err { color: var(--danger); font-size: 14px; font-weight: 600; min-height: 20px; margin: 8px 0; }

/* ---------- settings ---------- */
.set { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-top: 1px solid var(--line); min-height: 56px; }
.set:first-child { border-top: 0; }
.set .k { flex: 1; min-width: 0; }
.set .k b { display: block; font-weight: 600; }
.set .k small { color: var(--ink2); font-size: 13px; display: block; overflow: hidden; text-overflow: ellipsis; }
.set .seg { width: 230px; flex: none; }
@media (max-width: 420px) { .set.wrap { flex-wrap: wrap; } .set.wrap .seg { width: 100%; } }
.badge { font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }
.devav { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; color: #fff; flex: none; }
.devav svg { width: 20px; height: 20px; }
.code { font: 13px/1.4 ui-monospace, Menlo, monospace; word-break: break-all; background: var(--bg2); padding: 10px 12px; border-radius: 12px; color: var(--ink2); }

.shop .t a { text-decoration: none; }
.shop .price { font: 700 14px/1 var(--round); color: var(--accent); }
.quick { display: flex; gap: 8px; margin-bottom: 12px; }
.quick input { flex: 1; }
.quick .btn { width: 50px; padding: 0; flex: none; }
.banner { display: flex; gap: 12px; align-items: center; background: var(--accent-soft); color: var(--ink); border-radius: 16px; padding: 12px 14px; margin-bottom: 14px; font-size: 14px; }
.banner svg { width: 22px; height: 22px; color: var(--accent); flex: none; }
.banner .btn { margin-left: auto; flex: none; }
