:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --ink: #1e293b;
  --muted: #64748b;
  --line: #dbe3ef;
  --blue: #2563eb;
  --green: #059669;
  --red: #dc2626;
  --amber: #d97706;
  --sidebar: #0f172a;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.5 Arial, "Microsoft YaHei", sans-serif;
}

.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #eef4ff;
}

.admin-login {
  background: #f7f3ee;
}

.login-card {
  width: min(420px, 100%);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 28px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
}

.login-brand {
  width: fit-content;
  color: #fff;
  background: var(--blue);
  border-radius: 6px;
  padding: 6px 10px;
  font-weight: 700;
  margin-bottom: 14px;
}

.login-card h1 {
  margin-bottom: 8px;
}

.login-card p {
  color: var(--muted);
  margin-bottom: 18px;
}

.login-result {
  min-height: 22px;
  color: var(--red);
  margin-top: 10px;
}

.text-link {
  display: inline-block;
  color: var(--blue);
  text-decoration: none;
  margin-top: 12px;
}

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

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 236px 1fr;
}

.sidebar {
  background: var(--sidebar);
  color: #fff;
  padding: 22px 16px;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 28px;
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: #38bdf8;
  display: grid;
  place-items: center;
  font-weight: 700;
}

.brand span {
  display: block;
  color: #a8b3c7;
  font-size: 12px;
  margin-top: 2px;
}

nav {
  display: grid;
  gap: 8px;
}

.nav-button {
  border: 0;
  color: #cbd5e1;
  background: transparent;
  text-align: left;
  padding: 10px 12px;
  border-radius: 6px;
  cursor: pointer;
}

.nav-button.active,
.nav-button:hover {
  color: #fff;
  background: #1d4ed8;
}

main {
  padding: 24px;
  overflow: auto;
}

.single-shell {
  max-width: 1180px;
  margin: 0 auto;
}

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

.topbar-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 24px;
}

.topbar p,
.panel-title span,
.empty-state {
  color: var(--muted);
}

.status-pill {
  background: #dcfce7;
  color: #166534;
  padding: 8px 12px;
  border-radius: 999px;
  white-space: nowrap;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.section-grid {
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(420px, 1fr);
  gap: 18px;
  align-items: start;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.wide-panel {
  margin-top: 18px;
}

.no-margin {
  margin-top: 0;
}

.panel-title {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: baseline;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
  margin-bottom: 16px;
}

.panel-title h2 {
  font-size: 18px;
}

label {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
  color: #334155;
}

.field-group {
  margin-bottom: 12px;
}

.field-label {
  color: #334155;
  margin-bottom: 6px;
}

.checkbox-grid {
  display: grid;
  gap: 8px;
}

.tier-group {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}

.tier-group-title {
  display: grid;
  gap: 3px;
}

.tier-group-title span {
  color: var(--muted);
  font-size: 12px;
}

.checkbox-item {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 9px 10px;
  background: #fff;
}

.checkbox-item input {
  width: auto;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 9px 10px;
  background: #fff;
  color: var(--ink);
}

textarea {
  resize: vertical;
}

.primary-button {
  width: 100%;
  border: 0;
  border-radius: 6px;
  padding: 10px 14px;
  color: #fff;
  background: var(--blue);
  cursor: pointer;
}

.primary-button:hover {
  background: #1d4ed8;
}

.ghost-button,
.sidebar-logout {
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 8px 10px;
  color: var(--ink);
  background: #fff;
  cursor: pointer;
}

.sidebar-logout {
  width: 100%;
  margin-top: 20px;
  color: #cbd5e1;
  border-color: #334155;
  background: transparent;
}

.sidebar-logout:hover {
  color: #fff;
  border-color: #64748b;
}

.result-card,
.activity-card,
.inventory-card,
.log-item {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
  margin-bottom: 10px;
  background: #f8fafc;
}

.result-card strong,
.activity-card strong {
  display: block;
  margin-bottom: 4px;
}

.code {
  color: #0f766e;
  font-weight: 700;
}

.badge {
  display: inline-flex;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  background: #e2e8f0;
  color: #334155;
}

.badge.success {
  background: #dcfce7;
  color: #166534;
}

.badge.warn {
  background: #fef3c7;
  color: #92400e;
}

.badge.fail {
  background: #fee2e2;
  color: #991b1b;
}

.inventory-list {
  display: grid;
  gap: 10px;
}

.inventory-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 860px;
}

th,
td {
  text-align: left;
  border-bottom: 1px solid var(--line);
  padding: 10px 8px;
  vertical-align: top;
}

th {
  color: #475569;
  background: #f8fafc;
  font-weight: 600;
}

.log-list {
  display: grid;
  gap: 10px;
}

.log-item {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.muted {
  color: var(--muted);
}

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

  .sidebar {
    position: static;
  }

  .section-grid,
  .topbar {
    grid-template-columns: 1fr;
    display: grid;
  }
}
