:root {
  color: #202124;
  background: #f4f5f7;
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background: #f4f5f7;
}

button,
input,
select { font: inherit; }

button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.56; }

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

.login-view {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 28px;
  background: #eef1f4;
}

.login-panel {
  width: min(100%, 420px);
  padding: 30px;
  border: 1px solid #e0e3e7;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 16px 44px rgba(27, 31, 36, 0.09);
}

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

.brand-mark {
  display: inline-grid;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  place-items: center;
  border-radius: 7px;
  background: #f56600;
  color: #ffffff;
  font-size: 21px;
  font-weight: 700;
}

.brand strong,
.brand span { display: block; }
.brand strong { font-size: 17px; }
.brand div > span { margin-top: 3px; color: #83878d; font-size: 12px; }

.login-form { margin-top: 42px; }
.login-form h1 { margin: 0 0 26px; font-size: 25px; letter-spacing: 0; }

label { display: block; margin-top: 18px; }
label > span { display: block; margin-bottom: 8px; color: #64686e; font-size: 13px; }

input,
select {
  width: 100%;
  height: 42px;
  border: 1px solid #cfd3d8;
  border-radius: 5px;
  outline: none;
  background: #ffffff;
  color: #202124;
  padding: 0 12px;
  transition: border-color 120ms, box-shadow 120ms;
}

input:focus,
select:focus {
  border-color: #f56600;
  box-shadow: 0 0 0 3px rgba(245, 102, 0, 0.12);
}

.form-error {
  min-height: 20px;
  margin: 12px 0 0;
  color: #bd271e;
  font-size: 13px;
  line-height: 1.5;
}

.button {
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 5px;
  padding: 0 15px;
  font-weight: 600;
}

.button--wide { width: 100%; }
.button--primary { background: #f56600; color: #ffffff; }
.button--primary:hover { background: #dd5c00; }
.button--secondary { border-color: #d7dade; background: #ffffff; color: #30343a; }
.button--quiet { min-height: 34px; background: transparent; color: #686d74; padding: 0 8px; }

.app-header {
  position: sticky;
  z-index: 10;
  top: 0;
  border-bottom: 1px solid #e3e5e8;
  background: rgba(255, 255, 255, 0.96);
}

.header-inner {
  display: flex;
  width: min(1180px, calc(100% - 48px));
  min-height: 68px;
  margin: 0 auto;
  align-items: center;
  justify-content: space-between;
}

.brand--compact .brand-mark { width: 36px; height: 36px; flex-basis: 36px; font-size: 18px; }
.brand--compact strong { font-size: 15px; }
.account-menu { display: flex; align-items: center; gap: 12px; }
.admin-phone { color: #5f646b; font-size: 13px; }

.content {
  width: min(1180px, calc(100% - 48px));
  margin: 30px auto 56px;
}

.summary-band {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 1px solid #e1e4e8;
  border-radius: 7px;
  background: #ffffff;
}

.summary-item { min-width: 0; padding: 22px 24px; border-right: 1px solid #e8eaed; }
.summary-item:last-child { border-right: 0; }
.summary-item span { display: block; color: #767b82; font-size: 13px; }
.summary-item strong { display: block; margin-top: 7px; font-size: 27px; letter-spacing: 0; }

.section-tabs {
  display: flex;
  gap: 6px;
  margin-top: 28px;
  border-bottom: 1px solid #dadde1;
}

.tab-button {
  min-width: 110px;
  min-height: 42px;
  border: 0;
  border-bottom: 3px solid transparent;
  background: transparent;
  color: #6d7279;
  font-weight: 600;
}

.tab-button.is-active { border-bottom-color: #f56600; color: #202124; }
.data-section { padding-top: 24px; }

.section-header {
  display: flex;
  min-height: 46px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.section-header h2 { margin: 0; font-size: 20px; letter-spacing: 0; }
.section-count { display: block; margin-top: 4px; color: #858a91; font-size: 12px; }

.table-wrap {
  overflow: hidden;
  margin-top: 17px;
  border: 1px solid #e0e3e7;
  border-radius: 7px;
  background: #ffffff;
}

table { width: 100%; border-collapse: collapse; table-layout: fixed; }
th, td { padding: 15px 18px; border-bottom: 1px solid #eceef0; text-align: left; vertical-align: middle; }
th { background: #f8f9fa; color: #747980; font-size: 12px; font-weight: 600; }
td { color: #3b3f45; font-size: 13px; }
tbody tr:last-child td { border-bottom: 0; }
.actions-column { width: 270px; text-align: right; }
.cell-title { display: block; color: #24272b; font-size: 14px; font-weight: 600; }
.cell-meta { display: block; overflow-wrap: anywhere; margin-top: 4px; color: #8a8f95; font-size: 12px; }

.badge {
  display: inline-flex;
  min-height: 25px;
  align-items: center;
  border-radius: 4px;
  padding: 0 8px;
  background: #edf0f2;
  color: #5c6269;
  font-size: 12px;
}

.badge--success { background: #e8f6ee; color: #197747; }
.badge--warning { background: #fff2df; color: #9b5700; }
.badge--muted { background: #f0f1f2; color: #7b8086; }

.row-actions { display: flex; justify-content: flex-end; gap: 6px; flex-wrap: wrap; }
.action-link { min-height: 30px; border: 0; background: transparent; color: #b94d00; padding: 0 6px; font-size: 12px; }
.action-link--danger { color: #b42318; }
.empty-row { padding: 48px 20px; color: #8a8f95; text-align: center; }

.modal {
  position: fixed;
  z-index: 30;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal-backdrop { position: absolute; inset: 0; border: 0; background: rgba(20, 23, 27, 0.46); }
.modal-panel { position: relative; width: min(100%, 460px); max-height: calc(100vh - 40px); overflow: auto; border-radius: 8px; background: #ffffff; box-shadow: 0 24px 70px rgba(0, 0, 0, 0.2); }
.modal-header { display: flex; min-height: 62px; align-items: center; justify-content: space-between; padding: 0 22px; border-bottom: 1px solid #e5e7ea; }
.modal-header h2 { margin: 0; font-size: 18px; letter-spacing: 0; }
.icon-button { width: 34px; height: 34px; border: 0; background: transparent; color: #6d7279; font-size: 26px; line-height: 1; }
.modal-body { padding: 5px 22px 8px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 22px 22px; }
.modal .form-error { margin-right: 22px; margin-left: 22px; }
.modal-copy { margin: 16px 0 0; padding: 14px; border: 1px solid #e1e4e7; border-radius: 6px; background: #f7f8f9; overflow-wrap: anywhere; font-family: Consolas, monospace; font-size: 12px; line-height: 1.6; }
.binding-code { display: block; margin-top: 18px; color: #202124; font-size: 34px; font-weight: 700; text-align: center; letter-spacing: 0; }
.binding-device { display: block; margin-top: 5px; color: #7b8086; font-size: 13px; text-align: center; }

.toast {
  position: fixed;
  z-index: 50;
  right: 24px;
  bottom: 24px;
  max-width: min(360px, calc(100% - 48px));
  border-radius: 6px;
  background: #25282c;
  color: #ffffff;
  padding: 12px 16px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.2);
  font-size: 13px;
}

@media (max-width: 760px) {
  .login-view { padding: 16px; }
  .login-panel { padding: 24px 20px; box-shadow: none; }
  .header-inner, .content { width: calc(100% - 28px); }
  .brand--compact div > span, .admin-phone { display: none; }
  .content { margin-top: 18px; }
  .summary-band { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .summary-item { padding: 17px; }
  .summary-item:nth-child(2) { border-right: 0; }
  .summary-item:nth-child(-n + 2) { border-bottom: 1px solid #e8eaed; }
  .summary-item strong { font-size: 23px; }
  .section-header { align-items: flex-end; }
  .table-wrap { overflow-x: auto; }
  table { min-width: 700px; }
  th, td { padding: 13px 14px; }
  .modal { padding: 12px; align-items: end; }
  .modal-panel { max-height: calc(100vh - 24px); border-radius: 8px 8px 0 0; }
  .toast { right: 14px; bottom: 14px; max-width: calc(100% - 28px); }
}
