/* ==========================================================================
   RayHub · 暖调 Bento 运营控制台
   品牌色板：奶油白 #FAF7ED · 炭黑 #242629 · 灰鼠尾草绿 #789285 · 珊瑚橘 #EA7853 · 蜜糖黄 #F4C165
   ========================================================================== */

:root {
  --cream-bg: #faf7ed;
  --cream-subtle: #f1ede1;
  --cream-card: #fdfbf4;
  --charcoal: #242629;
  --charcoal-soft: #313438;
  --charcoal-muted: #a6aba3;

  --sage: #789285;
  --sage-ink: #456653;
  --sage-hover: #324e3d;
  --sage-tint: rgba(120, 146, 133, 0.13);

  --coral: #ea7853;
  --coral-ink: #b94b28;
  --coral-tint: rgba(234, 120, 83, 0.14);

  --honey: #f4c165;
  --amber-ink: #80550e;
  --amber-bg: rgba(244, 193, 101, 0.24);

  --red-ink: #a13d3d;
  --red-bg: rgba(161, 61, 61, 0.11);

  --border: #e3dfd1;
  --border-strong: #d0cab8;
  --text-normal: #242629;
  --text-muted: #62655e;

  --shadow-sm: 0 1px 2px rgba(36, 38, 41, 0.04);
  --shadow-md: 0 10px 28px -12px rgba(36, 38, 41, 0.14);
  --shadow-dark: 0 16px 34px -14px rgba(36, 38, 41, 0.34);

  --r-sm: 8px;
  --r-md: 14px;
  --r-lg: 20px;

  --font-sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 15px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--cream-bg);
  color: var(--text-normal);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  font-variant-numeric: tabular-nums;
}

a {
  color: var(--sage-ink);
  text-decoration: none;
  transition: color 160ms var(--ease), background-color 160ms var(--ease), border-color 160ms var(--ease);
}

a:hover {
  color: var(--sage-hover);
}

:is(a, select, input, summary, button):focus-visible {
  outline: 2px solid var(--coral);
  outline-offset: 2px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 10px;
  z-index: 100;
  padding: 6px 12px;
  background: var(--charcoal);
  color: var(--cream-bg);
  border-radius: var(--r-sm);
  font-size: 13px;
}

.skip-link:focus {
  left: 14px;
  color: var(--cream-bg);
}

/* ---------- Topbar Navigation ---------- */
.topbar-wrap {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(250, 247, 237, 0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 28px;
  min-height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--text-normal);
  white-space: nowrap;
}

.brand-lockup:hover {
  color: var(--text-normal);
}

.brand-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid var(--border-strong);
}

.brand-title {
  font-size: 1.15rem;
  font-weight: 750;
  letter-spacing: -0.02em;
}

.brand-sub {
  color: var(--text-muted);
  font-size: 13px;
  padding-left: 10px;
  border-left: 1px solid var(--border);
}

.nav-pills {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  background: var(--cream-subtle);
  border-radius: 999px;
  border: 1px solid var(--border);
}

.nav-pill {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 4px 14px;
  border-radius: 999px;
  color: var(--text-muted);
  font-size: 13.5px;
  font-weight: 550;
  white-space: nowrap;
}

.nav-pill:hover {
  color: var(--text-normal);
}

.nav-pill[aria-current="page"] {
  background: var(--charcoal);
  color: var(--cream-bg);
  font-weight: 600;
}

.logout-form {
  margin: 0;
}

.btn-logout {
  min-height: 34px;
  padding: 5px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: color 160ms var(--ease), background-color 160ms var(--ease), border-color 160ms var(--ease);
}

.btn-logout:hover {
  color: var(--text-normal);
  background: var(--cream-card);
  border-color: var(--charcoal);
}

/* ---------- Workspace Shell ---------- */
.bento-shell {
  max-width: 1320px;
  margin: 0 auto;
  padding: 24px 28px 56px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 20px;
}

/* ---------- First-Screen Asymmetric Bento (Left Charcoal + Right Chart) ---------- */
.hero-bento {
  display: grid;
  grid-template-columns: minmax(300px, 4.2fr) minmax(0, 7.8fr);
  gap: 18px;
  align-items: stretch;
}

.charcoal-card {
  background: var(--charcoal);
  color: var(--cream-bg);
  border-radius: var(--r-lg);
  padding: 24px;
  box-shadow: var(--shadow-dark);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 20px;
  position: relative;
  overflow: hidden;
}

.charcoal-card::after {
  content: "";
  position: absolute;
  right: -46px;
  top: -46px;
  width: 170px;
  height: 170px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(234, 120, 83, 0.18) 0%, rgba(120, 146, 133, 0.06) 55%, transparent 72%);
  pointer-events: none;
}

.charcoal-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.charcoal-date-tag {
  font-size: 13px;
  color: var(--charcoal-muted);
}

.fresh-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: rgba(120, 146, 133, 0.24);
  color: #cfe0d6;
}

.fresh-chip.is-warn {
  background: rgba(244, 193, 101, 0.2);
  color: var(--honey);
}

.fresh-chip.is-bad {
  background: rgba(234, 120, 83, 0.24);
  color: #ffb49c;
}

.hero-metric-block {
  display: grid;
  gap: 4px;
}

.hero-metric-label {
  font-size: 13px;
  color: var(--charcoal-muted);
}

.hero-metric-row {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}

.hero-big-num {
  font-size: 46px;
  font-weight: 750;
  line-height: 1.05;
  letter-spacing: -0.03em;
  color: var(--cream-bg);
}

.hero-delta-tag {
  font-size: 13px;
  color: #b9d0c2;
  font-weight: 550;
}

.hero-sub-note {
  font-size: 13px;
  color: var(--charcoal-muted);
}

.spotlight-divider {
  height: 1px;
  background: rgba(250, 247, 237, 0.11);
}

.charcoal-highlights {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.highlight-item {
  display: grid;
  gap: 3px;
}

.highlight-kicker {
  font-size: 12px;
  color: var(--charcoal-muted);
}

.highlight-val {
  font-size: 22px;
  font-weight: 700;
  color: var(--coral);
  line-height: 1.2;
}

.highlight-val.is-honey {
  color: var(--honey);
}

.highlight-desc {
  font-size: 12px;
  color: rgba(250, 247, 237, 0.72);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.health-bar-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--r-md);
  background: var(--charcoal-soft);
  color: var(--cream-bg);
  font-size: 13px;
  transition: background-color 160ms var(--ease);
}

.health-bar-link:hover {
  background: #3a3e43;
  color: var(--cream-bg);
}

.health-dots {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.health-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.health-dot.is-success {
  background: #87b59c;
}

.health-dot.is-partial {
  background: var(--honey);
}

.health-dot.is-failed {
  background: var(--coral);
}

/* ---------- Right Stage: Interactive Trend Panel ---------- */
.bento-card {
  min-width: 0;
  background: var(--cream-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 22px 24px;
  box-shadow: var(--shadow-sm);
}

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

.stage-head.is-compact {
  margin-bottom: 0;
}

.stage-head.is-tight {
  margin-bottom: 12px;
}

.stage-title-area h2,
.section-heading {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  color: var(--text-normal);
  letter-spacing: -0.01em;
}

.stage-caption {
  margin: 3px 0 0;
  font-size: 13px;
  color: var(--text-muted);
}

.stage-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.seg-group {
  display: inline-flex;
  flex-wrap: wrap;
  padding: 3px;
  background: var(--cream-subtle);
  border: 1px solid var(--border);
  border-radius: 999px;
  gap: 2px;
}

.seg-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 4px 12px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 13px;
  font-weight: 550;
  cursor: pointer;
  white-space: nowrap;
  transition: color 150ms var(--ease), background-color 150ms var(--ease);
}

.seg-btn:hover {
  color: var(--text-normal);
}

.seg-btn[aria-selected="true"],
.seg-btn[aria-current="page"] {
  background: var(--cream-card);
  color: var(--text-normal);
  font-weight: 650;
  box-shadow: 0 1px 3px rgba(36, 38, 41, 0.08);
}

.bento-select,
.bento-date,
.bento-input {
  min-height: 34px;
  padding: 4px 11px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  background: var(--cream-bg);
  color: var(--text-normal);
  font: inherit;
  font-size: 13px;
}

.bento-select,
.bento-date {
  cursor: pointer;
}

.filter-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px 12px;
}

.filter-field {
  display: grid;
  gap: 4px;
  font-size: 12.5px;
  color: var(--text-muted);
}

.bento-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 34px;
  padding: 5px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  background: var(--cream-bg);
  color: var(--text-normal);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 150ms var(--ease), border-color 150ms var(--ease), color 150ms var(--ease);
}

.bento-btn:hover {
  border-color: var(--sage);
  background: var(--sage-tint);
  color: var(--sage-hover);
}

.bento-btn[aria-pressed="true"] {
  background: var(--charcoal);
  border-color: var(--charcoal);
  color: var(--cream-bg);
}

.bento-btn[aria-pressed="true"]:hover {
  background: #36393e;
  border-color: #36393e;
  color: var(--cream-bg);
}

.bento-btn-dark {
  background: var(--charcoal);
  border-color: var(--charcoal);
  color: var(--cream-bg);
}

.bento-btn-dark:hover {
  background: #36393e;
  border-color: #36393e;
  color: var(--cream-bg);
}

.bento-btn-danger {
  color: var(--red-ink);
  background: var(--red-bg);
  border-color: rgba(161, 61, 61, 0.25);
}

.bento-btn-danger:hover {
  color: var(--red-ink);
  background: rgba(161, 61, 61, 0.18);
  border-color: var(--red-ink);
}

/* ---------- Chart Surface ---------- */
.chart-stage {
  position: relative;
}

.chart-stage > svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.chart-stage > svg text {
  fill: var(--text-muted);
  font-size: 12px;
  font-family: var(--font-sans);
}

.chart-gridline {
  stroke: var(--border);
  stroke-width: 1;
}

.chart-hover-layer {
  fill: transparent;
  pointer-events: all;
  cursor: crosshair;
}

.chart-hover-line {
  stroke: var(--coral);
  stroke-width: 1.2;
  stroke-dasharray: 3 3;
  opacity: 0;
  pointer-events: none;
}

.chart-hover-dot {
  stroke: var(--cream-card);
  stroke-width: 2;
  pointer-events: none;
}

.chart-tooltip {
  position: absolute;
  z-index: 10;
  min-width: 175px;
  max-width: 255px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--charcoal);
  color: var(--cream-bg);
  box-shadow: var(--shadow-dark);
  font-size: 12.5px;
  line-height: 1.5;
  pointer-events: none;
}

.chart-tooltip[hidden] {
  display: none;
}

.chart-tooltip strong {
  display: block;
  margin-bottom: 5px;
  font-size: 13px;
  color: var(--honey);
}

.tooltip-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 3px;
}

.tooltip-list li {
  display: flex;
  align-items: center;
  gap: 6px;
}

.tooltip-val {
  margin-left: auto;
  font-weight: 650;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  font-size: 13px;
  color: var(--text-muted);
}

.chart-legend li {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}

.chart-legend-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
  transition: background-color 150ms var(--ease), border-color 150ms var(--ease), opacity 150ms var(--ease);
}

.chart-legend-btn:hover {
  background: var(--cream-subtle);
  border-color: var(--border);
  color: var(--text-normal);
}

.chart-legend-btn[aria-pressed="false"] {
  opacity: 0.42;
  text-decoration: line-through;
}

.chart-legend strong {
  color: var(--text-normal);
  font-weight: 650;
}

.chart-series {
  transition: opacity 150ms var(--ease);
}

.chart-series.is-dimmed {
  opacity: 0.16;
}

/* ---------- 5-Platform Horizontal Pulse Strip ---------- */
.section-head-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-bottom: 12px;
}

.pulse-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.pulse-tile {
  background: var(--cream-card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
  color: var(--text-normal);
  position: relative;
  transition: transform 180ms var(--ease), border-color 180ms var(--ease), box-shadow 180ms var(--ease);
}

.pulse-tile:hover {
  transform: translateY(-2px);
  border-color: var(--sage);
  box-shadow: var(--shadow-md);
  color: var(--text-normal);
}

.pulse-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.pulse-plat {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 14px;
  font-weight: 650;
}

.plat-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-block;
}

.pulse-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.pulse-status-dot.is-success {
  background: var(--sage);
}

.pulse-status-dot.is-partial {
  background: var(--honey);
}

.pulse-status-dot.is-failed {
  background: var(--coral);
}

.pulse-main-val {
  font-size: 26px;
  font-weight: 750;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--text-normal);
}

.pulse-main-label {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 2px;
}

.pulse-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  font-size: 12.5px;
  color: var(--text-muted);
}

/* ---------- Works Spotlight Grid ---------- */
.works-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.work-tile {
  background: var(--cream-card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
  transition: border-color 160ms var(--ease), box-shadow 160ms var(--ease);
}

.work-tile:hover {
  border-color: var(--sage);
  box-shadow: var(--shadow-md);
}

.work-tile[hidden] {
  display: none;
}

.work-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12.5px;
  color: var(--text-muted);
}

.work-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--cream-subtle);
  color: var(--text-normal);
  font-weight: 600;
}

.work-title {
  margin: 0;
  font-size: 15.5px;
  font-weight: 650;
  line-height: 1.45;
}

.work-head + .work-title {
  margin-top: 10px;
}

.works-count {
  margin-left: 8px;
}

.work-card-cta {
  margin-left: auto;
  color: var(--sage-ink);
  font-weight: 600;
}

.work-dialog-meta {
  justify-content: flex-start;
  gap: 10px;
}

.work-dialog-section-title {
  font-size: 15px;
  margin-bottom: 8px;
}

.pagination-row {
  justify-content: flex-end;
}

.work-title a {
  color: var(--text-normal);
}

.work-title a:hover {
  color: var(--sage-ink);
}

.work-num-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.work-big-num {
  font-size: 28px;
  font-weight: 750;
  letter-spacing: -0.02em;
  color: var(--text-normal);
}

.work-delta-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--coral-tint);
  color: var(--coral-ink);
  font-size: 12.5px;
  font-weight: 650;
}

.work-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  font-size: 12.5px;
  color: var(--text-muted);
}

.work-meta-row a {
  margin-left: auto;
  font-weight: 550;
}

.muted-line {
  margin: 10px 0 0;
  color: var(--text-muted);
  font-size: 13px;
}

.muted-line.is-flush {
  margin: 0;
}

.tone-amber {
  color: var(--amber-ink);
}

.inline-note {
  display: inline;
}

.nowrap {
  white-space: nowrap;
}

/* ---------- Semantic Status Pills & Tables (Subpages) ---------- */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.status-pill.is-success {
  background: var(--sage-tint);
  color: var(--sage-ink);
}

.status-pill.is-partial {
  background: var(--amber-bg);
  color: var(--amber-ink);
}

.status-pill.is-failed {
  background: var(--red-bg);
  color: var(--red-ink);
}

.status-pill.is-missing {
  background: var(--amber-bg);
  color: var(--amber-ink);
}

.status-pill.is-uncollected {
  background: var(--cream-subtle);
  color: var(--text-muted);
}

.tone-positive {
  color: var(--sage-ink);
  font-weight: 650;
}

.tone-negative {
  color: var(--coral-ink);
  font-weight: 650;
}

.tone-zero,
.tone-missing {
  color: var(--text-muted);
}

.table-scroll {
  min-width: 0;
  overflow-x: auto;
}

.bento-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.bento-table th,
.bento-table td {
  padding: 10px 10px;
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid var(--border);
}

.bento-table thead th {
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 550;
  white-space: nowrap;
}

.bento-table tbody tr:last-child th,
.bento-table tbody tr:last-child td {
  border-bottom: none;
}

.bento-table tbody tr:hover {
  background: rgba(120, 146, 133, 0.06);
}

.bento-table .num {
  text-align: right;
  white-space: nowrap;
}

.bento-table small {
  display: block;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 400;
}

.sticky-col {
  position: sticky;
  left: 0;
  background: var(--cream-card);
  z-index: 1;
}

.bento-table tbody tr:hover .sticky-col {
  background: #f5f5ec;
  background: color-mix(in srgb, var(--sage) 6%, var(--cream-card));
}

/* Single-Metric Subpage Chart */
.subpage-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px 20px;
}

.subpage-head h1 {
  margin: 0;
  font-size: 24px;
  font-weight: 750;
  letter-spacing: -0.02em;
}

.subpage-sub {
  margin: 4px 0 0;
  color: var(--text-muted);
  font-size: 13.5px;
}

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

.trend-mini-stat {
  padding: 10px 14px;
  border-radius: var(--r-sm);
  background: var(--cream-bg);
  border: 1px solid var(--border);
}

.trend-mini-label {
  color: var(--text-muted);
  font-size: 12px;
}

.trend-mini-val {
  margin-top: 2px;
  font-size: 15px;
  font-weight: 650;
}

.trend-readout-box {
  padding: 8px 14px;
  border-radius: var(--r-sm);
  background: var(--charcoal);
  color: var(--cream-bg);
  font-size: 12.5px;
}

.trend-readout-box .stage-caption {
  color: var(--charcoal-muted);
}

.single-solid-path {
  fill: none;
  stroke-width: 2.3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.single-gap-line {
  stroke: #9ca095;
  stroke-width: 1.5;
  stroke-dasharray: 4 4;
}

.single-point {
  cursor: pointer;
}

.single-point.is-zero {
  fill: var(--cream-card) !important;
  stroke-width: 2.4;
}

.single-miss-marker {
  cursor: pointer;
  fill: var(--cream-subtle);
  stroke: #9ca095;
  stroke-width: 1.4;
}

.single-point.is-active {
  stroke-width: 3;
  filter: drop-shadow(0 0 4px rgba(36, 38, 41, 0.25));
}

.single-miss-marker.is-active {
  stroke: var(--coral);
  stroke-width: 2;
}

/* ---------- Daily Timeline Accordion (Zero Horizontal Overflow) ---------- */
.day-timeline {
  display: grid;
  gap: 8px;
}

.day-row {
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--cream-bg);
  overflow: hidden;
}

.day-row.is-missed {
  background: rgba(241, 237, 225, 0.55);
}

.day-row.is-missed .day-summary {
  cursor: default;
}

.day-summary {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  padding: 12px 16px;
  cursor: pointer;
  user-select: none;
}

.day-summary::-webkit-details-marker {
  display: none;
}

.day-summary:hover {
  background: rgba(120, 146, 133, 0.06);
}

.day-summary-left {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 12px;
}

.day-date {
  font-weight: 700;
  font-size: 14.5px;
  color: var(--text-normal);
}

.day-time {
  font-size: 12.5px;
  color: var(--text-muted);
}

.day-summary-right {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  font-size: 13px;
}

.day-toggle-hint {
  color: var(--sage-ink);
  font-size: 12.5px;
  font-weight: 550;
}

.day-row[open] .day-toggle-hint {
  color: var(--text-muted);
}

.day-metrics-body {
  padding: 14px 16px 16px;
  border-top: 1px solid var(--border);
  background: var(--cream-card);
}

.day-metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
}

.day-metric-item {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--cream-bg);
  display: grid;
  gap: 4px;
  align-content: start;
}

.day-metric-item.is-active {
  border-color: var(--sage);
  background: rgba(120, 146, 133, 0.08);
}

.day-metric-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
  font-size: 12.5px;
  color: var(--text-muted);
}

.day-metric-name {
  font-weight: 600;
  color: var(--text-normal);
}

.day-metric-val {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-normal);
}

.day-metric-foot {
  font-size: 12px;
  color: var(--text-muted);
}

/* ---------- Compact Work Cards & Native <dialog> Modal ---------- */
.work-card-btn {
  text-align: left;
  width: 100%;
  font: inherit;
  cursor: pointer;
}

.work-card-btn:hover {
  transform: translateY(-2px);
}

.work-dialog {
  width: min(760px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  margin: auto;
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-lg);
  background: var(--cream-card);
  color: var(--text-normal);
  box-shadow: var(--shadow-dark);
}

.work-dialog::backdrop {
  background: rgba(36, 38, 41, 0.48);
  backdrop-filter: blur(4px);
}

.work-dialog-inner {
  display: grid;
  max-height: calc(100vh - 50px);
  grid-template-rows: auto 1fr auto;
}

.work-dialog-head {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.work-dialog-head h2 {
  margin: 6px 0 4px;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.4;
}

.work-dialog-body {
  padding: 18px 22px;
  overflow-y: auto;
  display: grid;
  gap: 18px;
}

.work-dialog-foot {
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  background: var(--cream-bg);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.dialog-close-btn {
  min-width: 34px;
  min-height: 34px;
  padding: 4px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  background: var(--cream-bg);
  color: var(--text-normal);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  flex-shrink: 0;
}

.dialog-close-btn:hover {
  background: var(--cream-subtle);
  border-color: var(--charcoal);
}

/* ---------- Login Page ---------- */
.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-card {
  width: 100%;
  max-width: 410px;
  padding: 34px 30px;
  border-radius: var(--r-lg);
  background: var(--cream-card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}

.auth-avatar {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--cream-bg);
  box-shadow: 0 0 0 1px var(--border-strong);
}

.auth-card h1 {
  margin: 0;
  font-size: 21px;
  font-weight: 750;
}

.auth-slogan {
  margin: 2px 0 0;
  color: var(--text-muted);
  font-size: 13px;
}

.auth-alert {
  padding: 9px 12px;
  margin-bottom: 16px;
  border-radius: var(--r-sm);
  background: var(--red-bg);
  color: var(--red-ink);
  font-size: 13px;
}

.auth-field {
  display: grid;
  gap: 6px;
  margin-bottom: 16px;
}

.auth-field label {
  font-size: 13px;
  font-weight: 600;
}

.auth-input-row {
  display: flex;
  gap: 8px;
}

.auth-input-row input {
  flex: 1;
  min-height: 42px;
  padding: 6px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  background: var(--cream-bg);
  color: var(--text-normal);
  font: inherit;
}

.auth-submit {
  width: 100%;
  min-height: 42px;
}

/* ---------- Footer ---------- */
.bento-footer {
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 28px 36px;
  color: var(--text-muted);
  font-size: 12.5px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 6px 16px;
}

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
  .hero-bento {
    grid-template-columns: 1fr;
  }
  .pulse-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .works-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .topbar-inner {
    padding: 10px 16px;
    flex-wrap: wrap;
    gap: 10px;
  }
  .brand-sub {
    display: none;
  }
  .nav-pills {
    order: 3;
    width: 100%;
    overflow-x: auto;
  }
  .bento-shell {
    padding: 16px 16px 40px;
  }
  .pulse-grid,
  .works-grid,
  .trend-summary-bar {
    grid-template-columns: 1fr;
  }
  .bento-footer {
    padding: 0 16px 28px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---------- Settings ---------- */
.settings-page h1 {
  margin: 0 0 18px;
  font-size: clamp(1.65rem, 4vw, 2.15rem);
}

.settings-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr);
  align-items: start;
  gap: 16px;
}

.settings-side {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.settings-card {
  min-width: 0;
  padding: clamp(16px, 3vw, 24px);
}

.settings-card h2,
.settings-card h3 {
  margin: 0;
}

.settings-card h2 {
  font-size: 1.2rem;
}

.settings-card h3 {
  margin-top: 24px;
  font-size: 1rem;
}

.settings-card p {
  margin: 8px 0 16px;
}

.settings-card .muted-line {
  margin: 8px 0 0;
}

.settings-field-spaced {
  margin-top: 12px;
}

.settings-card label,
.settings-field {
  display: grid;
  gap: 5px;
  min-width: 0;
  color: var(--text-normal);
  font-weight: 600;
}

.settings-card input:not([type="hidden"]),
.settings-card select {
  width: 100%;
  min-width: 0;
  min-height: 36px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  padding: 5px 11px;
  background: var(--cream-bg);
  color: var(--text-normal);
  font: inherit;
  font-size: 13.5px;
  font-weight: 400;
}

.settings-card input[readonly] {
  font-family: ui-monospace, monospace;
}

.settings-card > label {
  margin: 12px 0 5px;
}

.settings-issue,
.settings-timezone,
.settings-key-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  align-items: end;
  gap: 8px;
}

.settings-issue {
  grid-template-columns: minmax(0, 1fr) minmax(6em, max-content) max-content;
}

.settings-timezone {
  margin-top: 12px;
}

.settings-revoke summary {
  list-style: none;
}

.settings-revoke summary::-webkit-details-marker {
  display: none;
}

.settings-revoke[open] summary {
  background: var(--cream-subtle);
}

.settings-notice {
  padding: 12px;
  margin: 0 0 12px;
  border-radius: var(--r-sm);
  background: var(--sage-tint);
}

.settings-error {
  background: var(--red-bg);
  color: var(--red-ink);
}

.settings-key-row {
  margin: 6px 0;
}

.settings-keys {
  list-style: none;
  margin: 6px 0 0;
  padding: 0;
}

.settings-keys li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: start;
  gap: 8px;
  padding: 8px 0;
  border-top: 1px solid var(--border);
}

.settings-key-name {
  overflow-wrap: anywhere;
  padding: 10px 0;
}

.settings-scope {
  margin-top: 9px;
  padding: 2px 8px;
  border-radius: 99px;
  background: var(--cream-subtle);
}

.settings-revoke form {
  margin-top: 6px;
}

.settings-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}

@media (max-width: 780px) {
  .settings-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 420px) {
  .nav-pill {
    padding-inline: 9px;
  }

  .settings-issue {
    grid-template-columns: minmax(0, 1fr) max-content;
  }

  .settings-issue > label {
    grid-column: 1 / -1;
  }
}
