:root {
  --bg: #f3f5f9;
  --panel: #ffffff;
  --panel-soft: #f8fafc;
  --line: #e2e8f0;
  --ink: #1f2937;
  --muted: #64748b;
  --nav: #111827;
  --nav-soft: #1f2937;
  --brand: #2563eb;
  --brand-soft: #dbeafe;
  --green: #16a34a;
  --yellow: #d97706;
  --red: #dc2626;
  --gray: #64748b;
  --shadow: 0 10px 28px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "PingFang SC", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--ink);
}

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

.hidden {
  display: none !important;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-panel {
  width: min(460px, 100%);
  padding: 36px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.login-kicker,
.panel-kicker,
.topbar-kicker,
.brand-kicker {
  margin: 0 0 8px;
  font-size: 12px;
  letter-spacing: 0.12em;
  color: var(--muted);
  text-transform: uppercase;
}

.login-panel h1,
.brand-block h2,
.topbar h1,
.panel h3 {
  margin: 0;
}

.login-copy,
.brand-copy,
.admin-role,
.topbar-copy {
  color: var(--muted);
}

.login-form,
.config-form,
.detail-form {
  display: grid;
  gap: 14px;
}

.login-form {
  margin-top: 24px;
}

.field {
  display: grid;
  gap: 8px;
}

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

.field input,
.field textarea,
.table-search,
.table-select {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  outline: none;
}

.field textarea {
  resize: vertical;
}

.primary-button,
.ghost-button,
.nav-item,
.toolbar-button,
.table-action,
.filter-chip {
  border: 0;
  cursor: pointer;
}

.primary-button {
  padding: 12px 16px;
  border-radius: 10px;
  background: var(--brand);
  color: #fff;
}

.ghost-button {
  padding: 10px 14px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

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

.sidebar {
  display: flex;
  flex-direction: column;
  padding: 18px;
  background: linear-gradient(180deg, var(--nav), var(--nav-soft));
  color: #fff;
}

.brand-block {
  padding: 8px 8px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-nav {
  display: grid;
  gap: 6px;
  margin-top: 18px;
}

.nav-item {
  padding: 11px 12px;
  border-radius: 10px;
  background: transparent;
  text-align: left;
  color: #cbd5e1;
}

.nav-item-active,
.nav-item:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.sidebar-bottom {
  margin-top: auto;
  display: grid;
  gap: 14px;
}

.admin-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
}

.admin-avatar {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, #60a5fa, #2563eb);
  color: #fff;
  font-weight: 700;
}

.admin-name {
  margin: 0 0 4px;
}

.main-panel {
  padding: 22px;
}

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

.topbar-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.summary-pill {
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  font-size: 13px;
}

.summary-pill-warn {
  color: var(--yellow);
  background: #fff7ed;
}

.panel-grid {
  display: grid;
  gap: 16px;
}

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

.panel-grid-services {
  grid-template-columns: minmax(0, 1.3fr) minmax(360px, 0.9fr);
}

.panel {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.inline-tools,
.toolbar-row,
.action-row,
.inline-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.toolbar-row {
  margin-bottom: 12px;
}

.toolbar-button {
  padding: 9px 12px;
  border-radius: 10px;
  background: #eef2ff;
  color: #3730a3;
}

.toolbar-button-danger,
.table-action-danger {
  background: #fee2e2;
  color: #991b1b;
}

.filter-chip {
  padding: 8px 12px;
  border-radius: 999px;
  background: #f1f5f9;
  color: var(--muted);
}

.filter-chip-active {
  background: var(--brand-soft);
  color: var(--brand);
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 880px;
  background: #fff;
}

.data-table th,
.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 14px;
  vertical-align: middle;
}

.data-table th {
  background: var(--panel-soft);
  color: var(--muted);
  font-weight: 600;
  white-space: nowrap;
}

.data-table tr:last-child td {
  border-bottom: 0;
}

.table-row-active td {
  background: #eff6ff;
}

.status-tag {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  white-space: nowrap;
}

.status-success {
  background: #dcfce7;
  color: #166534;
}

.status-danger {
  background: #fee2e2;
  color: #991b1b;
}

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

.status-muted {
  background: #e2e8f0;
  color: #475569;
}

.table-action {
  padding: 6px 10px;
  border-radius: 8px;
  background: #e0f2fe;
  color: #075985;
}

.muted-text {
  color: var(--muted);
  font-size: 13px;
}

.mono-cell {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

@media (max-width: 1200px) {
  .panel-grid-2,
  .panel-grid-services,
  .form-grid {
    grid-template-columns: 1fr;
  }
}

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

  .sidebar {
    gap: 16px;
  }

  .main-panel {
    padding: 16px;
  }

  .topbar {
    flex-direction: column;
  }
}
