:root {
  --bg: #0f1420;
  --side: #141b2b;
  --side-2: #1b2435;
  --surface: #ffffff;
  --surface-2: #f5f7fb;
  --page: #eef1f7;
  --border: #e1e6ef;
  --text: #121a27;
  --muted: #6a7691;
  --accent: #4f6bff;
  --accent-soft: #eaeeff;
  --good: #11a66b;
  --warn: #e08a16;
  --bad: #e0443e;
  --radius: 16px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --surface: #161d2b;
    --surface-2: #1b2433;
    --page: #10161f;
    --border: #283243;
    --text: #e8eef9;
    --muted: #93a1ba;
    --accent: #7e92ff;
    --accent-soft: #212c4a;
  }
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--page);
  color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 232px;
  flex: none;
  position: sticky; top: 0; height: 100vh;
  background: linear-gradient(180deg, var(--side), var(--side-2));
  color: #dfe6f5;
  display: flex;
  flex-direction: column;
  padding: 18px 14px;
  gap: 18px;
}

.brand { display: flex; align-items: center; gap: 10px; padding: 0 6px; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: var(--accent); color: #fff; font-weight: 700; font-size: 13px; letter-spacing: .02em;
}
.brand-text { font-weight: 650; font-size: 15px; }

.side-device {
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 12px; padding: 11px 12px; display: grid; gap: 2px;
}
.side-device-name { font-weight: 650; font-size: 14px; }
.side-device-sub { font-size: 12px; color: #93a1ba; }

.nav { display: grid; gap: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 11px; width: 100%;
  padding: 10px 12px; border: 0; border-radius: 10px;
  background: none; color: #b9c4db; font: inherit; font-size: 14px;
  cursor: pointer; text-align: left; transition: background .15s, color .15s;
}
.nav-item svg { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.nav-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-item.is-active { background: var(--accent); color: #fff; }
.nav-item:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

.side-foot {
  margin-top: auto; display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: #93a1ba; padding: 0 6px;
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: #6a7691; flex: none; }
.dot.on { background: var(--good); }
.dot.off { background: var(--bad); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: flex; align-items: center; gap: 28px;
  padding: 14px 24px; background: var(--surface); border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.topbar-cell { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.topbar-cell strong { font-size: 14.5px; font-weight: 650; }
.topbar-label { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }


.chip {
  display: inline-block; align-self: flex-start; padding: 2px 9px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent);
  font-size: 11.5px; font-weight: 650; white-space: nowrap;
}

.batt-mini { display: inline-flex; align-items: center; gap: 3px; margin-top: 3px; }
.batt-mini i {
  display: block; width: 34px; height: 13px; border: 1.6px solid var(--muted);
  border-radius: 3px; position: relative; overflow: hidden;
}
.batt-mini i::after {
  content: ""; position: absolute; inset: 1.5px; width: var(--lvl, 0%);
  background: var(--good); border-radius: 1px;
}

.viewport { flex: 1; padding: 22px 24px 36px; }
.page { display: none; }
.page.is-active { display: block; }

.btn {
  font: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer;
  border-radius: 10px; padding: 8px 15px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text);
}
.btn:hover:not(:disabled) { border-color: var(--accent); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.solid { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn:focus-visible, .link:focus-visible, .icon-btn:focus-visible, .search:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
.link { background: none; border: 0; color: var(--accent); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; padding: 0; }
.icon-btn { background: none; border: 0; color: var(--muted); font-size: 26px; line-height: 1; cursor: pointer; padding: 0 6px; border-radius: 8px; }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px;
}
.card h2, .card h3 {
  margin: 0 0 14px; font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .07em; color: var(--muted);
}

.state { padding: 60px 20px; display: grid; justify-items: center; gap: 10px; text-align: center; }
.state[hidden] { display: none; }
.state p { margin: 0; color: var(--muted); }
.state-title { font-weight: 650; font-size: 15px; color: var(--text); }
.state-msg { max-width: 48ch; }
.state-code { font-size: 12px; font-family: ui-monospace, Menlo, monospace; }
.state.err .state-title { color: var(--bad); }
.spinner {
  width: 28px; height: 28px; border-radius: 50%;
  border: 3px solid var(--border); border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } }

.info-grid { display: grid; gap: 16px; grid-template-columns: 1fr; }
.info-grid[hidden] { display: none; }
@media (min-width: 900px) { .info-grid { grid-template-columns: 240px 1fr; } }
@media (min-width: 1240px) { .info-grid { grid-template-columns: 240px 1fr 310px; } }

.device-card { display: grid; justify-items: center; gap: 16px; align-content: start; align-self: start; }
.phone {
  position: relative; width: 148px; height: 290px; border-radius: 26px;
  border: 3px solid var(--border); background: linear-gradient(165deg, #2b3550, #161d2b);
  padding: 8px; box-shadow: 0 14px 30px rgba(16, 24, 44, .18);
}
.phone-screen {
  position: relative; overflow: hidden; isolation: isolate;
  width: 100%; height: 100%; border-radius: 19px;
  background: radial-gradient(120% 90% at 30% 10%, #4f6bff33, transparent 60%), #0f1626;
  display: grid; place-content: center; gap: 4px; text-align: center;
}
.phone-level { font-size: 30px; font-weight: 700; color: #fff; font-variant-numeric: tabular-nums; }
.phone-name { font-size: 12px; color: #9fb0d0; }
.phone-notch {
  position: absolute; top: 11px; left: 50%; transform: translateX(-50%);
  width: 62px; height: 16px; border-radius: 0 0 11px 11px; background: #0b1120;
}
.device-tags { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }

.specs { margin: 0; display: grid; gap: 0; }
.specs > div {
  display: flex; align-items: baseline; justify-content: space-between; gap: 16px;
  padding: 9px 0; border-bottom: 1px solid var(--border);
}
.specs > div:last-child { border-bottom: 0; }
.specs dt { color: var(--muted); font-size: 13px; }
.specs dd { margin: 0; font-size: 13.5px; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }

.side-stack { display: grid; gap: 16px; align-content: start; align-self: start; }
.metric-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.metric-head > span:first-child { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.metric-body { display: flex; align-items: center; gap: 16px; }

.gauge {
  --pct: 0; --col: var(--good);
  width: 78px; height: 78px; flex: none; border-radius: 50%; display: grid; place-items: center;
  background: conic-gradient(var(--col) calc(var(--pct) * 1%), var(--border) 0);
  position: relative;
}
.gauge::before { content: ""; position: absolute; inset: 8px; border-radius: 50%; background: var(--surface); }
.gauge span { position: relative; font-size: 14px; font-weight: 700; }
.gauge.alt { --col: var(--accent); }

.mini { margin: 0; display: grid; gap: 6px; flex: 1; min-width: 0; }
.mini > div { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.mini dt { color: var(--muted); font-size: 12.5px; }
.mini dd { margin: 0; font-size: 13px; font-weight: 650; font-variant-numeric: tabular-nums; }

.check-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 9px; }
.check-list li { display: flex; align-items: center; gap: 9px; font-size: 13px; }
.check-list .label { color: var(--muted); }
.check-list .detail { margin-left: auto; font-weight: 650; font-variant-numeric: tabular-nums; }
.pip { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--muted); }
.pip.normal { background: var(--good); }
.pip.warning { background: var(--warn); }
.pip.unknown { background: var(--muted); }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h2 { margin: 0; font-size: 19px; font-weight: 680; }
.page-sub { margin: 3px 0 0; font-size: 13px; color: var(--muted); }
.search {
  font: inherit; font-size: 13.5px; padding: 9px 13px; min-width: 260px;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface); color: var(--text);
}

.tile-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.tile-list[hidden] { display: none; }
@media (min-width: 760px) { .tile-list { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1300px) { .tile-list { grid-template-columns: 1fr 1fr 1fr; } }

.tile {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 13px; padding: 12px 14px; min-width: 0;
}
.tile-icon {
  width: 38px; height: 38px; flex: none; border-radius: 10px; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 13px;
}
.tile-icon.image { background: #e7f6ee; color: var(--good); }
.tile-icon.video { background: #fdeee9; color: #d9633c; }
.tile-icon.audio { background: #f0ecfd; color: #7a5bd8; }
.tile-icon.document { background: #eaf0fb; color: #3f6ec6; }
.tile-body { min-width: 0; flex: 1; }
.tile-name { font-size: 13.8px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile-sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile-meta { text-align: right; font-size: 12px; color: var(--muted); flex: none; display: grid; gap: 2px; }
.tile-meta strong { font-size: 12.5px; color: var(--text); font-variant-numeric: tabular-nums; }
.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 10.5px; font-weight: 700; letter-spacing: .03em; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
.badge.user { background: var(--accent-soft); color: var(--accent); border-color: transparent; }

.modal {
  border: 1px solid var(--border); border-radius: 20px; padding: 0;
  width: min(1000px, calc(100vw - 32px)); max-height: calc(100vh - 48px);
  background: var(--surface); color: var(--text); overflow: auto;
  box-shadow: 0 24px 60px rgba(10, 18, 36, .32);
}
.modal::backdrop { background: rgba(10, 16, 26, .6); }
.modal-head {
  position: sticky; top: 0; z-index: 2; background: var(--surface);
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  padding: 20px 22px 14px; border-bottom: 1px solid var(--border);
}
.modal-head h2 { margin: 0; font-size: 19px; font-weight: 680; }
.modal-sub { margin: 4px 0 0; font-size: 13px; color: var(--muted); }
.modal-actions { display: flex; align-items: center; gap: 8px; }
.modal-body { padding: 18px 22px 24px; display: grid; gap: 14px; }
.modal-body[hidden] { display: none; }
.bd-top, .bd-bottom { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 780px) {
  .bd-top { grid-template-columns: .9fr 1.1fr; }
  .bd-bottom { grid-template-columns: repeat(3, 1fr); }
}

.batt-visual { display: flex; align-items: center; justify-content: center; gap: 4px; margin-bottom: 14px; }
.batt-shell {
  position: relative; width: 180px; height: 70px; border: 3px solid var(--muted);
  border-radius: 12px; padding: 4px; overflow: hidden; background: var(--surface-2);
}
.batt-fill { position: relative; height: 100%; width: 0%; border-radius: 7px; background: linear-gradient(90deg, #22c55e, var(--good)); transition: width 1.1s cubic-bezier(.2, .8, .2, 1); }
.batt-fill.low { background: linear-gradient(90deg, #f6a723, var(--warn)); }
.batt-fill.critical { background: linear-gradient(90deg, #f4675f, var(--bad)); }
.batt-fill.unknown { width: 100%; background: repeating-linear-gradient(45deg, var(--border) 0 8px, var(--surface-2) 8px 16px); }
.batt-shell span { position: absolute; inset: 0; display: grid; place-items: center; font-size: 22px; font-weight: 700; }
.batt-cap { width: 8px; height: 24px; border-radius: 0 4px 4px 0; background: var(--muted); }

.health-row { display: flex; align-items: center; gap: 16px; margin-bottom: 14px; flex-wrap: wrap; }
.rows { margin: 0; display: grid; gap: 7px; }
.rows > div { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; }
.rows dt { color: var(--muted); font-size: 13px; }
.rows dd { margin: 0; font-size: 13.5px; font-weight: 650; text-align: right; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }

dd.na, .specs dd.na, .mini dd.na { color: var(--muted); font-weight: 500; font-style: italic; }
dd.good { color: var(--good); }
dd.warn { color: var(--warn); }
dd.bad { color: var(--bad); }

.notes { border: 1px solid var(--border); border-radius: 12px; padding: 11px 15px; background: var(--surface-2); }
.notes[hidden] { display: none; }
.notes summary { cursor: pointer; font-size: 13px; color: var(--muted); }
.notes ul { margin: 10px 0 0; padding-left: 18px; font-size: 12.5px; color: var(--muted); }
.notes li { margin-bottom: 4px; }
.muted { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }

@media (max-width: 760px) {
  .shell { flex-direction: column; }
  .sidebar { position: static; height: auto; width: 100%; flex-direction: row; align-items: center; gap: 12px; padding: 10px 12px; overflow-x: auto; }
  .side-device, .side-foot { display: none; }
  .nav { grid-auto-flow: column; }
  .viewport { padding: 16px 14px 32px; }
}

/* ---------- motion ---------- */

@property --pct { syntax: "<number>"; inherits: true; initial-value: 0; }

.gauge { transition: --pct 1.1s cubic-bezier(.2, .8, .2, 1); }

@keyframes rise { from { opacity: 0; transform: translateY(12px); } }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(14px) scale(.97); } }
@keyframes ring {
  0% { box-shadow: 0 0 0 0 rgba(79, 107, 255, .45); }
  70%, 100% { box-shadow: 0 0 0 10px rgba(79, 107, 255, 0); }
}
@keyframes beat {
  0% { box-shadow: 0 0 0 0 rgba(17, 166, 107, .55); }
  70%, 100% { box-shadow: 0 0 0 7px rgba(17, 166, 107, 0); }
}
@keyframes sweep { from { transform: translateX(-100%); } to { transform: translateX(250%); } }
@keyframes float { 50% { transform: translateY(-6px); } }
@keyframes plug { 0%, 15% { transform: translateY(-12px); opacity: .35; } 55%, 100% { transform: translateY(0); opacity: 1; } }

.page.is-active { animation: fade .3s ease both; }

.anim-in .card,
.anim-in .specs > div,
.anim-in .check-list li,
.tile-list.anim-in .tile {
  animation: rise .55s cubic-bezier(.2, .8, .2, 1) both;
  animation-delay: calc(var(--i, 0) * 70ms);
}
.anim-in .specs > div, .anim-in .check-list li { animation-duration: .4s; }

.card, .tile { transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease; }
.tile:hover { transform: translateY(-2px); border-color: var(--accent); box-shadow: 0 8px 20px rgba(16, 24, 44, .08); }
.btn { transition: border-color .15s, background-color .15s, transform .1s; }
.btn:active:not(:disabled) { transform: scale(.97); }

.btn.solid.attention { animation: ring 2.2s ease-out infinite; }
.dot.on { animation: beat 2.4s ease-out infinite; }

.phone { animation: float 6s ease-in-out infinite; }
.phone-screen > span:not(.phone-fill) { position: relative; z-index: 1; }
.phone-fill {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 0;
  height: var(--lvl, 0%);
  background: linear-gradient(0deg, rgba(79, 107, 255, .55), rgba(79, 107, 255, .12));
  transition: height 1.2s cubic-bezier(.2, .8, .2, 1);
}
.phone-fill.charging { background: linear-gradient(0deg, rgba(17, 166, 107, .6), rgba(17, 166, 107, .12)); }

.batt-fill.charging::after, .batt-mini.charging i::before {
  content: ""; position: absolute; inset: 0; width: 40%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .55), transparent);
  animation: sweep 1.8s ease-in-out infinite;
}
.batt-mini i::after { transition: width .8s cubic-bezier(.2, .8, .2, 1); }
.batt-mini.charging i::before { z-index: 1; }

.modal[open] { animation: pop .3s cubic-bezier(.2, .8, .2, 1); }
.modal[open]::backdrop { animation: fade .3s ease; }

.plug {
  width: 22px; height: 34px; border-radius: 6px 6px 4px 4px; margin-bottom: 6px;
  border: 2px solid var(--muted); position: relative;
  animation: plug 2.4s cubic-bezier(.2, .8, .2, 1) infinite alternate;
}
.plug::after {
  content: ""; position: absolute; left: 50%; bottom: -14px; width: 2px; height: 12px;
  background: var(--muted); transform: translateX(-50%);
}

.demo-flag {
  margin-left: auto; margin-right: -14px; padding: 3px 10px; border-radius: 999px;
  background: rgba(224, 138, 22, .14); color: var(--warn);
  font-size: 11.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
}
.demo-flag:not([hidden]) ~ #connectBtn,
.demo-flag:not([hidden]) ~ .live { margin-left: 0; }
.topbar .live { margin-left: auto; }
.topbar .live:not([hidden]) ~ #connectBtn { margin-left: 0; }

.live {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12px; font-weight: 600; color: var(--muted); white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.live i { width: 8px; height: 8px; border-radius: 50%; background: var(--good); animation: beat 2.4s ease-out infinite; }
.live.busy i { background: var(--accent); animation: blink .9s ease-in-out infinite; }
@keyframes blink { 50% { opacity: .25; } }

@keyframes toast-in { from { opacity: 0; transform: translateY(16px) scale(.98); } }
.toast {
  position: fixed; right: 20px; bottom: 20px; z-index: 50;
  display: flex; align-items: center; gap: 10px; max-width: min(380px, calc(100vw - 40px));
  padding: 12px 16px; border-radius: 12px;
  background: #141b2b; color: #e8eef9; border: 1px solid rgba(255, 255, 255, .08);
  box-shadow: 0 16px 40px rgba(10, 18, 36, .3); font-size: 13.5px; font-weight: 600;
  animation: toast-in .35s cubic-bezier(.2, .8, .2, 1);
}
.toast::before { content: ""; width: 9px; height: 9px; border-radius: 50%; flex: none; background: var(--good); }
.toast.bad::before { background: var(--bad); }
.toast.warn::before { background: var(--warn); }
.toast.leaving { opacity: 0; transform: translateY(8px); transition: opacity .25s, transform .25s; }

@media (prefers-reduced-motion: reduce) {
  *:not(.spinner), *::before, *::after, .modal::backdrop {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    animation-delay: 0s !important;
    transition-duration: .01ms !important;
  }
}

/* Connect panel, problem card and connection hints */

.connect-panel {
  max-width: 860px; margin: 24px auto; padding: 36px 40px;
  display: flex; gap: 40px; align-items: center;
}
.connect-art { width: 150px; flex: none; }
.art-body { fill: var(--surface-2); stroke: var(--border); stroke-width: 3; }
.art-screen { fill: var(--accent-soft); }
.art-island { fill: var(--text); opacity: .85; }
.art-bolt { fill: var(--accent); }
.art-cable { fill: none; stroke: var(--muted); stroke-width: 4; stroke-linecap: round; }
.art-plug { fill: var(--muted); }
.connect-copy h2 {
  margin: 0 0 6px; font-size: 22px; font-weight: 700; letter-spacing: -.01em;
  text-transform: none; color: var(--text);
}
.connect-lead { margin: 0 0 18px; color: var(--muted); max-width: 52ch; }
.steps { margin: 0 0 22px; padding: 0; list-style: none; counter-reset: step; display: grid; gap: 12px; }
.steps li { counter-increment: step; display: grid; grid-template-columns: 28px 1fr; gap: 12px; align-items: start; font-size: 14px; color: var(--muted); }
.steps li::before {
  content: counter(step); width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 13px;
}
.steps strong { color: var(--text); font-weight: 650; }
.connect-actions { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.btn.lg { padding: 11px 22px; font-size: 14.5px; border-radius: 12px; }
.fine { font-size: 12.5px; color: var(--muted); }

.problem {
  max-width: 820px; margin: 24px auto; display: flex; gap: 16px; align-items: flex-start;
  border-color: color-mix(in srgb, var(--bad) 30%, var(--border));
}
.problem-icon {
  width: 36px; height: 36px; flex: none; border-radius: 50%; display: grid; place-items: center;
  background: color-mix(in srgb, var(--bad) 14%, var(--surface)); color: var(--bad); font-weight: 800; font-size: 18px;
}
.problem-body { display: grid; gap: 8px; min-width: 0; }
.problem-body .state-title { margin: 0; color: var(--bad); }
.problem-body .state-msg { margin: 0; max-width: 60ch; color: var(--muted); }
.problem-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 6px; }
.problem-actions .state-code { color: var(--muted); }

.hint {
  margin: 4px 0 0; padding: 12px 14px; max-width: 72ch;
  border-radius: 12px; background: color-mix(in srgb, var(--warn) 13%, var(--surface)); color: var(--text);
  font-size: 13.5px; line-height: 1.6; text-align: left;
}
.hint code {
  padding: 1px 6px; border-radius: 6px; font-size: .9em;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  background: var(--surface); border: 1px solid var(--border);
  white-space: nowrap; user-select: all;
}

/* Device title and grouped details */

.device-title { display: grid; justify-items: center; gap: 2px; text-align: center; }
.device-title strong { font-size: 16px; font-weight: 700; letter-spacing: -.01em; }
.device-title span { font-size: 13px; color: var(--muted); }
.spec-groups { display: grid; gap: 22px; }
.spec-group h3 { margin: 0 0 4px; font-size: 11px; color: var(--accent); letter-spacing: .08em; }
.specs dt { white-space: nowrap; }

/* Tinted from the theme colours so they also work in dark mode. */
.tile-icon.image { background: color-mix(in srgb, var(--good) 15%, var(--surface)); }
.tile-icon.video { background: color-mix(in srgb, #d9633c 16%, var(--surface)); }
.tile-icon.audio { background: color-mix(in srgb, #7a5bd8 16%, var(--surface)); }
.tile-icon.document { background: color-mix(in srgb, #3f6ec6 16%, var(--surface)); }

@media (max-width: 760px) {
  .connect-panel { flex-direction: column; padding: 24px 20px; gap: 20px; }
  .connect-art { width: 110px; }
  .problem { padding: 18px; }
}

/* ---------- language switch and RTL ---------- */

.lang-switch {
  display: inline-flex;
  margin-left: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: var(--surface-2);
}
.lang-btn {
  font: inherit;
  font-size: 12.5px;
  font-weight: 650;
  padding: 7px 12px;
  border: 0;
  background: none;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
  line-height: 1.4;
}
.lang-btn + .lang-btn { border-inline-start: 1px solid var(--border); }
.lang-btn:hover { color: var(--text); }
.lang-btn.is-active { background: var(--accent); color: #fff; }
.lang-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

:root[dir="rtl"] body {
  font-family: "Vazirmatn", "IRANSans", "Segoe UI", Tahoma, system-ui, sans-serif;
}

:root[dir="rtl"] .kv dd,
:root[dir="rtl"] .mini dd,
:root[dir="rtl"] .rows dd,
:root[dir="rtl"] .specs dd,
:root[dir="rtl"] .tile-meta {
  text-align: left;
}

:root[dir="rtl"] .check-list .detail { margin-left: 0; margin-right: auto; }
:root[dir="rtl"] .lang-switch { margin-left: 0; margin-right: auto; }

:root[dir="rtl"] .topbar #refreshBtn {
  margin-left: 0;
  margin-right: 8px;
}

:root[dir="rtl"] .steps { padding-right: 20px; padding-left: 0; }
:root[dir="rtl"] .notes ul { padding-right: 18px; padding-left: 0; }
:root[dir="rtl"] .modal-close-form { float: left; padding: 10px 0 0 10px; }

/* Purely numeric readouts are pinned left-to-right so a value and its unit are
   never reordered. Cells that can also hold Persian prose are left to the bidi
   algorithm, which already keeps Latin runs such as "2,798 mAh" intact; forcing
   those to LTR is what reorders the percent sign in mixed sentences. */
:root[dir="rtl"] .gauge span,
:root[dir="rtl"] .batt-shell span,
:root[dir="rtl"] .phone-level,
:root[dir="rtl"] .chip,
:root[dir="rtl"] .state-code,
:root[dir="rtl"] .tile-meta strong,
:root[dir="rtl"] .modal-sub {
  direction: ltr;
  unicode-bidi: isolate;
}

/* ---------- device picker ---------- */

.device-picker { display: grid; gap: 6px; }
.device-picker[hidden] { display: none; }
.picker-label {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em;
  color: #7c8aa5; padding: 0 8px;
}
.picker-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.picker-item {
  display: grid; gap: 1px; width: 100%; text-align: start;
  padding: 8px 10px; border-radius: 9px; cursor: pointer;
  border: 1px solid rgba(255, 255, 255, .08);
  background: rgba(255, 255, 255, .04); color: #cfd8ea; font: inherit;
}
.picker-item:hover:not(:disabled) { background: rgba(255, 255, 255, .09); }
.picker-item[aria-current="true"] { border-color: var(--accent); background: rgba(79, 107, 255, .16); cursor: default; }
.picker-item:disabled { opacity: 1; }
.picker-name { font-size: 13px; font-weight: 600; }
.picker-sub { font-size: 11px; color: #8d9ab3; overflow-wrap: anywhere; }

/* ---------- printable report ---------- */

.report { display: none; }

@media print {
  body * { visibility: hidden !important; }
  .report, .report * { visibility: visible !important; }
  .report {
    display: block !important;
    position: absolute;
    inset: 0;
    padding: 0;
    color: #000;
    background: #fff;
    font: 12pt/1.5 system-ui, sans-serif;
  }
  .report-head { border-bottom: 2px solid #000; padding-bottom: 8pt; margin-bottom: 12pt; }
  .report-head h1 { margin: 0 0 4pt; font-size: 18pt; }
  .report-device { margin: 0; font-size: 13pt; font-weight: 600; }
  .report-date { margin: 2pt 0 0; font-size: 10pt; color: #444; }
  .report section { margin-bottom: 12pt; break-inside: avoid; }
  .report section h2 {
    margin: 0 0 4pt; font-size: 11pt; text-transform: uppercase;
    letter-spacing: .06em; border-bottom: 1px solid #999; padding-bottom: 2pt;
  }
  .report dl { margin: 0; }
  .report .r {
    display: flex; justify-content: space-between; gap: 16pt;
    padding: 2.5pt 0; border-bottom: 1px dotted #ccc;
  }
  .report dt { color: #333; }
  .report dd { margin: 0; font-weight: 600; text-align: end; }
  @page { margin: 14mm; }
}
