:root {
  --bg: #f5f5f7;
  --surface: #ffffff;
  --ink: #1d1d1f;
  --ink-2: #6e6e73;
  --ink-3: #86868b;
  --blue: #0071e3;
  --blue-hover: #0077ed;
  --green: #1d8a3a;
  --orange: #b64400;
  --red: #d70015;
  --line: #d2d2d7;
  --hair: rgba(0, 0, 0, 0.08);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
}

button { font-family: inherit; cursor: pointer; }

/* Login Page */
.adm-login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.adm-login-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border-radius: 22px;
  padding: 36px 32px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.08);
}

.adm-login-card h1 {
  margin: 0 0 6px;
  font-size: 24px;
  font-weight: 700;
}

.adm-login-card p {
  margin: 0 0 24px;
  font-size: 13.5px;
  color: var(--ink-2);
}

/* Shell Layout */
.adm-shell {
  display: grid;
  grid-template-columns: 236px 1fr;
  min-height: 100vh;
}

.adm-sidebar {
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(18px);
  border-right: 1px solid var(--hair);
  padding: 22px 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: sticky;
  top: 0;
  height: 100vh;
}

.adm-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 10px 20px;
  font-weight: 700;
  font-size: 16px;
}

.adm-brand-badge {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: #1d1d1f;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
}

.adm-menu {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.adm-menu-item {
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  padding: 10px 12px;
  border-radius: 11px;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-2);
  display: flex;
  align-items: center;
  gap: 10px;
  transition: all 0.15s ease;
}

.adm-menu-item:hover {
  background: rgba(0, 0, 0, 0.045);
  color: var(--ink);
}

.adm-menu-item.active {
  background: var(--blue);
  color: #ffffff;
}

.adm-sidebar-foot {
  border-top: 1px solid var(--hair);
  padding-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.adm-main {
  padding: 28px 32px 60px;
  max-width: 1240px;
  width: 100%;
}

.adm-page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}

.adm-page-head h2 {
  margin: 0;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* Cards & Stats */
.adm-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}

.adm-kpi {
  background: var(--surface);
  border-radius: 18px;
  padding: 20px 22px;
  border: 1px solid rgba(0, 0, 0, 0.03);
}

.adm-kpi-label {
  font-size: 13px;
  color: var(--ink-2);
}

.adm-kpi-value {
  margin-top: 8px;
  font-size: 28px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.adm-kpi-sub {
  margin-top: 4px;
  font-size: 12px;
  color: var(--ink-3);
}

.adm-card {
  background: var(--surface);
  border-radius: 18px;
  padding: 22px;
  margin-bottom: 20px;
  border: 1px solid rgba(0, 0, 0, 0.03);
}

.adm-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.adm-card-head h3 {
  margin: 0;
  font-size: 16.5px;
  font-weight: 600;
}

/* Tables */
.adm-table-wrap {
  overflow-x: auto;
}

.adm-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.adm-table th,
.adm-table td {
  padding: 12px 10px;
  text-align: left;
  border-bottom: 1px solid var(--hair);
  vertical-align: middle;
}

.adm-table th {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-2);
  white-space: nowrap;
}

.adm-table tr:last-child td {
  border-bottom: none;
}

/* Forms & Buttons */
.adm-field {
  margin-bottom: 14px;
}

.adm-field label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 6px;
}

.adm-input,
.adm-select,
.adm-textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 9px 12px;
  font-size: 14px;
  font-family: inherit;
  color: var(--ink);
  background: #ffffff;
}

.adm-textarea {
  min-height: 108px;
  resize: vertical;
  line-height: 1.55;
}

.adm-input:focus,
.adm-select:focus,
.adm-textarea:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.14);
}

.adm-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.adm-btn {
  border: none;
  border-radius: 980px;
  padding: 8px 18px;
  font-size: 13.5px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.adm-btn-primary {
  background: var(--blue);
  color: #ffffff;
}

.adm-btn-primary:hover { background: var(--blue-hover); }

.adm-btn-ghost {
  background: rgba(0, 0, 0, 0.055);
  color: var(--ink);
}

.adm-btn-ghost:hover { background: rgba(0, 0, 0, 0.095); }

.adm-btn-danger {
  background: rgba(215, 0, 21, 0.1);
  color: var(--red);
}

.adm-btn-danger:hover { background: rgba(215, 0, 21, 0.16); }

.adm-btn-sm {
  padding: 5px 11px;
  font-size: 12px;
}

/* Badges */
.adm-badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 99px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
  background: var(--bg);
  color: var(--ink-2);
}

.adm-badge.green { background: rgba(29, 138, 58, 0.12); color: var(--green); }
.adm-badge.orange { background: rgba(182, 68, 0, 0.12); color: var(--orange); }
.adm-badge.red { background: rgba(215, 0, 21, 0.12); color: var(--red); }
.adm-badge.blue { background: rgba(0, 113, 227, 0.12); color: var(--blue); }

.adm-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  background: var(--bg);
  padding: 3px 7px;
  border-radius: 6px;
  word-break: break-all;
}

/* Modal */
.adm-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.38);
  backdrop-filter: blur(5px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.adm-modal-backdrop.open { display: flex; }

.adm-modal {
  width: 100%;
  max-width: 640px;
  background: #ffffff;
  border-radius: 20px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.2);
  overflow: hidden;
}

.adm-modal-head {
  padding: 18px 22px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--hair);
}

.adm-modal-head h3 { margin: 0; font-size: 17px; }

.adm-modal-close {
  border: none;
  background: var(--bg);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 16px;
}

.adm-modal-body {
  padding: 18px 22px;
  max-height: 72vh;
  overflow-y: auto;
}

.adm-modal-foot {
  padding: 14px 22px 18px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  border-top: 1px solid var(--hair);
}

/* Toast */
.adm-toast {
  position: fixed;
  top: 22px;
  left: 50%;
  transform: translateX(-50%) translateY(-10px);
  z-index: 300;
  background: rgba(29, 29, 31, 0.92);
  color: #fff;
  padding: 10px 20px;
  border-radius: 99px;
  font-size: 13.5px;
  opacity: 0;
  pointer-events: none;
  transition: all 0.2s ease;
}

.adm-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.app-icon {
  display: inline-flex;
  flex-shrink: 0;
}

.app-icon svg {
  width: 100%;
  height: 100%;
}

@media (max-width: 820px) {
  .adm-shell { grid-template-columns: 1fr; }
  .adm-sidebar {
    position: static;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--hair);
  }
  .adm-menu { flex-direction: row; overflow-x: auto; }
  .adm-menu-item { white-space: nowrap; width: auto; }
  .adm-main { padding: 20px 16px; }
  .adm-grid-2 { grid-template-columns: 1fr; }
}
