/* ==========================================================================
   Trade Toolkit PRO v2 — New tools, floating bubbles & mobile layer
   Loaded after design.css and reuses its tokens.
   ========================================================================== */
[hidden] { display: none !important; }

.tabs button {
  flex: 1 0 auto;
  min-width: 0;
  padding: 11px 14px;
  font-size: 13.5px;
}

.inline-sub {
  display: inline;
  margin: 0 0 0 4px;
  font-size: 11px;
  color: var(--text-dim);
}

.warn { color: var(--amber) !important; }

.controls-4 {
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}

.controls [hidden] { display: none !important; }

.summary-4 { grid-template-columns: repeat(4, 1fr); }

.stat:nth-child(4)::before {
  background: linear-gradient(180deg, #f59e0b, #f43f5e);
}

.stat-hero {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.18) 0%, rgba(16, 185, 129, 0.12) 100%), var(--surface);
  border-color: rgba(99, 102, 241, 0.35);
}

.stat-hero::before { background: linear-gradient(180deg, #6366f1, #10b981) !important; }

.stat-warn strong { font-size: 22px; }

.split-2 {
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  gap: 22px;
  align-items: start;
  margin-bottom: 22px;
}

.split-wide { grid-template-columns: 1.7fr 1fr; }

.split-2 > *, .stack > * { min-width: 0; }

.stack {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.stack .tablebox { margin-bottom: 0; }

td.basis {
  font-size: 11.5px;
  color: var(--text-muted);
  font-weight: 500;
  white-space: normal;
  text-align: left;
}

/* Segmented control */
.segmented {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  margin-bottom: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-sm);
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
}

.segmented::-webkit-scrollbar { display: none; }

.segmented button {
  border: 0;
  background: transparent;
  color: var(--text-muted);
  border-radius: var(--radius-pill);
  padding: 9px 18px;
  font-size: 13px;
  white-space: nowrap;
  flex: 0 0 auto;
}

.segmented button:hover { transform: none; color: var(--text); background: var(--surface2); }

.segmented button[aria-checked="true"] {
  background: linear-gradient(135deg, var(--accent) 0%, #7c3aed 100%);
  color: #fff;
  box-shadow: 0 3px 12px var(--accent-glow);
}

.preset-chip.on {
  background: var(--accent-light);
  border-color: var(--accent);
  color: var(--accent);
}

/* Rates disclosure */
.ratebox {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin: -8px 0 22px;
  box-shadow: var(--shadow-sm);
}

.ratebox summary {
  cursor: pointer;
  padding: 14px 18px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 10px;
  list-style: none;
}

.ratebox summary::-webkit-details-marker { display: none; }
.ratebox summary::before { content: '▸'; transition: transform 0.2s ease; }
.ratebox[open] summary::before { transform: rotate(90deg); }

.rate-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
  padding: 4px 18px 8px;
}

.rate-grid input { font-size: 15px; padding: 9px 12px; }
.rate-grid label { font-size: 11px; }

.rate-note {
  padding: 6px 18px 16px;
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.55;
}

/* Price ladder */
.ladder {
  display: flex;
  flex-direction: column;
  padding: 6px 4px 10px 8px;
  position: relative;
}

.ladder::before {
  content: '';
  position: absolute;
  left: 15px;
  top: 16px;
  bottom: 20px;
  width: 2px;
  background: linear-gradient(180deg, var(--green), var(--border-strong) 50%, var(--red));
  opacity: 0.45;
  border-radius: 2px;
}

.rung {
  display: grid;
  grid-template-columns: 16px 64px 1fr auto;
  grid-template-areas: "dot name line price" ". . . note";
  align-items: center;
  column-gap: 10px;
  min-height: 30px;
  position: relative;
  transition: margin 0.25s ease;
}

.rung-dot {
  grid-area: dot;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--surface-solid);
  border: 3px solid var(--text-dim);
  z-index: 1;
}

.rung-name { grid-area: name; font-size: 12.5px; font-weight: 800; color: var(--text-muted); font-family: var(--font-mono); }
.rung-line { grid-area: line; height: 1px; border-top: 1px dashed var(--border-strong); }
.rung-price { grid-area: price; font-family: var(--font-mono); font-size: 15px; font-weight: 800; color: var(--text); }
.rung-note { grid-area: note; font-style: normal; font-size: 11.5px; font-weight: 700; text-align: right; font-family: var(--font-mono); }

.rung-r .rung-dot, .rung-tgt .rung-dot { border-color: var(--green); }
.rung-r .rung-name, .rung-tgt .rung-name, .rung-tgt .rung-note { color: var(--green); }
.rung-s .rung-dot, .rung-sl .rung-dot { border-color: var(--red); }
.rung-s .rung-name, .rung-sl .rung-name, .rung-sl .rung-note { color: var(--red); }
.rung-p .rung-dot, .rung-entry .rung-dot { border-color: var(--accent); background: var(--accent); }
.rung-p .rung-name, .rung-entry .rung-name { color: var(--accent); }

.rung-p, .rung-entry, .rung-ltp {
  background: var(--accent-light);
  border-radius: 10px;
  margin-left: -6px;
  padding-left: 6px;
  padding-right: 8px;
}

.rung-ltp { background: var(--amber-light); }
.rung-ltp .rung-dot { border-color: var(--amber); background: var(--amber); box-shadow: 0 0 0 5px var(--amber-glow); }
.rung-ltp .rung-name, .rung-ltp .rung-price { color: var(--amber); }

tr.lvl-p td { background: var(--accent-light); }
tr.lvl-r td:first-child { color: var(--green); }
tr.lvl-s td:first-child { color: var(--red); }

.zone-tag { font-size: 15px !important; color: var(--amber) !important; }

/* Horizontal bars */
.hbars { display: flex; flex-direction: column; gap: 18px; }
.hbar-group { display: flex; flex-direction: column; gap: 10px; }
.hbar-group + .hbar-group { padding-top: 16px; border-top: 1px solid var(--border); }

.hbar {
  display: grid;
  grid-template-columns: 100px 1fr 86px;
  align-items: center;
  gap: 10px;
  font-size: 12.5px;
}

.hbar-name { color: var(--text-muted); font-weight: 600; }
.hbar strong { text-align: right; font-family: var(--font-mono); font-size: 13px; }

.hbar-track {
  height: 12px;
  background: var(--surface2);
  border-radius: var(--radius-pill);
  overflow: hidden;
}

.hbar-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  min-width: 3px;
  transition: width 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Donut & legend */
.donut { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.donut svg { width: 100%; max-width: 220px; height: auto; }
.donut circle { transition: stroke-dasharray 0.4s ease; }

.donut-legend {
  list-style: none;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.donut-legend li {
  display: grid;
  grid-template-columns: 12px 1fr auto;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 600;
}

.donut-legend i, .legend i {
  width: 12px;
  height: 12px;
  border-radius: 4px;
  display: inline-block;
}

.donut-legend strong { font-family: var(--font-mono); color: var(--text); }

.legend { display: flex; gap: 14px; font-size: 12px; font-weight: 600; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }

.barchart .bar { cursor: pointer; outline: none; }
.barchart .bar rect:not([fill="transparent"]) { transition: opacity 0.15s ease; }
.barchart:hover .bar:not(:hover) rect:not([fill="transparent"]) { opacity: 0.55; }
.barchart .bar.on rect[fill="transparent"] { fill: var(--accent-light); }

.bar-tip {
  margin-top: 10px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  min-height: 18px;
  text-align: center;
}

.chartbox svg[data-hover] { touch-action: pan-y; cursor: crosshair; }

/* Toasts (base styles were missing in v1) */
#toast-container {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 400;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: var(--radius-pill);
  background: var(--surface-elevated);
  border: 1px solid var(--border-strong);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  animation: toast-in 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  max-width: min(92vw, 420px);
}

.toast-ok { color: var(--green); font-weight: 800; }
.toast-out { opacity: 0; transform: translateY(8px); transition: all 0.25s ease; }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(12px) scale(0.96); }
  to { opacity: 1; transform: none; }
}

/* Calculator v2 */
.calc-preview {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 700;
  color: var(--green);
  min-height: 20px;
  margin-top: 4px;
  opacity: 0.9;
}

.calc-display[data-size="sm"] { font-size: 28px; }
.calc-display[data-size="xs"] { font-size: 22px; }

.calc-btn-op.is-active-op {
  background: linear-gradient(135deg, var(--accent) 0%, #7c3aed 100%);
  color: #fff;
  box-shadow: 0 0 0 3px var(--accent-light), 0 0 18px var(--accent-glow);
}

html[data-theme="light"] .calc-btn-op { color: var(--accent); }
html[data-theme="light"] .calc-btn-op.is-active-op { color: #fff; }

.calc-keypad .calc-circle-btn {
  width: 100%;
  max-width: 70px;
  height: auto;
  aspect-ratio: 1;
  touch-action: manipulation;
}

.calc-history-item {
  width: 100%;
  text-align: left;
  font-weight: 600;
}

.calc-history-item:hover { transform: none; }

/* Footer */
.site-foot {
  margin-top: 40px;
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--text-muted);
}

/* ==========================================================================
   Floating Split Bubbles
   ========================================================================== */
.bubble-root {
  position: fixed;
  z-index: 300;
  width: 60px;
  height: 60px;
  top: calc(100vh - 100px);
  right: 14px;
  transition: opacity 0.2s ease;
}

.bubble-root.snap {
  transition: left 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), top 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.2s ease;
}

.bubble-root.hidden-by-sheet { opacity: 0; pointer-events: none; }

.bubble-main {
  position: relative;
  z-index: 2;
  width: 60px;
  height: 60px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: radial-gradient(circle at 30% 25%, #a5b4fc 0%, #6366f1 38%, #7c3aed 100%);
  color: #fff;
  font-size: 26px;
  box-shadow: 0 10px 28px rgba(79, 70, 229, 0.55), inset 0 -4px 10px rgba(0, 0, 0, 0.2), inset 0 3px 8px rgba(255, 255, 255, 0.35);
  touch-action: none;
  cursor: grab;
  animation: bubble-float 4s ease-in-out infinite;
}

.bubble-main::after {
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px solid rgba(129, 140, 248, 0.45);
  animation: bubble-ring 2.6s ease-out infinite;
  pointer-events: none;
}

.bubble-main:hover {
  transform: scale(1.06);
  background: radial-gradient(circle at 30% 25%, #c7d2fe 0%, #6366f1 38%, #7c3aed 100%);
}

.bubble-root.dragging .bubble-main { cursor: grabbing; animation: none; transform: scale(1.12); }
.bubble-root.dragging .bubble-main::after,
.bubble-root.open .bubble-main::after { animation: none; opacity: 0; }

.bubble-main > span {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.2s ease;
}

.bubble-icon-close { opacity: 0; transform: rotate(-90deg) scale(0.5); font-size: 22px; }
.bubble-root.open .bubble-icon-open { opacity: 0; transform: rotate(90deg) scale(0.5); }
.bubble-root.open .bubble-icon-close { opacity: 1; transform: none; }

.bubble-root.open .bubble-main {
  animation: none;
  background: radial-gradient(circle at 30% 25%, #fda4af 0%, #f43f5e 45%, #be123c 100%);
  box-shadow: 0 10px 28px rgba(244, 63, 94, 0.45);
}

@keyframes bubble-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

@keyframes bubble-ring {
  0% { transform: scale(0.9); opacity: 0.9; }
  100% { transform: scale(1.35); opacity: 0; }
}

.bubble-children {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.bubble-child {
  --step: 60px;
  position: absolute;
  left: 7px;
  top: 7px;
  width: 46px;
  height: 46px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: var(--surface-elevated);
  color: var(--text);
  font-size: 19px;
  font-weight: 800;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.35);
  opacity: 0;
  transform: translate(0, 0) scale(0.3);
  transition: transform 0.42s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.2s ease;
  transition-delay: calc((4 - var(--i)) * 25ms);
}

.bubble-child > span { pointer-events: none; }

.bubble-child em {
  position: absolute;
  top: 50%;
  right: calc(100% + 10px);
  transform: translateY(-50%);
  font-style: normal;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  padding: 5px 10px;
  border-radius: var(--radius-pill);
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  color: var(--text);
  pointer-events: none;
}

.bubble-root[data-side="left"] .bubble-child em { right: auto; left: calc(100% + 10px); }

.bubble-root.open .bubble-children { pointer-events: auto; }

.bubble-root.open .bubble-child {
  opacity: 1;
  transition-delay: calc(var(--i) * 45ms);
  transform: translateY(calc(var(--step) * (var(--i) + 1) * -1)) scale(1);
  animation: bubble-split 0.5s calc(var(--i) * 45ms) both;
}

.bubble-root.open[data-dir="down"] .bubble-child {
  transform: translateY(calc(var(--step) * (var(--i) + 1))) scale(1);
}

.bubble-child:hover {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

/* Liquid "split" squash as each bubble pinches off the main one */
@keyframes bubble-split {
  0% { border-radius: 50%; }
  35% { border-radius: 46% 54% 42% 58% / 60% 40% 60% 40%; }
  70% { border-radius: 52% 48% 55% 45% / 45% 55% 45% 55%; }
  100% { border-radius: 50%; }
}

/* Sheet: floating card on desktop, bottom sheet on phones */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 310;
  background: rgba(2, 6, 23, 0.55);
  backdrop-filter: blur(2px);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.sheet-backdrop.in { opacity: 1; }

.sheet {
  position: fixed;
  z-index: 320;
  bottom: 24px;
  right: 24px;
  width: 380px;
  max-height: min(680px, calc(100vh - 48px));
  display: flex;
  flex-direction: column;
  background: var(--surface-solid);
  border: 1px solid var(--border-strong);
  border-radius: 24px;
  box-shadow: var(--shadow-lg), 0 30px 60px rgba(0, 0, 0, 0.35);
  opacity: 0;
  transform: translateY(16px) scale(0.97);
  transform-origin: bottom right;
  transition: opacity 0.22s ease, transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

.sheet[data-side="left"] { right: auto; left: 24px; transform-origin: bottom left; }
.sheet.in { opacity: 1; transform: none; }
.sheet.dragging { transition: none; }

.sheet::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 3px;
  background: linear-gradient(90deg, #6366f1, #06b6d4, #10b981);
}

.sheet-grip { display: none; }

.sheet-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 14px 10px 18px;
  border-bottom: 1px solid var(--border);
}

.sheet-head h3 {
  font-size: 15px;
  font-weight: 800;
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sheet-tabs { display: flex; gap: 4px; }

.sheet-tabs button,
.sheet-close {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 50%;
  font-size: 14px;
  font-weight: 800;
}

.sheet-tabs button[aria-selected="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.sheet-close { background: transparent; color: var(--text-muted); }

.sheet-body {
  padding: 16px 18px 20px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

/* Mini tools */
.mini-calc { display: flex; flex-direction: column; gap: 12px; }
.mini-calc .calc-screen { min-height: 96px; padding: 14px 16px; }
.mini-calc .calc-display { font-size: 30px; }
.mini-calc .calc-keypad { gap: 10px; }
.mini-calc .calc-keypad .calc-circle-btn { max-width: 62px; font-size: 19px; }

.mini-history summary {
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-muted);
  padding: 4px 0;
}

.mini-history .calc-history-list { max-height: 180px; padding: 8px 0 0; }

.mini-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mini-grid-3 { grid-template-columns: repeat(3, 1fr); }
.sheet-body input { font-size: 16px; padding: 10px 12px; min-height: 44px; }
.sheet-body label { font-size: 11px; margin-bottom: 6px; }
.sheet-body .input-field { margin-bottom: 4px; }

.mini-h { font-size: 13px; font-weight: 800; margin: 18px 0 10px; color: var(--text); }
.mini-hint { font-size: 12.5px; color: var(--text-muted); margin-bottom: 10px; }

.mini-out {
  margin-top: 12px;
  padding: 14px;
  border-radius: var(--radius-md);
  background: var(--surface2);
  border: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 800;
  text-align: center;
  color: var(--text-muted);
}

.mini-out small { display: block; font-size: 12px; font-weight: 600; margin-top: 6px; }

.avg-rows { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.avg-row { display: grid; grid-template-columns: 30px 1fr 1fr; gap: 8px; align-items: center; }
.avg-idx { font-family: var(--font-mono); font-size: 12px; font-weight: 800; color: var(--text-dim); }

.rr-bar {
  display: flex;
  height: 30px;
  margin-top: 14px;
  border-radius: var(--radius-pill);
  overflow: hidden;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 800;
}

.rr-bar i {
  display: grid;
  place-items: center;
  font-style: normal;
  color: #fff;
  min-width: 52px;
  transition: flex 0.3s ease;
}

.rr-risk { background: linear-gradient(90deg, #be123c, #f43f5e); }
.rr-reward { background: linear-gradient(90deg, #10b981, #059669); }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (hover: none) {
  button:hover, .stat:hover, .lot-card:hover, .preset-chip:hover, .calc-circle-btn:hover { transform: none; }
}

@media (max-width: 1050px) {
  .summary-4 { grid-template-columns: repeat(2, 1fr); }
  .split-2, .split-wide { grid-template-columns: 1fr; }
  .donutbox .donut { flex-direction: row; justify-content: center; gap: 24px; }
  .donutbox .donut svg { max-width: 170px; }
  .donutbox .donut-legend { max-width: 220px; }
}

@media (max-width: 640px) {
  .live-indicator { display: none; }
  header h1 { white-space: nowrap; }

  .tabs button {
    flex: 0 0 auto;
    min-height: 42px;
    padding: 0 13px;
    font-size: 13px;
  }

  .controls-4 { grid-template-columns: 1fr 1fr; gap: 14px 12px; }
  .controls-4 .input-field small { display: none; }

  .summary-4 { grid-template-columns: 1fr 1fr; gap: 10px; }
  .summary-4 .stat-hero,
  .summary-4:has(.stat-hero) .stat:last-child { grid-column: 1 / -1; }
  .summary-4 .stat { padding: 14px; }
  .summary-4 .stat span { font-size: 10.5px; letter-spacing: 0.4px; }
  .summary-4 .stat strong { font-size: 18px; letter-spacing: -0.4px; }
  .summary-4 .stat-hero strong { font-size: 24px; }
  .summary-4 .stat small { font-size: 10.5px; }

  .segmented { display: flex; width: 100%; margin-bottom: 14px; }
  .segmented button { flex: 1 0 auto; padding: 9px 12px; font-size: 12.5px; }

  .ratebox { margin-top: -4px; }
  .rate-grid { grid-template-columns: 1fr 1fr; padding: 4px 14px 8px; }

  .hbar { grid-template-columns: 82px 1fr 70px; font-size: 11.5px; }
  .rung { grid-template-columns: 16px 50px 1fr auto; }
  .rung-price { font-size: 14px; }

  .donutbox .donut { flex-direction: column; }
  .legend { gap: 10px; font-size: 11px; }

  .growthcontrols { grid-template-columns: 1fr 1fr; gap: 14px 12px; }

  /* Order book: each leg becomes a card */
  .order-table, .order-table tbody, .order-table tfoot { display: block; }
  .order-table thead { display: none; }
  .order-table tr {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px 10px;
    padding: 14px;
    border-bottom: 1px solid var(--border);
    background: transparent !important;
  }
  .order-table td {
    display: block;
    padding: 0 !important;
    border: 0;
    text-align: left;
    white-space: normal;
    min-width: 0;
  }
  .order-table td[data-label]::before {
    content: attr(data-label);
    display: block;
    font-family: var(--font-sans);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    color: var(--text-dim);
    margin-bottom: 4px;
  }
  .order-table .o-idx { grid-column: 1 / 3; grid-row: 1; align-self: center; font-size: 14px; }
  .order-table .o-act { grid-column: 3; grid-row: 1; justify-self: end; }
  .order-table .o-act .danger { padding: 6px 10px; min-height: 34px; }
  .order-table .o-act .danger span { display: none; }
  .order-table .o-out { font-size: 13px; overflow-wrap: anywhere; }
  .order-table .orderinput { width: 100%; text-align: left; font-size: 16px; min-height: 44px; }
  .order-table tfoot tr { background: var(--surface2) !important; }
  .order-table tfoot .o-idx { grid-column: 1 / -1; font-size: 12px; letter-spacing: 0.6px; }
  .order-table tfoot .o-act { display: none; }
  #order-panel .tablebox .scroll { max-height: none; overflow: visible; }
  #order-panel .table-toolbar { flex-wrap: wrap; }
  #order-panel .table-toolbar .primary { flex: 1; }

  /* Calculator: fluid keypad */
  .calc-device { max-width: 420px; }
  .calc-keypad .calc-circle-btn { width: 100%; height: auto; max-width: 68px; }

  /* Sheet becomes a bottom sheet */
  .sheet,
  .sheet[data-side="left"] {
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-height: 88vh;
    max-height: 88dvh;
    border-radius: 22px 22px 0 0;
    border-bottom: 0;
    padding-bottom: env(safe-area-inset-bottom);
    transform: translateY(100%);
  }
  .sheet.in { transform: none; }
  .sheet-grip {
    display: flex;
    justify-content: center;
    padding: 10px 0 2px;
    touch-action: none;
    cursor: grab;
  }
  .sheet-grip span { width: 42px; height: 5px; border-radius: 3px; background: var(--border-strong); }
  .sheet-head { padding: 6px 12px 10px 16px; flex-wrap: wrap; }
  .sheet-head h3 { flex-basis: calc(100% - 50px); }
  .sheet-tabs { order: 3; width: 100%; justify-content: space-between; }
  .sheet-tabs button { flex: 1; border-radius: 12px; height: 38px; }
  .sheet-body { padding: 14px 16px 22px; }
  .mini-grid-3 { gap: 8px; }

  .bubble-child em { font-size: 11.5px; }

  #toast-container {
    left: 14px;
    right: 14px;
    transform: none;
    bottom: calc(14px + env(safe-area-inset-bottom));
  }

  .site-foot { padding: 14px; font-size: 11.5px; margin-top: 28px; margin-bottom: 70px; }
}

@media (max-width: 420px) {
  .market-tag { display: none; }
}

@media (max-width: 340px) {
  .controls-4, .growthcontrols { grid-template-columns: 1fr; }
  .summary-4 .stat strong { font-size: 16px; }
  .rate-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .bubble-main, .bubble-main::after { animation: none !important; }
}

@media print {
  .bubble-root, .sheet, .sheet-backdrop, .segmented, .site-foot { display: none !important; }
}
