/* Detail-first layout: compact context, one table scrolling area. */
body.app-ui.plan-page #plan-dialog{scroll-margin-top:100px!important}
body.app-ui.plan-page #plan-dialog .plan-dialog-header{padding:10px 16px!important;min-height:48px}
body.app-ui.plan-page #plan-dialog .plan-dialog-header h2{margin:0!important;font-size:18px!important}
body.app-ui.plan-page #plan-dialog .plan-dialog-content{padding:10px 16px 12px!important;max-height:none!important;overflow:visible!important}
body.app-ui.plan-page #plan-dialog .detail-overview{display:flex;align-items:center;flex-wrap:wrap;gap:6px 18px;padding-bottom:8px;border-bottom:1px solid #e0e8f1;min-width:0}
body.app-ui.plan-page #plan-dialog .detail-context{display:block!important;flex:0 1 auto;font-size:12px!important;line-height:1.6;margin:0!important}
body.app-ui.plan-page #plan-dialog .detail-current{display:flex;align-items:baseline;justify-content:flex-end;flex:1 1 240px;flex-wrap:wrap;gap:4px 12px;padding:0!important;margin:0!important;background:transparent!important;border:0!important;border-radius:0!important;box-shadow:none!important;min-width:0}
body.app-ui.plan-page #plan-dialog .detail-issue{font-size:12px!important;line-height:1.6;margin:0!important;white-space:nowrap}
body.app-ui.plan-page #plan-dialog .detail-numbers{font-size:22px!important;line-height:1.4;margin:0!important;overflow-wrap:anywhere;max-width:100%}
body.app-ui.plan-page #plan-dialog .detail-unavailable{font-size:12px;line-height:1.6;margin:0!important}
body.app-ui.plan-page #plan-dialog .detail-metrics{display:flex!important;flex-wrap:wrap;gap:5px 22px;margin:8px 0!important}
body.app-ui.plan-page #plan-dialog .detail-metrics>div{display:flex;align-items:baseline;gap:8px;background:transparent!important;border:0!important;border-radius:0;padding:0!important;min-width:0}
body.app-ui.plan-page #plan-dialog .detail-metrics small{display:inline;font-size:11px!important;line-height:1.6}
body.app-ui.plan-page #plan-dialog .detail-metrics strong{display:inline;font-size:14px!important;line-height:1.6;margin:0!important}
body.app-ui.plan-page #plan-dialog .detail-records-heading{margin:10px 0 8px!important;font-size:16px!important;line-height:1.5}
body.app-ui.plan-page #plan-dialog .detail-cycle-scroll{max-height:clamp(320px,62dvh,720px)!important;overflow:auto!important;overscroll-behavior:contain;border-radius:8px}
body.app-ui.plan-page #plan-dialog .detail-cycle-scroll thead{z-index:1}
body.app-ui.plan-page #plan-dialog .detail-cycle-scroll th{padding:10px 12px!important;font-size:12px!important}
body.app-ui.plan-page #plan-dialog .detail-cycle-scroll td{padding:11px 12px!important;line-height:1.65}
body.app-ui.plan-page #plan-dialog .plan-dialog-content>.muted{margin:8px 0 0!important;font-size:11px!important;line-height:1.6}
@media(max-width:850px){
 body.app-ui.plan-page #plan-dialog{scroll-margin-top:72px!important}
 body.app-ui.plan-page #plan-dialog .plan-dialog-header{padding:9px 12px!important;min-height:44px}
 body.app-ui.plan-page #plan-dialog .plan-dialog-content{padding:8px 12px 10px!important}
 body.app-ui.plan-page #plan-dialog .detail-overview{gap:4px 12px}
 body.app-ui.plan-page #plan-dialog .detail-current{justify-content:flex-start;flex-basis:100%}
 body.app-ui.plan-page #plan-dialog .detail-numbers{font-size:20px!important}
 body.app-ui.plan-page #plan-dialog .detail-metrics{gap:4px 14px}
 body.app-ui.plan-page #plan-dialog .detail-cycle-scroll{max-height:54dvh!important}
 body.app-ui.plan-page:has(.plan-chat-dock[open]) #plan-dialog .detail-cycle-scroll{max-height:22dvh!important}
 body.app-ui.plan-page:has(.plan-chat-dock[open]) #plan-dialog .detail-context{display:none!important}
}

/* Expert filters follow the draw directly, without a redundant section heading. */
body.app-ui.plan-page #page-content #plans-panel{border-top:0!important;margin-top:0!important;padding-top:0!important}
body.app-ui.plan-page #page-content #plans-panel #plan-form{margin-top:0!important}
body.app-ui.plan-page:not(.precise-page) #page-content .draw-snapshot{border-bottom:0!important;padding-bottom:0!important;margin-bottom:8px!important}
/* Hidden progress must not create an empty grid row between numbers and filters. */
html body.app-ui.plan-page #page-content .draw-snapshot .draw-progress[hidden]{display:none!important}
@media(max-width:850px){
 html body.app-ui.plan-page:not(.precise-page) #page-content .draw-snapshot{row-gap:8px!important;margin-bottom:8px!important}
 html body.app-ui.plan-page:not(.precise-page) #page-content .draw-snapshot #countdown{height:24px!important;min-height:24px!important;line-height:24px!important}
}

body.app-ui.plan-page #page-content #plan-state:empty{display:none!important}

/* Clear list action; favorite belongs to the detail title bar. */
body.app-ui.plan-page #page-content .plan-view{min-width:54px!important;padding:7px 10px!important;white-space:nowrap;color:#1565c0!important;background:#edf4ff!important;border:1px solid #c9ddf7!important;font-size:14px!important;font-weight:600!important}
body.app-ui.plan-page #plan-dialog .plan-dialog-header>div:first-child{min-width:0;flex:1}
body.app-ui.plan-page #plan-dialog .plan-dialog-actions{display:flex;align-items:center;gap:8px;flex:0 0 auto}
body.app-ui.plan-page #plan-dialog #plan-detail-save{display:inline-flex;align-items:center;justify-content:center;width:40px;height:40px;min-height:40px;padding:8px;border:0;background:transparent!important;color:#1565c0!important;flex-shrink:0}
body.app-ui.plan-page #plan-dialog #plan-detail-save[hidden]{display:none!important}
body.app-ui.plan-page #plan-dialog #plan-detail-save svg{width:24px;height:24px;display:block;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
body.app-ui.plan-page #plan-dialog #plan-detail-save[aria-pressed="true"] svg{fill:currentColor}

@media(max-width:600px){
 html body.app-ui.plan-page #page-content #plans-panel>.table-wrap>table{table-layout:fixed;width:100%;min-width:0!important}
 html body.app-ui.plan-page #page-content #plans-panel table th,html body.app-ui.plan-page #page-content #plans-panel table td{padding-left:4px!important;padding-right:4px!important;min-width:0!important;white-space:normal;overflow-wrap:anywhere}
 html body.app-ui.plan-page #page-content #plans-panel table th:nth-child(1){width:24%!important}
 html body.app-ui.plan-page #page-content #plans-panel table th:nth-child(2){width:21%!important}
 html body.app-ui.plan-page #page-content #plans-panel table th:nth-child(3){width:13%!important}
 html body.app-ui.plan-page #page-content #plans-panel table th:nth-child(4){width:24%!important}
 html body.app-ui.plan-page #page-content #plans-panel table th:nth-child(5){width:18%!important}
 html body.app-ui.plan-page #page-content #plans-panel .plan-open{max-width:100%;min-width:0;padding:6px 0!important}
 html body.app-ui.plan-page #page-content #plans-panel .plan-open strong{white-space:normal;overflow-wrap:anywhere;font-size:13px}
 html body.app-ui.plan-page #page-content #plans-panel .plan-view{min-width:0!important;width:100%;padding:7px 4px!important;font-size:13px!important}
}
