:root {
  --bg: #f3f6f2;
  --bg-accent: #e7efe6;
  --surface: #ffffff;
  --ink: #1c2b24;
  --muted: #5f7268;
  --line: #d5e0d8;
  --brand: #2f6f5e;
  --brand-dark: #245748;
  --brand-soft: #d8eee6;
  --accent: #c4a35a;
  --danger: #b42318;
  --shadow: 0 18px 40px rgba(28, 43, 36, 0.08);
  --radius: 18px;
  --font: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --display: "DM Sans", "Noto Sans SC", sans-serif;
}

* {
  box-sizing: border-box;
}

body.app-body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 10% -10%, #dff0e8 0%, transparent 55%),
    radial-gradient(900px 420px at 100% 0%, #f7efd8 0%, transparent 45%),
    var(--bg);
  min-height: 100vh;
}

a {
  color: var(--brand);
  text-decoration: none;
}
a:hover {
  color: var(--brand-dark);
}

/* Auth */
.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(47, 111, 94, 0.92), rgba(36, 87, 72, 0.88)),
    url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.06'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.auth-card {
  width: min(420px, 100%);
  background: rgba(255, 255, 255, 0.96);
  border-radius: 24px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.22);
  padding: 36px 32px 28px;
  backdrop-filter: blur(8px);
}

.auth-brand {
  text-align: center;
  margin-bottom: 28px;
}

.auth-brand .mark {
  width: 56px;
  height: 56px;
  margin: 0 auto 14px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #3d8f78, #2f6f5e);
  color: #fff;
  font-size: 26px;
  box-shadow: 0 10px 24px rgba(47, 111, 94, 0.35);
}

.auth-brand h1 {
  margin: 0;
  font-family: var(--display);
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.auth-brand p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.auth-card .form-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
}

.auth-card .form-control {
  border-radius: 12px;
  border-color: var(--line);
  padding: 0.7rem 0.9rem;
  background: #fbfcfb;
}

.auth-card .form-control:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 0.2rem rgba(47, 111, 94, 0.15);
}

.btn-brand {
  background: linear-gradient(135deg, #3d8f78, #2f6f5e);
  border: none;
  color: #fff !important;
  border-radius: 12px;
  padding: 0.75rem 1rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  box-shadow: 0 10px 20px rgba(47, 111, 94, 0.25);
}

.btn-brand:hover {
  background: linear-gradient(135deg, #347a66, #245748);
  color: #fff !important;
}

.auth-hint {
  margin-top: 18px;
  text-align: center;
  font-size: 0.8rem;
  color: var(--muted);
}

/* App shell */
.app-shell {
  display: grid;
  grid-template-columns: 250px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: linear-gradient(180deg, #243f36 0%, #1c322b 100%);
  color: #e7f2ed;
  padding: 22px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
}

.sidebar .brand {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 8px 10px 22px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 16px;
}

.sidebar .brand > div:nth-child(2) {
  flex: 1;
  min-width: 0;
}

.sidebar .brand .mark {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.12);
  display: grid;
  place-items: center;
  font-size: 18px;
}

.sidebar .brand strong {
  display: block;
  font-size: 1rem;
}

.sidebar .brand small {
  opacity: 0.65;
  font-size: 0.75rem;
}

.side-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border-radius: 12px;
  color: rgba(255, 255, 255, 0.78);
  margin-bottom: 4px;
  font-size: 0.94rem;
  transition: 0.15s ease;
}

.side-nav a:hover,
.side-nav a.active {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.side-nav a.active {
  background: rgba(196, 163, 90, 0.22);
  box-shadow: inset 0 0 0 1px rgba(196, 163, 90, 0.35);
}

.main {
  padding: 22px 26px 40px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 22px;
}

.topbar h1 {
  margin: 0;
  font-size: 1.45rem;
  font-family: var(--display);
  font-weight: 700;
}


.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 6px 6px 14px;
  box-shadow: var(--shadow);
}

.user-chip .avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand-dark);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 0.85rem;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}

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

.stat-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.stat-card::after {
  content: "";
  position: absolute;
  right: -20px;
  top: -20px;
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: var(--brand-soft);
  opacity: 0.65;
}

.stat-card .label {
  color: var(--muted);
  font-size: 0.82rem;
  margin-bottom: 8px;
}

.stat-card .value {
  font-size: 1.8rem;
  font-weight: 700;
  font-family: var(--display);
  position: relative;
  z-index: 1;
}

.stat-card .hint {
  margin-top: 6px;
  font-size: 0.78rem;
  color: var(--muted);
  position: relative;
  z-index: 1;
}

.quick-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.quick-actions a {
  display: block;
  padding: 16px;
  border-radius: 14px;
  background: #f7faf7;
  border: 1px solid var(--line);
  color: var(--ink);
  transition: 0.15s ease;
}

.quick-actions a:hover {
  border-color: var(--brand);
  background: var(--brand-soft);
  transform: translateY(-1px);
}

.quick-actions strong {
  display: block;
  margin-bottom: 4px;
}

.quick-actions span {
  color: var(--muted);
  font-size: 0.82rem;
}

.meal-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-size: 0.85rem;
  font-weight: 600;
}

.pill.gold {
  background: #f7efd8;
  color: #7a5c1e;
}

.alert-soft {
  border: none;
  border-radius: 12px;
  background: #fdecec;
  color: var(--danger);
}

.placeholder-hero {
  text-align: center;
  padding: 48px 20px;
}

.placeholder-hero .icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 16px;
  border-radius: 20px;
  background: var(--brand-soft);
  color: var(--brand);
  display: grid;
  place-items: center;
  font-size: 32px;
}

@media (max-width: 991.98px) {
  .stat-grid,
  .quick-actions {
    grid-template-columns: 1fr 1fr;
  }
}

.table thead th {
  white-space: nowrap;
  font-size: 0.85rem;
  color: var(--muted);
  border-bottom-color: var(--line);
}

.check-table .form-check-input {
  width: 1.25rem;
  height: 1.25rem;
  cursor: pointer;
}

.btn-brand.btn-sm {
  padding: 0.4rem 0.85rem;
  border-radius: 10px;
  box-shadow: none;
}

.panel h2.h5 {
  font-family: var(--display);
  font-weight: 700;
}

/* ---------- Mobile shell ---------- */
.mobile-top {
  display: none;
}

.sidebar-backdrop {
  display: none;
}

.nav-close {
  margin-left: auto;
  border: 0;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  width: 36px;
  height: 36px;
  border-radius: 10px;
}

.import-textarea {
  min-height: 180px;
  font-size: 15px;
  line-height: 1.5;
}

.import-preview-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}

.import-batch-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.meal-card-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.meal-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fbfcfb;
  padding: 14px;
}

.meal-card.is-unmatched {
  background: #fff8e8;
  border-color: #f0d78c;
}

.meal-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 12px;
}

.meal-card-name {
  font-weight: 700;
  font-size: 1.05rem;
  line-height: 1.35;
  word-break: break-word;
}

.meal-card-seq {
  color: var(--muted);
  font-weight: 600;
  margin-right: 4px;
}

.meal-card-meta {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.4;
}

.meal-toggle-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.meal-toggle {
  position: relative;
  display: block;
  margin: 0;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.meal-toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.meal-toggle span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  border-radius: 14px;
  border: 1.5px solid var(--line);
  background: #fff;
  color: var(--muted);
  font-size: 1.05rem;
  font-weight: 700;
  transition: 0.15s ease;
}

.meal-toggle input:checked + span {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
  box-shadow: 0 8px 16px rgba(47, 111, 94, 0.22);
}

.meal-toggle input:focus-visible + span {
  outline: 2px solid rgba(47, 111, 94, 0.35);
  outline-offset: 2px;
}

/* 导入核对：紧凑卡片，宽屏一行四个 */
.import-preview-panel .meal-card-list {
  gap: 8px;
}

.import-preview-panel .meal-card {
  border-radius: 12px;
  padding: 10px;
}

.import-preview-panel .meal-card-top {
  gap: 6px;
  margin-bottom: 8px;
  align-items: center;
}

.import-preview-panel .meal-card-name {
  font-size: 0.92rem;
  line-height: 1.25;
}

.import-preview-panel .meal-card-seq {
  font-size: 0.8rem;
}

.import-preview-panel .meal-card-meta {
  margin-top: 2px;
  font-size: 0.72rem;
  line-height: 1.3;
}

.import-preview-panel .meal-card .badge {
  font-size: 0.65rem;
  padding: 0.25em 0.45em;
  flex-shrink: 0;
}

.import-preview-panel .meal-toggle-row {
  gap: 5px;
}

.import-preview-panel .meal-toggle span {
  min-height: 34px;
  border-radius: 9px;
  font-size: 0.88rem;
  border-width: 1px;
}

.import-preview-panel .meal-toggle input:checked + span {
  box-shadow: 0 4px 10px rgba(47, 111, 94, 0.18);
}

.import-submit-spacer {
  height: 76px;
}

.import-submit-bar {
  position: sticky;
  bottom: 12px;
  z-index: 20;
  padding: 10px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  box-shadow: 0 10px 30px rgba(28, 43, 36, 0.12);
  border: 1px solid var(--line);
}

@media (min-width: 576px) {
  .import-preview-panel .meal-card-list {
    grid-template-columns: 1fr 1fr;
  }
}

@media (min-width: 768px) {
  .meal-card-list {
    grid-template-columns: 1fr 1fr;
  }
  .import-parse-btn {
    width: auto !important;
  }
  .import-preview-panel .meal-card-list {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 1100px) {
  .import-preview-panel .meal-card-list {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (min-width: 1200px) {
  .meal-card-list {
    grid-template-columns: 1fr 1fr 1fr;
  }
  .import-preview-panel .meal-card-list {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 991.98px) {
  .app-shell {
    display: block;
    min-height: 100vh;
  }

  .mobile-top {
    display: flex;
    align-items: center;
    gap: 10px;
    position: sticky;
    top: 0;
    z-index: 40;
    padding: 10px 12px;
    padding-top: calc(10px + env(safe-area-inset-top));
    background: linear-gradient(180deg, #243f36 0%, #1c322b 100%);
    color: #fff;
  }

  .mobile-top .nav-toggle {
    width: 42px;
    height: 42px;
    border: 0;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    font-size: 1.4rem;
  }

  .mobile-top-title {
    flex: 1;
    min-width: 0;
  }

  .mobile-top-title strong {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-top .avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.16);
    display: grid;
    place-items: center;
    font-weight: 700;
  }

  .desktop-topbar {
    display: none;
  }

  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    opacity: 0;
    pointer-events: none;
    transition: 0.2s ease;
    z-index: 50;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(82vw, 300px);
    height: 100%;
    height: 100dvh;
    z-index: 60;
    transform: translateX(-105%);
    transition: transform 0.22s ease;
    border-radius: 0;
    padding-top: calc(18px + env(safe-area-inset-top));
    overflow: auto;
    -webkit-overflow-scrolling: touch;
  }

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

  .app-shell.nav-open .sidebar-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .app-shell.nav-open {
    overflow: hidden;
  }

  body:has(.app-shell.nav-open) {
    overflow: hidden;
  }

  .main {
    padding: 14px 12px 28px;
    padding-bottom: calc(28px + env(safe-area-inset-bottom));
  }

  .panel {
    padding: 16px;
    border-radius: 16px;
  }

  .side-nav a {
    min-height: 46px;
  }

  .import-submit-bar {
    bottom: calc(8px + env(safe-area-inset-bottom));
  }

  .nav-close {
    display: grid;
    place-items: center;
  }
}

@media (min-width: 992px) {
  .nav-close {
    display: none;
  }
}

@media (max-width: 576px) {
  .stat-grid,
  .quick-actions {
    grid-template-columns: 1fr;
  }
}

/* ---------- Month overview (compact, PC-fit) ---------- */
.month-toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  padding: 12px 14px;
  background:
    linear-gradient(135deg, rgba(47, 111, 94, 0.07), rgba(196, 163, 90, 0.06)),
    var(--surface);
}

.month-toolbar-title {
  margin: 0;
  font-family: var(--display);
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.2;
}

.month-toolbar-hint {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.75rem;
}

.month-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.month-nav-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  display: grid;
  place-items: center;
  color: var(--ink);
  transition: 0.15s ease;
}

.month-nav-btn:hover {
  background: var(--brand-soft);
  color: var(--brand-dark);
}

.month-nav-fields {
  display: flex;
  align-items: end;
  gap: 6px;
  flex-wrap: wrap;
  background: #f7faf8;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 5px 8px;
}

.month-nav-fields label {
  display: grid;
  gap: 1px;
  margin: 0;
}

.month-nav-fields label span {
  font-size: 0.65rem;
  color: var(--muted);
  font-weight: 600;
}

.month-nav-fields input {
  width: 58px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 4px 6px;
  background: #fff;
  font-size: 0.88rem;
}

.month-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.month-summary-card {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: 0 6px 16px rgba(28, 43, 36, 0.05);
  min-width: 0;
}

.month-summary-icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.month-summary-label {
  color: var(--muted);
  font-size: 0.72rem;
  margin-bottom: 0;
}

.month-summary-value {
  font-family: var(--display);
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.1;
}

.month-summary-card.tone-dawn .month-summary-icon {
  background: #fff1d6;
  color: #b07a1a;
}
.month-summary-card.tone-noon .month-summary-icon {
  background: #dff3ea;
  color: #2f6f5e;
}
.month-summary-card.tone-dusk .month-summary-icon {
  background: #e6e8f8;
  color: #4a5288;
}
.month-summary-card.tone-guest .month-summary-icon {
  background: #f5e7d2;
  color: #8a6a2f;
}
.month-summary-card.tone-total .month-summary-icon {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}
.month-summary-card.tone-total {
  background: linear-gradient(145deg, #3d8f78, #2f6f5e);
  border-color: transparent;
  color: #fff;
}
.month-summary-card.tone-total .month-summary-label {
  color: rgba(255, 255, 255, 0.78);
}
.month-summary-card.tone-total .month-summary-value {
  color: #fff;
}

.month-panel {
  padding: 0;
  overflow: hidden;
}

.month-scroll {
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
}

.month-matrix {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
  table-layout: fixed;
  font-size: 0.78rem;
}

.month-matrix th,
.month-matrix td {
  border-bottom: 1px solid #e3ebe5;
  border-right: 1px solid #e3ebe5;
  padding: 0;
  text-align: center;
  white-space: nowrap;
  height: 30px;
  vertical-align: middle;
  overflow: hidden;
}

.month-matrix thead th {
  background: #243f36;
  color: rgba(255, 255, 255, 0.88);
  font-weight: 600;
  padding: 4px 1px;
  line-height: 1.05;
}

.month-matrix thead th .day-num {
  display: block;
  font-family: var(--display);
  font-size: 0.8rem;
  color: #fff;
  font-weight: 700;
}

.month-matrix thead th .day-week {
  display: block;
  font-size: 0.58rem;
  opacity: 0.7;
  margin-top: 0;
}

.month-matrix thead th.is-weekend {
  background: #1c322b;
}

.month-matrix thead th.is-today {
  background: #c4a35a;
  color: #1c2b24;
}

.month-matrix thead th.is-today .day-num,
.month-matrix thead th.is-today .day-week {
  color: #1c2b24;
  opacity: 1;
}

.month-matrix .sticky-col {
  position: sticky;
  left: 0;
  z-index: 3;
  background: #f4f8f5;
  text-align: left;
  width: 78px;
  min-width: 78px;
  max-width: 78px;
  padding: 0 6px;
  box-shadow: 4px 0 8px rgba(28, 43, 36, 0.05);
}

.month-matrix thead .sticky-col.corner {
  z-index: 4;
  background: #1c322b;
  color: #fff;
  font-size: 0.72rem;
}

.month-matrix .row-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 700;
  color: var(--ink);
  font-size: 0.78rem;
}

.month-matrix .row-chip i {
  width: 18px;
  height: 18px;
  border-radius: 5px;
  display: grid;
  place-items: center;
  font-size: 0.68rem;
}

.month-matrix tr.tone-dawn .row-chip i {
  background: #fff1d6;
  color: #b07a1a;
}
.month-matrix tr.tone-noon .row-chip i {
  background: #dff3ea;
  color: #2f6f5e;
}
.month-matrix tr.tone-dusk .row-chip i {
  background: #e6e8f8;
  color: #4a5288;
}
.month-matrix tr.tone-guest .row-chip i {
  background: #f5e7d2;
  color: #8a6a2f;
}
.month-matrix tr.tone-total .row-chip i {
  background: #2f6f5e;
  color: #fff;
}

.month-matrix .month-total-col {
  position: sticky;
  right: 0;
  z-index: 3;
  background: #eef6f1;
  font-weight: 700;
  width: 42px;
  min-width: 42px;
  max-width: 42px;
  box-shadow: -4px 0 8px rgba(28, 43, 36, 0.05);
}

.month-matrix thead .month-total-col {
  z-index: 4;
  background: #c4a35a;
  color: #1c2b24;
}

.month-matrix thead .month-total-col .day-num,
.month-matrix thead .month-total-col .day-week {
  color: #1c2b24;
  opacity: 1;
}

.month-matrix td {
  font-variant-numeric: tabular-nums;
  font-family: var(--display);
  font-size: 0.8rem;
  background: #fff;
}

.month-matrix td.has-val {
  color: var(--brand-dark);
  font-weight: 700;
  background: #f3faf6;
}

.month-matrix td.is-zero {
  color: transparent;
}

.month-matrix td.is-today {
  box-shadow: inset 0 0 0 1.5px rgba(196, 163, 90, 0.7);
}

.month-matrix tr.is-total td {
  background: #e7f2ec;
  color: var(--brand-dark);
  font-weight: 800;
}

.month-matrix tr.is-total .sticky-col,
.month-matrix tr.is-total .month-total-col {
  background: #d8eee6;
}

.month-matrix tr.is-total td.heat-1 {
  background: #e7f2ec;
}
.month-matrix tr.is-total td.heat-2 {
  background: #d5ebdf;
}
.month-matrix tr.is-total td.heat-3 {
  background: #bfe0cf;
}
.month-matrix tr.is-total td.heat-4 {
  background: #9fd0b8;
  color: #1c322b;
}
.month-matrix tr.is-total td.heat-5 {
  background: #2f6f5e;
  color: #fff;
}

.month-matrix tbody tr:not(.is-total):hover td {
  background: #f8fcfa;
}

.month-matrix tbody tr:not(.is-total):hover .sticky-col {
  background: #eaf3ee;
}

/* PC 宽屏：表格铺满，尽量不出现横向滚动 */
@media (min-width: 1200px) {
  .month-scroll {
    overflow-x: hidden;
  }
}

@media (max-width: 1199.98px) and (min-width: 992px) {
  .month-matrix .sticky-col {
    width: 68px;
    min-width: 68px;
    max-width: 68px;
  }
  .month-matrix .row-chip span,
  .month-matrix .row-chip {
    font-size: 0.72rem;
  }
  .month-matrix .row-chip i {
    display: none;
  }
}

@media (max-width: 991.98px) {
  .month-summary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .month-summary-card.tone-total {
    grid-column: span 2;
  }
  .month-matrix {
    table-layout: auto;
    width: max-content;
    min-width: 100%;
  }
  .month-matrix th,
  .month-matrix td {
    min-width: 34px;
    height: 34px;
  }
  .month-matrix .sticky-col {
    min-width: 72px;
    width: 72px;
    max-width: 72px;
  }
  .month-scroll {
    overflow-x: auto;
  }
}

@media (max-width: 576px) {
  .month-summary {
    grid-template-columns: 1fr 1fr;
  }
  .month-summary-card.tone-total {
    grid-column: 1 / -1;
  }
  .month-toolbar-hint {
    display: none;
  }
}

/* 按人汇总表格：紧凑展示（不撑满整行） */
.month-person-table {
  width: auto;
  min-width: 380px;
  font-size: 0.85rem;
}
.month-person-table th,
.month-person-table td {
  padding: 0.2rem 0.6rem;
  white-space: nowrap;
}
.month-person-table td:first-child,
.month-person-table th:first-child {
  text-align: center;
  color: #8a9b93;
}

/* ============================================================
   树形收缩菜单（nav-group）
   ============================================================ */
.side-nav .nav-group {
  margin-bottom: 2px;
}

/* 一级分组标题：品牌点缀色图标 + 展开箭头 */
.nav-group-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: rgba(255, 255, 255, 0.78);
  font-family: var(--font);
  font-size: 0.94rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-align: left;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease;
}

.nav-group-toggle > i:first-child {
  color: var(--accent, #c4a35a);
  font-size: 1.02rem;
}

.nav-group-toggle:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.nav-group-toggle .nav-arrow {
  margin-left: auto;
  font-size: 0.8rem;
  opacity: 0.6;
  transition: transform 0.25s ease;
}

.nav-group.open .nav-group-toggle .nav-arrow {
  transform: rotate(180deg);
}

/* 子项容器：左侧导轨线 + 平滑展开动画（max-height 过渡） */
.nav-group-items {
  max-height: 0;
  overflow: hidden;
  margin: 0 0 2px 21px;
  padding-left: 11px;
  border-left: 1px solid rgba(255, 255, 255, 0.14);
  transition: max-height 0.3s ease;
}

.nav-group.open .nav-group-items {
  max-height: 340px; /* 足够容纳所有子项 */
}

.nav-group-items a {
  position: relative;
  padding: 9px 12px 9px 13px;
  font-size: 0.9rem;
  margin-bottom: 2px;
  border-radius: 10px;
  color: rgba(255, 255, 255, 0.72);
}

.nav-group-items a i {
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.5);
}

.nav-group-items a:hover {
  background: rgba(255, 255, 255, 0.07);
  color: #fff;
}

/* 当前页子项：金色高亮 + 左侧指示条 */
.nav-group-items a.active {
  background: rgba(196, 163, 90, 0.2);
  color: #ffe9b8;
  box-shadow: inset 0 0 0 1px rgba(196, 163, 90, 0.32);
}

.nav-group-items a.active::before {
  content: '';
  position: absolute;
  left: -12px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 18px;
  border-radius: 3px;
  background: var(--accent, #c4a35a);
}

.nav-group-items a.active i {
  color: #ffe9b8;
}

/* ============================================================
   标签式页面（tabs-bar）
   ============================================================ */
.tabs-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 18px;
  padding: 6px 8px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow-x: auto;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
  white-space: nowrap;
}

.tabs-bar::-webkit-scrollbar {
  height: 5px;
}

.tabs-bar::-webkit-scrollbar-thumb {
  background: rgba(28, 43, 36, 0.18);
  border-radius: 3px;
}

.tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px 6px 12px;
  border-radius: 10px;
  font-size: 0.87rem;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: 0.15s ease;
  flex: 0 0 auto;
}

.tab:hover {
  background: var(--brand-soft);
  color: var(--brand-dark);
  text-decoration: none;
}

.tab.active {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
  box-shadow: 0 4px 12px rgba(47, 111, 94, 0.25);
}

.tab .tab-close {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: inherit;
  font-size: 1.05rem;
  line-height: 1;
  opacity: 0.6;
  cursor: pointer;
  transition: 0.15s ease;
}

.tab .tab-close:hover {
  background: rgba(0, 0, 0, 0.14);
  opacity: 1;
}

.tab.active .tab-close:hover {
  background: rgba(255, 255, 255, 0.22);
}

/* 移动端：标签栏加宽间距，便于点击 */
@media (max-width: 991.98px) {
  .tabs-bar {
    margin-bottom: 14px;
    margin-left: -2px;
    margin-right: -2px;
    padding: 6px;
  }
  .tab {
    padding: 7px 10px 7px 12px;
    font-size: 0.85rem;
  }
  .tab .tab-close {
    width: 22px;
    height: 22px;
  }
}

/* ============================================================
   发票拖拽上传区（dropzone）
   ============================================================ */
.dropzone {
  border: 2px dashed rgba(28, 43, 36, 0.28);
  border-radius: 16px;
  padding: 36px 24px;
  text-align: center;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.55);
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.15s ease;
  user-select: none;
}

.dropzone:hover,
.dropzone:focus-visible,
.dropzone.drag-over {
  border-color: var(--accent, #c4a35a);
  background: rgba(196, 163, 90, 0.08);
}

.dropzone.drag-over {
  transform: scale(1.01);
}

.dropzone > .bi {
  font-size: 2.4rem;
  color: var(--accent, #c4a35a);
  display: block;
  margin-bottom: 8px;
}

.dropzone .dropzone-title {
  font-size: 1.02rem;
  font-weight: 600;
  color: #243f36;
  margin: 0 0 4px;
}

.dropzone .dropzone-hint {
  font-size: 0.85rem;
  color: #7b8b84;
  margin: 0;
}

.dropzone .dropzone-file {
  display: inline-block;
  margin-top: 10px;
  padding: 4px 12px;
  border-radius: 20px;
  background: rgba(28, 43, 36, 0.08);
  font-size: 0.85rem;
  color: #243f36;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dropzone.uploading {
  pointer-events: none;
  opacity: 0.75;
}
