/* Remote Portal - hand written, no frameworks. Light and dark, mobile first. */
:root {
  --bg: #f3f4fb;
  --surface: rgba(255, 255, 255, .74);
  --surface-2: rgba(255, 255, 255, .55);
  --solid: #ffffff;
  --text: #0e1124;
  --muted: #5b6283;
  --faint: #8d93b0;
  --border: rgba(24, 28, 70, .09);
  --border-strong: rgba(24, 28, 70, .16);
  --accent: #5b5df0;
  --accent-2: #a45cf5;
  --accent-soft: rgba(91, 93, 240, .11);
  --grad: linear-gradient(135deg, var(--accent), var(--accent-2));
  --danger: #e5484d;
  --danger-soft: rgba(229, 72, 77, .11);
  --ok: #12a06b;
  --ok-soft: rgba(18, 160, 107, .12);
  --warn: #d98a06;
  --warn-soft: rgba(217, 138, 6, .13);
  --shadow: 0 1px 2px rgba(20, 24, 70, .05), 0 12px 32px -12px rgba(30, 34, 100, .16);
  --shadow-lg: 0 24px 64px -16px rgba(30, 34, 100, .28);
  --radius: 20px;
  --radius-sm: 12px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI Variable Text", "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;
  --ease: cubic-bezier(.2, .8, .2, 1);
}
:root[data-theme="dark"] {
  --bg: #070913;
  --surface: rgba(23, 26, 48, .66);
  --surface-2: rgba(30, 34, 62, .5);
  --solid: #14172b;
  --text: #eceefc;
  --muted: #a0a7cb;
  --faint: #6f769c;
  --border: rgba(255, 255, 255, .075);
  --border-strong: rgba(255, 255, 255, .15);
  --accent: #7f86ff;
  --accent-2: #b983ff;
  --accent-soft: rgba(127, 134, 255, .15);
  --danger: #ff6b70;
  --danger-soft: rgba(255, 107, 112, .13);
  --ok: #3ccf91;
  --ok-soft: rgba(60, 207, 145, .13);
  --warn: #f2b13d;
  --warn-soft: rgba(242, 177, 61, .14);
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 16px 40px -16px rgba(0, 0, 0, .6);
  --shadow-lg: 0 28px 70px -18px rgba(0, 0, 0, .75);
  color-scheme: dark;
}
:root:not([data-theme="light"]):not([data-theme="dark"]) { color-scheme: light dark; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh;
  font-family: var(--font); font-size: 15px; line-height: 1.5; color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased; letter-spacing: -.005em;
}
.bg { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.bg::before, .bg::after { content: ""; position: absolute; border-radius: 50%; filter: blur(90px); opacity: .55; }
.bg::before { width: 60vmax; height: 60vmax; left: -18vmax; top: -22vmax; background: radial-gradient(circle, var(--accent) 0%, transparent 65%); animation: drift 22s ease-in-out infinite alternate; }
.bg::after { width: 55vmax; height: 55vmax; right: -20vmax; bottom: -24vmax; background: radial-gradient(circle, var(--accent-2) 0%, transparent 65%); animation: drift 28s ease-in-out infinite alternate-reverse; }
:root[data-theme="dark"] .bg::before, :root[data-theme="dark"] .bg::after { opacity: .3; }
@keyframes drift { to { transform: translate3d(6vmax, 4vmax, 0) scale(1.08); } }

h1, h2, h3, p { margin: 0; }
h1 { font-size: 1.75rem; line-height: 1.2; font-weight: 700; letter-spacing: -.025em; }
h2 { font-size: 1.05rem; font-weight: 650; letter-spacing: -.015em; }
h3 { font-size: .95rem; font-weight: 600; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: .85rem; }
.mono { font-family: var(--mono); }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ic { width: 1.25em; height: 1.25em; flex: none; vertical-align: -.22em; }

/* ---- cards and layout */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
  -webkit-backdrop-filter: blur(22px) saturate(1.4); backdrop-filter: blur(22px) saturate(1.4);
  padding: 1.5rem; animation: rise .5s var(--ease) both;
}
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
.card + .card { margin-top: 1.25rem; }
.card-head { display: flex; align-items: flex-start; gap: .9rem; margin-bottom: 1.15rem; }
.card-head .badge-ic { margin-top: .1rem; }
.card-head p { margin-top: .15rem; }
.badge-ic { display: grid; place-items: center; width: 2.5rem; height: 2.5rem; flex: none; border-radius: 12px; background: var(--accent-soft); color: var(--accent); }
.badge-ic .ic { width: 1.3rem; height: 1.3rem; }
.badge-ic.ok { background: var(--ok-soft); color: var(--ok); }
.badge-ic.warn { background: var(--warn-soft); color: var(--warn); }
.badge-ic.danger { background: var(--danger-soft); color: var(--danger); }
.stack > * + * { margin-top: 1rem; }
.row { display: flex; align-items: center; gap: .75rem; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.grid { display: grid; gap: 1.25rem; }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); }
.grid.tiles { grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr)); }

/* ---- forms */
.field { display: block; }
.field > span { display: block; margin-bottom: .35rem; font-size: .85rem; font-weight: 550; color: var(--muted); }
.input {
  width: 100%; padding: .72rem .9rem; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--text); outline: none; transition: border-color .15s, box-shadow .15s, background .15s;
}
.input::placeholder { color: var(--faint); }
.input:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--border-strong)); }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); background: var(--solid); }
.input[readonly] { opacity: .7; cursor: default; }
.input-wrap { position: relative; }
.input-wrap .input { padding-right: 2.9rem; }
.input-wrap .reveal { position: absolute; right: .35rem; top: 50%; transform: translateY(-50%); }
.hint { margin-top: .35rem; font-size: .82rem; color: var(--faint); }
.otp { text-align: center; font-family: var(--mono); font-size: 1.9rem; letter-spacing: .5em; padding-left: calc(.9rem + .5em); font-weight: 600; }
.otp.recovery { font-size: 1.15rem; letter-spacing: .12em; padding-left: .9rem; }
.error {
  display: flex; gap: .55rem; align-items: flex-start; padding: .7rem .85rem; border-radius: var(--radius-sm);
  background: var(--danger-soft); color: var(--danger); font-size: .9rem; font-weight: 500; animation: shake .35s;
}
@keyframes shake { 20%, 60% { transform: translateX(-4px); } 40%, 80% { transform: translateX(4px); } }
.notice { display: flex; gap: .7rem; align-items: flex-start; padding: .85rem 1rem; border-radius: var(--radius-sm); background: var(--accent-soft); font-size: .9rem; }
.notice.warn { background: var(--warn-soft); }
.notice.ok { background: var(--ok-soft); }
.notice .ic { margin-top: .12rem; }
.meter { display: flex; gap: 4px; margin-top: .5rem; }
.meter i { flex: 1; height: 4px; border-radius: 2px; background: var(--border-strong); transition: background .2s; }
.meter[data-s="1"] i:nth-child(-n+1) { background: var(--danger); }
.meter[data-s="2"] i:nth-child(-n+2) { background: var(--warn); }
.meter[data-s="3"] i:nth-child(-n+3) { background: #7cb342; }
.meter[data-s="4"] i { background: var(--ok); }

/* ---- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem; padding: .7rem 1.15rem; border: 1px solid transparent;
  border-radius: var(--radius-sm); cursor: pointer; font-weight: 600; font-size: .93rem; line-height: 1.2; white-space: nowrap;
  transition: transform .12s var(--ease), box-shadow .2s, background .15s, opacity .15s, border-color .15s;
}
.btn:active:not(:disabled) { transform: scale(.975); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { color: #fff; background: var(--grad); box-shadow: 0 6px 18px -6px color-mix(in srgb, var(--accent) 70%, transparent), inset 0 1px 0 rgba(255, 255, 255, .22); }
.btn.primary:hover:not(:disabled) { box-shadow: 0 10px 26px -8px color-mix(in srgb, var(--accent) 80%, transparent), inset 0 1px 0 rgba(255, 255, 255, .28); filter: brightness(1.06); }
.btn.secondary { background: var(--surface-2); border-color: var(--border-strong); }
.btn.secondary:hover:not(:disabled) { background: var(--solid); border-color: color-mix(in srgb, var(--accent) 45%, var(--border-strong)); }
.btn.ghost { background: transparent; color: var(--muted); padding: .55rem .8rem; }
.btn.ghost:hover:not(:disabled) { background: var(--accent-soft); color: var(--text); }
.btn.danger { background: var(--danger-soft); color: var(--danger); }
.btn.danger:hover:not(:disabled) { background: var(--danger); color: #fff; }
.btn.block { width: 100%; }
.btn.sm { padding: .42rem .75rem; font-size: .85rem; border-radius: 10px; }
.btn.icon { padding: .5rem; border-radius: 10px; }
.spin { width: 1.1em; height: 1.1em; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- pills, avatars */
.pill { display: inline-flex; align-items: center; gap: .3rem; padding: .15rem .6rem; border-radius: 999px; font-size: .76rem; font-weight: 600; background: var(--accent-soft); color: var(--accent); white-space: nowrap; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.mute { background: var(--border); color: var(--faint); }
.avatar { display: grid; place-items: center; flex: none; overflow: hidden; width: 2.5rem; height: 2.5rem; border-radius: 28%; color: #fff; font-weight: 700; font-size: 1.05rem; background: var(--grad); }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar.xl { width: 6rem; height: 6rem; font-size: 2.4rem; border-radius: 26%; box-shadow: var(--shadow); }

/* ---- sign-in and set-up */
.auth { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 1.25rem; }
.auth-box { width: 100%; max-width: 420px; }
.auth-box.wide { max-width: 520px; }
.auth-box .card { padding: 2rem; box-shadow: var(--shadow-lg); }
.brand { display: flex; align-items: center; gap: .7rem; font-weight: 700; letter-spacing: -.02em; font-size: 1.05rem; }
.logo { display: grid; place-items: center; width: 2.4rem; height: 2.4rem; border-radius: 28%; color: #fff; background: var(--grad); box-shadow: 0 8px 20px -8px var(--accent); }
.logo .ic { width: 1.3rem; height: 1.3rem; }
.auth-head { text-align: center; margin-bottom: 1.5rem; }
.auth-head .logo { width: 3.4rem; height: 3.4rem; margin: 0 auto 1rem; }
.auth-head .logo .ic { width: 1.8rem; height: 1.8rem; }
.auth-head p { margin-top: .4rem; }
.auth-foot { margin-top: 1.1rem; text-align: center; font-size: .82rem; color: var(--faint); }
.steps { display: flex; gap: .4rem; justify-content: center; margin-bottom: 1.25rem; }
.steps i { width: 2rem; height: 4px; border-radius: 2px; background: var(--border-strong); transition: background .3s; }
.steps i.on { background: var(--accent); }
.qr { width: 216px; max-width: 100%; margin: 0 auto; padding: 8px; border-radius: 16px; background: #fff; box-shadow: var(--shadow); line-height: 0; }
.qr svg { width: 100%; height: auto; display: block; }
.secret { display: flex; align-items: center; gap: .5rem; padding: .55rem .6rem .55rem .85rem; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px dashed var(--border-strong); }
.secret code { flex: 1; font-family: var(--mono); font-size: .92rem; letter-spacing: .06em; word-break: break-all; user-select: all; }
.codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: .5rem; padding: 1rem; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--border); }
.codes code { font-family: var(--mono); font-size: .95rem; padding: .3rem .1rem; text-align: center; letter-spacing: .04em; user-select: all; }
.check { display: flex; align-items: flex-start; gap: .65rem; cursor: pointer; font-size: .92rem; }
.check input { width: 1.1rem; height: 1.1rem; margin-top: .2rem; accent-color: var(--accent); }

/* ---- app shell */
.shell { display: grid; grid-template-columns: 272px minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; }
.side {
  position: sticky; top: 0; height: 100vh; height: 100dvh; display: flex; flex-direction: column; padding: 1.25rem 1rem; gap: .25rem;
  background: var(--surface); border-right: 1px solid var(--border); -webkit-backdrop-filter: blur(24px) saturate(1.4); backdrop-filter: blur(24px) saturate(1.4);
}
.side .brand { padding: .35rem .6rem 1.2rem; }
.nav-label { padding: .9rem .75rem .35rem; font-size: .72rem; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }
.nav a {
  display: flex; align-items: center; gap: .75rem; padding: .66rem .8rem; border-radius: 12px; color: var(--muted); font-weight: 560; text-decoration: none;
  transition: background .15s, color .15s;
}
.nav a:hover { background: var(--accent-soft); color: var(--text); text-decoration: none; }
.nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
.nav a[aria-current="page"] .ic { filter: drop-shadow(0 0 8px var(--accent)); }
.nav a.soon { opacity: .5; pointer-events: none; }
.nav a .pill { margin-left: auto; font-size: .68rem; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: .5rem; }
.me { display: flex; align-items: center; gap: .7rem; padding: .65rem; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); }
.me .who { min-width: 0; flex: 1; line-height: 1.25; }
.me .who b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .92rem; }
.me .who span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .78rem; color: var(--faint); }
.main { min-width: 0; padding: 2.25rem clamp(1rem, 4vw, 3rem) 4rem; }
.page { max-width: 1040px; margin: 0 auto; }
.page-head { margin-bottom: 1.75rem; animation: rise .45s var(--ease) both; }
.page-head p { margin-top: .35rem; color: var(--muted); }
.mobile-top, .tabbar { display: none; }

.tile { display: flex; flex-direction: column; gap: .7rem; padding: 1.15rem 1.25rem; animation: rise .5s var(--ease) both; }
.card.tile + .card.tile { margin-top: 0; }
.tile .top { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: .88rem; font-weight: 550; }
.tile .num { font-size: 2.1rem; font-weight: 700; letter-spacing: -.03em; line-height: 1; }
.tile .sub { font-size: .85rem; color: var(--faint); }
.hero { position: relative; overflow: hidden; margin-bottom: 1.25rem; }
.hero::after { content: ""; position: absolute; right: -60px; top: -60px; width: 220px; height: 220px; border-radius: 50%; background: var(--grad); opacity: .16; filter: blur(30px); }
.hero h1 { position: relative; }
.hero p { position: relative; margin-top: .4rem; }

.list { display: flex; flex-direction: column; }
.item { display: flex; align-items: center; gap: .9rem; padding: .85rem 0; }
.item + .item { border-top: 1px solid var(--border); }
.item .grow { flex: 1; min-width: 0; }
.item .grow b { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; font-weight: 600; }
.item .grow span { display: block; font-size: .84rem; color: var(--faint); overflow: hidden; text-overflow: ellipsis; }
.item > .badge-ic { width: 2.3rem; height: 2.3rem; }
.empty { padding: 1rem 0; color: var(--faint); font-size: .9rem; }

/* ---- dialogs and toasts */
dialog {
  width: min(480px, calc(100vw - 2rem)); padding: 0; border: 1px solid var(--border-strong); border-radius: 24px; color: var(--text);
  background: var(--solid); box-shadow: var(--shadow-lg);
}
dialog[open] { animation: pop .28s var(--ease); }
dialog::backdrop { background: rgba(8, 10, 24, .5); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); animation: fade .25s; }
@keyframes pop { from { opacity: 0; transform: translateY(14px) scale(.97); } }
@keyframes fade { from { opacity: 0; } }
.dlg { padding: 1.6rem; }
.dlg h2 { font-size: 1.2rem; margin-bottom: .35rem; }
.dlg .actions { display: flex; gap: .6rem; justify-content: flex-end; margin-top: 1.4rem; flex-wrap: wrap; }
.toasts { position: fixed; left: 50%; bottom: calc(1.25rem + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: .5rem; align-items: center; width: max-content; max-width: calc(100vw - 2rem); pointer-events: none; }
.toast { display: flex; align-items: center; gap: .6rem; padding: .7rem 1rem; border-radius: 14px; background: var(--text); color: var(--bg); font-weight: 550; font-size: .92rem; box-shadow: var(--shadow-lg); animation: pop .3s var(--ease); }
.toast.err { background: var(--danger); color: #fff; }
.toast.out { opacity: 0; transform: translateY(8px); transition: .3s; }

.skeleton { border-radius: 10px; background: linear-gradient(90deg, var(--border) 25%, var(--surface-2) 50%, var(--border) 75%); background-size: 200% 100%; animation: shimmer 1.3s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
.boot { min-height: 100vh; display: grid; place-items: center; }
.boot .logo { width: 3.4rem; height: 3.4rem; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(.9); opacity: .7; } }

/* ---- small screens: the sidebar turns into a bottom bar */
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { display: none; }
  .mobile-top { display: flex; align-items: center; gap: .75rem; position: sticky; top: 0; z-index: 20; padding: .7rem 1rem; background: var(--surface); border-bottom: 1px solid var(--border); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); }
  .tabbar {
    display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
    padding: .35rem .5rem calc(.35rem + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--border);
    -webkit-backdrop-filter: blur(24px) saturate(1.4); backdrop-filter: blur(24px) saturate(1.4);
  }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: .15rem; padding: .4rem; border-radius: 12px; color: var(--faint); font-size: .7rem; font-weight: 600; text-decoration: none; }
  .tabbar a .ic { width: 1.4rem; height: 1.4rem; }
  .tabbar a[aria-current="page"] { color: var(--accent); }
  .main { padding: 1.25rem 1rem 6.5rem; }
  h1 { font-size: 1.5rem; }
  .card { padding: 1.15rem; }
  .auth-box .card { padding: 1.5rem 1.25rem; }
  .toasts { bottom: calc(5.2rem + env(safe-area-inset-bottom)); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

.subhead { margin: 1.1rem 0 .1rem; font-size: .72rem; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }
.subhead:first-child { margin-top: 0; }
.dlg > * + * { margin-top: 1rem; }
.dlg > h2 + p { margin-top: 0; }
.page > .stack:not(:empty) { margin-bottom: 1.25rem; }
.alt-actions { display: flex; flex-direction: column; align-items: center; gap: .1rem; }
.alt-actions .btn { white-space: normal; text-align: center; max-width: 100%; }

/* ---- phase 2: devices, address books, log */
textarea.input { resize: vertical; min-height: 4.5rem; line-height: 1.45; }
select.input { appearance: none; -webkit-appearance: none; padding-right: 2.2rem; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 1.1rem) 52%, calc(100% - .8rem) 52%; background-size: .3rem .3rem, .3rem .3rem; background-repeat: no-repeat; }
.card.tile.link { text-decoration: none; color: inherit; transition: transform .2s var(--ease), border-color .2s, box-shadow .2s; }
.card.tile.link:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); box-shadow: var(--shadow-lg); text-decoration: none; }
.toolbar { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin-bottom: 1.1rem; }
.toolbar > .input { flex: 1 1 200px; width: auto; }
.search { position: relative; flex: 1 1 220px; max-width: 420px; }
.search .ic { position: absolute; left: .85rem; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.search .input { padding-left: 2.5rem; }
.seg { display: inline-flex; gap: .25rem; padding: .25rem; margin-bottom: 1.25rem; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); max-width: 100%; overflow-x: auto; }
.seg a, .seg button { display: inline-flex; align-items: center; gap: .5rem; padding: .5rem .95rem; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font-weight: 600; font-size: .92rem; white-space: nowrap; cursor: pointer; text-decoration: none; transition: background .15s, color .15s; }
.seg a:hover, .seg button:hover { color: var(--text); text-decoration: none; }
.seg [aria-selected="true"] { background: var(--solid); color: var(--accent); box-shadow: var(--shadow); }
.seg .count { padding: .05rem .5rem; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: .75rem; }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.chips:empty { display: none; }
.chips + .error, .chips + .grid { margin-top: .9rem; }
.page > .chips { margin-bottom: 1rem; }
.tag { display: inline-flex; align-items: center; gap: .4rem; padding: .15rem .65rem; border-radius: 999px; font-size: .8rem; font-weight: 600; background: color-mix(in srgb, var(--tag, var(--accent)) 16%, transparent); border: 1px solid color-mix(in srgb, var(--tag, var(--accent)) 35%, transparent); }
.tag i { width: .55rem; height: .55rem; border-radius: 50%; background: var(--tag, var(--accent)); }
.tagbtn { display: inline-flex; align-items: center; gap: .35rem; padding: .15rem; border: 2px solid transparent; border-radius: 999px; background: none; cursor: pointer; color: var(--faint); font-size: .75rem; font-weight: 600; opacity: .75; }
.tagbtn:hover { opacity: 1; }
.tagbtn[aria-pressed="true"] { opacity: 1; border-color: var(--accent); }
.tagbtn .count { padding-right: .4rem; }
.tagslabel { margin-bottom: .4rem; font-weight: 550; }
.idchip { display: inline-flex; align-items: center; gap: .45rem; margin-top: .15rem; padding: .1rem .5rem; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-size: .88rem; cursor: pointer; }
.idchip:hover { background: var(--accent-soft); color: var(--text); }
.idchip .ic { width: .95em; height: .95em; opacity: .6; }
.card.device, .card.entry { display: flex; flex-direction: column; gap: .9rem; margin-top: 0; }
.dev-top { display: flex; align-items: center; gap: .9rem; }
.dev-top .grow { flex: 1; min-width: 0; }
.dev-top h3 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 1rem; }
.dev-top .idchip { margin-left: -.5rem; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: .65rem 1rem; margin: 0; }
.facts dt { font-size: .75rem; color: var(--faint); font-weight: 550; }
.facts dd { margin: .05rem 0 0; font-size: .9rem; overflow-wrap: anywhere; }
.devnote { display: flex; gap: .55rem; align-items: flex-start; margin: 0; padding: .6rem .8rem; border-radius: var(--radius-sm); background: var(--surface-2); font-size: .88rem; color: var(--muted); }
.devnote .ic { margin-top: .12rem; opacity: .7; }
.dev-actions { margin-top: auto; padding-top: .25rem; }
.empty-state { grid-column: 1 / -1; display: flex; flex-direction: column; align-items: center; text-align: center; gap: .6rem; padding: 2.5rem 1.5rem; margin-top: 0; box-shadow: none; }
.empty-state .badge-ic { width: 3.2rem; height: 3.2rem; border-radius: 16px; }
.empty-state p { max-width: 38ch; }
.card > .empty-state { border: 0; background: none; box-shadow: none; padding: 1.5rem 0; }
.tagrow { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.tagrow .input { flex: 1 1 140px; width: auto; }
.swatches { display: flex; gap: .3rem; }
.swatch { width: 1.35rem; height: 1.35rem; padding: 0; border-radius: 50%; border: 2px solid transparent; background: var(--tag); cursor: pointer; box-shadow: inset 0 0 0 2px var(--solid); }
.swatch[aria-pressed="true"] { border-color: var(--text); }
.logrow .grow b { font-weight: 600; display: block; }
.logrow .grow > span { display: block; overflow-wrap: anywhere; }
.logrow .chips { margin-top: .35rem; }
.logrow time { white-space: nowrap; align-self: flex-start; padding-top: .15rem; }
.dayhead.subhead { margin: 1.1rem 0 0; padding-bottom: .4rem; border-bottom: 1px solid var(--border); }
.dayhead.subhead:first-child { margin-top: 0; }
.log-skel { height: 8rem; }
dialog .tagrow + .tagrow { margin-top: .1rem; }
@media (max-width: 860px) {
  .seg { display: flex; }
  .toolbar .search { max-width: none; }
}
.shell > * { min-width: 0; }
@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .toolbar { gap: .5rem; }
  .toolbar .spacer { display: none; }
  .toolbar .row { width: 100%; }
  .toolbar .row .btn { flex: 1; }
  .page-head p { overflow-wrap: anywhere; }
}
.dot { width: .6rem; height: .6rem; border-radius: 50%; background: var(--faint); flex: none; }
.dot.live { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.btn.secondary.on { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.settled > .card { animation: none; }
