:root {
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  color: #1d2530;
  background: #f5f7f8;
  font-synthesis: none;
  --green: #07965f;
  --green-dark: #06794f;
  --line: #dfe4e8;
  --muted: #6f7883;
  --yellow: #e9a20c;
  --red: #e24a4a;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { min-width: 320px; min-height: 100%; margin: 0; }
body { min-height: 100vh; background: #f5f7f8; }
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .5; }

.login-view { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: #f5f7f8; }
.login-panel { width: min(420px, 100%); padding: 36px; border: 1px solid var(--line); border-radius: 12px; background: #fff; box-shadow: 0 22px 60px rgba(25, 39, 52, .1); }
.brand-mark { width: 44px; height: 44px; display: grid; place-items: center; margin-bottom: 22px; border-radius: 11px; color: #fff; background: var(--green); font-size: 20px; font-weight: 700; }
.login-panel h1 { margin: 0; font-size: 27px; letter-spacing: -.5px; }
.login-panel > p { margin: 9px 0 27px; color: var(--muted); font-size: 13px; }
.login-panel label span { display: block; margin-bottom: 8px; color: #3f4852; font-size: 13px; font-weight: 600; }
.login-panel input { width: 100%; height: 46px; padding: 0 13px; border: 1px solid #ced5db; border-radius: 7px; outline: 0; }
.login-panel input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(7,150,95,.1); }
.primary-button { width: 100%; height: 46px; margin-top: 16px; border: 0; border-radius: 7px; color: #fff; background: var(--green); font-size: 14px; font-weight: 700; }
.primary-button:hover { background: var(--green-dark); }
.form-message { min-height: 20px; margin-top: 12px; color: var(--red); font-size: 12px; text-align: center; }

.dashboard { min-height: 100vh; }
.topbar { height: 68px; display: flex; align-items: center; justify-content: space-between; padding: 0 42px; border-bottom: 1px solid var(--line); background: #fff; }
.topbar h1 { margin: 0; font-size: 24px; letter-spacing: -.5px; }
.topbar-actions { display: flex; align-items: center; gap: 28px; }
.server-status { display: flex; align-items: center; gap: 8px; color: #46515d; font-size: 13px; }
.server-status i { width: 9px; height: 9px; border-radius: 50%; background: var(--green); }
.text-button { padding: 7px 0 7px 24px; border: 0; border-left: 1px solid var(--line); color: #4c5661; background: transparent; font-size: 13px; }
.text-button:hover { color: #111820; }

.content { width: min(1240px, calc(100% - 48px)); margin: 28px auto 50px; }
.section-block { margin-bottom: 18px; padding: 22px; border: 1px solid var(--line); border-radius: 11px; background: #fff; }
.section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 18px; }
.section-heading h2 { margin: 0; font-size: 20px; letter-spacing: -.3px; }
.section-heading p { margin: 6px 0 0; color: var(--muted); font-size: 12px; }
.section-heading > span { color: var(--muted); font-size: 12px; }
.refresh-button { min-width: 68px; height: 34px; border: 1px solid #ccd3d9; border-radius: 6px; color: #4c5660; background: #fff; font-size: 12px; }
.refresh-button:hover { border-color: var(--green); color: var(--green); }

.request-list { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.request-row { min-height: 70px; display: grid; grid-template-columns: minmax(220px, 1.4fr) minmax(180px, .8fr) 130px 180px; align-items: center; gap: 18px; padding: 11px 16px; }
.request-row + .request-row { border-top: 1px solid var(--line); }
.device-name { min-width: 0; }
.device-name strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.device-name small { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; }
.time-text { color: #48515b; font-size: 12px; }
.status { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 600; }
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.status.pending { color: var(--yellow); }
.status.approved, .status.enabled { color: var(--green); }
.status.rejected, .status.disabled { color: var(--red); }
.row-actions { display: flex; justify-content: flex-end; gap: 9px; }
.row-actions button, .device-action { min-width: 70px; height: 34px; padding: 0 12px; border: 1px solid #ccd3d9; border-radius: 6px; color: #3f4953; background: #fff; font-size: 12px; font-weight: 600; }
.row-actions .approve { color: #fff; border-color: var(--green); background: var(--green); }
.row-actions .approve:hover { background: var(--green-dark); }
.row-actions .reject:hover, .device-action.disable:hover { border-color: var(--red); color: var(--red); }
.device-action.enable { border-color: #8bcfb0; color: var(--green); }

.device-table-wrap { border: 1px solid var(--line); border-radius: 8px; overflow-x: auto; }
.device-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.device-table th { height: 43px; padding: 0 16px; color: #5d6670; background: #fafbfc; font-size: 11px; font-weight: 600; text-align: left; }
.device-table td { height: 51px; padding: 8px 16px; border-top: 1px solid var(--line); color: #313a43; font-size: 12px; }
.device-table th:nth-child(1) { width: 25%; }
.device-table th:nth-child(2) { width: 16%; }
.device-table th:nth-child(3), .device-table th:nth-child(4) { width: 22%; }
.device-table th:last-child { width: 15%; }
.empty-state { min-height: 78px; display: grid; place-items: center; border: 1px dashed #cad2d9; border-radius: 8px; color: #818a94; background: #fbfcfd; font-size: 13px; }
.request-list:empty { display: none; }
.device-table-wrap .empty-state { border: 0; border-radius: 0; }

.toast { position: fixed; right: 24px; top: 84px; z-index: 20; max-width: 380px; padding: 12px 15px; border: 1px solid #a9d9c3; border-radius: 7px; color: #166842; background: #fff; box-shadow: 0 12px 36px rgba(30,42,55,.14); font-size: 12px; }
.toast.error { color: #9a3131; border-color: #edb9b9; }

@media (max-width: 760px) {
  .topbar { height: auto; min-height: 68px; padding: 14px 18px; }
  .topbar h1 { font-size: 20px; }
  .server-status { display: none; }
  .content { width: calc(100% - 24px); margin-top: 14px; }
  .section-block { padding: 16px; }
  .request-row { grid-template-columns: minmax(0, 1fr) auto; gap: 9px; }
  .request-row .time-text { grid-column: 1; }
  .request-row .status { grid-column: 2; grid-row: 1; }
  .request-row .row-actions { grid-column: 1 / -1; justify-content: flex-start; }
  .device-table { min-width: 780px; }
}
