:root {
  color-scheme: light;
  --bg: #f4f6fa;
  --surface: #ffffff;
  --surface-soft: #f8f9fc;
  --line: #e5e8ef;
  --text: #171a22;
  --muted: #697080;
  --primary: #5b45e0;
  --primary-hover: #4934c7;
  --primary-soft: #efecff;
  --success: #16794c;
  --success-soft: #e8f7ef;
  --danger: #bd2d3a;
  --danger-soft: #fff0f1;
  --warning: #a46005;
  --shadow: 0 16px 50px rgba(33, 39, 60, 0.08);
  --radius: 18px;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
}

button, input, select { font: inherit; }

button { cursor: pointer; }

.login-page {
  display: grid;
  min-height: 100vh;
  grid-template-columns: minmax(340px, 0.9fr) minmax(520px, 1.1fr);
  background: var(--surface);
}

.login-brand {
  position: relative;
  display: flex;
  min-height: 100vh;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  padding: 54px;
  color: #fff;
  background:
    radial-gradient(circle at 70% 18%, rgba(125, 106, 255, 0.85), transparent 27%),
    linear-gradient(145deg, #151128 0%, #31266f 58%, #5b45e0 100%);
}

.login-brand::after {
  position: absolute;
  right: -130px;
  bottom: -160px;
  width: 420px;
  height: 420px;
  border: 1px solid rgba(255,255,255,.24);
  border-radius: 50%;
  box-shadow: 0 0 0 52px rgba(255,255,255,.05), 0 0 0 110px rgba(255,255,255,.04);
  content: "";
}

.brand-mark {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-size: 18px;
  font-weight: 700;
}

.brand-mark__icon {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid rgba(255,255,255,.25);
  border-radius: 12px;
  background: rgba(255,255,255,.14);
  backdrop-filter: blur(12px);
}

.brand-copy {
  position: relative;
  z-index: 1;
  max-width: 520px;
  padding-bottom: 8vh;
}

.brand-copy p { margin: 0 0 12px; color: rgba(255,255,255,.7); letter-spacing: .12em; }
.brand-copy h1 { margin: 0; font-size: clamp(38px, 5vw, 66px); line-height: 1.08; letter-spacing: -.04em; }
.brand-copy small { display: block; margin-top: 24px; max-width: 420px; color: rgba(255,255,255,.7); font-size: 15px; line-height: 1.8; }

.login-panel {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 48px;
}

.login-card { width: min(420px, 100%); }
.login-card__eyebrow { margin: 0 0 10px; color: var(--primary); font-weight: 700; }
.login-card h2 { margin: 0; font-size: 34px; letter-spacing: -.03em; }
.login-card__lead { margin: 12px 0 34px; color: var(--muted); line-height: 1.7; }

.field { margin-bottom: 20px; }
.field label { display: block; margin-bottom: 9px; font-size: 14px; font-weight: 650; }
.field input, .field select {
  width: 100%;
  height: 48px;
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: none;
  padding: 0 14px;
  color: var(--text);
  background: #fff;
  transition: border-color .2s, box-shadow .2s;
}
.field input:focus, .field select:focus { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }
.field-help { margin: 8px 0 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.button {
  min-height: 44px;
  border: 0;
  border-radius: 12px;
  padding: 0 18px;
  font-weight: 700;
  transition: transform .15s, background .2s, opacity .2s;
}
.button:active { transform: translateY(1px); }
.button:disabled { cursor: not-allowed; opacity: .55; }
.button--primary { color: #fff; background: var(--primary); }
.button--primary:hover:not(:disabled) { background: var(--primary-hover); }
.button--secondary { color: var(--primary); background: var(--primary-soft); }
.button--ghost { border: 1px solid var(--line); color: var(--text); background: #fff; }
.button--block { width: 100%; min-height: 50px; }

.feedback {
  margin: 16px 0;
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 14px;
  line-height: 1.55;
}
.feedback[hidden] { display: none; }
.feedback--error { color: var(--danger); background: var(--danger-soft); }
.feedback--success { color: var(--success); background: var(--success-soft); }

.app-shell { display: grid; min-height: 100vh; grid-template-columns: 248px minmax(0, 1fr); }
.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  height: 100vh;
  flex-direction: column;
  padding: 26px 18px;
  color: #fff;
  background: #171426;
}
.sidebar .brand-mark { padding: 0 8px 28px; }
.nav-label { margin: 18px 12px 8px; color: #777184; font-size: 11px; font-weight: 800; letter-spacing: .14em; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 46px;
  border-radius: 12px;
  padding: 0 13px;
  color: #aaa5b8;
  text-decoration: none;
}
.nav-item--active { color: #fff; background: rgba(111, 87, 235, .26); }
.nav-item__icon { display: grid; width: 24px; place-items: center; }
.sidebar-footer { margin-top: auto; border-top: 1px solid rgba(255,255,255,.08); padding: 20px 10px 4px; color: #8d879b; font-size: 12px; line-height: 1.6; }

.workspace { min-width: 0; }
.topbar {
  display: flex;
  min-height: 76px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  padding: 0 38px;
  background: rgba(255,255,255,.88);
  backdrop-filter: blur(16px);
}
.topbar h1 { margin: 0; font-size: 20px; }
.admin-profile { display: flex; align-items: center; gap: 12px; }
.avatar { display: grid; width: 38px; height: 38px; place-items: center; border-radius: 12px; color: var(--primary); background: var(--primary-soft); font-weight: 800; }
.profile-copy strong, .profile-copy small { display: block; }
.profile-copy small { margin-top: 2px; color: var(--muted); }

.content { width: min(1180px, calc(100% - 64px)); margin: 0 auto; padding: 38px 0 60px; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.page-heading p { margin: 0 0 8px; color: var(--primary); font-size: 12px; font-weight: 800; letter-spacing: .12em; }
.page-heading h2 { margin: 0; font-size: 30px; letter-spacing: -.035em; }
.page-heading__desc { max-width: 540px; color: var(--muted); line-height: 1.7; }

.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 22px; }
.stat-card, .panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: 0 8px 28px rgba(37,42,65,.045); }
.stat-card { padding: 21px; }
.stat-card span { display: block; margin-bottom: 12px; color: var(--muted); font-size: 13px; }
.stat-card strong { font-size: 22px; }
.status-dot { display: inline-block; width: 8px; height: 8px; margin-right: 7px; border-radius: 50%; background: #b7bdc9; }
.status-dot--ok { background: #26a269; box-shadow: 0 0 0 5px var(--success-soft); }

.panel { padding: 26px; }
.panel-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--line); padding-bottom: 20px; }
.panel-header h3 { margin: 0; font-size: 19px; }
.panel-header p { margin: 8px 0 0; color: var(--muted); line-height: 1.6; }
.model-form { padding-top: 24px; }
.model-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
.model-card { border: 1px solid var(--line); border-radius: 15px; padding: 18px; background: var(--surface-soft); }
.model-card__title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.model-card__title strong { font-size: 16px; }
.badge { border-radius: 999px; padding: 5px 9px; color: var(--primary); background: var(--primary-soft); font-size: 11px; font-weight: 800; }
.model-detail { min-height: 48px; margin: 12px 2px 0; color: var(--muted); font-size: 12px; line-height: 1.65; }
.form-actions { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-top: 24px; }
.form-actions p { margin: 0; color: var(--muted); font-size: 13px; }
.loading { color: var(--muted); }

@media (max-width: 900px) {
  .login-page { grid-template-columns: 1fr; }
  .login-brand { display: none; }
  .app-shell { grid-template-columns: 84px minmax(0, 1fr); }
  .sidebar { padding-inline: 14px; }
  .sidebar .brand-mark span:last-child, .nav-item span:last-child, .nav-label, .sidebar-footer { display: none; }
  .sidebar .brand-mark { justify-content: center; padding-inline: 0; }
  .nav-item { justify-content: center; padding: 0; }
  .topbar { padding-inline: 24px; }
  .content { width: min(100% - 36px, 1180px); }
}

@media (max-width: 650px) {
  .app-shell { display: block; }
  .sidebar { display: none; }
  .topbar { min-height: 68px; }
  .profile-copy { display: none; }
  .content { width: min(100% - 28px, 1180px); padding-top: 26px; }
  .page-heading { align-items: flex-start; flex-direction: column; }
  .stats, .model-grid { grid-template-columns: 1fr; }
  .form-actions { align-items: stretch; flex-direction: column; }
  .form-actions .button { width: 100%; }
  .login-panel { padding: 28px; }
}
