@import url("https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Libre+Caslon+Display&display=swap");
:root {
  --canvas: #0b0d0e;
  --surface: #141719;
  --raised: #202326;
  --ink: #e8e5dd;
  --muted: #b0ada5;
  --border: #343638;
  --accent: #e8b04b;
  --accent-soft: #332918;
  --accent-text: #e8b04b;
  --orange: #e8b04b;
  --review: #332918;
  --red: #e9a29a;
  --error-bg: #321e1b;
  --error-border: #624238;
  --poster-brightness: 0.72;
  color-scheme: dark;
  --radius: 12px;
  font-family: "DM Sans", system-ui, sans-serif;
  color: var(--ink);
  background: var(--canvas);
  font-synthesis: none;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
button,
input,
select,
textarea {
  font: inherit;
}
button,
a,
input,
select,
textarea {
  -webkit-tap-highlight-color: transparent;
}
button,
select {
  cursor: pointer;
}
button {
  border: 0;
  background: none;
  color: inherit;
}
button:disabled {
  opacity: 0.55;
  cursor: wait;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}
a {
  color: inherit;
}
h1,
h2,
h3,
p {
  margin: 0;
}
h1,
h2,
.brand,
.editorial,
.metric-number {
  font-family: "Libre Caslon Display", Georgia, serif;
  font-weight: 400;
}
h1 {
  font-size: clamp(2.4rem, 3.4vw, 3.5rem);
  line-height: 1.06;
  letter-spacing: -0.035em;
}
h2 {
  font-size: 1.85rem;
  line-height: 1.2;
}
h3 {
  font-size: 1rem;
}
p {
  line-height: 1.6;
}
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 218px;
  border-right: 1px solid var(--border);
  padding: 34px 22px;
  display: flex;
  flex-direction: column;
}
.brand {
  font-size: 2rem;
  letter-spacing: -0.06em;
  text-decoration: none;
  display: flex;
  gap: 10px;
  align-items: center;
}
.ticket {
  font-size: 1.7rem;
  line-height: 1;
  letter-spacing: 0;
  color: var(--accent);
  display: inline-grid;
  place-items: center;
}
/* The ticket-stub mark scales with the surrounding font size. */
svg.mark {
  width: 1.15em;
  height: 1.15em;
  display: block;
  flex: none;
}
.metric-icon svg.mark,
.symbol svg.mark {
  width: 1.1em;
  height: 1.1em;
}
.sidebar nav {
  margin-top: 48px;
  display: grid;
  gap: 8px;
}
.nav-item {
  display: flex;
  gap: 14px;
  align-items: center;
  width: 100%;
  padding: 14px 12px;
  text-align: left;
  border-radius: 8px;
  font-size: 0.9rem;
  min-height: 46px;
}
.nav-item:hover {
  background: var(--raised);
}
.nav-item.active {
  background: var(--accent-soft);
  color: var(--accent-text);
  font-weight: 700;
}
.nav-icon {
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.nav-icon svg {
  width: 20px;
  height: 20px;
}
.sidebar-bottom {
  margin-top: auto;
}
.editorial {
  font-size: 1.7rem;
  line-height: 1.3;
  color: var(--muted);
  padding: 32px 12px 50px;
}
.workspace {
  margin-left: 218px;
}
.preview-strip {
  padding: 10px 38px;
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 12px;
  justify-content: space-between;
  align-items: center;
  background: var(--raised);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
}
.preview-strip button {
  font-size: 0.78rem;
  text-decoration: underline;
  text-underline-offset: 3px;
  letter-spacing: 0;
  min-height: 28px;
}
main {
  max-width: 1330px;
  margin: auto;
  padding: 42px 42px 24px;
}
.page-header {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: center;
  margin-bottom: 30px;
}
.eyebrow {
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  font-weight: 700;
  margin-bottom: 10px;
}
.subtitle {
  color: var(--muted);
  font-size: 0.94rem;
  margin-top: 10px;
}
.header-actions {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
  align-items: center;
}
select,
.secondary {
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  padding: 11px 14px;
  min-height: 44px;
}
.primary {
  background: var(--accent);
  color: var(--muted);
  border-radius: 7px;
  padding: 12px 17px;
  min-height: 44px;
}
.primary:hover {
  background: var(--accent);
}
.secondary:hover {
  background: var(--raised);
}
.recommendation {
  background: var(--accent);
  color: var(--ink);
  padding: 30px 34px;
  border-radius: var(--radius);
  position: relative;
  overflow: hidden;
}
.recommendation h2 {
  font-size: clamp(2rem, 3vw, 3rem);
  max-width: 730px;
  letter-spacing: -0.02em;
}
.recommendation > p:not(.eyebrow) {
  margin-top: 13px;
  color: var(--muted);
  max-width: 690px;
  font-size: 0.95rem;
}
.recommendation-foot {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  align-items: center;
  margin-top: 24px;
  flex-wrap: wrap;
}
.confidence {
  background: var(--raised);
  color: var(--muted);
  padding: 7px 12px;
  border-radius: 30px;
  font-size: 0.75rem;
}
.text-light {
  color: var(--ink);
  padding: 8px 0;
  font-size: 0.88rem;
}
.metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin: 20px 0 24px;
}
.metrics article {
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 21px;
  background: var(--surface);
  display: flex;
  align-items: center;
  gap: 16px;
}
.metrics strong {
  display: block;
  font-family: "Libre Caslon Display", Georgia, serif;
  font-size: 2.2rem;
  letter-spacing: -0.03em;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}
.metrics span:not(.metric-icon) {
  display: block;
  font-size: 0.82rem;
  color: var(--muted);
  margin-top: 3px;
}
.metric-icon {
  font-size: 1.4rem;
  color: var(--muted);
  width: 26px;
}
.metrics small {
  font-size: 0.7rem;
  color: var(--orange);
  display: block;
  margin-top: 5px;
}
.overview-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, 1fr);
  gap: 20px;
  margin-bottom: 20px;
}
.panel {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 24px;
  min-width: 0;
}
.panel p.subtle {
  margin-top: 6px;
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}
.panel-head button,
.text-button {
  font-size: 0.85rem;
  text-decoration: underline;
  text-underline-offset: 4px;
  min-height: 40px;
}
.subtle {
  color: var(--muted);
  font-size: 0.85rem;
}
.chart {
  height: 185px;
  display: flex;
  align-items: stretch;
  gap: 10px;
  margin-top: 24px;
  border-bottom: 1px solid var(--border);
  background: repeating-linear-gradient(
    to top,
    transparent 0,
    transparent calc(25% - 1px),
    var(--border) calc(25% - 1px),
    var(--border) 25%
  );
  padding: 0 4px;
}
.chart-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  position: relative;
}
.chart-bar {
  background: var(--accent);
  width: 65%;
  max-width: 38px;
  border-radius: 3px 3px 0 0;
  min-height: 0;
}
.chart-col:hover .chart-bar {
  background: var(--accent);
}
.chart-labels {
  display: flex;
  gap: 10px;
  padding: 10px 4px 0;
  color: var(--muted);
  font-size: 0.75rem;
}
.chart-labels span {
  flex: 1;
  text-align: center;
  min-width: 0;
}
.chart-caption {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 16px;
}
.outlook-row {
  display: flex;
  gap: 13px;
  align-items: center;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}
.outlook-row:last-child {
  border-bottom: 0;
}
.outlook-row .symbol {
  width: 32px;
  height: 32px;
  background: var(--raised);
  border-radius: 8px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.outlook-row > div {
  flex: 1;
}
.outlook-row strong {
  font-size: 0.87rem;
}
.outlook-row small {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
  margin-top: 5px;
}
.badge {
  display: inline-flex;
  border-radius: 20px;
  padding: 5px 9px;
  font-size: 0.7rem;
  background: var(--accent-soft);
  color: var(--accent);
  white-space: normal;
}
.badge.review {
  background: var(--review);
  color: var(--orange);
}
.review-notice {
  display: flex;
  gap: 12px;
  justify-content: space-between;
  align-items: center;
  background: var(--review);
  color: var(--orange);
  padding: 16px;
  border-radius: 8px;
  margin-top: 16px;
  font-size: 0.86rem;
}
.review-notice button {
  font-weight: 700;
  min-height: 36px;
}
.visit-row {
  display: flex;
  gap: 16px;
  align-items: center;
  border-top: 1px solid var(--border);
  padding: 18px 0;
  width: 100%;
  text-align: left;
}
.visit-row:first-child {
  border-top: 0;
}
.visit-row:hover {
  background: var(--raised);
}
.poster {
  width: 56px;
  height: 84px;
  position: relative;
  overflow: hidden;
  background: var(--raised);
  border: 1px solid var(--border);
  color: var(--muted);
  flex-shrink: 0;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: Georgia, serif;
  font-size: 1.15rem;
}
.poster.alt {
  background: var(--raised);
  color: var(--muted);
  border-color: var(--border);
}
.poster.blue {
  background: var(--raised);
  color: var(--muted);
  border-color: var(--border);
}
.visit-info {
  flex: 1;
  min-width: 0;
}
.visit-info strong {
  font-size: 0.95rem;
  display: block;
  line-height: 1.35;
}
.visit-info small {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.5;
  margin-top: 5px;
}
.visit-amount {
  font-size: 0.95rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.visit-chevron {
  color: var(--muted);
  font-size: 1.3rem;
}
.page-footer {
  max-width: 1330px;
  margin: auto;
  padding: 20px 42px 28px;
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.75rem;
}
.page-footer span:first-child {
  font-family: Georgia;
  font-style: italic;
}
.mobile-header,
.bottom-nav {
  display: none;
}
.filters {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.filters input {
  flex: 1;
  min-width: 160px;
}
.input,
input:not([type]),
input[type="email"],
input[type="text"],
input[type="search"],
input[type="number"],
input[type="date"],
textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 12px;
  background: var(--surface);
  color: var(--ink);
  min-height: 44px;
}
.empty {
  text-align: center;
  padding: 50px 18px;
}
.empty h2 {
  margin-bottom: 12px;
}
.empty p {
  color: var(--muted);
  margin-bottom: 22px;
}
.comparison-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 20px;
}
.comparison-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.comparison-card .price {
  font-family: Georgia;
  font-size: 1.8rem;
}
.comparison-card .positive {
  color: var(--accent);
}
.negative {
  color: var(--red);
}
.divider {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 20px 0;
}
.breakdown {
  display: grid;
  gap: 11px;
  font-size: 0.86rem;
}
.breakdown > div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}
.breakdown dd {
  margin: 0;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.breakdown dt {
  color: var(--muted);
}
details {
  border-top: 1px solid var(--border);
  padding-top: 15px;
}
summary {
  cursor: pointer;
  min-height: 34px;
  font-size: 0.86rem;
}
.scenario {
  display: flex;
  gap: 20px;
  align-items: center;
  flex-wrap: wrap;
}
.scenario label {
  flex: 1;
  min-width: 200px;
}
.scenario input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
  margin-top: 15px;
}
.settings-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.setting-row {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}
.setting-row input {
  max-width: 100px;
}
.setting-row:last-child {
  border-bottom: 0;
}
.error {
  background: var(--error-bg);
  color: var(--red);
  padding: 14px;
  border: 1px solid var(--error-border);
  border-radius: 8px;
  margin-bottom: 18px;
  font-size: 0.9rem;
}
.error:empty {
  display: none;
}
.success {
  background: var(--accent-soft);
  padding: 12px;
  border-radius: 8px;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.skip {
  position: fixed;
  top: -100px;
  left: 20px;
  z-index: 1000;
  background: var(--surface);
  padding: 12px;
}
.skip:focus {
  top: 12px;
}
dialog {
  width: min(620px, calc(100% - 32px));
  max-height: 90dvh;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--canvas);
  color: var(--ink);
  padding: 28px;
}
dialog::backdrop {
  background: #000000b3;
  backdrop-filter: blur(3px);
}
.dialog-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 22px;
  gap: 16px;
}
.close {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 1.5rem;
  background: var(--raised);
  flex-shrink: 0;
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
label.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-size: 0.83rem;
}
.wide {
  grid-column: 1/-1;
}
.dialog-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 24px;
  flex-wrap: wrap;
}
.danger {
  color: var(--red);
  margin-right: auto;
}
.check {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.86rem;
}
.check input {
  width: 20px;
  height: 20px;
  accent-color: var(--accent);
}
.auth-choice {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.muted-block {
  padding: 14px;
  background: var(--raised);
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.6;
  margin: 16px 0;
}
.range-note {
  margin-bottom: 18px;
}
.section-stack {
  display: grid;
  gap: 20px;
}
#toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--raised);
  color: var(--muted);
  border-radius: 8px;
  padding: 13px 20px;
  max-width: 90vw;
  z-index: 100;
  font-size: 0.9rem;
}
table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.8rem;
  margin-top: 10px;
}
th,
td {
  padding: 9px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.loading {
  opacity: 0.6;
  pointer-events: none;
}
.offline-banner {
  margin-bottom: 20px;
}
@media (min-width: 1500px) {
  main {
    padding-top: 50px;
  }
  .recommendation {
    padding: 38px;
  }
  .metrics article {
    padding: 26px;
  }
  .chart {
    height: 215px;
  }
}
@media (max-width: 1150px) {
  .sidebar {
    width: 184px;
    padding: 28px 16px;
  }
  .workspace {
    margin-left: 184px;
  }
  main {
    padding: 32px 26px;
  }
  .page-header {
    align-items: flex-start;
    flex-direction: column;
  }
  .header-actions {
    width: 100%;
  }
  .overview-grid {
    grid-template-columns: 1fr 1fr;
  }
  .metrics article {
    padding: 16px;
    gap: 8px;
  }
  .metric-icon {
    display: none;
  }
  .preview-strip {
    padding: 8px 26px;
  }
}
@media (max-width: 850px) {
  .overview-grid,
  .settings-layout {
    grid-template-columns: 1fr;
  }
  .comparison-grid {
    grid-template-columns: 1fr;
  }
  .sidebar {
    width: 165px;
  }
  .workspace {
    margin-left: 165px;
  }
  .nav-item {
    padding: 13px 8px;
    gap: 8px;
  }
  .brand {
    font-size: 1.8rem;
  }
  .editorial {
    font-size: 1.5rem;
  }
}
@media (max-width: 700px) {
  .sidebar {
    display: none;
  }
  .workspace {
    margin-left: 0;
  }
  .preview-strip {
    padding: 8px 16px;
    font-size: 0.75rem;
    letter-spacing: 0.03em;
  }
  .preview-strip button {
    font-size: 0.75rem;
    max-width: 140px;
  }
  .mobile-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 18px 0;
  }
  .avatar {
    width: 36px;
    height: 36px;
    background: var(--raised);
    border-radius: 50%;
  }
  .brand {
    font-size: 1.9rem;
  }
  main {
    padding: 26px 18px 30px;
  }
  .eyebrow {
    font-size: 0.75rem;
  }
  h1 {
    font-size: 2.75rem;
  }
  .subtitle {
    font-size: 0.88rem;
    max-width: 270px;
  }
  .page-header {
    gap: 18px;
    margin-bottom: 22px;
  }
  .header-actions {
    justify-content: space-between;
  }
  .header-actions select,
  .header-actions button {
    font-size: 0.83rem;
  }
  .recommendation {
    padding: 24px;
  }
  .recommendation h2 {
    font-size: 2.25rem;
  }
  .recommendation > p:not(.eyebrow) {
    font-size: 0.87rem;
  }
  .recommendation-foot {
    margin-top: 20px;
    gap: 12px;
  }
  .text-light {
    font-size: 0.8rem;
  }
  .confidence {
    font-size: 0.75rem;
  }
  .metrics {
    gap: 8px;
    margin: 14px 0 18px;
  }
  .metrics article {
    padding: 14px 9px;
    display: block;
  }
  .metrics strong {
    font-size: 1.85rem;
  }
  .metrics span:not(.metric-icon) {
    font-size: 0.75rem;
    line-height: 1.4;
  }
  .metrics small {
    font-size: 0.75rem;
  }
  .panel {
    padding: 20px;
  }
  h2 {
    font-size: 1.65rem;
  }
  .panel-head {
    gap: 10px;
  }
  .panel-head button {
    font-size: 0.77rem;
  }
  .overview-grid {
    gap: 18px;
  }
  .visit-row {
    gap: 11px;
  }
  .visit-info strong {
    font-size: 0.87rem;
  }
  .visit-info small {
    font-size: 0.75rem;
  }
  .visit-amount {
    font-size: 0.87rem;
    max-width: 100px;
  }
  .poster {
    width: 48px;
    height: 72px;
    font-size: 1rem;
  }
  .visit-chevron {
    display: none;
  }
  .review-notice {
    align-items: flex-start;
    flex-direction: column;
    gap: 3px;
  }
  .page-footer {
    padding: 8px 18px 105px;
    gap: 20px;
    font-size: 0.75rem;
  }
  .bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--raised);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--border);
    justify-content: space-around;
    padding: 9px 8px calc(9px + env(safe-area-inset-bottom));
    z-index: 20;
  }
  .bottom-nav button {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    min-width: 60px;
    min-height: 45px;
    font-size: 0.75rem;
    color: var(--muted);
    padding: 5px;
  }
  .bottom-nav button.active {
    color: var(--accent);
    font-weight: 700;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .wide {
    grid-column: auto;
  }
  dialog {
    padding: 22px;
    max-height: 88dvh;
  }
  .filters {
    gap: 9px;
  }
  .filters select {
    flex: 1;
    font-size: 0.8rem;
  }
  .chart {
    gap: 5px;
  }
  .chart-labels {
    gap: 5px;
    font-size: 0.75rem;
  }
  .badge {
    font-size: 0.75rem;
  }
  #toast {
    bottom: 90px;
  }
  .setting-row {
    font-size: 0.84rem;
  }
}
@media (prefers-reduced-motion: no-preference) {
  button {
    transition:
      background 0.15s,
      color 0.15s;
  }
  .chart-bar {
    transition: height 0.25s;
  }
}
@media print {
  .sidebar,
  .preview-strip,
  .bottom-nav,
  .mobile-header,
  .header-actions,
  button {
    display: none !important;
  }
  .workspace {
    margin: 0;
  }
  main {
    padding: 0;
  }
  .panel,
  .recommendation {
    break-inside: avoid;
  }
}

@media (max-width: 700px) {
  .preview-strip {
    flex-wrap: wrap;
  }
  .chart-labels span:nth-child(even) {
    visibility: hidden;
  }
  .bottom-nav .nav-item {
    width: auto;
    padding: 5px 3px;
  }
  .bottom-nav .nav-item span:last-child {
    font-size: 0.75rem;
  }
}

/* Readable accents on dark surfaces; every view uses the same theater palette. */
.ticket,
.nav-item.active,
.badge,
.comparison-card .positive,
.bottom-nav button.active {
  color: var(--accent-text);
}
.badge.review {
  color: var(--orange);
}
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--ink);
  -webkit-box-shadow: 0 0 0 1000px var(--surface) inset;
  caret-color: var(--ink);
}
::selection {
  background: var(--raised);
  color: var(--muted);
}

.poster-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: brightness(0.72);
}

:root[data-theme="light"] {
  --canvas: #f6f5f1;
  --surface: #ffffff;
  --raised: #efede6;
  --ink: #232321;
  --muted: #626159;
  --border: #d9d6cb;
  --accent-soft: #faedcf;
  --accent-text: #78520b;
  --orange: #78520b;
  --review: #faedcf;
  --red: #a13428;
  --error-bg: #fff0ed;
  --error-border: #d69c93;
  --poster-brightness: 1;
  color-scheme: light;
}
.primary,
.primary:hover {
  background: var(--accent);
  color: #0b0d0e;
}
.primary:hover {
  filter: brightness(0.92);
}
.nav-item.active {
  background: var(--accent-soft);
  color: var(--accent-text);
}
.ticket,
.brand,
.metric-icon {
  color: var(--accent-text);
}
.recommendation {
  background: var(--accent-soft);
  color: var(--ink);
  border: 1px solid var(--border);
}
.recommendation .text-light {
  color: var(--accent-text);
}
.confidence {
  background: var(--surface);
  color: var(--accent-text);
}
.poster-image {
  filter: brightness(var(--poster-brightness));
}
.theme-control {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 16px;
}

/* ---- Integration additions: line items, staged emails, update bar ---- */
fieldset.lines {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px 8px;
  margin: 0;
  min-width: 0;
}
fieldset.lines legend {
  padding: 0 6px;
  font-size: 0.83rem;
}
.line-head,
.line-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 64px 132px 92px 44px;
  gap: 8px;
  align-items: center;
}
.line-row select.input {
  min-width: 0;
  padding: 10px 8px;
}
.line-row input:disabled {
  opacity: 0.6;
}
.line-head {
  font-size: 0.72rem;
  color: var(--muted);
  margin-bottom: 6px;
}
.line-row {
  margin-bottom: 8px;
}
.line-row .input {
  min-width: 0;
}
.line-remove {
  min-width: 44px;
  min-height: 44px;
  border-radius: 7px;
  color: var(--muted);
  font-size: 1.3rem;
}
.line-remove:hover {
  background: var(--raised);
  color: var(--ink);
}
#computed-total {
  margin: 0;
  font-size: 0.82rem;
}
#computed-total.warn {
  color: var(--accent-text);
}
#computed-total.warn::before {
  content: "⚠ ";
}
.scan-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}
.email-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.email-row .visit-row {
  flex: 1;
  min-width: 0;
}
.update-bar {
  position: fixed;
  left: 50%;
  bottom: 30px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--raised);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px 10px 18px;
  z-index: 101;
  max-width: calc(100vw - 32px);
  font-size: 0.9rem;
}
.update-bar[hidden] {
  display: none;
}
@media (max-width: 700px) {
  .update-bar {
    bottom: calc(84px + env(safe-area-inset-bottom));
  }
  /* Phones: name on its own row, then qty / price type / price / remove. */
  .line-head {
    display: none;
  }
  .line-row {
    grid-template-columns: 58px minmax(0, 1fr) 84px 44px;
    gap: 6px;
  }
  .line-row [data-f="name"] {
    grid-column: 1 / -1;
  }
  .scan-actions {
    align-items: stretch;
  }
}
@media (max-width: 360px) {
  .line-row {
    grid-template-columns: 52px minmax(0, 1fr) 72px 40px;
  }
}
/* Narrow phones: give "Add a visit" its own row instead of a 4-line wrap. */
@media (max-width: 420px) {
  .header-actions {
    flex-wrap: wrap;
  }
  .header-actions select {
    flex: 1;
  }
  .header-actions .primary {
    flex: 1 1 100%;
    white-space: nowrap;
  }
}

/* ---- Foldables & compact tablets -------------------------------------
   An open Galaxy Z Fold (~750-850 CSS px, near-square) or an iPhone Fold
   (wider than tall) lands between phone and desktop. Give the content the
   room: icon rail instead of the full sidebar, and a one-line header on
   short screens. Pure CSS, so folding/unfolding re-lays out instantly
   without losing an open form. */
@media (min-width: 701px) and (max-width: 1100px) {
  .sidebar {
    width: 88px;
    padding: 20px 8px;
    align-items: stretch;
  }
  .workspace {
    margin-left: 88px;
  }
  .sidebar .brand {
    font-size: 0; /* keep the ticket mark, drop the wordmark */
    justify-content: center;
    display: flex;
  }
  .sidebar .brand .ticket {
    font-size: 1.9rem;
  }
  .sidebar .nav-item {
    flex-direction: column;
    justify-content: center;
    text-align: center;
    gap: 4px;
    padding: 10px 4px;
    min-height: 58px;
    font-size: 0.68rem;
    line-height: 1.2;
  }
  .sidebar .editorial {
    display: none;
  }
  main {
    padding: 28px 24px 24px;
  }
  .preview-strip {
    padding-inline: 24px;
  }
  .metric-icon {
    display: none;
  }
}
@media (min-width: 701px) and (max-width: 819px) {
  .overview-grid,
  .settings-layout,
  .comparison-grid {
    grid-template-columns: 1fr;
  }
}
@media (min-width: 820px) and (max-width: 1100px) {
  .overview-grid,
  .comparison-grid {
    grid-template-columns: 1fr 1fr;
  }
}
/* Wide but short (open foldable in landscape, small laptop): one-line
   header so the numbers start above the fold. */
@media (min-width: 701px) and (max-height: 820px) {
  main {
    padding-top: 20px;
  }
  .page-header {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 12px 24px;
    margin-bottom: 18px;
  }
  .page-header > div:first-child {
    flex: 1 1 220px;
    min-width: 0;
  }
  .header-actions {
    width: auto;
    flex-wrap: wrap;
  }
  h1 {
    font-size: clamp(2rem, 3vw, 2.6rem);
  }
  .recommendation {
    padding: 22px 26px;
  }
  .preview-strip {
    padding-block: 6px;
  }
  .sidebar .editorial {
    display: none;
  }
  dialog {
    padding: 20px;
  }
}
/* Fold / hinge aware (Viewport Segments API). Only browsers that report a
   fold apply these; everyone else ignores them. Keep dialogs off the crease:
   side-by-side halves -> right half; tabletop (top/bottom halves) -> top. */
@media (horizontal-viewport-segments: 2) {
  dialog {
    inset: 0 0 0 env(viewport-segment-left 1 0);
    width: min(620px, calc(env(viewport-segment-width 1 0) - 32px));
    margin: auto;
  }
  .update-bar,
  #toast {
    left: calc(env(viewport-segment-left 1 0) + env(viewport-segment-width 1 0) / 2);
  }
}
@media (vertical-viewport-segments: 2) {
  dialog {
    inset: 0 0 auto 0;
    max-height: calc(env(viewport-segment-height 0 0) - 24px);
    margin: 12px auto auto;
  }
  .update-bar,
  #toast {
    bottom: auto;
    top: calc(env(viewport-segment-bottom 0 0) - 64px);
  }
}

.attach-choices {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

/* ---- Add to home screen card (overview) ---- */
.install-card {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 14px;
  align-items: start;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 16px 18px;
  margin-bottom: 18px;
}
.install-card img {
  border-radius: 11px;
  display: block;
}
.install-card h2 {
  font-size: 1rem;
  margin: 2px 0 0;
}
.install-card .subtle {
  margin-top: 4px;
}
.install-steps {
  margin: 10px 0 0;
  padding-left: 20px;
  color: var(--ink);
  font-size: 0.92rem;
  line-height: 1.45;
}
.install-steps li + li {
  margin-top: 4px;
}
.install-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  align-items: center;
  margin-top: 12px;
}
.inline-icon {
  width: 1.05em;
  height: 1.05em;
  vertical-align: -0.15em;
}
