:root {
  --dashboard-header-blue: #2563eb;
  --dashboard-header-ink: #0b1b3a;
  --dashboard-header-line: #e6ecf5;
  --dashboard-header-soft: #eff6ff;
  --dashboard-header-height: 64px;
  --dashboard-nav-item-width: 90px;
  --dashboard-nav-item-height: 64px;
  --dashboard-nav-gap: 17px;
  --dashboard-nav-font-size: 15px;
  --dashboard-nav-active-width: 62px;
}

html {
  overflow-y: scroll;
  scrollbar-gutter: stable;
}

body.dashboard-page-loading main {
  opacity: 0;
  visibility: hidden;
}

body.dashboard-page-loading::before {
  content: "";
  position: fixed;
  left: 50%;
  top: 132px;
  z-index: 20;
  width: 34px;
  height: 34px;
  margin-left: -17px;
  border-radius: 999px;
  border: 3px solid #dbeafe;
  border-top-color: var(--dashboard-header-blue);
  animation: dashboardLoaderSpin 0.85s linear infinite;
}

@keyframes dashboardLoaderSpin {
  to {
    transform: rotate(360deg);
  }
}

.dashboard-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  width: auto;
  height: var(--dashboard-header-height);
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 34px;
  border-bottom: 1px solid var(--dashboard-header-line);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 4px 18px rgba(15, 23, 42, 0.04);
  backdrop-filter: blur(14px);
  font-family: "Noto Sans TC", "Microsoft JhengHei", "PingFang TC", system-ui, sans-serif;
}

.dashboard-header + main {
  margin-top: var(--dashboard-header-height);
}

.dashboard-header > * {
  min-width: 0;
}

.dashboard-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: var(--dashboard-header-ink);
  text-decoration: none;
  font-size: 20px;
  line-height: 1;
  font-weight: 800;
  letter-spacing: 0;
  white-space: nowrap;
  cursor: default;
}

.dashboard-brand-logo {
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
}

.dashboard-nav {
  position: absolute;
  left: 50%;
  top: 0;
  transform: translateX(-50%);
  height: var(--dashboard-header-height);
  max-width: calc(100% - 520px);
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--dashboard-nav-gap);
  padding: 0 4px;
  overflow-x: auto;
  scrollbar-width: none;
}

.dashboard-nav::-webkit-scrollbar {
  display: none;
}

.dashboard-nav a {
  position: relative;
  box-sizing: border-box;
  width: var(--dashboard-nav-item-width);
  height: var(--dashboard-nav-item-height);
  flex: 0 0 var(--dashboard-nav-item-width);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  color: var(--dashboard-header-ink);
  text-decoration: none;
  border-radius: 8px;
  font-size: var(--dashboard-nav-font-size);
  line-height: 1;
  font-weight: 700;
  white-space: nowrap;
  transition: color .18s ease, background-color .18s ease;
}

.dashboard-nav a:hover {
  color: var(--dashboard-header-blue);
  background: rgba(239, 246, 255, 0.56);
}

.dashboard-nav a.is-active {
  color: var(--dashboard-header-blue);
  font-weight: 700;
  background: transparent;
}

.dashboard-nav a.is-active::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 0;
  width: var(--dashboard-nav-active-width);
  height: 3px;
  transform: translateX(-50%);
  border-radius: 999px 999px 0 0;
  background: var(--dashboard-header-blue);
}

.dashboard-actions {
  position: relative;
  min-width: 190px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
}

.dashboard-icon-button {
  position: relative;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  color: var(--dashboard-header-ink);
  border: 1px solid transparent;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  transition: color .18s ease, background-color .18s ease, border-color .18s ease;
}

.dashboard-icon-button:hover {
  color: var(--dashboard-header-blue);
  border-color: #dce8f8;
  background: var(--dashboard-header-soft);
}

.dashboard-icon-button svg {
  width: 23px;
  height: 23px;
}

.dashboard-user-button {
  appearance: none;
  min-width: 182px;
  height: 48px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px 6px 8px;
  border: 1px solid #dce8f8;
  border-radius: 999px;
  color: var(--dashboard-header-ink);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.1);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color .18s ease, background-color .18s ease, box-shadow .18s ease;
}

.dashboard-user-button:hover {
  border-color: #bfdbfe;
  background: var(--dashboard-header-soft);
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.14);
}

.dashboard-user-avatar {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  color: #fff;
  border-radius: 50%;
  background: linear-gradient(180deg, #60a5fa 0%, #2563eb 100%);
}

.dashboard-user-avatar svg {
  width: 20px;
  height: 20px;
}

.dashboard-user-summary {
  min-width: 0;
  display: grid;
  gap: 4px;
  text-align: left;
}

.dashboard-user-name {
  max-width: 124px;
  overflow: hidden;
  color: var(--dashboard-header-ink);
  font-size: 14px;
  line-height: 1;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-user-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #64748b;
  font-size: 12px;
  line-height: 1;
  font-weight: 800;
  white-space: nowrap;
}

.dashboard-user-meta span + span::before {
  content: "\00b7";
  margin-right: 6px;
  color: #94a3b8;
}

.dashboard-user-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 178px;
  display: none;
  padding: 14px;
  border: 1px solid #dce8f8;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 18px 40px rgba(37, 99, 235, 0.14);
}

.dashboard-header.is-user-menu-open .dashboard-user-menu {
  display: grid;
  gap: 6px;
}

.dashboard-user-menu strong {
  color: var(--dashboard-header-ink);
  font-size: 15px;
  font-weight: 900;
}

.dashboard-user-menu span {
  color: #64748b;
  font-size: 13px;
  font-weight: 700;
}

.dashboard-user-menu-link,
.dashboard-user-menu button {
  height: 34px;
  margin-top: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 10px;
  color: #fff;
  background: var(--dashboard-header-blue);
  font: inherit;
  font-size: 14px;
  font-weight: 800;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

.dashboard-user-menu button {
  width: 100%;
  margin-top: 0;
}

@media (max-width: 1180px) {
  :root {
    --dashboard-nav-item-width: 80px;
    --dashboard-nav-gap: 10px;
    --dashboard-nav-font-size: 14px;
    --dashboard-nav-active-width: 56px;
  }

  .dashboard-header {
    padding: 0 22px;
  }

  .dashboard-nav {
    justify-content: center;
    max-width: calc(100% - 420px);
  }
}

@media (max-width: 760px) {
  :root {
    --dashboard-nav-item-width: 86px;
    --dashboard-nav-item-height: 48px;
    --dashboard-nav-gap: 8px;
    --dashboard-nav-font-size: 14px;
    --dashboard-nav-active-width: 54px;
  }

  .dashboard-header {
    position: relative;
    height: auto;
    min-height: 64px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    row-gap: 4px;
    padding: 10px 16px 0;
    overflow: hidden;
  }

  .dashboard-header + main {
    margin-top: 0;
  }

  .dashboard-brand {
    grid-column: 1;
    grid-row: 1;
    font-size: 20px;
  }

  .dashboard-actions {
    position: fixed;
    top: 10px;
    right: auto;
    left: auto;
    right: 16px;
    min-width: 0;
    gap: 8px;
    z-index: 40;
  }

  .dashboard-user-button {
    min-width: 136px;
    height: 42px;
    padding: 5px 10px 5px 6px;
  }

  .dashboard-user-avatar {
    width: 31px;
    height: 31px;
  }

  .dashboard-user-name {
    max-width: 82px;
    font-size: 13px;
  }

  .dashboard-user-meta {
    max-width: 86px;
    overflow: hidden;
    font-size: 11px;
    text-overflow: ellipsis;
  }

  .dashboard-nav {
    position: static;
    transform: none;
    grid-column: 1 / -1;
    grid-row: 2;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    height: var(--dashboard-nav-item-height);
    justify-content: flex-start;
    padding: 0 2px;
  }

  .dashboard-nav a {
    min-width: 0;
  }
}
