:root {
  color-scheme: light;
  --background: #f3f6f1;
  --background-deep: #e7efe7;
  --surface: #ffffff;
  --surface-soft: #eef4ef;
  --text: #17231c;
  --muted: #68766d;
  --muted-strong: #4e5f54;
  --primary: #126b5c;
  --primary-strong: #0a5347;
  --primary-soft: #e3f1ec;
  --border: #dfe7e0;
  --border-strong: #cbd8ce;
  --danger: #b42318;
  --danger-soft: #fff1ef;
  --shadow-small: 0 8px 24px rgba(26, 52, 38, 0.06);
  --shadow-large: 0 28px 70px rgba(25, 51, 37, 0.18);
  --radius-large: 24px;
  --radius-medium: 18px;
  --radius-small: 12px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--background);
}

body {
  min-width: 320px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 8% -5%, rgba(152, 205, 175, 0.34), transparent 34%),
    radial-gradient(circle at 100% 20%, rgba(224, 233, 199, 0.4), transparent 30%),
    var(--background);
  font-family:
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    "PingFang SC",
    "Microsoft YaHei",
    sans-serif;
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

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

button {
  touch-action: manipulation;
}

[hidden] {
  display: none !important;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--primary);
  font-size: 0.74rem;
  font-weight: 750;
  letter-spacing: 0.12em;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2,
h3 {
  line-height: 1.25;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid rgba(18, 107, 92, 0.24);
  outline-offset: 2px;
}

.button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border: 1px solid transparent;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
  transition:
    transform 140ms ease,
    background-color 140ms ease,
    border-color 140ms ease,
    color 140ms ease,
    box-shadow 140ms ease;
}

.button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.button:active:not(:disabled) {
  transform: translateY(0);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.56;
}

.button.primary {
  color: #ffffff;
  background: var(--primary);
  box-shadow: 0 10px 22px rgba(18, 107, 92, 0.18);
}

.button.primary:hover:not(:disabled) {
  background: var(--primary-strong);
}

.button.ghost {
  color: var(--muted-strong);
  background: transparent;
  border-color: var(--border);
}

.button.ghost:hover:not(:disabled) {
  color: var(--text);
  background: var(--surface-soft);
}

.button.subtle {
  color: var(--primary);
  background: var(--primary-soft);
}

.button.subtle:hover:not(:disabled) {
  background: #d6eae3;
}

.button.danger {
  color: #ffffff;
  background: var(--danger);
  box-shadow: 0 10px 22px rgba(180, 35, 24, 0.16);
}

.button.danger:hover:not(:disabled) {
  background: #8f1b13;
}

.button.danger-ghost {
  color: var(--danger);
  background: transparent;
  border-color: #efd2cf;
}

.button.danger-ghost:hover:not(:disabled) {
  background: var(--danger-soft);
}

.button.small {
  min-height: 36px;
  padding: 7px 13px;
  font-size: 0.86rem;
}

.install-button {
  padding-inline: 12px;
}

.install-button svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.button-full {
  width: 100%;
}

.icon-button {
  display: inline-grid;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--muted-strong);
  background: var(--surface);
  cursor: pointer;
  font-size: 1.45rem;
  line-height: 1;
}

.icon-button:hover {
  color: var(--text);
  background: var(--surface-soft);
}

.field {
  display: grid;
  gap: 7px;
}

.field > span {
  color: var(--muted-strong);
  font-size: 0.88rem;
  font-weight: 700;
}

.field small {
  color: var(--muted);
  font-weight: 500;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 48px;
  padding: 11px 13px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-small);
  color: var(--text);
  background: var(--surface);
  outline: none;
  transition:
    border-color 140ms ease,
    box-shadow 140ms ease;
}

.field textarea {
  min-height: 92px;
  resize: vertical;
}

.field input::placeholder,
.field textarea::placeholder {
  color: #96a198;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(18, 107, 92, 0.1);
}

.form-error {
  margin: 0;
  padding: 9px 12px;
  border-radius: 10px;
  color: var(--danger);
  background: var(--danger-soft);
  font-size: 0.88rem;
}

.helper-text,
.readonly-note {
  color: var(--muted);
  font-size: 0.84rem;
}

.helper-text {
  margin: 10px 2px 18px;
}

.readonly-note {
  margin: 0;
  padding: 11px 13px;
  border-radius: 12px;
  background: var(--surface-soft);
}

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

.login-card {
  width: min(100%, 430px);
  padding: 34px;
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 30px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow-large);
  backdrop-filter: blur(18px);
}

.brand-mark {
  display: grid;
  width: 52px;
  height: 52px;
  margin-bottom: 20px;
  place-items: center;
  border-radius: 17px;
  color: #ffffff;
  background: linear-gradient(145deg, #1d7f6e, #0c5d50);
  box-shadow: 0 12px 24px rgba(18, 107, 92, 0.24);
}

.brand-mark svg {
  width: 30px;
  height: 30px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.65;
}

.login-card h1 {
  margin-bottom: 10px;
  font-size: clamp(2rem, 8vw, 2.6rem);
  letter-spacing: -0.04em;
}

.login-description {
  margin-bottom: 26px;
  color: var(--muted);
  font-size: 0.94rem;
}

.login-form {
  display: grid;
  gap: 15px;
}

.login-hint {
  margin: 20px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  text-align: center;
}

.app-shell {
  min-height: 100vh;
  min-height: 100dvh;
  padding-bottom: calc(96px + env(safe-area-inset-bottom));
}

.app-header {
  position: sticky;
  z-index: 20;
  top: 0;
  border-bottom: 1px solid rgba(217, 228, 218, 0.78);
  background: rgba(243, 246, 241, 0.86);
  backdrop-filter: blur(16px);
}

.header-inner,
.app-main {
  width: min(1120px, calc(100% - 28px));
  margin-inline: auto;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 17px 0 15px;
}

.header-inner h1 {
  margin: 0;
  font-size: 1.6rem;
  letter-spacing: -0.035em;
}

.header-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 7px;
}

.app-main {
  padding-top: 20px;
}

.panel {
  animation: panel-in 220ms ease-out;
}

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

.summary-card {
  position: relative;
  display: grid;
  min-height: 112px;
  align-content: end;
  gap: 1px;
  padding: 18px;
  overflow: hidden;
  border: 1px solid rgba(223, 231, 224, 0.82);
  border-radius: var(--radius-medium);
  background: rgba(255, 255, 255, 0.78);
  box-shadow: var(--shadow-small);
}

.summary-card::after {
  position: absolute;
  top: -26px;
  right: -18px;
  width: 86px;
  height: 86px;
  border-radius: 50%;
  background: rgba(218, 237, 226, 0.64);
  content: "";
}

.summary-label {
  position: relative;
  z-index: 1;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 650;
}

.summary-card strong {
  position: relative;
  z-index: 1;
  font-size: clamp(1.55rem, 5vw, 2rem);
  letter-spacing: -0.04em;
  line-height: 1.1;
}

.summary-unit {
  position: relative;
  z-index: 1;
  color: var(--muted);
  font-size: 0.74rem;
}

.panel-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.panel-heading h2 {
  margin: 0 0 4px;
  font-size: 1.28rem;
  letter-spacing: -0.025em;
}

.panel-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 0.87rem;
}

.panel-heading-actions {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.toolbar {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-bottom: 13px;
}

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

.search-box {
  position: relative;
  display: flex;
  min-width: 0;
  align-items: center;
}

.search-box svg {
  position: absolute;
  left: 15px;
  width: 20px;
  height: 20px;
  fill: none;
  stroke: var(--muted);
  stroke-linecap: round;
  stroke-width: 1.8;
  pointer-events: none;
}

.search-box input,
.select-box select {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--border);
  border-radius: 14px;
  color: var(--text);
  background: var(--surface);
  box-shadow: 0 4px 14px rgba(26, 52, 38, 0.035);
}

.search-box input {
  padding: 10px 14px 10px 44px;
  outline: none;
}

.search-box input::-webkit-search-cancel-button {
  cursor: pointer;
}

.select-box select {
  padding: 10px 36px 10px 14px;
  cursor: pointer;
  outline: none;
}

.search-box input:focus,
.select-box select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(18, 107, 92, 0.1);
}

.batch-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  padding: 11px 13px 11px 16px;
  border: 1px solid #cde4da;
  border-radius: 15px;
  color: var(--primary-strong);
  background: var(--primary-soft);
  font-size: 0.9rem;
  font-weight: 700;
}

.batch-actions {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  gap: 7px;
}

.list-control-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 12px 2px 10px;
}

.list-control-group {
  display: flex;
  min-width: 0;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 16px;
}

.text-action {
  padding: 2px 0;
  border: 0;
  color: var(--muted-strong);
  background: transparent;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 700;
  text-decoration: underline;
  text-decoration-color: #b8c8bd;
  text-underline-offset: 3px;
}

.text-action:hover,
.text-action.active {
  color: var(--primary-strong);
  text-decoration-color: currentColor;
}

.check-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted-strong);
  cursor: pointer;
  font-size: 0.84rem;
  font-weight: 650;
}

.check-control input,
.device-checkbox input {
  width: 19px;
  height: 19px;
  margin: 0;
  accent-color: var(--primary);
  cursor: pointer;
}

.result-count {
  color: var(--muted);
  font-size: 0.8rem;
}

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

.device-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 13px;
  min-width: 0;
  padding: 15px;
  border: 1px solid var(--border);
  border-radius: var(--radius-medium);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow-small);
  transition:
    border-color 140ms ease,
    box-shadow 140ms ease,
    background-color 140ms ease;
}

.device-card:hover {
  border-color: var(--border-strong);
}

.device-card.is-selected {
  border-color: #97c9b6;
  background: #f6fbf8;
  box-shadow: 0 10px 28px rgba(18, 107, 92, 0.08);
}

.device-card.is-removed {
  border-style: dashed;
  background: #fbfbfa;
}

.device-checkbox {
  display: grid;
  padding: 4px;
  place-items: center;
}

.device-info {
  min-width: 0;
}

.device-title-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.device-name {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 1rem;
  letter-spacing: -0.01em;
}

.region-badge {
  display: inline-flex;
  max-width: 100%;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  color: var(--primary-strong);
  background: var(--primary-soft);
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.category-badge {
  display: inline-flex;
  max-width: 100%;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  color: #425a6b;
  background: #e9f0f4;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.device-status-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  color: var(--danger);
  background: var(--danger-soft);
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.45;
}

.device-code {
  display: flex;
  min-width: 0;
  align-items: baseline;
  gap: 7px;
  margin: 5px 0 0;
  color: var(--muted-strong);
  font-family: ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.8rem;
}

.meta-label {
  flex: 0 0 auto;
  color: var(--muted);
  font-family: inherit;
  font-size: 0.68rem;
  font-weight: 700;
}

.device-code-value {
  min-width: 0;
  overflow-wrap: anywhere;
}

.device-note {
  display: -webkit-box;
  margin: 5px 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.78rem;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  white-space: pre-wrap;
}

.detail-button {
  align-self: center;
}

.device-card-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 6px;
}

.empty-state {
  display: grid;
  grid-column: 1 / -1;
  min-height: 210px;
  place-items: center;
  padding: 30px 20px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-large);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.56);
  text-align: center;
}

.empty-state-inner {
  max-width: 320px;
}

.empty-icon {
  display: inline-grid;
  width: 46px;
  height: 46px;
  margin-bottom: 13px;
  place-items: center;
  border-radius: 50%;
  color: var(--primary);
  background: var(--primary-soft);
  font-size: 1.25rem;
  font-weight: 700;
}

.empty-state h3 {
  margin-bottom: 6px;
  color: var(--text);
  font-size: 1rem;
}

.empty-state p {
  margin: 0;
  font-size: 0.84rem;
}

.empty-state.compact {
  min-height: 130px;
  padding: 22px 16px;
}

.inline-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  padding: 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-medium);
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow-small);
}

.compact-field input {
  min-height: 46px;
}

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

.region-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 13px;
  padding: 15px;
  border: 1px solid var(--border);
  border-radius: var(--radius-medium);
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow-small);
}

.region-icon {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 13px;
  color: var(--primary);
  background: var(--primary-soft);
}

.region-icon svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.region-info {
  min-width: 0;
}

.region-name {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 0.98rem;
}

.region-meta {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 6px;
}

.category-icon {
  color: #425a6b;
  background: #e9f0f4;
}

.transfer-list {
  display: grid;
  gap: 10px;
}

.transfer-card {
  padding: 17px;
  border: 1px solid var(--border);
  border-radius: var(--radius-medium);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow-small);
}

.transfer-title-line {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.transfer-device-name {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 1rem;
}

.transfer-time {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.73rem;
  white-space: nowrap;
}

.transfer-device-code {
  margin: 4px 0 12px;
  color: var(--muted);
  font-family: ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.76rem;
  overflow-wrap: anywhere;
}

.transfer-route {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
}

.route-place {
  display: inline-flex;
  max-width: 100%;
  align-items: center;
  padding: 5px 10px;
  border-radius: 9px;
  color: var(--muted-strong);
  background: var(--surface-soft);
  font-size: 0.79rem;
  font-weight: 650;
  overflow-wrap: anywhere;
}

.to-place {
  color: var(--primary-strong);
  background: var(--primary-soft);
}

.route-arrow {
  color: var(--muted);
  font-weight: 800;
}

.transfer-meta {
  margin: 11px 0 0;
  color: var(--muted);
  font-size: 0.76rem;
}

.transfer-note {
  margin: 7px 0 0;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
  color: var(--muted-strong);
  font-size: 0.8rem;
  white-space: pre-wrap;
}

.bottom-nav {
  position: fixed;
  z-index: 30;
  bottom: max(12px, env(safe-area-inset-bottom));
  left: 50%;
  display: grid;
  width: min(480px, calc(100% - 24px));
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 5px;
  padding: 6px;
  border: 1px solid rgba(218, 228, 220, 0.9);
  border-radius: 21px;
  background: rgba(255, 255, 255, 0.93);
  box-shadow: 0 16px 38px rgba(22, 47, 33, 0.16);
  transform: translateX(-50%);
  backdrop-filter: blur(18px);
}

.nav-button {
  display: grid;
  min-height: 52px;
  place-items: center;
  gap: 2px;
  padding: 5px 8px;
  border: 0;
  border-radius: 16px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 700;
  transition:
    color 140ms ease,
    background-color 140ms ease;
}

.nav-button svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.75;
}

.nav-button:hover {
  color: var(--primary-strong);
  background: var(--surface-soft);
}

.nav-button.active {
  color: var(--primary-strong);
  background: var(--primary-soft);
}

.modal {
  width: min(520px, calc(100vw - 28px));
  max-height: calc(100vh - 30px);
  max-height: calc(100dvh - 30px);
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: var(--radius-large);
  color: var(--text);
  background: var(--surface);
  box-shadow: var(--shadow-large);
}

.modal-wide {
  width: min(680px, calc(100vw - 28px));
}

.modal::backdrop {
  background: rgba(13, 32, 22, 0.52);
  backdrop-filter: blur(4px);
}

.modal[open] {
  animation: modal-in 180ms ease-out;
}

.modal-form {
  display: flex;
  max-height: calc(100vh - 30px);
  max-height: calc(100dvh - 30px);
  flex-direction: column;
}

.modal-header {
  display: flex;
  flex: 0 0 auto;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 22px 16px;
  border-bottom: 1px solid var(--border);
}

.modal-header h2 {
  margin: 0;
  font-size: 1.3rem;
  letter-spacing: -0.025em;
}

.modal-body {
  display: grid;
  flex: 1 1 auto;
  gap: 15px;
  padding: 20px 22px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.warning-eyebrow {
  color: var(--danger);
}

.install-intro {
  margin: 0;
  color: var(--muted-strong);
}

.install-steps {
  display: grid;
  gap: 9px;
  margin: 0;
  padding-left: 1.35rem;
}

.install-steps li {
  padding-left: 3px;
}

.install-note {
  margin: 0;
  padding: 12px 14px;
  border-radius: var(--radius-small);
  color: var(--muted-strong);
  background: var(--surface-soft);
  font-size: 0.86rem;
}

.removal-note {
  border-color: #efd2cf;
  background: var(--danger-soft);
}

.removal-note p + p {
  margin-top: 5px;
}

.modal-actions {
  display: flex;
  flex: 0 0 auto;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 9px;
  padding: 14px 22px calc(14px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.transfer-intro {
  margin: 0;
  color: var(--muted-strong);
  font-size: 0.92rem;
}

.transfer-intro strong {
  color: var(--primary-strong);
  font-size: 1.08rem;
}

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

.detail-item {
  display: grid;
  gap: 4px;
  padding: 12px;
  border-radius: 13px;
  background: var(--surface-soft);
}

.detail-item span,
.detail-note > span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 650;
}

.detail-item strong {
  overflow-wrap: anywhere;
  font-size: 0.86rem;
  font-weight: 700;
}

.detail-note {
  margin-top: 11px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 13px;
}

.detail-note p {
  margin: 4px 0 0;
  color: var(--muted-strong);
  font-size: 0.84rem;
  white-space: pre-wrap;
}

.section-split {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 22px 0 12px;
}

.section-split h3 {
  margin: 0;
  font-size: 1rem;
}

.section-split span {
  color: var(--muted);
  font-size: 0.75rem;
}

.timeline {
  display: grid;
  gap: 0;
}

.timeline-item {
  position: relative;
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 9px;
  padding-bottom: 18px;
}

.timeline-item::before {
  position: absolute;
  top: 14px;
  bottom: -2px;
  left: 6px;
  width: 1px;
  background: var(--border-strong);
  content: "";
}

.timeline-item:last-child::before {
  display: none;
}

.timeline-dot {
  position: relative;
  z-index: 1;
  width: 13px;
  height: 13px;
  margin-top: 3px;
  border: 3px solid #d8ebe3;
  border-radius: 50%;
  background: var(--primary);
}

.timeline-body {
  min-width: 0;
}

.timeline-route {
  margin: 0;
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.timeline-meta {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.74rem;
}

.timeline-note {
  margin: 6px 0 0;
  color: var(--muted-strong);
  font-size: 0.78rem;
  white-space: pre-wrap;
}

.loading-text {
  margin: 0;
  padding: 38px 12px;
  color: var(--muted);
  text-align: center;
}

.toast {
  position: fixed;
  z-index: 100;
  bottom: calc(88px + env(safe-area-inset-bottom));
  left: 50%;
  width: min(520px, calc(100% - 28px));
  padding: 12px 16px;
  border-radius: 13px;
  color: #ffffff;
  background: rgba(18, 35, 25, 0.94);
  box-shadow: 0 16px 40px rgba(15, 32, 21, 0.22);
  font-size: 0.86rem;
  text-align: center;
  transform: translate(-50%, 8px);
  opacity: 0;
  transition:
    opacity 160ms ease,
    transform 160ms ease;
}

.toast.is-visible {
  transform: translate(-50%, 0);
  opacity: 1;
}

body:has(dialog[open]) {
  overflow: hidden;
}

@keyframes panel-in {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (min-width: 620px) {
  .header-inner,
  .app-main {
    width: min(1120px, calc(100% - 48px));
  }

  .app-main {
    padding-top: 28px;
  }

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

  .summary-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 15px;
  }

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

  .transfer-list .empty-state,
  .region-list .empty-state {
    grid-column: 1 / -1;
  }
}

@media (min-width: 900px) {
  .device-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .device-card {
    padding: 16px;
  }

  .panel-heading {
    margin-bottom: 20px;
  }

  .modal-header,
  .modal-body,
  .modal-actions {
    padding-right: 26px;
    padding-left: 26px;
  }
}

@media (max-width: 519px) {
  .install-button {
    width: 36px;
    padding: 0;
    border-radius: 50%;
  }

  .install-button-label {
    display: none;
  }

  .login-card {
    padding: 27px 22px;
    border-radius: 25px;
  }

  .panel-heading {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .panel-heading-actions {
    width: 100%;
  }

  .panel-heading-actions .button {
    flex: 1 1 0;
  }

  .panel-heading .button {
    flex: 0 0 auto;
    padding-inline: 15px;
    font-size: 0.86rem;
  }

  .batch-bar {
    align-items: flex-start;
    flex-direction: column;
  }

  .batch-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .inline-form {
    grid-template-columns: 1fr;
  }

  .inline-form .button {
    width: 100%;
  }

  .detail-grid {
    grid-template-columns: 1fr;
  }

  .modal-actions .button {
    flex: 1 1 0;
  }
}

@media (max-width: 380px) {
  .summary-grid {
    gap: 8px;
  }

  .summary-card {
    min-height: 100px;
    padding: 13px;
  }

  .summary-card strong {
    font-size: 1.35rem;
  }

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

  .device-card-actions {
    grid-column: 2;
    justify-self: start;
  }

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

  .row-actions {
    grid-column: 2;
    justify-self: start;
  }
}

@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;
  }
}
