:root {
  --bg: #03070c; --panel: #08131c; --line: #12303b;
  --cyan: #5ce1e6; --cyan-dim: #2b7f8a;
  --text: #d6e8ee; --muted: #7d97a3; --faint: #4b6370;
  --amber: #ffb547; --red: #ff7a7a; --green: #6ff0b8;
  --radius: 14px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 16px/1.5 "Segoe UI", Tahoma, system-ui, sans-serif;
  min-height: 100dvh; -webkit-tap-highlight-color: transparent;
}
[dir="rtl"] body { font-family: "Segoe UI", Tahoma, "Noto Sans Arabic", system-ui, sans-serif; }
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0; font-weight: 600; }
button, input, select, textarea { font: inherit; color: inherit; }
.muted { color: var(--muted); }
.tiny { font-size: .8rem; }
.center { text-align: center; }
.err { color: var(--red); min-height: 1.5em; margin: .5rem 0 0; }

/* buttons */
button { cursor: pointer; border: 1px solid var(--line); background: var(--panel); border-radius: 10px; padding: .6rem 1rem; }
button.primary { background: var(--cyan); color: #01232a; border-color: var(--cyan); font-weight: 600; }
button.ghost { background: transparent; }
button.small { padding: .35rem .7rem; font-size: .85rem; }
button.round { width: 48px; height: 48px; border-radius: 50%; padding: 0; font-size: 1.3rem; }
button.round.listening { background: var(--red); border-color: var(--red); animation: pulse 1.2s infinite; }
button:disabled { opacity: .5; cursor: default; }
@keyframes pulse { 50% { box-shadow: 0 0 0 10px rgba(255,122,122,.15); } }

/* sign in */
#login { display: grid; place-items: center; min-height: 100dvh; padding: 1.5rem; }
.login-card { width: min(360px, 100%); text-align: center; }
.login-card h1 { letter-spacing: .4em; color: var(--cyan); margin: 1rem 0 1.5rem; font-size: 1.4rem; }
.login-card form { display: grid; gap: 1rem; text-align: start; }
.login-card label { display: grid; gap: .35rem; color: var(--muted); font-size: .9rem; }
.login-card .lang-btn { margin-top: 1.5rem; }
input[type=password], input[inputmode], select, textarea {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: .7rem .8rem; width: 100%;
}
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 2px solid var(--cyan-dim); outline-offset: 1px; }
label.check { display: flex; gap: .5rem; align-items: center; color: var(--muted); }
.reactor {
  width: 84px; height: 84px; margin: 0 auto; border-radius: 50%;
  background: radial-gradient(circle, #e9fdff 0 12%, var(--cyan) 13% 30%, transparent 31% 42%, var(--cyan-dim) 43% 48%, transparent 49%);
  box-shadow: 0 0 40px rgba(92,225,230,.35);
}

/* app shell */
#app { display: flex; flex-direction: column; min-height: 100dvh; }
.top {
  position: sticky; top: 0; z-index: 2; display: flex; justify-content: space-between; align-items: center; gap: .5rem;
  padding: calc(.6rem + env(safe-area-inset-top)) 1rem .6rem; background: rgba(3,7,12,.92); border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
}
.status { display: flex; align-items: center; gap: .5rem; font-size: .85rem; color: var(--muted); min-width: 0; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--faint); flex: none; }
.dot.on { background: var(--green); box-shadow: 0 0 8px var(--green); }
.dot.paused { background: var(--amber); }
.top-actions { display: flex; gap: .35rem; flex-wrap: wrap; justify-content: flex-end; }
main { flex: 1; padding: 1rem 1rem calc(5rem + env(safe-area-inset-bottom)); max-width: 760px; width: 100%; margin: 0 auto; }
.tabs {
  position: fixed; inset: auto 0 0 0; display: grid; grid-template-columns: repeat(3, 1fr);
  background: rgba(3,7,12,.96); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
}
.tabs button { border: 0; border-radius: 0; background: transparent; padding: .9rem 0; color: var(--muted); }
.tabs button.active { color: var(--cyan); box-shadow: inset 0 2px 0 var(--cyan); }

/* cards */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; margin-bottom: .8rem; }
.card.hero h2 { font-size: 1.15rem; line-height: 1.45; margin: .3rem 0 .9rem; }
.card h3 { font-size: .8rem; letter-spacing: .12em; text-transform: uppercase; color: var(--cyan); margin-bottom: .6rem; }
[dir="rtl"] .card h3 { letter-spacing: 0; }
.item { padding: .65rem 0; border-top: 1px solid var(--line); }
.item:first-of-type { border-top: 0; padding-top: 0; }
.item .t { font-weight: 600; }
.item .p { font-size: .8rem; color: var(--cyan-dim); }
.item .d { color: var(--muted); font-size: .92rem; margin-top: .2rem; }
.item .fix { font-size: .9rem; margin-top: .3rem; }
.item.done .t { text-decoration: line-through; color: var(--muted); }
.prio { display: grid; grid-template-columns: auto 1fr; gap: .7rem; align-items: start; }
.prio input { width: 22px; height: 22px; margin-top: .1rem; accent-color: var(--cyan); }
.counts { display: flex; gap: .5rem; margin-top: .5rem; }
.pill { border-radius: 999px; padding: .2rem .7rem; font-size: .85rem; border: 1px solid; }
.pill.red { color: var(--red); } .pill.amber { color: var(--amber); } .pill.green { color: var(--green); }
.lvl { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-inline-end: .4rem; }
.lvl.red { background: var(--red); } .lvl.amber { background: var(--amber); }

/* ask */
.ask-bar { display: flex; gap: .5rem; margin-bottom: .8rem; }
.ask-bar select { flex: 1; }
#thread { display: flex; flex-direction: column; gap: .7rem; margin-bottom: 1rem; }
.msg { border-radius: var(--radius); padding: .7rem .9rem; max-width: 92%; white-space: pre-wrap; word-wrap: break-word; }
.msg.me { align-self: flex-end; background: #0d2a33; }
.msg.jv { align-self: flex-start; background: var(--panel); border: 1px solid var(--line); }
.msg.err { border-color: var(--red); }
.msg .meta { font-size: .75rem; color: var(--faint); margin-top: .35rem; }
.msg .links { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .5rem; }
.msg .links a { color: var(--cyan); }
.msg.pending { color: var(--muted); font-style: italic; }
.composer { position: sticky; bottom: calc(4rem + env(safe-area-inset-bottom)); background: var(--bg); padding-top: .4rem; }
.composer textarea { resize: vertical; min-height: 3.2rem; }
.composer-row { display: flex; align-items: center; gap: .6rem; margin-top: .5rem; }
.composer-row .check { flex: 1; font-size: .85rem; }
