:root {
  font-family: Inter, "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  color: #17211f;
  background: #eef2f4;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: #eef2f4; }
button, input, textarea { font: inherit; }
button { border: 0; cursor: pointer; }
.hidden { display: none !important; }

.shell { width: min(1440px, 100%); margin: 0 auto; padding: 18px; }
.topbar, .control-row, .notice, .alert, .order-card header, .order-card dl, .items div, .account-list article, .event-list article {
  display: flex;
  align-items: center;
}

.topbar {
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid #dce4e8;
  border-radius: 8px;
  background: #fff;
}
.topbar > div { display: grid; gap: 3px; }
.topbar strong { font-size: 21px; }
.topbar span, .muted, .order-card em, .order-card dt, .event-list span, .account-list small { color: #6b777b; }
.topbar nav { display: flex; gap: 8px; flex-wrap: wrap; }
.topbar button, .account-list button {
  min-height: 38px;
  padding: 0 12px;
  border-radius: 8px;
  color: #23302d;
  background: #eef3f2;
}
.topbar button.active, .primary { color: #fff; background: #078c7f; }

.notice, .alert {
  gap: 10px;
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 8px;
}
.notice { color: #073c37; background: #c9f4ed; }
.alert { color: #6f2f00; background: #ffe4bc; }

.control-row { gap: 10px; margin: 12px 0; flex-wrap: wrap; }
.control-row label {
  min-width: 240px;
  flex: 1;
  display: grid;
  gap: 5px;
  padding: 10px 12px;
  border: 1px solid #d9e1e4;
  border-radius: 8px;
  background: #fff;
}
.control-row span { color: #6b777b; font-size: 12px; }
input, textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid #d9e1e4;
  outline: 0;
  border-radius: 8px;
  padding: 10px 12px;
  background: #fff;
}
.control-row input { border: 0; padding: 0; }

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}
.metrics article, .panel, .order-card {
  border: 1px solid #dce4e8;
  border-radius: 8px;
  background: #fff;
}
.metrics article { padding: 14px; }
.metrics span { color: #6b777b; font-size: 13px; }
.metrics strong { display: block; margin-top: 6px; font-size: 28px; }

.orders-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 12px; }
.order-card { display: grid; gap: 12px; padding: 15px; }
.order-card header { justify-content: space-between; gap: 12px; }
.order-card header > div { min-width: 0; display: grid; gap: 5px; }
.order-card header strong { overflow-wrap: anywhere; font-size: 18px; }
.status, .account-status {
  width: max-content;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
}
.status.pending_accept, .account-status.login_required, .account-status.error { color: #823300; background: #ffe0b3; }
.status.pending_delivery, .account-status.online, .account-status.checking { color: #05645b; background: #c9f4ed; }
.account-status.paused { color: #596167; background: #e6eaed; }
.order-card dl { align-items: stretch; gap: 8px; margin: 0; }
.order-card dl div { flex: 1; min-width: 0; padding: 9px; border-radius: 8px; background: #f5f8f9; }
.order-card dt { font-size: 12px; }
.order-card dd { margin: 4px 0 0; overflow-wrap: anywhere; font-weight: 700; }
.items { display: grid; gap: 7px; }
.items div {
  justify-content: space-between;
  gap: 10px;
  min-height: 38px;
  padding: 8px 10px;
  border-radius: 8px;
  background: #f6f1e9;
}
.items span { min-width: 0; flex: 1; overflow-wrap: anywhere; font-weight: 800; }
.items small, .items p { color: #6f6253; }
.primary {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
  border-radius: 8px;
  font-weight: 900;
}
.empty {
  grid-column: 1 / -1;
  min-height: 260px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  border: 1px dashed #b9c7cc;
  border-radius: 8px;
  background: #fff;
  color: #596167;
}
.empty strong { color: #17211f; font-size: 20px; }

.admin-layout { display: grid; grid-template-columns: 320px 1fr; gap: 12px; }
.panel { display: grid; gap: 10px; align-content: start; padding: 14px; }
.panel.wide { min-width: 0; }
.panel h2 { margin: 0; font-size: 18px; }
.account-list, .event-list { display: grid; gap: 8px; }
.account-list article {
  justify-content: space-between;
  gap: 10px;
  padding: 10px;
  border-radius: 8px;
  background: #f5f8f9;
}
.account-list article > div { min-width: 0; display: grid; gap: 3px; }
.account-list strong, .account-list span, .account-list small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.event-list article { align-items: flex-start; gap: 10px; padding: 9px 0; border-bottom: 1px solid #edf1f3; }
.event-list strong { min-width: 0; overflow-wrap: anywhere; }

.login-dialog {
  width: min(640px, calc(100% - 24px));
  border: 0;
  border-radius: 8px;
  padding: 0;
  color: #17211f;
  box-shadow: 0 24px 70px rgba(18, 31, 35, 0.25);
}
.login-dialog::backdrop { background: rgba(10, 22, 25, 0.45); }
.login-dialog form { display: grid; gap: 14px; padding: 18px; }
.login-dialog header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.login-dialog header div { display: grid; gap: 4px; }
.login-dialog header strong { font-size: 22px; }
.login-dialog header span, .login-dialog label span, .login-dialog p { color: #6b777b; }
.login-dialog header button {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: #eef3f2;
  font-size: 24px;
  line-height: 1;
}
.login-dialog p { margin: 0; line-height: 1.6; }
.login-dialog label { display: grid; gap: 7px; }
.login-dialog textarea {
  min-height: 110px;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 14px;
}
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.dialog-actions button {
  min-height: 40px;
  padding: 0 14px;
  border-radius: 8px;
  background: #eef3f2;
  color: #23302d;
}
.remote-login-link {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  text-decoration: none;
}
.dialog-actions .primary, .remote-login-link { color: #fff; background: #078c7f; }

@media (max-width: 860px) {
  .shell { padding: 10px; }
  .topbar { align-items: flex-start; flex-direction: column; }
  .metrics, .admin-layout { grid-template-columns: 1fr; }
  .orders-grid { grid-template-columns: 1fr; }
  .order-card dl { flex-direction: column; }
}
