/* Orbita — design system */
:root {
  --bg: #f6f5f2; --bg2: #ffffff; --bg3: #eeece7; --line: #e4e1da; --line2: #d6d2c9;
  --fg: #16181d; --fg2: #5a5e68; --fg3: #9094a0;
  --accent: #6d5dfc; --accent-fg: #fff; --danger: #e5484d; --ok: #30a46c;
  --jarvis: linear-gradient(135deg, #6d5dfc, #c04bff 60%, #ff6b9d);
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 8px 24px -12px rgba(0,0,0,.15);
  --shadow-lg: 0 24px 64px -24px rgba(0,0,0,.35);
  --r: 14px; --r2: 20px;
  --today: #ff5d3a;
  --sat: 1;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --bg: #0b0d12; --bg2: #141720; --bg3: #1c2029; --line: #23272f; --line2: #2f343e; --fg: #f1f2f5; --fg2: #a3a8b4; --fg3: #6a7080; --accent: #8b7dff; --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px -12px rgba(0,0,0,.6); --shadow-lg: 0 24px 64px -24px rgba(0,0,0,.8); color-scheme: dark; } }
:root[data-theme="dark"] { --bg: #0b0d12; --bg2: #141720; --bg3: #1c2029; --line: #23272f; --line2: #2f343e; --fg: #f1f2f5; --fg2: #a3a8b4; --fg3: #6a7080; --accent: #8b7dff; --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px -12px rgba(0,0,0,.6); --shadow-lg: 0 24px 64px -24px rgba(0,0,0,.8); color-scheme: dark; }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--fg); font: 15px/1.45 -apple-system, "SF Pro Text", Inter, system-ui, sans-serif; -webkit-font-smoothing: antialiased; overscroll-behavior-y: none; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
input, textarea, select { border: 1px solid var(--line2); background: var(--bg2); border-radius: 10px; padding: 10px 12px; width: 100%; outline: none; }
input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent); }
textarea { resize: vertical; min-height: 70px; }
h1, h2, h3 { margin: 0; letter-spacing: -.01em; }
h1 { font-size: 28px; font-weight: 800; letter-spacing: -.03em; }
h2 { font-size: 17px; font-weight: 700; }
.muted { color: var(--fg2); } .tiny { font-size: 12px; color: var(--fg3); }
.row { display: flex; align-items: center; gap: 10px; } .grow { flex: 1; min-width: 0; }
.ellip { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* shell */
#app { min-height: 100%; display: flex; flex-direction: column; }
.shell { flex: 1; display: flex; flex-direction: column; max-width: 1100px; width: 100%; margin: 0 auto; }
.top { position: sticky; top: 0; z-index: 20; padding: calc(10px + env(safe-area-inset-top)) 16px 10px; background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: saturate(1.6) blur(18px); -webkit-backdrop-filter: saturate(1.6) blur(18px); display: flex; align-items: center; gap: 10px; }
.top .title { font-weight: 800; font-size: 20px; letter-spacing: -.02em; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 800; letter-spacing: -.02em; }
.brand .dot { width: 22px; height: 22px; border-radius: 50%; background: conic-gradient(from 200deg, #6d5dfc, #ff6b9d, #ffb84d, #30d18c, #6d5dfc); box-shadow: inset 0 0 0 6px var(--bg); }
.main { flex: 1; padding: 0 16px 110px; }
@media (min-width: 900px) { .main { padding-bottom: 40px; } }

/* bottom nav (mobile) / side nav (desktop) */
.nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; justify-content: space-around; padding: 8px 8px calc(8px + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--bg2) 88%, transparent); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); border-top: 1px solid var(--line); }
.nav button { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; font-weight: 600; color: var(--fg3); padding: 4px 10px; border-radius: 12px; min-width: 58px; }
.nav button svg { width: 24px; height: 24px; }
.nav button.on { color: var(--accent); }
.nav .fab { background: var(--jarvis); color: #fff; width: 54px; height: 54px; border-radius: 50%; margin-top: -26px; box-shadow: 0 10px 30px -8px #8b5cf6aa; display: grid; place-items: center; min-width: 0; padding: 0; }
.nav .fab svg { width: 26px; height: 26px; }
@media (min-width: 900px) {
  .shell { flex-direction: row; align-items: flex-start; max-width: 1280px; }
  .nav { position: sticky; top: 0; bottom: auto; flex-direction: column; justify-content: flex-start; width: 200px; height: 100vh; border: 0; border-right: 1px solid var(--line); background: transparent; backdrop-filter: none; padding: 24px 12px; gap: 4px; }
  .nav button { flex-direction: row; gap: 10px; font-size: 14px; padding: 10px 12px; width: 100%; justify-content: flex-start; }
  .nav button.on { background: var(--bg3); }
  .nav .fab { width: 100%; height: 44px; border-radius: 12px; margin: 10px 0 0; justify-content: center; gap: 8px; font-size: 14px; }
  .nav .fab span { display: inline; }
  .content { flex: 1; min-width: 0; }
}
.nav .fab span { display: none; }

/* nav: 'desk' entries only on desktop, 'mob' only on mobile */
.nav button.desk { display: none; }
@media (min-width: 900px) { .nav button.desk { display: flex; } .nav button.mob { display: none; } }
.more-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.more-card { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 16px; border-radius: var(--r2); background: var(--bg2); border: 1px solid var(--line); box-shadow: var(--shadow); text-align: left; }
.more-card svg { width: 26px; height: 26px; color: var(--accent); margin-bottom: 4px; }

/* member chips */
.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 4px 0; }
.chips::-webkit-scrollbar { display: none; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px 5px 6px; border-radius: 999px; border: 1.5px solid var(--line2); font-size: 13px; font-weight: 600; white-space: nowrap; color: var(--fg2); transition: .15s; }
.chip .av { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; background: var(--c); color: #fff; }
.chip.on { background: color-mix(in srgb, var(--c) 14%, var(--bg2)); border-color: var(--c); color: var(--fg); }
.chip.dim { opacity: .45; }

/* cards */
.card { background: var(--bg2); border: 1px solid var(--line); border-radius: var(--r2); padding: 16px; box-shadow: var(--shadow); }
.card + .card { margin-top: 12px; }
.section { margin: 22px 0 10px; display: flex; align-items: baseline; justify-content: space-between; }
.section h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--fg3); font-weight: 700; }

/* event rows */
.ev { display: flex; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); cursor: pointer; }
.ev:first-child { border-top: 0; padding-top: 2px; }
.ev .time { width: 52px; flex: none; font-variant-numeric: tabular-nums; font-size: 13px; color: var(--fg2); font-weight: 600; line-height: 1.3; }
.ev .time small { display: block; font-weight: 400; color: var(--fg3); }
.ev .bar { width: 4px; border-radius: 4px; background: var(--c, var(--accent)); flex: none; }
.ev .t { font-weight: 600; }
.ev .sub { font-size: 13px; color: var(--fg2); }
.ev .who { display: flex; margin-left: auto; align-self: center; }
.av-s { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; background: var(--c); border: 2px solid var(--bg2); margin-left: -8px; }
.av-s:first-child { margin-left: 0; }
.empty { color: var(--fg3); padding: 18px 0; text-align: center; font-size: 14px; }

/* today hero */
.hero { padding: 8px 0 4px; }
.hero .date { font-size: 13px; font-weight: 700; color: var(--today); text-transform: uppercase; letter-spacing: .08em; }
.brief { position: relative; padding: 14px 16px 14px 18px; border-radius: var(--r2); background: linear-gradient(135deg, color-mix(in srgb, #6d5dfc 12%, var(--bg2)), color-mix(in srgb, #ff6b9d 10%, var(--bg2))); border: 1px solid color-mix(in srgb, var(--accent) 25%, var(--line)); margin: 12px 0; font-size: 15px; line-height: 1.5; }
.brief::before { content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 3px; border-radius: 3px; background: var(--jarvis); }
.brief .lbl { font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; background: var(--jarvis); -webkit-background-clip: text; background-clip: text; color: transparent; margin-bottom: 4px; }
.shimmer { background: linear-gradient(90deg, var(--bg3) 25%, var(--line2) 50%, var(--bg3) 75%); background-size: 200% 100%; animation: sh 1.2s infinite; border-radius: 8px; height: 14px; margin: 6px 0; }
@keyframes sh { to { background-position: -200% 0; } }

/* week view */
.wk-head { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin: 6px 0 10px; }
.wk-head button { display: flex; flex-direction: column; align-items: center; padding: 6px 0; border-radius: 12px; color: var(--fg2); font-size: 11px; font-weight: 700; text-transform: uppercase; }
.wk-head button b { font-size: 18px; color: var(--fg); font-weight: 700; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; margin-top: 2px; }
.wk-head button.today b { background: var(--today); color: #fff; }
.wk-head button.sel b { box-shadow: 0 0 0 2px var(--accent); }
.wk-head .dots { display: flex; gap: 2px; height: 5px; margin-top: 3px; }
.wk-head .dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--c); }
.day-block { margin-bottom: 10px; }
.day-block .dh { font-size: 13px; font-weight: 700; color: var(--fg2); padding: 10px 0 4px; display: flex; gap: 8px; align-items: baseline; }
.day-block .dh.today { color: var(--today); }
.free { border: 1.5px dashed var(--line2); border-radius: 14px; padding: 8px; text-align: center; color: var(--fg3); font-size: 13px; cursor: pointer; }
.day-block .dh .meal { margin-left: auto; font-weight: 500; color: var(--fg3); font-size: 12px; }

/* month grid */
.mo-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.mo-grid .wd { text-align: center; font-size: 11px; font-weight: 700; color: var(--fg3); text-transform: uppercase; padding: 6px 0; }
.mo-cell { min-height: 74px; border-radius: 10px; padding: 4px; background: var(--bg2); border: 1px solid var(--line); cursor: pointer; display: flex; flex-direction: column; gap: 2px; overflow: hidden; }
.mo-cell.out { opacity: .4; }
.mo-cell .n { font-size: 12px; font-weight: 700; width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; }
.mo-cell.today .n { background: var(--today); color: #fff; }
.mo-cell .pill { font-size: 10px; line-height: 1.35; padding: 1px 5px; border-radius: 5px; background: color-mix(in srgb, var(--c) 18%, var(--bg2)); color: var(--fg); border-left: 2px solid var(--c); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mo-cell .more { font-size: 10px; color: var(--fg3); padding-left: 4px; }
@media (max-width: 600px) { .mo-cell { min-height: 60px; } .mo-cell .pill { font-size: 0; height: 5px; padding: 0; border: 0; background: var(--c); border-radius: 3px; } }
.mo-nav { display: flex; align-items: center; justify-content: space-between; margin: 6px 0 12px; }
.mo-nav h2 { font-size: 20px; font-weight: 800; letter-spacing: -.02em; }
.icon-btn { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; color: var(--fg2); background: var(--bg2); border: 1px solid var(--line); }
.icon-btn svg { width: 20px; height: 20px; }
.btn { padding: 10px 16px; border-radius: 12px; font-weight: 700; background: var(--bg3); color: var(--fg); }
.btn.primary { background: var(--accent); color: var(--accent-fg); }
.btn.danger { color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, var(--bg2)); }
.btn.jarvis { background: var(--jarvis); color: #fff; }
.btn:disabled { opacity: .5; }

/* lists */
.list-tabs { display: flex; gap: 6px; margin: 6px 0 14px; overflow-x: auto; }
.list-tabs button { padding: 8px 14px; border-radius: 999px; background: var(--bg2); border: 1px solid var(--line); font-weight: 600; white-space: nowrap; }
.list-tabs button.on { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.item { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.item:first-child { border-top: 0; }
.item .chk { width: 24px; height: 24px; border-radius: 8px; border: 2px solid var(--line2); display: grid; place-items: center; flex: none; transition: .15s; }
.item.done .chk { background: var(--ok); border-color: var(--ok); color: #fff; }
.item.done .tx { text-decoration: line-through; color: var(--fg3); }
.item .tx { flex: 1; }
.add-row { display: flex; gap: 8px; margin-top: 10px; }
.add-row input { flex: 1; }

/* meals */
.meal-day { display: grid; grid-template-columns: 70px 1fr 1fr; gap: 8px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); }
.meal-day:first-child { border-top: 0; }
.meal-day .d { font-weight: 700; font-size: 13px; color: var(--fg2); }
.meal-day .d.today { color: var(--today); }
.meal-day input { padding: 8px 10px; font-size: 14px; }

/* sheet / modal */
.sheet-bg { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.45); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); display: flex; align-items: flex-end; justify-content: center; animation: fi .15s; }
.sheet { background: var(--bg2); width: 100%; max-width: 640px; max-height: 92vh; overflow: auto; border-radius: 24px 24px 0 0; padding: 12px 18px calc(20px + env(safe-area-inset-bottom)); box-shadow: var(--shadow-lg); animation: up .22s cubic-bezier(.2,.9,.3,1.1); }
.sheet .grab { width: 40px; height: 5px; border-radius: 3px; background: var(--line2); margin: 0 auto 14px; }
@media (min-width: 700px) { .sheet-bg { align-items: center; } .sheet { border-radius: 24px; animation: fi .18s; } }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
@keyframes fi { from { opacity: 0; } }
.field { margin: 12px 0; } .field label { display: block; font-size: 12px; font-weight: 700; color: var(--fg3); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 6px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.title-in { font-size: 22px; font-weight: 700; border: 0; background: transparent; padding: 6px 0; border-bottom: 2px solid var(--line); border-radius: 0; }
.title-in:focus { box-shadow: none; border-color: var(--accent); }
.sw { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; }
.toggle { width: 46px; height: 28px; border-radius: 14px; background: var(--line2); position: relative; transition: .2s; flex: none; }
.toggle::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.toggle.on { background: var(--ok); } .toggle.on::after { left: 21px; }
.cat-grid { display: flex; flex-wrap: wrap; gap: 6px; }
.cat { padding: 6px 10px; border-radius: 999px; border: 1.5px solid var(--line2); font-size: 13px; font-weight: 600; color: var(--fg2); }
.cat.on { border-color: var(--fg); color: var(--fg); background: var(--bg3); }
.sheet .actions { display: flex; gap: 8px; margin-top: 18px; }
.sheet .actions .btn { flex: 1; }

/* Jarvis chat */
.chat { display: flex; flex-direction: column; height: 100%; }
.chat .msgs { flex: 1; overflow: auto; display: flex; flex-direction: column; gap: 10px; padding: 4px 0 10px; }
.msg { max-width: 86%; padding: 10px 14px; border-radius: 18px; line-height: 1.45; white-space: pre-wrap; }
.msg.u { align-self: flex-end; background: var(--accent); color: #fff; border-bottom-right-radius: 6px; }
.msg.j { align-self: flex-start; background: var(--bg3); border-bottom-left-radius: 6px; }
.msg.j.think { color: var(--fg3); font-style: italic; }
.msg .acts { margin-top: 8px; display: flex; flex-direction: column; gap: 4px; }
.msg .act { font-size: 12px; padding: 5px 9px; border-radius: 8px; background: color-mix(in srgb, var(--ok) 14%, var(--bg2)); color: var(--ok); font-weight: 600; }
.msg .act.err { background: color-mix(in srgb, var(--danger) 14%, var(--bg2)); color: var(--danger); }
.chat .in { display: flex; gap: 8px; align-items: flex-end; padding-top: 8px; border-top: 1px solid var(--line); }
.chat .in textarea { min-height: 44px; max-height: 120px; border-radius: 22px; padding: 11px 16px; }
.chat .send { width: 44px; height: 44px; border-radius: 50%; background: var(--jarvis); color: #fff; display: grid; place-items: center; flex: none; }
.chat .send svg { width: 20px; height: 20px; }
.chat .sugg { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 6px 0; }
.chat .sugg button { white-space: nowrap; padding: 7px 12px; border-radius: 999px; background: var(--bg3); font-size: 13px; }
.jsheet { height: 80vh; display: flex; flex-direction: column; }
.jsheet .hd { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.jsheet .hd .orb { width: 34px; height: 34px; border-radius: 50%; background: var(--jarvis); box-shadow: 0 0 20px #8b5cf6aa; animation: pulse 3s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 34px #ff6b9daa; } }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login .box { width: 100%; max-width: 380px; }
.login .who { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 20px 0; }
.login .who button { padding: 16px; border-radius: 16px; border: 2px solid var(--line); background: var(--bg2); font-weight: 700; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.login .who button.on { border-color: var(--c); background: color-mix(in srgb, var(--c) 10%, var(--bg2)); }
.login .who .av { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; font-size: 24px; background: var(--c); }
.err { color: var(--danger); font-size: 13px; margin-top: 8px; }

/* toast */
.toast { position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--fg); color: var(--bg); padding: 10px 16px; border-radius: 999px; font-weight: 600; font-size: 14px; z-index: 60; box-shadow: var(--shadow-lg); animation: up .2s; white-space: nowrap; }
.conflict { font-size: 12px; color: #d97706; font-weight: 600; }
.activity { font-size: 13px; color: var(--fg2); padding: 6px 0; border-top: 1px solid var(--line); display: flex; gap: 8px; }
.activity:first-child { border-top: 0; }
.activity .tm { color: var(--fg3); flex: none; width: 46px; font-variant-numeric: tabular-nums; }
.settings .krow { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; border-top: 1px solid var(--line); gap: 12px; }
.settings .krow:first-child { border-top: 0; }
code.sm { font-size: 11px; word-break: break-all; color: var(--fg2); }

/* setup link: Jarvis greets by name */
.welcome { display: flex; gap: 12px; align-items: flex-start; margin: 22px 0 6px; }
.welcome .orb { width: 38px; height: 38px; border-radius: 50%; background: var(--jarvis); box-shadow: 0 0 22px #8b5cf6aa; flex: none; animation: pulse 3s infinite; }
.welcome .bubble { background: var(--bg3); border-radius: 18px; border-top-left-radius: 6px; padding: 12px 14px; line-height: 1.5; font-size: 15px; }
