/* Screens of docs/next-level.md: sheets, sparkline, bars, chips editor, journal,
   rules, notification settings, health. Same tokens as style.css. */

/* --- bottom sheet --------------------------------------------------------------- */
body.sheet-open { overflow: hidden; }
.sheet-back {
  position: fixed; inset: 0; z-index: 45; background: rgba(0, 0, 0, 0); display: flex; align-items: flex-end;
  justify-content: center; transition: background 0.18s;
}
.sheet-back.show { background: rgba(0, 0, 0, 0.45); }
.sheet {
  width: 100%; max-width: 760px; max-height: min(92vh, 100%); display: flex; flex-direction: column;
  background: var(--bg); border-radius: 18px 18px 0 0; outline: none; transform: translateY(40px); opacity: 0;
  transition: transform 0.2s ease-out, opacity 0.2s; padding-bottom: var(--safe-bottom);
}
.sheet-back.show .sheet { transform: none; opacity: 1; }
.sheet-grip { width: 36px; height: 4px; border-radius: 2px; background: var(--line); margin: 8px auto 0; flex: none; }
.sheet-head { display: flex; align-items: center; gap: 8px; padding: 2px 8px 0 16px; flex: none; }
.sheet-head b { flex: 1; min-width: 0; font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheet-x { width: 44px; height: 44px; border: 0; border-radius: 50%; background: transparent; color: var(--hint);
  font-size: 28px; line-height: 1; flex: none; }
.sheet-x:active { background: var(--soft); }
.sheet-body { overflow-y: auto; overscroll-behavior: contain; padding: 4px 16px 20px; position: relative; }
.sheet-body > * + * { margin-top: 10px; }
.sheet .card { background: var(--card); }

/* listing / deal detail sheet */
.sh-photo { position: relative; border-radius: 12px; overflow: hidden; background: var(--soft); aspect-ratio: 4 / 3;
  display: grid; place-items: center; font-size: 56px; }
.sh-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sh-photo .star { background: rgba(0, 0, 0, 0.35); color: #fff; right: 6px; top: 6px; }
.sh-photo .star[aria-pressed="true"] { color: #ffc83d; }
.sh-title { font-size: 17px; font-weight: 600; line-height: 1.3; margin: 0; overflow-wrap: anywhere; }
.sh-price { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; }
.sh-price .price { font-size: 26px; }
.sh-price s { color: var(--hint); font-size: 15px; }
.sh-facts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px 12px; margin: 0; }
.sh-facts div { min-width: 0; }
.sh-facts dt { color: var(--hint); font-size: 12px; }
.sh-facts dd { margin: 1px 0 0; font-size: 14px; font-weight: 500; overflow-wrap: anywhere; }
.sh-section { background: var(--card); border-radius: 12px; padding: 12px; }
.sh-section h3 { margin: 0 0 6px; font-size: 13px; text-transform: uppercase; letter-spacing: 0.3px; color: var(--section); font-weight: 600; }
.sh-actions { display: flex; flex-direction: column; gap: 8px; }
.sh-actions .btn-row .btn { flex: 1 1 130px; }
.liq { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; }

/* sparkline */
.spark { display: block; width: 100%; height: 64px; overflow: visible; }
.spark-line { stroke: var(--hint); stroke-width: 2; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.spark-area { fill: var(--soft); stroke: none; }
.spark circle { fill: var(--card); stroke: var(--hint); stroke-width: 2; vector-effect: non-scaling-stroke; }
.spark.down .spark-line, .spark.down circle { stroke: var(--good); }
.spark.down .spark-area { fill: var(--good-bg); }
.spark.up .spark-line, .spark.up circle { stroke: var(--bad); }
.spark.up .spark-area { fill: var(--bad-bg); }
.spark-cap { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--hint); margin-top: 4px; }
.hist-line { font-size: 14px; margin-top: 8px; }
.hist-line b.good { color: var(--good); }
.hist-line b.bad { color: var(--bad); }

/* price drops in the feed */
.drop-price { display: flex; align-items: baseline; flex-wrap: wrap; gap: 2px 8px; margin-top: 3px; }
.drop-price .price { color: var(--good); }
.drop-price s { color: var(--hint); font-size: 14px; }
.why { margin-top: 6px; font-size: 13px; color: var(--warn); background: var(--warn-bg); border-radius: 8px; padding: 4px 8px;
  display: inline-block; max-width: 100%; overflow-wrap: anywhere; }
.item.hidden-item .item-body { padding-right: 0; }
.mode-note { color: var(--hint); font-size: 13px; margin: 0 4px 10px; }

/* segmented switch Сделки | Мои сделки */
#flip-seg:empty { display: none; }
#flip-seg .seg { margin-bottom: 12px; }

/* chips editor */
.chipsed { margin-top: 12px; }
.chipsed:first-child { margin-top: 0; }
.chipsed .field-label { margin: 0 2px 4px; }
.ce-hint { display: block; color: var(--hint); font-size: 12px; margin: 0 2px 6px; }
.ce-box { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-height: 46px; padding: 5px 8px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--card); }
.ce-box:focus-within { border-color: var(--accent); }
.ce-input { flex: 1 1 110px; min-width: 90px; min-height: 36px; border: 0; background: transparent; outline: none; padding: 0 4px; }
.sheet .ce-box, .card .ce-box { background: var(--bg); }
.city-pick { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 6px; }
.city-pick .chip { min-height: 40px; font-size: 13px; padding: 4px 12px; }
.city-pick .chip[aria-pressed="true"] { background: var(--info-bg); color: var(--link); box-shadow: inset 0 0 0 1px var(--link); }

/* form bits */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.two-col > div { min-width: 0; }
.unit-in { position: relative; }
.unit-in .field { padding-right: 34px; }
.unit-in span { position: absolute; right: 12px; top: 0; bottom: 0; display: grid; place-items: center; color: var(--hint); pointer-events: none; font-size: 14px; }
input[type="time"].field { min-width: 0; }
textarea.field { min-height: 76px; resize: vertical; line-height: 1.35; }
select.field { appearance: auto; }
.err-text { color: var(--danger); font-size: 14px; margin: 8px 0 0; overflow-wrap: anywhere; }
.save-bar { margin-top: 12px; }
.rt-result { margin-top: 10px; padding: 10px 12px; border-radius: 12px; font-size: 14px; overflow-wrap: anywhere; }
.rt-result.pass { background: var(--good-bg); color: var(--good); }
.rt-result.drop { background: var(--bad-bg); color: var(--bad); }
.rt-result b { display: block; }
.soft-card { background: var(--bg); border-radius: 12px; padding: 12px; margin-top: 12px; }
.soft-card h3 { margin: 0 0 8px; font-size: 15px; }
.mini-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 14px; }
.mini-row:first-of-type { border-top: 0; }
.mini-row span:last-child { text-align: right; font-weight: 600; }
.link-card { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; border: 0; background: var(--card);
  border-radius: var(--radius); padding: 12px 14px; min-height: 56px; margin-top: 10px; }
.link-card .em { font-size: 22px; }
.link-card div { flex: 1; min-width: 0; }
.link-card b { display: block; font-size: 16px; }
.link-card small { color: var(--hint); font-size: 13px; }
.link-card .chev { color: var(--hint); font-size: 20px; }
.link-card:active { opacity: 0.8; }

/* journal */
.jr-hero { text-align: center; padding: 16px 14px; }
.jr-hero small { color: var(--hint); font-size: 13px; display: block; }
.jr-hero b { display: block; font-size: 34px; letter-spacing: -0.8px; line-height: 1.15; margin: 2px 0; }
.jr-hero b.good { color: var(--good); }
.jr-hero b.bad { color: var(--bad); }
.jr-tiles { margin-top: 10px; }
.jr-tiles .tile b { font-size: 20px; }
.bars { display: block; width: 100%; height: auto; }
.bar.pos { fill: var(--good); }
.bar.neg { fill: var(--bad); }
.bar-val { fill: var(--text); font-size: 10px; font-variant-numeric: tabular-nums; }
.bar-lab { fill: var(--hint); font-size: 10px; }
.bar-zero { stroke: var(--line); stroke-width: 1; }
.jr-table { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.jr-table th, .jr-table td { text-align: right; padding: 7px 4px; border-top: 1px solid var(--line); }
.jr-table th:first-child, .jr-table td:first-child { text-align: left; overflow-wrap: anywhere; }
.jr-table th { color: var(--hint); font-weight: 500; border-top: 0; }
.jr-card { background: var(--card); border-radius: var(--radius); padding: 12px; cursor: pointer; display: block; width: 100%; text-align: left; border: 0; }
.jr-card + .jr-card { margin-top: 10px; }
.jr-card:active { opacity: 0.85; }
.jr-top { display: flex; align-items: flex-start; gap: 10px; }
.jr-top .thumb { width: 52px; height: 52px; font-size: 22px; flex: none; }
.jr-top > div { flex: 1; min-width: 0; }
.jr-top .item-title { font-weight: 600; }
.jr-line { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.jr-profit { font-size: 22px; font-weight: 800; letter-spacing: -0.4px; }
.jr-profit.good { color: var(--good); }
.jr-profit.bad { color: var(--bad); }
.jr-calc { color: var(--hint); font-size: 13px; }
.jr-actions { display: flex; gap: 8px; margin-top: 10px; }
.jr-actions .btn { flex: 1; min-height: 40px; font-size: 14px; padding: 6px 10px; }
.badge.st-sold { background: var(--good-bg); color: var(--good); font-weight: 600; }
.badge.st-bought, .badge.st-listed { background: var(--info-bg); color: var(--link); font-weight: 600; }
.badge.st-cancelled { background: var(--soft); color: var(--hint); }
.result-big { text-align: center; padding: 18px 8px 8px; }
.result-big b { display: block; font-size: 38px; letter-spacing: -1px; }
.result-big b.good { color: var(--good); }
.result-big b.bad { color: var(--bad); }
.result-big span { color: var(--hint); font-size: 14px; display: block; margin-top: 4px; }
.preview { text-align: center; font-size: 14px; color: var(--hint); }
.preview b { font-size: 18px; }
.preview b.good { color: var(--good); }
.preview b.bad { color: var(--bad); }

/* health */
.hl-head { display: flex; align-items: center; gap: 12px; }
.hl-head b { display: block; font-size: 16px; }
.hl-head span.sub { margin: 0; }
.hl-ico { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-size: 18px; flex: none; }
.hl-ico.ok { background: var(--good-bg); color: var(--good); }
.hl-ico.warn { background: var(--warn-bg); color: var(--warn); }
.hl-ico.fail { background: var(--bad-bg); color: var(--bad); }
.hl-problems { list-style: none; margin: 10px 0 0; padding: 0; font-size: 14px; }
.hl-problems li { padding: 6px 10px; border-radius: 10px; background: var(--warn-bg); color: var(--warn); overflow-wrap: anywhere; }
.hl-problems li + li { margin-top: 4px; }
.hl-log { margin-top: 10px; }
.hl-log summary { cursor: pointer; min-height: 40px; display: flex; align-items: center; color: var(--link); font-size: 14px; }
.hl-log pre { margin: 0; padding: 10px; background: var(--bg); border-radius: 10px; font-size: 11.5px; line-height: 1.4;
  max-height: 260px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; }
.chk { display: flex; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.chk:first-child { border-top: 0; }
.chk .hl-ico { width: 30px; height: 30px; font-size: 15px; }
.chk b { display: block; font-size: 14px; }
.chk p { margin: 2px 0 0; font-size: 13px; color: var(--hint); overflow-wrap: anywhere; }
.chk p.fix { color: var(--text); }
.chk > div { min-width: 0; flex: 1; }
.chk-sum { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }

@media (min-width: 760px) { .sheet-back { align-items: center; } .sheet { border-radius: 18px; max-height: 88vh; } }
@media (prefers-reduced-motion: reduce) { .sheet, .sheet-back { transition: none; } }
