/* SyncTone 管理端：浅色工具型控制台。零构建、零外部资源。 */

/* ---------------------------------------------------------------- tokens */
:root {
  --canvas: #f5f6f9;
  --surface: #ffffff;
  --surface-2: #fafbfd;
  --surface-3: #f1f3f8;
  --line: #e6e9f0;
  --line-strong: #d5dae5;

  --ink: #171b23;
  --ink-2: #4e5868;
  --ink-3: #6f7887;
  --ink-4: #9aa3b2;

  --brand: #4c7dff;
  --accent: #2f5be0;
  --accent-hover: #2449c4;
  --accent-weak: #edf2ff;
  --accent-line: #c9d8ff;

  --ok: #157d57;
  --ok-weak: #e8f7f0;
  --ok-bright: #36c48b;
  --warn: #8a5608;
  --warn-weak: #fff6e4;
  --warn-bright: #ffb020;
  --bad: #b42318;
  --bad-weak: #fdedec;
  --bad-bright: #ff5c5c;

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --pill: 999px;

  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06);
  --shadow-md: 0 6px 20px -8px rgba(16, 24, 40, 0.16);
  --shadow-lg: 0 24px 60px -28px rgba(23, 27, 35, 0.35);

  --sidebar: 236px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Consolas, "Liberation Mono",
    monospace;
  --ease: cubic-bezier(0.2, 0.7, 0.3, 1);
}

/* ---------------------------------------------------------------- reset */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font: 14px/1.55 var(--font);
  background:
    radial-gradient(1100px 460px at 12% -8%, rgba(76, 125, 255, 0.07), transparent 62%),
    radial-gradient(900px 420px at 100% 0%, rgba(54, 196, 139, 0.05), transparent 58%),
    var(--canvas);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, p, dl, dd, figure {
  margin: 0;
}

ul, ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

img, svg {
  display: block;
  max-width: 100%;
}

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

code, pre {
  font-family: var(--mono);
}

table {
  width: 100%;
  border-collapse: collapse;
}

[x-cloak] {
  display: none !important;
}

::selection {
  background: var(--accent-weak);
  color: var(--accent);
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.svg-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.icon {
  width: 18px;
  height: 18px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 100;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: var(--ink);
  color: #fff;
  font-size: 13px;
  transform: translateY(-160%);
  transition: transform 0.16s var(--ease);
}

.skip-link:focus {
  transform: none;
}

/* ---------------------------------------------------------------- shell */
.app {
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  width: var(--sidebar);
  padding: 18px 14px 16px;
  background: var(--surface);
  border-right: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 20px;
}

.brand__mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  color: #fff;
  background: linear-gradient(135deg, #5b8bff 0%, #2f5be0 100%);
  box-shadow: 0 10px 22px -10px rgba(47, 91, 224, 0.7);
}

.brand__mark svg {
  width: 22px;
  height: 22px;
}

.brand__text strong {
  display: block;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.brand__text span {
  display: block;
  margin-top: 1px;
  color: var(--ink-4);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 4px;
}

.navlink {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 0 12px;
  border-radius: 10px;
  color: var(--ink-2);
  font-size: 13.5px;
  font-weight: 500;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}

.navlink .icon {
  width: 18px;
  height: 18px;
  color: var(--ink-4);
  transition: color 0.15s var(--ease);
}

.navlink:hover {
  background: var(--surface-3);
  color: var(--ink);
}

.navlink:hover .icon {
  color: var(--ink-2);
}

.navlink.active {
  background: var(--accent-weak);
  color: var(--accent);
  font-weight: 650;
}

.navlink.active .icon {
  color: var(--accent);
}

.navlink > .active {
  position: absolute;
  left: 0;
  top: 10px;
  bottom: 10px;
  width: 3px;
  border-radius: 3px;
  background: var(--accent);
}

.sidebar__foot {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.sidebar__domain {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 10px;
  color: var(--ink-4);
  font-size: 11.5px;
}

.sidebar__domain .dot {
  background: var(--ok-bright);
  box-shadow: 0 0 0 3px rgba(54, 196, 139, 0.14);
}

.main {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;
  margin-left: var(--sidebar);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 12px;
  height: 64px;
  padding: 0 28px;
  background: rgba(245, 246, 249, 0.84);
  border-bottom: 1px solid transparent;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.topbar .topbar__menu {
  display: none;
}

.topbar__brand {
  display: none;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.topbar__crumb {
  color: var(--ink-4);
  font-size: 12.5px;
}

.topbar__crumb strong {
  color: var(--ink-2);
  font-weight: 600;
}

.topbar__spacer {
  flex: 1;
}

.topbar .topbar__logout {
  display: none;
}

.topbar__domain {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ink-4);
  font-size: 12px;
}

.topbar__domain .icon {
  width: 14px;
  height: 14px;
}

.content {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 8px 28px 56px;
}

.scrim {
  position: fixed;
  inset: 0;
  z-index: 35;
  display: none;
  background: rgba(18, 22, 31, 0.4);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

/* ---------------------------------------------------------------- typography & utilities */
.muted {
  color: var(--ink-3);
  font-size: 12.5px;
}

.mono {
  font-family: var(--mono);
  font-size: 0.92em;
  word-break: break-all;
}

.small {
  font-size: 12px;
}

.nowrap {
  white-space: nowrap;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.stack--sm {
  gap: 10px;
}

.row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.row--between {
  justify-content: space-between;
}

.row--end {
  justify-content: flex-end;
}

.divider {
  height: 1px;
  margin: 14px 0;
  background: var(--line);
}

.dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  flex: none;
  border-radius: 50%;
  background: var(--ink-4);
}

/* ---------------------------------------------------------------- page head */
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px 24px;
  padding: 18px 0 20px;
  flex-wrap: wrap;
}

.page-head h1 {
  font-size: 26px;
  font-weight: 680;
  line-height: 1.18;
  letter-spacing: -0.025em;
}

.page-head__sub {
  margin-top: 6px;
  color: var(--ink-3);
  font-size: 13px;
}

.page-head__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ---------------------------------------------------------------- buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 38px;
  padding: 0 15px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  transition: background 0.15s var(--ease), border-color 0.15s var(--ease),
    color 0.15s var(--ease), transform 0.15s var(--ease);
}

.btn .icon {
  width: 16px;
  height: 16px;
}

.btn:hover:not(:disabled) {
  background: var(--accent-hover);
}

.btn:active:not(:disabled) {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn--ghost {
  background: var(--surface);
  border-color: var(--line-strong);
  color: var(--ink);
}

.btn--ghost:hover:not(:disabled) {
  background: var(--surface-3);
  border-color: var(--line-strong);
}

.btn--danger {
  background: var(--bad);
  color: #fff;
}

.btn--danger:hover:not(:disabled) {
  background: #951c13;
}

.btn--danger-ghost {
  background: var(--bad-weak);
  color: var(--bad);
  border-color: transparent;
}

.btn--danger-ghost:hover:not(:disabled) {
  background: #fbdcda;
}

.btn--sm {
  height: 32px;
  padding: 0 11px;
  border-radius: 8px;
  font-size: 12.5px;
}

.btn--icon {
  width: 38px;
  padding: 0;
}

.btn--block {
  width: 100%;
}

.btn--link {
  height: auto;
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  font-size: 12.5px;
  font-weight: 600;
}

.btn--link:hover:not(:disabled) {
  background: none;
  color: var(--accent-hover);
  text-decoration: underline;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink-2);
  transition: background 0.15s var(--ease), color 0.15s var(--ease),
    border-color 0.15s var(--ease);
}

.icon-btn:hover:not(:disabled) {
  background: var(--surface-3);
  border-color: var(--line-strong);
  color: var(--ink);
}

.icon-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.icon-btn--sm {
  width: 32px;
  height: 32px;
  border-radius: 8px;
}

.icon-btn--sm .icon {
  width: 15px;
  height: 15px;
}

.icon-btn--danger:hover:not(:disabled) {
  background: var(--bad-weak);
  border-color: transparent;
  color: var(--bad);
}

/* ---------------------------------------------------------------- cards */
.card {
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  min-width: 0;
}

.card--flush {
  padding: 0;
  overflow: hidden;
}

.card--soft {
  background: var(--surface-2);
  box-shadow: none;
}

.card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.card__title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14.5px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.card__title .icon {
  width: 16px;
  height: 16px;
  color: var(--ink-4);
}

.card__sub {
  color: var(--ink-4);
  font-size: 11.5px;
  font-weight: 400;
}

.card__actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.card__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  flex-wrap: wrap;
}

/* ---------------------------------------------------------------- grids */
.grid {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.grid--2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid--3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid--main {
  grid-template-columns: minmax(0, 1.55fr) minmax(300px, 0.9fr);
  align-items: start;
}

.device-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.stat-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.stat {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 14px 15px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.stat__icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: none;
  border-radius: 11px;
  background: var(--accent-weak);
  color: var(--accent);
}

.stat__icon .icon {
  width: 18px;
  height: 18px;
}

.stat__icon--ok {
  background: var(--ok-weak);
  color: var(--ok);
}

.stat__icon--warn {
  background: var(--warn-weak);
  color: var(--warn);
}

.stat__value {
  font-size: 21px;
  font-weight: 680;
  line-height: 1.1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.stat__label {
  margin-top: 2px;
  color: var(--ink-3);
  font-size: 11.5px;
}

/* ---------------------------------------------------------------- chips */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 23px;
  padding: 2px 9px;
  border-radius: var(--pill);
  background: var(--surface-3);
  color: var(--ink-2);
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}

.chip .dot {
  width: 6px;
  height: 6px;
  background: currentColor;
}

.chip--ok {
  background: var(--ok-weak);
  color: var(--ok);
}

.chip--warn {
  background: var(--warn-weak);
  color: var(--warn);
}

.chip--bad {
  background: var(--bad-weak);
  color: var(--bad);
}

.chip--accent {
  background: var(--accent-weak);
  color: var(--accent);
}

.chip--muted {
  background: var(--surface-3);
  color: var(--ink-3);
}

.chip--lg {
  min-height: 28px;
  padding: 3px 12px;
  font-size: 12.5px;
}

.chip-btn {
  border: 1px solid transparent;
  cursor: pointer;
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease),
    color 0.15s var(--ease);
}

.chip-btn:hover {
  border-color: var(--line-strong);
}

.chip-btn.active {
  border-color: var(--accent);
  background: var(--accent-weak);
  color: var(--accent);
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* ---------------------------------------------------------------- forms */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.field > label,
.label {
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 600;
}

.field__hint {
  color: var(--ink-4);
  font-size: 11px;
}

.input,
.select,
.textarea {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font-size: 13.5px;
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}

.textarea {
  height: auto;
  min-height: 84px;
  padding: 10px 12px;
  resize: vertical;
}

.input::placeholder,
.textarea::placeholder {
  color: var(--ink-4);
}

.input:hover,
.select:hover,
.textarea:hover {
  border-color: #c3cad8;
}

.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(76, 125, 255, 0.16);
}

.input:disabled,
.select:disabled {
  background: var(--surface-3);
  color: var(--ink-3);
  cursor: not-allowed;
}

.input--sm,
.select--sm {
  height: 32px;
  border-radius: 8px;
  font-size: 12.5px;
}

.select {
  appearance: none;
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236f7887' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 15px;
}

.input-color {
  width: 46px;
  height: 36px;
  padding: 3px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  cursor: pointer;
}

input[type="checkbox"] {
  accent-color: var(--accent);
}

input[type="datetime-local"] {
  min-width: 0;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 16px;
}

.field-grid--3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.field-grid--4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.field--grow {
  grid-column: 1 / -1;
}

.search-row {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.switch {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  user-select: none;
}

.switch input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.switch__track {
  position: relative;
  width: 40px;
  height: 22px;
  flex: none;
  border-radius: var(--pill);
  background: var(--line-strong);
  transition: background 0.15s var(--ease);
}

.switch__track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(16, 24, 40, 0.24);
  transition: transform 0.16s var(--ease);
}

.switch input:checked + .switch__track {
  background: var(--accent);
}

.switch input:checked + .switch__track::after {
  transform: translateX(18px);
}

.switch input:focus-visible + .switch__track {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.switch__label {
  color: var(--ink-3);
  font-size: 12px;
}

.check-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--pill);
  background: var(--surface);
  color: var(--ink-2);
  font-size: 12.5px;
  font-weight: 550;
  cursor: pointer;
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease),
    color 0.15s var(--ease);
}

.check-chip:hover {
  border-color: #c3cad8;
}

.check-chip.is-on {
  border-color: var(--accent-line);
  background: var(--accent-weak);
  color: var(--accent);
}

.check-chip input {
  width: 14px;
  height: 14px;
  margin: 0;
}

/* ---------------------------------------------------------------- segmented & tabs */
.segmented {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-3);
}

.segmented button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 31px;
  padding: 0 12px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--ink-2);
  font-size: 12.5px;
  font-weight: 550;
  white-space: nowrap;
  transition: background 0.15s var(--ease), color 0.15s var(--ease),
    box-shadow 0.15s var(--ease);
}

.segmented button:hover {
  color: var(--ink);
}

.segmented button.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

.segmented--wrap {
  flex-wrap: wrap;
}

.tabs {
  display: flex;
  gap: 2px;
  overflow-x: auto;
  margin-bottom: 2px;
  border-bottom: 1px solid var(--line);
  scrollbar-width: none;
}

.tabs::-webkit-scrollbar {
  display: none;
}

.tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 11px 14px;
  border: 0;
  background: none;
  color: var(--ink-3);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.tab:hover {
  color: var(--ink);
}

.tab.active {
  color: var(--accent);
}

.tab.active::after {
  content: "";
  position: absolute;
  left: 11px;
  right: 11px;
  bottom: -1px;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
}

.tab__badge {
  display: inline-grid;
  place-items: center;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: var(--pill);
  background: var(--warn-weak);
  color: var(--warn);
  font-size: 10px;
  font-weight: 700;
}

/* ---------------------------------------------------------------- tables */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  -webkit-overflow-scrolling: touch;
}

.table {
  min-width: 560px;
  font-size: 13px;
}

.table th {
  padding: 9px 12px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  color: var(--ink-3);
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: 0.05em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}

.table td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.table tbody tr:last-child td {
  border-bottom: 0;
}

.table tbody tr:hover {
  background: var(--surface-2);
}

.table .cell-actions {
  display: flex;
  justify-content: flex-end;
  gap: 5px;
  flex-wrap: wrap;
}

.table .cell-main {
  font-weight: 550;
}

.table .cell-sub {
  margin-top: 2px;
  color: var(--ink-4);
  font-size: 11px;
}

.table .cell-num {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ---------------------------------------------------------------- banners / empty / skeleton */
.banner {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 11px 13px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-size: 12.5px;
  line-height: 1.5;
}

.banner .icon {
  width: 16px;
  height: 16px;
  margin-top: 1px;
  flex: none;
}

.banner--bad {
  background: var(--bad-weak);
  border-color: #f6cfcc;
  color: var(--bad);
}

.banner--warn {
  background: var(--warn-weak);
  border-color: #f2dfb7;
  color: var(--warn);
}

.banner--ok {
  background: var(--ok-weak);
  border-color: #c9ecdd;
  color: var(--ok);
}

.banner--info {
  background: var(--accent-weak);
  border-color: var(--accent-line);
  color: var(--accent);
}

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  padding: 34px 20px;
  text-align: center;
  color: var(--ink-3);
}

.empty__icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  margin-bottom: 2px;
  border-radius: 14px;
  background: var(--surface-3);
  color: var(--ink-4);
}

.empty__icon .icon {
  width: 21px;
  height: 21px;
}

.empty strong {
  color: var(--ink-2);
  font-size: 13.5px;
  font-weight: 600;
}

.empty p {
  max-width: 380px;
  font-size: 12px;
  line-height: 1.6;
}

.skeleton {
  position: relative;
  overflow: hidden;
  border-radius: 8px;
  background: var(--surface-3);
}

.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.72),
    transparent
  );
  animation: shimmer 1.45s infinite;
}

@keyframes shimmer {
  100% {
    transform: translateX(100%);
  }
}

.skeleton-card {
  display: flex;
  flex-direction: column;
  gap: 11px;
  min-height: 148px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

.skeleton-line {
  height: 12px;
}

.skeleton-line--sm {
  width: 38%;
}

.skeleton-line--md {
  width: 62%;
}

.skeleton-line--lg {
  width: 86%;
}

.skeleton-block {
  height: 64px;
  margin-top: 6px;
}

/* ---------------------------------------------------------------- toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  z-index: 80;
  display: flex;
  align-items: center;
  gap: 9px;
  max-width: min(92vw, 560px);
  padding: 11px 16px;
  border-radius: 12px;
  background: #1f2633;
  color: #fff;
  font-size: 13px;
  line-height: 1.4;
  box-shadow: var(--shadow-lg);
  transform: translateX(-50%);
}

.toast__dot {
  width: 7px;
  height: 7px;
  flex: none;
  border-radius: 50%;
  background: var(--ok-bright);
}

.toast--bad {
  background: var(--bad);
}

.toast--bad .toast__dot {
  background: #fff;
}

/* ---------------------------------------------------------------- copy box / dropzone */
.copybox {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 8px 8px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
}

.copybox__body {
  flex: 1;
  min-width: 0;
}

.copybox__label {
  color: var(--ink-4);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.copybox__value {
  margin-top: 2px;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.45;
  word-break: break-all;
}

.copybox .btn,
.copybox .icon-btn {
  flex: none;
}

.copy-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.pair-code-box {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
  margin-top: 16px;
  padding: 15px;
  border: 1px solid var(--accent-line);
  border-radius: 14px;
  background: linear-gradient(180deg, #f7f9ff, var(--surface));
}

.pair-code {
  color: var(--accent);
  font-family: var(--mono);
  font-size: 30px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.16em;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr)) auto;
  gap: 12px;
  align-items: end;
}

.form-row .btn {
  height: 40px;
}

.dropzone {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 128px;
  padding: 22px;
  border: 1.5px dashed var(--line-strong);
  border-radius: 14px;
  background: var(--surface-2);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease);
}

.dropzone:hover,
.dropzone.is-over {
  border-color: var(--brand);
  background: var(--accent-weak);
}

.dropzone.is-busy {
  opacity: 0.7;
  pointer-events: none;
}

.dropzone input[type="file"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.dropzone .icon {
  width: 26px;
  height: 26px;
  color: var(--ink-4);
}

.dropzone strong {
  font-size: 13.5px;
  font-weight: 600;
}

.dropzone span {
  color: var(--ink-4);
  font-size: 11.5px;
}

.dropzone--sm {
  min-height: 96px;
  padding: 16px;
}

/* ---------------------------------------------------------------- device cards */
.device-card {
  position: relative;
  min-width: 0;
  padding: 18px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.device-card::after {
  content: "";
  position: absolute;
  top: -54px;
  right: -54px;
  width: 150px;
  height: 150px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(76, 125, 255, 0.1), transparent 68%);
  pointer-events: none;
}

.device-card.is-offline::after {
  background: radial-gradient(circle, rgba(139, 148, 165, 0.13), transparent 68%);
}

.device-card.is-revoked {
  opacity: 0.72;
}

.device-card--empty {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 5px;
  min-height: 150px;
  border-style: dashed;
  background: var(--surface-2);
  box-shadow: none;
}

.device-card--empty::after {
  display: none;
}

.device-card--empty strong {
  font-size: 13.5px;
  font-weight: 600;
}

.device-card__head {
  display: flex;
  align-items: center;
  gap: 11px;
}

.avatar {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: none;
  border-radius: 12px;
  background: var(--accent-weak);
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
}

.avatar--panel {
  background: var(--ok-weak);
  color: var(--ok);
}

.device-card__title {
  flex: 1;
  min-width: 0;
}

.device-card__title h2 {
  overflow: hidden;
  font-size: 15.5px;
  font-weight: 650;
  letter-spacing: -0.01em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.device-card__meta {
  margin-top: 2px;
  overflow: hidden;
  color: var(--ink-4);
  font-family: var(--mono);
  font-size: 10.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.device-card__status {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 15px;
  font-size: 13.5px;
}

.device-card__status strong {
  font-weight: 650;
}

.status-dot {
  width: 9px;
  height: 9px;
  flex: none;
  border-radius: 50%;
  background: var(--ink-4);
}

.status-dot.is-online {
  background: var(--ok-bright);
  box-shadow: 0 0 0 4px rgba(54, 196, 139, 0.14);
}

.status-dot.is-offline {
  background: var(--ink-4);
}

.status-dot.is-bad {
  background: var(--bad-bright);
}

.device-card__rows {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px 16px;
  margin-top: 14px;
  padding-top: 13px;
  border-top: 1px solid var(--line);
}

.meta-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
  font-size: 12px;
}

.meta-row dt {
  flex: none;
  color: var(--ink-4);
}

.meta-row dd {
  overflow: hidden;
  color: var(--ink-2);
  font-weight: 550;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.device-card__actions {
  display: flex;
  gap: 7px;
  margin-top: 15px;
  padding-top: 13px;
  border-top: 1px solid var(--line);
  flex-wrap: wrap;
}

/* ---------------------------------------------------------------- overview */
.weather {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.weather__temp {
  font-size: 46px;
  font-weight: 680;
  line-height: 0.95;
  letter-spacing: -0.045em;
  font-variant-numeric: tabular-nums;
}

.weather__condition {
  margin-top: 6px;
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 600;
}

.weather__icon {
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  flex: none;
  border-radius: 18px;
  background: linear-gradient(135deg, #edf3ff, #e8f8f1);
  color: var(--accent);
}

.weather__icon .icon {
  width: 28px;
  height: 28px;
}

.weather__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 16px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.weather__tip {
  margin-top: 13px;
  padding: 9px 11px;
  border-radius: 9px;
  background: var(--warn-weak);
  color: var(--warn);
  font-size: 12px;
}

.send-grid {
  display: flex;
  flex-direction: column;
  gap: 13px;
}

.send-grid__row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.send-grid__row .field {
  flex: 1;
  min-width: 150px;
}

.send-grid__row .btn {
  flex: none;
}

.timeline {
  display: flex;
  flex-direction: column;
}

.timeline__item {
  position: relative;
  padding: 0 0 15px 20px;
  border-left: 1.5px solid var(--line);
}

.timeline__item:last-child {
  padding-bottom: 0;
  border-left-color: transparent;
}

.timeline__item::before {
  content: "";
  position: absolute;
  top: 4px;
  left: -5px;
  width: 8px;
  height: 8px;
  border: 2px solid var(--line-strong);
  border-radius: 50%;
  background: var(--surface);
}

.timeline__item.is-ok::before {
  border-color: var(--ok-bright);
}

.timeline__item.is-bad::before {
  border-color: var(--bad-bright);
}

.timeline__time {
  color: var(--ink-4);
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
}

.timeline__body {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 2px;
  flex-wrap: wrap;
  font-size: 12.5px;
  color: var(--ink-2);
}

.timeline__body strong {
  color: var(--ink);
  font-weight: 600;
}

/* ---------------------------------------------------------------- todos */
.quick-add__grid {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 150px 178px 160px auto;
  gap: 12px;
  align-items: end;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  flex-wrap: wrap;
}

.toolbar__right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.todo-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.todo-list--page {
  gap: 0;
}

.todo-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease);
}

.todo-list--page .todo-item {
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  padding: 12px 16px;
  background: transparent;
}

.todo-list--page .todo-item:last-child {
  border-bottom: 0;
}

.todo-list--page .todo-item:hover {
  background: var(--surface-2);
}

.todo-check {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  flex: none;
  padding: 0;
  border: 1.5px solid var(--line-strong);
  border-radius: 7px;
  background: var(--surface);
  color: transparent;
  transition: background 0.15s var(--ease), border-color 0.15s var(--ease),
    color 0.15s var(--ease);
}

.todo-check .icon {
  width: 13px;
  height: 13px;
  stroke-width: 2.4;
}

.todo-check:hover {
  border-color: var(--accent);
  color: var(--accent-line);
}

.todo-item.is-done .todo-check {
  border-color: var(--ok);
  background: var(--ok);
  color: #fff;
}

.todo-item__main {
  min-width: 0;
}

.todo-item__title {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  font-size: 13.5px;
  font-weight: 550;
  line-height: 1.35;
}

.todo-item.is-done .todo-item__title > span:first-child {
  color: var(--ink-4);
  text-decoration: line-through;
}

.todo-item__meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 3px;
  color: var(--ink-4);
  font-size: 11px;
  flex-wrap: wrap;
}

.owner-tag {
  display: inline-flex;
  align-items: center;
  height: 18px;
  padding: 0 6px;
  border-radius: 5px;
  background: var(--surface-3);
  color: var(--ink-3);
  font-size: 10px;
  font-weight: 600;
}

.todo-item__side {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.inline-editor {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 3px;
}

.inline-editor .input {
  flex: 1;
  min-width: 150px;
}

/* ---------------------------------------------------------------- settings */
.state-list {
  display: flex;
  flex-direction: column;
}

.state-row {
  display: grid;
  grid-template-columns: minmax(90px, 0.7fr) minmax(130px, 1.4fr) 46px;
  gap: 11px;
  align-items: center;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}

.state-row:last-child {
  border-bottom: 0;
}

.state-row__id {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.state-swatch {
  width: 18px;
  height: 18px;
  flex: none;
  border: 1px solid rgba(16, 24, 40, 0.12);
  border-radius: 6px;
}

.config-group {
  padding-top: 4px;
}

.config-group + .config-group {
  margin-top: 6px;
  padding-top: 16px;
  border-top: 1px dashed var(--line);
}

.config-group__title {
  margin-bottom: 2px;
  color: var(--ink-3);
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.config-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 26px;
}

.config-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-width: 0;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.config-row__label {
  min-width: 0;
}

.config-row__name {
  font-size: 12.5px;
  font-weight: 550;
}

.config-row__path {
  margin-top: 1px;
  overflow: hidden;
  color: var(--ink-4);
  font-family: var(--mono);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.config-row__control {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex: 0 0 176px;
  min-width: 0;
}

.config-row__control .select,
.config-row__control .input {
  height: 34px;
  border-radius: 8px;
  font-size: 12.5px;
}

.dirty-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--warn-bright);
}

/* ---------------------------------------------------------------- photos */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 13px;
}

.photo-card {
  position: relative;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease),
    opacity 0.15s var(--ease), transform 0.15s var(--ease);
}

.photo-card:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-md);
}

.photo-card img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  background: var(--surface-3);
}

.photo-card.is-dragging {
  opacity: 0.45;
  transform: scale(0.97);
}

.photo-card.is-target {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px rgba(76, 125, 255, 0.2);
}

.order-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 7px;
  border-radius: var(--pill);
  background: rgba(23, 27, 35, 0.68);
  color: #fff;
  font-size: 10.5px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  backdrop-filter: blur(4px);
}

.photo-card__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  color: var(--ink-4);
  font-size: 10.5px;
}

.photo-card__actions {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 8px 8px;
}

.photo-card__actions .btn--danger-ghost {
  margin-left: auto;
}

/* ---------------------------------------------------------------- runtime */
.health-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.tile {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.tile--bad {
  border-color: #f6cfcc;
  background: var(--bad-weak);
}

.tile--warn {
  border-color: #f2dfb7;
  background: var(--warn-weak);
}

.tile__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--ink-4);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.tile__value {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 6px;
  font-size: 17px;
  font-weight: 680;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}

.telemetry-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.telemetry-card {
  min-width: 0;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.telemetry-card__head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 11px;
}

.telemetry-card__head strong {
  overflow: hidden;
  font-size: 13px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.telemetry-card__head .mono {
  overflow: hidden;
  color: var(--ink-4);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.telemetry-card__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px 12px;
}

.telemetry-card__grid .meta-row dd {
  font-variant-numeric: tabular-nums;
}

.spark {
  width: 100%;
  height: 48px;
  margin-top: 12px;
  overflow: visible;
}

.spark__grid {
  stroke: var(--line);
  stroke-width: 1;
  stroke-dasharray: 2 3;
}

.spark__line {
  fill: none;
  stroke: var(--brand);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

.event-feed {
  display: flex;
  flex-direction: column;
  max-height: 420px;
  overflow-y: auto;
}

.event-feed__item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}

.event-feed__item:last-child {
  border-bottom: 0;
}

.event-feed__time {
  flex: 0 0 42px;
  color: var(--ink-4);
  font-family: var(--mono);
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
}

.event-feed__body {
  min-width: 0;
  flex: 1;
}

.event-feed__name {
  font-size: 12px;
  font-weight: 600;
}

.event-feed__data {
  margin-top: 2px;
  overflow: hidden;
  color: var(--ink-4);
  font-family: var(--mono);
  font-size: 10.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------------------------------------------------------------- login */
.login-body {
  background:
    radial-gradient(900px 520px at 50% -12%, rgba(76, 125, 255, 0.14), transparent 62%),
    radial-gradient(760px 460px at 100% 100%, rgba(54, 196, 139, 0.08), transparent 58%),
    var(--canvas);
}

.login {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 28px 18px;
}

.login__card {
  width: min(100%, 392px);
  padding: 32px 30px 26px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow-lg);
}

.login__brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-bottom: 24px;
  text-align: center;
}

.login__mark {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 17px;
  color: #fff;
  background: linear-gradient(135deg, #5b8bff 0%, #2f5be0 100%);
  box-shadow: 0 16px 30px -14px rgba(47, 91, 224, 0.75);
}

.login__mark svg {
  width: 30px;
  height: 30px;
}

.login__brand h1 {
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.login__domain {
  margin-top: 2px;
  color: var(--ink-4);
  font-size: 11.5px;
  letter-spacing: 0.04em;
}

.login__form {
  display: flex;
  flex-direction: column;
  gap: 13px;
}

.login__hint {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  color: var(--ink-4);
  font-size: 11px;
  line-height: 1.7;
  text-align: center;
}

.login__hint code {
  padding: 1px 5px;
  border-radius: 5px;
  background: var(--surface-3);
  color: var(--ink-2);
  font-size: 10.5px;
}

.password-field {
  position: relative;
}

.password-field .input {
  padding-right: 44px;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 5px;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-4);
  transform: translateY(-50%);
}

.password-toggle:hover {
  background: var(--surface-3);
  color: var(--ink-2);
}

.password-toggle .icon {
  width: 17px;
  height: 17px;
}

/* ---------------------------------------------------------------- responsive */
@media (max-width: 1180px) {
  .grid--main {
    grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.9fr);
  }

  .telemetry-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .quick-add__grid {
    grid-template-columns: minmax(200px, 1fr) 140px 168px 150px auto;
  }
}

@media (max-width: 1023px) {
  .sidebar {
    width: 280px;
    max-width: 84vw;
    transform: translateX(-102%);
    box-shadow: var(--shadow-lg);
    transition: transform 0.22s var(--ease);
  }

  .sidebar.is-open {
    transform: none;
  }

  .main {
    margin-left: 0;
  }

  .topbar {
    height: 60px;
    padding: 0 16px;
    background: rgba(245, 246, 249, 0.92);
    border-bottom: 1px solid var(--line);
  }

  .topbar .topbar__menu {
    display: inline-grid;
  }

  .topbar__brand {
    display: block;
  }

  .topbar .topbar__logout {
    display: inline-flex;
  }

  .topbar__crumb {
    display: none;
  }

  .content {
    padding: 4px 16px 44px;
  }

  .scrim {
    display: block;
  }

  body.drawer-open {
    overflow: hidden;
  }

  .stat-strip,
  .health-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .grid--main {
    grid-template-columns: minmax(0, 1fr);
  }

  .quick-add__grid {
    grid-template-columns: minmax(180px, 1fr) 140px 160px;
  }

  .quick-add__grid .btn {
    grid-column: 1 / -1;
    justify-self: start;
  }
}

@media (max-width: 860px) {
  .grid--2,
  .grid--3,
  .device-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .telemetry-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .config-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }

  .copy-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .config-row {
    padding: 11px 0;
  }

  .quick-add__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .form-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .form-row .btn {
    grid-column: 1 / -1;
    width: 100%;
  }

  .quick-add__grid .field:first-child {
    grid-column: 1 / -1;
  }

  .field-grid--3,
  .field-grid--4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 759px) {
  .icon-btn {
    width: 44px;
    height: 44px;
  }

  .icon-btn--sm {
    width: 40px;
    height: 40px;
  }

  .btn--sm {
    height: 36px;
  }

  .segmented button {
    height: 36px;
  }

  .todo-check {
    width: 28px;
    height: 28px;
  }

  .page-head {
    align-items: flex-start;
    padding: 14px 0 16px;
  }

  .page-head h1 {
    font-size: 22px;
  }

  .page-head__actions {
    width: 100%;
  }

  .page-head__actions .btn {
    flex: 1;
  }

  .stat-strip,
  .health-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .stat {
    padding: 12px 14px;
  }

  .field-grid,
  .field-grid--3,
  .field-grid--4 {
    grid-template-columns: minmax(0, 1fr);
  }

  .state-row {
    grid-template-columns: minmax(0, 1fr) 46px;
  }

  .state-row__id {
    grid-column: 1 / -1;
  }

  .config-row {
    align-items: flex-start;
    flex-direction: column;
    gap: 7px;
  }

  .config-row__control {
    flex: none;
    width: 100%;
    justify-content: flex-start;
  }

  .config-row__control .select,
  .config-row__control .input {
    max-width: 100%;
  }

  .weather__temp {
    font-size: 40px;
  }

  .todo-item {
    grid-template-columns: auto minmax(0, 1fr);
    row-gap: 8px;
  }

  .todo-item__side {
    grid-column: 1 / -1;
    justify-content: flex-start;
    padding-left: 38px;
  }

  .todo-list--page .todo-item {
    padding: 12px;
  }

  .photo-grid {
    grid-template-columns: repeat(auto-fill, minmax(128px, 1fr));
  }

  /* 表格在窄屏降级为卡片，避免整页横向撑宽。 */
  .table--cards {
    min-width: 0;
  }

  .table--cards thead {
    display: none;
  }

  .table--cards,
  .table--cards tbody,
  .table--cards tr,
  .table--cards td {
    display: block;
    width: 100%;
  }

  .table--cards tr {
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
  }

  .table--cards tbody tr:last-child {
    border-bottom: 0;
  }

  .table--cards tbody tr:hover {
    background: transparent;
  }

  .table--cards td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 4px 0;
    border: 0;
    text-align: right;
  }

  .table--cards td::before {
    content: attr(data-label);
    flex: 0 0 74px;
    color: var(--ink-4);
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-align: left;
    text-transform: uppercase;
  }

  .table--cards td:first-child {
    padding-top: 0;
  }

  .table--cards td:last-child {
    padding-bottom: 0;
  }

  .table--cards td.cell-actions {
    justify-content: flex-end;
    padding-top: 8px;
  }

  .table--cards td.cell-actions::before {
    display: none;
  }

  .table--cards .cell-sub {
    text-align: right;
  }

  .toast {
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  }

  .login__card {
    padding: 26px 20px 22px;
  }
}

@media (max-width: 520px) {
  .topbar__domain {
    display: none;
  }

  .card {
    padding: 15px;
  }

  .quick-add__grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .quick-add__grid .btn {
    justify-self: stretch;
  }

  .send-grid__row .btn {
    width: 100%;
  }

  .device-card__rows {
    grid-template-columns: minmax(0, 1fr);
  }

  .weather {
    gap: 12px;
  }

  .weather__icon {
    width: 52px;
    height: 52px;
    border-radius: 15px;
  }

  .weather__icon .icon {
    width: 24px;
    height: 24px;
  }
}

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