.app-sticky-shell {
  position: sticky;
  top: 0;
  z-index: 30;
}

.app-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  min-height: 104px;
  padding: 12px clamp(18px, 2.5vw, 40px) 12px clamp(12px, 1.5vw, 24px);
  background:
    radial-gradient(ellipse at 82% 32%, rgba(255, 255, 255, 0.14) 0 12%, transparent 13%),
    radial-gradient(ellipse at 76% 76%, rgba(140, 90, 54, 0.22) 0 13%, transparent 14%),
    linear-gradient(115deg, rgba(255, 255, 255, 0.96) 0 38%, rgba(245, 249, 250, 0.9) 48%, rgba(6, 123, 162, 0.2) 100%),
    linear-gradient(135deg, #2c1713, #4a271c 46%, #0f556b 100%);
  border-bottom: 1px solid rgba(24, 33, 63, 0.16);
  box-shadow: none;
  position: relative;
  z-index: 3;
  overflow: hidden;
}

.app-header::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at center, rgba(255, 255, 255, 0.22) 0 18%, transparent 20%),
    radial-gradient(ellipse at center, rgba(74, 39, 28, 0.3) 0 28%, transparent 30%);
  background-size: 78px 46px, 78px 46px;
  background-position: 62% 12px, calc(62% + 28px) 34px;
  opacity: 0.2;
  transform: rotate(-8deg) scale(1.15);
  transform-origin: center;
  pointer-events: none;
}

.brand-block,
.header-actions {
  position: relative;
  z-index: 1;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: 680px;
  min-width: 0;
}

.brand-copy {
  display: grid;
  gap: 0.35rem;
  min-width: 0;
}

.brand-logo {
  width: clamp(170px, 20vw, 230px);
  height: clamp(66px, 8vw, 88px);
  overflow: hidden;
  border-radius: 0;
  background: #fff url("/static/sheng-logo-transparent.webp") center / contain no-repeat;
  background-color: transparent;
  box-shadow: none;
  flex: 0 0 auto;
  filter: drop-shadow(0 5px 12px rgba(44, 23, 19, 0.12));
  mix-blend-mode: normal;
}

.app-header h1 {
  margin: 0;
  color: #18213f;
  font-size: clamp(1.45rem, 2.25vw, 1.9rem);
  line-height: 1.08;
  letter-spacing: -0.015em;
  text-wrap: balance;
}

.brand-copy p {
  margin: 0;
  color: #52636b;
  font-size: clamp(0.66rem, 0.85vw, 0.76rem);
  font-weight: 650;
  line-height: 1.35;
  letter-spacing: 0.025em;
}

.brand-copy p span {
  color: var(--accent);
  padding: 0 0.12rem;
}

.header-actions {
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: nowrap;
}

.header-actions button {
  white-space: nowrap;
}

.header-date {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 46px;
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.76);
  color: #18213f;
  font-size: 0.86rem;
  font-weight: 700;
  box-shadow: none;
  white-space: nowrap;
}

#headerWeek {
  border-left: 1px solid rgba(35, 97, 91, 0.22);
  color: var(--brand-strong);
  padding-left: 0.7rem;
  font-size: 0.9rem;
}

.site-control {
  display: grid;
  gap: 0.3rem;
  width: clamp(180px, 14vw, 220px);
  min-width: 180px;
}

.site-control-heading {
  display: flex;
  width: max-content;
  min-height: 1.55rem;
  align-items: center;
  justify-content: flex-start;
  gap: 0.38rem;
  padding: 0.08rem 0.12rem 0.08rem 0.55rem;
  border: 1px solid rgba(35, 97, 91, 0.14);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
}

.site-control-heading label {
  color: #31514d;
  font-size: 0.76rem;
  font-weight: 780;
  letter-spacing: 0.035em;
}

.site-control select {
  min-height: 48px;
  border-color: rgba(35, 97, 91, 0.38);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 4px 14px rgba(27, 39, 36, 0.08);
}

.site-control select:focus {
  border-color: var(--brand);
  outline: 3px solid rgba(35, 97, 91, 0.16);
}

.header-file-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.header-file-action,
#importBtn {
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  border: 1px solid rgba(13, 73, 55, 0.18);
  border-radius: 9px;
  box-shadow: 0 4px 14px rgba(27, 39, 36, 0.1);
}

#exportBtn {
  min-height: 40px;
  padding: 0.5rem 0.68rem;
  border-color: rgba(35, 97, 91, 0.24);
  background: rgba(247, 250, 249, 0.76);
  color: #285d56;
  font-size: 0.8rem;
  font-weight: 720;
  box-shadow: none;
}

#exportBtn:hover {
  border-color: rgba(35, 97, 91, 0.42);
  background: rgba(255, 255, 255, 0.94);
  color: var(--brand-strong);
  transform: none;
  box-shadow: 0 3px 10px rgba(27, 39, 36, 0.08);
}

.header-file-action svg,
#importBtn svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
}

#exportBtn svg {
  width: 15px;
  height: 15px;
}

.upload-button {
  display: inline-grid;
  place-items: center;
  min-height: 48px;
  min-width: 118px;
  border-radius: 6px;
  background: #e9f0ee;
  color: var(--brand-strong);
  cursor: pointer;
  padding: 0.67rem 0.9rem;
}

.upload-button input {
  display: none;
}

.tabs {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  overflow-x: auto;
  padding: 0.55rem 1.25rem;
  background: rgba(250, 251, 249, 0.94);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 2px 8px rgba(27, 39, 36, 0.04);
  position: relative;
  z-index: 2;
}

.tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  flex: 0 0 auto;
  background: transparent;
  color: var(--muted);
  border: 1px solid transparent;
  border-radius: 7px;
  padding: 0.58rem 0.8rem;
  white-space: nowrap;
  transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease, box-shadow 140ms ease;
}

.tab:hover {
  background: #eef2ee;
  color: var(--brand-strong);
  border-color: #e0e5df;
}

.tab.active {
  background: #fff;
  color: var(--brand-strong);
  border-color: #cbd8d2;
  box-shadow: 0 1px 3px rgba(27, 39, 36, 0.09), inset 0 -2px 0 var(--brand);
}

.tab-icon {
  width: 1rem;
  height: 1rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: 0 0 auto;
}

main {
  padding: 1rem 1.25rem 2rem;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 1rem;
}

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.8rem;
}

.panel-title h2 {
  margin: 0;
  font-size: 1.05rem;
}

.panel-title > div {
  display: grid;
  gap: 0.18rem;
}

.panel-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.panel-title span {
  color: var(--muted);
  font-size: 0.86rem;
}

@media (min-width: 921px) and (max-width: 1350px) {
  .app-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
    gap: 0.7rem;
    min-height: auto;
    padding-left: 28px;
    padding-right: 28px;
  }

  .brand-block {
    max-width: none;
  }

  .brand-logo {
    width: 190px;
    height: 70px;
  }

  .app-header h1 {
    font-size: 1.55rem;
  }

  .brand-copy p {
    font-size: 0.64rem;
    letter-spacing: 0.005em;
  }

  .header-actions {
    width: 100%;
    flex-wrap: wrap;
    gap: 8px;
  }

  .site-control {
    width: 175px;
    min-width: 175px;
  }

  .header-file-action,
  #importBtn {
    padding-left: 0.7rem;
    padding-right: 0.7rem;
  }
}

@media (max-width: 920px) {
  .app-header {
    display: grid;
    grid-template-columns: 1fr;
    min-height: auto;
    padding: 0.9rem 1rem;
  }

  .brand-block {
    flex-wrap: wrap;
  }

  .brand-logo {
    width: 232px;
    height: 78px;
  }

  .app-header h1 {
    font-size: 2rem;
  }

  .header-actions {
    align-items: stretch;
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .site-control {
    width: min(240px, 100%);
  }

  .header-date,
  .header-file-actions,
  .account-menu {
    align-self: flex-end;
  }
}

@media (max-width: 560px) {
  main,
  .tabs,
  .app-header {
    padding-left: 0.8rem;
    padding-right: 0.8rem;
  }

  .brand-logo {
    width: 190px;
    height: 64px;
  }

  .app-header h1 {
    font-size: 1.65rem;
  }

  .header-date,
  .site-control,
  .header-file-actions,
  .upload-button {
    width: 100%;
  }

  .header-actions {
    flex-direction: column;
  }

  .header-file-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .header-file-action,
  #importBtn,
  .account-menu-trigger {
    width: 100%;
  }
}
