:root {
  --page: #f2f5f8;
  --page-soft: #f7f9fc;
  --surface: #ffffff;
  --surface-strong: #fbfcfe;
  --ink: #142033;
  --ink-soft: #334155;
  --muted: #66758a;
  --muted-soft: #93a1b3;
  --line: #dce3ec;
  --line-soft: #edf1f6;
  --sidebar: #0f1724;
  --sidebar-panel: #162235;
  --sidebar-hover: #1d2b41;
  --ember: #d94d2b;
  --ember-dark: #b93b20;
  --amber: #e99a2c;
  --blue: #2563eb;
  --green: #0f8b6f;
  --teal: #138b9f;
  --danger: #c9342d;
  --radius: 8px;
  --shadow: 0 18px 42px rgba(20, 32, 51, 0.11);
  --shadow-soft: 0 8px 20px rgba(20, 32, 51, 0.07);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--page);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: var(--page);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.hidden {
  display: none !important;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  color: #fff;
  background: rgba(217, 77, 43, 0.9);
  font-size: 12px;
  font-weight: 750;
}

.brand-mark {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 38px;
  border-radius: 8px;
  color: #fff;
  background: var(--ember);
  font-weight: 800;
  box-shadow: inset 0 -10px 18px rgba(92, 20, 10, 0.16);
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 34px 20px;
  background:
    linear-gradient(135deg, rgba(15, 23, 36, 0.98), rgba(18, 31, 47, 0.98)),
    var(--sidebar);
}

.login-shell {
  width: min(1120px, 100%);
  min-height: 610px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 430px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.34);
  background: #101827;
}

.login-brief {
  position: relative;
  display: grid;
  align-content: space-between;
  gap: 32px;
  padding: 42px;
  color: #e5edf7;
  background:
    linear-gradient(90deg, rgba(217, 77, 43, 0.18), rgba(217, 77, 43, 0)),
    linear-gradient(180deg, #101827, #121f2f);
}

.login-brief::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.88), transparent);
}

.login-brand,
.brand {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 12px;
}

.login-brand strong,
.brand strong {
  display: block;
  color: #fff;
  font-size: 18px;
  line-height: 24px;
}

.login-brand span:not(.brand-mark),
.brand span:not(.brand-mark) {
  display: block;
  color: #9fb0c5;
  font-size: 12px;
  line-height: 18px;
}

.brief-copy {
  position: relative;
  z-index: 1;
  max-width: 620px;
}

.brief-copy h1 {
  margin: 18px 0 14px;
  max-width: 620px;
  color: #fff;
  font-size: 42px;
  line-height: 52px;
  font-weight: 850;
}

.brief-copy p {
  max-width: 560px;
  margin: 0;
  color: #b6c4d7;
  font-size: 15px;
  line-height: 26px;
}

.signal-board {
  position: relative;
  z-index: 1;
  width: min(520px, 100%);
  display: grid;
  gap: 10px;
}

.signal-line {
  min-height: 52px;
  display: grid;
  grid-template-columns: 10px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}

.signal-line span {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--amber);
}

.signal-line.active span {
  background: #2dd4bf;
  box-shadow: 0 0 0 4px rgba(45, 212, 191, 0.14);
}

.signal-line strong {
  color: #fff;
  font-size: 14px;
}

.signal-line em {
  color: #b6c4d7;
  font-style: normal;
  font-size: 13px;
}

.login-card {
  display: grid;
  align-content: center;
  padding: 42px;
  background: #fff;
}

.login-card-head {
  margin-bottom: 28px;
}

.login-card-head .eyebrow {
  background: rgba(217, 77, 43, 0.12);
  color: var(--ember-dark);
}

.login-card h2 {
  margin: 16px 0 8px;
  color: var(--ink);
  font-size: 28px;
  line-height: 36px;
}

.login-card p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.login-card label,
.field {
  display: grid;
  gap: 7px;
}

.login-card label {
  margin-bottom: 15px;
}

.login-card label span,
.field span {
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 650;
  line-height: 18px;
}

input,
select,
textarea {
  width: 100%;
  min-height: 40px;
  padding: 8px 11px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  color: var(--ink);
  background: #fff;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

input::placeholder,
textarea::placeholder {
  color: #99a7ba;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(217, 77, 43, 0.72);
  box-shadow: 0 0 0 3px rgba(217, 77, 43, 0.13);
}

textarea {
  min-height: 82px;
  resize: vertical;
}

.login-card button,
.primary-button {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 16px;
  border: 1px solid var(--ember);
  border-radius: 6px;
  color: #fff;
  background: var(--ember);
  font-weight: 750;
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.login-card button {
  width: 100%;
  margin-top: 6px;
}

.login-card button:hover,
.primary-button:hover {
  border-color: var(--ember-dark);
  background: var(--ember-dark);
  box-shadow: 0 8px 18px rgba(217, 77, 43, 0.22);
}

.login-card button:active,
.primary-button:active,
.ghost-button:active,
.danger-button:active,
.small-button:active {
  transform: translateY(1px);
}

.form-message {
  min-height: 20px;
  margin: 14px 0 0;
  color: var(--danger);
  font-size: 13px;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: 16px;
  padding: 18px 14px;
  color: #d7e1ee;
  background: var(--sidebar);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.brand {
  min-height: 56px;
  padding: 4px 4px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.09);
}

.sidebar-status {
  min-height: 64px;
  display: grid;
  grid-template-columns: 12px 1fr;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: var(--radius);
  background: var(--sidebar-panel);
}

.status-light {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #2dd4bf;
  box-shadow: 0 0 0 4px rgba(45, 212, 191, 0.13);
}

.sidebar-status strong,
.sidebar-foot strong {
  display: block;
  color: #fff;
  font-size: 13px;
  line-height: 18px;
}

.sidebar-status span:not(.status-light),
.sidebar-foot span {
  display: block;
  color: #9fb0c5;
  font-size: 12px;
  line-height: 18px;
}

#nav {
  display: grid;
  align-content: start;
  gap: 6px;
}

.nav-button {
  position: relative;
  width: 100%;
  min-height: 58px;
  display: grid;
  grid-template-columns: 34px 1fr;
  align-items: center;
  gap: 10px;
  padding: 0 10px;
  text-align: left;
  color: #c8d3e2;
  background: transparent;
  border: 0;
  border-radius: 8px;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.nav-icon {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 8px;
  color: #cbd5e1;
  background: rgba(255, 255, 255, 0.04);
  font-size: 13px;
  font-weight: 750;
}

.nav-copy {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.nav-copy strong {
  color: inherit;
  font-size: 14px;
  line-height: 19px;
}

.nav-copy em {
  color: #8ea0b8;
  font-style: normal;
  font-size: 12px;
  line-height: 17px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-button.active,
.nav-button:hover {
  color: #fff;
  background: var(--sidebar-hover);
}

.nav-button.active .nav-icon {
  color: #fff;
  border-color: rgba(217, 77, 43, 0.48);
  background: var(--ember);
}

.sidebar-foot {
  padding: 13px 12px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.045);
}

.main {
  min-width: 0;
}

.topbar {
  height: 78px;
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 0 30px;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}

.page-heading h2 {
  margin: 0;
  color: var(--ink);
  font-size: 22px;
  line-height: 28px;
  font-weight: 800;
}

.page-heading p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
}

.top-clock,
.admin-pill {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-soft);
  background: var(--surface-strong);
  font-size: 13px;
}

.ghost-button,
.danger-button,
.small-button {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  color: var(--ink-soft);
  background: #fff;
  font-weight: 650;
  transition: border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.ghost-button:hover,
.small-button:hover {
  border-color: #a7b5c9;
  background: #f8fafc;
}

.danger-button {
  color: var(--danger);
  border-color: #f0b9b5;
  background: #fff7f6;
}

.danger-button:hover {
  color: #fff;
  border-color: var(--danger);
  background: var(--danger);
}

.content {
  width: min(1500px, 100%);
  margin: 0 auto;
  padding: 24px 30px 50px;
}

.overview-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 22px;
  align-items: stretch;
  margin-bottom: 18px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(90deg, rgba(217, 77, 43, 0.08), rgba(19, 139, 159, 0.06)),
    #fff;
  box-shadow: var(--shadow-soft);
}

.overview-copy h3 {
  margin: 14px 0 8px;
  color: var(--ink);
  font-size: 25px;
  line-height: 34px;
}

.overview-copy p {
  max-width: 760px;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 24px;
}

.overview-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 18px;
}

.health-card {
  display: grid;
  align-content: center;
  gap: 7px;
  padding: 18px;
  border-radius: var(--radius);
  color: #fff;
  background: #1d2b41;
}

.health-card.success {
  background: #0f766e;
}

.health-card.warning {
  background: #b45309;
}

.health-card span {
  color: rgba(255, 255, 255, 0.76);
  font-size: 12px;
}

.health-card strong {
  font-size: 28px;
  line-height: 34px;
}

.health-card em {
  color: rgba(255, 255, 255, 0.82);
  font-style: normal;
  font-size: 13px;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(188px, 1fr));
  gap: 14px;
}

.metric-card,
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}

.metric-card {
  min-height: 124px;
  position: relative;
  overflow: hidden;
  padding: 18px;
}

.metric-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--blue);
}

.metric-card.tone-green::before {
  background: var(--green);
}

.metric-card.tone-orange::before {
  background: var(--amber);
}

.metric-card.tone-teal::before {
  background: var(--teal);
}

.metric-card.tone-red::before {
  background: var(--danger);
}

.metric-card.tone-gray::before {
  background: #94a3b8;
}

.metric-card span {
  color: var(--muted);
  font-size: 13px;
}

.metric-card strong {
  display: block;
  margin-top: 10px;
  color: var(--ink);
  font-size: 27px;
  line-height: 34px;
  font-weight: 850;
}

.metric-card em {
  display: block;
  margin-top: 8px;
  color: var(--muted-soft);
  font-style: normal;
  font-size: 12px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.panel {
  overflow: hidden;
}

.panel-head {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-strong);
}

.panel-head strong {
  display: block;
  color: var(--ink);
  font-size: 15px;
  line-height: 20px;
}

.panel-head span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 17px;
}

.panel-subhead {
  min-height: 44px;
  display: flex;
  align-items: center;
  padding: 0 18px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  color: var(--ink-soft);
  background: #f8fafc;
  font-size: 13px;
  font-weight: 750;
}

.insight-list {
  display: grid;
  gap: 1px;
  background: var(--line-soft);
}

.insight-list div {
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 18px;
  background: #fff;
}

.insight-list span {
  color: var(--muted);
  font-size: 13px;
}

.insight-list strong {
  color: var(--ink);
  font-size: 15px;
}

.toolbar,
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
  padding: 16px 18px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.filter-bar {
  background: #f8fafc;
}

.form-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.toolbar-actions {
  display: flex;
  align-self: end;
  align-items: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  min-height: 40px;
}

.toolbar-actions .primary-button,
.toolbar-actions .ghost-button,
.toolbar-actions .danger-button,
.toolbar-actions .small-button {
  min-height: 40px;
}

.table-wrap {
  width: 100%;
  overflow: auto;
  background: #fff;
}

table {
  width: 100%;
  min-width: 960px;
  border-collapse: separate;
  border-spacing: 0;
}

th,
td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line-soft);
  text-align: left;
  vertical-align: top;
  font-size: 13px;
  line-height: 20px;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: #52627a;
  background: #f8fafc;
  font-weight: 800;
}

tbody tr {
  transition: background-color 0.12s ease;
}

tbody tr:hover {
  background: #fbfdff;
}

.table-title {
  max-width: 430px;
  color: #111827;
  font-weight: 750;
}

.muted {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  word-break: break-all;
}

.status {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 9px;
  border-radius: 999px;
  color: #0f766e;
  background: #e7f7f2;
  font-size: 12px;
  font-weight: 750;
}

.status::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: currentColor;
}

.status.off {
  color: #64748b;
  background: #eef2f6;
}

.status.error {
  color: var(--danger);
  background: #fee2e2;
}

.row-actions {
  min-width: 174px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.pager {
  min-height: 58px;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  color: var(--muted);
  background: #fff;
  border-top: 1px solid var(--line);
  font-size: 13px;
}

.empty-state {
  min-height: 190px;
  display: grid;
  place-items: center;
  padding: 42px 16px;
  color: var(--muted);
  background: #fff;
  text-align: center;
}

.loading-state {
  color: var(--ink-soft);
}

@media (max-width: 1100px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    grid-template-rows: auto;
  }

  #nav {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .sidebar-foot {
    display: none;
  }
}

@media (max-width: 940px) {
  .login-shell {
    grid-template-columns: 1fr;
  }

  .login-brief {
    min-height: 430px;
  }

  .brief-copy h1 {
    font-size: 32px;
    line-height: 42px;
  }

  .overview-panel,
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .login-page {
    padding: 16px;
  }

  .login-brief,
  .login-card {
    padding: 26px;
  }

  .topbar {
    position: static;
    height: auto;
    align-items: flex-start;
    flex-direction: column;
    padding: 18px;
  }

  .top-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .content {
    padding: 18px;
  }

  #nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .toolbar,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .pager {
    justify-content: center;
    flex-wrap: wrap;
  }
}

@media (max-width: 500px) {
  #nav {
    grid-template-columns: 1fr;
  }

  .signal-line {
    grid-template-columns: 10px 1fr;
  }

  .signal-line em {
    grid-column: 2;
  }

  .overview-panel {
    padding: 18px;
  }
}
