body { line-height: 1.45; }
.wrap { width: min(100%, 1280px); padding: 20px clamp(14px, 3vw, 30px) 30px; }
.rates-heading { margin-bottom: 12px; justify-content: space-between; }
.rates-heading h1 { font-size: clamp(20px, 3vw, 26px); line-height: 1.22; }
:where(button, a, summary, input):focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.wrap > .sec { margin: 22px 0 9px; flex-wrap: wrap; gap: 2px 9px; }
.wrap > .sec .tag { min-width: 0; color: var(--muted); }
.wrap > .cards { grid-template-columns: repeat(auto-fit, minmax(148px, 1fr)); gap: 9px; }
.wrap > #rtCards { grid-template-columns: repeat(5,minmax(0,1fr)); }
.wrap > #cards { margin-top: 9px; }
.wrap > .cards > .card { min-width: 0; }
.wrap > .cards .k { white-space: normal; word-break: break-word; }
.wrap > .cards .v { font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
#rates-daily + header { margin-bottom: 10px; }
#seriesBtns { gap: 6px; }
#seriesBtns button, .rates-range button { min-height: 36px; font-weight: 550; }
.rates-range { padding: 12px; margin: 0 0 8px; background: var(--card); border: 1px solid var(--border); border-radius: 10px; }
.rates-range-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 14px; }
.rates-range-buttons { display: flex; flex-wrap: wrap; gap: 5px; }
.rates-range button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.rates-window { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.rates-custom { margin-top: 6px; }
.rates-custom summary { width: fit-content; padding: 5px 0; cursor: pointer; color: var(--accent); font-size: 13px; }
.rates-custom form { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr) auto; gap: 8px; max-width: 480px; align-items: end; padding: 4px 0 2px; }
.rates-custom label { min-width: 0; color: var(--muted); font-size: 12px; }
.rates-custom input { display: block; min-width: 0; width: 100%; min-height: 38px; margin-top: 3px; padding: 5px; border: 1px solid var(--border); border-radius: 6px; background: var(--card); color: var(--text); }
.rates-custom button { min-height: 38px; }
.rates-date-error { font-size: 12px; color: #9f302e; }
.rates-date-error:not(:empty) { margin-top: 4px; }
.wrap .cycle-card header { margin-bottom: 6px; }
.wrap .cycle-table { overscroll-behavior-inline: contain; }
.wrap .dg .card, .wrap .dg .m, .wrap .dg .cp { min-width: 0; }
.wrap .dg .mv, .wrap .dg .cv, .wrap .dg .cp, .wrap .dg .lead { overflow-wrap: anywhere; }
.wrap .dg h3 { flex-wrap: wrap; }
.wrap > section, .wrap > .sec { scroll-margin-top: 14px; }
.cycle-table .cycle-mobile { display: none; }
.stock-groups { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 15px; }
.stock-market h3 { font-size: 14px; margin-bottom: 6px; }
.stock-days { list-style: none; border: 1px solid var(--border); border-radius: 8px; }
.stock-days li { display: grid; grid-template-columns: 50px minmax(0,1fr); gap: 8px; padding: 7px 9px; }
.stock-days li + li { border-top: 1px solid var(--border); }
.stock-date, .stock-symbol { font-variant-numeric: tabular-nums; white-space: nowrap; font-size: 12px; }
.stock-muted, .stock-symbol { color: var(--muted); font-size: 12px; }
.stock-notice { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 7px; overflow-wrap: anywhere; }
.stock-notice + .stock-notice { margin-top: 5px; }
.stock-buy { color: #16745a; }
.stock-sell { color: #a53c2b; }

@media (min-width: 641px) and (max-width: 920px) {
  .wrap > #rtCards { grid-template-columns: repeat(4,minmax(0,1fr)); }
}

@media (max-width: 640px) {
  .wrap { padding: 14px 12px 24px; }
  .rates-heading { align-items: flex-start; gap: 5px 12px; }
  .rates-heading .meta { min-width: 0; }
  .wrap > .cards { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 7px; }
  .wrap > #rtCards { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .wrap > .cards > .card { padding: 9px; }
  .wrap > .cards .v { font-size: 16px; }
  .wrap > .cards .d { font-size: 11px; }
  #seriesBtns { display: flex; width: 100%; flex-wrap: nowrap; overflow-x: auto; padding: 2px 2px 5px; }
  #seriesBtns button { flex: 0 0 auto; white-space: nowrap; min-height: 44px; }
  .rates-range { padding: 9px; }
  .rates-range-buttons { display: grid; width: 100%; grid-template-columns: repeat(5,minmax(0,1fr)); gap: 4px; }
  .rates-range-buttons button { padding: 3px; min-height: 44px; white-space: nowrap; }
  .rates-custom summary { padding: 9px 0; }
  .rates-custom input { min-height: 42px; font-size: 16px; }
  .rates-custom button { min-height: 42px; }
  #chart { height: clamp(260px, 75vw, 335px); touch-action: pan-y; }
  .wrap .cycle-card { padding: 10px; }
  .wrap .cycle-table table { min-width: 0; }
  .wrap .cycle-table .cycle-desktop { display: none; }
  .wrap .cycle-table .cycle-mobile { display: table; }
  .wrap .cycle-mobile td { width: 34%; white-space: normal; }
  .wrap .cycle-table td, .wrap .cycle-table th { padding: 7px 6px; }
  :is(#cycle-history, #stock-history) :is(table, tbody) { display: block; }
  :is(#cycle-history, #stock-history) thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  :is(#cycle-history, #stock-history) tbody tr { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; padding: 6px 0; border-top: 1px solid var(--border); }
  :is(#cycle-history, #stock-history) tbody th { grid-column: 1 / -1; }
  :is(#cycle-history, #stock-history) tbody tr > * { border-top: 0; white-space: normal; }
  :is(#cycle-history, #stock-history) td::before { display: block; content: attr(data-label); color: var(--muted); font-size: 12px; }
  .stock-groups { grid-template-columns: minmax(0,1fr); }
  .wrap .dg .card { padding: 10px; }
  .wrap .dg .grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .wrap .dg .cmp { gap: 5px; }
  .wrap .dg .case table, .wrap .dg .valuation table { display: block; max-width: 100%; overflow-x: auto; }
}
