/* 3833 CAPITAL — Market Wall Dashboard */
:root {
  --bg: #0a0a0b;
  --bg-elevated: #111113;
  --panel: #141416;
  --panel-hover: #1a1a1d;
  --border: #2a2a2e;
  --border-soft: #1f1f23;
  --text: #f2f2f3;
  --text-muted: #8b8b93;
  --text-dim: #5c5c66;
  --green: #22c55e;
  --green-dim: rgba(34, 197, 94, 0.12);
  --red: #ef4444;
  --red-muted: #c45c5c;
  --red-dim: rgba(196, 92, 92, 0.12);
  --amber: #f59e0b;
  --amber-dim: rgba(245, 158, 11, 0.12);
  --blue: #60a5fa;
  --radius: 10px;
  --font: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", "SF Mono", ui-monospace, monospace;
}

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

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body {
  min-height: 100vh;
  background:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(34, 197, 94, 0.04), transparent),
    var(--bg);
}

.dashboard {
  max-width: 1920px;
  margin: 0 auto;
  padding: 16px 20px 28px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 100vh;
}

/* —— Header —— */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 4px 8px;
  border-bottom: 1px solid var(--border-soft);
  gap: 16px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}
.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: conic-gradient(from 210deg, #22c55e, #111113 35%, #f2f2f3 55%, #111113 75%, #22c55e);
  border: 2px solid #2a2a2e;
  flex-shrink: 0;
  box-shadow: inset 0 0 0 4px #0a0a0b;
}

.brand-name {
  font-size: clamp(22px, 2.4vw, 32px);
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--text);
  text-transform: uppercase;
}

.brand-tag {
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-dim);
  font-weight: 500;
}

.header-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  color: var(--text-muted);
  font-size: 12px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
  animation: pulse 2s ease-in-out infinite;
}

.status-pill.degraded .status-dot {
  background: var(--amber);
  box-shadow: 0 0 8px var(--amber);
}

.status-pill.error .status-dot {
  background: var(--red-muted);
  box-shadow: none;
  animation: none;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

.btn-refresh {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 6px;
  padding: 5px 12px;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.15s, color 0.15s;
}
.btn-refresh:hover {
  border-color: var(--text-muted);
  color: var(--text);
}

/* —— Grid sections —— */
.section-label {
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 8px;
  font-weight: 600;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  transition: border-color 0.15s, background 0.15s;
}
.panel:hover { border-color: #35353a; }

.panel-title {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 10px;
  font-weight: 600;
}

.row {
  display: grid;
  gap: 12px;
}

.row-top {
  grid-template-columns: 1.4fr 1fr 1fr;
}

.row-equities {
  grid-template-columns: repeat(5, 1fr);
}

.row-mid {
  grid-template-columns: 1.1fr 1.4fr 1.2fr;
}

.row-charts {
  grid-template-columns: 1fr 1fr;
  flex: 1;
  min-height: 260px;
}

.row-deals {
  grid-template-columns: 2fr 1fr;
}

@media (max-width: 1200px) {
  .row-top, .row-equities, .row-mid, .row-charts, .row-deals {
    grid-template-columns: 1fr 1fr;
  }
}
@media (max-width: 720px) {
  .row-top, .row-equities, .row-mid, .row-charts, .row-deals {
    grid-template-columns: 1fr;
  }
}

/* —— Overview / movers —— */
.overview-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.stat-block {
  padding: 8px 0;
}
.stat-block .label {
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 4px;
}
.stat-block .value {
  font-size: 22px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.stat-block .sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.mover-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mover-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 10px;
  border-radius: 6px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
}
.mover-row .sym {
  font-weight: 600;
  letter-spacing: 0.04em;
  font-size: 13px;
}
.mover-row .chg {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  font-size: 13px;
}
.mover-row .meta {
  font-size: 11px;
  color: var(--text-dim);
  margin-left: 8px;
}

.volume-bars {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.vol-row {
  display: grid;
  grid-template-columns: 64px 1fr 72px;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}
.vol-row .sym { font-weight: 600; color: var(--text-muted); }
.vol-track {
  height: 6px;
  background: var(--bg);
  border-radius: 3px;
  overflow: hidden;
  border: 1px solid var(--border-soft);
}
.vol-fill {
  height: 100%;
  background: linear-gradient(90deg, #1a5c35, var(--green));
  border-radius: 3px;
  transition: width 0.6s ease;
}
.vol-row .amt {
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
  font-size: 11px;
}

/* —— Asset cards —— */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}
.card-grid-3 {
  grid-template-columns: repeat(3, 1fr);
}

.asset-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  padding: 12px 14px;
  min-height: 108px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.asset-card .ticker {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text);
}
.asset-card .name {
  font-size: 10px;
  color: var(--text-dim);
  margin-top: 2px;
  letter-spacing: 0.04em;
}
.asset-card .price {
  font-size: 22px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  margin-top: 10px;
}
.asset-card .change {
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
}
.asset-card .badge {
  display: inline-block;
  margin-top: 10px;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 4px 8px;
  border-radius: 4px;
  background: var(--amber-dim);
  color: var(--amber);
  border: 1px solid rgba(245, 158, 11, 0.25);
  width: fit-content;
}
.asset-card .err {
  font-size: 12px;
  color: var(--red-muted);
  margin-top: 12px;
}

.up { color: var(--green); }
.down { color: var(--red-muted); }
.flat { color: var(--text-muted); }

/* —— Charts —— */
.chart-panel {
  display: flex;
  flex-direction: column;
  min-height: 280px;
}
.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
}
.chart-header .live-price {
  font-size: 18px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.chart-wrap {
  flex: 1;
  position: relative;
  min-height: 220px;
}
.chart-wrap canvas {
  width: 100% !important;
  height: 100% !important;
}
.chart-error {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  font-size: 13px;
}

/* —— Deals —— */
.deals-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.deal-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  padding: 16px;
  text-align: center;
}
.deal-card .stage {
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 10px;
}
.deal-card .count {
  font-size: 36px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
  line-height: 1;
}
.deal-card .count.placeholder {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-dim);
  letter-spacing: 0;
  padding: 8px 0;
}
.deal-card .status {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 8px;
}
.deals-note {
  margin-top: 10px;
  font-size: 11px;
  color: var(--text-dim);
}

.deal-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.deal-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.deal-form input {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 8px 10px;
  font-size: 14px;
  font-family: var(--mono);
}
.deal-form input:focus {
  outline: none;
  border-color: var(--green);
}
.deal-form .actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}
.deal-form button {
  flex: 1;
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
}
.deal-form button.primary {
  background: var(--green-dim);
  border-color: rgba(34, 197, 94, 0.35);
  color: var(--green);
}
.deal-form button:hover { border-color: var(--text-muted); }
.form-hint {
  font-size: 10px;
  color: var(--text-dim);
  line-height: 1.5;
}

.skeleton {
  background: linear-gradient(90deg, #1a1a1d 25%, #222226 50%, #1a1a1d 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: 4px;
  color: transparent !important;
  min-height: 1.2em;
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.footer-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 4px;
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 0.06em;
  flex-wrap: wrap;
  gap: 8px;
}
.footer-bar a { color: var(--text-muted); }

/* 5-up equities density on wall */
@media (min-width: 1201px) {
  .row-equities .asset-card .price { font-size: 20px; }
  .row-equities .asset-card { min-height: 100px; padding: 11px 12px; }
}
@media (max-width: 1400px) and (min-width: 1201px) {
  .row-equities { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}


/* —— PWA install hint —— */
.install-hint {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 12px;
}
.install-hint[hidden] { display: none !important; }
.btn-install {
  margin-left: auto;
  background: var(--green);
  color: #0a0a0b;
  border: none;
  border-radius: 6px;
  padding: 6px 12px;
  font-weight: 600;
  font-size: 12px;
  cursor: pointer;
}
.btn-install:hover { filter: brightness(1.08); }
.btn-install-dismiss {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}
.btn-install-dismiss:hover { color: var(--text); }
