:root {
  --bg: #f4f7fb;
  --ink: #152033;
  --muted: #64748b;
  --panel: #ffffff;
  --line: #dbe5f1;
  --blue: #1d4ed8;
  --blue-dark: #1e40af;
  --green: #16745f;
  --green-soft: #e8f6ef;
  --red: #dc2626;
  --red-soft: #fff1f1;
  --orange: #d97706;
  --orange-soft: #fff7ed;
  --shadow: 0 18px 45px rgba(30, 64, 175, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

body.dashboard-open {
  overflow: hidden;
}

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

button {
  border: 0;
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

.site-shell {
  min-height: 100vh;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  min-height: 76px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 24px;
  padding: 14px 40px;
  background: rgba(244, 247, 251, 0.9);
  border-bottom: 1px solid rgba(219, 229, 241, 0.86);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-grid;
  grid-template-columns: 148px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
}

.brand.compact {
  grid-template-columns: 126px minmax(0, 1fr);
}

.brand-logo {
  width: 148px;
  height: 50px;
  object-fit: contain;
  display: block;
}

.brand.compact .brand-logo {
  width: 126px;
  height: 43px;
}

.brand strong,
.brand em {
  display: block;
  font-style: normal;
}

.brand strong {
  font-size: 18px;
}

.brand em {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.top-nav {
  justify-self: center;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.top-nav a {
  border-radius: 999px;
  padding: 9px 13px;
  color: #334155;
  font-weight: 800;
}

.top-nav a:hover {
  background: #eaf2ff;
  color: var(--blue-dark);
}

.top-nav a.active {
  background: var(--blue);
  color: white;
}

.header-actions,
.hero-actions,
.dash-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.ghost,
.primary,
.side-link {
  min-height: 40px;
  border-radius: 8px;
  padding: 0 14px;
  display: inline-grid;
  place-items: center;
  font-weight: 900;
}

.ghost {
  background: white;
  border: 1px solid var(--line);
  color: var(--ink);
}

.primary {
  background: var(--green);
  color: white;
}

.large {
  min-height: 48px;
  padding-inline: 18px;
}

.hero {
  min-height: calc(100vh - 76px);
  display: grid;
  align-items: end;
  padding: 0 40px 34px;
  position: relative;
  overflow: hidden;
  background: #10213c;
}

.hero-media {
  position: absolute;
  inset: 0;
}

.hero-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.72;
}

.hero-media::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(12, 25, 45, 0.86) 0%, rgba(12, 25, 45, 0.62) 48%, rgba(12, 25, 45, 0.22) 100%),
    linear-gradient(0deg, rgba(12, 25, 45, 0.72) 0%, rgba(12, 25, 45, 0.05) 48%);
}

.hero-content {
  position: relative;
  z-index: 1;
  width: min(860px, 100%);
  color: white;
}

.eyebrow {
  display: inline-block;
  margin-bottom: 10px;
  color: #678098;
  font-size: 14px;
  font-weight: 900;
}

.hero .eyebrow {
  color: #bfdbfe;
}

.hero h1 {
  margin-bottom: 18px;
  font-size: clamp(36px, 5vw, 68px);
  line-height: 1.05;
  letter-spacing: 0;
}

.hero p {
  width: min(760px, 100%);
  color: #dbeafe;
  font-size: 18px;
  line-height: 1.75;
}

.hero .ghost {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.32);
  color: white;
}

.quick-login {
  max-width: 1440px;
  margin: -18px auto 0;
  padding: 0 40px;
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.quick-login button {
  min-height: 116px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 20px;
  text-align: left;
  box-shadow: var(--shadow);
}

.quick-login strong,
.quick-login span {
  display: block;
}

.quick-login strong {
  margin-bottom: 10px;
  font-size: 20px;
}

.quick-login span {
  color: var(--muted);
  line-height: 1.55;
}

.section {
  max-width: 1440px;
  margin: 0 auto;
  padding: 72px 40px 0;
}

.section-head {
  margin-bottom: 18px;
}

.section h2 {
  margin-bottom: 10px;
  font-size: 34px;
  letter-spacing: 0;
}

.section > p,
.split p {
  color: var(--muted);
  line-height: 1.7;
}

.card-grid,
.role-grid {
  display: grid;
  gap: 14px;
}

.card-grid.three,
.role-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.service-card,
.role-grid article,
.agent-panel,
.dashboard-card,
.table-panel,
.profile-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  box-shadow: var(--shadow);
}

.service-card,
.role-grid article {
  min-height: 160px;
  padding: 22px;
}

.service-card strong,
.role-grid strong {
  display: block;
  margin-bottom: 12px;
  font-size: 20px;
}

.service-card p,
.role-grid p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.65;
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(460px, 1fr);
  gap: 22px;
  align-items: stretch;
}

.agent-panel {
  padding: 18px;
}

.mini-kpis {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}

.mini-kpis span,
.store-rank div {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbff;
  padding: 14px;
}

.mini-kpis strong,
.mini-kpis em {
  display: block;
  font-style: normal;
}

.mini-kpis strong {
  font-size: 30px;
}

.mini-kpis em,
.store-rank span {
  color: var(--muted);
}

.store-rank {
  display: grid;
  gap: 10px;
}

.store-rank strong,
.store-rank span {
  display: block;
}

.store-rank span {
  margin-top: 6px;
}

.safety {
  padding-bottom: 72px;
}

.flow {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px;
}

.flow span {
  min-height: 68px;
  border: 1px solid #b8c8dc;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #edf5ff;
  color: #1e3a8a;
  font-weight: 900;
  text-align: center;
  padding: 8px;
}

.login-drawer {
  position: fixed;
  inset: 0;
  z-index: 30;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.18s ease;
}

.login-drawer.open {
  pointer-events: auto;
  opacity: 1;
}

.drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.48);
}

.drawer-panel {
  position: absolute;
  top: 0;
  right: 0;
  width: min(460px, 100%);
  height: 100%;
  background: white;
  padding: 28px;
  box-shadow: -20px 0 45px rgba(15, 23, 42, 0.18);
  transform: translateX(22px);
  transition: transform 0.18s ease;
}

.login-drawer.open .drawer-panel {
  transform: translateX(0);
}

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

.drawer-head h2 {
  margin-bottom: 0;
}

.icon-button {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: #eef4fb;
  color: #1f2937;
  font-size: 24px;
}

.login-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 18px;
}

.login-tabs button {
  min-height: 42px;
  border-radius: 8px;
  background: #eef4fb;
  color: #334155;
  font-weight: 900;
}

.login-tabs button.active {
  background: var(--blue);
  color: white;
}

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

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

.login-form input,
.login-form select {
  width: 100%;
  height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--ink);
  background: #f8fafc;
}

.store-role-field {
  display: none !important;
}

.login-form.store-mode .store-role-field {
  display: grid !important;
}

.dashboard {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
  grid-template-columns: 260px minmax(0, 1fr);
  background: var(--bg);
}

.dashboard.open {
  display: grid;
}

.dash-side {
  background: linear-gradient(180deg, var(--blue) 0%, var(--blue-dark) 100%);
  color: white;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.dash-side .brand em {
  color: #c8dbf3;
}

#dash-nav {
  display: grid;
  gap: 7px;
}

#dash-nav button,
.side-link {
  min-height: 42px;
  border-radius: 8px;
  background: transparent;
  color: #eaf2ff;
  text-align: left;
  padding: 0 12px;
  font-weight: 900;
}

#dash-nav button.active {
  background: #eff6ff;
  color: #1e3a8a;
}

#dash-nav button:hover,
.side-link:hover {
  background: rgba(147, 197, 253, 0.34);
  color: white;
}

.side-link {
  margin-top: auto;
  border: 1px solid rgba(216, 231, 251, 0.28);
}

.dash-main {
  min-width: 0;
  overflow: auto;
  padding: 28px;
}

.dash-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

.dash-top h1 {
  margin-bottom: 0;
  font-size: 32px;
}

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

.dashboard-card,
.profile-panel,
.table-panel {
  padding: 18px;
}

.dashboard-card span,
.dashboard-card em {
  display: block;
  color: var(--muted);
  font-style: normal;
}

.dashboard-card strong {
  display: block;
  margin: 8px 0 4px;
  font-size: 30px;
}

.content-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(360px, 0.7fr);
  gap: 14px;
}

.profile-list,
.todo-list,
.permission-list {
  display: grid;
  gap: 10px;
}

.profile-row,
.todo-list article,
.permission-list article {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
  padding: 12px;
}

.profile-row {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 12px;
}

.profile-row span,
.todo-list p,
.permission-list p {
  color: var(--muted);
}

.todo-list article.red {
  border-color: #f3a4a4;
  background: var(--red-soft);
}

.todo-list article.orange {
  border-color: #fed7aa;
  background: var(--orange-soft);
}

.table {
  width: 100%;
  border-collapse: collapse;
}

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

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

.status {
  border-radius: 999px;
  padding: 4px 8px;
  background: var(--green-soft);
  color: var(--green);
  font-weight: 900;
}

.status.warn {
  background: var(--orange-soft);
  color: var(--orange);
}

.status.bad {
  background: var(--red-soft);
  color: var(--red);
}

.toast-stack {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 40;
  display: grid;
  gap: 10px;
}

.toast {
  width: 300px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  box-shadow: var(--shadow);
  padding: 12px;
}

.toast strong,
.toast span {
  display: block;
}

.toast span {
  margin-top: 4px;
  color: var(--muted);
}

@media (max-width: 1080px) {
  .site-header {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .top-nav {
    justify-self: start;
    flex-wrap: wrap;
  }

  .quick-login,
  .card-grid.three,
  .role-grid,
  .split,
  .content-layout {
    grid-template-columns: 1fr;
  }

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

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

@media (max-width: 720px) {
  .site-header,
  .hero,
  .quick-login,
  .section {
    padding-left: 16px;
    padding-right: 16px;
  }

  .hero {
    min-height: 720px;
  }

  .quick-login,
  .mini-kpis,
  .dash-grid {
    grid-template-columns: 1fr;
  }

  .dashboard {
    grid-template-columns: 1fr;
    overflow: auto;
  }

  .dash-side {
    position: static;
  }

  .dash-main {
    padding: 18px;
  }

  .dash-top {
    align-items: start;
    flex-direction: column;
  }

  .profile-row {
    grid-template-columns: 1fr;
  }
}
