:root {
  color-scheme: light;
  --bg: #f6f7f8;
  --panel: #ffffff;
  --panel-2: #fafafa;
  --ink: #202124;
  --muted: #68707a;
  --border: #dfe3e7;
  --border-strong: #c9d0d7;
  --accent: #0f766e;
  --accent-dark: #0b5f59;
  --blue: #2563eb;
  --amber: #d97706;
  --red: #dc2626;
  --critical: #991b1b;
  --green: #138a53;
  --shadow: 0 8px 22px rgba(32, 33, 36, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 0;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  min-width: 0;
  overflow-x: hidden;
}

button,
input,
select {
  font: inherit;
}

button,
input,
select,
a {
  -webkit-tap-highlight-color: transparent;
}

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

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  padding: calc(14px + env(safe-area-inset-top)) 22px 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

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

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

.brand-logo {
  width: 46px;
  height: 46px;
  border-radius: 10px;
  object-fit: cover;
  flex: 0 0 auto;
  border: 1px solid rgba(32, 33, 36, 0.08);
}

.brand-copy {
  min-width: 0;
}

.eyebrow {
  margin: 0 0 3px;
  font-size: 12px;
  color: var(--accent);
  font-weight: 700;
  text-transform: uppercase;
}

.language-control {
  min-width: 128px;
}

.language-control select {
  height: 34px;
  padding-inline: 9px;
}

h1,
h2,
p {
  margin: 0;
}

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

h2 {
  font-size: 15px;
  line-height: 1.3;
  letter-spacing: 0;
}

.position-form {
  display: grid;
  grid-template-columns: minmax(110px, 140px) minmax(110px, 140px) minmax(92px, 118px) auto auto;
  gap: 10px;
  align-items: end;
}

label {
  display: grid;
  gap: 5px;
  font-size: 12px;
  color: var(--muted);
}

input,
select {
  width: 100%;
  min-width: 0;
  height: 40px;
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  background: var(--panel);
  color: var(--ink);
  padding: 0 10px;
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.14);
}

button {
  border: 0;
  cursor: pointer;
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 40px;
  min-height: 40px;
  height: 40px;
  padding: 0 13px;
  color: var(--ink);
  background: var(--panel-2);
  border: 1px solid var(--border-strong);
}

button:hover {
  border-color: var(--accent);
}

button:disabled {
  cursor: progress;
  opacity: 0.68;
}

button svg {
  width: 17px;
  height: 17px;
}

.primary-button {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
  font-weight: 700;
}

.primary-button:hover {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
}

.secondary-button {
  background: #eef7f5;
  border-color: #badbd5;
  color: var(--accent-dark);
  font-weight: 700;
}

.secondary-button.compact {
  min-height: 32px;
  height: 32px;
  padding: 0 10px;
  font-size: 13px;
  white-space: nowrap;
}

.topbar-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 11px;
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  background: var(--panel-2);
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

.topbar-link:hover {
  border-color: var(--accent);
  background: #eef7f5;
}

.auth-controls {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.auth-button {
  max-width: 220px;
}

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

.auth-logout[hidden] {
  display: none;
}

.icon-button {
  width: 40px;
  padding: 0;
}

.icon-button.small {
  width: 31px;
  height: 31px;
}

.workspace {
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
  gap: 16px;
  width: 100%;
  max-width: 1540px;
  margin: 0 auto;
  padding: 16px max(18px, env(safe-area-inset-right)) 12px max(18px, env(safe-area-inset-left));
  flex: 1;
}

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

.watch-panel {
  min-height: 420px;
  padding: 12px;
  align-self: start;
  position: sticky;
  top: 92px;
}

.analysis-panel {
  min-width: 0;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 12px 10px;
  border-bottom: 1px solid var(--border);
}

.panel-title {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex-wrap: wrap;
}

.watchlist {
  display: grid;
  gap: 8px;
  padding-top: 10px;
}

.watch-row {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(94px, 112px);
  gap: 6px 10px;
  height: auto;
  min-height: 64px;
  padding: 10px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  border-radius: 7px;
  text-align: left;
  min-width: 0;
  width: 100%;
  align-items: center;
  justify-content: stretch;
  box-shadow: none;
  overflow: visible;
  touch-action: none;
  user-select: none;
  cursor: grab;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.08s ease;
}

.watch-row.active {
  border-color: var(--accent);
  box-shadow: inset 3px 0 0 var(--accent);
}

.watch-row.dragging {
  opacity: 0.88;
  border-style: dashed;
  cursor: grabbing;
  z-index: 3;
  background: var(--panel);
  box-shadow: 0 10px 24px rgba(32, 33, 36, 0.14);
}

.watch-row:focus-visible {
  outline: 3px solid rgba(15, 118, 110, 0.2);
  outline-offset: 2px;
}

.watch-row.drop-before::before,
.watch-row.drop-after::after {
  content: "";
  position: absolute;
  left: 8px;
  right: 8px;
  height: 3px;
  border-radius: 999px;
  background: var(--accent);
}

.watch-row.drop-before::before {
  top: -6px;
}

.watch-row.drop-after::after {
  bottom: -6px;
}

.watch-symbol {
  font-weight: 800;
  font-size: 15px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.watch-symbol,
#symbol-input,
#active-title,
.chart-badge,
.setup-meta strong,
.metric strong,
.watch-cost,
.watch-alert {
  direction: ltr;
  unicode-bidi: isolate;
}

.watch-cost,
.watch-alert {
  color: var(--muted);
  font-size: 12px;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.watch-cost-actions {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
}

.watch-cost-actions .watch-cost {
  flex: 0 1 auto;
}

.watch-delete {
  width: 26px;
  min-width: 26px;
  height: 26px;
  min-height: 26px;
  padding: 0;
  border-color: transparent;
  background: transparent;
  color: #8a929c;
  border-radius: 6px;
  box-shadow: none;
}

.watch-delete:hover,
.watch-delete:focus-visible {
  color: var(--red);
  background: #fef2f2;
  border-color: #fecaca;
}

.watch-delete svg {
  width: 14px;
  height: 14px;
}

.status-bar {
  min-height: 36px;
  display: flex;
  align-items: center;
  padding: 0 12px;
  background: #eef2f5;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: #3d4752;
  font-size: 13px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.status-bar.warning {
  background: #fff7ed;
  border-color: #fed7aa;
  color: #9a3412;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 10px;
  margin: 12px 0;
}

.metric {
  display: grid;
  gap: 5px;
  min-height: 78px;
  padding: 12px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  min-width: 0;
}

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

.metric strong {
  font-size: 22px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.metric small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.25;
  min-height: 14px;
  overflow-wrap: anywhere;
}

.metric small.realtime {
  color: var(--green);
  font-weight: 800;
}

.metric small.warning {
  color: var(--amber);
  font-weight: 800;
}

.metric strong.support-range {
  font-size: 18px;
  line-height: 1.25;
}

.chart-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin: 0 0 10px;
}

.chart-toolbar p {
  color: var(--muted);
  font-size: 13px;
  margin-top: 3px;
  overflow-wrap: anywhere;
}

.chart-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.alert-count {
  min-width: 88px;
  height: 32px;
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  font-size: 13px;
  font-weight: 800;
  border: 1px solid var(--border-strong);
}

.alert-count.neutral {
  background: #f3f4f6;
  color: #4b5563;
}

.alert-count.hot {
  background: #fef2f2;
  color: var(--critical);
  border-color: #fecaca;
}

.chart-stack {
  display: grid;
  gap: 10px;
}

.chart {
  position: relative;
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--shadow);
  direction: ltr;
  unicode-bidi: isolate;
}

.chart-badge {
  position: absolute;
  top: 8px;
  left: 10px;
  z-index: 2;
  max-width: calc(100% - 20px);
  padding: 3px 7px;
  border: 1px solid rgba(201, 208, 215, 0.82);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.88);
  color: var(--muted);
  font-size: 11px;
  line-height: 1.2;
  font-weight: 700;
  pointer-events: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.price-chart {
  height: clamp(360px, 42vh, 520px);
}

.indicator-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.small-chart {
  height: clamp(180px, 22vh, 240px);
}

.lower-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}

.tool-panel {
  min-height: 170px;
}

.alerts-list,
.events-list,
.ai-summary {
  padding: 12px;
  display: grid;
  gap: 8px;
}

.alert-item,
.event-item {
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 10px;
  background: var(--panel-2);
}

.alert-title,
.event-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-weight: 800;
  margin-bottom: 5px;
  min-width: 0;
}

.alert-title span:first-child,
.event-title span:first-child {
  min-width: 0;
  overflow-wrap: anywhere;
}

.alert-item.notice {
  border-color: #bfdbfe;
  background: #eff6ff;
}

.alert-item.warning {
  border-color: #fed7aa;
  background: #fff7ed;
}

.alert-item.danger {
  border-color: #fecaca;
  background: #fef2f2;
}

.alert-item.critical {
  border-color: #fca5a5;
  background: #fff1f2;
}

.badge {
  flex: none;
  min-width: 46px;
  text-align: center;
  font-size: 11px;
  line-height: 1;
  padding: 5px 7px;
  border-radius: 999px;
  background: #e5e7eb;
  color: #374151;
}

.badge.critical,
.badge.danger {
  background: #fee2e2;
  color: var(--critical);
}

.badge.warning {
  background: #ffedd5;
  color: #9a3412;
}

.badge.notice {
  background: #dbeafe;
  color: #1d4ed8;
}

.alert-detail,
.event-detail {
  color: #4b5563;
  font-size: 13px;
  line-height: 1.45;
}

.event-link {
  color: var(--blue);
  text-decoration: none;
  overflow-wrap: anywhere;
}

.event-link:hover {
  text-decoration: underline;
}

.ai-panel {
  margin-top: 12px;
}

.trade-action-panel {
  margin: 12px 0;
  padding: 0;
  overflow: hidden;
}

.trade-action-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 14px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #ffffff 0%, var(--panel-2) 100%);
  box-shadow: inset 4px 0 0 var(--accent);
}

.trade-action-panel.critical .trade-action-hero {
  box-shadow: inset 4px 0 0 var(--critical);
}

.trade-action-panel.danger .trade-action-hero {
  box-shadow: inset 4px 0 0 var(--red);
}

.trade-action-panel.warning .trade-action-hero,
.trade-action-panel.starter .trade-action-hero {
  box-shadow: inset 4px 0 0 var(--amber);
}

.trade-action-panel.confirm .trade-action-hero {
  box-shadow: inset 4px 0 0 var(--green);
}

.trade-action-hero div {
  min-width: 0;
}

.trade-action-hero span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.trade-action-hero strong {
  display: block;
  margin-top: 4px;
  color: var(--ink);
  font-size: clamp(24px, 4vw, 34px);
  line-height: 1.08;
  overflow-wrap: anywhere;
}

.trade-action-hero p {
  margin-top: 7px;
  color: #4b5563;
  font-size: 13px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.trade-action-badge {
  flex: 0 0 auto;
  max-width: 40%;
  padding: 6px 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel);
  color: var(--ink) !important;
  text-align: center;
  overflow-wrap: anywhere;
}

.trade-action-meta {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  padding: 10px 12px 0;
}

.trade-action-chip {
  min-width: 0;
  padding: 8px 9px;
  border: 1px solid rgba(201, 208, 215, 0.86);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: inset 3px 0 0 var(--border);
}

.trade-action-chip small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.2;
}

.trade-action-chip strong {
  display: block;
  margin-top: 3px;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.trade-action-chip.critical {
  box-shadow: inset 3px 0 0 var(--critical);
}

.trade-action-chip.danger {
  box-shadow: inset 3px 0 0 var(--red);
}

.trade-action-chip.warning,
.trade-action-chip.starter {
  box-shadow: inset 3px 0 0 var(--amber);
}

.trade-action-chip.confirm {
  box-shadow: inset 3px 0 0 var(--green);
}

.trade-action-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 12px;
}

.trade-action-card {
  min-width: 0;
  min-height: 126px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-2);
}

.trade-action-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.25;
}

.trade-action-card strong {
  display: block;
  margin-top: 8px;
  color: var(--ink);
  font-size: 19px;
  line-height: 1.18;
  overflow-wrap: anywhere;
}

.trade-action-card p {
  margin-top: 8px;
  color: #4b5563;
  font-size: 12px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.trade-action-card.critical strong {
  color: var(--critical);
}

.trade-action-card.danger strong {
  color: var(--red);
}

.trade-action-card.warning strong,
.trade-action-card.starter strong {
  color: var(--amber);
}

.trade-action-card.confirm strong {
  color: var(--green);
}

.trade-action-basis {
  padding: 0 12px 12px;
}

.trade-action-basis summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.buy-panel {
  margin-top: 12px;
}

.setup-meta {
  display: grid;
  grid-template-columns: repeat(5, minmax(88px, 1fr));
  gap: 6px;
  margin-top: 9px;
}

.setup-meta div {
  min-width: 0;
  padding: 7px;
  border: 1px solid rgba(201, 208, 215, 0.78);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.66);
}

.setup-meta span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.2;
}

.setup-meta strong {
  display: block;
  margin-top: 3px;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.setup-reasons {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 8px;
}

.setup-reasons span {
  max-width: 100%;
  padding: 4px 7px;
  border-radius: 999px;
  background: rgba(229, 231, 235, 0.76);
  color: #4b5563;
  font-size: 11px;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.tradingview-panel {
  margin-top: 12px;
}

.sentiment-panel {
  margin-top: 12px;
}

.sentiment-body {
  display: grid;
  gap: 12px;
  padding: 12px;
}

.sentiment-dashboard {
  display: grid;
  grid-template-columns: minmax(210px, 300px) minmax(0, 1fr);
  gap: 24px;
  align-items: center;
  min-width: 0;
  padding: 18px 22px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff 0%, var(--panel-2) 100%);
  color: var(--ink);
  box-shadow: inset 3px 0 0 rgba(15, 118, 110, 0.86);
  overflow: hidden;
}

.sentiment-gauge-wrap {
  min-width: 0;
}

.sentiment-gauge-svg {
  display: block;
  width: 100%;
  max-width: 300px;
  height: auto;
}

.sentiment-gauge-svg path {
  fill: none;
  stroke-width: 28;
  stroke-linecap: round;
}

.gauge-label {
  fill: var(--muted);
  font-size: 18px;
  font-weight: 700;
}

.gauge-score {
  fill: var(--red);
  font-size: 44px;
  font-weight: 800;
  text-anchor: middle;
}

.gauge-needle {
  stroke: var(--ink);
  stroke-width: 4;
  stroke-linecap: round;
}

.gauge-center {
  fill: var(--panel);
  stroke: var(--border-strong);
  stroke-width: 2;
}

.sentiment-summary {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.sentiment-summary span {
  color: var(--muted);
  font-size: 15px;
  font-weight: 700;
}

.sentiment-summary strong {
  color: var(--red);
  font-size: clamp(28px, 5vw, 44px);
  line-height: 1.05;
}

.sentiment-summary p {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.45;
}

.sentiment-dashboard.greed .sentiment-summary strong,
.sentiment-dashboard.extreme-greed .sentiment-summary strong,
.sentiment-dashboard.greed .gauge-score,
.sentiment-dashboard.extreme-greed .gauge-score {
  color: var(--green);
  fill: var(--green);
}

.sentiment-dashboard.neutral .sentiment-summary strong,
.sentiment-dashboard.neutral .gauge-score {
  color: var(--amber);
  fill: var(--amber);
}

.sentiment-dashboard.fear,
.sentiment-dashboard.extreme-fear {
  box-shadow: inset 3px 0 0 rgba(220, 38, 38, 0.82);
}

.sentiment-dashboard.greed,
.sentiment-dashboard.extreme-greed {
  box-shadow: inset 3px 0 0 rgba(19, 138, 83, 0.82);
}

.sentiment-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
}

.sentiment-metric {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 9px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--panel-2);
}

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

.sentiment-metric strong {
  font-size: 16px;
  line-height: 1.2;
}

.sentiment-narratives {
  margin-top: 10px;
}

.sentiment-cost-note {
  color: var(--muted);
  font-size: 12px;
}

.sentiment-source-list {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
}

.sentiment-source-list > strong {
  color: var(--ink);
  font-size: 13px;
}

.sentiment-source-row {
  display: grid;
  grid-template-columns: minmax(90px, 1fr) auto auto;
  gap: 8px;
  align-items: center;
  min-width: 0;
  padding: 8px 9px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--panel-2);
}

.sentiment-source-row span,
.sentiment-source-row em {
  min-width: 0;
  overflow-wrap: anywhere;
}

.sentiment-source-row strong {
  color: var(--ink);
}

.sentiment-source-row em {
  color: var(--muted);
  font-style: normal;
}

.rtl .alert-title,
.rtl .event-title,
.rtl .panel-header,
.rtl .chart-toolbar,
.rtl .topbar,
.rtl .brand-area {
  direction: rtl;
}

.rtl .watch-row {
  text-align: right;
}

.rtl .watch-row.active {
  box-shadow: inset -3px 0 0 var(--accent);
}

.rtl .watch-cost,
.rtl .watch-alert {
  text-align: left;
}

.rtl .watch-cost-actions {
  justify-content: flex-start;
}

.rtl .chart-badge {
  left: auto;
  right: 10px;
}

.tradingview-panel.is-collapsed .panel-header {
  border-bottom: 0;
}

.collapse-button svg {
  transition: transform 0.18s ease;
}

.tradingview-panel:not(.is-collapsed) .collapse-button svg {
  transform: rotate(180deg);
}

.tradingview-widget {
  width: 100%;
  height: clamp(420px, 58vh, 640px);
  min-height: 360px;
  background: var(--panel);
  overflow: hidden;
  direction: ltr;
  unicode-bidi: isolate;
}

.tradingview-widget[hidden] {
  display: none;
}

.tradingview-widget .tradingview-widget-container,
.tradingview-widget iframe {
  width: 100%;
  height: 100%;
}

.ai-summary {
  color: #374151;
  font-size: 14px;
  line-height: 1.55;
  white-space: pre-line;
}

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

.empty-state {
  color: var(--muted);
  padding: 14px 2px;
  text-align: center;
  font-size: 13px;
}

.footer-note {
  padding: 10px max(18px, env(safe-area-inset-right)) calc(16px + env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
  text-align: center;
  color: var(--muted);
  font-size: 12px;
}

.auth-modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: max(18px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) max(18px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
  background: rgba(32, 33, 36, 0.42);
}

.auth-modal[hidden] {
  display: none;
}

.auth-dialog {
  width: min(440px, 100%);
  max-height: min(620px, calc(100vh - 36px));
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 18px 44px rgba(32, 33, 36, 0.22);
}

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

.auth-dialog-header div {
  min-width: 0;
}

.auth-dialog-header p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.auth-form {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.auth-form + .auth-form {
  padding-top: 0;
}

.auth-form[hidden] {
  display: none;
}

.auth-form-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.auth-message {
  min-height: 22px;
  padding: 0 14px 14px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.auth-message.success {
  color: var(--green);
}

.auth-message.warning {
  color: var(--amber);
}

.auth-message.error {
  color: var(--red);
}

.pricing-shell {
  background: var(--bg);
}

.pricing-topbar {
  align-items: center;
}

.pricing-brand {
  color: inherit;
  text-decoration: none;
}

.pricing-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pricing-main {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 18px 18px 28px;
}

.pricing-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(260px, 0.8fr);
  gap: 14px;
  align-items: stretch;
  margin-bottom: 14px;
}

.pricing-hero > div,
.pricing-status-card,
.pricing-card,
.pricing-note {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.pricing-hero > div:first-child {
  padding: 22px;
  box-shadow: inset 4px 0 0 var(--accent), var(--shadow);
}

.pricing-kicker {
  display: inline-flex;
  margin-bottom: 10px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 850;
}

.pricing-hero h2 {
  max-width: 860px;
  color: var(--ink);
  font-size: 30px;
  line-height: 1.16;
}

.pricing-hero p,
.pricing-card p,
.pricing-status-card p,
.pricing-note p {
  color: #4b5563;
  line-height: 1.55;
}

.pricing-hero p {
  max-width: 780px;
  margin-top: 10px;
  font-size: 14px;
}

.pricing-status-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  padding: 18px;
}

.pricing-status-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.pricing-status-card strong {
  margin-top: 7px;
  color: var(--green);
  font-size: 28px;
  line-height: 1.1;
}

.pricing-status-card p {
  margin-top: 9px;
  font-size: 13px;
}

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

.pricing-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 456px;
  padding: 14px;
}

.pricing-card.featured {
  border-color: rgba(15, 118, 110, 0.42);
  box-shadow: inset 4px 0 0 var(--accent), var(--shadow);
}

.pricing-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 850;
}

.pricing-card-head svg {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
}

.pricing-card > strong {
  display: block;
  margin-top: 12px;
  color: var(--ink);
  font-size: 30px;
  line-height: 1.1;
}

.pricing-card p {
  margin-top: 8px;
  min-height: 44px;
  font-size: 13px;
}

.pricing-card ul {
  display: grid;
  gap: 9px;
  margin: 14px 0 18px;
  padding: 0;
  list-style: none;
  color: #4b5563;
  font-size: 13px;
  line-height: 1.35;
}

.pricing-card li {
  position: relative;
  padding-left: 18px;
}

.pricing-card li::before {
  position: absolute;
  top: 0.56em;
  left: 0;
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--accent);
  content: "";
}

.pricing-action {
  width: 100%;
  margin-top: auto;
  text-decoration: none;
}

.pricing-matrix-panel {
  margin-top: 14px;
  overflow: hidden;
}

.pricing-matrix {
  display: grid;
  padding: 0 12px 12px;
  overflow-x: auto;
}

.pricing-matrix-row {
  display: grid;
  grid-template-columns: minmax(180px, 1.2fr) repeat(3, minmax(128px, 1fr));
  min-width: 650px;
  border-bottom: 1px solid var(--border);
}

.pricing-matrix-row:last-child {
  border-bottom: 0;
}

.pricing-matrix-row span {
  min-width: 0;
  padding: 11px 10px;
  color: #4b5563;
  font-size: 13px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.pricing-matrix-row.header span {
  color: var(--ink);
  font-weight: 850;
  background: var(--panel-2);
}

.pricing-note {
  margin-top: 14px;
  padding: 14px 16px;
}

.pricing-note strong {
  display: block;
  color: var(--ink);
  font-size: 14px;
}

.pricing-note p {
  margin-top: 6px;
  font-size: 13px;
}

.positive {
  color: var(--green);
}

.negative {
  color: var(--red);
}

@media (max-width: 1020px) {
  .topbar {
    align-items: stretch;
    flex-direction: column;
    gap: 12px;
  }

  .brand-area {
    align-items: center;
    justify-content: space-between;
  }

  .position-form {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(108px, 0.6fr) auto auto;
  }

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

  .watch-panel {
    position: static;
    min-height: auto;
  }

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

  .pricing-topbar {
    align-items: stretch;
  }

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

  .pricing-hero {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .topbar {
    position: static;
    padding: calc(12px + env(safe-area-inset-top)) 12px 12px;
  }

  .eyebrow {
    font-size: 11px;
  }

  h1 {
    font-size: 20px;
  }

  .brand-logo {
    width: 40px;
    height: 40px;
    border-radius: 9px;
  }

  h2 {
    font-size: 14px;
  }

  .brand-area {
    align-items: stretch;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(118px, 0.46fr) auto;
  }

  .language-control {
    min-width: 0;
  }

  .brand-area .topbar-link {
    align-self: end;
  }

  .pricing-main {
    padding: 12px max(12px, env(safe-area-inset-right)) 20px max(12px, env(safe-area-inset-left));
  }

  .pricing-hero > div:first-child {
    padding: 16px;
  }

  .pricing-hero h2 {
    font-size: 24px;
  }

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

  .pricing-card {
    min-height: auto;
  }

  input,
  select,
  button {
    height: 44px;
    min-height: 44px;
  }

  .icon-button {
    width: 44px;
  }

  .workspace {
    gap: 12px;
    padding: 12px max(12px, env(safe-area-inset-right)) 10px max(12px, env(safe-area-inset-left));
  }

  .position-form {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 8px;
  }

  .position-form label:nth-of-type(3) {
    grid-column: 1 / 2;
  }

  .position-form .primary-button {
    grid-column: 2 / 3;
    width: 100%;
  }

  .position-form .icon-button {
    grid-column: 1 / -1;
    width: 100%;
  }

  .watch-panel {
    padding: 10px;
  }

  .watchlist {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 10px 1px 2px;
  }

  .watch-row {
    width: 100%;
  }

  .status-bar {
    min-height: 42px;
    padding: 8px 10px;
    align-items: flex-start;
  }

  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

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

  .sentiment-dashboard {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 16px;
  }

  .trade-action-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
    padding: 12px;
  }

  .trade-action-badge {
    max-width: 100%;
    justify-self: start;
  }

  .trade-action-meta {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 10px 10px 0;
  }

  .trade-action-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 10px;
  }

  .trade-action-card {
    min-height: 118px;
  }

  .sentiment-gauge-svg {
    margin: 0 auto;
    max-width: 280px;
  }

  .metric {
    min-height: 72px;
    padding: 10px;
  }

  .metric strong {
    font-size: 20px;
  }

  .metric strong.support-range {
    font-size: 15px;
  }

  .support-metric {
    grid-column: 1 / -1;
  }

  .chart-toolbar {
    align-items: flex-start;
  }

  .chart-actions {
    align-items: flex-end;
  }

  .chart-toolbar p {
    font-size: 12px;
  }

  .alert-count {
    height: 30px;
    min-width: 76px;
    font-size: 12px;
  }

  .indicator-row,
  .lower-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .price-chart {
    height: clamp(320px, 58vh, 460px);
  }

  .small-chart {
    height: 190px;
  }

  .tradingview-widget {
    height: 520px;
    min-height: 420px;
  }

  .panel-header {
    padding: 10px;
  }

  .alerts-list,
  .events-list,
  .ai-summary {
    padding: 10px;
  }

  .setup-meta {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .alert-item,
  .event-item {
    padding: 10px;
  }
}

@media (max-width: 520px) {
  .topbar {
    gap: 10px;
  }

  .position-form {
    grid-template-columns: 1fr 1fr;
  }

  .brand-area {
    flex-wrap: wrap;
  }

  .brand-area .topbar-link,
  .auth-controls {
    flex: 1 1 auto;
  }

  .auth-button {
    max-width: none;
    flex: 1 1 auto;
  }

  .pricing-nav {
    width: 100%;
  }

  .pricing-nav .topbar-link {
    width: 100%;
  }

  .brand-logo {
    width: 38px;
    height: 38px;
  }

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

  .sentiment-dashboard {
    padding: 14px;
  }

  .trade-action-grid {
    grid-template-columns: 1fr;
  }

  .trade-action-meta {
    grid-template-columns: 1fr;
  }

  .trade-action-card {
    min-height: auto;
  }

  .sentiment-source-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .position-form label {
    min-width: 0;
  }

  .position-form label:nth-of-type(1),
  .position-form label:nth-of-type(2) {
    grid-column: span 1;
  }

  .position-form label:nth-of-type(3),
  .position-form .primary-button,
  .position-form .icon-button {
    grid-column: 1 / -1;
  }

  .chart-toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .chart-actions {
    justify-content: flex-end;
  }

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

  .watch-row {
    width: 100%;
  }

  .auth-dialog {
    max-height: calc(100vh - 28px);
  }
}

@media (max-width: 390px) {
  .workspace {
    padding-left: max(8px, env(safe-area-inset-left));
    padding-right: max(8px, env(safe-area-inset-right));
  }

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

  .price-chart {
    height: 330px;
  }

  .small-chart {
    height: 176px;
  }

  .setup-meta {
    grid-template-columns: 1fr;
  }

  .secondary-button.compact span {
    display: none;
  }

  .tradingview-widget {
    height: 460px;
    min-height: 380px;
  }

  .alert-title,
  .event-title {
    align-items: flex-start;
  }

  .badge {
    min-width: 40px;
  }
}
