:root {
  --bg: #f4f9ff;
  --white: #ffffff;
  --text: #14233b;
  --muted: #66758a;
  --line: #dce9f7;
  --blue: #2176ff;
  --blue-soft: #eaf3ff;
  --green: #19b86a;
  --green-soft: #e9fbf2;
  --orange: #ff9d2e;
  --orange-soft: #fff4e6;
  --red: #e6495f;
  --red-soft: #fff0f2;
  --shadow: 0 18px 45px rgba(28, 72, 120, 0.10);
  --radius: 22px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: var(--bg);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 17px;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font: inherit;
}

.admin-shell {
  width: min(1120px, calc(100% - 28px));
  margin: 0 auto;
  padding: 24px 0 44px;
}

.admin-header {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 22px;
  align-items: end;
  margin-bottom: 22px;
}

.back-link {
  display: inline-flex;
  margin-bottom: 12px;
  color: var(--blue);
  font-weight: 900;
}

.eyebrow {
  display: inline-flex;
  padding: 9px 13px;
  border-radius: 999px;
  color: var(--blue);
  background: var(--blue-soft);
  font-size: 14px;
  font-weight: 900;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin: 14px 0 10px;
  font-size: clamp(38px, 6vw, 68px);
  line-height: 0.98;
  letter-spacing: -2px;
}

h2 {
  margin-bottom: 6px;
  font-size: 30px;
}

p {
  color: var(--muted);
  line-height: 1.6;
}

.auth-box,
.device-card,
.help-card,
.manage-card,
.requests-section,
.request-card,
.empty {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.auth-box {
  display: grid;
  gap: 12px;
  padding: 20px;
}

label {
  display: grid;
  gap: 8px;
  color: #273d5b;
  font-weight: 900;
}

label span {
  font-size: 15px;
}

input {
  width: 100%;
  min-height: 54px;
  padding: 0 15px;
  color: var(--text);
  background: #f9fcff;
  border: 1px solid #cddff1;
  border-radius: 14px;
  outline: none;
}

input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(33, 118, 255, 0.12);
}

#save-token,
.actions button {
  min-height: 52px;
  padding: 0 18px;
  border: 0;
  border-radius: 15px;
  color: #fff;
  background: var(--blue);
  font-weight: 900;
  cursor: pointer;
}

button:disabled {
  opacity: .65;
  cursor: wait;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1.1fr .9fr;
  gap: 18px;
  margin-bottom: 18px;
}

.device-card,
.help-card {
  padding: 22px;
}

.device-card {
  display: grid;
  gap: 10px;
}

.device-card strong,
.help-card strong {
  font-size: 24px;
}

.device-state,
.status {
  display: inline-flex;
  width: fit-content;
  padding: 8px 11px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 900;
}

.device-state.online,
.status.applied {
  color: #0d6940;
  background: var(--green-soft);
}

.device-state.offline,
.status.pending {
  color: #935000;
  background: var(--orange-soft);
}

.status.approved,
.status.processing {
  color: var(--blue);
  background: var(--blue-soft);
}

.status.failed,
.status.rejected {
  color: #b32138;
  background: var(--red-soft);
}

.command-badge {
  display: inline-flex;
  margin-left: 7px;
  padding: 8px 11px;
  border-radius: 999px;
  font-size: 13px;
  color: var(--blue);
  background: var(--blue-soft);
  font-weight: 900;
}

.command-badge.removePublisher {
  color: #b32138;
  background: var(--red-soft);
}

.publisher-pill {
  display: inline-flex;
  margin: 6px 6px 0 0;
  padding: 9px 11px;
  border-radius: 999px;
  color: #31506f;
  background: #f0f6ff;
  font-weight: 900;
}

.publisher-pill.connected {
  color: #0d6940;
  background: var(--green-soft);
}

.publisher-list {
  display: grid;
  gap: 8px;
}

.publisher-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px;
  border-radius: 15px;
  color: #31506f;
  background: #f0f6ff;
  font-weight: 900;
}

.publisher-line.connected {
  color: #0d6940;
  background: var(--green-soft);
}

.publisher-line button {
  min-height: 36px;
  padding: 0 13px;
  border: 0;
  border-radius: 12px;
  color: #fff;
  background: var(--red);
  font-weight: 900;
  cursor: pointer;
}

.help-card {
  display: grid;
  align-content: center;
  gap: 8px;
}

.help-card span {
  color: #29415f;
  font-weight: 900;
}

.help-card small {
  color: var(--muted);
}

.manage-card {
  display: grid;
  grid-template-columns: .72fr 1.28fr;
  gap: 18px;
  align-items: end;
  padding: 22px;
  margin-bottom: 18px;
}

.manual-form {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 12px;
  align-items: end;
}

.manual-form button {
  min-height: 54px;
  padding: 0 22px;
  border: 0;
  border-radius: 15px;
  color: #fff;
  background: var(--green);
  font-weight: 900;
  cursor: pointer;
}

.requests-section {
  padding: 22px;
}

.section-title {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 16px;
}

#last-refresh {
  color: var(--muted);
  font-weight: 900;
}

.request-list {
  display: grid;
  gap: 12px;
}

.empty {
  padding: 22px;
  color: var(--muted);
  font-weight: 900;
}

.request-card {
  padding: 18px;
}

.request-main {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

.request-card h3 {
  margin: 10px 0 6px;
  font-size: 28px;
}

.request-card p,
.request-card small {
  color: var(--muted);
}

.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.actions .approve {
  background: var(--green);
}

.actions .reject {
  background: var(--red);
}

.result {
  margin-top: 10px;
  padding: 12px 13px;
  border-radius: 14px;
  color: #31506f;
  background: #f4f8ff;
  font-weight: 800;
}

.notice {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 30;
  max-width: min(420px, calc(100% - 40px));
  padding: 15px 18px;
  border-radius: 18px;
  color: #fff;
  background: var(--green);
  box-shadow: var(--shadow);
  font-weight: 900;
}

.notice.error {
  background: var(--red);
}

@media (max-width: 860px) {
  .admin-header,
  .dashboard-grid,
  .manage-card,
  .manual-form {
    grid-template-columns: 1fr;
  }

  .request-main,
  .section-title {
    align-items: stretch;
    flex-direction: column;
  }

  .actions button {
    flex: 1;
  }
}
