:root {
  --paper: #f2eee5;
  --paper-deep: #e9e1d4;
  --surface: #fffdf8;
  --surface-muted: #f8f4ec;
  --ink: #192522;
  --ink-soft: #3f4d48;
  --muted: #718079;
  --line: #d9d2c5;
  --line-strong: #bfb6a6;
  --forest: #153c34;
  --forest-light: #20564b;
  --teal: #0d7667;
  --teal-soft: #dcece6;
  --amber: #b46c1f;
  --amber-soft: #f4e6cf;
  --red: #a23b35;
  --red-soft: #f4dfdc;
  --blue: #346786;
  --blue-soft: #dfeaf0;
  --shadow: 0 18px 48px rgba(28, 40, 35, 0.09);
  --radius: 8px;
  --font-body: "Aptos", "Microsoft YaHei UI", "PingFang SC", sans-serif;
  --font-display: "STZhongsong", "Songti SC", "Noto Serif SC", serif;
  --font-number: "DIN Alternate", "Bahnschrift", "Aptos Display", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--paper);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    repeating-linear-gradient(
      0deg,
      transparent 0,
      transparent 31px,
      rgba(58, 72, 66, 0.035) 31px,
      rgba(58, 72, 66, 0.035) 32px
    );
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select {
  font: inherit;
}

button {
  color: inherit;
}

button,
a,
input,
select {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(13, 118, 103, 0.24);
  outline-offset: 2px;
}

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

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

h1 {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 700;
}

h2 {
  font-family: var(--font-display);
  font-size: 23px;
  font-weight: 700;
}

h3 {
  font-size: 18px;
}

code {
  font-family: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
}

.is-hidden {
  display: none !important;
}

.noscript {
  padding: 18px;
  color: #fff;
  background: var(--red);
  text-align: center;
}

.eyebrow {
  display: block;
  color: var(--teal);
  font-family: var(--font-number);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  line-height: 1.3;
  text-transform: uppercase;
}

.loading-screen {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: var(--ink);
  background: var(--paper);
  font-weight: 650;
}

.loading-screen::after {
  width: 42px;
  height: 2px;
  content: "";
  background: var(--teal);
  animation: loading-pulse 1.15s ease-in-out infinite;
}

@keyframes loading-pulse {
  0%,
  100% {
    opacity: 0.25;
    transform: scaleX(0.35);
  }
  50% {
    opacity: 1;
    transform: scaleX(1);
  }
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-lockup > div:last-child {
  display: grid;
  gap: 1px;
}

.brand-lockup strong {
  font-family: var(--font-number);
  font-size: 12px;
  letter-spacing: 0.12em;
}

.brand-lockup span {
  color: var(--muted);
  font-size: 12px;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  color: var(--surface);
  background: var(--forest);
  border-radius: 7px 2px 7px 2px;
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
}

.brand-mark--light {
  color: var(--forest);
  background: #f5e9d7;
}

.auth-shell {
  display: grid;
  min-height: 100vh;
  grid-template-columns: minmax(320px, 0.92fr) minmax(480px, 1.08fr);
}

.auth-context {
  position: relative;
  display: flex;
  overflow: hidden;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(32px, 5vw, 72px);
  color: #f8f5ed;
  background-color: var(--forest);
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 34px 34px;
}

.auth-context::after {
  position: absolute;
  right: -80px;
  bottom: 80px;
  width: 280px;
  height: 280px;
  content: "";
  border: 1px solid rgba(240, 213, 170, 0.35);
  border-radius: 50%;
}

.auth-context .brand-mark {
  color: var(--forest);
  background: #f0d5aa;
}

.auth-context .brand-lockup span {
  color: rgba(248, 245, 237, 0.64);
}

.auth-copy {
  z-index: 1;
  max-width: 560px;
  margin: 80px 0;
}

.auth-copy .eyebrow {
  margin-bottom: 20px;
  color: #e9be7b;
}

.auth-copy h1 {
  max-width: 520px;
  color: #fffaf1;
  font-size: clamp(36px, 4.5vw, 62px);
  line-height: 1.12;
}

.auth-copy p {
  max-width: 530px;
  margin-top: 24px;
  color: rgba(248, 245, 237, 0.72);
  font-size: 16px;
  line-height: 1.8;
}

.auth-principles {
  z-index: 1;
  display: grid;
  max-width: 560px;
  border-top: 1px solid rgba(255, 255, 255, 0.16);
}

.auth-principles > div {
  display: grid;
  align-items: center;
  padding: 13px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.11);
  grid-template-columns: 28px 1fr;
}

.auth-principles svg {
  width: 17px;
  color: #e9be7b;
}

.auth-principles span {
  color: rgba(248, 245, 237, 0.68);
  font-size: 13px;
}

.auth-principles strong {
  margin-right: 8px;
  color: #fffaf1;
  font-family: var(--font-number);
}

.auth-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(28px, 6vw, 80px);
}

.auth-progress {
  position: absolute;
  top: 36px;
  right: clamp(28px, 6vw, 80px);
  display: flex;
  align-items: center;
  gap: 10px;
}

.auth-progress__item {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.auth-progress__item span {
  font-family: var(--font-number);
  font-size: 10px;
}

.auth-progress__item.is-active {
  color: var(--teal);
}

.auth-progress__line {
  width: 24px;
  height: 1px;
  background: var(--line-strong);
}

.auth-panel {
  width: min(100%, 460px);
  padding: 34px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 4px solid var(--teal);
  box-shadow: var(--shadow);
}

.auth-panel__header {
  margin-bottom: 28px;
}

.auth-panel__header .eyebrow {
  margin-bottom: 10px;
}

.auth-panel__header p {
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
}

.field {
  display: grid;
  min-width: 0;
  gap: 8px;
  margin-bottom: 18px;
}

.field > span {
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 650;
}

.field input,
.field select {
  width: 100%;
  height: 46px;
  padding: 0 13px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  transition:
    border-color 150ms ease,
    box-shadow 150ms ease;
}

.field input::placeholder {
  color: #9aa39e;
}

.field input:hover,
.field select:hover {
  border-color: #8e998f;
}

.field input:focus,
.field select:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(13, 118, 103, 0.09);
  outline: none;
}

.check-row {
  display: grid;
  align-items: start;
  margin: 4px 0 20px;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  gap: 10px;
  grid-template-columns: 17px 1fr;
  line-height: 1.65;
}

.check-row input {
  width: 16px;
  height: 16px;
  margin: 2px 0 0;
  accent-color: var(--teal);
}

.button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  cursor: pointer;
  border: 1px solid transparent;
  border-radius: 5px;
  font-size: 13px;
  font-weight: 700;
  gap: 8px;
  transition:
    background-color 140ms ease,
    border-color 140ms ease,
    color 140ms ease,
    transform 140ms ease;
}

.button svg {
  width: 16px;
  height: 16px;
}

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

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

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

.button--primary {
  color: #fff;
  background: var(--forest);
  border-color: var(--forest);
}

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

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

.button--secondary:hover:not(:disabled) {
  background: var(--surface-muted);
  border-color: var(--teal);
}

.button--danger {
  color: #fff;
  background: var(--red);
  border-color: var(--red);
}

.button--danger:hover:not(:disabled) {
  background: #862f2a;
}

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

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

.button--wide {
  width: 100%;
}

.text-button {
  display: block;
  margin: 14px auto 0;
  padding: 4px;
  color: var(--muted);
  background: transparent;
  border: 0;
  cursor: pointer;
  font-size: 12px;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.icon-button {
  display: inline-grid;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  place-items: center;
  padding: 0;
  color: var(--ink-soft);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 5px;
  cursor: pointer;
  transition:
    border-color 140ms ease,
    background-color 140ms ease,
    transform 140ms ease;
}

.icon-button svg {
  width: 17px;
}

.icon-button:hover {
  background: var(--surface-muted);
  border-color: var(--line-strong);
  transform: translateY(-1px);
}

.icon-button--dark {
  color: rgba(255, 255, 255, 0.68);
  background: transparent;
  border-color: rgba(255, 255, 255, 0.14);
}

.icon-button--dark:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.24);
}

.inline-alert {
  margin-bottom: 20px;
  padding: 11px 13px;
  color: var(--red);
  background: var(--red-soft);
  border-left: 3px solid var(--red);
  font-size: 13px;
}

.inline-alert.is-success {
  color: var(--teal);
  background: var(--teal-soft);
  border-color: var(--teal);
}

.captcha-stage {
  padding-top: 22px;
  margin-top: 24px;
  border-top: 1px solid var(--line);
}

.captcha-box {
  min-height: 90px;
  margin: 18px 0;
}

.sms-stage {
  padding-top: 22px;
  margin-top: 24px;
  border-top: 1px solid var(--line);
}

.auth-footnote {
  margin-top: 22px;
  color: #89938e;
  font-size: 11px;
  line-height: 1.75;
}

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

.sidebar {
  position: fixed;
  z-index: 10;
  inset: 0 auto 0 0;
  display: flex;
  width: 236px;
  flex-direction: column;
  padding: 26px 18px 18px;
  color: rgba(255, 255, 255, 0.82);
  background: var(--forest);
}

.brand-lockup--sidebar {
  padding: 0 8px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.brand-lockup--sidebar span {
  color: rgba(255, 255, 255, 0.52);
}

.main-nav {
  display: grid;
  margin-top: 24px;
  gap: 5px;
}

.nav-item {
  display: grid;
  width: 100%;
  min-height: 44px;
  align-items: center;
  padding: 0 12px;
  color: rgba(255, 255, 255, 0.64);
  background: transparent;
  border: 0;
  border-left: 3px solid transparent;
  border-radius: 3px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 650;
  gap: 11px;
  grid-template-columns: 20px 1fr;
  text-align: left;
  transition:
    color 140ms ease,
    background-color 140ms ease,
    border-color 140ms ease;
}

.nav-item svg {
  width: 18px;
}

.nav-item:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
}

.nav-item.is-active {
  color: #fff;
  background: rgba(255, 255, 255, 0.09);
  border-left-color: #e9be7b;
}

.sidebar-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 16px;
  margin-top: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  gap: 10px;
}

.profile-lockup {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
}

.profile-avatar {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  place-items: center;
  color: var(--forest);
  background: #e9be7b;
  border-radius: 5px;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
}

.profile-lockup > div:last-child {
  display: grid;
  min-width: 0;
}

.profile-lockup strong {
  overflow: hidden;
  color: #fff;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-lockup span {
  color: rgba(255, 255, 255, 0.47);
  font-size: 10px;
}

.main-content {
  min-height: 100vh;
  margin-left: 236px;
  padding: 0 clamp(24px, 4vw, 58px) 48px;
}

.topbar {
  display: flex;
  min-height: 102px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  gap: 24px;
}

.topbar h1 {
  margin-top: 5px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.connection-state {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  padding: 0 12px;
  color: var(--muted);
  background: rgba(255, 253, 248, 0.72);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 11px;
  gap: 7px;
}

.status-dot {
  width: 7px;
  height: 7px;
  background: var(--amber);
  border-radius: 50%;
}

.connection-state.is-online .status-dot {
  background: var(--teal);
  box-shadow: 0 0 0 4px rgba(13, 118, 103, 0.1);
}

.connection-state.is-offline .status-dot {
  background: var(--red);
}

.view {
  padding-top: 32px;
  animation: view-enter 220ms ease-out both;
}

@keyframes view-enter {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.schedule-band {
  display: grid;
  align-items: center;
  padding: 15px 18px;
  margin-bottom: 18px;
  background: rgba(255, 253, 248, 0.62);
  border: 1px solid var(--line);
  gap: 18px;
  grid-template-columns: auto minmax(200px, 1fr) auto;
}

.schedule-band__lead {
  display: grid;
  min-width: 135px;
}

.schedule-band__lead strong {
  margin-top: 2px;
  font-family: var(--font-number);
  font-size: 16px;
}

.schedule-band__track {
  display: grid;
  align-items: center;
  color: var(--muted);
  font-family: var(--font-number);
  font-size: 10px;
  gap: 10px;
  grid-template-columns: auto 1fr auto;
}

.schedule-track {
  position: relative;
  height: 3px;
  overflow: hidden;
  background: var(--paper-deep);
}

.schedule-track i {
  display: block;
  width: 0;
  height: 100%;
  background: var(--teal);
  transition: width 500ms ease;
}

.schedule-band__meta {
  display: grid;
  justify-items: end;
}

.schedule-band__meta span {
  color: var(--muted);
  font-size: 10px;
}

.schedule-band__meta strong {
  font-family: var(--font-number);
  font-size: 13px;
}

.dashboard-layout {
  display: grid;
  align-items: stretch;
  gap: 18px;
  grid-template-columns: minmax(0, 1.7fr) minmax(280px, 0.8fr);
}

.operation-surface,
.result-surface,
.settings-section,
.admin-surface,
.table-surface {
  background: var(--surface);
  border: 1px solid var(--line);
}

.operation-surface {
  padding: clamp(24px, 3.4vw, 38px);
}

.result-surface {
  padding: 26px;
}

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.section-heading h2 {
  margin-top: 5px;
}

.section-heading--compact h2 {
  font-size: 19px;
}

.section-icon {
  width: 21px;
  color: var(--muted);
}

.section-icon--risk {
  color: var(--red);
}

.status-pill {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  padding: 0 9px;
  color: var(--ink-soft);
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}

.status-pill--success {
  color: var(--teal);
  background: var(--teal-soft);
  border-color: #b9d8cf;
}

.status-pill--warning {
  color: var(--amber);
  background: var(--amber-soft);
  border-color: #e6cda5;
}

.status-pill--danger {
  color: var(--red);
  background: var(--red-soft);
  border-color: #e2b9b4;
}

.status-pill--info {
  color: var(--blue);
  background: var(--blue-soft);
  border-color: #bfd3df;
}

.sign-focus {
  display: grid;
  align-items: center;
  padding: 42px 0 36px;
  gap: 28px;
  grid-template-columns: minmax(0, 1fr) auto;
}

.sign-focus__main {
  display: grid;
}

.focus-label {
  color: var(--muted);
  font-size: 12px;
}

.sign-focus__main strong {
  margin-top: 5px;
  font-family: var(--font-display);
  font-size: clamp(28px, 3.2vw, 43px);
  line-height: 1.15;
}

.sign-focus__main p {
  max-width: 610px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
}

.sign-focus__meter {
  display: grid;
  justify-items: center;
  color: var(--muted);
  font-size: 10px;
  gap: 7px;
}

.meter-ring {
  --progress: 0deg;
  display: grid;
  width: 102px;
  height: 102px;
  place-content: center;
  background:
    radial-gradient(circle at center, var(--surface) 60%, transparent 61%),
    conic-gradient(var(--teal) var(--progress), var(--paper-deep) 0);
  border-radius: 50%;
  text-align: center;
}

.meter-ring span {
  color: var(--ink);
  font-family: var(--font-number);
  font-size: 25px;
  font-weight: 700;
}

.meter-ring small {
  color: var(--muted);
  font-size: 9px;
}

.operation-actions {
  display: flex;
  padding: 18px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  gap: 10px;
}

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

.detail-grid > div {
  padding: 15px 18px 15px 0;
  border-bottom: 1px solid #ebe5da;
}

.detail-grid > div:nth-child(even) {
  padding-left: 18px;
  border-left: 1px solid #ebe5da;
}

.detail-grid dt {
  color: var(--muted);
  font-size: 10px;
}

.detail-grid dd {
  margin: 4px 0 0;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 650;
}

.result-empty {
  display: grid;
  min-height: 310px;
  align-content: center;
  justify-items: start;
  color: var(--muted);
}

.result-empty svg {
  width: 28px;
  margin-bottom: 16px;
  color: var(--line-strong);
}

.result-empty strong {
  margin-bottom: 6px;
  color: var(--ink-soft);
}

.result-empty span {
  max-width: 260px;
  font-size: 12px;
}

.result-detail {
  display: grid;
  min-height: 310px;
  align-content: center;
}

.result-detail > strong {
  margin-top: 16px;
  font-family: var(--font-display);
  font-size: 24px;
}

.result-detail dl {
  display: grid;
  margin: 25px 0 0;
  border-top: 1px solid var(--line);
}

.result-detail dl > div {
  display: flex;
  justify-content: space-between;
  padding: 11px 0;
  border-bottom: 1px solid #ebe5da;
  gap: 18px;
}

.result-detail dt {
  color: var(--muted);
  font-size: 11px;
}

.result-detail dd {
  margin: 0;
  font-size: 12px;
  font-weight: 650;
  text-align: right;
}

.view-intro {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 24px;
}

.view-intro h2 {
  margin-top: 6px;
}

.view-intro p,
.section-description {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

.table-surface {
  overflow: hidden;
}

.table-scroll {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  white-space: nowrap;
}

.data-table th {
  padding: 13px 16px;
  color: var(--muted);
  background: var(--surface-muted);
  border-bottom: 1px solid var(--line);
  font-size: 10px;
  font-weight: 700;
  text-align: left;
}

.data-table td {
  padding: 15px 16px;
  color: var(--ink-soft);
  border-bottom: 1px solid #eee8de;
  vertical-align: middle;
}

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

.data-table tbody tr:hover {
  background: #fbf8f1;
}

.data-table td:last-child {
  white-space: normal;
}

.table-empty {
  color: var(--muted);
}

.empty-state {
  display: grid;
  min-height: 300px;
  place-content: center;
  justify-items: center;
  color: var(--muted);
  text-align: center;
}

.empty-state svg {
  width: 28px;
  margin-bottom: 14px;
  color: var(--line-strong);
}

.empty-state strong {
  color: var(--ink-soft);
}

.empty-state span {
  margin-top: 4px;
  font-size: 12px;
}

.settings-layout {
  display: grid;
  max-width: 980px;
  gap: 18px;
}

.settings-section {
  padding: 28px;
}

.settings-section form {
  max-width: 560px;
  margin-top: 22px;
}

.input-action {
  display: flex;
  align-items: center;
  gap: 8px;
}

.input-action input {
  min-width: 0;
}

.setting-row,
.danger-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 0;
  border-top: 1px solid var(--line);
  gap: 24px;
}

.setting-row {
  margin-top: 24px;
}

.setting-row > div,
.danger-actions > div {
  display: grid;
  gap: 4px;
}

.setting-row strong,
.danger-actions strong {
  font-size: 13px;
}

.setting-row span,
.danger-actions span {
  color: var(--muted);
  font-size: 12px;
}

.switch {
  position: relative;
  display: inline-flex;
  width: 44px;
  height: 24px;
  flex: 0 0 44px;
  cursor: pointer;
}

.switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.switch span {
  width: 100%;
  height: 100%;
  background: #c9c4bb;
  border-radius: 999px;
  transition: background-color 160ms ease;
}

.switch span::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  content: "";
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.16);
  transition: transform 160ms ease;
}

.switch input:checked + span {
  background: var(--teal);
}

.switch input:checked + span::after {
  transform: translateX(20px);
}

.switch input:focus-visible + span {
  outline: 3px solid rgba(13, 118, 103, 0.24);
  outline-offset: 2px;
}

.policy-note {
  display: flex;
  align-items: flex-start;
  padding: 12px 14px;
  margin-top: 18px;
  color: var(--ink-soft);
  background: var(--surface-muted);
  border-left: 3px solid var(--amber);
  font-size: 11px;
  gap: 9px;
}

.policy-note svg {
  width: 15px;
  flex: 0 0 15px;
  color: var(--amber);
}

.settings-section--danger {
  border-top: 3px solid var(--red);
}

.danger-actions {
  margin-top: 18px;
}

.metric-grid {
  display: grid;
  margin-bottom: 18px;
  gap: 1px;
  background: var(--line);
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.metric {
  display: grid;
  min-height: 128px;
  align-content: center;
  padding: 20px;
  background: var(--surface);
}

.metric > span {
  color: var(--muted);
  font-size: 10px;
}

.metric strong {
  margin: 6px 0 3px;
  font-family: var(--font-number);
  font-size: 28px;
  line-height: 1;
}

.metric small {
  color: var(--muted);
  font-size: 10px;
}

.admin-layout {
  display: grid;
  align-items: start;
  min-width: 0;
  gap: 18px;
  grid-template-columns: minmax(0, 1.55fr) minmax(260px, 0.7fr);
}

.admin-surface {
  min-width: 0;
  padding: 26px;
}

.invite-form {
  display: grid;
  align-items: end;
  min-width: 0;
  padding: 18px 0;
  margin: 16px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  gap: 12px;
  grid-template-columns: 1fr 0.8fr 0.8fr auto;
}

.invite-form .field {
  margin: 0;
}

.invite-form .field input,
.invite-form .field select {
  height: 40px;
}

.invite-reveal {
  padding: 14px;
  margin-bottom: 16px;
  color: var(--teal);
  background: var(--teal-soft);
  border: 1px solid #b9d8cf;
}

.invite-reveal > span {
  display: block;
  margin-bottom: 7px;
  font-size: 10px;
}

.invite-reveal > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.invite-reveal code {
  overflow-wrap: anywhere;
  font-size: 14px;
  font-weight: 700;
}

.invite-reveal .icon-button {
  color: var(--teal);
  background: rgba(255, 255, 255, 0.62);
  border-color: #b9d8cf;
}

.error-list {
  display: grid;
  margin-top: 18px;
  border-top: 1px solid var(--line);
}

.error-item {
  display: grid;
  padding: 15px 0;
  border-bottom: 1px solid #ebe5da;
  gap: 5px;
}

.error-item > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.error-item strong {
  font-size: 12px;
}

.error-item code {
  color: var(--red);
  font-size: 9px;
}

.error-item span {
  color: var(--muted);
  font-size: 10px;
}

.confirm-dialog {
  width: min(92vw, 460px);
  padding: 0;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 4px solid var(--red);
  border-radius: 0;
  box-shadow: 0 30px 80px rgba(20, 28, 25, 0.25);
}

.confirm-dialog::backdrop {
  background: rgba(16, 25, 21, 0.62);
  backdrop-filter: blur(3px);
}

.confirm-dialog form {
  padding: 28px;
}

.confirm-dialog h2 {
  margin-top: 8px;
}

.confirm-dialog p {
  margin-top: 13px;
  color: var(--muted);
  font-size: 13px;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 25px;
  gap: 10px;
}

.toast-region {
  position: fixed;
  z-index: 120;
  right: 22px;
  bottom: 22px;
  display: grid;
  width: min(360px, calc(100vw - 44px));
  gap: 9px;
  pointer-events: none;
}

.toast {
  padding: 13px 15px;
  color: #fff;
  background: var(--forest);
  border-left: 4px solid #e9be7b;
  border-radius: 4px;
  box-shadow: 0 16px 44px rgba(20, 28, 25, 0.23);
  font-size: 12px;
  animation: toast-enter 180ms ease-out both;
}

.toast--error {
  background: #6f2b27;
  border-left-color: #f0a49d;
}

@keyframes toast-enter {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1060px) {
  .dashboard-layout,
  .admin-layout {
    grid-template-columns: 1fr;
  }

  .result-empty,
  .result-detail {
    min-height: 220px;
  }

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

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

@media (max-width: 860px) {
  .auth-shell {
    grid-template-columns: 1fr;
  }

  .auth-context {
    min-height: 390px;
    padding: 30px;
  }

  .auth-copy {
    margin: 45px 0;
  }

  .auth-copy h1 {
    max-width: 650px;
    font-size: clamp(34px, 8vw, 52px);
  }

  .auth-principles {
    display: none;
  }

  .auth-stage {
    min-height: 560px;
    padding: 64px 22px 42px;
  }

  .auth-progress {
    top: 25px;
    right: 22px;
    left: 22px;
    justify-content: center;
  }

  .sidebar {
    inset: auto 0 0;
    width: auto;
    height: 66px;
    padding: 7px 10px max(7px, env(safe-area-inset-bottom));
  }

  .brand-lockup--sidebar,
  .sidebar-footer {
    display: none;
  }

  .main-nav {
    display: grid;
    margin: 0;
    gap: 4px;
    grid-template-columns: repeat(4, 1fr);
  }

  .nav-item {
    min-height: 50px;
    justify-items: center;
    padding: 4px;
    border-left: 0;
    border-bottom: 2px solid transparent;
    font-size: 10px;
    gap: 2px;
    grid-template-columns: 1fr;
    text-align: center;
  }

  .nav-item svg {
    width: 18px;
  }

  .nav-item.is-active {
    border-bottom-color: #e9be7b;
  }

  .main-nav:not(.has-admin) {
    grid-template-columns: repeat(3, 1fr);
  }

  .main-content {
    margin-left: 0;
    padding: 0 18px 96px;
  }

  .topbar {
    min-height: 88px;
  }

  .connection-state {
    display: none;
  }

  .view {
    padding-top: 22px;
  }
}

@media (max-width: 640px) {
  h1 {
    font-size: 25px;
  }

  h2 {
    font-size: 20px;
  }

  .auth-context {
    min-height: 330px;
    padding: 24px 20px;
  }

  .auth-copy {
    margin: 38px 0 10px;
  }

  .auth-copy p {
    margin-top: 16px;
    font-size: 13px;
  }

  .auth-stage {
    min-height: auto;
    padding: 58px 14px 34px;
  }

  .auth-progress {
    gap: 6px;
  }

  .auth-progress__line {
    width: 12px;
  }

  .auth-panel {
    padding: 24px 18px;
  }

  .topbar-actions {
    gap: 8px;
  }

  .topbar h1 {
    font-size: 24px;
  }

  .schedule-band {
    align-items: start;
    grid-template-columns: 1fr auto;
  }

  .schedule-band__track {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .dashboard-layout {
    gap: 12px;
  }

  .operation-surface,
  .result-surface,
  .settings-section,
  .admin-surface {
    padding: 20px 17px;
  }

  .section-heading {
    align-items: flex-start;
  }

  .sign-focus {
    padding: 32px 0 28px;
    gap: 18px;
    grid-template-columns: minmax(0, 1fr) 82px;
  }

  .sign-focus__main strong {
    font-size: 28px;
  }

  .meter-ring {
    width: 80px;
    height: 80px;
  }

  .meter-ring span {
    font-size: 20px;
  }

  .operation-actions {
    display: grid;
  }

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

  .detail-grid > div:nth-child(even) {
    padding-left: 0;
    border-left: 0;
  }

  .view-intro {
    align-items: flex-start;
    flex-direction: column;
  }

  .view-intro .button {
    width: 100%;
  }

  .setting-row,
  .danger-actions {
    align-items: flex-start;
    flex-direction: column;
  }

  .danger-actions .button {
    width: 100%;
  }

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

  .admin-layout > *,
  .invite-form > * {
    min-width: 0;
  }

  .metric {
    min-height: 108px;
    padding: 16px;
  }

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

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

  .dialog-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .toast-region {
    right: 14px;
    bottom: 82px;
    width: calc(100vw - 28px);
  }
}

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