:root {
  color: #202124;
  background: #f6f7f9;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  font-synthesis: none;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: #f6f7f9; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .45; }
.hidden { display: none !important; }
.muted { color: #707782; line-height: 1.65; }
.touch { min-height: 44px; }
.primary, .secondary, .text-button, .icon-button, .nav-link, .nav-item { border: 0; }
.primary { border-radius: 12px; padding: 11px 18px; background: #f4b400; color: #241b00; font-weight: 750; }
.secondary { border: 1px solid #d8dde5; border-radius: 12px; padding: 10px 16px; background: #fff; color: #343840; }
.text-button { padding: 6px 0; background: transparent; color: #4d5663; }
.icon-button { width: 44px; height: 44px; border-radius: 12px; background: #f2f3f5; color: #30343a; font-size: 23px; }

.auth-shell { min-height: 100dvh; display: grid; align-items: center; padding: 24px 16px; background: radial-gradient(circle at top right, #fff2bd 0, transparent 35%), #f5b800; }
.auth-card { width: min(100%, 430px); margin: auto; padding: 28px 22px; border-radius: 24px; background: #fff; box-shadow: 0 24px 70px #57400038; }
.brand-mark { display: inline-flex; border-radius: 999px; padding: 7px 12px; background: #fff4c9; color: #8b6500; font-weight: 800; }
.auth-card h1 { margin: 20px 0 4px; font-size: 28px; }
.form-stack { display: grid; gap: 16px; margin-top: 24px; }
label { display: grid; gap: 7px; color: #59616e; font-size: 13px; }
input, select { width: 100%; min-height: 44px; border: 1px solid #d9dde4; border-radius: 11px; padding: 9px 11px; background: #fff; color: #202124; }
input:focus, select:focus { border-color: #d49a00; outline: 3px solid #f9d96b55; }
.error { margin: 14px 0 0; padding: 11px 13px; border-radius: 10px; background: #fff0ee; color: #b42318; }
.totp-qr { display: block; width: min(280px, 100%); aspect-ratio: 1; margin: 18px auto; }
.manual-secret { display: grid; gap: 5px; padding: 12px; border-radius: 10px; background: #f6f7f9; text-align: center; }
.manual-secret code { overflow-wrap: anywhere; font-size: 15px; }

.app-shell { min-height: 100dvh; }
.desktop-sidebar { display: none; }
.mobile-header { position: sticky; top: 0; z-index: 3; display: flex; align-items: center; justify-content: space-between; height: 64px; padding: 8px 16px; background: #fff; border-bottom: 1px solid #e7e9ed; }
.mobile-header div { display: grid; }
.mobile-header strong { font-size: 18px; }
.mobile-header small { color: #7a818c; }
.main { padding: 18px 14px 92px; }
.page-head { margin: 0 0 16px; }
.page-head h1 { margin: 0; font-size: 25px; }
.page-head p { margin: 6px 0 0; color: #737b87; }
.section-title { margin: 26px 2px 12px; font-size: 17px; }

.mobile-nav { position: fixed; right: 0; bottom: 0; left: 0; z-index: 4; display: grid; grid-template-columns: repeat(5, 1fr); padding: 6px max(6px, env(safe-area-inset-right)) calc(6px + env(safe-area-inset-bottom)) max(6px, env(safe-area-inset-left)); background: #fff; border-top: 1px solid #e3e6ea; }
.nav-item { display: grid; place-items: center; gap: 2px; min-height: 52px; border-radius: 11px; background: transparent; color: #6f7782; }
.nav-item span { font-size: 19px; }
.nav-item.active { background: #fff4c9; color: #755500; }
.drawer-backdrop { position: fixed; inset: 0; z-index: 8; display: flex; justify-content: flex-end; background: #0007; }
.drawer { width: min(82vw, 320px); height: 100%; padding: 18px; background: #fff; box-shadow: -16px 0 40px #0002; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; font-size: 20px; }
.drawer .nav-link, .drawer .logout { width: 100%; margin-bottom: 8px; }
.nav-link { min-height: 44px; padding: 10px 12px; border-radius: 11px; background: transparent; color: #424851; text-align: left; }
.nav-link.active { background: #fff1b3; color: #6d4f00; font-weight: 750; }

.status-grid, .metric-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.status-card, .metric-card, .panel, .record-card, .filter-card { border: 1px solid #e3e6eb; border-radius: 16px; background: #fff; box-shadow: 0 5px 18px #1f29370a; }
.status-card { display: grid; gap: 12px; padding: 14px; }
.metric-card { min-width: 0; padding: 15px; }
.metric-card span { color: #717985; font-size: 12px; }
.metric-card strong { display: block; overflow: hidden; margin-top: 8px; font-size: 21px; text-overflow: ellipsis; }
.filter-card { display: grid; grid-template-columns: 1fr; gap: 12px; margin-bottom: 14px; padding: 14px; }
.record-list { display: grid; gap: 10px; }
.record-card { width: 100%; padding: 15px; color: inherit; text-align: left; }
button.record-card:active { transform: translateY(1px); background: #fffdf5; }
.record-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.record-head strong { min-width: 0; overflow: hidden; font-size: 16px; text-overflow: ellipsis; white-space: nowrap; }
.record-meta, .record-foot { display: flex; flex-wrap: wrap; gap: 7px 13px; margin-top: 11px; }
.record-meta { color: #49515d; font-size: 13px; }
.record-foot { color: #7a828e; font-size: 12px; }
.tag { display: inline-flex; max-width: 100%; align-items: center; border-radius: 999px; padding: 3px 8px; background: #eef1f4; color: #555e69; font-size: 11px; white-space: nowrap; }
.tag.active, .tag.normal, .tag.paid, .tag.delivered, .tag.accepted, .tag.ok, .tag.true { background: #e7f7ee; color: #14784b; }
.tag.failed, .tag.expired, .tag.blocked, .tag.disabled, .tag.critical, .tag.false { background: #feeceb; color: #b42318; }
.tag.pending, .tag.throttled, .tag.warning, .tag.queued, .tag.scheduled { background: #fff3cf; color: #855a00; }
.tag.restricted { background: #ffeadb; color: #9d4300; }
.pagination { display: flex; align-items: center; justify-content: center; gap: 16px; margin: 18px 0 4px; }
.empty, .loading { padding: 40px 18px; border-radius: 16px; background: #fff; color: #747c87; text-align: center; }
.loading.full { min-height: 100dvh; display: grid; place-items: center; border-radius: 0; }
.panel { padding: 16px; margin-bottom: 12px; }
.panel h3 { margin: 0 0 13px; }
.panel dl { margin: 0; }
.panel dl div { display: flex; justify-content: space-between; gap: 20px; padding: 8px 0; border-bottom: 1px solid #f0f1f3; }
.panel dl div:last-child { border: 0; }
.panel dt { color: #737b87; }
.panel dd { margin: 0; text-align: right; overflow-wrap: anywhere; }
.compact-list { display: grid; gap: 8px; }
.compact-list > div { display: grid; gap: 7px; padding: 10px; border-radius: 10px; background: #f7f8fa; }
.compact-list span { display: flex; justify-content: space-between; gap: 12px; overflow-wrap: anywhere; }
.compact-list small { color: #77808b; }
details { margin-top: 12px; }
summary { color: #5e6672; cursor: pointer; }
pre { overflow: auto; padding: 12px; border-radius: 10px; background: #f6f7f9; white-space: pre-wrap; word-break: break-word; font-size: 12px; }
.modal { position: fixed; inset: 0; z-index: 10; display: flex; align-items: flex-end; justify-content: center; padding: 10px; background: #0008; }
.modal-card { width: min(100%, 920px); max-height: 92dvh; overflow: auto; padding: 18px; border-radius: 22px 22px 14px 14px; background: #f6f7f9; }
.modal-card > header { position: sticky; top: -18px; z-index: 2; display: flex; align-items: center; justify-content: space-between; margin: -18px -18px 16px; padding: 14px 18px; background: #fff; border-bottom: 1px solid #e3e6ea; }
.modal-card h2 { margin: 0; }

@media (min-width: 720px) {
  .filter-card { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: end; }
  .status-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .metric-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .record-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .modal { align-items: center; padding: 28px; }
  .modal-card { border-radius: 22px; }
}

@media (min-width: 1024px) {
  .app-shell { display: grid; grid-template-columns: 240px minmax(0, 1fr); }
  .desktop-sidebar { position: sticky; top: 0; display: flex; flex-direction: column; height: 100vh; padding: 24px 16px; background: #24272c; color: #fff; }
  .brand { display: grid; gap: 4px; padding: 0 10px 24px; }
  .brand strong { color: #ffd45d; font-size: 22px; }
  .brand span, .admin-summary small { color: #abb1bb; font-size: 12px; }
  .desktop-nav { display: grid; gap: 6px; }
  .desktop-sidebar .nav-link { color: #d9dde3; }
  .desktop-sidebar .nav-link.active { background: #3a3e45; color: #fff; }
  .admin-summary { display: grid; gap: 3px; margin-top: auto; padding: 18px 10px 10px; }
  .desktop-sidebar .logout { width: 100%; border-color: #5f646d; background: transparent; color: #fff; }
  .mobile-header, .mobile-nav { display: none; }
  .main { padding: 30px; }
  .record-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .filter-card { grid-template-columns: repeat(5, minmax(140px, 1fr)); }
}
