:root {
  --black: #050505;
  --panel: #111111;
  --panel-2: #181818;
  --line: #303030;
  --line-soft: #242424;
  --text: #f5f5f5;
  --muted: #9b9b9b;
  --orange: #ff8a00;
  --cyan: #19c3ff;
  --green: #35d07f;
  --red: #ff496d;
  --violet: #ad7cff;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html { background: #202020; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background: #202020;
  letter-spacing: 0;
}
button, input { font: inherit; }
button { color: inherit; }
button, .assignment-row, .signal-row, .mail-row { -webkit-tap-highlight-color: transparent; }
.app-shell, .detail-view {
  width: min(540px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  background: var(--black);
  position: relative;
  border-inline: 1px solid #282828;
}
.app-shell { padding-bottom: calc(68px + var(--safe-bottom)); }
.top-bar {
  height: 58px;
  padding: 9px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(5,5,5,.96);
  border-bottom: 1px solid var(--line);
}
.brand, .top-actions button, .page-head button, .profile-head button {
  border: 0;
  background: transparent;
  padding: 0;
}
.brand { display: flex; align-items: center; gap: 8px; }
.brand-mark { font-weight: 900; font-size: 18px; color: white; }
.brand-product { padding: 3px 5px; background: var(--orange); color: black; font-weight: 900; font-size: 10px; }
.top-actions { display: flex; align-items: center; gap: 12px; }
.top-actions button { width: 30px; height: 30px; display: grid; place-items: center; position: relative; }
.top-actions svg { width: 19px; height: 19px; }
.badge, .nav-icon b {
  position: absolute;
  display: grid;
  place-items: center;
  background: var(--red);
  color: white;
  border-radius: 20px;
  font-size: 9px;
  line-height: 1;
  font-style: normal;
}
.badge { top: -3px; right: -4px; min-width: 16px; height: 16px; }
.live-clock { display: flex; align-items: center; gap: 5px; color: #bdbdbd; font-size: 10px; font-variant-numeric: tabular-nums; }
.live-clock b { width: 6px; height: 6px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px rgba(53,208,127,.12); }
.page { display: none; min-height: calc(100vh - 126px); }
.page.active { display: block; }
.pulse-head, .page-head, .profile-head { padding: 18px 16px 14px; }
.pulse-head { display: flex; align-items: flex-start; justify-content: space-between; }
.pulse-head span, .page-head > div > span, .profile-head > div > span, .section-head span {
  font-size: 10px;
  font-weight: 800;
  color: var(--orange);
}
h1, h2, p { margin-top: 0; }
.pulse-head h1, .page-head h1 { margin: 4px 0 0; font-size: 25px; line-height: 1.1; }
.pulse-head h1 span { font-size: inherit; color: white; }
.mode-switch { border: 1px solid #4d4d4d; background: #101010; height: 30px; padding: 0 9px; display: flex; align-items: center; gap: 6px; font-size: 10px; font-weight: 800; border-radius: 3px; }
.mode-switch span { width: 6px; height: 6px; border-radius: 50%; background: var(--green); }
.ticker-grid { display: grid; grid-template-columns: repeat(3, 1fr); border-block: 1px solid var(--line); }
.ticker-cell { padding: 10px 8px; min-width: 0; border-right: 1px solid var(--line); }
.ticker-cell:nth-child(3n) { border-right: 0; }
.ticker-cell:nth-child(n+4) { border-top: 1px solid var(--line); }
.ticker-cell span { display: block; color: var(--muted); font-size: 9px; font-weight: 700; }
.ticker-cell strong { display: block; margin: 3px 0 2px; font-size: 15px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ticker-cell small { font-size: 10px; font-weight: 800; color: var(--green); }
.ticker-cell small.down { color: var(--red); }
.breaking-alert {
  width: calc(100% - 24px);
  margin: 12px;
  padding: 10px 11px;
  border: 1px solid #613900;
  background: #181109;
  border-radius: 4px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 9px;
  align-items: center;
  text-align: left;
}
.breaking-alert > span { background: var(--orange); color: black; font-size: 9px; font-weight: 900; padding: 4px 5px; }
.breaking-alert strong { font-size: 12px; line-height: 1.35; }
.breaking-alert svg { width: 16px; }
.compact-section { border-top: 1px solid var(--line); }
.section-head { display: flex; align-items: end; justify-content: space-between; padding: 14px 14px 8px; }
.section-head h2 { margin: 3px 0 0; font-size: 17px; }
.section-head button, .timezone { border: 0; background: transparent; padding: 0; color: var(--muted); font-size: 10px; }
.assignment-row {
  width: 100%;
  display: grid;
  grid-template-columns: 29px 1fr auto;
  gap: 10px;
  align-items: start;
  padding: 11px 14px;
  text-align: left;
  color: inherit;
  background: transparent;
  border: 0;
  border-top: 1px solid var(--line-soft);
}
.assignment-rank { font-size: 17px; font-weight: 800; color: #636363; font-variant-numeric: tabular-nums; }
.assignment-copy { min-width: 0; }
.assignment-copy > span, .pipeline-meta span { font-size: 9px; color: var(--cyan); font-weight: 800; }
.assignment-copy strong { display: block; margin: 3px 0 4px; font-size: 13px; line-height: 1.3; }
.assignment-copy small { display: block; color: var(--muted); font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.assignment-row > time { color: #c8c8c8; font-size: 10px; font-variant-numeric: tabular-nums; }
.schedule-section { margin-top: 4px; }
.schedule-item { display: grid; grid-template-columns: 45px 1fr auto; gap: 10px; padding: 10px 14px; border-top: 1px solid var(--line-soft); align-items: center; }
.schedule-item time { color: white; font-size: 11px; font-weight: 800; }
.schedule-item strong { display: block; font-size: 12px; }
.schedule-item small { display: block; color: var(--muted); font-size: 10px; margin-top: 2px; }
.schedule-item > span { color: var(--orange); border: 1px solid #6b4300; padding: 3px 4px; font-size: 8px; font-weight: 800; }
.page-head { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--line); }
.page-head button { min-height: 32px; color: var(--orange); display: flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 800; }
.page-head button svg { width: 17px; }
.metric-strip, .profile-stats { display: grid; grid-template-columns: repeat(4, 1fr); border-bottom: 1px solid var(--line); }
.metric-strip div, .profile-stats div { min-width: 0; padding: 10px 8px; border-right: 1px solid var(--line); }
.metric-strip div:last-child, .profile-stats div:last-child { border-right: 0; }
.metric-strip strong, .profile-stats strong { display: block; font-size: 15px; }
.metric-strip span, .profile-stats span { display: block; color: var(--muted); font-size: 9px; line-height: 1.25; margin-top: 2px; }
.filter-rail { display: flex; gap: 5px; padding: 10px 12px; overflow-x: auto; border-bottom: 1px solid var(--line); scrollbar-width: none; }
.filter-rail::-webkit-scrollbar { display: none; }
.filter-rail button { flex: 0 0 auto; height: 28px; padding: 0 10px; border: 1px solid #3a3a3a; background: #101010; color: #aaa; border-radius: 3px; font-size: 10px; font-weight: 700; }
.filter-rail button.active { background: var(--orange); color: black; border-color: var(--orange); }
.pipeline-card { padding: 13px 14px; border-bottom: 1px solid var(--line); }
.pipeline-card button { width: 100%; border: 0; padding: 0; background: transparent; color: inherit; text-align: left; }
.pipeline-meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.pipeline-meta time { color: var(--muted); font-size: 10px; }
.pipeline-card h3 { margin: 7px 0 8px; font-size: 15px; line-height: 1.32; }
.pipeline-foot { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; }
.progress { height: 3px; background: #313131; }
.progress span { display: block; height: 100%; background: var(--orange); }
.pipeline-foot small { color: #a8a8a8; font-size: 9px; }
.market-table { border-bottom: 1px solid var(--line); }
.market-row { display: grid; grid-template-columns: 1fr auto auto; gap: 14px; padding: 10px 14px; border-top: 1px solid var(--line-soft); align-items: center; }
.market-row:first-child { border-top: 0; }
.market-row strong { font-size: 12px; }
.market-row span { font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }
.market-row small { min-width: 55px; text-align: right; color: var(--green); font-size: 10px; font-weight: 800; }
.market-row small.down { color: var(--red); }
.signal-row { width: 100%; border: 0; border-top: 1px solid var(--line-soft); background: transparent; color: inherit; padding: 11px 14px; text-align: left; display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.signal-row h3 { margin: 4px 0; font-size: 13px; }
.signal-row p { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.45; }
.signal-top { display: flex; align-items: center; gap: 7px; }
.signal-top span { color: var(--cyan); font-size: 9px; font-weight: 800; }
.signal-top b { color: black; background: var(--violet); padding: 2px 4px; font-size: 8px; }
.signal-row > div:last-child { display: flex; flex-direction: column; align-items: end; gap: 14px; color: var(--muted); font-size: 9px; }
.signal-row svg { width: 15px; }
.search-field { margin: 11px 12px 8px; height: 38px; display: flex; align-items: center; gap: 8px; border: 1px solid #3a3a3a; background: #101010; padding: 0 10px; border-radius: 3px; }
.search-field svg { width: 16px; color: #aaa; }
.search-field input { min-width: 0; flex: 1; border: 0; outline: 0; color: white; background: transparent; font-size: 12px; }
.compose-button { background: var(--orange) !important; color: black !important; padding: 0 9px !important; border-radius: 3px; }
.mail-summary { display: flex; gap: 18px; padding: 0 14px 10px; color: var(--muted); font-size: 9px; border-bottom: 1px solid var(--line); }
.mail-summary b { color: white; }
.mail-row { width: 100%; display: grid; grid-template-columns: 30px 1fr auto; gap: 10px; padding: 11px 14px; border: 0; border-bottom: 1px solid var(--line-soft); background: transparent; color: inherit; text-align: left; }
.mail-avatar { width: 30px; height: 30px; display: grid; place-items: center; background: #262626; border: 1px solid #444; color: var(--orange); font-size: 10px; font-weight: 900; }
.mail-row.unread .mail-avatar { background: var(--orange); color: black; border-color: var(--orange); }
.mail-copy { min-width: 0; }
.mail-line { display: flex; justify-content: space-between; gap: 8px; }
.mail-line strong { font-size: 12px; }
.mail-line span { color: var(--muted); font-size: 9px; }
.mail-copy h3 { margin: 3px 0; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mail-row.unread .mail-copy h3 { color: white; }
.mail-copy p { margin: 0; color: var(--muted); font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mail-tags { margin-top: 6px; display: flex; align-items: center; gap: 6px; }
.mail-tags span { color: var(--cyan); font-size: 8px; border: 1px solid #204657; padding: 2px 4px; }
.mail-tags small { color: #a5a5a5; font-size: 8px; display: flex; gap: 3px; align-items: center; }
.mail-tags svg { width: 11px; }
.mail-star { border: 0; background: transparent; padding: 1px; }
.mail-star svg { width: 15px; color: #666; }
.mail-star.active svg { color: var(--orange); fill: var(--orange); }
.profile-head { display: grid; grid-template-columns: 48px 1fr 30px; gap: 12px; align-items: center; border-bottom: 1px solid var(--line); }
.profile-avatar { width: 48px; height: 48px; display: grid; place-items: center; background: var(--orange); color: black; font-weight: 900; font-size: 16px; }
.profile-avatar.has-photo { overflow: hidden; background: #e8eaec; }
.profile-avatar.has-photo img { width: 100%; height: 100%; object-fit: cover; object-position: center top; }
.profile-head h1 { margin: 3px 0 2px; font-size: 20px; }
.profile-head p { margin: 0; color: var(--muted); font-size: 11px; }
.profile-head button { width: 30px; height: 30px; }
.profile-head svg { width: 18px; }
.credential { display: grid; grid-template-columns: 1fr 1fr auto; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.credential div { min-width: 0; }
.credential strong { display: block; font-size: 8px; color: var(--orange); }
.credential span { display: block; margin-top: 3px; font-size: 10px; color: #bbb; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.credential svg { width: 26px; }
.profile-stats { grid-template-columns: repeat(3, 1fr); }
.profile-menu button { width: 100%; display: grid; grid-template-columns: 28px 1fr 16px; gap: 10px; align-items: center; padding: 12px 14px; color: inherit; background: transparent; border: 0; border-bottom: 1px solid var(--line-soft); text-align: left; }
.profile-menu button > svg:first-child { width: 18px; color: var(--orange); }
.profile-menu button > svg:last-child { width: 15px; color: #666; }
.profile-menu strong { display: block; font-size: 12px; }
.profile-menu small { display: block; margin-top: 2px; color: var(--muted); font-size: 9px; }
.bottom-nav {
  position: fixed;
  z-index: 30;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: min(540px, 100%);
  height: calc(64px + var(--safe-bottom));
  padding: 5px 4px var(--safe-bottom);
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  background: rgba(10,10,10,.98);
  border-top: 1px solid #343434;
}
.bottom-nav button { min-width: 0; border: 0; background: transparent; color: #8d8d8d; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; padding: 0; font-size: 9px; font-weight: 700; }
.bottom-nav button.active { color: var(--orange); }
.bottom-nav svg { width: 20px; height: 20px; stroke-width: 1.8; }
.nav-icon { height: 20px; position: relative; display: block; }
.nav-icon b { top: -8px; right: -10px; min-width: 16px; height: 16px; }
.detail-view { position: fixed; z-index: 50; inset: 0; overflow-y: auto; }
.detail-view[hidden], .sheet-layer[hidden] { display: none; }
.detail-view > header { position: sticky; top: 0; z-index: 3; height: 54px; display: grid; grid-template-columns: 40px 1fr 40px; align-items: center; padding: 0 8px; background: rgba(5,5,5,.97); border-bottom: 1px solid var(--line); }
.detail-view > header button { border: 0; background: transparent; color: white; padding: 0; height: 40px; }
.detail-view > header svg { width: 20px; }
.detail-view > header h2 { margin: 0; font-size: 14px; text-align: center; }
.detail-content { padding-bottom: 32px; }
.detail-hero { padding: 18px 16px; border-bottom: 1px solid var(--line); }
.detail-hero > span { color: var(--orange); font-size: 9px; font-weight: 900; }
.detail-hero h1 { margin: 7px 0 10px; font-size: 23px; line-height: 1.22; }
.detail-hero p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.55; }
.detail-grid { display: grid; grid-template-columns: repeat(2, 1fr); border-bottom: 1px solid var(--line); }
.detail-grid div { padding: 11px 14px; border-right: 1px solid var(--line); border-top: 1px solid var(--line-soft); min-width: 0; }
.detail-grid div:nth-child(2n) { border-right: 0; }
.detail-grid small { display: block; color: var(--muted); font-size: 8px; }
.detail-grid strong { display: block; margin-top: 3px; font-size: 11px; overflow-wrap: anywhere; }
.detail-block { padding: 15px 16px; border-bottom: 1px solid var(--line); }
.detail-block h3 { margin: 0 0 9px; font-size: 13px; }
.detail-block p { margin: 0; color: #c0c0c0; white-space: pre-line; font-size: 11px; line-height: 1.6; }
.check-list { list-style: none; margin: 0; padding: 0; }
.check-list li { display: flex; gap: 8px; padding: 7px 0; border-top: 1px solid var(--line-soft); font-size: 11px; color: #c4c4c4; }
.check-list li:first-child { border-top: 0; }
.check-list li::before { content: ""; width: 7px; height: 7px; margin-top: 4px; background: var(--green); flex: 0 0 auto; }
.detail-action { width: calc(100% - 28px); margin: 14px; min-height: 42px; border: 0; border-radius: 3px; background: var(--orange); color: black; font-weight: 900; font-size: 12px; }
.mail-body { white-space: pre-line; }
.sheet-layer { position: fixed; z-index: 70; inset: 0; display: flex; justify-content: center; align-items: end; }
.sheet-scrim { position: absolute; inset: 0; border: 0; background: rgba(0,0,0,.68); }
.action-sheet { position: relative; width: min(540px, 100%); background: #171717; border-top: 1px solid #444; padding: 16px 14px calc(16px + var(--safe-bottom)); }
.action-sheet h2 { margin: 0 0 10px; font-size: 17px; }
.action-sheet p { color: var(--muted); font-size: 11px; line-height: 1.5; }
.action-sheet label { display: block; color: #aaa; font-size: 9px; margin: 10px 0 4px; }
.action-sheet input, .action-sheet textarea { width: 100%; border: 1px solid #3c3c3c; background: #0b0b0b; color: white; padding: 10px; outline: 0; border-radius: 3px; font-size: 12px; }
.action-sheet textarea { min-height: 92px; resize: none; }
.sheet-actions { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-top: 12px; }
.sheet-actions button { height: 39px; border: 1px solid #444; background: transparent; color: white; border-radius: 3px; }
.sheet-actions button:last-child { border: 0; padding: 0 18px; background: var(--orange); color: black; font-weight: 900; }
.toast { position: fixed; z-index: 90; left: 50%; bottom: calc(78px + var(--safe-bottom)); transform: translate(-50%, 12px); max-width: calc(100% - 36px); background: #f3f3f3; color: #111; padding: 8px 12px; border-radius: 3px; font-size: 10px; opacity: 0; pointer-events: none; transition: .18s ease; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (min-width: 541px) {
  .app-shell, .detail-view { box-shadow: 0 18px 60px rgba(0,0,0,.35); }
}
