/* DonutMarket: shared styles (Schwab-like look from the approved mockups) */

:root {
  --blue: #00539b;
  --cyan: #00a0df;
  --text: #1a1a1a;
  --grey: #6b7280;
  --line: #e3e6ea;
  --line-soft: #eef0f3;
  --row: #f1f2f4;
  --field: #cfd4da;
  --tint: #eef5fb;
  --up: #0a8a3a;
  --dn: #c0262d;
  --orange: #e8833a;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: #fff;
  color: var(--text);
  font: 14px/1.4 Arial, Helvetica, sans-serif;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }

/* ---- header ---- */

.hdr { border-bottom: 3px solid var(--cyan); background: #fff; }
.hdr .wrap { display: flex; align-items: center; gap: 22px; padding-top: 10px; padding-bottom: 8px; }
.logo { font-weight: 800; color: var(--blue); font-size: 18px; white-space: nowrap; }
.logo:hover { text-decoration: none; }
.nav { display: flex; gap: 4px; }
.nav a { font-size: 13px; padding: 4px 9px; border-radius: 3px; color: var(--blue); }
.nav a:hover { background: var(--tint); text-decoration: none; }
.nav a.on { background: var(--blue); color: #fff; }
.hdr .search { margin-left: auto; width: 280px; }

/* ---- search box + dropdown ---- */

.search { position: relative; }
.search input {
  width: 100%;
  border: 1px solid var(--field);
  border-radius: 3px;
  padding: 6px 9px;
  font: inherit;
  font-size: 13px;
  color: var(--text);
  background: #fff;
}
.search input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 2px var(--tint); }
.search.big input { font-size: 16px; padding: 10px 12px; }
.search-dd {
  position: absolute;
  z-index: 20;
  top: 100%;
  left: 0;
  right: 0;
  margin: 2px 0 0;
  padding: 0;
  list-style: none;
  background: #fff;
  border: 1px solid var(--field);
  border-radius: 3px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .12);
}
.search-dd[hidden] { display: none; }
.search-dd a { display: flex; justify-content: space-between; gap: 12px; padding: 6px 9px; color: var(--text); font-size: 13px; }
.search-dd a:hover, .search-dd a.sel { background: var(--tint); text-decoration: none; }
.search-dd .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-dd .px { color: var(--grey); white-space: nowrap; }
.search-dd .empty { padding: 6px 9px; color: var(--grey); font-size: 13px; }

/* ---- freshness / messages ---- */

.fresh { font-size: 12px; color: var(--grey); margin: 8px 0; min-height: 17px; }
.stale {
  background: #fdecec;
  border: 1px solid #f0b4b7;
  color: var(--dn);
  font-size: 13px;
  font-weight: 700;
  padding: 7px 10px;
  border-radius: 4px;
}
.msg { color: var(--grey); font-size: 13px; padding: 12px 0; }
.msg.err { color: var(--dn); }
.msg button { margin-left: 8px; }
.badge {
  display: inline-block;
  font-size: 11px;
  line-height: 16px;
  padding: 0 7px;
  border-radius: 9px;
  background: var(--row);
  color: var(--grey);
  white-space: nowrap;
  cursor: default;
}
.badge[hidden] { display: none; }
.badge.flag { background: #fff4d6; border: 1px solid #f0c24b; color: #7a5a00; font-weight: 700; }
.note { font-size: 11px; color: var(--grey); }
.muted { color: var(--grey); }

/* ---- item header ---- */

h1, .name { font-size: 22px; font-weight: 700; margin: 12px 0 4px; }
.quotes { display: flex; gap: 36px; flex-wrap: wrap; margin: 8px 0 4px; }
.q b { display: block; font-size: 11px; color: var(--grey); font-weight: 400; }
.q .px { font-size: 26px; font-weight: 700; margin-right: 4px; }

.up { color: var(--up); font-weight: 700; }
.dn { color: var(--dn); font-weight: 700; }
.ask { color: var(--blue); }
.bid { color: var(--up); }

/* ---- sections ---- */

.sec { --sec: var(--blue); --sec-tint: var(--tint); border-top: 2px solid var(--sec); margin-top: 18px; padding-top: 8px; }
.sec h2 { margin: 0 0 2px; color: var(--sec); font-size: 17px; }
/* Each section in its side's colour; Buy vs Sell in the blend of the two. */
#bo { --sec: #0a8a3a; --sec-tint: #e7f4ec; }
#vs { --sec: #056f6a; --sec-tint: #e5f1f0; }
.sec-head { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; margin: 0 0 2px; }
.sec-head h2 { margin: 0; }
h4 { font-size: 12px; margin: 10px 0 4px; color: #333; text-transform: uppercase; letter-spacing: .3px; }

/* ---- tabs (buttons or spans) ---- */

.tabs { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; margin: 6px 0; }
.tabs > button, .tabs > span, .tabs > a {
  font: inherit;
  font-size: 12px;
  padding: 3px 9px;
  border: 0;
  border-radius: 3px;
  background: none;
  color: var(--blue);
  cursor: pointer;
}
.tabs > button:hover, .tabs > a:hover { background: var(--tint); text-decoration: none; }
.tabs > .on, .tabs > .on:hover { background: var(--blue); color: #fff; }

button.btn {
  font: inherit;
  font-size: 12px;
  border: 1px solid var(--blue);
  border-radius: 3px;
  padding: 3px 10px;
  background: #fff;
  color: var(--blue);
  cursor: pointer;
}
button.btn:hover { background: var(--tint); }

/* ---- chart legends ---- */

.legend { font-size: 11px; color: #444; display: flex; gap: 16px; flex-wrap: wrap; margin: 2px 0 4px; min-height: 15px; }
.k { display: inline-block; width: 14px; height: 3px; vertical-align: middle; margin-right: 4px; }
.chart { position: relative; width: 100%; height: 340px; }
.chart.short { height: 240px; }
.chart-head { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 14px; margin: 6px 0 4px; }
.chart-head .legend { flex: 1 1 220px; margin: 0; }
.chart-box { position: relative; }
/* Volume legend, pinned by item.js to the top-left of the volume pane. */
.vol-legend {
  position: absolute;
  z-index: 3;
  left: 4px;
  top: 0;
  margin: 0;
  gap: 12px;
  min-height: 0;
  padding: 0 5px;
  background: rgba(255, 255, 255, .85);
  border-radius: 3px;
  white-space: nowrap;
}
.vol-legend .vl { color: var(--grey); font-weight: 700; font-size: 10px; text-transform: uppercase; letter-spacing: .4px; }

/* ---- heatmap toggle ---- */

.heat-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  line-height: 16px;
  padding: 4px 12px 4px 9px;
  border: 2px solid var(--sec, var(--blue));
  border-radius: 999px;
  background: #fff;
  color: var(--sec, var(--blue));
  cursor: pointer;
  white-space: nowrap;
}
.heat-btn:hover { background: var(--sec-tint, var(--tint)); }
.heat-btn:focus-visible { outline: 2px solid var(--sec, var(--blue)); outline-offset: 2px; }
.heat-btn .ic { flex: none; }
.heat-btn.on, .heat-btn.on:hover { background: var(--sec, var(--blue)); color: #fff; }

/* ---- stat grid ---- */

.grid { display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--line); margin: 10px 0; }
.grid > div { padding: 7px 6px; border-bottom: 1px solid var(--line-soft); font-size: 13px; }
.grid b { display: block; font-size: 10px; color: var(--grey); font-weight: 400; text-transform: uppercase; letter-spacing: .3px; }

/* ---- tables ---- */

table.book { font-size: 12px; border-collapse: collapse; width: 100%; }
.book td, .book th { padding: 3px 6px; border-bottom: 1px solid var(--row); text-align: left; }
.book th { font-size: 10px; color: var(--grey); font-weight: 400; text-transform: uppercase; letter-spacing: .3px; white-space: nowrap; }
td.r, th.r { text-align: right; }
.book .bar, .bar { height: 9px; display: inline-block; vertical-align: middle; }
svg.spark { display: block; }

/* ---- layout helpers ---- */

.cols { display: flex; gap: 18px; }
.cols > * { flex: 1; min-width: 0; }
.cols > :only-child { flex: 0 1 calc(50% - 9px); }

/* ---- home ---- */

.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 160px);
  padding-bottom: 60px;
}
.wordmark { font-size: 56px; font-weight: 800; color: var(--blue); letter-spacing: -1px; margin: 0 0 22px; text-align: center; }
.hero-search { width: 100%; max-width: 600px; }

/* ---- item page ---- */

.name { overflow-wrap: anywhere; }
.q .px.sm { font-size: 20px; }
.tabs > .badge, .tabs > .badge:hover { margin-left: 8px; padding: 0 7px; font-size: 11px; color: var(--grey); background: var(--row); border-radius: 9px; cursor: default; }
.ladder td.lb { width: 45%; }
#item.loading .chart { opacity: .55; transition: opacity .15s; }

/* ---- footer ---- */

.ftr { border-top: 1px solid var(--line); margin-top: 28px; padding: 10px 0 18px; font-size: 11px; color: var(--grey); }
.ftr a { color: inherit; }

/* ---- small screens ---- */

@media (max-width: 800px) {
  .hdr .wrap { flex-wrap: wrap; gap: 8px 14px; }
  .hdr .search { order: 3; width: 100%; margin-left: 0; }
  .cols { flex-direction: column; }
  .cols > :only-child { flex: 1; }
  .wordmark { font-size: 40px; }
  .grid { grid-template-columns: repeat(2, 1fr); }
  .quotes { gap: 18px; }
  .q .px { font-size: 22px; }
  .q .px.sm { font-size: 18px; }
  .chart { height: 280px; }
}
