:root {
  color-scheme: dark;
  --bg: rgba(9, 14, 18, 0.84);
  --panel: rgba(255, 255, 255, 0.07);
  --panel-strong: rgba(255, 255, 255, 0.12);
  --line: rgba(255, 255, 255, 0.14);
  --text: #f4f7f8;
  --muted: #9caab2;
  --soft: #c7d0d5;
  --accent: #6ee7a8;
  --accent2: #8ec5ff;
  --accent-rgb: 110, 231, 168;
  --green: #6ee7a8;
  --amber: #f2c36b;
  --red: #ff8a8a;
  --blue: #8ec5ff;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body[data-theme="blue"] {
  --accent: #8ec5ff;
  --accent2: #6ee7d8;
  --accent-rgb: 142, 197, 255;
}

body[data-theme="amber"] {
  --accent: #f2c36b;
  --accent2: #8ec5ff;
  --accent-rgb: 242, 195, 107;
}

body[data-theme="rose"] {
  --accent: #ff8ab3;
  --accent2: #8ec5ff;
  --accent-rgb: 255, 138, 179;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: transparent;
  overflow: hidden;
}

body.web-shell,
body.is-web {
  background:
    radial-gradient(circle at 12% 10%, rgba(var(--accent-rgb), 0.2), transparent 28%),
    linear-gradient(180deg, #0a0f14 0%, #111821 100%);
  overflow: auto;
}

button {
  font: inherit;
}

.shell {
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.46);
  overflow: hidden;
}

body.web-shell .shell,
body.is-web .shell {
  width: min(1120px, calc(100vw - 28px));
  min-height: calc(100vh - 28px);
  height: auto;
  margin: 14px auto;
}

body.is-web .desktop-only {
  display: none;
}

.web-nav-button {
  text-decoration: none;
}

.titlebar {
  -webkit-app-region: drag;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 16px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

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

.brand-mark {
  width: 13px;
  height: 36px;
  border-radius: 3px;
  background: linear-gradient(180deg, var(--accent), var(--accent2));
  box-shadow: 0 0 18px rgba(var(--accent-rgb), 0.42);
}

h1 {
  margin: 0;
  font-size: 15px;
  line-height: 1.2;
  letter-spacing: 0;
}

.brand p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 280px;
}

.window-actions {
  -webkit-app-region: no-drag;
  display: flex;
  gap: 7px;
}

.icon-button,
.text-button,
.footer button {
  -webkit-app-region: no-drag;
  border: 1px solid var(--line);
  color: var(--text);
  background: var(--panel);
  cursor: pointer;
}

.icon-button {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  padding: 0;
}

.icon-button.active {
  border-color: rgba(var(--accent-rgb), 0.55);
  background: rgba(var(--accent-rgb), 0.18);
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
}

.view-tabs {
  -webkit-app-region: no-drag;
  display: inline-flex;
  min-width: 150px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-strong);
}

.view-tab {
  flex: 1 1 0;
  min-width: 0;
  border: 0;
  border-radius: 7px;
  padding: 7px 9px;
  color: var(--muted);
  background: transparent;
  font-weight: 750;
  font-size: 12px;
  text-align: center;
  cursor: pointer;
}

.view-tab.active {
  color: #0b1712;
  background: var(--accent);
  box-shadow: 0 0 16px rgba(var(--accent-rgb), 0.24);
}

.theme-swatches {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-right: auto;
}

.theme-swatch {
  width: 26px;
  height: 26px;
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  background: var(--accent);
  box-shadow: inset 0 0 0 3px rgba(9, 14, 18, 0.8);
}

.theme-swatch.active {
  border-color: rgba(255, 255, 255, 0.72);
  box-shadow: inset 0 0 0 3px rgba(9, 14, 18, 0.85), 0 0 0 2px rgba(var(--accent-rgb), 0.3);
}

.theme-swatch--green {
  background: #6ee7a8;
}

.theme-swatch--blue {
  background: #8ec5ff;
}

.theme-swatch--amber {
  background: #f2c36b;
}

.theme-swatch--rose {
  background: #ff8ab3;
}

.text-button {
  border-radius: 10px;
  padding: 8px 12px;
}

.summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  padding: 0 16px 12px;
}

.summary-grid div {
  min-width: 0;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.055);
}

.summary-label {
  display: block;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.2;
  margin-bottom: 5px;
}

.summary-grid strong {
  display: block;
  font-size: 15px;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.spotlight {
  margin: 0 16px 12px;
  padding: 12px;
  border: 1px solid rgba(var(--accent-rgb), 0.3);
  border-radius: 12px;
  background: rgba(var(--accent-rgb), 0.09);
}

.spotlight .date {
  color: var(--accent);
  font-size: 12px;
  margin-bottom: 7px;
}

.spotlight strong {
  font-size: 18px;
}

.spotlight p {
  margin: 7px 0 0;
  color: var(--soft);
  font-size: 12px;
}

.list {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 0 12px 12px 16px;
}

.date-group {
  margin-bottom: 14px;
}

.date-heading {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 4px;
  color: var(--muted);
  background: rgba(9, 14, 18, 0.94);
  font-size: 12px;
}

.event-card {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px 10px;
  margin-bottom: 7px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.055);
}

.ticker {
  color: var(--text);
  font-weight: 750;
  font-size: 15px;
}

.company {
  min-width: 0;
}

.company strong {
  display: block;
  font-size: 13px;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.company span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.25;
}

.signal-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 6px;
}

.signal-meta span {
  display: inline-flex;
  margin-top: 0;
  padding: 3px 6px;
  border-radius: 999px;
  color: var(--accent);
  background: rgba(var(--accent-rgb), 0.12);
  font-size: 10px;
  font-weight: 750;
  line-height: 1;
}

.structure-plan-line {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 8px;
}

.structure-plan-line > span {
  display: inline-flex;
  align-items: center;
  min-height: 21px;
  margin-top: 0;
  padding: 3px 6px;
  border: 1px solid rgba(var(--accent-rgb), 0.15);
  border-radius: 999px;
  color: var(--soft);
  background: rgba(var(--accent-rgb), 0.08);
  font-size: 10px;
  font-weight: 750;
  line-height: 1;
}

.structure-plan-line > span.is-strong {
  color: var(--accent);
  background: rgba(var(--accent-rgb), 0.14);
}

.structure-plan-line > span.plan-chip-cycle {
  border-color: rgba(142, 197, 255, 0.24);
  color: #d8eaff;
  background: rgba(142, 197, 255, 0.13);
}

.structure-plan-line > span.plan-chip-strike {
  border-color: rgba(199, 208, 213, 0.2);
  color: #d7dee2;
  background: rgba(199, 208, 213, 0.1);
}

.structure-plan-line > span.plan-chip-yield {
  border-color: rgba(110, 231, 168, 0.28);
  color: #6ee7a8;
  background: rgba(110, 231, 168, 0.16);
}

.structure-plan-line > span.plan-chip-share {
  border-color: rgba(110, 231, 216, 0.26);
  color: #8cf2e2;
  background: rgba(110, 231, 216, 0.13);
}

.structure-plan-line .score-chip {
  position: relative;
  overflow: hidden;
  gap: 4px;
  border-color: hsla(var(--score-hue), 78%, var(--score-lightness), 0.36);
  color: hsl(var(--score-hue), 78%, var(--score-lightness));
  background:
    linear-gradient(
      90deg,
      hsla(var(--score-hue), 78%, var(--score-lightness), 0.28) 0 var(--score-fill),
      rgba(255, 255, 255, 0.06) var(--score-fill) 100%
    );
  box-shadow: inset 0 0 0 1px hsla(var(--score-hue), 78%, var(--score-lightness), 0.1);
}

.structure-plan-line .score-chip span,
.structure-plan-line .score-chip strong {
  position: relative;
  z-index: 1;
}

.structure-plan-line .score-chip strong {
  color: var(--text);
  font-size: 11px;
  line-height: 1;
}

.structure-plan-line .score-chip-missing {
  border-color: rgba(255, 255, 255, 0.1);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.06);
}

.session {
  min-width: 42px;
  text-align: center;
  padding: 5px 7px;
  border-radius: 999px;
  color: var(--text);
  background: rgba(142, 197, 255, 0.15);
  font-size: 11px;
}

.session.after {
  background: rgba(var(--accent-rgb), 0.16);
  color: var(--accent);
}

.session.before {
  background: rgba(242, 195, 107, 0.14);
  color: var(--amber);
}

.empty {
  margin: 40px 18px;
  color: var(--muted);
  text-align: center;
  line-height: 1.55;
}

.footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 16px;
  color: var(--muted);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 11px;
}

.footer-status {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.footer-actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 7px;
}

.footer span {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#accessStatus {
  color: var(--accent);
}

#accessStatus.warning,
#updateStatus.warning {
  color: var(--amber);
}

#accessStatus.error,
#updateStatus.error {
  color: var(--red);
}

.footer button {
  border-radius: 8px;
  padding: 5px 9px;
  color: var(--muted);
}

::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.17);
  border-radius: 99px;
}
