/* ---------- base ---------- */
* {
  box-sizing: border-box;
  border-radius: 0 !important;
}

:root {
  --wes-sticky-topbar: 46px;
  --wes-sticky-chrome: 46px;
  --wes-month-panel: 0px;
  --keyboard-inset: 0px;
  --phone-tabs-h: 58px;
}

html, body {
  margin: 0;
  padding: 0;
  font-family: "Segoe UI", Arial, Helvetica, sans-serif;
  font-size: 11px;
  color: #3b3b3b;
  background: #ffffeb;
  overflow-x: hidden;
  overflow-x: clip;
  max-width: 100vw;
}

button, select, input {
  font-family: inherit;
}

/* ---------- top bar ---------- */
#topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  background: #ffffeb;
  border-bottom: 1px solid #d9d4c7;
  padding: 8px 14px;
  position: sticky;
  top: 0;
  z-index: 100;
  overflow: visible;
}

.topbar-main {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  min-width: 0;
}

#topbar .brand,
.mobile-head .brand {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: #034f46;
  white-space: nowrap;
  text-decoration: none;
}

#topbar a.brand:hover,
.mobile-head a.brand:hover {
  color: #04685d;
}

.menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 4px;
  width: 36px;
  min-width: 36px;
  height: 32px;
  padding: 6px;
  border: 1px solid #c9c4b6;
  background: #ffffeb;
  cursor: pointer;
  flex-shrink: 0;
  z-index: 2;
}

.menu-toggle span {
  display: block;
  height: 2px;
  background: #3b3b3b;
  width: 100%;
  transform-origin: center;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

#topbar.menu-open .menu-toggle span:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}

#topbar.menu-open .menu-toggle span:nth-child(2) {
  opacity: 0;
}

#topbar.menu-open .menu-toggle span:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

.topbar-drawer {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
  min-width: 0;
}

#topbar .nav {
  display: flex;
  flex-shrink: 0;
}

.nav-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.nav-area {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: #034f46;
  padding: 4px 8px;
  border: 1px solid #034f46;
  background: #ffffeb;
  white-space: nowrap;
}

.topbar-cross-link {
  font-size: 11px;
  color: #2f6fce;
  text-decoration: underline;
  white-space: nowrap;
  padding: 4px 2px;
}

.topbar-cross-link:hover {
  color: #1d4f9a;
}

.nav-btn {
  border: 1px solid #c9c4b6;
  border-left-width: 0;
  background: #ffffeb;
  color: #3b3b3b;
  padding: 5px 12px;
  font-size: 11px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}

.nav-btn:first-child {
  border-left-width: 1px;
}

.nav-btn.active {
  background: #034f46;
  border-color: #034f46;
  color: #ffffeb;
  font-weight: 600;
}

#topbar .controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

#topbar .controls .ctl {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

#topbar .controls label {
  font-size: 11px;
  color: #6b6b6b;
}

body[data-page="yearly"] #monthCtl,
body[data-page="categories"] #monthCtl {
  display: none !important;
}

#topbar select {
  border: 1px solid #c9c4b6;
  background: #ffffeb;
  padding: 4px 6px;
  font-size: 11px;
  outline: none;
  cursor: pointer;
}

#topbar .actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

#topbar .actions button,
#topbar .actions .topbar-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid #034f46;
  background: #034f46;
  color: #ffffeb;
  padding: 5px 12px;
  font-size: 11px;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}

#topbar .actions button:hover,
#topbar .actions .topbar-link-btn:hover {
  background: #5a9e8e;
  border-color: #5a9e8e;
  color: #ffffeb;
}

.btn-icon {
  width: 12px;
  height: 12px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: square;
  stroke-linejoin: miter;
  flex-shrink: 0;
}

.edit-legend {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  color: #6b6b6b;
  margin-right: 4px;
}

.edit-legend-header {
  display: none;
}

.mode-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  flex-shrink: 0;
  user-select: none;
}

.mode-switch-text {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.4px;
  color: #6b6b6b;
  white-space: nowrap;
}

.mode-switch-input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.mode-switch-track {
  position: relative;
  width: 52px;
  height: 22px;
  background: #d9d4c7;
  border: 1px solid #c9c4b6;
  flex-shrink: 0;
  transition: background 0.2s ease;
}

.mode-switch-track::before {
  content: "OFF";
  position: absolute;
  right: 5px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.3px;
  color: #5a5a5a;
  pointer-events: none;
}

.mode-switch-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background: #ffffeb;
  border: 1px solid #c9c4b6;
  transition: transform 0.2s ease;
}

.mode-switch-input:checked + .mode-switch-track {
  background: #034f46;
  border-color: #034f46;
}

.mode-switch-input:checked + .mode-switch-track::before {
  content: "ON";
  left: 6px;
  right: auto;
  color: #ffffeb;
}

.mode-switch-input:checked + .mode-switch-track::after {
  transform: translateX(30px);
  border-color: #034f46;
}

.mode-switch-input:focus-visible + .mode-switch-track {
  outline: 2px solid #2f6fce;
  outline-offset: 2px;
}

.mode-switch-header {
  display: none;
}

.mode-switch-drawer {
  display: inline-flex;
}

.legend-swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 1px solid #c9c4b6;
}

.legend-swatch.editable { background: #ffffeb; }
.legend-swatch.locked { background: #e4efd5; }

#saveIndicator {
  font-size: 10px;
  color: #7ba05b;
  opacity: 0;
  transition: opacity 0.3s;
  white-space: nowrap;
}

#saveIndicator.show {
  opacity: 1;
}

#saveIndicator.error {
  color: #b54a3a;
}

#saveIndicator.unsigned {
  color: #8a6a2f;
  opacity: 1;
}

.auth-slot {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.profile-menu-wrap,
.export-menu-wrap {
  position: relative;
  display: inline-flex;
}

.profile-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid #034f46 !important;
  background: #034f46 !important;
  color: #ffffeb !important;
  padding: 4px 10px !important;
  cursor: pointer;
}

.profile-name {
  font-size: 11px;
  font-weight: 600;
  color: #ffffeb;
  max-width: 88px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-icon {
  width: 16px;
  height: 16px;
  border: 1.5px solid #ffffeb;
  background:
    radial-gradient(circle at 50% 38%, #ffffeb 0 28%, transparent 30%),
    radial-gradient(circle at 50% 88%, #ffffeb 0 42%, transparent 44%);
}

.profile-btn:hover {
  background: #04685d !important;
  border-color: #04685d !important;
}

.profile-caret {
  font-size: 10px;
  line-height: 1;
  color: #ffffeb;
}

.profile-menu,
.export-menu {
  position: absolute;
  top: calc(100% + 2px);
  right: 0;
  min-width: 168px;
  background: #ffffeb;
  border: 1px solid #c9c4b6;
  z-index: 120;
  display: flex;
  flex-direction: column;
}

.profile-menu[hidden],
.export-menu[hidden] {
  display: none !important;
}

.profile-menu button,
.export-menu button {
  border: none !important;
  border-bottom: 1px solid #efece3 !important;
  background: #ffffeb !important;
  color: #3b3b3b !important;
  text-align: left;
  padding: 8px 12px !important;
  font-size: 11px !important;
  cursor: pointer;
  width: 100%;
}

.profile-menu button:last-child,
.export-menu button:last-child {
  border-bottom: none !important;
}

.profile-menu button:hover,
.export-menu button:hover {
  background: #fbf6e3 !important;
}

.auth-btn {
  border: 1px solid #c9c4b6;
  background: #ffffeb;
  color: #3b3b3b;
  padding: 4px 10px;
  font-size: 11px;
  cursor: pointer;
  white-space: nowrap;
}

.auth-btn.primary {
  background: #034f46;
  border-color: #034f46;
  color: #ffffeb;
  font-weight: 600;
}

.auth-btn:hover {
  background: #04685d;
  border-color: #04685d;
}

.auth-btn.primary:hover {
  background: #034f46;
  border-color: #04685d;
}

.auth-slot-bar {
  display: none;
  margin-left: auto;
}

.unsigned-banner,
.sample-banner {
  display: none;
  font-size: 12px;
  padding: 8px 14px;
  text-align: center;
}

.notice-banners {
  position: relative;
  z-index: 90;
  background: #ffffeb;
}

.sample-banner {
  background: #034f46;
  border-bottom: 1px solid #e08a6c;
  color: #ffffeb;
  font-weight: 700;
  letter-spacing: 0.4px;
}

body.showing-sample .sample-banner,
body.signed-out .sample-banner {
  display: block;
}

/* pages hidden via the hidden attribute must stay hidden despite display:grid/flex */
.page[hidden] {
  display: none !important;
}

/* ---------- monthly board layout ---------- */
.board {
  display: grid;
  grid-template-columns: 37.5% 36% 1fr;
  gap: 8px;
  padding: 8px;
  align-items: start;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  overflow-x: clip;
}

#page-monthly:focus,
#page-monthly:focus-visible {
  outline: none;
}

.left-wrap {
  display: grid;
  grid-template-columns: 52% 1fr;
  gap: 8px;
  min-width: 0;
  align-items: start;
}

.month-panel { grid-column: 1; grid-row: 1; }
.kpi-stack {
  grid-column: 1;
  grid-row: 2;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}
.summary-panel { grid-column: 1; grid-row: 3; }
.chart-pie { grid-column: 1; grid-row: 4; }
.income-block {
  grid-column: 2;
  grid-row: 1 / 4;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}
.chart-spend { grid-column: 2; grid-row: 4; }
.chart-budget { grid-column: 1 / -1; grid-row: 5; }

.left-cols {
  display: grid;
  grid-template-columns: 52% 1fr;
  gap: 8px;
  align-items: start;
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  align-items: start;
}

.col {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
}

/* ---------- panels & section bars ---------- */
.panel {
  background: #ffffeb;
  border: 1px solid #ddd8ca;
  max-width: 100%;
  min-width: 0;
}

.scroll-x {
  /* overflow-x: hidden; */
  max-width: 100%;
}

.scroll-x .grid-table {
  min-width: 0;
  width: 100%;
}

.bar {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  text-align: center;
  padding: 5px 4px;
}

.bar.big {
  font-size: 10px;
  padding: 6px 4px;
  border: 1px solid #ddd8ca;
}

.bar-flex {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 2px;
  padding-bottom: 2px;
  min-height: 22px;
}

.bar-link {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.4px;
  text-transform: lowercase;
  color: #58291a;
  text-decoration: underline;
  padding: 0 6px;
  white-space: nowrap;
}

.bar-link:hover {
  color: #2f6fce;
}

.bar-spacer {
  width: 34px;
  flex-shrink: 0;
}

.bar-actions {
  display: flex;
  gap: 2px;
  min-width: 34px;
  width: auto;
  justify-content: flex-end;
  position: relative;
}

.bar-btn {
  border: 1px solid rgba(0, 0, 0, 0.18);
  background: rgba(255, 255, 255, 0.55);
  color: inherit;
  font-size: 11px;
  line-height: 1;
  padding: 2px 5px;
  cursor: pointer;
}

.bar-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.add-row-btn:disabled {
  opacity: 0.45;
  cursor: default;
}

.lock-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  min-width: 20px;
  padding: 2px 4px;
}

.lock-tip {
  position: fixed;
  z-index: 400;
  max-width: 220px;
  padding: 8px 10px;
  background: #3b3b3b;
  color: #ffffeb;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1.35;
  text-align: left;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.22);
  pointer-events: none;
}

.lock-tip[hidden] {
  display: none !important;
}

.lock-icon {
  width: 12px;
  height: 12px;
  display: block;
}

.grid-table.section-locked td.cell:not(.readonly) {
  background: #f4f1e6;
  cursor: default;
}

.bar-btn:disabled,
.add-row-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.grid-table tr.sub-row td {
  height: 24px;
}

.grid-table tr.sub-row td.cell {
  background: #e5f4f1;
}

.grid-table tr.sub-row td.cell:first-child {
  box-shadow: inset 3px 0 0 #034f46;
}

.grid-table tr.sub-row td.cell.selected {
  background: #c5dbf7;
}

.grid-table tr.sub-row td.cell.in-range {
  background: #dceafb;
}

td.cell.sub-name-cell {
  overflow: hidden;
}

.sub-name-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  max-width: 100%;
}

.sub-name-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sub-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
  background: #034f46;
  color: #ffffeb;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.4px;
  line-height: 1;
  padding: 1px 3px;
}

.sub-badge-icon {
  padding: 2px;
}

.sub-badge-icon .sub-icon {
  width: 11px;
  height: 11px;
}

.sub-icon {
  width: 9px;
  height: 9px;
  display: block;
}

.sub-head-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  padding: 2px 4px;
}

.sub-head-btn .sub-icon {
  width: 12px;
  height: 12px;
}

.sort-menu-wrap {
  width: auto;
}

.sort-menu {
  position: absolute;
  top: 100%;
  right: 0;
  z-index: 40;
  min-width: 180px;
  background: #ffffeb;
  border: 1px solid #c9c4b6;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
}

.sort-menu[hidden] {
  display: none !important;
}

.sort-menu button {
  border: none;
  background: transparent;
  text-align: left;
  padding: 7px 10px;
  font-size: 11px;
  color: #3b3b3b;
  cursor: pointer;
  border-bottom: 1px solid #efece3;
}

.sort-menu button:last-child {
  border-bottom: none;
}

.sort-menu button:hover {
  background: #fbf6e3;
}

.coral      { background: #034f46; color: #ffffeb; }
.coral-lt   { background: #034f46; color: #ffffeb; }
.deals-bar  { background: #734bb6; color: #ffffeb; }
.green      { background: #034f46; color: #ffffeb; }
.green-lt   { background: #ccf1c3; color: #3b3b3b; }
.pink       { background: #ef7c7c; color: #6b2f2b; }
.pink-lt    { background: #fbe6e4; color: #6b2f2b; }
.yellow     { background: #ffd042; color: #5f4a12; }
.yellow-lt  { background: #ffd042; color: #5f4a12; }

/* ---------- month/year card & stat values ---------- */
.month-card {
  background: #fbf6e3;
  text-align: center;
  font-size: 26px;
  font-weight: 300;
  padding: 18px 4px;
  color: #3b3b3b;
}

.month-card-pickers {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  gap: 0;
}

.month-card-select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  border: none;
  background-color: transparent;
  font-family: inherit;
  font-size: inherit;
  font-weight: 300;
  color: #3b3b3b;
  text-align: center;
  text-align-last: center;
  width: 100%;
  cursor: pointer;
  padding: 0 18px 0 4px;
  outline: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6'><path d='M0 0l5 6 5-6' fill='%233b3b3b'/></svg>");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 10px 6px;
}

.month-card-select:focus {
  outline: none;
}

.cats-year-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fbf6e3;
  min-width: 0;
}

.cats-year-card {
  flex: 0 0 auto;
  padding: 6px 14px 6px 8px;
  background: transparent;
}

.cats-year-card .month-card-select {
  font-size: 15px;
  font-weight: 400;
  width: auto;
  min-width: 68px;
  padding-right: 16px;
}

.cats-year-row .note {
  flex: 1;
  min-width: 0;
  text-align: left;
  background: transparent;
  padding: 6px 10px 6px 0;
}

.stat-value {
  text-align: center;
  font-size: 16px;
  font-weight: 600;
  padding: 8px 4px;
  background: #ffffeb;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- tables ---------- */
.grid-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.grid-table th,
.grid-table td {
  border: 1px solid #e7e2d5;
  padding: 2px 6px;
  height: 20px;
  font-size: 11px;
  font-weight: 400;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.grid-table th {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.2px;
  text-transform: uppercase;
  text-align: center;
}

.grid-table th[data-col-head] { cursor: pointer; }

.grid-table td.money    { text-align: right; }
.grid-table td.center   { text-align: center; }

td.cell.sip-cell {
  text-align: center;
  padding: 0;
}

.sip-check {
  width: 13px;
  height: 13px;
  margin: 0;
  vertical-align: middle;
  accent-color: #034f46;
  cursor: pointer;
}

tr.add-row-line td {
  background: #ffffeb !important;
  padding: 0;
  height: auto;
  border-top: 1px solid #e7e2d5;
}

.add-row-btn {
  display: block;
  width: 100%;
  border: 0;
  background: transparent;
  color: #034f46;
  font-size: 12px;
  font-weight: 600;
  text-align: left;
  padding: 7px 10px;
  cursor: pointer;
}

.add-row-btn:hover {
  background: #f3f0e4;
}

.tracker-scroll tr.add-row-line {
  position: sticky;
  bottom: 0;
  z-index: 3;
}

.tracker-scroll tr.add-row-line td {
  background: #ffffeb !important;
  box-shadow: 0 -1px 0 #d9d4c7;
}

/* Editable vs calculated cells */
td.cell {
  cursor: cell;
  background: #ffffeb;
  user-select: none;
  -webkit-user-select: none;
}

td.cell.readonly,
.grid-table.locked td,
.grid-table.locked th,
.grid-table tr.total td,
.locked-value {
  background: #e4efd5 !important;
  color: #000000;
  cursor: default;
}

.locked-panel .stat-value {
  background: #e8e5dc;
  color: #5a5a5a;
}

.grid-table tr.total td {
  font-weight: 700;
}

td.cell.in-range {
  background: #dceafb;
}

td.cell.selected {
  outline: 2px solid #2f6fce;
  outline-offset: -2px;
  background: #c5dbf7;
}

td.cell.date-invalid {
  box-shadow: inset 0 0 0 2px #7a1515;
}

td.cell.date-invalid.selected,
td.cell.date-invalid.in-range {
  box-shadow: inset 0 0 0 2px #7a1515;
}

td.cell.editing {
  padding: 0;
  outline: 2px solid #2f6fce;
  outline-offset: -2px;
  background: #ffffeb !important;
}

td.cell.editing input,
td.cell.editing select {
  width: 100%;
  height: 100%;
  border: none;
  outline: none;
  padding: 2px 6px;
  font-size: 11px;
  background: #ffffeb;
}

td.cell.editing input { text-align: inherit; }

td.cell.cat::after {
  content: "\25BE";
  float: right;
  color: #b3ac9a;
  font-size: 9px;
  pointer-events: none;
}

td.cell.editing.cat::after {
  display: none;
}

.cat-menu {
  position: fixed;
  z-index: 260;
  background: #ffffeb;
  border: 1px solid #c9c4b6;
  box-shadow: 0 6px 18px rgba(40, 35, 30, 0.16);
  max-height: min(280px, 50vh);
  overflow-y: auto;
  padding: 2px 0;
}

.cat-menu-item {
  display: block;
  width: 100%;
  text-align: left;
  border: none !important;
  background: #ffffeb !important;
  color: #3b3b3b !important;
  padding: 7px 12px !important;
  font-size: 11px !important;
  cursor: pointer;
  white-space: nowrap;
}

.cat-menu-item:hover,
.cat-menu-item.active {
  background: #f4ebd3 !important;
}

.cat-menu-add {
  border-top: 1px solid #efece3 !important;
  color: #2f6fce !important;
}

.grid-table.summary tr.emph td {
  background: #fbf6e3;
  font-weight: 700;
}

/* ---------- charts ---------- */
.chart-box {
  position: relative;
  height: 195px;
  padding: 6px;
  max-width: 100%;
}

.chart-box.tall {
  height: 250px;
}

/* ---------- expense tracker ---------- */
.tracker-scroll {
  overflow-y: auto;
  overflow-x: auto;
  max-height: calc(100vh - 120px);
  -webkit-overflow-scrolling: touch;
}

.tracker-scroll::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.tracker-scroll::-webkit-scrollbar-thumb {
  background: #d9d4c7;
}

.tracker-scroll thead th {
  position: sticky;
  top: 0;
  z-index: 5;
}

.tracker-scroll .grid-table {
  min-width: 0;
  /* border-collapse: separate; */
  border-spacing: 0;
}

/* ---------- yearly page ---------- */
.yearly {
  display: grid;
  grid-template-columns: 18% repeat(4, 1fr);
  gap: 8px;
  padding: 8px;
  align-items: start;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

.yearly-left {
  grid-row: 1 / span 3;
  min-width: 0;
  width: 100%;
}

.yearly-summary-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  width: 100%;
}

.yearly-summary-stack > .panel,
.yearly-summary-stack > .stat-grid {
  width: 100%;
  max-width: 100%;
}

.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  width: 100%;
}

.chart-box.ydonut {
  height: 220px;
}

.chart-box.ychart {
  height: 296px;
}

/* ---------- category overview page ---------- */
.cats {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  min-height: calc(100dvh - 52px);
  box-sizing: border-box;
}

.cats .note,
.yearly .note,
.note {
  background: #fbf6e3;
  text-align: center;
  font-size: 10px;
  padding: 5px 8px;
  color: #6b6b6b;
  line-height: 1.4;
}

.cats-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  align-items: stretch;
  flex: 1 1 auto;
  min-height: 0;
}

.cats-grid > .col {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  height: 100%;
}

.cats-grid > .col > .panel,
.cats-grid > .panel {
  display: flex;
  flex-direction: column;
  /* min-height: 0; */
  height: 100%;
  flex: 1 1 auto;
}

.cats-grid .grid-table {
  flex: 1 1 auto;
  height: 100%;
}

.thead-total {
  /* display: block; */
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
  margin-top: 2px;
}

/* ============================================================
   Responsive layouts
   ============================================================ */

/* Shrink content on mid-size screens instead of inner horizontal scroll */
@media (max-width: 1500px) and (min-width: 768px) {
  .grid-table th,
  .grid-table td {
    font-size: 10px;
    padding: 2px 4px;
  }
  .grid-table th { font-size: 8px; }
  .bar { font-size: 8px; }
  .stat-value { font-size: 15px; }
}

@media (max-width: 1280px) and (min-width: 768px) {
  .grid-table th,
  .grid-table td {
    font-size: 9px;
    padding: 1px 3px;
    height: 18px;
  }
  .grid-table th { font-size: 8px; letter-spacing: 0.4px; }
  .bar { font-size: 8px; letter-spacing: 0.8px; padding: 4px 2px; }
  .month-card { font-size: 22px; padding: 12px 4px; }
  .stat-value { font-size: 13px; padding: 6px 2px; }
  .board { gap: 6px; padding: 6px; }
}

@media (max-width: 1100px) and (min-width: 768px) {
  html, body { font-size: 10px; }
  .grid-table th,
  .grid-table td {
    font-size: 8px;
    padding: 1px 2px;
    height: 16px;
  }
  .grid-table th { font-size: 7px; }
  .bar { font-size: 7px; }
  .nav-btn { padding: 4px 8px; font-size: 10px; }
}

/* Tablet / small laptop */
@media (max-width: 1279px) {
  .menu-toggle {
    display: flex;
  }

  #topbar {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 0;
  }

  .topbar-main {
    justify-content: flex-start;
    padding: 6px 8px;
    gap: 6px;
    min-width: 0;
    overflow: visible;
  }

  #topbar .brand {
    margin-right: auto;
  }

  .menu-toggle {
    margin-left: 0;
  }

  .auth-slot-bar {
    display: inline-flex;
    margin-left: 0;
  }

  .edit-legend-header {
    display: inline-flex;
    margin-left: auto;
    margin-right: 2px;
    flex-shrink: 0;
    width: auto;
    white-space: nowrap;
  }

  .mode-switch-header {
    display: inline-flex;
  }

  .mode-switch-drawer {
    display: none !important;
  }

  .edit-legend-drawer {
    display: none !important;
  }

  .topbar-drawer .auth-slot {
    display: none;
  }

  .topbar-drawer {
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 0 12px 12px;
    border-top: 1px solid #efece3;
  }

  #topbar.menu-open .topbar-drawer {
    display: flex;
  }

  #topbar .nav {
    width: 100%;
  }

  .nav-group {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    gap: 6px;
  }

  .nav-area {
    text-align: center;
  }

  .topbar-cross-link {
    text-align: center;
    display: block;
    padding: 8px 0;
  }

  .nav-btn {
    flex: 1;
    text-align: center;
  }

  #topbar .controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  #topbar .controls .ctl {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 3px;
  }

  body[data-page="yearly"] #monthCtl,
  body[data-page="categories"] #monthCtl {
    display: none !important;
  }

  #topbar .actions {
    margin-left: 0;
    width: 100%;
  }

  #topbar .actions button,
  #topbar .actions .topbar-link-btn {
    flex: 1;
    justify-content: center;
  }

  #topbar .actions .mode-switch {
    width: 100%;
    justify-content: space-between;
  }

  .board {
    grid-template-columns: 1fr 1fr;
  }
  #col4 {
    grid-column: 1 / -1;
  }
  .tracker-scroll {
    max-height: 480px;
  }
  .yearly {
    grid-template-columns: 1fr 1fr;
  }
  .yearly-left {
    grid-row: auto;
    grid-column: 1 / -1;
    display: block;
  }
  .yearly-summary-stack {
    display: grid;
    grid-template-columns: minmax(220px, 280px) 1fr;
    gap: 8px;
    align-items: start;
  }
  .yearly-summary-stack > .panel:first-child,
  .yearly-summary-stack > .yearly-donut-panel {
    grid-column: 1;
  }
  .yearly-summary-stack > .stat-grid {
    grid-column: 2;
    grid-row: 1 / span 2;
  }
  .yearly-summary-stack > .locked-panel.scroll-x,
  .yearly-summary-stack > .panel.scroll-x {
    grid-column: 1 / -1;
  }
  .chart-box.ydonut {
    height: 200px;
  }
  .cats-grid {
    grid-template-columns: repeat(3, 1fr);
    align-items: stretch;
  }
}

/* Large phones / small tablets */
@media (max-width: 899px) {
  .board {
    overflow-x: visible;
    grid-template-columns: 1fr;
    padding: 0;
    gap: 0;
  }

  .notice-banners {
    position: sticky;
    top: var(--wes-sticky-topbar);
    z-index: 99;
    background: #ffffeb;
  }

  #page-monthly .month-panel {
    position: sticky;
    top: var(--wes-sticky-chrome);
    z-index: 40;
    background: #ffffeb;
    box-shadow: 0 1px 0 #d9d4c7;
  }

  td.cell,
  td.details-cell {
    scroll-margin-top: calc(var(--wes-sticky-chrome) + 88px);
  }

  .left-wrap,
  .two-col,
  #col3,
  #col4,
  .col {
    width: 100%;
    max-width: 100%;
    gap: 0;
  }

  .left-wrap {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    grid-template-columns: none;
  }

  .left-wrap > * {
    width: 100%;
    max-width: 100%;
    grid-column: auto;
    grid-row: auto;
  }

  .two-col {
    grid-template-columns: 1fr;
  }

  .month-panel { order: 1; }
  .kpi-stack {
    order: 2;
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 0;
    width: 100%;
  }
  .kpi-stack .panel {
    min-width: 0;
    width: 100%;
  }
  .kpi-stack .bar {
    font-size: 9px;
    letter-spacing: 0.3px;
    padding: 4px 2px;
  }
  .kpi-stack .stat-value {
    font-size: 11px;
    padding: 6px 2px;
  }
  .summary-panel { order: 3; }
  .chart-pie { order: 4; }
  .chart-spend { order: 5; }
  .chart-budget { order: 6; }
  .income-block { order: 7; }

  .chart-box,
  .chart-box.tall {
    width: 100%;
  }

  #topbar .controls {
    grid-template-columns: 1fr;
  }

  .yearly {
    display: flex !important;
    flex-direction: column;
    grid-template-columns: none;
    width: 100%;
  }

  .yearly-left {
    grid-row: auto;
    grid-column: auto;
    width: 100% !important;
    max-width: 100% !important;
  }

  .yearly-summary-stack {
    display: flex !important;
    flex-direction: column;
    gap: 8px;
    width: 100% !important;
  }

  .yearly .panel,
  .yearly .stat-grid,
  .yearly-summary-stack > * {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
  }

  .chart-box.ydonut {
    height: 200px;
  }
}

@media (max-width: 980px) {
  .edit-legend-header {
    display: none !important;
  }

  .mode-switch-header .mode-switch-text {
    display: inline;
    font-size: 9px;
    letter-spacing: 0.2px;
  }

  .mode-switch-header {
    gap: 4px;
  }

  .profile-name {
    max-width: 72px;
  }

  .profile-btn {
    padding: 3px 7px !important;
    gap: 4px;
  }

  .topbar-main {
    padding: 5px 8px;
    padding-right: max(8px, env(safe-area-inset-right));
    gap: 6px;
  }
}

/* Phones */
@media (max-width: 599px) {
  .auth-slot-bar,
  .mode-switch-header,
  .menu-toggle {
    flex-shrink: 0;
  }

  #topbar .brand {
    font-size: 11px;
    letter-spacing: 0.6px;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
  }

  .left-cols,
  .two-col {
    grid-template-columns: 1fr;
  }

  .yearly {
    display: flex;
    flex-direction: column;
    grid-template-columns: none;
  }

  .yearly-left {
    display: block;
    width: 100%;
  }

  .yearly-summary-stack {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
  }

  .cats-grid {
    grid-template-columns: 1fr;
  }

  .chart-box {
    height: 180px;
  }

  .chart-box.tall,
  .chart-box.ychart {
    height: 220px;
  }

  .board,
  .yearly,
  .cats {
    padding: 0;
    gap: 0;
  }

  .chart-box.ydonut {
    height: 190px;
  }

  .tracker-scroll {
    max-height: 420px;
  }

  .month-card {
    font-size: 22px;
    padding: 12px 4px;
  }

  .stat-value {
    font-size: 14px;
  }

  .scroll-x .grid-table {
    min-width: 0;
  }

  .edit-legend-header {
    width: auto;
    font-size: 9px;
    gap: 4px;
  }
}

/* ---------- modal ---------- */
.modal[hidden] {
  display: none !important;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(50, 45, 40, 0.35);
}

.modal-card {
  position: relative;
  z-index: 1;
  width: min(420px, 100%);
  max-height: min(80vh, 560px);
  background: #ffffeb;
  border: 1px solid #ddd8ca;
  display: flex;
  flex-direction: column;
}

.modal-title {
  flex-shrink: 0;
}

.modal-body {
  padding: 12px;
  overflow-y: auto;
  flex: 1;
}

.modal-hint {
  margin: 0 0 10px;
  font-size: 11px;
  color: #6b6b6b;
  line-height: 1.4;
}

.cat-add-row {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
}

.cat-add-row input {
  flex: 1;
  border: 1px solid #c9c4b6;
  padding: 7px 8px;
  font-size: 12px;
  outline: none;
  background: #ffffeb;
}

.cat-add-row button,
.modal-footer button,
.cat-list button {
  border: 1px solid #3b3b3b;
  background: #3b3b3b;
  color: #ffffeb;
  padding: 7px 12px;
  font-size: 11px;
  cursor: pointer;
}

.cat-add-row button:hover,
.modal-footer button:hover {
  background: #555550;
}

.cat-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid #e7e2d5;
}

.cat-list li {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border-bottom: 1px solid #efece3;
  background: #ffffeb;
}

.cat-list li:nth-child(even) {
  background: #faf8f3;
}

.cat-list li:last-child {
  border-bottom: none;
}

.cat-list .cat-name,
.cat-list input {
  flex: 1;
  min-width: 0;
  font-size: 12px;
  border: 1px solid transparent;
  background: transparent;
  padding: 4px 6px;
}

.cat-list input {
  border-color: #c9c4b6;
  background: #ffffeb;
  outline: none;
}

.cat-list .cat-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.cat-list .cat-actions button {
  padding: 4px 8px;
  font-size: 10px;
  background: #ffffeb;
  color: #3b3b3b;
  border: 1px solid #c9c4b6;
}

.cat-list .cat-actions button.danger {
  color: #8a2f24;
  border-color: #d9a39a;
}

.cat-list .cat-actions button:hover {
  background: #fbf6e3;
}

.modal-footer {
  padding: 10px 12px;
  border-top: 1px solid #efece3;
  display: flex;
  justify-content: flex-end;
  background: #fbf6e3;
}

.share-modal .modal-card {
  width: min(460px, 100%);
  max-height: min(94vh, 920px);
}

.subs-modal-card {
  width: min(560px, 100%);
  max-height: min(84vh, 680px);
}

.subs-empty {
  margin: 0;
  font-size: 12px;
  color: #6b6b6b;
}

.sub-card {
  border: 1px solid #e7e2d5;
  margin-bottom: 8px;
  background: #ffffeb;
}

.sub-card:last-child {
  margin-bottom: 0;
}

.sub-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  background: #e5f4f1;
  border-bottom: 1px solid #e7e2d5;
  box-shadow: inset 3px 0 0 #034f46;
}

.sub-card-head strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  color: #034f46;
}

.sub-card-period,
.sub-card-when {
  margin-left: auto;
  flex-shrink: 0;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: #6b2f2b;
}

.busy-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(50, 45, 40, 0.35);
}

.busy-overlay[hidden] {
  display: none !important;
}

.busy-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  background: #ffffeb;
  border: 2px solid #034f46;
  box-shadow: 4px 4px 0 #034f46;
  color: #034f46;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.busy-spin {
  width: 16px;
  height: 16px;
  border: 3px solid #e5f4f1;
  border-top-color: #034f46;
  animation: busy-spin 0.7s linear infinite;
}

@keyframes busy-spin {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .busy-spin { animation: none; border-color: #034f46; }
}

.sub-card-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.sub-card-actions button {
  border: 1px solid #c9c4b6;
  background: #ffffeb;
  color: #3b3b3b;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 7px;
  cursor: pointer;
}

.sub-card-actions button.danger {
  color: #8a2f24;
  border-color: #d9a39a;
}

.sub-card-actions button:hover {
  background: #fbf6e3;
}

.subs-editor input,
.subs-editor select {
  border: 1px solid #c9c4b6;
  background: #fff;
  box-shadow: inset 0 0 0 1px #034f46;
  padding: 7px 8px;
  font-size: 12px;
  outline: none;
  width: 100%;
}

.subs-danger {
  background: #ffffeb !important;
  color: #8a2f24 !important;
  border-color: #d9a39a !important;
}

.sub-card-grid {
  width: 100%;
  border-collapse: collapse;
}

.sub-card-grid th,
.sub-card-grid td {
  border-bottom: 1px solid #efece3;
  padding: 5px 8px;
  font-size: 11px;
  text-align: left;
  font-weight: 400;
}

.sub-card-grid tr:last-child th,
.sub-card-grid tr:last-child td {
  border-bottom: 0;
}

.sub-card-grid th {
  width: 22%;
  color: #6b6b6b;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}

.sub-card-grid td {
  width: 28%;
  color: #1c1c1c;
}

.share-preview-wrap {
  margin-top: 4px;
  padding: 14px;
  display: flex;
  justify-content: center;
  background:
    linear-gradient(45deg, #e8e5dc 25%, transparent 25%) 0 0 / 14px 14px,
    linear-gradient(-45deg, #e8e5dc 25%, transparent 25%) 0 7px / 14px 14px,
    linear-gradient(45deg, transparent 75%, #e8e5dc 75%) 7px -7px / 14px 14px,
    linear-gradient(-45deg, transparent 75%, #e8e5dc 75%) -7px 0 / 14px 14px,
    #ffffeb;
}

#shareCanvas {
  display: block;
  width: min(360px, 100%);
  height: auto;
  max-height: 58vh;
}

.share-modal-footer {
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.share-modal-footer button {
  flex: 1 1 auto;
}

#shareDownloadBtn {
  background: #034f46 !important;
  border-color: #034f46 !important;
}

@media (max-width: 899px) {
  .modal {
    align-items: center;
    justify-content: center;
    padding: 16px;
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  }
  .modal-card {
    width: min(420px, 100%);
    max-height: min(80dvh, 560px);
    margin: auto;
  }
  body.phone-layout .modal {
    padding-bottom: calc(16px + var(--phone-tabs-h) + env(safe-area-inset-bottom, 0px));
  }
  body.phone-layout .modal-card {
    max-height: calc(100dvh - 32px - var(--phone-tabs-h) - env(safe-area-inset-bottom, 0px));
  }
}

/* ---------- details column ---------- */
.grid-table td.details-cell,
.grid-table td.row-menu-cell {
  text-align: center;
  padding: 0 2px;
  background: #ffffeb;
  white-space: nowrap;
  width: 22px;
}

.row-kebab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: #3b3b3b;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  vertical-align: middle;
}

.row-kebab:hover,
.row-kebab[aria-expanded="true"] {
  background: #fbf6e3;
  color: #034f46;
}

.row-menu {
  position: fixed;
  z-index: 160;
  min-width: 228px;
  background: #ffffeb;
  border: 1px solid #c9c4b6;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  padding: 2px 0;
}

.row-menu[hidden] {
  display: none !important;
}

.row-menu button {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  color: #3b3b3b;
  font-size: 12px;
  padding: 7px 12px;
  cursor: pointer;
  white-space: nowrap;
}

.row-menu button[hidden] {
  display: none !important;
}

.row-menu button:hover:not(:disabled) {
  background: #fbf6e3;
  color: #034f46;
}

.row-menu button:disabled {
  color: #9a9588;
  cursor: default;
}

.row-menu button.danger:hover:not(:disabled) {
  color: #8a2f24;
}

#confirmModal {
  z-index: 280;
}

#confirmOkBtn {
  background: #034f46 !important;
  border-color: #034f46 !important;
  color: #ffffeb !important;
}

.row-details-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  margin: 0 1px;
  padding: 0;
  border: 1px solid #c9c4b6;
  background: #ffffeb;
  color: #5a5a5a;
  font-size: 12px;
  line-height: 1;
  font-weight: 600;
  cursor: pointer;
  vertical-align: middle;
}

.row-details-btn:hover {
  background: #fbf6e3;
  color: #2f6fce;
  border-color: #2f6fce;
}

.row-details-btn.filled {
  background: #034f46;
  border-color: #9bb57a;
  color: #ffffeb;
}

.row-details-del {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  margin: 0 1px;
  padding: 0;
  border: 1px solid #d9a39a;
  background: #ffffeb;
  color: #8a2f24;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  vertical-align: middle;
}

.row-details-del:hover {
  background: #ef7c7c;
}

/* ---------- details drawer ---------- */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(50, 45, 40, 0.28);
  z-index: 180;
}

.drawer-backdrop[hidden] {
  display: none !important;
}

.details-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(360px, 100vw);
  height: 100vh;
  background: #ffffeb;
  border-left: 1px solid #ddd8ca;
  z-index: 190;
  transform: translateX(100%);
  transition: transform 0.22s ease;
  display: flex;
  flex-direction: column;
}

.details-drawer.open {
  transform: translateX(0);
}

.drawer-header {
  display: flex;
  align-items: stretch;
  flex-shrink: 0;
}

.drawer-header .bar {
  flex: 1;
}

.drawer-close {
  border: none;
  border-left: 1px solid #ddd8ca;
  background: #f6c8b5;
  color: #58291a;
  font-size: 20px;
  width: 40px;
  cursor: pointer;
}

.drawer-body {
  padding: 12px;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: #6b6b6b;
  margin-top: 6px;
}

.drawer-body input[type="date"],
.drawer-body input[type="text"],
.drawer-body input[type="file"],
.drawer-body select {
  border: 1px solid #c9c4b6;
  background: #ffffeb;
  padding: 7px 8px;
  font-size: 12px;
  outline: none;
  width: 100%;
}

.toggle-row {
  display: flex;
  gap: 0;
}

.toggle-btn {
  flex: 1;
  border: 1px solid #c9c4b6;
  background: #ffffeb;
  color: #3b3b3b;
  padding: 7px;
  font-size: 12px;
  cursor: pointer;
}

.toggle-btn + .toggle-btn {
  border-left: none;
}

.toggle-btn.active {
  background: #034f46;
  border-color: #034f46;
  color: #ffffeb;
  font-weight: 600;
}

.recurring-fields[hidden] {
  display: none !important;
}

.recurring-fields {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
  background: #fbf6e3;
  border: 1px solid #e7e2d5;
}

.receipt-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.receipt-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 5px 0;
  border-bottom: 1px solid #efece3;
  font-size: 11px;
}

.receipt-list button {
  border: 1px solid #d9a39a;
  background: #ffffeb;
  color: #8a2f24;
  font-size: 10px;
  padding: 2px 6px;
  cursor: pointer;
}

.drawer-footer {
  padding: 10px 12px;
  border-top: 1px solid #efece3;
  background: #fbf6e3;
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
}

.drawer-footer-spacer {
  flex: 1;
}

.drawer-footer button {
  border: 1px solid #3b3b3b;
  background: #3b3b3b;
  color: #ffffeb;
  padding: 7px 12px;
  font-size: 11px;
  cursor: pointer;
}

.drawer-footer #detailsCancel {
  background: #ffffeb;
  color: #3b3b3b;
}

.drawer-footer #detailsDelete,
.drawer-footer .danger-btn {
  background: #ffffeb;
  color: #8a2f24;
  border-color: #d9a39a;
}

.drawer-footer #detailsDelete[hidden] {
  display: none !important;
}

@media (max-width: 599px) {
  .details-drawer {
    width: 100vw;
  }
}

/* ---------- debt payoff tracker ---------- */
body.showing-sample .debt-setup .bar.green.big::after,
body.showing-sample .debt-tracker .bar.green.big::after {
  content: "  ·  SAMPLE DATA";
}

.debt-setup {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px;
  width: 100%;
  max-width: 100%;
}

.debt-tracker {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0;
  width: 100%;
  max-width: 100%;
  min-height: 0;
}

body[data-page="debt-tracker"] {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  overflow: hidden;
}

body[data-page="debt-tracker"] #topbar {
  flex-shrink: 0;
}

body[data-page="debt-tracker"] .notice-banners {
  flex-shrink: 0;
}

body[data-page="debt-tracker"] #page-tracker {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.debt-sheet-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 8px;
  -webkit-overflow-scrolling: touch;
}

.debt-table-panel {
  min-width: min-content;
}

.debt-setup-top {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 8px;
  align-items: stretch;
}

.start-date-row {
  display: flex;
  gap: 6px;
  padding: 10px;
  background: #ffffeb;
}

.start-date-row select {
  flex: 1;
  border: 1px solid #c9c4b6;
  background: #ffffeb;
  padding: 6px;
  font-size: 12px;
}

.debt-quote {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fbf6e3;
  border: 1px solid #ddd8ca;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 16px;
  font-style: italic;
  color: #5a5a5a;
  padding: 12px 20px;
  text-align: center;
}

.debt-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 8px;
}

.debt-main-scroll {
  overflow: visible;
}

.debt-wide {
  min-width: 900px;
}

.debt-table-panel thead tr:first-child th {
  position: sticky;
  top: 0;
  z-index: 5;
}

.debt-table-panel thead tr:last-child th {
  position: sticky;
  top: 20px;
  z-index: 4;
}

.debt-wide .th-sub {
  display: block;
  font-size: 9px;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  color: #5a5a5a;
}

.grid-table tr.paid-row td {
  background: #e9f1dc !important;
}

@media (max-width: 899px) {
  .debt-setup-top {
    grid-template-columns: 1fr;
  }
  .debt-quote {
    font-size: 14px;
    padding: 10px 12px;
  }
  .debt-stat-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 599px) {
  .debt-stat-grid {
    grid-template-columns: 1fr;
  }
  .debt-setup {
    padding: 6px;
  }
  .debt-sheet-scroll {
    padding: 6px;
  }
  .start-date-row {
    flex-direction: column;
  }
  body[data-page="debt-setup"] .debt-setup {
    padding-bottom: 12px;
  }
}

/* ============================================================
   Mobile mode
   ============================================================ */

html, body {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body.mobile-mode {
  overflow: hidden;
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
}

body.mobile-mode #topbar,
body.mobile-mode .notice-banners,
body.mobile-mode .page,
body.mobile-mode #detailsDrawer,
body.mobile-mode #detailsBackdrop,
body.mobile-mode #shareModal,
body.mobile-mode .site-footer {
  display: none !important;
}

.mobile-mode-screen {
  position: fixed;
  inset: 0;
  z-index: 110;
  background: #ffffeb;
  display: flex;
  flex-direction: column;
  height: 100%;
  max-height: 100svh;
  overflow: hidden;
  padding: 0;
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
  touch-action: manipulation;
}

.mobile-save-wash {
  position: absolute;
  inset: 0;
  z-index: 2;
  background: #2d8118;
  transform: translateX(-100%);
  pointer-events: none;
}

.mobile-mode-screen.save-flash .mobile-save-wash {
  animation: mobileSaveSweep 1s ease-in-out forwards;
}

@keyframes mobileSaveSweep {
  0% { transform: translateX(-100%); }
  32% { transform: translateX(0); }
  68% { transform: translateX(0); }
  100% { transform: translateX(100%); }
}

.mobile-mode-screen[hidden] {
  display: none !important;
}

.mobile-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: #ffffeb;
  border-bottom: 1px solid #d9d4c7;
  padding: 10px 14px;
  flex-shrink: 0;
}

.mobile-head .brand {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: #034f46;
  white-space: nowrap;
  text-decoration: none;
}

.mobile-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.mobile-auth-slot .auth-btn.primary {
  padding: 5px 10px !important;
  font-size: 11px !important;
}

.mobile-banner {
  margin: 0;
  flex-shrink: 0;
  background: #fbf6e3;
  border-bottom: 1px solid #e7e2d5;
  color: #6b6b6b;
  font-size: 12px;
  line-height: 1.4;
  text-align: center;
  padding: 10px 14px;
}

.mobile-signin-msg {
  margin: 0;
  flex-shrink: 0;
  background: #fff4ef;
  border-bottom: 1px solid #034f46;
  color: #58291a;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  text-align: center;
  padding: 12px 14px;
}

.mobile-signin-msg[hidden] {
  display: none !important;
}

.mobile-form {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.mobile-form.form-disabled {
  opacity: 0.55;
}

.mobile-form .bar {
  flex-shrink: 0;
}

.mobile-fields {
  background: #ffffeb;
  border: 1px solid #d9d4c7;
  border-top: none;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.mobile-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: #6b6b6b;
}

.mobile-field input,
.mobile-field select {
  width: 100%;
  font-size: 16px;
  line-height: 1.25;
  padding: 12px 10px;
  border: 1px solid #c9c4b6;
  background: #ffffeb;
  color: #3b3b3b;
  outline: none;
  text-transform: none;
  font-weight: 400;
  letter-spacing: 0;
}

.mobile-field input:focus,
.mobile-field select:focus {
  border-color: #034f46;
}

.mobile-field input:disabled,
.mobile-field select:disabled {
  background: #f5f3ee;
  color: #9a958a;
}

.mobile-amount-wrap {
  display: flex;
  align-items: stretch;
  border: 1px solid #c9c4b6;
  background: #ffffeb;
}

.mobile-amount-wrap:focus-within {
  border-color: #034f46;
}

.mobile-curr {
  display: flex;
  align-items: center;
  padding: 0 10px;
  background: #fff8e5;
  border-right: 1px solid #e7e2d5;
  font-size: 16px;
  font-weight: 600;
  color: #3b3b3b;
}

.mobile-amount-wrap input {
  border: none;
  flex: 1;
  min-width: 0;
}

.mobile-submit {
  margin-top: 12px;
  width: 100%;
  border: 1px solid #3b3b3b;
  background: #3b3b3b;
  color: #ffffeb;
  padding: 14px 12px;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  cursor: pointer;
}

.mobile-submit:hover:not(:disabled) {
  background: #555550;
  border-color: #555550;
}

.mobile-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.mobile-status {
  min-height: 24px;
  margin: 12px 0 0;
  text-align: center;
  font-size: 13px;
  color: #6b6b6b;
  position: relative;
  z-index: 2;
}

.mobile-status.ok {
  color: #ffffeb;
  font-weight: 800;
  font-size: 16px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.mobile-status.err { color: #b54a3a; font-weight: 600; }

/* ============================================================
   Sheetal helper (dormant)
   ============================================================ */

.sheetal.dormant,
.sheetal[hidden] {
  display: none !important;
}

.sheetal {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 95;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  pointer-events: none;
  touch-action: none;
}

.sheetal.placed {
  right: auto;
  top: auto;
}

.sheetal-bubble,
.sheetal-bubble *,
.sheetal-avatar,
.sheetal-avatar img,
.sheetal-bob,
.sheetal-wiggle {
  border-radius: 0 !important;
}

.sheetal-bubble {
  pointer-events: auto;
  position: relative;
  width: min(250px, calc(100vw - 32px));
  background: #ffffeb;
  border: 2px solid #034f46;
  box-shadow: 3px 3px 0 #f4ebd3;
  padding: 10px 28px 12px 12px;
  animation: sheetal-pop 0.28s ease-out;
}

.sheetal-bubble[hidden] {
  display: none !important;
}

.sheetal-bubble::after {
  content: "";
  position: absolute;
  right: 28px;
  bottom: -8px;
  width: 12px;
  height: 12px;
  background: #ffffeb;
  border-right: 2px solid #034f46;
  border-bottom: 2px solid #034f46;
  transform: rotate(45deg);
}

.sheetal-name {
  margin: 0 0 4px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: #034f46;
}

.sheetal-text {
  margin: 0;
  font-size: 12px;
  line-height: 1.45;
  color: #3b3b3b;
}

.sheetal-dismiss {
  pointer-events: auto;
  position: absolute;
  top: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  border: none !important;
  background: transparent !important;
  color: #9a958a !important;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  padding: 0 !important;
}

.sheetal-dismiss:hover {
  color: #3b3b3b !important;
}

.sheetal-avatar {
  pointer-events: auto;
  width: 104px;
  height: 104px;
  padding: 0;
  border: none;
  background: transparent;
  cursor: grab;
}

.sheetal.dragging .sheetal-avatar {
  cursor: grabbing;
}

.sheetal-wiggle,
.sheetal-bob {
  display: block;
  width: 100%;
  height: 100%;
}

.sheetal-bob {
  animation: sheetal-idle 2.6s ease-in-out infinite;
}

.sheetal.dragging .sheetal-bob {
  animation-play-state: paused;
}

.sheetal-avatar img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  background: transparent;
}

.sheetal.talking .sheetal-wiggle {
  animation: sheetal-talk 0.55s ease;
}

@keyframes sheetal-idle {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

@keyframes sheetal-talk {
  0% { transform: rotate(0); }
  30% { transform: rotate(-7deg); }
  60% { transform: rotate(6deg); }
  100% { transform: rotate(0); }
}

@keyframes sheetal-pop {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

body.mobile-mode .sheetal {
  z-index: 130;
  right: 10px;
  bottom: 10px;
}

body.mobile-mode .sheetal.placed {
  right: auto;
  top: auto;
}

body.mobile-mode .sheetal-avatar {
  width: 84px;
  height: 84px;
}

body.mobile-mode .sheetal-bubble {
  width: min(220px, calc(100vw - 24px));
}

#catModal:not([hidden]) ~ .sheetal,
#detailsDrawer.open ~ .sheetal {
  visibility: hidden;
}

@media (max-width: 599px) {
  .sheetal:not(.placed) {
    right: 10px;
    bottom: 10px;
  }
  .sheetal-avatar {
    width: 84px;
    height: 84px;
  }
}

/* Page footer — outside the sheet grid, so it cannot change rows or totals.
   Tall enough on phones that last table rows can scroll above the keyboard. */
.site-footer {
  border-top: 3px solid #034f46;
  background: #034f46;
  color: #ffffeb;
  padding: 40px 20px 32px;
  margin-top: 12px;
  min-height: 280px;
}

.site-footer-inner {
  /* max-width: 1100px; */
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr 1fr;
  gap: 28px 32px;
  align-items: start;
}

.site-footer-brand-block p {
  margin: 10px 0 0;
  font-size: 13px;
  line-height: 1.55;
  color: #d7efe9;
  max-width: 280px;
}

.site-footer-brand {
  display: inline-block;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 1.4px;
  color: #ffffeb;
  text-decoration: none;
}

.site-footer-brand:hover {
  text-decoration: underline;
}

.site-footer-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.site-footer-col h4 {
  margin: 0 0 6px;
  font-size: 11px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: #9ed3c8;
}

.site-footer-col a {
  font-size: 13px;
  color: #ffffeb;
  text-decoration: none;
}

.site-footer-col a:hover {
  text-decoration: underline;
}

.site-footer-copy {
  max-width: 1100px;
  margin: 28px auto 0;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 235, 0.22);
  font-size: 12px;
  color: #b7d8d1;
}

@media (max-width: 980px) {
  .site-footer {
    min-height: 380px;
    padding: 36px 16px 48px;
  }

  .site-footer-inner {
    grid-template-columns: 1fr 1fr;
    gap: 22px 20px;
  }

  td.cell.editing,
  td.cell.selected {
    scroll-margin-bottom: 12px;
  }
}

@media (max-width: 599px) {
  .site-footer {
    min-height: 420px;
    padding-bottom: 56px;
  }

  .site-footer-inner {
    grid-template-columns: 1fr 1fr;
  }
}

/* ============================================================
   Phone sheet layout (narrow viewport, not Mobile Mode)
   ============================================================ */

.phone-tabs,
.outgoing-subtabs,
.phone-help {
  display: none;
}

@media (max-width: 899px) {
  body.phone-layout {
    display: flex;
    flex-direction: column;
    height: 100%;
    height: 100dvh;
    overflow: hidden;
    overscroll-behavior: none;
  }

  html:has(body.phone-layout) {
    height: 100%;
    height: 100dvh;
    overflow: hidden;
  }

  body.phone-layout #topbar {
    position: relative;
    flex-shrink: 0;
    top: auto;
  }

  body.phone-layout .notice-banners {
    position: relative;
    top: auto;
    flex-shrink: 0;
    z-index: 20;
  }

  body.phone-layout .page {
    flex: 1 1 auto;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding-bottom: 8px;
  }

  body.phone-layout .board {
    overflow-x: hidden;
    overflow-y: auto;
  }

  body.phone-layout .page[hidden] {
    display: none !important;
  }

  body.phone-layout #page-monthly .month-panel {
    top: 0;
  }

  body.phone-layout .site-footer {
    display: none !important;
  }

  body.phone-layout .phone-hide {
    display: none !important;
  }

  body.phone-layout .phone-tabs {
    display: flex;
    flex-shrink: 0;
    position: relative;
    z-index: 80;
    width: 100%;
    background: #ebe6d6;
    border-top: 1px solid #d4cdb8;
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom, 0px));
    gap: 5px;
    justify-content: stretch;
    align-items: stretch;
    min-height: var(--phone-tabs-h);
  }

  body.phone-layout .phone-tabs button {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    border: 1px solid #d4cdb8;
    border-radius: 8px;
    background: #ffffeb;
    color: #5c584c;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.2px;
    padding: 6px 2px 5px;
    min-width: 0;
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.06);
  }

  body.phone-layout .phone-tabs button svg {
    width: 18px;
    height: 18px;
  }

  body.phone-layout .phone-tabs button[data-phone-tab="summary"] { color: #034f46; }
  body.phone-layout .phone-tabs button[data-phone-tab="income"] { color: #1d5a10; }
  body.phone-layout .phone-tabs button[data-phone-tab="outgoing"] { color: #8a3d38; }
  body.phone-layout .phone-tabs button[data-phone-tab="help"] { color: #5c584c; }

  body.phone-layout .phone-tabs button[data-phone-tab="transactions"] {
    flex: 1.2 1 0;
    background: #ffd042;
    border-color: #c99612;
    color: #5f4a12;
  }

  body.phone-layout .phone-tabs button[data-phone-tab="summary"].active {
    background: #034f46;
    border-color: #034f46;
    color: #ffffeb;
  }

  body.phone-layout .phone-tabs button[data-phone-tab="income"].active {
    background: #2d8118;
    border-color: #1d5a10;
    color: #ffffeb;
  }

  body.phone-layout .phone-tabs button[data-phone-tab="transactions"].active {
    background: #e0a800;
    border-color: #5f4a12;
    color: #3d2e08;
    box-shadow: inset 0 0 0 2px #5f4a12;
  }

  body.phone-layout .phone-tabs button[data-phone-tab="outgoing"].active {
    background: #ef7c7c;
    border-color: #c45c5c;
    color: #fff;
  }

  body.phone-layout .phone-tabs button[data-phone-tab="help"].active {
    background: #5c584c;
    border-color: #3b3b3b;
    color: #ffffeb;
  }

  body.phone-layout .outgoing-subtabs {
    display: flex;
    position: sticky;
    top: var(--wes-month-panel);
    z-index: 35;
    background: #f7f3e6;
    border-bottom: 1px solid #d9d4c7;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 6px;
    padding: 6px;
  }

  body.phone-layout .outgoing-subtabs[hidden] {
    display: none !important;
  }

  body.phone-layout .outgoing-subtabs button {
    flex: 1 0 auto;
    border: 1px solid #efc4c4;
    border-radius: 8px;
    background: #fff;
    color: #8a3d38;
    font-size: 12px;
    font-weight: 700;
    padding: 8px 10px;
  }

  body.phone-layout .outgoing-subtabs button.active {
    background: #ef7c7c;
    border-color: #c45c5c;
    color: #fff;
  }

  body.phone-layout .phone-help {
    display: none;
  }

  body.phone-layout[data-phone-tab="help"] .phone-help {
    display: block;
  }

  body.phone-layout .phone-help-body {
    display: flex;
    flex-direction: column;
    padding: 8px 0;
  }

  body.phone-layout .phone-help-body a,
  body.phone-layout .phone-help-body button {
    display: block;
    width: 100%;
    text-align: left;
    background: #ffffeb;
    border: 0;
    border-bottom: 1px solid #e6e0d0;
    color: #034f46;
    font-size: 15px;
    font-weight: 600;
    padding: 14px 16px;
    text-decoration: none;
  }

  body.phone-layout[data-phone-tab="summary"] .income-block,
  body.phone-layout[data-phone-tab="summary"] #col3,
  body.phone-layout[data-phone-tab="summary"] #col4,
  body.phone-layout[data-phone-tab="summary"] #phoneHelp {
    display: none !important;
  }

  body.phone-layout[data-phone-tab="income"] .kpi-stack,
  body.phone-layout[data-phone-tab="income"] .summary-panel,
  body.phone-layout[data-phone-tab="income"] .chart-pie,
  body.phone-layout[data-phone-tab="income"] .chart-spend,
  body.phone-layout[data-phone-tab="income"] .chart-budget,
  body.phone-layout[data-phone-tab="income"] #col3,
  body.phone-layout[data-phone-tab="income"] #col4,
  body.phone-layout[data-phone-tab="income"] #phoneHelp {
    display: none !important;
  }

  body.phone-layout[data-phone-tab="transactions"] .kpi-stack,
  body.phone-layout[data-phone-tab="transactions"] .summary-panel,
  body.phone-layout[data-phone-tab="transactions"] .chart-pie,
  body.phone-layout[data-phone-tab="transactions"] .chart-spend,
  body.phone-layout[data-phone-tab="transactions"] .chart-budget,
  body.phone-layout[data-phone-tab="transactions"] .income-block,
  body.phone-layout[data-phone-tab="transactions"] #col3,
  body.phone-layout[data-phone-tab="transactions"] #phoneHelp {
    display: none !important;
  }

  body.phone-layout[data-phone-tab="outgoing"] .kpi-stack,
  body.phone-layout[data-phone-tab="outgoing"] .summary-panel,
  body.phone-layout[data-phone-tab="outgoing"] .chart-pie,
  body.phone-layout[data-phone-tab="outgoing"] .chart-spend,
  body.phone-layout[data-phone-tab="outgoing"] .chart-budget,
  body.phone-layout[data-phone-tab="outgoing"] .income-block,
  body.phone-layout[data-phone-tab="outgoing"] #col4,
  body.phone-layout[data-phone-tab="outgoing"] #phoneHelp {
    display: none !important;
  }

  body.phone-layout[data-phone-tab="help"] .kpi-stack,
  body.phone-layout[data-phone-tab="help"] .summary-panel,
  body.phone-layout[data-phone-tab="help"] .chart-pie,
  body.phone-layout[data-phone-tab="help"] .chart-spend,
  body.phone-layout[data-phone-tab="help"] .chart-budget,
  body.phone-layout[data-phone-tab="help"] .income-block,
  body.phone-layout[data-phone-tab="help"] #col3,
  body.phone-layout[data-phone-tab="help"] #col4 {
    display: none !important;
  }

  body.phone-layout[data-phone-tab="outgoing"] #col3 .two-col {
    display: flex;
    flex-direction: column;
    align-items: stretch;
  }

  body.phone-layout[data-phone-tab="outgoing"] #col3 .two-col .col {
    display: contents;
  }

  body.phone-layout[data-phone-tab="outgoing"] #sec-bills,
  body.phone-layout[data-phone-tab="outgoing"] #sec-expenses,
  body.phone-layout[data-phone-tab="outgoing"] #sec-debt,
  body.phone-layout[data-phone-tab="outgoing"] #sec-save,
  body.phone-layout[data-phone-tab="outgoing"] #sec-invest {
    display: none !important;
  }

  body.phone-layout[data-phone-tab="outgoing"][data-out-tab="bills"] #sec-bills,
  body.phone-layout[data-phone-tab="outgoing"][data-out-tab="expenses"] #sec-expenses,
  body.phone-layout[data-phone-tab="outgoing"][data-out-tab="debt"] #sec-debt,
  body.phone-layout[data-phone-tab="outgoing"][data-out-tab="save"] #sec-save,
  body.phone-layout[data-phone-tab="outgoing"][data-out-tab="invest"] #sec-invest {
    display: flex !important;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 100%;
    width: 100%;
  }

  body.phone-layout td.cell,
  body.phone-layout td.details-cell {
    scroll-margin-top: calc(var(--wes-month-panel) + 12px);
    scroll-margin-bottom: calc(var(--keyboard-inset) + 16px);
  }

  body.phone-layout td.cell.editing input,
  body.phone-layout td.cell.editing select {
    font-size: 16px;
    line-height: 1.2;
  }

  body.phone-layout .month-card-select {
    font-size: 16px;
  }

  body.phone-layout .left-unit,
  body.phone-layout .month-panel,
  body.phone-layout #col3,
  body.phone-layout #col4 {
    width: 100%;
    max-width: 100%;
    align-self: stretch;
  }

  body.phone-layout #page-monthly {
    align-content: start;
    justify-items: stretch;
    width: 100%;
  }

  body.phone-layout[data-phone-tab="transactions"] #page-monthly,
  body.phone-layout[data-phone-tab="outgoing"] #page-monthly {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    overflow: hidden;
    width: 100%;
    height: 100%;
  }

  body.phone-layout[data-phone-tab="transactions"] .left-unit,
  body.phone-layout[data-phone-tab="outgoing"] .left-unit,
  body.phone-layout[data-phone-tab="transactions"] .left-wrap,
  body.phone-layout[data-phone-tab="outgoing"] .left-wrap {
    flex: 0 0 auto;
    width: 100%;
  }

  body.phone-layout[data-phone-tab="transactions"] #col4,
  body.phone-layout[data-phone-tab="transactions"] .tracker-panel {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
  }

  body.phone-layout[data-phone-tab="transactions"] .tracker-scroll {
    flex: 1 1 auto;
    max-height: none;
    min-height: 0;
  }

  body.phone-layout[data-phone-tab="outgoing"] #col3 {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
  }

  body.phone-layout[data-phone-tab="outgoing"] .outgoing-subtabs {
    position: relative;
    top: auto;
    flex: 0 0 auto;
  }

  body.phone-layout[data-phone-tab="outgoing"] #col3 .two-col {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
  }

  body.phone-layout #page-categories {
    min-height: 0;
    height: auto;
    gap: 8px;
    padding: 0 0 12px;
  }

  body.phone-layout .cats-year-row {
    flex-direction: column;
    align-items: stretch;
  }

  body.phone-layout .cats-year-row .note {
    text-align: left;
    padding: 4px 10px 8px;
  }

  body.phone-layout .cats-grid {
    display: flex;
    flex-direction: column;
    grid-template-columns: 1fr;
    gap: 8px;
    height: auto;
    flex: none;
    min-height: 0;
  }

  body.phone-layout .cats-grid > .col {
    height: auto;
    min-height: 0;
    gap: 8px;
  }

  body.phone-layout .cats-grid > .col > .panel,
  body.phone-layout .cats-grid > .panel,
  body.phone-layout .cats-grid .grid-table {
    height: auto;
    flex: none;
    min-height: 0;
  }

  body.phone-layout .cats-grid .grid-table td {
    overflow: visible;
    text-overflow: unset;
    white-space: normal;
    word-break: break-word;
  }
}

body.mobile-mode .phone-tabs,
body.mobile-mode .outgoing-subtabs,
body.mobile-mode .phone-help {
  display: none !important;
}

/* ============================================================
   Smart deals: collapsible left column + deals panel (desktop)
   ============================================================ */

.left-unit {
  min-width: 0;
}

.collapse-row,
.side-rail,
#dealsPanel {
  display: none;
}

.chev {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.chev-icon {
  width: 20px;
  height: 20px;
  display: block;
}

.chev-right { transform: scaleX(-1); }
.chev-up { transform: rotate(90deg); }
.chev-down { transform: rotate(-90deg); }

@keyframes wes-bobble-left {
  0%, 100% { transform: translateX(0) scale(1); }
  30% { transform: translateX(-3px) scale(1.14); }
  52% { transform: translateX(1.5px) scale(0.94); }
  74% { transform: translateX(-2px) scale(1.06); }
}

@keyframes wes-bobble-right {
  0%, 100% { transform: translateX(0) scale(1); }
  30% { transform: translateX(3px) scale(1.14); }
  52% { transform: translateX(-1.5px) scale(0.94); }
  74% { transform: translateX(2px) scale(1.06); }
}

@keyframes wes-bobble-up {
  0%, 100% { transform: translateY(0) scale(1); }
  30% { transform: translateY(-3px) scale(1.14); }
  52% { transform: translateY(1.5px) scale(0.94); }
  74% { transform: translateY(-2px) scale(1.06); }
}

.bobble-left,
.bobble-right,
.bobble-up {
  display: inline-flex;
  animation-duration: 1.7s;
  animation-timing-function: ease-in-out;
  animation-iteration-count: infinite;
}

.bobble-left { animation-name: wes-bobble-left; }
.bobble-right { animation-name: wes-bobble-right; }
.bobble-up { animation-name: wes-bobble-up; }

.collapse-row:hover .bobble-left,
.side-rail:hover .bobble-left,
.side-rail:hover .bobble-right,
.deals-collapse-btn:hover .bobble-right,
.deals-sheet-toggle:hover .bobble-up {
  animation-duration: 0.5s;
}

@media (prefers-reduced-motion: reduce) {
  .bobble-left,
  .bobble-right,
  .bobble-up {
    animation: none;
  }
}

.side-rail {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 34px;
  min-height: 240px;
  height: calc(100vh - var(--wes-sticky-topbar) - 28px);
  padding: 10px 0;
  background: #034f46;
  color: #ffffeb;
  border: 1px solid #034f46;
  cursor: pointer;
  position: sticky;
  top: calc(var(--wes-sticky-topbar) + 8px);
}

.side-rail:hover {
  background: #046355;
}

.side-rail .rail-label {
  writing-mode: vertical-rl;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 1.6px;
}

#dealsRail.side-rail {
  background: #734bb6;
  border-color: #5e3a96;
  color: #ffffeb;
}

#dealsRail.side-rail:hover {
  background: #6240a0;
}

@media (min-width: 900px) {
  .left-unit {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
  }

  .collapse-row {
    display: flex;
    align-items: center;
    position: sticky;
    top: calc(var(--wes-sticky-topbar) + 8px);
    z-index: 5;
    width: 100%;
    min-height: 30px;
    padding: 4px 10px;
    background: #034f46;
    color: #ffffeb;
    border: 1px solid #034f46;
    cursor: pointer;
    font-family: inherit;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.4px;
  }

  .collapse-row:hover {
    background: #046355;
  }

  .collapse-row-label {
    position: absolute;
    left: 0;
    right: 0;
    text-align: center;
    pointer-events: none;
  }

  .collapse-row .chev {
    position: relative;
    z-index: 1;
  }

  body:not(.deals-collapsed) #dealsPanel {
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: #f6f1fb;
    border: 1px solid #d4c2ee;
    padding-bottom: 8px;
  }

  body.deals-collapsed #dealsRail {
    display: flex;
  }

  body.left-collapsed .left-unit {
    display: none;
  }

  body.left-collapsed #leftRail {
    display: flex;
  }
}

@media (min-width: 900px) and (max-width: 1279px) {
  body:not(.left-collapsed).deals-collapsed #page-monthly {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 36px;
  }

  body:not(.left-collapsed):not(.deals-collapsed) #page-monthly {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(200px, 250px);
  }

  body.left-collapsed.deals-collapsed #page-monthly {
    grid-template-columns: 36px minmax(0, 1fr) 36px;
  }

  body.left-collapsed:not(.deals-collapsed) #page-monthly {
    grid-template-columns: 36px minmax(0, 1fr) minmax(200px, 250px);
  }

  #page-monthly .left-unit { grid-column: 1; grid-row: 1; }
  #page-monthly #col3 { grid-column: 2; grid-row: 1; }
  #page-monthly #col4 { grid-column: 1 / 3; grid-row: 2; }
  #page-monthly #leftRail,
  #page-monthly #dealsRail,
  #page-monthly #dealsPanel {
    grid-column: 3;
    grid-row: 1 / span 2;
    align-self: stretch;
    height: auto;
    min-height: 0;
    max-height: none;
  }

  #page-monthly #leftRail { grid-column: 1; }

  body.left-collapsed #page-monthly #col3 { grid-column: 2; grid-row: 1; }
  body.left-collapsed #page-monthly #col4 { grid-column: 2; grid-row: 2; }
}

@media (min-width: 1280px) {
  .board {
    grid-template-columns: minmax(0, 37.5fr) minmax(0, 36fr) minmax(0, 26.5fr) 34px;
  }

  body:not(.deals-collapsed) .board {
    grid-template-columns: minmax(0, 37.5fr) minmax(0, 36fr) minmax(0, 26.5fr) 248px;
  }

  body.left-collapsed .left-unit {
    display: none;
  }

  body.left-collapsed #leftRail {
    display: flex;
  }

  body.left-collapsed.deals-collapsed .board {
    grid-template-columns: 34px minmax(0, 46fr) minmax(0, 54fr) 34px;
  }

  body.left-collapsed:not(.deals-collapsed) .board {
    grid-template-columns: 34px minmax(0, 40fr) minmax(0, 60fr) 260px;
  }
}

/* ---------- deal cards ---------- */

.deals-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  max-height: calc(100vh - 140px);
}

.deal-card {
  background: #ffffeb;
  border: 1px solid #ddd8ca;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.deal-card.deal-unapproved {
  border-style: dashed;
  border-color: #c9a23f;
}

.deal-top {
  display: flex;
  align-items: center;
  gap: 8px;
}

.deal-logo {
  width: 28px;
  height: 28px;
  object-fit: contain;
  background: #fff;
  border: 1px solid #efece3;
  flex-shrink: 0;
}

.deal-brand {
  font-weight: 700;
  color: #734bb6;
  font-size: 13px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.deal-tags {
  display: flex;
  gap: 4px;
  margin-left: auto;
  flex-shrink: 0;
}

.deal-tag {
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.6px;
  padding: 2px 6px;
  background: #f3eafc;
  color: #4a2d78;
  border: 1px solid #c4a6e8;
}

.deal-product {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  color: #3b3b3b;
}

.deal-tagline {
  margin: 0;
  font-size: 11px;
  color: #6b6b6b;
  line-height: 1.4;
}

.deal-offer {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  color: #2d8118;
  white-space: pre-line;
}

.deal-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 2px;
}

.deal-prices {
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
  flex-wrap: wrap;
}

.deal-price-old {
  font-size: 11px;
  color: #8a8478;
  text-decoration: line-through;
}

.deal-price-new {
  font-size: 13px;
  font-weight: 700;
  color: #034f46;
}

.deal-new {
  flex-shrink: 0;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.6px;
  padding: 2px 6px;
  background: #ffd042;
  color: #3b3b3b;
  border: 1px solid #e0a800;
  animation: deal-new-flash 1.1s steps(2, end) infinite;
}

@keyframes deal-new-flash {
  50% {
    background: #734bb6;
    color: #ffffeb;
    border-color: #734bb6;
  }
}

@media (prefers-reduced-motion: reduce) {
  .deal-new { animation: none; }
}

.deal-link {
  background: #734bb6;
  color: #ffffeb;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.8px;
  padding: 6px 12px;
  text-decoration: none;
  flex-shrink: 0;
}

.deal-link:hover {
  background: #6240a0;
}

.deal-draft-note {
  margin: 0;
  font-size: 9px;
  color: #b08a1e;
}

.deals-empty {
  font-size: 11px;
  color: #6b6b6b;
  padding: 8px;
  margin: 0;
}

/* ---------- deals admin modal ---------- */

.deal-modal-card {
  width: min(460px, 100%);
  max-height: min(88vh, 680px);
}

.deal-form .field-label {
  display: block;
  margin-top: 10px;
}

.deal-form input[type="text"],
.deal-form textarea {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #c9c4b6;
  background: #ffffeb;
  color: #3b3b3b;
  font-family: inherit;
  font-size: 12px;
  padding: 7px 8px;
  margin-top: 2px;
  resize: vertical;
}

.deal-logo-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
}

.deal-logo-preview {
  width: 36px;
  height: 36px;
  object-fit: contain;
  border: 1px solid #ddd8ca;
  background: #fff;
  flex-shrink: 0;
}

.deal-logo-row input[type="file"] {
  font-size: 11px;
  flex: 1;
  min-width: 0;
}

.deal-logo-row button {
  border: 1px solid #c9c4b6;
  background: #ffffeb;
  color: #3b3b3b;
  font-size: 10px;
  padding: 4px 8px;
  cursor: pointer;
}

.deal-admin-list .deal-admin-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border-bottom: 1px solid #efece3;
}

.deal-admin-name {
  flex: 1;
  min-width: 0;
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.deal-admin-state {
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.6px;
  padding: 2px 6px;
  border: 1px solid #c9c4b6;
  color: #6b6b6b;
  background: #ffffeb;
}

.deal-admin-state.ok {
  background: #ccf1c3;
  border-color: #2d8118;
  color: #1d5a10;
}

.deal-admin-list button[data-deal-edit] {
  padding: 4px 10px;
  font-size: 10px;
}

.deal-modal-footer {
  gap: 8px;
}

.deal-footer-spacer {
  flex: 1;
}

.deal-danger {
  background: #b54a3a !important;
  border-color: #b54a3a !important;
}

/* ---------- smart deals bottom sheet (phone) ---------- */

.deals-sheet {
  display: none;
}

@media (max-width: 899px) {
  body.phone-layout .deals-sheet {
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
  }

  .deals-sheet-head {
    display: flex;
    align-items: stretch;
    background: #734bb6;
    border-top: 1px solid #5e3a96;
    flex-shrink: 0;
  }

  .deals-sheet-toggle {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    background: transparent;
    border: 0;
    color: #ffffeb;
    font-weight: 700;
    font-size: 10px;
    letter-spacing: 1.4px;
    padding: 10px 14px;
    min-width: 0;
  }

  .deals-sheet-manage {
    border: 0;
    border-left: 1px solid rgba(255, 255, 235, 0.3);
    background: transparent;
    color: #ffffeb;
    font-size: 13px;
    padding: 0 14px;
  }

  .sheet-arrow {
    transition: transform 0.2s ease;
    font-size: 10px;
  }

  .deals-sheet-body {
    display: none;
  }

  body.phone-layout .deals-sheet.open {
    position: fixed;
    inset: 0;
    z-index: 150;
    background: #ffffeb;
  }

  .deals-sheet.open .sheet-arrow {
    transform: rotate(180deg);
  }

  .deals-sheet.open .deals-sheet-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  }
}

body.mobile-mode .deals-sheet {
  display: none !important;
}

/* ---------- step-up SIP calculator ---------- */
.sip-page {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px;
  width: 100%;
  max-width: 100%;
}

.sip-top {
  display: grid;
  grid-template-columns: minmax(260px, 1.05fr) minmax(240px, 0.95fr) minmax(220px, 0.85fr);
  gap: 8px;
  align-items: stretch;
}

.sip-input-table td:first-child,
.sip-result-table td:first-child {
  text-align: left;
  padding-left: 8px;
  white-space: normal;
  line-height: 1.3;
}

.sip-input-table th:last-child,
.sip-result-table th:last-child,
.sip-year-table th {
  text-align: center;
}

.sip-input-table td,
.sip-result-table td,
.sip-year-table td {
  height: 28px;
  font-size: 12px;
}

.sip-edit {
  background: #fff;
  box-shadow: inset 0 0 0 2px #034f46;
  padding: 0 6px;
}

.sip-page .legend-swatch.editable {
  background: #fff;
  box-shadow: inset 0 0 0 1.5px #034f46;
}

.sip-edit:focus-within {
  background: #e5f4f1;
}

.sip-field {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  width: 100%;
}

.sip-affix {
  color: #034f46;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}

.sip-input {
  flex: 0 1 6.5em;
  width: 6.5em;
  min-width: 0;
  border: 0;
  background: transparent;
  color: #034f46;
  font-size: 13px;
  font-weight: 700;
  text-align: right;
  padding: 4px 2px;
  outline: none;
}

.sip-input-money {
  flex-basis: 11em;
  width: 11em;
}

.sip-input:focus {
  background: transparent;
}

.sip-result-table tbody td {
  background: #e4efd5;
}

.sip-result-table td.money,
.sip-year-table td.money {
  text-align: right;
  padding-right: 8px;
}

.sip-year-table td.center {
  text-align: center;
}

.sip-today-row td {
  background: #ffd042 !important;
  color: #1c1c1c;
  font-weight: 700;
}

.sip-year-table td.sip-today-cell {
  background: #fff4c4;
  font-weight: 600;
}

.sip-plain {
  margin: 0;
  padding: 8px 10px 10px;
  font-size: 12px;
  line-height: 1.45;
  color: #3b3b3b;
}

.sip-pie-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.sip-chart-wrap {
  position: relative;
  height: 220px;
  margin: 8px 12px 0;
}

.sip-chart-wrap canvas {
  position: relative;
  z-index: 1;
}

.sip-chart-center {
  position: absolute;
  inset: 18%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  pointer-events: none;
  z-index: 0;
}

.sip-center-label {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 1px;
  color: #6b6b6b;
}

.sip-chart-center strong {
  font-size: 14px;
  font-weight: 700;
  color: #034f46;
  line-height: 1.2;
}

.sip-legend {
  list-style: none;
  margin: 0;
  padding: 8px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
}

.sip-legend li {
  display: flex;
  align-items: center;
  gap: 6px;
}

.sip-dot {
  width: 10px;
  height: 10px;
  flex-shrink: 0;
  border: 1px solid rgba(0, 0, 0, 0.15);
}

.sip-dot-principal { background: #034f46; }
.sip-dot-interest { background: #ffd042; }

.sip-scroll {
  overflow-x: auto;
  max-width: 100%;
}

.sip-year-table {
  min-width: 760px;
}

.sip-read {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
}

.sip-read > div {
  padding: 10px 12px 12px;
  border-right: 1px solid #e7e2d5;
}

.sip-read > div:last-child {
  border-right: 0;
}

.sip-read h2 {
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.2px;
  color: #034f46;
}

.sip-read p,
.sip-faq p {
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
  color: #3b3b3b;
}

.sip-faq details {
  border-top: 1px solid #e7e2d5;
}

.sip-faq details:last-child {
  border-bottom: 0;
}

.sip-faq summary {
  cursor: pointer;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 600;
  color: #1c1c1c;
  background: #ffffeb;
}

.sip-faq summary:hover {
  background: #f3f0e4;
}

.sip-faq details[open] summary {
  background: #e4efd5;
}

.sip-faq p {
  padding: 8px 12px 12px;
}

.sip-page .nav-btn {
  text-decoration: none;
}

@media (max-width: 980px) {
  .sip-top,
  .sip-read {
    grid-template-columns: 1fr;
  }

  .sip-read > div {
    border-right: 0;
    border-bottom: 1px solid #e7e2d5;
  }

  .sip-read > div:last-child {
    border-bottom: 0;
  }
}

@media (max-width: 899px) {
  .sip-input {
    flex-basis: 5.2em;
    width: 5.2em;
    font-size: 16px;
    padding: 8px 2px;
  }

  .sip-input-money {
    flex-basis: 8.6em;
    width: 8.6em;
  }

  .sip-input-table td,
  .sip-result-table td {
    height: 40px;
  }

  .sip-chart-wrap {
    height: 240px;
  }

  .fire-chart {
    height: 280px;
  }
}

.fire-chart {
  height: 280px;
}

tr.fire-focus td,
tr.fire-focus td.locked-value,
tr.fire-focus td.sip-today-cell {
  background: #ffd042 !important;
  color: #1c1c1c;
  font-weight: 700;
}

.sip-dot-lean { background: #2d8118; }
.sip-dot-fire { background: #034f46; }
.sip-dot-fat { background: #e0a800; }

/* ---------- expense ask chat ---------- */
.ask-dock {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 145;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  max-width: calc(100vw - 24px);
}

.ask-launcher {
  border: 1px solid #034f46;
  background: #034f46;
  color: #ffffeb;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.4px;
  padding: 8px 14px;
  cursor: pointer;
}

.ask-launcher:hover {
  background: #02362f;
}

.ask-panel {
  width: min(360px, calc(100vw - 24px));
  height: min(440px, calc(100dvh - 96px));
  display: flex;
  flex-direction: column;
  background: #ffffeb;
  border: 1px solid #034f46;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16);
}

.ask-panel[hidden] {
  display: none !important;
}

.ask-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: #034f46;
  color: #ffffeb;
  padding: 8px 8px 8px 12px;
}

.ask-head strong {
  font-size: 11px;
  letter-spacing: 0.8px;
}

.ask-close {
  border: 1px solid rgba(255, 255, 235, 0.45);
  background: transparent;
  color: #ffffeb;
  font-size: 14px;
  line-height: 1;
  padding: 2px 7px;
  cursor: pointer;
}

.ask-log {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ask-msg {
  max-width: 92%;
  padding: 8px 10px;
  font-size: 12px;
  line-height: 1.45;
  white-space: pre-wrap;
}

.ask-msg-bot {
  align-self: flex-start;
  background: #e4efd5;
  color: #1c1c1c;
}

.ask-msg-user {
  align-self: flex-end;
  background: #fff;
  box-shadow: inset 0 0 0 2px #034f46;
  color: #034f46;
  font-weight: 600;
}

.ask-form {
  display: flex;
  gap: 6px;
  padding: 8px;
  border-top: 1px solid #e7e2d5;
}

.ask-form input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: #fff;
  box-shadow: inset 0 0 0 2px #034f46;
  color: #034f46;
  font-size: 13px;
  font-weight: 600;
  padding: 8px;
  outline: none;
}

.ask-form button {
  border: 1px solid #034f46;
  background: #034f46;
  color: #ffffeb;
  font-size: 12px;
  font-weight: 700;
  padding: 8px 10px;
  cursor: pointer;
}

.ask-form button:disabled {
  opacity: 0.55;
  cursor: default;
}

body.phone-layout .ask-dock,
body.mobile-mode .ask-dock {
  display: none !important;
}

@media (max-width: 899px) {
  .ask-form input {
    font-size: 16px;
  }
}

