:root {
  --bg: #f4f7fb;
  --panel: #ffffff;
  --ink: #142033;
  --muted: #7b8ca5;
  --line: #e4eaf2;
  --nav: #0f172a;
  --blue: #2563eb;
  --green: #059669;
  --amber: #d97706;
  --red: #dc2626;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
}

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

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px;
  background:
    radial-gradient(circle at top left, rgba(37, 99, 235, 0.14), transparent 34%),
    linear-gradient(135deg, #f8fafc 0%, #e8eef8 100%);
}

.login-card {
  width: min(440px, 100%);
  padding: 36px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(226, 232, 240, 0.9);
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.12);
}

.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  color: #fff;
  background: #0f172a;
  font-weight: 900;
  font-size: 20px;
}

.eyebrow {
  margin: 0 0 8px;
  color: #8a9ab3;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

.login-card h1 {
  margin-top: 18px;
  font-size: 30px;
}

.muted {
  color: var(--muted);
  line-height: 1.65;
}

.login-form {
  margin-top: 28px;
  display: grid;
  gap: 16px;
}

.login-form label {
  display: grid;
  gap: 8px;
  color: #334155;
  font-size: 13px;
  font-weight: 800;
}

.login-form input,
.toolbar-controls input,
.toolbar-controls select,
.modal input,
.modal select,
.modal textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  outline: none;
}

.login-form input {
  height: 48px;
  padding: 0 14px;
}

.login-form input:focus,
.toolbar-controls input:focus,
.toolbar-controls select:focus,
.modal input:focus,
.modal select:focus,
.modal textarea:focus {
  border-color: rgba(37, 99, 235, 0.55);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.08);
}

.login-form button,
.primary-button {
  height: 48px;
  border: 0;
  border-radius: 12px;
  color: #fff;
  background: var(--blue);
  font-weight: 800;
}

.error-text {
  min-height: 18px;
  margin: 0;
  color: var(--red);
  font-size: 13px;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px 18px;
  color: #cbd5e1;
  background: var(--nav);
  display: flex;
  flex-direction: column;
}

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

.sidebar-brand strong,
.sidebar-brand span {
  display: block;
}

.sidebar-brand strong {
  color: #fff;
  font-size: 19px;
}

.sidebar-brand span {
  color: #94a3b8;
  font-size: 12px;
}

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

.nav-item,
.logout-button,
.ghost-button,
.icon-button,
.table-action {
  border: 0;
  border-radius: 12px;
  font-weight: 800;
}

.nav-item {
  height: 46px;
  padding: 0 14px;
  color: #94a3b8;
  background: transparent;
  text-align: left;
}

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

.logout-button {
  margin-top: auto;
  height: 44px;
  color: #cbd5e1;
  background: rgba(255, 255, 255, 0.08);
}

.main {
  padding: 30px 36px 48px;
}

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

.topbar h1 {
  font-size: 30px;
}

.ghost-button {
  height: 40px;
  padding: 0 16px;
  color: #1e293b;
  background: #fff;
  border: 1px solid var(--line);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.summary-card,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.05);
}

.summary-card {
  padding: 20px;
  border-radius: 18px;
}

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

.summary-card strong {
  display: block;
  margin-top: 10px;
  font-size: 30px;
}

.summary-card.warning strong {
  color: var(--amber);
}

.summary-card.danger strong {
  color: var(--red);
}

.panel {
  border-radius: 20px;
  overflow: hidden;
}

.panel-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 22px;
  border-bottom: 1px solid var(--line);
}

.panel-toolbar h2 {
  font-size: 20px;
}

.panel-toolbar p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.toolbar-controls {
  min-width: 430px;
  display: grid;
  grid-template-columns: 1fr 150px;
  gap: 10px;
}

.toolbar-controls input,
.toolbar-controls select {
  height: 42px;
  padding: 0 12px;
}

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

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

th,
td {
  padding: 15px 18px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  color: #64748b;
  background: #f8fafc;
  font-size: 12px;
  font-weight: 900;
}

td {
  font-size: 14px;
}

.user-main {
  display: grid;
  gap: 4px;
}

.user-main strong {
  font-size: 15px;
}

.user-main span {
  color: var(--muted);
  font-size: 12px;
}

.badge {
  display: inline-flex;
  align-items: center;
  height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
}

.badge.active {
  color: #047857;
  background: #d1fae5;
}

.badge.pending {
  color: #b45309;
  background: #fef3c7;
}

.badge.expired,
.badge.disabled {
  color: #b91c1c;
  background: #fee2e2;
}

.data-stack {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  color: #64748b;
  font-size: 12px;
}

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

.table-action {
  height: 32px;
  padding: 0 10px;
  color: #334155;
  background: #f1f5f9;
}

.table-action.primary {
  color: #fff;
  background: var(--blue);
}

.table-action.danger {
  color: #b91c1c;
  background: #fee2e2;
}

.empty-state {
  padding: 42px;
  color: var(--muted);
  text-align: center;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 28px;
  background: rgba(15, 23, 42, 0.48);
}

.modal {
  width: min(760px, 100%);
  max-height: min(760px, 92vh);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 28px 90px rgba(15, 23, 42, 0.28);
}

.modal header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 24px;
  border-bottom: 1px solid var(--line);
}

.icon-button {
  width: 38px;
  height: 38px;
  color: #64748b;
  background: #f1f5f9;
  font-size: 24px;
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
}

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

.field-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f8fafc;
}

.field-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.field-card strong {
  display: block;
  margin-top: 6px;
  word-break: break-word;
}

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

.form-grid label {
  display: grid;
  gap: 8px;
  font-size: 13px;
  font-weight: 800;
}

.form-grid input,
.form-grid select {
  height: 42px;
  padding: 0 12px;
}

.form-grid textarea {
  min-height: 92px;
  padding: 12px;
  resize: vertical;
}

.form-grid .wide {
  grid-column: 1 / -1;
}

.modal-actions {
  margin-top: 18px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

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

  .sidebar {
    position: static;
    height: auto;
  }

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

  .toolbar-controls {
    min-width: 0;
    width: 100%;
  }

  .panel-toolbar {
    align-items: stretch;
    flex-direction: column;
  }
}
