:root {
  --bg: #f5f7f4;
  --surface: #ffffff;
  --surface-2: #eef3ee;
  --ink: #17201b;
  --muted: #66736b;
  --line: #d8e0d8;
  --accent: #24715d;
  --accent-2: #2f5e9e;
  --warn: #c36b2d;
  --danger: #b9413d;
  --shadow: 0 18px 40px rgba(24, 38, 31, 0.08);
  --bp-tablet: 900px;
  --bp-mobile: 600px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--bg);
  font-family:
    "Microsoft JhengHei",
    "Noto Sans TC",
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}

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

button {
  cursor: pointer;
}

.app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(250px, 0.36fr) minmax(720px, 1fr);
  gap: 8px 18px;
  align-items: start;
  padding: 10px 16px;
  border-bottom: 1px solid rgba(216, 224, 216, 0.9);
  background:
    radial-gradient(circle at 8% 0%, rgba(220, 236, 223, 0.84), transparent 28%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(239, 245, 239, 0.95));
  box-shadow: 0 12px 34px rgba(24, 38, 31, 0.08);
  backdrop-filter: blur(14px);
}

.brand {
  display: flex;
  align-items: center;
  cursor: pointer;
  user-select: none;
  gap: 10px;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 8px;
  background: #dcecdf;
  color: #17201b;
  font-weight: 800;
}

.brand h1,
.brand p {
  margin: 0;
}

.brand h1 {
  color: var(--ink);
  font-size: clamp(18px, 1.75vw, 24px);
  line-height: 1;
  letter-spacing: -0.04em;
}

.brand p {
  color: var(--muted);
  font-size: 12px;
}

.topbar-brand {
  align-self: center;
  min-width: 0;
}

.topbar-brand > div:last-child,
.brand h1 {
  min-width: 0;
}

.brand h1 {
  overflow-wrap: anywhere;
}

.topbar-eyebrow {
  margin-bottom: 2px;
}

.user-title-highlight {
  display: inline-block;
  color: #b9413d;
  font-weight: 950;
  text-shadow: 0 9px 24px rgba(185, 65, 61, 0.16);
}

.topbar-more-toggle {
  display: none;
}

.month-action-btn {
  min-height: 40px;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 12px;
}

.topbar-controls {
  display: grid;
  grid-template-columns: auto auto minmax(130px, 0.75fr) minmax(180px, 1fr) minmax(130px, 0.65fr);
  align-items: end;
  justify-content: flex-end;
  justify-self: stretch;
  gap: 8px;
  min-width: 0;
  padding: 0 5px;
}

.topbar-control-field {
  min-width: 120px;
}

.topbar-control-field select {
  height: 40px;
}

.topbar-controls .workspace-switcher {
  max-width: 280px;
}

.topbar-controls .language-control {
  max-width: 180px;
}

.month-action-btn {
  flex: 0 0 auto;
  align-self: end;
  height: 40px;
  white-space: nowrap;
}

.workspace {
  flex: 1 0 auto;
  min-width: 0;
  padding: 30px clamp(18px, 3vw, 42px) 34px;
}

.topbar-more-panel {
  grid-column: 2;
}

.workspace-toolbar {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  justify-content: flex-end;
  margin-bottom: 18px;
}

.workspace-switcher {
  position: relative;
  width: auto;
}

.workspace-switcher select {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(247, 250, 247, 0.96));
  border-color: rgba(36, 113, 93, 0.22);
  box-shadow: 0 8px 22px rgba(19, 38, 29, 0.08);
}

.workspace-switch-status {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-height: 14px;
  color: var(--muted);
  font-size: 12px;
}

.workspace-create-btn {
  white-space: nowrap;
}

.language-control {
  width: auto;
}

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

.view {
  display: none;
  min-width: 0;
}

.view.active {
  display: block;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  min-width: 0 !important;
  height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  border: 0 !important;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.page-head,
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.page-head h2,
.panel-head h3 {
  margin: 0;
}

.page-head h2 {
  font-size: 30px;
}

.panel-head h3 {
  font-size: 18px;
}

.eyebrow,
.panel-head p {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 13px;
}

.field {
  display: grid;
  gap: 7px;
  color: inherit;
}

.field span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.compact-field span,
.topbar-control-field span,
.topbar-nav-field span {
  font-size: 11px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

input,
select,
textarea {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 8px 10px;
  outline: none;
}

textarea {
  min-height: 72px;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(36, 113, 93, 0.14);
}

.nav-tabs {
  display: grid;
  gap: 8px;
}

.topbar-primary-row {
  grid-column: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.topbar-nav {
  display: grid;
  grid-template-columns: repeat(4, minmax(92px, 132px));
  flex: 0 1 auto;
  align-self: center;
  min-width: 0;
  padding: 5px;
  border: 1px solid rgba(216, 224, 216, 0.9);
  border-radius: 18px;
  background: rgba(23, 32, 27, 0.06);
}

.topbar-account {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.mobile-bottom-nav {
  display: none;
}

.sidebar-meta {
  display: grid;
  gap: 12px;
  justify-items: start;
  margin-top: auto;
  padding-top: 12px;
  min-width: 0;
}

.sidebar-ghost {
  width: auto;
  min-height: 34px;
  border-color: #3a473f;
  background: transparent;
  color: #e0ebe3;
  padding: 7px 11px;
  font-size: 13px;
}

.build-version {
  display: grid;
  gap: 2px;
  align-content: center;
  flex: 0 0 auto;
  width: auto;
  min-width: 0;
  min-height: 44px;
}

.app-footer {
  display: flex;
  justify-content: flex-end;
  padding: 10px 18px 16px;
  color: var(--muted);
}

.app-footer .build-version {
  display: flex;
  gap: 8px;
  align-items: center;
  min-height: 0;
}

.build-version span {
  color: var(--muted);
  font-size: 11px;
}

.build-version strong {
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.nav-tab,
.primary-btn,
.secondary-btn,
.danger-btn,
.ghost-btn {
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  padding: 8px 12px;
  font-weight: 700;
}

a.primary-btn,
a.secondary-btn,
a.danger-btn,
a.ghost-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.nav-tab {
  text-align: center;
  background: transparent;
  color: var(--ink);
  transition: background 120ms ease, color 120ms ease, box-shadow 120ms ease;
}

.nav-tab:hover:not(.active) {
  background: rgba(36, 113, 93, 0.12);
  color: var(--accent);
}

.nav-tab.active {
  background: var(--accent);
  color: #ffffff;
  box-shadow: 0 6px 16px rgba(36, 113, 93, 0.22);
}

.nav-tab.active:hover {
  background: #1f6252;
}

.mobile-nav-tab {
  min-height: 56px;
  border: 0;
  border-radius: 0;
  padding: 8px 10px;
  background: transparent;
  color: var(--muted);
  display: grid;
  gap: 4px;
  justify-items: center;
  align-content: center;
  font-size: 11px;
  font-weight: 700;
}

.mobile-nav-tab.active {
  color: var(--accent);
}

.mobile-nav-tab .mobile-nav-icon {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
}

.mobile-nav-tab .mobile-nav-icon svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mobile-nav-tab.active .mobile-nav-icon svg {
  stroke: var(--accent);
}

.settings-section-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
  padding: 6px;
  border: 1px solid rgba(216, 224, 216, 0.9);
  border-radius: 18px;
  background: rgba(23, 32, 27, 0.04);
}

.settings-section-tab {
  min-height: 38px;
  border: 0;
  border-radius: 10px;
  padding: 8px 14px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  transition: background 120ms ease, color 120ms ease, box-shadow 120ms ease;
}

.settings-section-tab:hover:not(.active) {
  background: rgba(36, 113, 93, 0.10);
  color: var(--accent);
}

.settings-section-tab.active {
  background: #e5f1ec;
  color: var(--accent);
  box-shadow: inset 0 0 0 1px rgba(36, 113, 93, 0.14);
}

.settings-section-hidden {
  display: none !important;
}

.nav-tab:focus-visible,
.mobile-nav-tab:focus-visible,
.settings-section-tab:focus-visible,
.primary-btn:focus-visible,
.secondary-btn:focus-visible,
.danger-btn:focus-visible,
.ghost-btn:focus-visible,
.google-auth-btn:focus-visible,
.import-tab:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.primary-btn {
  background: var(--accent);
  color: #ffffff;
}

.secondary-btn {
  background: #dcecdf;
  color: #17201b;
}

.danger-btn {
  background: #f7e2df;
  color: #8d2f2a;
}

.danger-btn:hover {
  background: #efcbc6;
}

.ghost-btn {
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink);
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
}

.ghost-btn:hover {
  border-color: var(--accent);
  background: rgba(36, 113, 93, 0.1);
  color: var(--accent);
}

.google-auth-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  border: 1px solid rgba(28, 43, 38, 0.16);
  border-radius: 16px;
  background: #ffffff;
  color: var(--ink);
  font-weight: 800;
  text-decoration: none;
  box-shadow: 0 12px 28px rgba(28, 43, 38, 0.1);
  transition:
    transform 0.16s ease,
    border-color 0.16s ease,
    box-shadow 0.16s ease;
}

.google-auth-btn:hover {
  border-color: rgba(36, 113, 93, 0.34);
  box-shadow: 0 16px 34px rgba(28, 43, 38, 0.16);
  transform: translateY(-1px);
}

.google-auth-mark {
  display: inline-grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 50%;
  background:
    conic-gradient(from -45deg, #4285f4 0 25%, #34a853 0 50%, #fbbc05 0 75%, #ea4335 0 100%);
  color: #ffffff;
  font-size: 15px;
  font-weight: 900;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  height: 1px;
  flex: 1;
  background: rgba(28, 43, 38, 0.14);
}

button[aria-busy="true"],
button.is-loading {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}

button[aria-busy="true"]::after,
button.is-loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 16px;
  height: 16px;
  margin: -8px 0 0 -8px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  color: #ffffff;
  opacity: 0.9;
  animation: btn-spin 0.6s linear infinite;
}

.secondary-btn.is-loading::after,
.ghost-btn.is-loading::after,
.secondary-btn[aria-busy="true"]::after,
.ghost-btn[aria-busy="true"]::after {
  color: var(--accent);
}

@keyframes btn-spin {
  to {
    transform: rotate(360deg);
  }
}

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

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

.kpi {
  display: grid;
  gap: 8px;
  padding: 18px;
}

.kpi span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.kpi strong {
  font-size: 24px;
}

.overview-decision {
  display: block;
  margin-bottom: 18px;
  min-width: 0;
}

.decision-status-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px 18px;
  align-items: start;
  min-width: 0;
  border: 1px solid var(--line);
  border-left: 7px solid var(--accent);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff 0%, #fbfdfb 100%);
  box-shadow: var(--shadow);
  padding: 18px;
}

.decision-status-card h3,
.decision-status-card p {
  margin: 0;
}

.decision-status-card h3 {
  font-size: 24px;
}

.decision-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.status-dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 5px rgba(36, 113, 93, 0.12);
  flex: 0 0 auto;
}

.decision-status-card p {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.status-good {
  background: #dcecdf;
  color: #14513f;
}

.status-watch {
  background: #fff1d7;
  color: #8a4a0f;
}

.status-over {
  background: #f8dfdc;
  color: #8d2f2a;
}

.status-empty {
  background: #eef3f8;
  color: #24496f;
}

.status-pill--ok {
  background: #dcecdf;
  color: #14513f;
}

.status-pill--warning {
  background: #fff1d7;
  color: #8a4a0f;
}

.status-dot.status-watch {
  background: #c36b2d;
  box-shadow: 0 0 0 5px rgba(195, 107, 45, 0.13);
}

.status-dot.status-over {
  background: var(--danger);
  box-shadow: 0 0 0 5px rgba(185, 65, 61, 0.13);
}

.status-dot.status-empty {
  background: var(--accent-2);
  box-shadow: 0 0 0 5px rgba(47, 94, 158, 0.13);
}

.overview-onboarding {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid #cfded4;
  border-radius: 8px;
  background: #f5faf6;
  padding: 16px;
  margin-bottom: 18px;
  min-width: 0;
}

.overview-onboarding h3 {
  margin: 4px 0 0;
  color: #26332b;
  font-size: 17px;
  line-height: 1.4;
}

.onboarding-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.decision-summary-lines {
  display: grid;
  grid-column: 1 / -1;
  gap: 8px;
  min-width: 0;
  padding-top: 2px;
}

.decision-summary-lines p {
  margin: 0;
}

#statusMetricsLine,
#overviewDriverLine {
  color: #2d3831;
  font-size: 14px;
  font-weight: 700;
}

.decision-next-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.decision-next-line span {
  border-radius: 999px;
  background: #eef3ee;
  color: #405048;
  padding: 4px 12px;
  font-size: 13px;
  font-weight: 800;
}

.decision-next-line strong {
  font-size: 14px;
}

.panel {
  padding: 18px;
  margin-bottom: 18px;
  min-width: 0;
}

#weeklyChartPanel {
  scroll-margin-top: 96px;
}

.chart-wrap {
  position: relative;
  width: 100%;
  max-width: 100%;
  min-height: 310px;
}

.chart-empty,
.table-empty {
  display: grid;
  place-items: center;
  min-height: 220px;
  border: 1px dashed #cfded4;
  border-radius: 8px;
  background: #f8fbf8;
  color: var(--muted);
  padding: 18px;
  text-align: center;
  font-size: 14px;
  line-height: 1.45;
}

.table-empty {
  min-height: 120px;
}

#weeklyChart,
#monthlyTrendChart {
  display: block;
  width: 100%;
  max-width: 100%;
  cursor: pointer;
  height: 360px;
}

#monthlyTrendChart {
  height: 340px;
}

.chart-tooltip {
  position: absolute;
  z-index: 5;
  min-width: 190px;
  max-width: min(240px, calc(100% - 16px));
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow);
  padding: 10px;
  pointer-events: none;
  font-size: 13px;
}

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

.grocery-explainer {
  margin: 8px 0 0;
  color: #405048;
  font-size: 13px;
  line-height: 1.45;
}

.transaction-import-panel {
  border-color: #d8e4dc;
}

.import-period-line {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
  border-radius: 999px;
  background: #eef5ef;
  color: #405048;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 750;
}

.import-period-line strong {
  color: var(--ink);
}

.import-input-field {
  margin-bottom: 12px;
}

.import-input-field textarea {
  min-height: 120px;
  font-family: Consolas, "Courier New", monospace;
  font-size: 13px;
  line-height: 1.45;
}

.import-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.import-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.import-summary-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 12px;
  min-width: 0;
}

.import-summary-item span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.import-summary-item strong {
  display: block;
  margin-top: 4px;
  color: var(--ink);
  font-size: 18px;
  overflow-wrap: anywhere;
}

.import-warning {
  margin-top: 12px;
  border: 1px solid #e7c9aa;
  border-left-width: 4px;
  border-radius: 8px;
  background: #fffaf3;
  color: #8a4a0f;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.45;
}

.import-review {
  margin-top: 14px;
}

.import-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.import-tab {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  color: #405048;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.import-tab.active {
  border-color: var(--accent);
  background: #e8f3ec;
  color: var(--accent);
}

.import-rows {
  display: grid;
  gap: 10px;
}

.import-row-card {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.7fr) minmax(92px, 0.7fr) minmax(160px, 1fr) minmax(110px, 0.8fr);
  gap: 10px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 12px;
}

.import-row-card.import-row-review {
  border-color: #e7c9aa;
  background: #fffaf4;
}

.import-row-card.import-row-excluded {
  background: #f8faf8;
}

.import-cell {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.import-cell span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.import-cell strong,
.import-cell p {
  margin: 0;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.import-cell select {
  width: 100%;
  min-width: 0;
}

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

.import-empty {
  border: 1px dashed #cfded4;
  border-radius: 8px;
  background: #f8fbf8;
  color: var(--muted);
  padding: 16px;
  text-align: center;
  font-size: 13px;
}

.table-scroll {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  overflow-y: visible;
  overscroll-behavior-inline: contain;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 780px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 10px;
  text-align: left;
  vertical-align: top;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #edf4ee;
  color: #26332b;
  font-size: 12px;
}

td.amount,
th.amount {
  text-align: right;
  white-space: nowrap;
}

tr:hover td {
  background: #f8faf8;
}

.period-chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  outline: none;
}

.period-chip-code {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  border: 1px solid rgba(88, 80, 196, 0.22);
  border-radius: 999px;
  background: #f8f7ff;
  color: #3d35a6;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0.02em;
  box-shadow: 0 8px 18px rgba(88, 80, 196, 0.10);
}

.period-tooltip {
  position: absolute;
  left: 0;
  bottom: calc(100% + 8px);
  z-index: 6;
  width: max-content;
  max-width: min(240px, calc(100vw - 48px));
  transform: translate(0, 4px);
  border: 1px solid rgba(36, 49, 42, 0.12);
  border-radius: 8px;
  background: #17201b;
  color: #f7fbf7;
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 750;
  line-height: 1.35;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  box-shadow: 0 14px 30px rgba(23, 32, 27, 0.20);
  transition: opacity 140ms ease, transform 140ms ease;
}

.period-tooltip::after {
  content: "";
  position: absolute;
  left: 18px;
  top: 100%;
  width: 8px;
  height: 8px;
  transform: translate(0, -4px) rotate(45deg);
  background: #17201b;
}

.period-chip:hover .period-tooltip,
.period-chip:focus .period-tooltip,
.period-chip:focus-visible .period-tooltip {
  opacity: 1;
  transform: translate(0, 0);
}

.period-chip:focus .period-chip-code,
.period-chip:focus-visible .period-chip-code {
  box-shadow: 0 0 0 3px rgba(88, 80, 196, 0.18), 0 8px 18px rgba(88, 80, 196, 0.10);
}

.entry-layout {
  display: grid;
  gap: 18px;
}

.entry-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

.mobile-entry-savebar {
  display: none;
}

.mobile-entry-save-copy {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.mobile-entry-save-btn {
  min-height: 48px;
}

.save-status {
  margin: 0;
  color: var(--accent);
  font-size: 13px;
  font-weight: 750;
}

.weekly-entry-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(260px, 0.65fr);
  gap: 18px;
  align-items: start;
}

.weekly-basics-grid {
  align-content: start;
}

.entry-edit-banner {
  margin-bottom: 14px;
  border-left: 4px solid var(--accent-2);
  border-radius: 8px;
  background: #eef3f8;
  color: #24496f;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 700;
}

.entry-summary-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 12px 30px rgba(24, 38, 31, 0.07);
  overflow: hidden;
}

.entry-summary-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-areas:
    "icon label"
    "icon value";
  align-items: center;
  column-gap: 12px;
  min-width: 0;
  padding: 18px 20px;
}

.entry-summary-card + .entry-summary-card {
  border-left: 1px solid var(--line);
}

.entry-summary-icon {
  display: grid;
  grid-area: icon;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 999px;
  color: #0f6a45;
}

.entry-summary-icon svg {
  width: 34px;
  height: 34px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.entry-summary-label {
  grid-area: label;
  min-width: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.entry-summary-card strong {
  grid-area: value;
  min-width: 0;
  color: var(--ink);
  font-size: 21px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.entry-period-comparison {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-left-width: 4px;
  border-radius: 8px;
  background: #ffffff;
  padding: 12px 14px;
  min-width: 0;
}

.entry-period-comparison.status-good {
  border-left-color: var(--accent);
}

.entry-period-comparison.status-watch {
  border-left-color: #c36b2d;
}

.entry-period-comparison.status-over {
  border-left-color: var(--danger);
}

.entry-period-comparison.status-empty {
  border-left-color: var(--accent-2);
}

.entry-period-comparison h3 {
  margin: 3px 0 4px;
  font-size: 16px;
}

.entry-period-comparison p:not(.eyebrow) {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.live-summary-card {
  display: grid;
  gap: 12px;
  border-radius: 8px;
  border: 1px solid #dce7dd;
  background: linear-gradient(180deg, #f8fbf7 0%, #eef5ef 100%);
  padding: 14px;
}

.live-summary-card h3 {
  margin: 0;
  font-size: 18px;
}

.summary-copy {
  margin: 0;
  color: #4f5d55;
  font-size: 13px;
  line-height: 1.45;
}

.summary-formula-list {
  display: grid;
  gap: 10px;
  margin: 0;
}

.summary-formula-list div {
  display: grid;
  gap: 3px;
}

.summary-formula-list dt {
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

.summary-formula-list dd {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

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

.category-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.category-input-card {
  align-content: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #ffffff;
}

.category-input-card-rare {
  border-color: #e7c9aa;
  background: #fffaf4;
}

.category-hint {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.filters {
  grid-template-columns: 1fr 1fr 1.5fr 1fr;
  align-items: end;
}

.period-range-field {
  min-width: 0;
}

.period-timeline-warning {
  grid-column: 1 / -1;
  border: 1px solid #e7c9aa;
  border-left-width: 4px;
  border-radius: 8px;
  background: #fffaf3;
  color: #8a4a0f;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.45;
}

.date-range-inputs {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
}

.date-range-separator {
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
  white-space: nowrap;
}

.readonly input {
  background: var(--surface-2);
  font-weight: 800;
}

.note-field {
  margin-top: 14px;
}

.incidentals-panel summary {
  display: grid;
  gap: 4px;
  cursor: pointer;
  color: var(--warn);
  font-weight: 800;
}

.incidentals-panel summary small {
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.incidentals-panel {
  border-color: #f0c998;
  background: #fffaf3;
  box-shadow: 0 14px 34px rgba(195, 107, 45, 0.09);
}

.account-admin-panel,
.account-reset-panel,
.account-security-panel,
.workspace-management-panel,
.profile-panel,
.trial-requests-panel {
  border-color: rgba(36, 113, 93, 0.22);
  background:
    linear-gradient(135deg, rgba(241, 248, 244, 0.92), rgba(255, 255, 255, 0.98));
}

.profile-identity {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.profile-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
}

.trial-requests-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.trial-request-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  background: var(--bg);
  border-radius: 6px;
}

.trial-request-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.trial-request-info strong {
  font-size: 14px;
}

.trial-request-info span {
  font-size: 13px;
  color: var(--ink);
}

.trial-request-info small {
  font-size: 11px;
  color: var(--muted);
}

.use-request-btn {
  flex-shrink: 0;
}

.panel-highlight {
  animation: panel-highlight-pulse 1.4s ease;
}

@keyframes panel-highlight-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(36, 113, 93, 0.28);
  }
  45% {
    box-shadow: 0 0 0 8px rgba(36, 113, 93, 0.14);
  }
  100% {
    box-shadow: var(--shadow);
  }
}

.trial-card-request {
  padding: 28px;
  background: linear-gradient(135deg, rgba(241, 248, 244, 0.96), rgba(255, 255, 255, 0.98));
  border-left: 5px solid var(--accent);
  border-radius: 10px;
}

.trial-card-copy {
  font-size: 14px;
  color: var(--muted);
  margin: 6px 0 18px;
  line-height: 1.5;
}

.trial-request-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.trial-request-fields {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.trial-field {
  margin: 0;
}

.trial-field input,
.trial-field textarea {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  transition: border-color .15s;
  width: 100%;
  box-sizing: border-box;
}

.trial-field input:focus,
.trial-field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(36, 113, 93, 0.12);
}

.trial-field textarea {
  resize: vertical;
  min-height: 56px;
}

.trial-field span {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  margin-bottom: 4px;
  display: block;
}

.trial-field span small {
  font-weight: 400;
  color: var(--muted);
}

.trial-request-status {
  font-size: 13px;
  margin: 0;
  min-height: 20px;
}

.trial-request-cta {
  align-self: flex-start;
  padding: 10px 22px;
  font-size: 14px;
}

.account-admin-form,
.account-reset-form,
.account-security-form,
.workspace-management-form {
  display: grid;
  gap: 14px;
}

.managed-account-section {
  display: grid;
  gap: 12px;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid rgba(36, 113, 93, 0.14);
}

.managed-account-section h4 {
  margin: 0;
  color: var(--ink);
  font-size: 16px;
}

.managed-account-section p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.managed-account-list {
  display: grid;
  gap: 10px;
}

.managed-account-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border: 1px solid rgba(36, 113, 93, 0.16);
  border-radius: 12px;
  padding: 13px 14px;
  background: rgba(255, 255, 255, 0.78);
}

.managed-account-main {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.managed-account-main strong,
.managed-account-main span,
.managed-account-main small {
  overflow-wrap: anywhere;
}

.managed-account-main span,
.managed-account-note {
  color: var(--muted);
  font-size: 13px;
}

.managed-account-main small {
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.managed-account-status {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.account-admin-actions,
.account-reset-actions,
.account-security-actions,
.workspace-management-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.account-admin-actions .save-status[data-status="error"],
.account-reset-actions .save-status[data-status="error"],
.account-security-actions .save-status[data-status="error"],
.workspace-management-actions .save-status[data-status="error"] {
  color: var(--danger);
}

.account-security-identity,
.account-admin-result {
  border: 1px solid rgba(36, 113, 93, 0.18);
  border-radius: 10px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 14px 30px rgba(24, 38, 31, 0.06);
}

.account-security-identity strong,
.account-admin-result strong {
  display: block;
  margin-bottom: 10px;
  font-size: 16px;
}

.account-security-identity dl,
.account-admin-result dl {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 10px;
}

.account-security-identity div,
.account-admin-result div {
  min-width: 0;
}

.account-security-identity dt,
.account-admin-result dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.account-security-identity dd,
.account-admin-result dd {
  margin: 2px 0 0;
  overflow-wrap: anywhere;
  font-weight: 800;
}

.account-admin-result p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.incidentals-summary-title {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.incidentals-icon {
  display: inline-grid;
  width: 24px;
  height: 24px;
  place-items: center;
  color: #ef7d22;
  flex: 0 0 auto;
}

.incidentals-icon svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.save-toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 80;
  max-width: min(320px, calc(100vw - 36px));
  border-radius: 8px;
  background: #17201b;
  color: #ffffff;
  box-shadow: var(--shadow);
  padding: 12px 14px;
  font-weight: 750;
}

.onboarding-overlay {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
}

.onboarding-scrim {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 20, 0.24);
}

.onboarding-card {
  position: relative;
  z-index: 1;
  width: min(520px, calc(100vw - 32px));
  padding: 28px 28px 24px;
  border-radius: 24px;
  border: 1px solid rgba(20, 93, 204, 0.16);
  background: linear-gradient(180deg, #1f6fe5 0%, #1967d2 100%);
  box-shadow: 0 28px 72px rgba(17, 36, 74, 0.28);
  color: #ffffff;
  pointer-events: auto;
}

.onboarding-card .eyebrow {
  color: rgba(255, 255, 255, 0.74);
}

.onboarding-card--centered {
  transform: none;
}

.onboarding-progress {
  margin: 8px 0 0;
  color: rgba(255, 255, 255, 0.82);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.onboarding-card h3 {
  margin: 10px 0 0;
  color: #ffffff;
  font-size: 24px;
  line-height: 1.22;
}

.onboarding-card > p:last-of-type {
  margin: 14px 0 0;
  color: rgba(255, 255, 255, 0.9);
  font-size: 16px;
  line-height: 1.6;
}

.onboarding-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 22px;
}

.onboarding-action-group {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.onboarding-card .secondary-btn,
.onboarding-card .ghost-btn,
.onboarding-card .primary-btn {
  min-height: 48px;
}

.onboarding-card .secondary-btn,
.onboarding-card .ghost-btn {
  border-color: rgba(255, 255, 255, 0.34);
  background: #ffffff;
  color: #1a4fab;
}

.onboarding-card .primary-btn {
  border-color: rgba(255, 255, 255, 0.2);
  background: #ffffff;
  color: #195fc3;
}

.onboarding-card .secondary-btn:disabled {
  opacity: 0.55;
}

.onboarding-help-actions {
  justify-content: flex-start;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 3px 9px;
  background: #e7efe9;
  color: #275342;
  font-size: 12px;
  font-weight: 750;
}

.pill.warn {
  background: #faeadc;
  color: #8c4a1c;
}

.pill.danger {
  background: #f7e2df;
  color: #8d2f2a;
}

dialog {
  border: 0;
  border-radius: 8px;
  padding: 0;
  box-shadow: var(--shadow);
}

dialog.dialog-fallback-open {
  position: fixed;
  inset: 50% auto auto 50%;
  transform: translate(-50%, -50%);
  margin: 0;
  z-index: 30;
}

dialog::backdrop {
  background: rgba(18, 28, 23, 0.4);
}

body.dialog-open::before {
  content: "";
  position: fixed;
  inset: 0;
  background: rgba(18, 28, 23, 0.4);
  z-index: 20;
}

.dialog-card {
  display: grid;
  gap: 16px;
  width: min(420px, calc(100vw - 32px));
  padding: 20px;
}

.dialog-card h3 {
  margin: 0;
}

.dialog-message {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.app-modal-field {
  margin: 0;
}

.dialog-card.dialog-danger .primary-btn {
  background: var(--danger);
}

.dialog-card.dialog-danger .primary-btn:hover {
  background: #a3322e;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.hidden {
  display: none !important;
}

body.auth-checking,
body.auth-locked {
  overflow: hidden;
  background:
    radial-gradient(circle at top left, rgba(81, 146, 117, 0.16), transparent 34%),
    linear-gradient(135deg, #08110d 0%, #13231c 48%, #eef3ed 100%);
}

body.auth-checking .app-shell,
body.auth-locked .app-shell {
  display: none;
}

body.onboarding-open {
  overflow: hidden;
}

body.auth-checking #authOverlay,
body.auth-locked #authOverlay {
  display: grid;
  place-items: center;
}

body.auth-checking #authOverlay .auth-scene,
body.auth-locked #authOverlay .auth-scene {
  display: grid;
  min-height: auto;
  width: min(420px, 100%);
  place-items: center;
}

body.auth-checking #authOverlay .auth-marketing {
  display: none;
}

body.auth-locked #authOverlay .auth-marketing {
  display: block;
  width: 100%;
  padding: 0;
  color: var(--ink);
}

body.auth-locked #authOverlay .auth-marketing > :not(.landing-panel-grid) {
  display: none;
}

body.auth-locked #authOverlay .landing-panel-grid {
  display: block;
  width: 100%;
}

body.auth-locked #authOverlay .landing-panel-grid > :not(#trialAccessCard) {
  display: none;
}

body.auth-locked #trialAccessCard {
  width: 100%;
  max-width: none;
  border-radius: 8px;
  background: #ffffff;
}

body.auth-locked #authCheckingCard {
  display: none;
}

body.landing-open {
  overflow: hidden;
}

.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  overflow-y: auto;
  padding: clamp(20px, 4vw, 48px);
  background:
    radial-gradient(circle at 15% 15%, rgba(109, 181, 145, 0.34), transparent 28%),
    radial-gradient(circle at 85% 12%, rgba(244, 211, 163, 0.18), transparent 26%),
    linear-gradient(135deg, #08110d 0%, #14251e 46%, #eef3ed 100%);
}

.auth-overlay::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(120deg, rgba(255, 255, 255, 0.03), transparent 30%),
    linear-gradient(300deg, rgba(255, 255, 255, 0.04), transparent 24%);
  pointer-events: none;
}

.auth-scene {
  position: relative;
  z-index: 1;
  width: min(1260px, 100%);
  min-height: 100%;
  margin: 0 auto;
}

.auth-checking-card {
  display: grid;
  justify-items: center;
  gap: 10px;
  width: min(420px, 100%);
  border: 1px solid rgba(236, 243, 237, 0.2);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.94);
  padding: 34px 28px;
  color: var(--ink);
  text-align: center;
  box-shadow: 0 28px 70px rgba(3, 8, 6, 0.26);
}

.auth-checking-card h2,
.auth-checking-card p {
  margin: 0;
}

.auth-spinner {
  width: 34px;
  height: 34px;
  border: 3px solid rgba(36, 113, 93, 0.16);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: auth-spin 0.85s linear infinite;
}

@keyframes auth-spin {
  to {
    transform: rotate(360deg);
  }
}

.auth-marketing {
  display: grid;
  align-content: start;
  gap: 32px;
  color: #f5f8f3;
  padding: clamp(4px, 1vw, 12px);
}

.landing-brand {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.landing-brand .brand-mark {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 18px 40px rgba(3, 8, 6, 0.22);
}

.landing-brand h2 {
  margin: 2px 0 0;
  color: #f5f8f3;
  font-size: clamp(28px, 3vw, 38px);
  line-height: 1;
  letter-spacing: -0.03em;
}

.landing-language-field {
  margin-left: auto;
  min-width: 160px;
}

.landing-language-field span {
  color: rgba(227, 237, 231, 0.74);
}

.landing-language-field select {
  min-height: 42px;
  border-color: rgba(226, 234, 228, 0.2);
  background: rgba(255, 255, 255, 0.08);
  color: #f5f8f3;
  backdrop-filter: blur(8px);
}

.landing-language-field option {
  color: #102019;
}

.landing-eyebrow {
  margin-bottom: 4px;
  color: rgba(227, 237, 231, 0.74);
}

.landing-headline {
  max-width: 12ch;
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(34px, 4.1vw, 52px);
  line-height: 1.02;
  letter-spacing: -0.05em;
}

.landing-copy {
  max-width: 46ch;
  margin: 0;
  color: rgba(236, 242, 237, 0.84);
  font-size: 16px;
  line-height: 1.65;
}

.landing-hero {
  display: grid;
  grid-template-columns: minmax(320px, 0.62fr) minmax(520px, 1.18fr);
  gap: 36px;
  align-items: center;
}

.landing-copy-block {
  display: grid;
  gap: 18px;
  align-content: start;
  max-width: 440px;
}

.landing-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.landing-actions .primary-btn,
.landing-actions .ghost-btn {
  min-width: 168px;
  min-height: 48px;
  border-radius: 14px;
}

.landing-pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.landing-pill {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  border: 1px solid rgba(235, 242, 236, 0.16);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  color: rgba(244, 247, 243, 0.92);
  padding: 0 14px;
  font-size: 13px;
  font-weight: 700;
}

.landing-visual-stage {
  position: relative;
  min-height: 560px;
}

.landing-visual-stage::before {
  content: "";
  position: absolute;
  inset: 24px 40px 18px 18px;
  border-radius: 42px;
  background:
    radial-gradient(circle at 24% 22%, rgba(132, 191, 157, 0.24), transparent 34%),
    linear-gradient(160deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.02));
  filter: blur(0.2px);
}

.landing-visual-stage::after {
  content: "";
  position: absolute;
  inset: 12% 0 18% 20%;
  background:
    linear-gradient(115deg, rgba(197, 240, 214, 0.14), rgba(197, 240, 214, 0) 34%),
    linear-gradient(115deg, rgba(197, 240, 214, 0.1), rgba(197, 240, 214, 0) 48%);
  transform: skewX(-18deg);
  opacity: 0.9;
  pointer-events: none;
}

.product-shot {
  position: absolute;
  margin: 0;
  overflow: hidden;
  border: 1px solid rgba(239, 244, 240, 0.22);
  border-radius: 30px;
  background: rgba(10, 18, 14, 0.76);
  box-shadow: 0 38px 90px rgba(3, 8, 6, 0.34);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.product-shot img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center center;
}

.product-shot-main {
  inset: 6px 110px 118px 26px;
  min-height: 320px;
  transform: perspective(1400px) rotateY(-10deg) rotateX(5deg) rotateZ(-2deg);
}

.product-shot-detail {
  right: 28px;
  bottom: 18px;
  width: min(470px, 70%);
  height: 230px;
  transform: perspective(1200px) rotateY(-8deg) rotateX(8deg) rotateZ(1deg);
}

.visual-story-badge {
  position: absolute;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  border: 1px solid rgba(236, 243, 237, 0.18);
  border-radius: 999px;
  background: rgba(8, 17, 13, 0.68);
  color: rgba(244, 247, 243, 0.92);
  padding: 0 14px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  box-shadow: 0 16px 36px rgba(4, 10, 7, 0.22);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.visual-story-badge-top {
  top: 0;
  left: 24px;
}

.visual-story-badge-bottom {
  right: 34px;
  bottom: 0;
}

.visual-motion-line {
  position: absolute;
  z-index: 1;
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(190, 246, 213, 0), rgba(190, 246, 213, 0.64), rgba(190, 246, 213, 0));
  transform: rotate(-14deg);
  opacity: 0.7;
}

.visual-motion-line-1 {
  top: 26%;
  left: 8%;
  width: 54%;
}

.visual-motion-line-2 {
  top: 68%;
  left: 30%;
  width: 44%;
}

.visual-glow {
  position: absolute;
  z-index: 0;
  border-radius: 999px;
  filter: blur(44px);
  opacity: 0.5;
}

.visual-glow-main {
  right: 4%;
  top: 18%;
  width: 220px;
  height: 220px;
  background: radial-gradient(circle, rgba(183, 238, 206, 0.34), rgba(183, 238, 206, 0));
}

.landing-panel-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(280px, 0.72fr) minmax(320px, 0.78fr);
  gap: 18px;
}

.trial-card {
  display: grid;
  gap: 14px;
  border: 1px solid rgba(224, 232, 226, 0.16);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 26px 60px rgba(13, 24, 18, 0.18);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  padding: 24px;
}

.trial-card h3 {
  margin: 0;
  font-size: 24px;
  line-height: 1.15;
  color: #f6faf5;
}

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

.trial-list li {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.trial-step-number {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 999px;
  background: #e8f3ec;
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
}

.trial-list strong {
  display: block;
  margin-bottom: 4px;
  color: #f5f8f3;
  font-size: 15px;
}

.trial-list p {
  margin: 0;
  color: rgba(236, 242, 237, 0.72);
  font-size: 13px;
  line-height: 1.55;
}

.contact-card {
  display: grid;
  align-content: start;
  gap: 14px;
  border: 1px solid rgba(224, 232, 226, 0.16);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 26px 60px rgba(13, 24, 18, 0.18);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  padding: 24px;
}

.contact-card h3 {
  margin: 0;
  color: #f5f8f3;
  font-size: 24px;
}

.contact-card p:last-of-type {
  margin: 0;
  color: rgba(236, 242, 237, 0.78);
  font-size: 14px;
  line-height: 1.7;
}

.contact-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.auth-card {
  display: grid;
  gap: 16px;
  width: min(420px, 100%);
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.auth-card--landing {
  width: 100%;
  max-width: none;
  border-radius: 28px;
  padding: 24px;
  align-content: start;
}

.auth-form {
  display: grid;
  gap: 16px;
}

.auth-card h2 {
  margin: 0;
  font-size: 24px;
}

.auth-copy {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.auth-error {
  margin: 0;
  color: var(--danger);
  font-size: 13px;
  font-weight: 700;
}

.auth-submit {
  width: 100%;
  min-height: 48px;
  border-radius: 14px;
}

.auth-footnote {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.data-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.file-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.file-btn input {
  display: none;
}

@media (max-width: 900px) {
  .landing-hero,
  .landing-panel-grid {
    grid-template-columns: 1fr;
  }

  .landing-visual-stage {
    min-height: 470px;
  }
}

@media (max-width: 600px) {
  .auth-overlay {
    padding: 16px;
  }

  .onboarding-card {
    width: calc(100vw - 24px);
    padding: 20px;
  }

  .onboarding-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .onboarding-action-group {
    width: 100%;
    justify-content: stretch;
  }

  .onboarding-action-group > * {
    flex: 1 1 0;
  }

  .landing-headline {
    max-width: 100%;
    font-size: clamp(28px, 10vw, 40px);
  }

  .landing-visual-stage {
    min-height: 320px;
  }

  .product-shot-main {
    inset: 10px 32px 90px 0;
    min-height: 190px;
  }

  .product-shot-detail {
    right: 8px;
    width: min(240px, 72%);
    height: 110px;
  }

  .trial-card,
  .contact-card,
  .auth-card--landing {
    padding: 20px;
    border-radius: 24px;
  }
}

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

  .topbar-brand {
    justify-content: center;
    text-align: center;
  }

  .landing-language-field {
    margin-left: 0;
  }

  .topbar-primary-row {
    grid-column: auto;
    justify-self: stretch;
  }

  .topbar-controls {
    grid-column: auto;
    justify-self: stretch;
  }

  .kpi-grid,
  .weekly-entry-grid,
  .filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .weekly-entry-grid {
    grid-template-columns: 1fr;
  }

}

@media (min-width: 1181px) and (max-width: 1400px) {
  .topbar {
    grid-template-columns: minmax(240px, 0.34fr) minmax(700px, 1fr);
  }

  .topbar-controls {
    grid-column: 2;
  }
}

@media (max-width: 600px) {
  .topbar {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px 12px;
    align-items: start;
    padding: 10px 12px;
  }

  .workspace {
    padding: 18px 14px calc(92px + env(safe-area-inset-bottom));
  }

  .topbar-brand {
    grid-column: 1;
    justify-content: flex-start;
    text-align: left;
  }

  .topbar-primary-row {
    grid-column: 2;
    justify-self: end;
    align-items: flex-start;
  }

  .topbar-nav {
    display: none;
  }

  .topbar-account {
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 6px;
    max-width: 148px;
  }

  .topbar-more-toggle {
    display: inline-flex;
    min-height: 44px;
    white-space: nowrap;
  }

  .topbar-more-panel {
    grid-column: 1 / -1;
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    pointer-events: none;
    transition: max-height 180ms ease, opacity 180ms ease;
  }

  .topbar-more-panel.is-open {
    max-height: 420px;
    opacity: 1;
    pointer-events: auto;
  }

  .topbar-controls {
    grid-column: auto;
    grid-template-columns: 1fr;
    align-items: stretch;
    justify-content: stretch;
    padding: 8px 0 0;
  }

  .compact-field,
  .workspace-switcher,
  .language-control,
  .month-action-btn {
    width: 100%;
  }

  .workspace-switch-status {
    position: static;
  }

  .workspace-create-btn,
  .topbar-logout,
  .topbar-more-toggle {
    flex: 1 1 auto;
    min-width: 0;
  }

  .page-head,
  .panel-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .kpi-grid,
  .form-grid,
  .category-grid,
  .weekly-entry-grid,
  .filters,
  .account-security-identity dl,
  .account-admin-result dl {
    grid-template-columns: 1fr;
  }

  .kpi-grid {
    grid-template-columns: 1fr;
  }

  .entry-summary-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .entry-summary-card:last-child {
    grid-column: 1 / -1;
  }

  .decision-status-card {
    grid-template-columns: 1fr;
  }

  .status-pill {
    justify-self: start;
  }

  .entry-summary-card {
    padding: 14px;
  }

  .entry-summary-card + .entry-summary-card {
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .entry-summary-card:nth-child(2) {
    border-top: 0;
    border-left: 1px solid var(--line);
  }

  .entry-summary-card:last-child {
    border-left: 0;
  }

  .entry-period-comparison {
    align-items: stretch;
    flex-direction: column;
  }

  .page-head .entry-actions {
    display: none;
  }

  .mobile-entry-savebar {
    position: fixed;
    right: 14px;
    bottom: calc(74px + env(safe-area-inset-bottom));
    left: 14px;
    z-index: 26;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid rgba(216, 224, 216, 0.96);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 14px 28px rgba(24, 38, 31, 0.12);
    backdrop-filter: blur(16px);
  }

  .mobile-entry-save-btn {
    min-width: 120px;
  }

  #entryView .entry-layout {
    padding-bottom: 112px;
  }

  #weekSelect,
  #periodStartInput,
  #periodEndInput,
  #availableInput,
  #unpaidInput,
  .import-tab,
  #parseImportBtn,
  #applyImportBtn {
    min-height: 44px;
  }

  .date-range-inputs {
    grid-template-columns: 1fr;
  }

  .date-range-separator {
    justify-self: start;
  }

  .page-head h2 {
    font-size: 24px;
  }

  .panel {
    padding: 16px;
  }

  .overview-onboarding {
    align-items: stretch;
    flex-direction: column;
  }

  .onboarding-actions {
    justify-content: stretch;
  }

  .onboarding-actions .primary-btn,
  .onboarding-actions .secondary-btn {
    flex: 1 1 100%;
  }

  .import-summary {
    grid-template-columns: 1fr;
  }

  .import-actions .primary-btn,
  .import-actions .secondary-btn {
    flex: 1 1 100%;
  }

  .import-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }

  .import-tabs::-webkit-scrollbar {
    display: none;
  }

  .import-tab {
    flex: 0 0 auto;
  }

  .import-row-card {
    grid-template-columns: 1fr;
  }

  .import-row-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .import-row-actions .ghost-btn {
    width: 100%;
  }

  .chart-wrap {
    min-height: 280px;
  }

  #weeklyChart,
  #monthlyTrendChart {
    width: 100% !important;
    max-width: 100%;
    height: 300px;
  }

  #weeksTable,
  #historyTable {
    min-width: 0;
  }

  #weeksTable thead,
  #historyTable thead {
    display: none;
  }

  #weeksTable,
  #weeksTable tbody,
  #weeksTable tr,
  #weeksTable td,
  #historyTable,
  #historyTable tbody,
  #historyTable tr,
  #historyTable td {
    display: block;
    width: 100%;
  }

  #weeksTable tr,
  #historyTable tr {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    overflow: hidden;
  }

  #weeksTable tr + tr,
  #historyTable tr + tr {
    margin-top: 10px;
  }

  #weeksTable td,
  #historyTable td {
    display: grid;
    grid-template-columns: minmax(100px, 0.85fr) minmax(0, 1fr);
    gap: 12px;
    border-bottom: 1px solid var(--line);
    padding: 10px 12px;
    text-align: left;
    white-space: normal;
  }

  #weeksTable td:last-child,
  #historyTable td:last-child {
    border-bottom: 0;
  }

  #weeksTable td::before,
  #historyTable td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 12px;
    font-weight: 750;
  }

  #weeksTable td.amount,
  #historyTable td.amount {
    text-align: left;
    white-space: normal;
  }

  #weeksTable .period-chip {
    justify-self: start;
  }

  #weeksTable .period-tooltip {
    max-width: min(220px, calc(100vw - 48px));
  }

  .mobile-bottom-nav {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 30;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    border-top: 1px solid rgba(216, 224, 216, 0.96);
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(16px);
    box-shadow: 0 -12px 28px rgba(24, 38, 31, 0.10);
    padding-bottom: env(safe-area-inset-bottom);
  }

  .settings-section-nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

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

  .topbar-more-panel {
    transition: none;
  }
}
