* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  color-scheme: dark;
  --bg: #171d1a;
  --bg2: #202923;
  --bg3: #0d1210;
  --text: #f3f7f2;
  --text2: #b3c0b9;
  --text3: #7f8d86;
  --border: rgba(231, 242, 235, .10);
  --border2: rgba(231, 242, 235, .20);
  --info-bg: #123044;
  --info-text: #a8d7ff;
  --info-border: #3b7aa7;
  --danger-bg: #4a2020;
  --danger-text: #f3aaa7;
  --danger-border: #9f4a4a;
  --today-bg: #463614;
  --today-text: #f7d982;
  --today-border: #b6872f;
  --rad: 8px;
  --rad-lg: 14px;
  --label-w: 132px;
  --row-h: 52px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #171d1a;
    --bg2: #202923;
    --bg3: #0d1210;
    --text: #f3f7f2;
    --text2: #b3c0b9;
    --text3: #7f8d86;
    --border: rgba(231, 242, 235, .10);
    --border2: rgba(231, 242, 235, .20);
    --info-bg: #123044;
    --info-text: #a8d7ff;
    --info-border: #3b7aa7;
    --danger-bg: #4a2020;
    --danger-text: #f3aaa7;
    --danger-border: #9f4a4a;
    --today-bg: #463614;
    --today-text: #f7d982;
    --today-border: #b6872f;
  }
}

html,
body {
  min-height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  background: var(--bg3);
  color: var(--text);
  font-size: 14px;
}

button,
input,
select,
textarea {
  font: inherit;
}

.app {
  max-width: 1400px;
  margin: 0 auto;
  padding: 18px 14px 48px;
}

.hdr {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.hdr h1 {
  font-size: 18px;
  font-weight: 800;
  flex: 1;
  white-space: nowrap;
}

.hdr h1 em {
  font-size: 12px;
  font-weight: 400;
  color: var(--text2);
  font-style: normal;
  margin-left: 6px;
}

.nav {
  display: flex;
  align-items: center;
  gap: 5px;
}

#rangeLabel {
  font-size: 13px;
  font-weight: 700;
  min-width: 164px;
  text-align: center;
  color: var(--text2);
}

.btn {
  font-size: 13px;
  padding: 6px 14px;
  border: 1px solid var(--border2);
  border-radius: var(--rad);
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  font-weight: 600;
  transition: background .12s, border-color .12s, color .12s;
}

.btn:hover {
  background: var(--bg2);
}

.btn.sq {
  width: 32px;
  height: 32px;
  padding: 0;
  font-size: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn.accent {
  background: var(--info-bg);
  color: var(--info-text);
  border-color: var(--info-border);
}

.btn.today-btn {
  background: var(--today-bg);
  color: var(--today-text);
  border-color: var(--today-border);
  font-size: 12px;
  font-weight: 800;
}

.btn.danger {
  color: var(--danger-text);
  border-color: var(--danger-border);
  background: var(--danger-bg);
}

.legend {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 10px;
}

.lg {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--text2);
}

.range-lg {
  margin-left: 8px;
}

.lg-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex: 0 0 auto;
}

.lg-range {
  width: 24px;
  height: 10px;
  border-radius: 5px;
  flex: 0 0 auto;
}

.lg-range.solid {
  background: #2563eb;
}

.lg-range.dashed {
  background: repeating-linear-gradient(90deg, #2563eb 0, #2563eb 6px, transparent 6px, transparent 9px);
}

.view-controls {
  min-height: 34px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: -2px 0 10px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: var(--rad);
  background: var(--bg);
}

.switch-control {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--text);
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
  user-select: none;
}

.switch-control input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.switch-track {
  width: 34px;
  height: 18px;
  border-radius: 18px;
  background: var(--bg3);
  border: 1px solid var(--border2);
  position: relative;
  flex: 0 0 auto;
  transition: background .15s, border-color .15s;
}

.switch-track::after {
  content: "";
  position: absolute;
  left: 2px;
  top: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--text3);
  transition: transform .15s, background .15s;
}

.switch-control input:checked + .switch-track {
  background: var(--info-bg);
  border-color: var(--info-border);
}

.switch-control input:checked + .switch-track::after {
  transform: translateX(16px);
  background: var(--info-text);
}

.switch-control input:focus-visible + .switch-track {
  box-shadow: 0 0 0 3px var(--info-bg);
}

.stock-summary {
  color: var(--text2);
  font-size: 12px;
  font-weight: 600;
}

.tl-shell {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--rad-lg);
  background: var(--bg);
  box-shadow: 0 12px 34px rgba(0, 0, 0, .34);
  overflow: hidden;
}

table {
  table-layout: fixed;
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

th:last-child,
td:last-child {
  border-right: none;
}

tr:last-child td {
  border-bottom: none;
}

.th-label,
.td-label {
  width: var(--label-w);
  min-width: var(--label-w);
  max-width: var(--label-w);
  position: sticky;
  left: 0;
  z-index: 10;
  background: var(--bg2);
  border-right: 1px solid var(--border2) !important;
}

.th-label {
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text2);
  text-align: left;
  vertical-align: middle;
}

.td-label {
  padding: 0 10px;
  height: var(--row-h);
  vertical-align: middle;
}

.td-label .tick {
  display: block;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: .02em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.td-label.glbl {
  font-size: 12px;
  font-weight: 600;
  color: var(--text2);
}

.rmv {
  float: right;
  width: 20px;
  height: 20px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--text3);
  cursor: pointer;
  line-height: 1;
  font-size: 16px;
}

.rmv:hover {
  color: var(--danger-text);
  background: var(--danger-bg);
}

.th-day {
  text-align: center;
  padding: 5px 1px;
  cursor: pointer;
  user-select: none;
  vertical-align: middle;
  background: var(--bg2);
}

.th-day:not(.wknd) .dn {
  color: var(--text);
  font-weight: 900;
}

.th-day:not(.wknd) .dw {
  color: var(--text2);
  font-weight: 800;
}

.th-day:hover {
  background: var(--bg3);
}

.th-day.is-col-focus {
  background: color-mix(in srgb, var(--info-bg) 74%, var(--bg2));
  color: var(--info-text);
  box-shadow: inset 0 -3px 0 var(--info-border);
}

.th-day.is-today {
  background: var(--today-bg);
  color: var(--today-text);
}

.th-day.is-today.is-col-focus {
  background: color-mix(in srgb, var(--today-bg) 64%, var(--info-bg));
  box-shadow: inset 0 -3px 0 var(--today-border), inset 0 0 0 1px var(--info-border);
}

.th-day.wknd {
  background:
    linear-gradient(135deg, rgba(231, 242, 235, .065) 0 25%, transparent 25% 50%, rgba(231, 242, 235, .065) 50% 75%, transparent 75%),
    var(--bg2);
  background-size: 8px 8px;
  color: var(--text3);
}

.th-day.wknd .dn {
  color: var(--text3);
  font-weight: 700;
}

.th-day.wknd .dw {
  color: var(--text3);
  font-weight: 800;
}

.th-day.past {
  opacity: .68;
}

.dn {
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
}

.dw,
.dm {
  font-size: 9px;
  margin-top: 2px;
  color: var(--text2);
}

.dm {
  color: var(--text3);
}

.td-cell {
  height: var(--row-h);
  vertical-align: top;
  cursor: pointer;
  padding: 0;
  position: relative;
  overflow: visible;
}

.td-cell:hover {
  background: color-mix(in srgb, var(--info-bg) 36%, var(--bg));
}

.td-cell.is-cell-focus {
  background: color-mix(in srgb, var(--info-bg) 48%, var(--bg)) !important;
  box-shadow: inset 0 0 0 2px var(--info-border), inset 0 0 0 999px rgba(255, 255, 255, .08);
  z-index: 4;
}

.td-cell.wknd {
  background:
    linear-gradient(135deg, rgba(231, 242, 235, .045) 0 25%, transparent 25% 50%, rgba(231, 242, 235, .045) 50% 75%, transparent 75%),
    rgba(255, 255, 255, .018);
  background-size: 9px 9px;
}

.td-cell.is-today {
  background: rgba(247, 217, 130, .12);
}

.td-cell.past {
  background: rgba(255, 255, 255, .012);
}

@media (prefers-color-scheme: dark) {
  .th-day.wknd {
    background:
      linear-gradient(135deg, rgba(224, 238, 231, .055) 0 25%, transparent 25% 50%, rgba(224, 238, 231, .055) 50% 75%, transparent 75%),
      var(--bg2);
  }

  .td-cell.wknd {
    background:
      linear-gradient(135deg, rgba(224, 238, 231, .04) 0 25%, transparent 25% 50%, rgba(224, 238, 231, .04) 50% 75%, transparent 75%),
      rgba(255, 255, 255, .02);
    background-size: 9px 9px;
  }

  .td-cell.is-today {
    background: rgba(250, 204, 21, .05);
  }

  .td-cell.past {
    background: rgba(255, 255, 255, .01);
  }
}

tr.global-row .td-cell {
  background: rgba(168, 215, 255, .035);
}

.td-label.is-row-focus {
  background: color-mix(in srgb, var(--info-bg) 56%, var(--bg2));
  color: var(--info-text);
  box-shadow: inset 3px 0 0 var(--info-border);
}

.td-label.is-row-focus .tick {
  color: var(--info-text);
}

tr.stock-sep td {
  border-top: 2px solid var(--border2);
}

.cell-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  height: var(--row-h);
  padding: 3px 1px;
  position: relative;
  z-index: 2;
}

.td-cell.has-events .cell-inner {
  z-index: 45;
}

.td-cell.range-overlap .cell-inner {
  align-items: flex-end;
  justify-content: flex-start;
  padding: 2px 4px 0 1px;
  z-index: 85;
}

.td-cell.range-overlap.has-events::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 3px;
  background: var(--point-accent, var(--info-border));
  z-index: 84;
  box-shadow: 0 1px 5px rgba(0, 0, 0, .18);
}

tr.global-row .cell-inner {
  justify-content: flex-start;
  padding-top: 5px;
}

.chip {
  width: 26px;
  height: 26px;
  border: none;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 800;
  color: #ffffff;
  cursor: pointer;
  flex: 0 0 auto;
  transition: transform .12s, box-shadow .12s;
}

.event-cluster {
  width: 34px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: color-mix(in srgb, var(--bg2) 84%, transparent);
  cursor: pointer;
  display: grid;
  grid-template-columns: repeat(2, 13px);
  grid-template-rows: repeat(2, 13px);
  gap: 2px;
  align-items: center;
  justify-content: center;
  place-content: center;
  padding: 2px;
  flex: 0 0 auto;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .08);
  transition: transform .12s, box-shadow .12s, border-color .12s, background .12s;
}

.event-cluster.count-2 {
  height: 24px;
  grid-template-rows: 13px;
}

.mini-chip {
  width: 13px;
  height: 13px;
  border-radius: 5px;
  background: var(--event-color);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 7px;
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .35) inset;
  pointer-events: none;
}

.more-chip {
  background: var(--text2);
  font-size: 7px;
}

tr.global-row .chip,
tr.global-row .event-cluster {
  width: 24px;
  height: 22px;
  font-size: 9px;
}

tr.global-row .event-cluster {
  grid-template-columns: repeat(2, 10px);
  grid-template-rows: repeat(2, 10px);
  gap: 1px;
  padding: 1px;
  border-radius: 6px;
}

tr.global-row .mini-chip {
  width: 10px;
  height: 10px;
  border-radius: 4px;
  font-size: 6px;
}

.td-cell.range-overlap .chip {
  width: 14px;
  height: 14px;
  border: 1px solid rgba(255, 255, 255, .72);
  font-size: 7px;
  opacity: .52;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .16);
}

.td-cell.range-overlap .event-cluster {
  width: 18px;
  height: 16px;
  grid-template-columns: repeat(2, 6px);
  grid-template-rows: repeat(2, 6px);
  gap: 1px;
  padding: 1px;
  border-radius: 5px;
  opacity: .54;
  background: rgba(13, 18, 16, .74);
  backdrop-filter: blur(2px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .12);
}

.td-cell.range-overlap .mini-chip {
  width: 6px;
  height: 6px;
  border-radius: 2px;
  font-size: 0;
}

.event-flag {
  min-width: 26px;
  height: 18px;
  border: 1px solid rgba(255, 255, 255, .78);
  border-radius: 9px;
  background: rgba(13, 18, 16, .86);
  color: var(--text);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 0 5px;
  font-size: 9px;
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 3px 10px rgba(0, 0, 0, .24);
  backdrop-filter: blur(3px);
  opacity: .92;
  position: relative;
  z-index: 90;
  transition: transform .12s, opacity .12s, box-shadow .12s;
}

.event-flag.multi {
  min-width: 34px;
}

.flag-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex: 0 0 auto;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .6);
}

.flag-dots {
  display: inline-flex;
  align-items: center;
  gap: 1px;
}

.flag-text {
  pointer-events: none;
}

.td-cell.range-overlap .chip:hover,
.td-cell.range-overlap .event-cluster:hover,
.event-flag:hover {
  opacity: 1;
  transform: scale(1.08);
  box-shadow: 0 5px 14px rgba(0, 0, 0, .3);
}

.chip:hover {
  transform: scale(1.25);
  box-shadow: 0 3px 10px rgba(0, 0, 0, .24);
  z-index: 20;
}

.event-cluster:hover {
  transform: scale(1.08);
  border-color: var(--info-border);
  background: var(--bg);
  box-shadow: 0 4px 14px rgba(0, 0, 0, .18);
  z-index: 20;
}

.range-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 60;
}

.range-bar {
  position: absolute;
  left: 0;
  top: 0;
  transform: translateY(-50%);
  height: 20px;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 800;
  color: #ffffff;
  cursor: pointer;
  pointer-events: auto;
  white-space: nowrap;
  overflow: hidden;
  border-radius: 10px;
  background: var(--bar-color);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .16), 0 0 0 1px rgba(255, 255, 255, .18) inset;
  z-index: 1;
}

.range-bar.point-overlap {
  opacity: .98;
}

.range-bar.uncertain {
  height: 30px;
  border-radius: 14px;
  font-size: 12px;
  font-weight: 900;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .24), 0 0 0 1px rgba(255, 255, 255, .24) inset;
  z-index: 3;
}

.range-bar:hover {
  filter: brightness(1.13);
}

.range-bar.continues-left {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}

.range-bar.continues-right {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.range-bar .bar-label {
  padding: 2px 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  pointer-events: none;
  border-radius: 999px;
  background: rgba(0, 0, 0, .24);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .12) inset;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .42);
  position: relative;
  z-index: 2;
}

.range-bar.point-overlap .bar-label {
  background: rgba(0, 0, 0, .38);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .2) inset, 0 1px 5px rgba(0, 0, 0, .18);
}

.range-bar.uncertain {
  background:
    repeating-linear-gradient(
      90deg,
      var(--bar-color) 0,
      var(--bar-color) 10px,
      rgba(255, 255, 255, .42) 10px,
      rgba(255, 255, 255, .42) 14px
    ),
    var(--bar-color);
}

.range-bar.uncertain .bar-label {
  background: rgba(0, 0, 0, .44);
  color: #ffffff;
  letter-spacing: 0;
  padding: 4px 12px;
  font-size: 12px;
  line-height: 1.1;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .22) inset, 0 2px 7px rgba(0, 0, 0, .24);
}

.range-bar.uncertain::after {
  content: "~";
  position: absolute;
  right: 6px;
  font-size: 11px;
  font-weight: 900;
}

.status {
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  color: var(--danger-text);
  background: var(--danger-bg);
  font-size: 13px;
}

.add-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-top: 1px solid var(--border);
  background: var(--bg2);
}

.add-bar input {
  width: 180px;
  font-size: 14px;
  padding: 6px 10px;
  border: 1px solid var(--border2);
  border-radius: var(--rad);
  background: var(--bg);
  color: var(--text);
  font-weight: 800;
  letter-spacing: 0;
  outline: none;
}

.add-bar input:focus,
.f-row input:focus,
.f-row select:focus,
.f-row textarea:focus {
  border-color: var(--info-text);
  box-shadow: 0 0 0 3px var(--info-bg);
}

.tooltip {
  position: fixed;
  background: var(--bg);
  border: 1px solid var(--border2);
  border-radius: var(--rad-lg);
  padding: 11px 13px;
  font-size: 13px;
  z-index: 600;
  max-width: 260px;
  pointer-events: none;
  box-shadow: 0 8px 28px rgba(0, 0, 0, .18);
}

.tt-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 20px;
  margin-bottom: 6px;
}

.tt-title {
  font-size: 14px;
  font-weight: 800;
  margin-bottom: 3px;
}

.tt-meta {
  font-size: 11px;
  color: var(--text2);
  margin-bottom: 4px;
}

.tt-desc {
  font-size: 12px;
  color: var(--text2);
  line-height: 1.6;
  border-top: 1px solid var(--border);
  padding-top: 5px;
}

.tt-list {
  display: grid;
  gap: 5px;
  margin-top: 6px;
}

.tt-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text2);
  line-height: 1.35;
}

.tt-item span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: 0 0 auto;
}

.modal-bg {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
  padding: 16px;
}

.modal {
  width: 440px;
  max-width: 100%;
  max-height: 92vh;
  overflow-y: auto;
  background: var(--bg);
  border: 1px solid var(--border2);
  border-radius: var(--rad-lg);
  padding: 24px;
}

.modal h3 {
  font-size: 17px;
  font-weight: 800;
  margin-bottom: 18px;
}

.picker-modal {
  width: 520px;
}

.event-choice-list {
  display: grid;
  gap: 8px;
}

.event-choice {
  width: 100%;
  border: 1px solid var(--border2);
  border-radius: var(--rad);
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  text-align: left;
  transition: background .12s, border-color .12s, transform .12s;
}

.event-choice:hover {
  background: var(--bg2);
  border-color: var(--info-border);
  transform: translateY(-1px);
}

.choice-type {
  min-width: 58px;
  max-width: 72px;
  height: 24px;
  border-radius: 12px;
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
  flex: 0 0 auto;
}

.choice-main {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.choice-title {
  font-size: 14px;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.choice-meta {
  font-size: 11px;
  color: var(--text2);
}

.f-row {
  margin-bottom: 13px;
}

.f-row label,
.date-label {
  display: block;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text2);
  margin-bottom: 4px;
}

.f-row input,
.f-row select,
.f-row textarea {
  width: 100%;
  font-size: 14px;
  padding: 8px 10px;
  border: 1px solid var(--border2);
  border-radius: var(--rad);
  background: var(--bg);
  color: var(--text);
  outline: none;
}

.f-row textarea {
  min-height: 76px;
  resize: vertical;
  line-height: 1.6;
}

.f-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}

.mode-toggle {
  display: flex;
  border: 1px solid var(--border2);
  border-radius: var(--rad);
  overflow: hidden;
  margin-bottom: 14px;
}

.mode-btn {
  flex: 1;
  padding: 7px;
  font-size: 12px;
  font-weight: 700;
  border: none;
  background: transparent;
  color: var(--text2);
  cursor: pointer;
}

.mode-btn.active {
  background: var(--info-bg);
  color: var(--info-text);
}

.uncertain-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--border2);
  border-radius: var(--rad);
  cursor: pointer;
  user-select: none;
  margin-bottom: 13px;
}

.uncertain-toggle input {
  width: 15px;
  height: 15px;
}

.uncertain-toggle span {
  font-size: 13px;
}

.modal-btns {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

@media (max-width: 760px) {
  :root {
    --label-w: 92px;
    --row-h: 46px;
  }

  body {
    font-size: 13px;
  }

  .app {
    width: 100%;
    padding: 10px 7px 24px;
  }

  .hdr {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 8px;
    margin-bottom: 9px;
  }

  .hdr h1 {
    grid-column: 1 / -1;
    width: 100%;
    min-width: 0;
    font-size: 16px;
    line-height: 1.2;
    white-space: normal;
  }

  .nav {
    min-width: 0;
    gap: 4px;
  }

  #rangeLabel {
    min-width: 0;
    width: 112px;
    font-size: 12px;
  }

  .btn {
    min-height: 32px;
    padding: 6px 10px;
    font-size: 12px;
  }

  .btn.sq {
    width: 30px;
    height: 30px;
    font-size: 16px;
  }

  .legend {
    flex-wrap: nowrap;
    gap: 8px;
    margin: 0 -7px 8px;
    padding: 0 7px 5px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .legend::-webkit-scrollbar {
    display: none;
  }

  .lg {
    flex: 0 0 auto;
    font-size: 11px;
  }

  .range-lg {
    margin-left: 0;
  }

  .view-controls {
    min-height: 30px;
    margin: 0 0 8px;
    padding: 6px 8px;
    gap: 8px;
  }

  .stock-summary {
    display: none;
  }

  .tl-shell {
    border-radius: 10px;
    box-shadow: 0 8px 22px rgba(0, 0, 0, .28);
  }

  .th-label,
  .td-label {
    width: var(--label-w);
    min-width: var(--label-w);
    max-width: var(--label-w);
  }

  .th-label {
    padding: 6px 7px;
    font-size: 11px;
  }

  .td-label {
    padding: 0 7px;
  }

  .td-label .tick {
    font-size: 12px;
    line-height: 1.18;
    white-space: normal;
    overflow-wrap: anywhere;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }

  .rmv {
    width: 17px;
    height: 17px;
    font-size: 14px;
  }

  .th-day {
    padding: 4px 1px;
  }

  .dn {
    font-size: 12px;
  }

  .dw,
  .dm {
    font-size: 8px;
    margin-top: 1px;
  }

  .cell-inner {
    padding: 2px 1px;
  }

  .chip {
    width: 22px;
    height: 22px;
    font-size: 9px;
  }

  .event-cluster {
    width: 28px;
    height: 28px;
    grid-template-columns: repeat(2, 11px);
    grid-template-rows: repeat(2, 11px);
  }

  .mini-chip {
    width: 11px;
    height: 11px;
    border-radius: 4px;
    font-size: 6px;
  }

  .range-bar {
    height: 18px;
    font-size: 9px;
  }

  .range-bar.uncertain {
    height: 24px;
    font-size: 10px;
  }

  .range-bar .bar-label {
    padding: 2px 7px;
  }

  .range-bar.uncertain .bar-label {
    padding: 3px 8px;
    font-size: 10px;
  }

  .add-bar {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    padding: 8px;
  }

  .add-bar input {
    width: 100%;
    min-width: 0;
    font-size: 13px;
    padding: 7px 9px;
  }

  .modal-bg {
    align-items: flex-end;
    padding: 10px;
  }

  .modal {
    width: 100%;
    max-height: 88vh;
    padding: 18px;
    border-radius: 12px;
  }

  .f-grid {
    grid-template-columns: 1fr;
  }
}
