:root {
  --canvas: #f5f1e8;
  --canvas-deep: #ece6da;
  --paper: #fffdfa;
  --paper-soft: rgba(255, 253, 250, .82);
  --ink: #13211e;
  --muted: #6f7a76;
  --line: #ddd8cf;
  --green: #0b8b78;
  --green-deep: #075b50;
  --green-dark: #0b3d37;
  --green-soft: #d9f2ec;
  --orange: #ef6d38;
  --blue: #3079d6;
  --red: #c83f3f;
  --shadow: 0 22px 70px rgba(25, 45, 40, .11);
  --shadow-soft: 0 10px 30px rgba(25, 45, 40, .07);
  --radius-xl: 30px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --sidebar: 258px;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--canvas);
  color-scheme: light;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 82% 5%, rgba(11, 139, 120, .11), transparent 26rem),
    radial-gradient(circle at 12% 78%, rgba(239, 109, 56, .08), transparent 30rem),
    linear-gradient(180deg, #f9f6ef 0%, var(--canvas) 58%, #eee9df 100%);
  font-family: "Avenir Next", "PingFang SC", "Hiragino Sans GB", sans-serif;
  -webkit-font-smoothing: antialiased;
}

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

button,
select {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(11, 139, 120, .22);
  outline-offset: 2px;
}

.hidden {
  display: none !important;
}

.muted {
  color: var(--muted);
  font-size: 13px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--green);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .14em;
}

.brand-mark {
  display: grid;
  width: 46px;
  height: 46px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 15px;
  color: #fff;
  background: linear-gradient(145deg, #10a18b, #076b5d);
  box-shadow: 0 12px 25px rgba(4, 104, 90, .24);
  font-family: "Songti SC", "STSong", serif;
  font-size: 25px;
  font-weight: 800;
}

.brand-mark.small {
  width: 39px;
  height: 39px;
  border-radius: 13px;
  font-size: 21px;
}

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

.brand-lockup strong {
  display: block;
  font-family: "Songti SC", "STSong", serif;
  font-size: 20px;
  letter-spacing: -.02em;
}

.brand-lockup small {
  display: block;
  margin-top: 3px;
  color: rgba(227, 244, 238, .62);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .14em;
}

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  height: 100vh;
  flex-direction: column;
  padding: 28px 18px 22px;
  color: #edf8f4;
  background:
    radial-gradient(circle at 115% 8%, rgba(79, 202, 176, .23), transparent 18rem),
    linear-gradient(170deg, #112d2b 0%, #0c1c20 75%, #111a1d 100%);
  box-shadow: 12px 0 45px rgba(20, 35, 32, .15);
  z-index: 20;
}

.sidebar .brand-lockup {
  padding: 0 10px 30px;
}

.side-nav {
  display: grid;
  gap: 8px;
}

.nav-item {
  display: flex;
  min-height: 52px;
  align-items: center;
  gap: 13px;
  padding: 0 15px;
  border: 0;
  border-radius: 16px;
  color: rgba(232, 246, 241, .72);
  background: transparent;
  font-weight: 700;
  text-align: left;
  transition: color .18s ease, background .18s ease, transform .18s ease;
}

.nav-item:hover {
  color: #fff;
  background: rgba(255, 255, 255, .07);
  transform: translateX(2px);
}

.nav-item.active {
  color: #fff;
  background: linear-gradient(100deg, rgba(18, 162, 139, .38), rgba(255, 255, 255, .06));
  box-shadow: inset 3px 0 #48d3b5;
}

.nav-icon {
  display: inline-grid;
  width: 24px;
  height: 24px;
  place-items: center;
}

.nav-icon svg {
  width: 23px;
  height: 23px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
}

.side-runtime {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-top: auto;
  padding: 15px;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 17px;
  background: rgba(255, 255, 255, .04);
}

.runtime-light {
  width: 10px;
  height: 10px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #e56846;
  box-shadow: 0 0 0 6px rgba(229, 104, 70, .12);
}

.runtime-light.online {
  background: #45d6aa;
  box-shadow: 0 0 0 6px rgba(69, 214, 170, .12);
}

.side-runtime strong,
.side-runtime small {
  display: block;
}

.side-runtime strong {
  font-size: 13px;
}

.side-runtime small {
  margin-top: 3px;
  color: rgba(232, 246, 241, .55);
  font-size: 10px;
}

.side-user {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-top: 10px;
  padding: 12px 15px;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 17px;
  background: rgba(255, 255, 255, .035);
}

.side-user .user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 11px;
  font-size: 14px;
}

.side-user strong,
.side-user small {
  display: block;
}

.side-user strong {
  max-width: 145px;
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.side-user small {
  margin-top: 3px;
  color: rgba(232, 246, 241, .5);
  font-size: 9px;
}

.side-logout {
  width: 100%;
  margin-top: 10px;
  color: rgba(232, 246, 241, .65) !important;
}

.workspace {
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  display: flex;
  min-height: 91px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 34px;
  border-bottom: 1px solid rgba(206, 201, 190, .7);
  background: rgba(249, 246, 239, .82);
  backdrop-filter: blur(20px);
  z-index: 15;
}

.desktop-title h1 {
  margin: 0;
  font-family: "Songti SC", "STSong", serif;
  font-size: 27px;
  line-height: 1;
  letter-spacing: -.03em;
}

.mobile-title {
  display: none;
  align-items: center;
  gap: 10px;
}

.mobile-title strong,
.mobile-title small {
  display: block;
}

.mobile-title strong {
  font-family: "Songti SC", "STSong", serif;
  font-size: 18px;
}

.mobile-title small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.account-filter {
  display: flex;
  min-height: 44px;
  min-width: 200px;
  align-items: center;
  gap: 9px;
  padding: 0 8px 0 13px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, .72);
}

.account-filter span {
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.account-filter select {
  min-width: 0;
  min-height: 44px;
  flex: 1;
  border: 0;
  color: var(--ink);
  background: transparent;
  font-size: 12px;
  font-weight: 750;
  outline: none;
}

.icon-button {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--green-deep);
  background: rgba(255, 255, 255, .72);
}

.icon-button svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.content {
  width: min(1240px, 100%);
  margin: 0 auto;
  padding: 30px 34px 70px;
}

.page {
  display: none;
}

.page.active {
  display: block;
  animation: page-in .24s ease both;
}

@keyframes page-in {
  from { opacity: .2; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.hero-card {
  position: relative;
  display: grid;
  min-height: 330px;
  grid-template-columns: minmax(0, 1.35fr) minmax(240px, .65fr);
  overflow: hidden;
  border-radius: 34px;
  color: #edf9f5;
  background:
    radial-gradient(circle at 93% 10%, rgba(99, 205, 182, .22), transparent 17rem),
    radial-gradient(circle at 76% 118%, rgba(239, 143, 82, .28), transparent 13rem),
    linear-gradient(135deg, #0b8d79 0%, #0c665a 45%, #0c433d 100%);
  box-shadow: 0 28px 80px rgba(5, 92, 79, .2);
}

.hero-card::after {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px);
  background-size: 34px 34px;
  content: "";
  mask-image: linear-gradient(90deg, #000, transparent 72%);
}

.hero-copy {
  position: relative;
  align-self: center;
  padding: 48px 26px 48px 52px;
  z-index: 2;
}

.hero-chip {
  display: inline-flex;
  margin: 0 0 24px;
  padding: 7px 13px;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 999px;
  color: rgba(240, 252, 248, .82);
  background: rgba(255, 255, 255, .09);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .12em;
}

.hero-copy h2 {
  max-width: 680px;
  margin: 0;
  font-family: "Songti SC", "STSong", serif;
  font-size: clamp(35px, 4.6vw, 62px);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -.05em;
}

.hero-copy > p:not(.hero-chip) {
  max-width: 620px;
  margin: 22px 0 0;
  color: rgba(235, 248, 244, .75);
  font-size: 16px;
  line-height: 1.8;
}

.hero-actions {
  display: flex;
  gap: 11px;
  margin-top: 28px;
}

.hero-visual {
  position: relative;
  min-height: 300px;
}

.pulse-ring,
.signal-core {
  position: absolute;
  top: 50%;
  left: 50%;
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

.pulse-ring {
  border: 1px solid rgba(255, 255, 255, .13);
  animation: breathe 4s ease-in-out infinite;
}

.ring-one {
  width: 200px;
  height: 200px;
}

.ring-two {
  width: 310px;
  height: 310px;
  animation-delay: -2s;
}

.signal-core {
  display: grid;
  width: 118px;
  height: 118px;
  place-items: center;
  background: rgba(255, 255, 255, .11);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .16), 0 20px 60px rgba(0, 0, 0, .14);
  backdrop-filter: blur(10px);
}

.signal-core span {
  width: 24px;
  height: 24px;
  border: 7px solid #f4f0df;
  border-radius: 50%;
  box-shadow: 0 0 0 14px rgba(244, 240, 223, .12);
}

@keyframes breathe {
  0%, 100% { opacity: .55; transform: translate(-50%, -50%) scale(.96); }
  50% { opacity: 1; transform: translate(-50%, -50%) scale(1.03); }
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin: 17px 0;
}

.metric-card {
  position: relative;
  min-height: 132px;
  padding: 22px;
  overflow: hidden;
  border: 1px solid rgba(217, 212, 202, .8);
  border-radius: var(--radius-lg);
  background: var(--paper-soft);
  box-shadow: var(--shadow-soft);
}

.metric-card::after {
  position: absolute;
  right: -22px;
  bottom: -28px;
  width: 92px;
  height: 92px;
  border-radius: 50%;
  background: rgba(11, 139, 120, .045);
  content: "";
}

.metric-dot {
  display: block;
  width: 9px;
  height: 9px;
  margin-bottom: 14px;
  border-radius: 50%;
}

.metric-dot.teal { background: var(--green); }
.metric-dot.green { background: #2f8d64; }
.metric-dot.amber { background: var(--orange); }
.metric-dot.blue { background: var(--blue); }

.metric-card strong {
  display: block;
  font-family: "Songti SC", "STSong", serif;
  font-size: 34px;
  line-height: 1;
}

.metric-card p {
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.two-column {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 17px;
  margin-top: 17px;
}

.panel {
  border: 1px solid rgba(217, 212, 202, .84);
  border-radius: var(--radius-xl);
  background: var(--paper-soft);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(16px);
}

.panel:not(form) {
  padding: 26px;
}

form.panel {
  padding: 26px;
}

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

.panel-heading h3,
.page-intro h2,
.manual-delivery h3 {
  margin: 0;
  font-family: "Songti SC", "STSong", serif;
  letter-spacing: -.025em;
}

.panel-heading h3 {
  font-size: 22px;
}

.panel-description {
  min-height: 48px;
  margin: 0 0 22px;
  color: var(--muted);
  line-height: 1.7;
}

.status-pill {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  padding: 0 10px;
  border-radius: 999px;
  color: var(--red);
  background: #fde9e4;
  font-size: 11px;
  font-weight: 800;
}

.status-pill.online {
  color: #08715f;
  background: var(--green-soft);
}

.status-pill.neutral {
  color: var(--muted);
  background: #efede7;
}

.button-row,
.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  padding: 0 18px;
  border: 0;
  border-radius: 14px;
  font-size: 13px;
  font-weight: 800;
  transition: transform .16s ease, box-shadow .16s ease, background .16s ease;
}

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

.button-primary {
  color: #fff;
  background: linear-gradient(135deg, #0e9c85, #087061);
  box-shadow: 0 11px 24px rgba(7, 112, 97, .18);
}

.button-outline {
  border: 1px solid #cfc9bd;
  color: var(--green-deep);
  background: rgba(255, 255, 255, .6);
}

.button-danger-soft {
  border: 1px solid #efd2ca;
  color: #af4337;
  background: #fff1ed;
}

.button-light {
  color: var(--green-deep);
  background: #f4f0df;
}

.button-ghost-light {
  border: 1px solid rgba(255, 255, 255, .28);
  color: #fff;
  background: rgba(255, 255, 255, .07);
}

.button-quiet {
  color: var(--muted);
  background: transparent;
}

.text-button {
  min-height: 44px;
  padding: 0 3px;
  border: 0;
  color: var(--green);
  background: transparent;
  font-size: 12px;
  font-weight: 800;
}

.install-row {
  display: flex;
  gap: 20px;
  margin-top: 20px;
}

.health-list,
.rule-list {
  display: grid;
  gap: 10px;
}

.health-row,
.rule-card {
  border: 1px solid #e4dfd5;
  border-radius: 17px;
  background: rgba(255, 255, 255, .62);
}

.health-row {
  display: flex;
  min-height: 60px;
  align-items: center;
  gap: 12px;
  padding: 10px 13px;
}

.avatar {
  display: grid;
  width: 39px;
  height: 39px;
  flex: 0 0 auto;
  place-items: center;
  overflow: hidden;
  border-radius: 13px;
  color: #fff;
  background: linear-gradient(135deg, #239f87, #155449);
  font-family: "Songti SC", serif;
  font-weight: 800;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.health-row div:nth-child(2) {
  min-width: 0;
  flex: 1;
}

.health-row strong,
.health-row small {
  display: block;
}

.health-row strong {
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.health-row small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}

.health-indicator {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #cf5845;
}

.health-indicator.online {
  background: #21a57d;
}

.log-panel {
  margin-top: 17px;
}

.logs {
  height: 320px;
  margin: 0;
  padding: 18px;
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 20px;
  color: #8debc7;
  background:
    linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px),
    #0d1e20;
  background-size: 100% 27px;
  font-family: "SFMono-Regular", Menlo, monospace;
  font-size: 11px;
  line-height: 1.75;
  white-space: pre-wrap;
  word-break: break-all;
}

.page-intro {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin: 8px 2px 24px;
}

.page-intro h2 {
  font-size: clamp(30px, 4vw, 43px);
}

.page-intro p:not(.eyebrow) {
  max-width: 680px;
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.qr-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 240px;
  align-items: center;
  gap: 30px;
  margin-bottom: 18px;
  background:
    radial-gradient(circle at 90% 15%, rgba(11, 139, 120, .14), transparent 14rem),
    var(--paper);
}

.qr-copy h3 {
  margin: 0;
  font-family: "Songti SC", serif;
  font-size: 27px;
}

.qr-copy > p:not(.eyebrow) {
  max-width: 600px;
  color: var(--muted);
  line-height: 1.7;
}

.inline-message {
  margin-top: 15px;
  padding: 11px 13px;
  border-radius: 13px;
  color: #7f5b15;
  background: #fff5d9;
  font-size: 12px;
  line-height: 1.5;
}

.inline-message.success {
  color: #0b705e;
  background: #def5ee;
}

.inline-message.error {
  color: #a23d35;
  background: #fdeae6;
}

.qr-code-wrap {
  display: grid;
  min-height: 220px;
  place-items: center;
  border: 1px solid #e5dfd4;
  border-radius: 25px;
  background: #fff;
  box-shadow: var(--shadow-soft);
}

.qr-code-wrap img {
  display: block;
  width: 190px;
  max-height: 190px;
  object-fit: contain;
}

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

.account-card {
  position: relative;
  overflow: hidden;
  padding: 22px;
  border: 1px solid rgba(217, 212, 202, .85);
  border-radius: var(--radius-lg);
  background: var(--paper-soft);
  box-shadow: var(--shadow-soft);
}

.account-card::before {
  position: absolute;
  top: 0;
  left: 0;
  width: 5px;
  height: 100%;
  background: #c8c3b9;
  content: "";
}

.account-card.running::before {
  background: var(--green);
}

.account-main {
  display: flex;
  align-items: center;
  gap: 13px;
}

.account-main > div {
  min-width: 0;
}

.account-main h3 {
  overflow: hidden;
  margin: 0;
  font-family: "Songti SC", serif;
  font-size: 20px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-main p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.account-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 18px 0;
}

.mini-pill {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  padding: 0 9px;
  border-radius: 999px;
  color: #53615d;
  background: #efede7;
  font-size: 10px;
  font-weight: 750;
}

.mini-pill.good {
  color: #086b5b;
  background: var(--green-soft);
}

.mini-pill.bad {
  color: #a34437;
  background: #fdeae5;
}

.account-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.account-nickname {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}

.account-nickname input {
  min-width: 0;
  flex: 1;
}

.field {
  display: grid;
  gap: 7px;
  margin-bottom: 17px;
}

.field > span {
  color: #42514c;
  font-size: 12px;
  font-weight: 800;
}

.field small {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
}

.field input,
.field textarea,
.field select,
.account-nickname input {
  width: 100%;
  min-height: 46px;
  padding: 11px 13px;
  border: 1px solid #d8d3c9;
  border-radius: 14px;
  color: var(--ink);
  background: rgba(255, 255, 255, .78);
  outline: none;
  transition: border .16s ease, box-shadow .16s ease;
}

.field textarea {
  resize: vertical;
  line-height: 1.55;
}

.field input:focus,
.field textarea:focus,
.field select:focus,
.account-nickname input:focus {
  border-color: rgba(11, 139, 120, .55);
  box-shadow: 0 0 0 4px rgba(11, 139, 120, .08);
}

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

.span-two {
  grid-column: 1 / -1;
}

.switch-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 11px;
  margin: 4px 0 22px;
}

.switch-stack {
  display: grid;
  gap: 10px;
  margin-bottom: 20px;
}

.switch-row {
  display: flex;
  min-height: 66px;
  align-items: center;
  gap: 11px;
  padding: 11px 13px;
  border: 1px solid #e1dcd2;
  border-radius: 15px;
  background: rgba(255, 255, 255, .5);
}

.switch-row input {
  width: 20px;
  height: 20px;
  accent-color: var(--green);
}

.switch-row span {
  min-width: 0;
}

.switch-row strong,
.switch-row small {
  display: block;
}

.switch-row strong {
  font-size: 12px;
}

.switch-row small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.4;
}

.item-picker-panel {
  margin-bottom: 17px;
}

.item-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  max-height: 420px;
  overflow: auto;
}

.item-card {
  display: flex;
  min-width: 0;
  gap: 10px;
  align-items: center;
  padding: 9px;
  border: 1px solid #e5e0d7;
  border-radius: 15px;
  color: inherit;
  background: #fff;
  text-align: left;
}

.item-card:hover {
  border-color: rgba(11, 139, 120, .45);
}

.item-card img {
  width: 58px;
  height: 58px;
  flex: 0 0 auto;
  border-radius: 12px;
  object-fit: cover;
  background: #eeeae1;
}

.item-card div {
  min-width: 0;
}

.item-card strong,
.item-card small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item-card strong {
  font-size: 11px;
}

.item-card small {
  margin-top: 5px;
  color: var(--muted);
  font-size: 9px;
}

.delivery-layout {
  grid-template-columns: minmax(300px, .8fr) minmax(420px, 1.2fr);
}

.rule-card {
  padding: 15px;
}

.rule-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.rule-card h4 {
  margin: 0;
  font-size: 13px;
}

.rule-card p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
  word-break: break-word;
}

.rule-card .button-row {
  margin-top: 12px;
}

.rule-card .button {
  min-height: 34px;
  padding: 0 11px;
  border-radius: 11px;
  font-size: 10px;
}

.rule-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.keyword-thumb {
  width: 70px;
  height: 70px;
  margin-top: 10px;
  border-radius: 13px;
  object-fit: cover;
  background: #ede9e0;
}

.manual-delivery {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(240px, .8fr) auto;
  align-items: end;
  gap: 16px;
  margin-top: 17px;
}

.manual-delivery p:not(.eyebrow) {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.manual-delivery .field {
  margin: 0;
}

.security-layout {
  display: grid;
  grid-template-columns: minmax(300px, .8fr) minmax(0, 1.2fr);
  gap: 17px;
  margin-top: 17px;
}

.security-card {
  align-self: start;
}

.admin-users {
  min-width: 0;
}

.new-user-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  align-items: end;
  gap: 10px;
  margin-bottom: 18px;
  padding: 15px;
  border: 1px dashed #cec8bc;
  border-radius: 18px;
  background: rgba(255, 255, 255, .42);
}

.new-user-form .field {
  margin: 0;
}

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

.tenant-user-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 13px 14px;
  border: 1px solid #e4dfd5;
  border-radius: 17px;
  background: rgba(255, 255, 255, .62);
}

.tenant-user-main {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 11px;
}

.tenant-user-main > div {
  min-width: 0;
}

.tenant-user-main strong,
.tenant-user-main small {
  display: block;
}

.tenant-user-main strong {
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tenant-user-main small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
}

.tenant-user-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
}

.empty-state {
  display: grid;
  min-height: 160px;
  place-items: center;
  padding: 24px;
  border: 1px dashed #d7d1c6;
  border-radius: 19px;
  color: var(--muted);
  background: rgba(255, 255, 255, .35);
  font-size: 12px;
  text-align: center;
}

.empty-state.compact {
  min-height: 72px;
}

.bottom-nav {
  display: none;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  max-width: min(400px, calc(100vw - 32px));
  padding: 13px 16px;
  border-radius: 14px;
  color: #fff;
  background: #173d37;
  box-shadow: 0 18px 50px rgba(12, 38, 34, .25);
  font-size: 12px;
  line-height: 1.5;
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: opacity .2s ease, transform .2s ease;
  z-index: 100;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast.error {
  background: #8b3c35;
}

/* Login */
.login-body {
  min-height: 100vh;
  background: #efe9dd;
}

.login-shell {
  display: grid;
  min-height: 100vh;
  grid-template-columns: minmax(0, 1.1fr) minmax(420px, .9fr);
}

.login-story {
  position: relative;
  display: flex;
  min-height: 100vh;
  flex-direction: column;
  overflow: hidden;
  padding: 50px 58px;
  color: #edf9f4;
  background:
    radial-gradient(circle at 84% 12%, rgba(95, 211, 185, .24), transparent 24rem),
    radial-gradient(circle at 8% 92%, rgba(239, 124, 66, .18), transparent 28rem),
    linear-gradient(145deg, #0d7566, #0c3e3a 58%, #10282a);
}

.login-orbit {
  position: absolute;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 50%;
}

.orbit-one {
  top: -160px;
  right: -120px;
  width: 530px;
  height: 530px;
}

.orbit-two {
  right: 8%;
  bottom: -280px;
  width: 620px;
  height: 620px;
}

.login-copy {
  position: relative;
  max-width: 760px;
  margin: auto 0;
  z-index: 2;
}

.display-kicker {
  margin: 0 0 22px;
  color: #7ee2c8;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .12em;
}

.login-copy h2 {
  margin: 0;
  font-family: "Songti SC", "STSong", serif;
  font-size: clamp(43px, 5.2vw, 76px);
  line-height: 1.14;
  letter-spacing: -.055em;
}

.login-copy > p:last-child {
  max-width: 600px;
  margin: 28px 0 0;
  color: rgba(235, 249, 244, .68);
  font-size: 16px;
  line-height: 1.8;
}

.login-signal {
  display: flex;
  height: 36px;
  align-items: end;
  gap: 7px;
}

.login-signal span {
  width: 6px;
  border-radius: 999px;
  background: #71d9c0;
  animation: signal 1.8s ease-in-out infinite;
}

.login-signal span:nth-child(1) { height: 11px; }
.login-signal span:nth-child(2) { height: 20px; animation-delay: -.3s; }
.login-signal span:nth-child(3) { height: 29px; animation-delay: -.6s; }
.login-signal span:nth-child(4) { height: 36px; animation-delay: -.9s; }

@keyframes signal {
  0%, 100% { opacity: .4; transform: scaleY(.78); }
  50% { opacity: 1; transform: scaleY(1); }
}

.login-panel {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 40px;
  background:
    radial-gradient(circle at 100% 0, rgba(11, 139, 120, .08), transparent 21rem),
    var(--canvas);
}

.login-card {
  width: min(430px, 100%);
  padding: 42px;
  border: 1px solid rgba(217, 212, 202, .85);
  border-radius: 30px;
  background: rgba(255, 253, 250, .8);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
}

.login-card h2 {
  margin: 0;
  font-family: "Songti SC", "STSong", serif;
  font-size: 38px;
  letter-spacing: -.04em;
}

.login-help {
  margin: 11px 0 28px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.65;
}

.login-button {
  width: 100%;
  min-height: 50px;
}

.login-footnote {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.55;
  text-align: center;
}

.form-alert {
  margin: -8px 0 18px;
  padding: 11px 13px;
  border: 1px solid #f0d0c8;
  border-radius: 13px;
  color: #a44036;
  background: #fff0ec;
  font-size: 11px;
}

.mobile-brand {
  display: none;
  align-items: center;
  gap: 11px;
  margin-bottom: 35px;
}

.mobile-brand strong,
.mobile-brand small {
  display: block;
}

.mobile-brand strong {
  font-family: "Songti SC", serif;
  font-size: 18px;
}

.mobile-brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 9px;
}

@media (max-width: 1050px) {
  :root {
    --sidebar: 220px;
  }

  .content {
    padding-inline: 24px;
  }

  .topbar {
    padding-inline: 24px;
  }

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

  .delivery-layout {
    grid-template-columns: 1fr;
  }

  .security-layout {
    grid-template-columns: 1fr;
  }

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

  .new-user-form .button {
    grid-column: 1 / -1;
  }

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

@media (max-width: 780px) {
  body {
    padding-bottom: calc(84px + env(safe-area-inset-bottom));
  }

  .app-shell {
    display: block;
  }

  .sidebar {
    display: none;
  }

  .topbar {
    min-height: 72px;
    padding: 10px 16px;
  }

  .desktop-title {
    display: none;
  }

  .mobile-title {
    display: flex;
  }

  .account-filter {
    min-width: 0;
    width: 132px;
    padding-left: 9px;
  }

  .account-filter span {
    display: none;
  }

  .content {
    padding: 18px 14px 34px;
  }

  .hero-card {
    min-height: 380px;
    grid-template-columns: 1fr;
  }

  .hero-copy {
    padding: 34px 28px 16px;
  }

  .hero-copy h2 {
    font-size: 38px;
  }

  .hero-copy > p:not(.hero-chip) {
    font-size: 14px;
  }

  .hero-visual {
    min-height: 130px;
  }

  .ring-one {
    width: 130px;
    height: 130px;
  }

  .ring-two {
    width: 210px;
    height: 210px;
  }

  .signal-core {
    width: 82px;
    height: 82px;
  }

  .signal-core span {
    width: 18px;
    height: 18px;
    border-width: 5px;
  }

  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-block: 12px;
  }

  .metric-card {
    min-height: 116px;
    padding: 18px;
    border-radius: 19px;
  }

  .two-column,
  .account-grid {
    grid-template-columns: 1fr;
    gap: 12px;
    margin-top: 12px;
  }

  .panel,
  .panel:not(form),
  form.panel {
    padding: 19px;
    border-radius: 22px;
  }

  .log-panel {
    margin-top: 12px;
  }

  .logs {
    height: 280px;
  }

  .page-intro {
    align-items: flex-start;
    flex-direction: column;
    margin: 5px 2px 18px;
  }

  .page-intro h2 {
    font-size: 34px;
  }

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

  .qr-panel {
    grid-template-columns: 1fr;
  }

  .qr-code-wrap {
    order: -1;
  }

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

  .manual-delivery {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

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

  .new-user-form .button {
    grid-column: auto;
  }

  .tenant-user-row {
    display: flex;
    align-items: stretch;
    flex-direction: column;
  }

  .tenant-user-actions {
    justify-content: flex-start;
  }

  .bottom-nav {
    position: fixed;
    right: 10px;
    bottom: calc(8px + env(safe-area-inset-bottom));
    left: 10px;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    padding: 7px 4px;
    border: 1px solid rgba(215, 209, 198, .88);
    border-radius: 24px;
    background: rgba(255, 253, 250, .93);
    box-shadow: 0 18px 50px rgba(26, 43, 38, .2);
    backdrop-filter: blur(22px);
    z-index: 50;
  }

  .bottom-nav button {
    display: grid;
    min-width: 0;
    min-height: 60px;
    place-items: center;
    gap: 2px;
    padding: 5px 2px;
    border: 0;
    border-radius: 17px;
    color: #727b78;
    background: transparent;
    font-size: 9px;
    font-weight: 750;
  }

  .bottom-nav button.active {
    color: var(--green-deep);
    background: var(--green-soft);
  }

  .bottom-nav .nav-icon {
    width: 25px;
    height: 25px;
  }

  .toast {
    right: 16px;
    bottom: calc(92px + env(safe-area-inset-bottom));
    left: 16px;
    max-width: none;
  }

  .login-shell {
    display: block;
  }

  .login-story {
    display: none;
  }

  .login-panel {
    min-height: 100vh;
    padding: 24px 18px;
  }

  .login-card {
    padding: 30px 24px;
    border-radius: 26px;
  }

  .mobile-brand {
    display: flex;
  }
}

@media (max-width: 390px) {
  .hero-copy {
    padding-inline: 23px;
  }

  .hero-copy h2 {
    font-size: 34px;
  }

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

  .account-filter {
    width: 112px;
  }

  .top-actions {
    gap: 6px;
  }
}

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