.weight-dashboard{direction:rtl;max-width:1300px!important}.weight-subtitle{color:#625c50;margin:0 0 24px}.weight-summary-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:14px;margin:20px 0}.weight-stat,.weight-section,.weight-tip{border:1px solid #e6c952;background:#fff;border-radius:20px;padding:20px}.weight-stat{min-height:120px;display:flex;flex-direction:column;gap:10px}.weight-stat span{font-weight:700;color:#37332c}.weight-stat strong{font-size:1.35rem;color:#1d1c1a}.weight-stat small{color:#716b5c}.weight-section h3{margin:0 0 18px}.weight-entry{background:#fffdf4;margin-bottom:16px}.weight-entry .tracking-grid{display:grid;grid-template-columns:1fr 1fr;gap:18px}.weight-entry .primary-btn{margin-top:12px}.weight-message{color:#665314;padding-top:8px;min-height:20px}.weight-two-column{display:grid;grid-template-columns:1.4fr 1fr;gap:16px}.weight-chart svg{width:100%;height:auto;min-height:190px}.weight-chart-controls{display:flex;gap:8px;flex-wrap:wrap;margin-bottom:12px}.wt-range,.weight-link{background:#fff;border:1px solid #d8b521;border-radius:12px;padding:8px 14px;cursor:pointer;color:#28231a}.wt-range.active{background:#e8d62e;font-weight:700}.weight-table-scroll{overflow-x:auto}.wt-table{width:100%;border-collapse:collapse;text-align:right;min-width:370px}.wt-table th{background:#fff4bc}.wt-table th,.wt-table td{padding:10px 8px;border-bottom:1px solid #e9ddb0;font-size:.9rem}.weight-link{margin-top:12px}.weight-all-history{max-height:420px;overflow:auto;margin-top:10px}.weight-periods{grid-template-columns:repeat(5,minmax(0,1fr))}.weight-tip{background:#fffdf1;margin-top:16px}.weight-tip p{margin:8px 0 0;line-height:1.9}@media(max-width:850px){.weight-summary-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.weight-two-column{grid-template-columns:1fr}.weight-periods{grid-template-columns:repeat(2,minmax(0,1fr))}}@media(max-width:480px){.weight-entry .tracking-grid{grid-template-columns:1fr}.weight-stat{padding:12px}.weight-stat strong{font-size:1.1rem}}

/* V26: keep the tracking chart and history inside their cards on phones. */
.weight-dashboard,.weight-dashboard *{box-sizing:border-box}
.weight-dashboard{width:100%;min-width:0;max-width:100%;overflow-x:hidden}
.weight-two-column{grid-template-columns:minmax(0,1.4fr) minmax(0,1fr);max-width:100%;min-width:0}
.weight-two-column>.weight-section{min-width:0;max-width:100%;overflow:hidden}
.weight-chart{width:100%;min-width:0;max-width:100%;overflow:hidden}
.weight-chart svg,.weight-chart canvas{display:block;max-width:100%!important;width:100%!important;height:auto!important;min-width:0!important}
.weight-table-scroll,.weight-all-history{width:100%;min-width:0;max-width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch}
.weight-chart-controls{justify-content:center}
@media(max-width:850px){.weight-two-column{grid-template-columns:minmax(0,1fr)}}
@media(max-width:600px){
 .weight-dashboard{padding-inline:0!important}
 .weight-two-column{display:grid;grid-template-columns:minmax(0,1fr);gap:12px}
 .weight-two-column>.weight-section{width:100%;padding:14px 10px}
 .weight-chart{overflow:hidden}
 .weight-chart svg{min-height:0!important}
 .weight-table-scroll .wt-table,.weight-all-history .wt-table{width:100%;min-width:0!important;table-layout:fixed}
 .wt-table th,.wt-table td{padding:9px 3px;font-size:clamp(10px,2.65vw,13px);overflow-wrap:anywhere;word-break:normal;white-space:normal;text-align:center}
 .weight-chart-controls{gap:6px}
 .wt-range{padding:8px 10px;font-size:clamp(11px,3vw,14px)}
}

/* V27: mobile gutters separate each inner card from the dashboard frame. */
@media (max-width: 600px) {
  #screen-tracking .weight-dashboard {
    box-sizing: border-box !important;
    padding: 18px 16px 22px !important;
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: hidden;
  }
  #screen-tracking .weight-summary-grid {
    width: 100%;
    max-width: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin: 18px 0;
  }
  #screen-tracking .weight-summary-grid > .weight-stat {
    min-width: 0;
    max-width: 100%;
    padding: 15px 11px;
    border-radius: 18px;
    overflow-wrap: anywhere;
  }
  #screen-tracking .weight-section,
  #screen-tracking .weight-tip {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin-inline: 0;
    border-radius: 18px;
  }
  #screen-tracking .weight-two-column {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    gap: 14px;
  }
  #screen-tracking .weight-two-column > .weight-section {
    padding: 16px 12px;
  }
}
@media (max-width: 360px) {
  #screen-tracking .weight-dashboard { padding-inline: 12px !important; }
  #screen-tracking .weight-summary-grid { gap: 9px; }
  #screen-tracking .weight-summary-grid > .weight-stat { padding: 12px 8px; }
}

/* V36: stable column alignment for Persian weight-history table. */
#screen-tracking .wt-table {direction:rtl;table-layout:fixed;width:100%;min-width:490px;border-spacing:0}
#screen-tracking .wt-table th,#screen-tracking .wt-table td {box-sizing:border-box;text-align:center;vertical-align:middle;white-space:nowrap;font-variant-numeric:tabular-nums}
#screen-tracking .wt-table th:nth-child(1),#screen-tracking .wt-table td:nth-child(1){width:25%}
#screen-tracking .wt-table th:nth-child(2),#screen-tracking .wt-table td:nth-child(2){width:24%}
#screen-tracking .wt-table th:nth-child(3),#screen-tracking .wt-table td:nth-child(3){width:17%}
#screen-tracking .wt-table th:nth-child(4),#screen-tracking .wt-table td:nth-child(4){width:34%}

/* V68: Tracking only; no changes to other screens. */
#screen-tracking .weight-stat{border-color:#dce8df;background:linear-gradient(145deg,#fff 60%,#f7fbf8);box-shadow:0 5px 20px rgba(39,81,59,.045)}
#screen-tracking .weight-stat strong{color:#315f4c;font-variant-numeric:tabular-nums}
#screen-tracking .weight-section{border-color:#dce8df;box-shadow:0 8px 28px rgba(39,81,59,.05)}
#screen-tracking .wt-range,#screen-tracking .wt-history-range{border:1px solid #cbded2;border-radius:999px;background:#fff;color:#315f4c;padding:9px 14px;cursor:pointer;font:inherit;font-size:.85rem}
#screen-tracking .wt-range.active,#screen-tracking .wt-history-range.active{background:#426d59;color:#fff;border-color:#426d59;font-weight:700}
#screen-tracking .wt-range:focus-visible,#screen-tracking .wt-history-range:focus-visible{outline:3px solid #b3d5c1;outline-offset:2px}
#screen-tracking .wt-cycle-caption{color:#426d59;background:#f0f7f2;border-radius:12px;padding:10px 14px;margin-bottom:14px;font-weight:600}
#screen-tracking .wt-empty{padding:24px 12px;text-align:center;color:#64766b;background:#f6faf7;border-radius:12px}
#screen-tracking .wt-table th{background:#e9f4ec;color:#315f4c}
#screen-tracking .weight-periods{grid-template-columns:repeat(3,minmax(0,1fr))}
@media(max-width:760px){#screen-tracking .weight-periods{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:460px){#screen-tracking .weight-periods{grid-template-columns:1fr 1fr}#screen-tracking .wt-range,#screen-tracking .wt-history-range{padding:8px 10px;font-size:.75rem}}

/* V69: restore mustard / charcoal brand palette for tracking */
#screen-tracking .weight-stat,#screen-tracking .weight-section{border-color:#e7d470;background:#fff;box-shadow:0 6px 20px rgba(35,32,22,.045)}
#screen-tracking .weight-stat strong{color:#1b1b1b}
#screen-tracking .wt-range,#screen-tracking .wt-history-range{border-color:#d5be42;color:#242424;background:#fff}
#screen-tracking .wt-range.active,#screen-tracking .wt-history-range.active{background:#e7d928;border-color:#b8a322;color:#171717}
#screen-tracking .wt-range:focus-visible,#screen-tracking .wt-history-range:focus-visible{outline-color:#c4ad23}
#screen-tracking .wt-cycle-caption{background:#fff8d3;color:#28251a}
#screen-tracking .wt-empty{background:#fffdf2;color:#625b3d}
#screen-tracking .wt-table th{background:#f8efb8;color:#242424}
#screen-tracking .wt-table td{border-bottom-color:#efe4b4}

/* V70: desktop history table and standalone status message only. */
#screen-tracking .weight-dashboard > .weight-section:has(> #wt_message){
  display:block;position:relative;clear:both;width:100%;box-sizing:border-box;
  margin:18px 0 20px;padding:14px 18px;min-height:0;overflow:visible;
  border:1px solid #e7d470;border-radius:18px;background:#fffdf4;
}
#screen-tracking #wt_message{display:block;margin:0;padding:0;min-height:0;line-height:1.9;overflow-wrap:anywhere}
#screen-tracking .weight-two-column{clear:both;position:relative;min-width:0}
#screen-tracking .weight-two-column > .weight-section{min-width:0;box-sizing:border-box}
#screen-tracking .weight-table-scroll{max-width:100%;overflow-x:auto;direction:rtl}
@media(min-width:851px){
  #screen-tracking .wt-table{min-width:0;width:100%;table-layout:fixed}
  #screen-tracking .wt-table th,#screen-tracking .wt-table td{white-space:normal;overflow-wrap:normal;word-break:normal;padding:10px 7px;line-height:1.6}
  #screen-tracking .wt-table th:nth-child(4),#screen-tracking .wt-table td:nth-child(4){width:34%;direction:rtl;unicode-bidi:plaintext}
}

/* V73: weight tooltip on hover, focus and tap */
.weight-chart{position:relative}
.weight-chart .wt-point{cursor:pointer;outline:none}
.weight-chart .wt-point:focus{stroke:#171717;stroke-width:3}
.wt-point-tooltip{position:absolute;z-index:5;pointer-events:none;opacity:0;visibility:hidden;transform:translate(-50%,calc(-100% - 12px));background:#1b1b1b;color:#fff;border-radius:9px;padding:7px 12px;font-weight:700;font-size:13px;white-space:nowrap;box-shadow:0 3px 12px #0002;transition:opacity .12s}
.wt-point-tooltip.visible{opacity:1;visibility:visible}

.weight-chart{position:relative}
.wt-point-hit{cursor:pointer;touch-action:manipulation}

/* V75: mustard tooltip, positioned inside chart bounds on mobile and desktop. */
#wt_chart .wt-point-tooltip{transform:none;background:#eadf29;color:#171717;border-radius:16px;padding:9px 14px;direction:rtl;unicode-bidi:plaintext;text-align:center;max-width:calc(100% - 8px);box-sizing:border-box;box-shadow:none}
