:root {
  --bg: #FAF4FB; --card: #fff; --card2: #F1EDF5; --text: #1C1726; --text2: #8A8194;
  --sep: rgba(0,0,0,.06); --accent: #8B5CF6; --streak: #FF8A3D; --gold: #F4C94C; --ok: #4CAF7D;
  --head: #F3E9FD; --shadow: 0 8px 24px rgba(139,92,246,.35);
  --pink: #FCD2EC; --peach: #FBD2B3; --yellow: #F9E68C; --green: #C7EDA0; --blue: #BBD8F6; --mint: #B9EFD9; --lavender: #D6C9F5;
  --sat: env(safe-area-inset-top, 0px); --sab: env(safe-area-inset-bottom, 0px);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Rounded", "SF Pro Display", "Segoe UI", Roboto, sans-serif;
}
html[data-theme="dark"] {
  --bg: #15131B; --card: #241F2E; --card2: #2D2738; --text: #fff; --text2: #AFA6BD;
  --sep: rgba(255,255,255,.08); --head: #201A2C; --shadow: 0 8px 24px rgba(0,0,0,.5);
  --pink: #4A2A3D; --peach: #4A3626; --yellow: #4A4420; --green: #2B4028; --blue: #253B52; --mint: #224238; --lavender: #352B4E;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: var(--font); }
body { overscroll-behavior: none; -webkit-user-select: none; user-select: none; }
input, textarea, select, button { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
input, textarea { -webkit-user-select: text; user-select: text; }
#app { max-width: 520px; margin: 0 auto; height: 100%; display: flex; flex-direction: column; position: relative; overflow: hidden; }

/* ----- viršus ----- */
.head { background: var(--head); padding: calc(var(--sat) + 10px) 16px 8px; border-radius: 0 0 28px 28px; position: relative; flex: none; }
.head-row { display: flex; align-items: center; justify-content: space-between; height: 44px; }
.head h1 { font-size: 19px; font-weight: 800; margin: 0; letter-spacing: -.2px; }
.icon-btn { width: 40px; height: 40px; display: grid; place-items: center; font-size: 22px; border-radius: 50%; }
.streak { display: flex; align-items: center; gap: 6px; background: var(--card); border-radius: 22px; padding: 6px 14px 6px 10px; font-weight: 800; font-size: 18px; min-width: 66px; justify-content: center; }
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; margin-top: 8px; padding-bottom: 8px; }
.wd { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px 0 8px; border-radius: 22px; color: var(--text2); font-size: 12px; font-weight: 600; }
.wd .num { width: 34px; height: 34px; border-radius: 50%; border: 1.5px solid var(--sep); display: grid; place-items: center; font-size: 15px; font-weight: 600; position: relative; }
.wd.sel { background: color-mix(in srgb, var(--accent) 22%, transparent); color: var(--text); }
.wd.sel .num { background: var(--card); color: var(--text); border-color: transparent; font-weight: 800; }
.wd.today .num { border-color: var(--accent); }
.wd .coin { position: absolute; inset: 0; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #FFE69A, var(--gold) 60%, #E2A92B); color: #7A5200; display: grid; place-items: center; font-weight: 800; border: 0; }
.today-btn { position: absolute; right: 0; bottom: -18px; background: color-mix(in srgb, var(--accent) 28%, var(--card)); border-radius: 14px 0 0 14px; padding: 6px 14px 6px 10px; font-weight: 700; font-size: 15px; z-index: 3; }

/* ----- turinys ----- */
.main { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 30px 16px calc(120px + var(--sab)); }
.list { display: flex; flex-direction: column; gap: 12px; }
.card { display: flex; align-items: center; gap: 14px; padding: 16px 18px; border-radius: 28px; background: var(--tc, var(--pink)); width: 100%; text-align: left; transition: transform .12s; }
.card:active { transform: scale(.985); }
.card .em { font-size: 36px; width: 46px; text-align: center; flex: none; line-height: 1; }
.card .mid { flex: 1; min-width: 0; }
.card .time { font-size: 15px; font-weight: 500; opacity: .9; display: flex; gap: 8px; align-items: center; }
.card .badge { background: color-mix(in srgb, var(--text) 12%, transparent); border-radius: 10px; padding: 1px 8px; font-size: 13px; font-weight: 700; }
.card .title { font-size: 18px; font-weight: 700; margin-top: 2px; overflow-wrap: anywhere; }
.card.done .title { text-decoration: line-through; opacity: .55; }
.card .circle, .circle { width: 40px; height: 40px; border-radius: 50%; border: 2px solid color-mix(in srgb, var(--text) 45%, transparent); flex: none; display: grid; place-items: center; font-size: 20px; font-weight: 800; }
.card.done .circle { background: var(--ok); border-color: var(--ok); color: #fff; }
.empty { text-align: center; color: var(--text2); padding: 60px 20px; font-size: 16px; line-height: 1.5; }
.empty .big { font-size: 56px; }
.fab { position: absolute; right: 18px; bottom: calc(88px + var(--sab)); width: 60px; height: 60px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 34px; display: grid; place-items: center; box-shadow: var(--shadow); z-index: 5; }

/* ----- apatinė juosta ----- */
.tabs { position: absolute; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: repeat(5, 1fr); background: var(--card); border-top: 1px solid var(--sep); padding: 8px 0 calc(8px + var(--sab)); z-index: 6; }
.tab { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 12px; font-weight: 600; color: var(--text2); }
.tab .ic { font-size: 26px; height: 32px; display: grid; place-items: center; filter: grayscale(1) opacity(.55); }
.tab.on { color: var(--text); }
.tab.on .ic { filter: none; }
.tab.center .ic { font-size: 30px; filter: none; }
.tab.center.on span.lbl { background: #F068C8; color: #fff; border-radius: 10px; padding: 1px 8px; }

/* ----- lapai (sheet) ----- */
.scrim { position: absolute; inset: 0; background: rgba(0,0,0,.35); z-index: 20; animation: fade .2s; }
.sheet { position: absolute; left: 0; right: 0; bottom: 0; z-index: 21; background: var(--sheetbg, var(--card)); border-radius: 28px 28px 0 0; padding: 16px 16px calc(24px + var(--sab)); max-height: 92%; overflow-y: auto; animation: up .25s ease-out; }
.sheet.full { top: 28px; max-height: none; }
.sheet .grab { width: 40px; height: 4px; border-radius: 2px; background: color-mix(in srgb, var(--text) 18%, transparent); margin: -6px auto 10px; }
@keyframes up { from { transform: translateY(40px); opacity: 0 } to { transform: none; opacity: 1 } }
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }
.detail .card { background: transparent; padding: 4px 6px 12px; }
.sub-list { background: var(--card); border-radius: 22px; padding: 4px 16px; }
.sub-row { display: flex; align-items: center; gap: 14px; padding: 14px 0; font-size: 17px; width: 100%; text-align: left; }
.sub-row + .sub-row { border-top: 1px solid var(--sep); }
.sub-row .circle { width: 28px; height: 28px; font-size: 15px; }
.sub-row.done { color: var(--text2); }
.sub-row.done .tx { text-decoration: line-through; }
.sub-row.done .circle { background: var(--ok); border-color: var(--ok); color: #fff; }
.detail .note { text-align: center; font-size: 15px; padding: 22px 10px; }
.pill-btn { display: block; margin: 0 auto; border: 1.5px solid color-mix(in srgb, var(--text) 50%, transparent); border-radius: 22px; padding: 11px 34px; font-size: 17px; font-weight: 500; }

/* ----- redaktorius ----- */
.ed { background: var(--sheetbg, var(--pink)); }
.ed-top { display: flex; justify-content: space-between; align-items: center; }
.ed-top .save { font-weight: 700; font-size: 17px; color: var(--text2); padding: 8px; }
.ed-top .save.on { color: var(--accent); }
.ed-emoji { text-align: center; font-size: 76px; line-height: 1.1; margin-top: 4px; width: 100%; }
.ed-title { width: 100%; text-align: center; background: transparent; border: 0; outline: 0; font-size: 28px; font-weight: 800; padding: 4px 0; }
.ed-title::placeholder { color: var(--text2); }
.hint { text-align: center; color: var(--text2); font-size: 15px; margin: 2px 0 14px; }
.colors { display: flex; justify-content: space-between; margin: 0 4px 20px; }
.dot { width: 44px; height: 44px; border-radius: 50%; border: 3px solid color-mix(in srgb, #fff 80%, transparent); display: grid; place-items: center; font-size: 20px; font-weight: 800; }
html[data-theme="dark"] .dot { border-color: rgba(255,255,255,.25); }
.group { background: var(--card); border-radius: 24px; padding: 4px 18px; margin-bottom: 16px; }
.row { display: flex; align-items: center; gap: 14px; width: 100%; padding: 17px 0; font-size: 18px; font-weight: 500; text-align: left; }
.row + .row { border-top: 1px solid var(--sep); }
.row .ri { font-size: 22px; width: 28px; text-align: center; }
.row .rv { margin-left: auto; color: var(--text); font-size: 17px; text-align: right; display: flex; align-items: center; gap: 8px; }
.row .rv::after { content: '›'; font-size: 24px; font-weight: 700; color: var(--text); }
.row.plain .rv::after { content: none; }
.foot-note { text-align: center; color: var(--text2); font-size: 15px; padding: 6px 10px 10px; }
.sub-edit { display: flex; align-items: center; gap: 10px; padding: 12px 0; }
.sub-edit + .sub-edit { border-top: 1px solid var(--sep); }
.sub-edit input { flex: 1; background: transparent; border: 0; outline: 0; font-size: 17px; min-width: 0; }
.minus { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--text2); color: var(--text2); display: grid; place-items: center; font-size: 18px; line-height: 1; flex: none; }
.danger { color: #E5484D; display: block; margin: 8px auto 0; font-weight: 600; padding: 12px 20px; }

/* ----- subpuslapiai ----- */
.sp-title { text-align: center; font-size: 28px; font-weight: 800; margin: 14px 0 22px; letter-spacing: -.3px; }
.sp { background: var(--card); border-radius: 0; }
.tgl-row { display: flex; align-items: center; gap: 14px; padding: 12px 0 18px; border-bottom: 1px solid var(--sep); }
.tgl-row .ri { font-size: 32px; }
.tgl-row .t1 { font-weight: 800; font-size: 20px; }
.tgl-row .t2 { color: var(--text2); font-size: 16px; }
.toggle { margin-left: auto; width: 56px; height: 34px; border-radius: 17px; background: color-mix(in srgb, var(--text) 18%, transparent); position: relative; flex: none; transition: background .2s; }
.toggle::after { content: ''; position: absolute; left: 3px; top: 3px; width: 28px; height: 28px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.toggle.on { background: #34C759; }
.toggle.on::after { transform: translateX(22px); }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--card2); border-radius: 26px; padding: 0; margin: 18px 0; overflow: hidden; }
.seg button { padding: 15px 4px; font-weight: 600; font-size: 16px; color: var(--text2); border-radius: 26px; white-space: nowrap; }
.seg button.on { background: var(--seg, var(--pink)); color: var(--text); font-weight: 800; }
.field { display: flex; justify-content: space-between; align-items: center; padding: 16px 0; border-bottom: 1px solid var(--sep); font-size: 18px; font-weight: 500; gap: 12px; }
.field select, .field input[type=date], .field input[type=time], .field input[type=number], .field input[type=text] { background: transparent; border: 0; outline: 0; text-align: right; font-size: 18px; -webkit-appearance: none; appearance: none; max-width: 60%; }
.field input[type=date], .field input[type=time] { background: var(--card2); border-radius: 12px; padding: 8px 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 0; }
.chip { min-width: 46px; padding: 10px 12px; border-radius: 18px; background: var(--card2); font-weight: 600; font-size: 16px; text-align: center; }
.chip.on { background: var(--accent); color: #fff; }
.mdays { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; padding: 12px 0; }
.mdays .chip { min-width: 0; padding: 10px 0; border-radius: 14px; }
.bigtime { display: flex; justify-content: center; gap: 8px; margin: 22px 0 8px; }
.bigtime input { font-size: 54px; font-weight: 800; background: var(--card2); border-radius: 22px; padding: 6px 18px; width: auto; text-align: center; border: 0; outline: 0; -webkit-appearance: none; }
.btn { display: block; width: 100%; background: var(--accent); color: #fff; border-radius: 22px; padding: 16px; font-weight: 700; font-size: 17px; text-align: center; }
.btn.sec { background: var(--card2); color: var(--text); }
.btn + .btn { margin-top: 10px; }
.btn[disabled] { opacity: .5; }
.emoji-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; }
.emoji-grid button { font-size: 34px; padding: 8px 0; border-radius: 14px; }
.emoji-grid button.on { background: var(--card2); }
.cat { font-weight: 800; font-size: 15px; color: var(--text2); margin: 16px 0 6px; }

/* ----- statistika / įpročiai ----- */
.stat-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 18px; }
.stat { background: var(--card); border-radius: 24px; padding: 18px; }
.stat .n { font-size: 38px; font-weight: 800; }
.stat .l { color: var(--text2); font-size: 15px; margin-top: 2px; }
h2.sec { font-size: 20px; font-weight: 800; margin: 22px 4px 12px; }
.grid-wrap { background: var(--card); border-radius: 28px; padding: 18px 14px; }
.hg { display: grid; grid-template-columns: minmax(0, 1fr) repeat(7, 26px); gap: 9px 8px; align-items: center; }
.hg .h { text-align: center; font-weight: 700; font-size: 13px; color: var(--text2); }
.hg .nm { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 15px; min-width: 0; }
.hg .nm span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hg .nm .e { font-size: 22px; }
.hg .d { width: 26px; height: 26px; border-radius: 50%; background: var(--card2); }
.hg .d.on { background: var(--tc); }
.hg .d.today { outline: 2px solid var(--accent); outline-offset: 1px; }
.hg .d.miss { background: color-mix(in srgb, var(--text2) 25%, transparent); }
.nav-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.nav-row b { font-size: 18px; }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal .h { text-align: center; font-size: 12px; font-weight: 700; color: var(--text2); }
.cal .c { aspect-ratio: 1; border-radius: 12px; background: var(--card2); display: grid; place-items: center; font-size: 13px; font-weight: 600; color: var(--text2); }
.cal .c.full { background: var(--gold); color: #7A5200; }
.cal .c.part { background: color-mix(in srgb, var(--gold) 35%, var(--card2)); color: var(--text); }
.cal .c.today { outline: 2px solid var(--accent); }
.cal .c.blank { background: transparent; }

/* ----- asistentas ----- */
.chat-title { font-size: 26px; font-weight: 800; margin: 0 4px 4px; }
.chat-sub { color: var(--text2); font-size: 15px; margin: 0 4px 14px; line-height: 1.4; }
.bubble { background: var(--card); border-radius: 20px 20px 20px 6px; padding: 14px 16px; font-size: 16px; line-height: 1.45; margin-bottom: 12px; }
.bubble.me { background: var(--accent); color: #fff; border-radius: 20px 20px 6px 20px; margin-left: 40px; }
.compose { display: flex; gap: 10px; align-items: flex-end; margin: 8px 0 16px; }
.compose textarea { flex: 1; border-radius: 22px; border: 1.5px solid var(--sep); background: var(--card); padding: 14px 16px; font-size: 17px; resize: none; min-height: 52px; max-height: 140px; outline: 0; }
.mic { width: 52px; height: 52px; border-radius: 50%; background: var(--card2); font-size: 24px; display: grid; place-items: center; flex: none; }
.mic.rec { background: #E5484D; animation: pulse 1s infinite; }
@keyframes pulse { 50% { transform: scale(1.08) } }
.send { width: 52px; height: 52px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 24px; display: grid; place-items: center; flex: none; }
.send[disabled] { opacity: .5; }
.prop { border-radius: 24px; padding: 14px 16px; margin-bottom: 12px; background: var(--tc); }
.prop .t { font-weight: 800; font-size: 18px; display: flex; gap: 10px; align-items: center; }
.prop .t .e { font-size: 28px; }
.prop .m { font-size: 14px; margin-top: 6px; opacity: .85; line-height: 1.5; }
.prop .acts { display: flex; gap: 8px; margin-top: 12px; }
.prop .acts button { flex: 1; padding: 10px; border-radius: 16px; font-weight: 700; background: var(--card); }
.prop .acts .go { background: var(--accent); color: #fff; }
.ex { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.ex button { background: var(--card); border-radius: 16px; padding: 8px 12px; font-size: 14px; }

/* ----- profilis ----- */
.set-group { background: var(--card); border-radius: 24px; padding: 6px 18px; margin-bottom: 16px; }
.set-group .field:last-child { border-bottom: 0; }
.set-h { font-size: 13px; font-weight: 700; color: var(--text2); text-transform: uppercase; letter-spacing: .5px; margin: 20px 8px 8px; }
.tiny { color: var(--text2); font-size: 13px; line-height: 1.45; padding: 0 8px 10px; }
.key-in { width: 100%; background: var(--card2); border-radius: 14px; border: 0; padding: 12px; font-size: 15px; outline: 0; margin: 4px 0 12px; }

/* ----- toast ----- */
.toast { position: absolute; left: 16px; right: 16px; top: calc(var(--sat) + 10px); background: var(--text); color: var(--bg); border-radius: 18px; padding: 14px 16px; z-index: 50; font-weight: 600; animation: down .25s; display: flex; gap: 10px; align-items: center; box-shadow: 0 10px 30px rgba(0,0,0,.3); }
@keyframes down { from { transform: translateY(-30px); opacity: 0 } to { transform: none; opacity: 1 } }
.menu { position: absolute; left: 12px; top: calc(var(--sat) + 56px); background: var(--card); border-radius: 20px; padding: 6px; z-index: 22; min-width: 240px; box-shadow: 0 12px 40px rgba(0,0,0,.25); animation: fade .15s; }
.menu button { display: flex; gap: 12px; align-items: center; width: 100%; padding: 13px 14px; border-radius: 14px; font-size: 16px; font-weight: 500; text-align: left; }
.menu button:active { background: var(--card2); }
