:root {
  --app-height: 100vh;
  --app-width: 100vw;
  --app-offset-top: 0px;
  --app-offset-left: 0px;
  --bg: #f4efe6;
  --surface: rgba(255, 255, 255, 0.92);
  --surface-strong: #ffffff;
  --surface-dark: #1c3940;
  --text: #1f2d31;
  --muted: #6a7b80;
  --line: rgba(30, 53, 59, 0.12);
  --primary: #d46a3a;
  --primary-strong: #b85128;
  --accent: #2f7d76;
  --shadow: 0 16px 40px rgba(48, 69, 76, 0.12);
  --radius-xl: 22px;
  --radius-lg: 16px;
  --radius-md: 12px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(212, 106, 58, 0.16), transparent 28%),
    radial-gradient(circle at 85% 10%, rgba(47, 125, 118, 0.12), transparent 22%),
    linear-gradient(180deg, #faf6ef 0%, #f4efe6 100%);
  font-family: "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

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

button,
input,
select {
  font: inherit;
}

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-shell {
  width: min(440px, 100%);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 16px;
}

.login-card {
  padding: 34px 30px 26px;
  border-radius: 28px;
  background: rgba(255, 251, 246, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.72);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.login-card-simple {
  position: relative;
  overflow: hidden;
}

.login-card-simple::before {
  content: "";
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  height: 6px;
  background: linear-gradient(90deg, var(--primary), #f0b07b, var(--accent));
}

.simple-header h1 {
  margin: 0;
  font-size: clamp(28px, 6vw, 34px);
  line-height: 1.18;
  text-align: center;
}

.login-subtitle {
  margin: 8px 0 0;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

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

label {
  display: block;
  margin-top: 18px;
  margin-bottom: 8px;
  font-weight: 600;
}

input,
select {
  width: 100%;
  min-height: 46px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(27, 57, 64, 0.14);
  background: rgba(255, 255, 255, 0.95);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

input:focus,
select:focus {
  outline: none;
  border-color: rgba(212, 106, 58, 0.72);
  box-shadow: 0 0 0 4px rgba(212, 106, 58, 0.13);
}

button,
.secondary-link,
.sidebar-logout {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

button:not(.password-toggle) {
  width: 100%;
  margin-top: 22px;
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
  color: #fff8f3;
  box-shadow: 0 10px 24px rgba(212, 106, 58, 0.22);
}

button:not(.password-toggle):hover,
.secondary-link:hover,
.sidebar-logout:hover,
.service-card:hover,
.nav-group-link:hover,
.nav-submenu-link:hover {
  transform: translateY(-1px);
}

.login-footnote {
  margin: 18px 0 0;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

.login-beian {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.login-beian-row {
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  flex-wrap: wrap;
}

.login-beian a {
  color: inherit;
  text-decoration: none;
}

.login-beian a:hover,
.login-beian a:focus-visible {
  color: var(--primary-strong);
  text-decoration: underline;
}

.login-beian-police {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.login-beian-police img {
  width: 16px;
  height: 16px;
  display: block;
}

.error-banner,
.success-banner {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid transparent;
}

.error-banner {
  background: rgba(190, 59, 43, 0.1);
  color: #a73b2d;
  border-color: rgba(190, 59, 43, 0.14);
}

.success-banner {
  margin-bottom: 14px;
  background: rgba(47, 125, 118, 0.1);
  color: #266a64;
  border-color: rgba(47, 125, 118, 0.16);
}

.app-page {
  min-height: 100vh;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100dvh;
  padding: 14px 12px;
  background:
    linear-gradient(180deg, rgba(22, 46, 52, 0.98), rgba(25, 50, 56, 0.96)),
    linear-gradient(120deg, rgba(212, 106, 58, 0.12), transparent 40%);
  color: #edf7f4;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 10px;
  box-shadow: 10px 0 30px rgba(17, 34, 39, 0.08);
}

.sidebar-header {
  padding: 4px 4px 8px;
}

.brand-title {
  display: block;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.3;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
  min-height: 0;
  padding-right: 2px;
}

.nav-group {
  padding: 6px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.nav-group-link {
  display: block;
  padding: 6px 8px;
  border-radius: 10px;
  color: #f7fbfa;
  font-size: 14px;
  font-weight: 700;
}

.nav-submenu {
  list-style: none;
  margin: 4px 0 0;
  padding: 0 0 0 6px;
}

.nav-submenu li + li {
  margin-top: 2px;
}

.nav-submenu-link {
  display: block;
  padding: 5px 8px;
  border-radius: 9px;
  font-size: 14px;
  line-height: 1.35;
  color: rgba(237, 247, 244, 0.78);
}

.nav-submenu-link.active {
  background: rgba(212, 106, 58, 0.18);
  color: #fff7f1;
}

.sidebar-logout {
  width: 100%;
  background: rgba(255, 255, 255, 0.08);
  color: #fff7f1;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-logout-form {
  margin: 0;
}

.sidebar-logout-form .sidebar-logout {
  margin-top: 0;
  box-shadow: none;
}

.sidebar-logout[disabled] {
  cursor: wait;
  opacity: 0.72;
  transform: none;
}

.app-page .content-shell {
  padding: 0 12px 10px;
}

.app-page .topbar {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr) 76px;
  align-items: start;
  gap: 6px;
  margin-top: 8px;
  margin-bottom: 6px;
}

.app-page .topbar .page-title,
.app-page .topbar .topbar-account,
.app-page .topbar .mobile-nav-toggle {
  min-height: 28px;
  font-size: 15px;
  line-height: 1;
  align-self: start;
}

.app-page .topbar .page-title {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  text-align: center;
  font-weight: 700;
}

.app-page .topbar .topbar-account {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  justify-self: end;
  width: 76px;
  min-width: 76px;
  padding: 0 8px;
  border-radius: 8px;
  background: rgba(47, 125, 118, 0.1);
  color: var(--accent);
  box-shadow: 0 6px 16px rgba(47, 125, 118, 0.1);
  text-align: center;
  font-weight: 700;
}

.app-page .topbar .mobile-nav-toggle {
  width: 76px;
  min-width: 76px;
  padding: 0 8px;
  margin-top: 0;
  border-radius: 8px;
  box-shadow: 0 6px 16px rgba(212, 106, 58, 0.18);
}

.content-section,
.detail-card,
.embed-wrapper {
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.content-section {
  padding: 18px;
}

.content-section + .content-section,
.management-grid {
  margin-top: 14px;
}

.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.section-title {
  margin: 0;
  font-size: 22px;
}

.section-description {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.service-grid,
.management-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.service-card {
  padding: 18px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(252, 248, 242, 0.92));
  border: 1px solid rgba(33, 64, 73, 0.08);
  box-shadow: 0 10px 24px rgba(52, 71, 79, 0.07);
}

.service-card h4,
.detail-card h4 {
  margin: 0 0 8px;
  font-size: 20px;
}

.service-card p,
.detail-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.detail-card {
  padding: 20px;
}

.detail-kicker {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.detail-card-wide {
  grid-column: 1 / -1;
}

.accounts-card {
  grid-column: span 2;
}

.manage-form {
  margin-top: 12px;
}

.form-hint {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.manage-form button {
  margin-top: 18px;
}

.account-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.account-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(245, 239, 230, 0.76);
  border: 1px solid rgba(30, 53, 59, 0.06);
}

.account-row strong {
  display: block;
  margin-bottom: 4px;
}

.account-chip {
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(47, 125, 118, 0.1);
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
}

.embed-wrapper {
  overflow: hidden;
  padding: 0;
  line-height: 0;
  background: transparent;
  border: none;
  box-shadow: none;
}

.service-frame {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

.service-page {
  height: var(--app-height);
  width: 100%;
  overflow: hidden;
  position: fixed;
  inset: 0;
  touch-action: manipulation;
}

.service-page .app-shell {
  height: var(--app-height);
  min-height: var(--app-height);
  width: 100%;
}

.service-page .content-shell {
  height: var(--app-height);
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.service-page .embed-wrapper {
  flex: 1 1 auto;
  min-height: 0;
}

.service-page .embed-wrapper > iframe {
  display: block;
  width: 100%;
  height: 100% !important;
  min-height: 0 !important;
  border: 0;
}

.mobile-overlay {
  display: none;
}

@media (max-width: 1180px) {
  .service-grid,
  .management-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .accounts-card {
    grid-column: span 1;
  }
}

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

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 30;
    width: min(52vw, 188px);
    padding: 10px 9px;
    transform: translateX(-100%);
    transition: transform 0.22s ease;
  }

  .mobile-overlay {
    position: fixed;
    inset: 0;
    z-index: 20;
    background: rgba(10, 20, 24, 0.32);
  }

  body.nav-open .sidebar {
    transform: translateX(0);
  }

  body.nav-open .mobile-overlay {
    display: block;
  }

  .app-page .content-shell {
    padding: 0 10px 8px;
  }

  .section-header {
    flex-direction: column;
    gap: 6px;
  }

  .service-grid,
  .management-grid {
    grid-template-columns: 1fr;
  }

  .service-page .content-shell {
    height: var(--app-height);
  }
}

@media (max-width: 560px) {
  .sidebar {
    width: min(48vw, 168px);
    padding:
      max(8px, env(safe-area-inset-top))
      7px
      max(8px, env(safe-area-inset-bottom));
  }

  .brand-title {
    font-size: 12px;
  }

  .nav-group {
    padding: 5px;
  }

  .nav-group-link,
  .nav-submenu-link {
    font-size: 13px;
  }

  .sidebar-logout {
    min-height: 34px;
    padding: 0 10px;
    border-radius: 10px;
    font-size: 13px;
  }

  .sidebar-logout-form .sidebar-logout {
    margin-top: 0;
  }

  .login-page {
    padding:
      max(16px, env(safe-area-inset-top))
      16px
      max(16px, env(safe-area-inset-bottom));
  }

  .login-card {
    padding: 28px 20px 22px;
  }

  .app-page .content-shell {
    padding:
      max(0px, env(safe-area-inset-top))
      10px
      max(8px, env(safe-area-inset-bottom));
  }
}
