:root {
  color-scheme: light;
  --bg: #f8fafc;
  --panel: #ffffff;
  --panel-2: #eef2f7;
  --text: #0f172a;
  --muted: #64748b;
  --line: #dbe3ee;
  --accent: #0f766e;
  --accent-2: #1d4ed8;
  --danger: #b91c1c;
  --warn: #b45309;
  --ok: #047857;
  --shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.boot,
.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 14px;
  padding: 20px;
  color: var(--muted);
}

.boot img,
.brand img {
  width: 58px;
  height: 58px;
  border-radius: 14px;
}

.login-card {
  width: min(100%, 420px);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
  box-shadow: var(--shadow);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.brand h1,
.title h1 {
  margin: 0;
  font-size: 20px;
  line-height: 1.15;
  letter-spacing: 0;
}

.brand p,
.title p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.field-row {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.field-row label {
  color: #334155;
  font-size: 12px;
  font-weight: 600;
}

.field,
.searchbox,
.select {
  width: 100%;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  outline: none;
  padding: 0 12px;
}

.field:focus,
.searchbox:focus,
.select:focus {
  border-color: rgba(15, 118, 110, 0.65);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.btn {
  min-height: 40px;
  padding: 0 12px;
  border-radius: 8px;
  background: #e2e8f0;
  color: #0f172a;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-weight: 700;
}

.btn.primary {
  background: var(--accent);
  color: #fff;
}

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

.btn.ghost {
  background: transparent;
  color: var(--muted);
}

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

.full {
  width: 100%;
}

.app-shell {
  min-height: 100vh;
  padding: calc(env(safe-area-inset-top) + 10px) 12px calc(78px + env(safe-area-inset-bottom));
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  margin: -10px -12px 10px;
  padding: calc(env(safe-area-inset-top) + 10px) 12px 10px;
  background: rgba(248, 250, 252, 0.94);
  border-bottom: 1px solid rgba(219, 227, 238, 0.75);
  backdrop-filter: blur(14px);
}

.title-row,
.item-head,
.metric-grid,
.toolbar,
.pager,
.inline-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.account {
  max-width: 132px;
  padding: 7px 9px;
  border-radius: 8px;
  background: #e2e8f0;
  color: #334155;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.toolbar {
  margin-top: 10px;
}

.toolbar .searchbox {
  min-width: 0;
  flex: 1;
}

.toolbar .select {
  width: 106px;
}

.metric-grid {
  align-items: stretch;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.metric {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.metric span,
.meta,
.empty,
.error,
.notice {
  color: var(--muted);
  font-size: 12px;
}

.metric b {
  display: block;
  margin-top: 5px;
  font-size: 18px;
  line-height: 1.1;
}

.list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.item-head {
  justify-content: space-between;
}

.item-title {
  min-width: 0;
  font-size: 14px;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: #e2e8f0;
  color: #334155;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.badge.ok {
  background: #dcfce7;
  color: var(--ok);
}

.badge.warn {
  background: #fef3c7;
  color: var(--warn);
}

.badge.danger {
  background: #fee2e2;
  color: var(--danger);
}

.kv {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  gap: 6px 10px;
  margin-top: 10px;
  font-size: 12px;
}

.kv span:nth-child(odd) {
  color: var(--muted);
}

.kv span:nth-child(even) {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pager {
  justify-content: center;
  margin-top: 12px;
}

.pager .btn {
  min-width: 92px;
}

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.94);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(16px);
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 4px;
}

.nav-btn {
  min-width: 0;
  height: 48px;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  display: grid;
  place-items: center;
  gap: 1px;
  font-size: 10px;
  font-weight: 700;
}

.nav-btn svg {
  width: 19px;
  height: 19px;
}

.nav-btn.active {
  background: #e0f2fe;
  color: #075985;
}

.empty,
.error,
.notice {
  padding: 16px;
  text-align: center;
}

.error {
  color: var(--danger);
}

.inline-actions {
  margin-top: 10px;
  flex-wrap: wrap;
}

@media (min-width: 760px) {
  .app-shell {
    max-width: 760px;
    margin: 0 auto;
  }
}
