:root {
  --bg: #11100f;
  --bg-soft: #171513;
  --panel: #1d1a18;
  --panel-2: #24201d;
  --panel-3: #2b2622;
  --line: #342e2a;
  --line-soft: rgba(255, 255, 255, .075);
  --text: #f5eee9;
  --muted: #9d928b;
  --faint: #6f6660;
  --accent: #ed8067;
  --accent-bright: #ff9b80;
  --accent-soft: rgba(237, 128, 103, .13);
  --iris: #9c8fff;
  --teal: #63c8b3;
  --yellow: #e4b965;
  --red: #e66d67;
  --green: #66c49b;
  --shadow: 0 24px 80px rgba(0, 0, 0, .35);
  --serif: Georgia, 'Times New Roman', serif;
  --sans: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color-scheme: dark;
  font-family: var(--sans);
  font-synthesis: none;
}

:root[data-theme="light"] {
  --bg: #f2eeea;
  --bg-soft: #ebe5df;
  --panel: #faf7f3;
  --panel-2: #f2ece6;
  --panel-3: #e8e0d8;
  --line: #d9cfc7;
  --line-soft: rgba(48, 37, 30, .09);
  --text: #241e1a;
  --muted: #776a61;
  --faint: #9a8d84;
  --accent: #cf5f49;
  --accent-bright: #df7159;
  --accent-soft: rgba(207, 95, 73, .12);
  --shadow: 0 24px 80px rgba(79, 53, 39, .14);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body { margin: 0; min-height: 100vh; min-height: 100dvh; background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; }
button, input, textarea, select { font: inherit; }
button { color: inherit; }
button, [role="button"] { -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button:disabled { opacity: .45; cursor: not-allowed; }
a { color: var(--accent-bright); }
svg { display: block; }

.app-shell { min-height: 100dvh; display: grid; grid-template-columns: 228px minmax(0, 1fr); }
.rail { position: fixed; inset: 0 auto 0 0; z-index: 20; width: 228px; display: flex; flex-direction: column; border-right: 1px solid var(--line-soft); padding: 28px 18px 22px; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(18px); }
.brand, .mobile-brand { border: 0; background: transparent; display: flex; align-items: center; gap: 11px; padding: 0; cursor: pointer; }
.brand { margin: 0 10px 38px; }
.brand-mark { width: 31px; height: 31px; display: inline-grid; place-items: center; border: 1px solid color-mix(in srgb, var(--accent) 50%, var(--line)); border-radius: 9px; color: var(--accent-bright); font: 600 18px/1 var(--serif); background: linear-gradient(145deg, var(--accent-soft), transparent); box-shadow: inset 0 0 18px rgba(237,128,103,.05); flex: none; }
.brand-mark.large { width: 54px; height: 54px; border-radius: 16px; font-size: 29px; }
.brand-name, .mobile-brand span:last-child { font: 500 22px/1 var(--serif); letter-spacing: -.02em; }
.rail-nav { display: grid; gap: 5px; }
.nav-button { position: relative; width: 100%; border: 0; background: transparent; display: flex; align-items: center; gap: 13px; color: var(--muted); padding: 11px 12px; border-radius: 11px; cursor: pointer; text-align: left; font-size: 14px; transition: .18s ease; }
.nav-button svg { width: 19px; height: 19px; stroke-width: 1.7; }
.nav-button:hover { color: var(--text); background: var(--line-soft); }
.nav-button.active { color: var(--text); background: var(--panel); }
.nav-button.active::before { content: ''; position: absolute; left: -18px; width: 3px; height: 21px; border-radius: 0 5px 5px 0; background: var(--accent); box-shadow: 0 0 14px var(--accent); }
.nav-badge { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; display: grid; place-items: center; border-radius: 10px; background: var(--accent); color: #20120f; font-size: 11px; font-weight: 750; }
.rail-bottom { margin-top: auto; display: flex; align-items: center; justify-content: space-between; padding: 0 8px; }
.icon-button, .avatar, .profile-button, .small-icon { border: 1px solid var(--line); background: var(--panel); display: grid; place-items: center; cursor: pointer; }
.icon-button { width: 38px; height: 38px; border-radius: 11px; color: var(--muted); }
.profile-button { width: 38px; height: 38px; border-radius: 50%; background: linear-gradient(145deg, #594a42, #302824); color: #fff; font-weight: 650; }

.main-shell { grid-column: 2; min-width: 0; min-height: 100dvh; }
.topbar { position: sticky; top: 0; z-index: 15; height: 70px; display: flex; align-items: center; padding: 0 34px; gap: 16px; background: color-mix(in srgb, var(--bg) 85%, transparent); border-bottom: 1px solid var(--line-soft); backdrop-filter: blur(20px); }
.mobile-brand, .avatar { display: none; }
.topbar-context { color: var(--muted); font-size: 13px; letter-spacing: .02em; }
.connection-pill { margin-left: auto; display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; background: var(--panel); border: 1px solid var(--line-soft); border-radius: 99px; padding: 7px 11px; }
.connection-pill i { display: block; width: 7px; height: 7px; border-radius: 50%; background: var(--yellow); box-shadow: 0 0 9px color-mix(in srgb, var(--yellow) 80%, transparent); }
.connection-pill.online i { background: var(--green); box-shadow: 0 0 9px color-mix(in srgb, var(--green) 80%, transparent); }
.connection-pill.offline i { background: var(--red); }
.content { width: min(1180px, 100%); margin: 0 auto; padding: 44px 42px 90px; }
.view { animation: view-in .28s ease both; }
@keyframes view-in { from { opacity: 0; transform: translateY(4px); } }

.eyebrow { margin: 0 0 11px; color: var(--accent); font-size: 10px; font-weight: 750; letter-spacing: .2em; }
.hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 28px; margin: 8px 0 35px; }
.hero h1, .page-heading h1 { margin: 0; font: 400 clamp(34px, 4vw, 55px)/1.04 var(--serif); letter-spacing: -.045em; }
.hero p { margin: 13px 0 0; max-width: 620px; color: var(--muted); line-height: 1.55; }
.hero-orbit { position: relative; width: 102px; height: 102px; flex: none; opacity: .85; }
.hero-orbit::before, .hero-orbit::after { content: ''; position: absolute; inset: 8px; border: 1px solid var(--line); border-radius: 50%; }
.hero-orbit::after { inset: 24px; border-color: var(--accent); box-shadow: 0 0 40px var(--accent-soft); }
.hero-orbit i { position: absolute; left: 47px; top: 8px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 15px var(--accent); transform-origin: 4px 43px; animation: orbit 7s linear infinite; }
@keyframes orbit { to { transform: rotate(1turn); } }

.composer { position: relative; border: 1px solid var(--line); border-radius: 18px; background: linear-gradient(145deg, var(--panel), color-mix(in srgb, var(--panel) 82%, var(--bg))); box-shadow: 0 20px 70px rgba(0,0,0,.14); overflow: hidden; transition: border-color .2s, box-shadow .2s; }
.composer:focus-within { border-color: color-mix(in srgb, var(--accent) 58%, var(--line)); box-shadow: 0 20px 70px rgba(0,0,0,.18), 0 0 0 3px var(--accent-soft); }
.composer textarea { display: block; width: 100%; min-height: 114px; max-height: 280px; resize: none; border: 0; outline: 0; background: transparent; color: var(--text); padding: 20px 21px 8px; font-size: 16px; line-height: 1.55; }
.composer textarea::placeholder { color: var(--faint); }
.composer-footer { min-height: 57px; display: flex; align-items: center; gap: 8px; padding: 8px 10px 10px 13px; }
.tool-button { width: 37px; height: 37px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); display: grid; place-items: center; cursor: pointer; }
.tool-button:hover { background: var(--line-soft); color: var(--text); }
.tool-button svg { width: 19px; height: 19px; }
.select-chip { appearance: none; border: 1px solid var(--line-soft); background: var(--panel-2); color: var(--muted); padding: 8px 28px 8px 10px; border-radius: 9px; font-size: 11px; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 13px) 50%, calc(100% - 9px) 50%; background-size: 4px 4px; background-repeat: no-repeat; }
.send-button { margin-left: auto; width: 39px; height: 39px; border: 0; border-radius: 11px; background: var(--accent); color: #25120e; display: grid; place-items: center; cursor: pointer; transition: transform .16s, filter .16s; }
.send-button:hover { filter: brightness(1.08); transform: translateY(-1px); }
.send-button svg { width: 18px; height: 18px; stroke-width: 2.3; }
.attachment-strip { display: flex; gap: 7px; overflow-x: auto; padding: 0 13px 8px; }
.attachment-chip { display: flex; align-items: center; gap: 6px; max-width: 190px; border: 1px solid var(--line); background: var(--panel-2); border-radius: 8px; padding: 6px 8px; color: var(--muted); font-size: 11px; }
.attachment-chip span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.attachment-chip button { border: 0; background: none; color: var(--muted); padding: 0; cursor: pointer; }

.metric-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 25px 0 37px; }
.metric { border: 1px solid var(--line-soft); background: color-mix(in srgb, var(--panel) 72%, transparent); border-radius: 14px; padding: 15px 16px; min-width: 0; }
.metric-top { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 11px; }
.metric-top svg { width: 16px; height: 16px; color: var(--faint); }
.metric strong { display: block; margin-top: 8px; font: 400 25px/1 var(--serif); }
.metric small { color: var(--faint); font-size: 10px; }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(270px, .8fr); gap: 18px; align-items: start; }
.stack { display: grid; gap: 18px; }
.panel { border: 1px solid var(--line-soft); background: color-mix(in srgb, var(--panel) 86%, transparent); border-radius: 16px; overflow: hidden; }
.panel-header { min-height: 55px; display: flex; align-items: center; gap: 10px; padding: 0 17px; border-bottom: 1px solid var(--line-soft); }
.panel-header h2 { margin: 0; font-size: 12px; font-weight: 650; letter-spacing: .02em; }
.panel-header .count { color: var(--faint); font-size: 11px; }
.panel-header .spacer { flex: 1; }
.link-button { border: 0; background: transparent; color: var(--accent); padding: 5px; cursor: pointer; font-size: 11px; }
.empty { padding: 37px 24px; text-align: center; color: var(--muted); }
.empty-icon { width: 42px; height: 42px; margin: 0 auto 12px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; color: var(--faint); }
.empty-icon svg { width: 19px; height: 19px; }
.empty p { margin: 0; font-size: 12px; line-height: 1.5; }

.goal-list { display: grid; }
.goal-row { width: 100%; display: grid; grid-template-columns: auto minmax(0,1fr) auto; align-items: center; gap: 13px; border: 0; border-bottom: 1px solid var(--line-soft); background: transparent; text-align: left; padding: 14px 17px; cursor: pointer; transition: background .16s; }
.goal-row:last-child { border-bottom: 0; }
.goal-row:hover { background: var(--line-soft); }
.status-ring { --progress: 0deg; position: relative; width: 35px; height: 35px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--status-color, var(--accent)) var(--progress), var(--line) 0); }
.status-ring::before { content: ''; position: absolute; inset: 3px; border-radius: 50%; background: var(--panel); }
.status-ring svg { position: relative; z-index: 1; width: 14px; height: 14px; color: var(--status-color, var(--accent)); }
.goal-copy { min-width: 0; }
.goal-copy strong { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 13px; font-weight: 590; }
.goal-copy small { display: block; margin-top: 5px; color: var(--muted); font-size: 10px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.goal-meta { text-align: right; color: var(--faint); font-size: 10px; }
.goal-meta b { display: block; color: var(--muted); font-weight: 550; margin-bottom: 4px; }

.approval-card { padding: 15px 16px; border-bottom: 1px solid var(--line-soft); }
.approval-card:last-child { border-bottom: 0; }
.approval-top { display: flex; align-items: center; gap: 8px; }
.risk-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--yellow); }
.risk-dot.high { background: var(--red); }
.approval-top strong { font-size: 12px; }
.approval-card p { color: var(--muted); margin: 9px 0 13px; font-size: 11px; line-height: 1.45; }
.action-row { display: flex; gap: 8px; }
.mini-button { border: 1px solid var(--line); background: var(--panel-2); color: var(--muted); border-radius: 8px; padding: 7px 10px; font-size: 10px; cursor: pointer; }
.mini-button:hover { color: var(--text); }
.mini-button.approve { border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); color: var(--accent-bright); background: var(--accent-soft); }
.mini-button.danger { color: var(--red); }

.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin: 8px 0 30px; }
.page-heading h1 { font-size: clamp(34px, 4vw, 48px); }
.page-heading p { margin: 10px 0 0; color: var(--muted); font-size: 13px; }
.primary-button { border: 0; border-radius: 11px; background: var(--accent); color: #25120e; padding: 11px 15px; font-weight: 700; font-size: 12px; display: inline-flex; align-items: center; justify-content: center; gap: 22px; cursor: pointer; }
.primary-button.full { width: 100%; padding: 13px 16px; }
.filter-row { display: flex; gap: 7px; overflow-x: auto; margin-bottom: 15px; scrollbar-width: none; }
.filter-chip { border: 1px solid var(--line-soft); background: transparent; color: var(--muted); border-radius: 99px; padding: 7px 11px; white-space: nowrap; font-size: 10px; cursor: pointer; }
.filter-chip.active { background: var(--panel-2); color: var(--text); border-color: var(--line); }

.task-card { border: 1px solid var(--line-soft); border-radius: 15px; background: var(--panel); margin-bottom: 10px; overflow: hidden; }
.task-card-main { display: grid; grid-template-columns: auto minmax(0,1fr) auto; align-items: center; gap: 14px; padding: 16px; cursor: pointer; }
.task-state { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 10px; background: var(--panel-2); color: var(--status-color, var(--muted)); }
.task-state svg { width: 16px; height: 16px; }
.task-copy { min-width: 0; }
.task-copy h3 { margin: 0; font-size: 13px; font-weight: 620; }
.task-copy p { margin: 5px 0 0; color: var(--muted); font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.task-progress { width: 92px; }
.progress-track { height: 3px; border-radius: 4px; background: var(--line); overflow: hidden; }
.progress-track i { display: block; height: 100%; background: var(--status-color, var(--accent)); border-radius: inherit; }
.task-progress small { display: block; margin-top: 6px; color: var(--faint); text-align: right; font-size: 9px; }
.task-details { display: none; border-top: 1px solid var(--line-soft); padding: 14px 16px; color: var(--muted); font-size: 11px; line-height: 1.55; }
.task-card.expanded .task-details { display: block; }
.task-details pre { overflow: auto; background: var(--bg); border: 1px solid var(--line-soft); border-radius: 9px; padding: 12px; color: var(--muted); font: 10px/1.5 ui-monospace, SFMono-Regular, Consolas, monospace; white-space: pre-wrap; }

.timeline { position: relative; }
.timeline::before { content: ''; position: absolute; left: 16px; top: 20px; bottom: 20px; width: 1px; background: var(--line); }
.event-row { position: relative; display: grid; grid-template-columns: 33px minmax(0,1fr) auto; gap: 12px; align-items: start; padding: 12px 0; }
.event-dot { z-index: 1; width: 33px; height: 33px; display: grid; place-items: center; border: 1px solid var(--line); background: var(--bg); border-radius: 50%; color: var(--muted); }
.event-dot svg { width: 14px; height: 14px; }
.event-copy strong { font-size: 12px; font-weight: 580; }
.event-copy p { margin: 4px 0 0; color: var(--muted); font-size: 10px; line-height: 1.45; }
.event-row time { color: var(--faint); font-size: 9px; }
.evidence-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 10px; margin-top: 22px; }
.evidence-card { min-height: 110px; border: 1px solid var(--line-soft); border-radius: 13px; background: var(--panel); padding: 14px; cursor: pointer; transition: transform .16s, border-color .16s; }
.evidence-card:hover { transform: translateY(-2px); border-color: var(--line); }
.evidence-card svg { width: 20px; height: 20px; color: var(--accent); }
.evidence-card strong { display: block; margin-top: 17px; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.evidence-card small { display: block; margin-top: 5px; color: var(--faint); font-size: 9px; }

.device-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; }
.device-card { border: 1px solid var(--line-soft); border-radius: 16px; background: var(--panel); padding: 18px; }
.device-head { display: flex; align-items: center; gap: 12px; }
.device-icon { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; color: var(--accent); background: var(--accent-soft); }
.device-icon svg { width: 21px; height: 21px; }
.device-title { min-width: 0; }
.device-title strong { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.device-title small { color: var(--muted); font-size: 10px; }
.online-dot { margin-left: auto; width: 8px; height: 8px; border-radius: 50%; background: var(--faint); }
.online-dot.online { background: var(--green); box-shadow: 0 0 9px var(--green); }
.cap-list { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 17px; }
.cap-chip { border: 1px solid var(--line-soft); border-radius: 6px; padding: 4px 6px; color: var(--muted); font-size: 8px; text-transform: uppercase; letter-spacing: .06em; }
.device-foot { margin-top: 16px; padding-top: 13px; border-top: 1px solid var(--line-soft); display: flex; justify-content: space-between; color: var(--faint); font-size: 9px; }

.auth-screen { position: fixed; z-index: 100; inset: 0; display: grid; place-items: center; padding: 24px; background: var(--bg); transition: opacity .3s, visibility .3s; }
.auth-screen.hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.auth-glow { position: absolute; width: min(70vw, 700px); aspect-ratio: 1; background: radial-gradient(circle, rgba(237,128,103,.12), transparent 64%); pointer-events: none; }
.auth-card { position: relative; width: min(420px, 100%); border: 1px solid var(--line); border-radius: 24px; background: color-mix(in srgb, var(--panel) 92%, transparent); box-shadow: var(--shadow); padding: 34px; }
.auth-brand { margin-bottom: 28px; }
.auth-card h1 { margin: 0 0 11px; font: 400 35px/1.05 var(--serif); letter-spacing: -.035em; }
.muted { color: var(--muted); }
.auth-card > .muted { margin: 0 0 28px; font-size: 12px; line-height: 1.55; }
.auth-card form { display: grid; gap: 14px; }
.auth-card label { display: grid; gap: 7px; color: var(--muted); font-size: 10px; }
.auth-card input, .form-input { width: 100%; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--text); padding: 12px 13px; outline: 0; }
.auth-card input:focus, .form-input:focus { border-color: var(--accent); }
.auth-status { min-height: 18px; margin-top: 12px; color: var(--red); font-size: 10px; }
.microcopy { margin: 9px 0 0; color: var(--faint); font-size: 9px; text-align: center; }

.modal-backdrop { position: fixed; z-index: 80; inset: 0; display: grid; place-items: center; padding: 18px; background: rgba(5,4,4,.68); backdrop-filter: blur(8px); animation: fade .18s ease; }
@keyframes fade { from { opacity: 0; } }
.modal { width: min(590px, 100%); max-height: min(780px, calc(100dvh - 36px)); overflow: auto; border: 1px solid var(--line); border-radius: 20px; background: var(--panel); box-shadow: var(--shadow); animation: modal-in .22s ease; }
@keyframes modal-in { from { opacity: 0; transform: translateY(8px) scale(.99); } }
.modal-header { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 10px; padding: 17px 19px; background: color-mix(in srgb, var(--panel) 92%, transparent); backdrop-filter: blur(15px); border-bottom: 1px solid var(--line-soft); }
.modal-header h2 { margin: 0; font: 400 21px/1.1 var(--serif); }
.modal-header button { margin-left: auto; border: 0; background: transparent; color: var(--muted); cursor: pointer; }
.modal-body { padding: 20px; }
.detail-title { margin: 0; font: 400 29px/1.15 var(--serif); }
.detail-intent { color: var(--muted); font-size: 12px; line-height: 1.6; white-space: pre-wrap; }
.detail-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 20px 0; }
.detail-stat { background: var(--panel-2); border-radius: 10px; padding: 10px; }
.detail-stat small { display: block; color: var(--faint); font-size: 8px; text-transform: uppercase; letter-spacing: .08em; }
.detail-stat b { display: block; margin-top: 6px; font-size: 11px; }
.section-label { margin: 22px 0 10px; color: var(--faint); font-size: 9px; text-transform: uppercase; letter-spacing: .14em; }
.step-list { display: grid; gap: 7px; }
.step { display: grid; grid-template-columns: auto minmax(0,1fr) auto; gap: 10px; align-items: center; border: 1px solid var(--line-soft); border-radius: 10px; padding: 10px; }
.step i { width: 8px; height: 8px; border-radius: 50%; background: var(--status-color, var(--faint)); }
.step strong { display: block; font-size: 10px; }
.step small { display: block; margin-top: 3px; color: var(--faint); font-size: 8px; }
.settings-group { border-bottom: 1px solid var(--line-soft); padding: 0 0 20px; margin-bottom: 20px; }
.settings-group:last-child { border: 0; margin: 0; }
.settings-group h3 { margin: 0 0 12px; font-size: 11px; }
.settings-row { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin: 10px 0; color: var(--muted); font-size: 11px; }
.settings-row select { border: 1px solid var(--line); background: var(--bg); color: var(--text); border-radius: 8px; padding: 7px; }
.code-box { margin: 18px 0; border: 1px dashed color-mix(in srgb, var(--accent) 55%, var(--line)); background: var(--accent-soft); border-radius: 13px; padding: 19px; text-align: center; }
.code-box strong { font: 500 27px/1 var(--serif); letter-spacing: .09em; color: var(--accent-bright); }
.code-box small { display: block; color: var(--muted); margin-top: 9px; }

.toast-stack { position: fixed; z-index: 120; right: 22px; bottom: 22px; display: grid; gap: 8px; pointer-events: none; }
.toast { width: min(340px, calc(100vw - 32px)); border: 1px solid var(--line); background: var(--panel-2); color: var(--text); box-shadow: var(--shadow); border-radius: 11px; padding: 11px 13px; font-size: 11px; animation: toast-in .25s ease both; }
.toast.error { border-color: color-mix(in srgb, var(--red) 45%, var(--line)); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
.skeleton { position: relative; overflow: hidden; min-height: 60px; background: var(--panel); border-radius: 12px; }
.skeleton::after { content: ''; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, var(--line-soft), transparent); animation: shimmer 1.4s infinite; }
@keyframes shimmer { to { transform: translateX(100%); } }
.bottom-nav { display: none; }

@media (max-width: 900px) {
  .app-shell { display: block; }
  .rail { display: none; }
  .main-shell { min-height: 100dvh; }
  .topbar { height: 62px; padding: max(8px, env(safe-area-inset-top)) 17px 0; }
  .mobile-brand { display: flex; }
  .mobile-brand .brand-mark { width: 27px; height: 27px; border-radius: 8px; font-size: 16px; }
  .mobile-brand span:last-child { font-size: 19px; }
  .topbar-context { display: none; }
  .avatar { display: grid; width: 30px; height: 30px; border-radius: 50%; font-size: 11px; }
  .connection-pill { margin-left: auto; padding: 6px 8px; }
  .connection-pill span { display: none; }
  .content { padding: 30px 17px calc(100px + env(safe-area-inset-bottom)); }
  .bottom-nav { position: fixed; z-index: 30; left: 12px; right: 12px; bottom: max(10px, env(safe-area-inset-bottom)); height: 63px; display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--line); border-radius: 18px; background: color-mix(in srgb, var(--panel) 92%, transparent); box-shadow: 0 12px 45px rgba(0,0,0,.3); backdrop-filter: blur(20px); padding: 6px; }
  .bottom-nav .nav-button { justify-content: center; flex-direction: column; gap: 3px; border-radius: 12px; padding: 5px 2px; font-size: 8px; }
  .bottom-nav .nav-button svg { width: 18px; height: 18px; }
  .bottom-nav .nav-button.active::before { display: none; }
  .bottom-nav .nav-badge { position: absolute; top: 2px; left: calc(50% + 5px); min-width: 15px; height: 15px; padding: 0 4px; font-size: 8px; }
  .hero { align-items: center; margin-top: 0; margin-bottom: 26px; }
  .hero h1 { font-size: 38px; }
  .hero p { font-size: 12px; margin-top: 9px; }
  .hero-orbit { width: 73px; height: 73px; }
  .hero-orbit::before { inset: 6px; }
  .hero-orbit::after { inset: 18px; }
  .hero-orbit i { left: 33px; top: 6px; transform-origin: 4px 30px; }
  .composer textarea { min-height: 104px; font-size: 15px; }
  .select-chip.autonomy { display: none; }
  .metric-row { grid-template-columns: repeat(2, minmax(0,1fr)); margin: 17px 0 27px; }
  .metric { padding: 13px; }
  .metric strong { font-size: 22px; }
  .dashboard-grid { display: grid; grid-template-columns: 1fr; }
  .page-heading { align-items: center; margin-top: 0; }
  .page-heading h1 { font-size: 37px; }
  .page-heading p { font-size: 11px; }
  .evidence-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .device-grid { grid-template-columns: 1fr; }
  .modal-backdrop { align-items: end; padding: 0; }
  .modal { width: 100%; max-height: calc(100dvh - 45px); border-radius: 22px 22px 0 0; padding-bottom: env(safe-area-inset-bottom); }
  .auth-card { padding: 27px 22px; }
  .toast-stack { right: 16px; bottom: calc(88px + env(safe-area-inset-bottom)); }
}

@media (max-width: 460px) {
  .goal-row { grid-template-columns: auto minmax(0,1fr); }
  .goal-meta { display: none; }
  .task-progress { width: 62px; }
  .evidence-grid { grid-template-columns: 1fr 1fr; }
  .evidence-card { min-height: 96px; }
  .detail-stats { grid-template-columns: 1fr 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
}
