:root {
  --bg: #fff;
  --panel: #fff;
  --line: #ececec;
  --soft: #f3f3f3;
  --text: #111;
  --muted: #999;
  --accent: #ff8a3d;
  --green: #7fd6a0;
  --pink: #f2a7c0;
  --blue: #8ec5ff;
  color-scheme: light;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: transparent; overflow: hidden; height: 100%; font-family: "Segoe UI Variable Text", "Segoe UI", Tahoma, "Arabic Typesetting", system-ui, sans-serif; color: var(--text); user-select: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input, textarea, select { font: inherit; color: inherit; }
#stack { display: flex; flex-direction: column; align-items: center; padding: 0 30px; }

/* ---------- notch + face ---------- */
.notch { width: 300px; height: 196px; background: var(--bg); border-radius: 0 0 38px 38px; position: relative; overflow: hidden; box-shadow: 0 6px 22px rgba(0,0,0,.18); cursor: pointer; }
#stage { position: absolute; left: 0; top: 4px; width: 300px; height: 184px; }
.notch-status { position: absolute; bottom: 6px; left: 0; right: 0; text-align: center; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
/* ---------- bar ---------- */
.bar { margin-top: 12px; width: 400px; height: 56px; background: var(--bg); border-radius: 28px; display: flex; align-items: center; gap: 6px; padding: 0 8px; box-shadow: 0 6px 22px rgba(0,0,0,.16); }
.bar input { flex: 1; min-width: 0; background: none; border: 0; outline: 0; font-size: 15.5px; font-weight: 600; padding: 0 6px; }
.bar input::placeholder { color: #666; }
.icon-btn { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; color: #222; flex: none; }
.icon-btn:hover { background: #eee; }
#grid-btn.open { background: #111; color: #fff; }
#mic-btn.on { background: #c0392b; color: #fff; }
.icon-btn:focus-visible, .row:focus-visible, button:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

/* ---------- card ---------- */
.card { margin-top: 12px; width: 400px; max-height: 430px; background: var(--panel); border-radius: 28px; padding: 14px 4px 18px; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 8px 28px rgba(0,0,0,.18); }
body.expanded .card { width: 700px; max-height: 640px; }
body.expanded .bar { width: 700px; }
.card-head { display: flex; align-items: center; gap: 4px; padding: 2px 14px 10px 14px; }
.card-head h2 { flex: 1; font-size: 19px; margin: 0 0 0 6px; font-weight: 700; }
.card-body { overflow-y: auto; padding: 4px 22px 4px; flex: 1; }
.card-body::-webkit-scrollbar { width: 6px; } .card-body::-webkit-scrollbar-thumb { background: #d9d9d9; border-radius: 3px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }

/* grid menu */
.menu { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 8px; padding: 4px 14px; }
.menu button { display: flex; align-items: center; gap: 14px; padding: 11px 8px; border-radius: 12px; font-size: 16px; font-weight: 600; text-align: left; }
.menu button:hover { background: #f2f2f2; }

/* empty states */
.empty { border: 1.5px dashed #d9d9d9; border-radius: 22px; padding: 46px 22px; display: flex; align-items: center; gap: 18px; margin: 4px 0; }
.empty.center { flex-direction: column; text-align: center; border: 0; padding: 50px 10px; }
.empty b { font-size: 16px; display: block; margin-bottom: 4px; }
.empty.center b { font-size: 22px; }
.sticker { width: 96px; height: 80px; flex: none; }

/* lists */
.task, .habit, .note, .rem, .chat-item, .row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.task .check { width: 22px; height: 22px; border-radius: 7px; border: 2px solid #999; display: grid; place-items: center; flex: none; padding: 0; }
.task.done .check { background: var(--accent); border-color: var(--accent); color: #000; }
.task.done .title { text-decoration: line-through; color: var(--muted); }
.title { flex: 1; font-size: 14.5px; min-width: 0; overflow-wrap: anywhere; }
.pill { font-size: 11.5px; padding: 3px 8px; border-radius: 999px; background: #f0f0f0; color: #666; white-space: nowrap; }
.pill.warn { background: #ffe9dc; color: #c25a12; }
.del { opacity: 0; color: var(--muted); padding: 4px; }
.task:hover .del, .note:hover .del, .rem:hover .del, .habit:hover .del, .chat-item:hover .del { opacity: 1; }
.note { flex-direction: column; align-items: stretch; gap: 4px; }
.note textarea { background: none; border: 0; outline: 0; resize: none; font-size: 14.5px; width: 100%; line-height: 1.4; }
.habit .bar-track { flex: 1; height: 8px; border-radius: 4px; background: #eee; overflow: hidden; }
.habit .bar-fill { height: 100%; background: var(--green); }
.habit .plus, .habit .minus { width: 30px; height: 30px; border-radius: 50%; background: #efefef; display: grid; place-items: center; }
.day { padding: 12px 0; border-bottom: 1px solid var(--line); }
.day h3 { margin: 0 0 6px; font-size: 16px; } .day h3 span { font-weight: 400; margin-left: 6px; font-size: 14px; }
.day .item { font-size: 14px; padding: 3px 0; display: flex; gap: 8px; }

/* settings + focus rows */
.row { justify-content: space-between; border: 0; padding: 12px 0; font-size: 14.5px; }
.row .left { display: flex; gap: 14px; align-items: center; }
.row .ico { width: 36px; height: 36px; border-radius: 50%; border: 1px solid #d9d9d9; display: grid; place-items: center; flex: none; }
.row b { display: block; font-weight: 600; } .row small { color: #666; }
button.row { width: 100%; text-align: left; }
.toggle { border: 1.5px solid #222; border-radius: 999px; padding: 4px 14px; font-weight: 700; font-size: 13px; min-width: 66px; }
.toggle.off { border-color: #bbb; color: var(--muted); }
select, .field { background: #f6f6f6; border: 1px solid #d9d9d9; border-radius: 10px; padding: 7px 10px; outline: 0; }
.field { width: 100%; margin-top: 6px; }
.disclosure { background: #f5f5f5; border-radius: 16px; padding: 14px 16px; margin-top: 10px; font-size: 14px; }
.disclosure summary { cursor: pointer; font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip { background: #f0f0f0; border-radius: 999px; padding: 5px 10px; font-size: 13px; display: flex; gap: 6px; align-items: center; }
.big-timer { font-size: 44px; font-weight: 700; text-align: center; font-variant-numeric: tabular-nums; margin: 14px 0 6px; }
.primary { background: #111; color: #fff; border-radius: 999px; padding: 9px 18px; font-weight: 700; }
.secondary { background: #f0f0f0; border-radius: 999px; padding: 9px 18px; font-weight: 600; }

/* chat */
.msgs { display: flex; flex-direction: column; gap: 10px; padding-bottom: 6px; }
.msg { max-width: 86%; padding: 9px 13px; border-radius: 18px; font-size: 14.5px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; user-select: text; }
.msg.user { align-self: flex-end; background: #ececec; }
.msg.assistant { align-self: flex-start; background: #fafafa; border: 1px solid #e4e4e4; }
.msg.error { align-self: flex-start; color: #c0392b; font-size: 13px; }
.msg .brain { display: block; font-size: 11px; color: var(--muted); margin-top: 4px; }
.typing { align-self: flex-start; color: var(--muted); font-size: 13px; }
.chat-item { cursor: pointer; } .chat-item .title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.section-label { font-size: 12.5px; font-weight: 700; margin: 6px 0 4px; }

.toast { margin-top: 10px; width: 400px; background: #fff; box-shadow: 0 6px 22px rgba(0,0,0,.16); border-radius: 22px; padding: 14px 18px; display: flex; gap: 12px; align-items: center; font-size: 14px; }
.toast .title { font-weight: 600; }
[dir="rtl"] .card-head h2 { margin: 0 6px 0 0; }
[dir="rtl"] .card-head [data-act="back"] svg, [dir="rtl"] .row svg.chev { transform: scaleX(-1); }

/* microphone: a ring that follows your voice, and fills as the pause ends the capture */
#mic-btn.on { background: #e5383b; color: #fff; box-shadow: 0 0 0 calc(var(--level, 0) * 10px) rgba(229,56,59,.25); transition: box-shadow .08s; }
#mic-btn.on::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; background: conic-gradient(#e5383b calc(var(--pause, 0) * 360deg), transparent 0); -webkit-mask: radial-gradient(circle, transparent 21px, #000 22px); }
#mic-btn { position: relative; }
#mic-btn.busy { animation: micbusy 1s linear infinite; }
@keyframes micbusy { 50% { opacity: .35; } }
