:root {
  --bg: #eef3f6;
  --panel: #ffffff;
  --panel-soft: #f6f8f7;
  --ink: #14201c;
  --muted: #66736e;
  --line: #d7e0dc;
  --line-strong: #bfccc6;
  --primary: #0f766e;
  --primary-dark: #0b4f4a;
  --primary-weak: #dff4ef;
  --accent: #c47a26;
  --success: #16803c;
  --warning: #b25f00;
  --danger: #b42318;
  --shadow: 0 18px 48px rgba(20, 32, 28, 0.1);
  --shadow-soft: 0 8px 24px rgba(20, 32, 28, 0.07);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 0%, rgba(15, 118, 110, 0.12), transparent 32rem),
    radial-gradient(circle at 92% 12%, rgba(196, 122, 38, 0.14), transparent 28rem),
    linear-gradient(180deg, #f8fbf9 0%, var(--bg) 38%, #e9f0ed 100%);
  font-family:
    "Avenir Next", "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC",
    sans-serif;
  min-height: 100vh;
  min-height: 100dvh;
}

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

button {
  -webkit-tap-highlight-color: transparent;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto auto 1fr;
}

.app-header {
  min-height: 76px;
  padding: 14px clamp(16px, 3vw, 34px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  color: #fff;
  font-weight: 800;
  flex: 0 0 auto;
  box-shadow: 0 12px 22px rgba(15, 118, 110, 0.22);
}

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

h1 {
  font-size: 21px;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

h2 {
  font-size: 24px;
  line-height: 1.25;
  letter-spacing: -0.03em;
}

h3 {
  font-size: 16px;
  line-height: 1.3;
  letter-spacing: 0;
}

.brand-block p,
.page-head p,
.section-title span,
.hint,
.sub {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.user-chip,
.status-pill {
  border: 1px solid var(--line);
  background: var(--panel-soft);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.status-pill.done {
  color: var(--success);
  background: #ecfdf3;
  border-color: #bbf7d0;
}

.status-pill.pending {
  color: var(--warning);
  background: #fffbeb;
  border-color: #fde68a;
}

.status-pill.score.strong,
.score-text.strong {
  color: var(--success);
}

.status-pill.score.weak,
.score-text.weak {
  color: var(--danger);
}

.status-pill.score.neutral,
.score-text.neutral {
  color: var(--muted);
}

.btn {
  min-height: 36px;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 8px 12px;
  cursor: pointer;
  font-weight: 700;
  font-size: 14px;
  background: var(--panel);
  color: var(--ink);
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    border-color 160ms ease;
}

.btn.primary {
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  color: #fff;
  box-shadow: 0 10px 18px rgba(15, 118, 110, 0.18);
}

.btn.ghost {
  border-color: var(--line);
  color: var(--ink);
  background: rgba(255, 255, 255, 0.72);
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.module-nav {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
  padding: 0 clamp(16px, 3vw, 34px);
  display: flex;
  gap: 8px;
  overflow-x: auto;
  position: sticky;
  top: 75px;
  z-index: 19;
}

.nav-item {
  height: 54px;
  border: 0;
  border-bottom: 3px solid transparent;
  border-radius: 16px 16px 0 0;
  background: transparent;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 14px;
  white-space: nowrap;
  cursor: pointer;
}

.nav-item.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  background: var(--primary-weak);
}

.nav-icon {
  font-size: 16px;
  line-height: 1;
}

.content-shell {
  width: min(1200px, 100%);
  margin: 0 auto;
  padding: 26px clamp(16px, 3vw, 34px) 36px;
}

.detail-week-field {
  min-width: 160px;
}

.view {
  display: none;
}

.view.active {
  display: block;
  animation: viewIn 220ms ease both;
}

@keyframes viewIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

.page-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.section-block {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

.mt {
  margin-top: 16px;
}

.section-title {
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.admin-page-actions {
  justify-content: flex-end;
}

.admin-collapsible {
  transition:
    border-color 180ms ease,
    box-shadow 180ms ease,
    transform 180ms ease;
}

.admin-collapsible .section-title {
  background:
    linear-gradient(135deg, rgba(15, 118, 110, 0.05), rgba(255, 255, 255, 0.94)),
    rgba(255, 255, 255, 0.92);
}

.admin-collapsible-body {
  display: block;
  transition:
    max-height 220ms ease,
    padding-top 180ms ease,
    padding-bottom 180ms ease,
    opacity 180ms ease;
  max-height: none;
  opacity: 1;
  overflow: hidden;
}

.admin-collapsible-body > * {
  min-height: 0;
  overflow: hidden;
}

.admin-collapsible.collapsed {
  box-shadow: 0 10px 22px rgba(20, 32, 28, 0.05);
}

.admin-collapsible.collapsed .section-title {
  border-bottom-color: transparent;
}

.admin-collapsible.collapsed .admin-collapsible-body {
  max-height: 0;
  opacity: 0;
  padding-top: 0;
  padding-bottom: 0;
}

.trend-alias-list.compact {
  padding-top: 8px;
}

.trend-alias-card {
  display: grid;
  gap: 10px;
  padding: 14px 16px;
}

.trend-alias-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
}

.trend-alias-name {
  min-width: 0;
}

.trend-alias-name strong,
.trend-alias-name span {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.trend-alias-name strong {
  font-size: 15px;
}

.trend-alias-name span {
  color: var(--muted);
  font-size: 12px;
}

.trend-alias-arrow {
  color: var(--muted);
  font-weight: 700;
}

.trend-alias-empty-target {
  color: var(--muted);
}

.admin-toggle-btn {
  min-width: 84px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}

.admin-toggle-btn::after {
  content: "▾";
  font-size: 12px;
  line-height: 1;
  transition: transform 180ms ease;
}

.admin-toggle-btn[aria-expanded="false"]::after {
  transform: rotate(-90deg);
}

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

.calendar-panel {
  padding: 14px;
  display: grid;
  gap: 12px;
}

.calendar-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(220px, 0.8fr);
  gap: 12px;
}

.calendar-hero-main,
.calendar-hero-side {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  display: grid;
  gap: 7px;
  min-width: 0;
}

.calendar-hero-main {
  background:
    radial-gradient(circle at right top, rgba(15, 118, 110, 0.12), transparent 34%),
    linear-gradient(135deg, rgba(15, 118, 110, 0.08), rgba(255, 255, 255, 0.96));
}

.calendar-hero-side {
  background:
    radial-gradient(circle at left bottom, rgba(196, 122, 38, 0.14), transparent 36%),
    rgba(255, 255, 255, 0.9);
}

.calendar-hero span,
.calendar-day span,
.calendar-day em,
.calendar-hero em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.calendar-hero strong {
  font-size: 28px;
  line-height: 1.1;
  letter-spacing: -0.04em;
}

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

.calendar-day {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px 10px;
  background: rgba(255, 255, 255, 0.78);
  display: grid;
  gap: 5px;
  min-height: 98px;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease,
    background 160ms ease;
}

.calendar-day strong {
  font-size: 18px;
  line-height: 1.1;
}

.calendar-day.is-cycle {
  border-color: rgba(15, 118, 110, 0.38);
  background:
    linear-gradient(180deg, rgba(15, 118, 110, 0.1), rgba(255, 255, 255, 0.96)),
    #fff;
  box-shadow: 0 12px 24px rgba(15, 118, 110, 0.1);
}

.calendar-day.is-today,
.calendar-day.is-cycle.is-today {
  transform: translateY(-2px);
}

.calendar-day.is-today strong {
  color: var(--primary-dark);
}

.calendar-day.is-past:not(.is-today) {
  background: rgba(246, 248, 247, 0.86);
}

.metric {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(246, 248, 247, 0.94));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow-soft);
  position: relative;
  overflow: hidden;
}

.metric::after {
  content: "";
  position: absolute;
  right: -26px;
  bottom: -30px;
  width: 96px;
  height: 96px;
  border-radius: 999px;
  background: rgba(15, 118, 110, 0.08);
}

.metric-label {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 8px;
}

.metric-value {
  font-size: clamp(24px, 3vw, 32px);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.04em;
  position: relative;
  z-index: 1;
}

.progress-list,
.assignment-list,
.product-card-list,
.org-user-list {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.progress-item,
.assignment-item,
.product-card,
.org-user-item {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  padding: 14px;
  box-shadow: 0 1px 0 rgba(20, 32, 28, 0.03);
}

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

.progress-row,
.product-card-head,
.assignment-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.product-name-en,
.matrix-product-en,
.cost-product-card-en {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
  word-break: break-word;
}

.matrix-product-en {
  max-width: 220px;
}

.progress-bar {
  height: 9px;
  background: #e9efec;
  border-radius: 999px;
  overflow: hidden;
  margin-top: 10px;
}

.progress-bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #46b79f);
}

.field {
  display: grid;
  gap: 6px;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
}

.field.compact {
  min-width: 180px;
}

select,
input,
textarea {
  box-sizing: border-box;
  min-width: 0;
  max-width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 9px 12px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  outline: none;
}

.field > select,
.field > input,
.field > textarea {
  width: 100%;
}

select {
  overflow: hidden;
  text-overflow: ellipsis;
}

textarea {
  min-height: 132px;
  resize: vertical;
  line-height: 1.55;
}

select:focus,
input:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.12);
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(160px, 220px) auto;
  align-items: end;
  gap: 12px;
  margin-bottom: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: var(--shadow-soft);
}

.sales-toolbar {
  grid-template-columns: minmax(320px, 1.25fr) minmax(150px, 200px) minmax(150px, 200px) minmax(160px, 210px);
}

.sales-view-field {
  min-width: 160px;
}
