/* The 470px desktop cap keeps dialogs within the mobile-width canvas. */
:root {
  --vi-window-width: min(89vw, 418px);
  --vi-window-height: 60vh;
}

@supports (height: 1dvh) {
  :root { --vi-window-height: 60dvh; }
}

:is(.modalback, .sms-modal-back, .summary-modal-back, .campaign-modal-back,
    .holiday-reminder-back, .finance-operation-popup-back, #viCloudGate) {
  inset: var(--vi-window-top, 0px) 0 auto;
  height: var(--vi-visible-height, 100%);
  padding: 0;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

:is(.modalback, .sms-modal-back, .summary-modal-back, .campaign-modal-back,
    .holiday-reminder-back, .finance-operation-popup-back, #viCloudGate)
  > :is(.modal, .summary-modal, .campaign-modal, .holiday-reminder,
        .finance-operation-popup, .vi-cloud-panel),
:is(.finance-fab-menu, .workspace-assistant, .booking-sms-toast)[class] {
  width: var(--vi-window-width);
  min-width: 0;
  max-width: none;
  height: auto;
  max-height: var(--vi-window-height);
  margin: auto;
  padding: 12px;
  overflow: hidden auto;
  overscroll-behavior: contain;
  overflow-wrap: anywhere;
  font-size: 13px;
}

:is(.finance-fab-menu, .workspace-assistant, .booking-sms-toast)[class] {
  inset: var(--vi-window-top, 0px) 0 auto;
  top: calc(var(--vi-window-top, 0px) + var(--vi-visible-half, 50vh));
  transform: translateY(-50%);
  gap: 6px;
}

:is(.modal, .summary-modal, .campaign-modal, .holiday-reminder,
    .finance-operation-popup, .vi-cloud-panel) h3 {
  font-size: 18px;
}

.finance-category-details-modal .modalhead h3 { font-size: 18px; }
:is(.modalhead, .summary-modal header, .campaign-modal header) {
  gap: 6px;
  margin-bottom: 8px;
}
.summary-modal header { padding-bottom: 6px; }
.campaign-modal[class] { gap: 10px; }
:is(.holiday-reminder, .finance-operation-popup) h3 {
  margin-bottom: 8px;
  padding-right: 28px;
}
:is(.holiday-reminder p, .finance-operation-popup .finance-popup-details) {
  margin-bottom: 9px;
}

:is(.modal, .campaign-modal, .finance-operation-popup, .vi-cloud-panel) form,
.modal .form,
.finance-operation-popup .finance-popup-edit {
  gap: 7px;
}

.finance-operation-popup .finance-popup-edit { margin-block: 8px; }
:is(.modal, .campaign-modal, .finance-operation-popup, .vi-cloud-panel) label {
  min-width: 0;
  gap: 3px;
  font-size: 11px;
}
.modal .two { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.modal .type-chooser-options { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px; }

:is(.modal, .campaign-modal, .finance-operation-popup, .vi-cloud-panel, .workspace-assistant)
  :is(input:not([type="checkbox"], [type="radio"], [type="range"], [type="color"], [type="file"]), select, textarea) {
  min-width: 0;
  max-width: 100%;
  min-height: 32px;
  padding: 5px 7px;
  font-size: 14px !important;
  scroll-margin-block: 8px;
}

@supports (-webkit-touch-callout: none) {
  /* iOS zooms the whole viewport when a smaller editable control receives focus. */
  :is(.modal, .campaign-modal, .finance-operation-popup, .vi-cloud-panel, .workspace-assistant)
    :is(input:not([type="checkbox"], [type="radio"], [type="range"], [type="color"], [type="file"]), select, textarea) {
    font-size: 16px !important;
  }
}

:is(.modal, .workspace-assistant) textarea { min-height: 46px; }

:is(.modal, .summary-modal, .campaign-modal, .holiday-reminder,
    .finance-operation-popup, .vi-cloud-panel, .workspace-assistant, .finance-fab-menu) button {
  min-height: 40px;
  min-width: 0;
  padding: 4px 7px;
  font-size: 11px;
  white-space: normal;
  overflow-wrap: anywhere;
}

:is(.modal, .campaign-modal, .summary-modal, .holiday-reminder, .workspace-assistant)
  :is(.close, .campaign-modal-close, .workspace-assistant-close, header > button) {
  min-width: 40px;
  font-size: 20px;
  flex: 0 0 auto;
}

.modal .modal-actions { gap: 4px; }
.modal .modal-actions:not(.booking-actions, .booking-action-mode) button { flex-shrink: 1; }
.modal .modal-actions button { padding-inline: 4px; }
.finance-operation-popup .finance-popup-actions,
.campaign-modal footer { gap: 5px; }
.finance-fab-menu[class] { padding: 0; animation: none; }
.finance-fab-menu[class] button { min-width: 0; justify-self: center; }
.finance-fab-menu .finance-menu-icon {
  width: 28px;
  height: 28px;
  flex-basis: 28px;
}

.workspace-assistant[class] { padding: 0; grid-template-rows: auto minmax(0, 1fr) auto; }
.workspace-assistant .workspace-assistant-head,
.workspace-assistant .workspace-assistant-compose,
.workspace-assistant .workspace-assistant-messages { padding: 7px 9px; }
.workspace-assistant .workspace-assistant-message { font-size: 12px; padding: 6px 8px; }
.workspace-assistant:focus-within { grid-template-rows: auto minmax(0, 1fr) auto; }
.booking-sms-toast[class] { padding-right: 42px; }
.booking-sms-toast strong { font-size: 14px; }
.booking-sms-toast span { font-size: 12px; }
.booking-sms-toast a { min-height: 40px; padding: 9px; }
.booking-sms-toast > button { min-width: 36px; min-height: 36px; }
#viCloudGate .vi-cloud-panel h1 { font-size: 19px; }

/* Finance quick-action menu is anchored above the bottom-right add button; it is not a dialog. */
#financeFabMenu.finance-fab-menu {
  position: fixed; inset: auto 22px 94px auto; top: auto; transform: none;
  width: max-content; min-width: 0; max-width: calc(100vw - 24px);
  height: auto; max-height: none; margin: 0; padding: 0; overflow: visible;
  display: grid; justify-items: end; gap: 6px; z-index: 1200;
}
#financeFabMenu.finance-fab-menu button { white-space: nowrap; }
.modal .two > label { min-width: 0; max-width: 100%; }
.modal .two > label > :is(input, select, textarea) {
  box-sizing: border-box; width: 100%; min-width: 0; max-width: 100%;
}
.finance-list-controls { display:flex; gap:6px; flex-wrap:nowrap; min-width:0; }
.finance-list-controls .addmini { flex:1 1 0; min-width:0; padding:6px 5px; white-space:nowrap; font-size:clamp(10px,2.8vw,13px); }
.finance-line-items { display:grid; gap:5px; }
.finance-line-items[hidden] { display:none; }
.finance-line-item-edit { display:grid; grid-template-columns:minmax(0,1fr) minmax(78px,.48fr) 32px; align-items:center; gap:5px; min-width:0; }
.finance-line-item-edit input { box-sizing:border-box; min-width:0; width:100%; }
.finance-line-item-remove { min-width:30px!important; padding:2px!important; }
.finance-line-items-add { width:100%; min-height:32px!important; }
.finance-line-items-view { grid-column:1/-1; display:grid; gap:3px; padding:0 4px 4px; }
.finance-line-item-view { display:grid; grid-template-columns:minmax(0,1fr) auto auto; align-items:center; gap:5px; min-width:0; padding:4px 0; border-top:1px solid #e8e2dd; font-size:clamp(9px,2.7vw,12px); }
.finance-line-item-view > span:first-child { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.finance-line-item-view button { white-space:nowrap; min-height:25px!important; padding:3px 5px!important; }
.finance-operation-card.has-finance-lines { grid-template-rows:auto auto; }
@media(max-width:600px) { #financeFabMenu.finance-fab-menu { right:12px; bottom:86px; } }


/* SMS editor: let the message occupy the full card width. */
.sms-template.sms-template-editor { display: block; min-width: 0; }
.sms-template.sms-template-editor > div { width: 100%; min-width: 0; }
.sms-template.sms-template-editor .sms-template-text { box-sizing: border-box; width: 100%; max-width: none; }

/* Holiday cards keep their existing content and palette in a denser layout. */
.sms-template.holiday-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(82px, 104px);
  align-items: center;
  gap: 8px;
  min-width: 0;
  margin: 7px 0;
  padding: 9px 10px;
  border-radius: 9px;
  background: #fff;
}
.sms-template.holiday-card > div { min-width: 0; }
.sms-template.holiday-card h3 { margin: 0 0 3px; font-size: clamp(13px, 3.5vw, 15px); line-height: 1.25; }
.sms-template.holiday-card p { margin: 3px 0; font-size: clamp(11px, 3vw, 12px); line-height: 1.35; overflow-wrap: anywhere; }
.sms-template.holiday-card input[data-holiday-days] { box-sizing: border-box; max-width: 52px; padding: 3px 4px; font-size: 12px; }
.sms-template.holiday-card > button { box-sizing: border-box; min-width: 0; width: 100%; padding: 7px 6px; font-size: 11px; line-height: 1.25; overflow-wrap: anywhere; }
.sms-template.holiday-card.holiday-selected { border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); background: #fcf8f6; }
@media (max-width: 360px) {
  .sms-template.holiday-card { grid-template-columns: minmax(0, 1fr) 88px; gap: 6px; padding: 8px; }
  .sms-template.holiday-card > button { padding: 6px 4px; font-size: 10px; }
}

/* Keep recipient names readable in the horizontally scrollable SMS tables. */
.table-scroll:has(.sms-recipient-table) { max-width: 100%; overflow-x: auto; }
.sms-recipient-table { min-width: 620px; }
.sms-recipient-table .sms-client-name {
  min-width: 150px;
  color: var(--ink) !important;
  font-weight: 500;
  white-space: normal;
  overflow-wrap: anywhere;
}

/* Inline paid-operation details within the existing budget editor. */
.finance-budget-paid-entries { display:grid; gap:6px; padding-top:8px; border-top:1px solid var(--line,#e7e1dc); }
.finance-budget-paid-entries h4 { margin:0; font-size:13px; }
.finance-budget-paid-list { display:grid; gap:4px; max-height:180px; overflow:auto; overscroll-behavior:contain; }
.finance-budget-paid-entry { display:flex; align-items:center; justify-content:space-between; gap:8px; width:100%; text-align:left; border:1px solid var(--line,#e7e1dc); border-radius:8px; background:transparent; color:inherit; }
.finance-budget-paid-entry > span { display:grid; min-width:0; }
.finance-budget-paid-entry small { color:var(--muted,#8b827b); }
.finance-subcategory-template-line { grid-template-columns:minmax(0,1fr) minmax(68px,.55fr) 30px 30px 30px; }
.finance-subcategory-template-line [data-template-up],.finance-subcategory-template-line [data-template-down] { min-height:30px!important; padding:2px!important; }

/* Business reserves */
.business-reserves summary{cursor:pointer;list-style:none}
.business-reserves summary::-webkit-details-marker{display:none}
.business-reserves>.account-section-head{display:grid;grid-template-columns:minmax(0,1fr) auto 12px;gap:10px;padding:13px 10px 13px 19px;background:#efebf6;color:var(--text);border-bottom:0}
.business-reserves>.account-section-head h3{font-family:inherit;font-size:13px;font-weight:600}
.business-reserves strong{font-weight:600}
.business-reserve-inner{padding:0 8px;font-size:13px}
.business-reserve-inner>details+details,.business-reserve-total{border-top:1px solid var(--line)}
.business-reserve-inner>details>summary{display:grid;grid-template-columns:14px minmax(0,1fr) auto 12px;align-items:start;gap:8px;padding:10px 0 18px}
.business-reserve-inner>details+details>summary{padding-top:19px}
.business-reserve-icon{color:#9976b3;line-height:1}
.business-reserve-icon svg{width:13px;height:13px}
.business-reserve-label{display:grid;gap:5px}
.business-reserve-label small,.business-reserve-student small{color:var(--muted);font-size:12px}
.business-reserve-chevron{align-self:start;justify-self:center;width:6px;height:6px;margin-top:4px;border-right:1px solid currentColor;border-bottom:1px solid currentColor;transform:rotate(45deg)}
.business-reserves details[open]>summary>.business-reserve-chevron,.business-reserves[open]>summary>.business-reserve-chevron{transform:rotate(225deg);margin-top:7px}
.business-reserve-list{display:grid;gap:6px;padding-bottom:18px}
.business-reserve-student{display:grid;gap:4px;width:100%;padding:8px;border:0;border-radius:8px;background:#f5f2f8;color:inherit;text-align:left;font:inherit;cursor:pointer}
.business-reserve-student-head{display:grid;grid-template-columns:minmax(0,1fr) auto 10px;gap:8px;align-items:start}
.business-reserve-student-head strong{overflow-wrap:anywhere}
.business-reserve-student-head .business-reserve-chevron{transform:rotate(-45deg)}
.business-reserve-student progress{appearance:none;width:100%;height:5px;margin:3px 0 0;border:0;border-radius:9px;background:#e2d9ed;overflow:hidden;color:#9f83bc}
.business-reserve-student progress::-webkit-progress-bar{background:#e2d9ed}
.business-reserve-student progress::-webkit-progress-value{background:#9f83bc}
.business-reserve-student progress::-moz-progress-bar{background:#9f83bc}
.business-reserve-total{display:flex;justify-content:space-between;gap:8px;padding:18px 0 10px}
.business-reserve-total span{color:var(--muted)}
.business-reserves summary>strong,.business-reserve-student-head>span,.business-reserve-total>strong{white-space:nowrap}
.business-reserve-transfer:not([hidden]){display:grid;gap:9px;grid-column:1/-1}
.business-reserve-dialog>.modal{width:min(89vw,420px);max-height:70dvh;display:flex;flex-direction:column}
.business-reserve-modal-body{overflow:auto;min-height:0}
.business-reserve-modal-body p,.business-reserve-history small{margin:4px 0;color:var(--muted)}
.business-reserve-modal-body dl>div,.business-reserve-history{padding:7px 0;border-bottom:1px solid var(--line)}
.business-reserve-modal-body dl>div{display:flex;justify-content:space-between;gap:8px}
.business-reserve-modal-body dd{margin:0;white-space:nowrap;font-weight:600}
.business-reserve-history{display:grid;overflow-wrap:anywhere}

.business-reserves[data-reserve-empty="true"] .business-reserve-inner summary>i{grid-column:-2;grid-row:2;justify-self:start;margin-left:3px}
.business-reserves[data-reserve-empty="true"] .business-reserve-inner>details>summary{grid-template-columns:14px minmax(0,1fr) auto;grid-template-rows:auto 10px;row-gap:0;min-height:68px}
.business-reserves[data-reserve-empty="true"] .business-reserve-total{min-height:51px;align-items:center;padding:13px 0}

.card-payment-group{border:1px solid var(--line);border-radius:9px;background:#efebf6;overflow:hidden}
.card-payment-group-project{background:#faf9f7}
.card-payment-group summary{list-style:none;display:grid;grid-template-columns:minmax(0,1fr) auto 10px;gap:8px;padding:9px;cursor:pointer}
.card-payment-group summary::-webkit-details-marker{display:none}
.card-payment-group summary>span{display:grid;gap:4px;min-width:0}
.card-payment-group summary>span:nth-child(2){text-align:right;white-space:nowrap}
.card-payment-group summary>span:nth-child(2)>strong{color:#627c5a}
.card-payment-group summary strong{font-size:13px}
.card-payment-group summary small{font-size:12px;color:var(--muted)}
.card-payment-group[open] summary i{transform:rotate(225deg);margin-top:7px}
.card-payment-detail{display:grid;gap:6px;padding:9px;border-top:1px solid var(--line)}
.card-payment-detail>div{display:flex;justify-content:space-between;gap:8px}
.card-payment-detail b{white-space:nowrap}
.card-payment-detail button{justify-self:end}
.card-payment-group-project summary:has(button){grid-template-columns:minmax(0,1fr) auto auto;align-items:center}
.card-payment-group-project summary button{white-space:nowrap}

.calendar-payment-reminders{display:grid;gap:8px;margin:8px 0 12px}
.calendar-payment-reminder{display:grid;gap:6px;width:100%;min-width:0;padding:8px;border:0;border-radius:8px;background:#efebf6;text-align:left;color:#1c2024;cursor:pointer;font-family:inherit;font-size:13px;line-height:1.3}
.calendar-payment-reminder.is-overdue{background:#f7ece8}
.calendar-reminder-status{display:flex;align-items:center;gap:8px;margin-bottom:9px;color:#76529d;font-weight:550}
.calendar-payment-reminder.is-overdue .calendar-reminder-status{color:#a8655b}
.calendar-reminder-status svg{width:13px;height:13px;flex:none}
.calendar-reminder-status i{width:6px;height:6px;border-top:1px solid #1c2024;border-right:1px solid #1c2024;transform:rotate(45deg);margin-left:auto;margin-right:4px;flex:none}
.calendar-reminder-person{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:start;gap:8px}
.calendar-reminder-person strong{font-weight:550;overflow-wrap:anywhere}
.calendar-reminder-person b{white-space:nowrap;font-weight:650}
.calendar-reminder-context,.calendar-reminder-date{color:#65636a;overflow-wrap:anywhere}
.calendar-reminder-date{margin-top:3px}
.course-payment-spotlight{animation:course-payment-spotlight 4s ease-out}
@keyframes course-payment-spotlight{0%,73%{background:#efebf6}100%{background:revert-layer}}
@media(prefers-reduced-motion:reduce){.course-payment-spotlight{animation-timing-function:steps(1,end)}}

/* Two equal-width calendar action rows. */
#workspace .legend {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 6px;
  padding: 0;
  overflow: visible;
}
#workspace .legend .typebtn {
  grid-column: span 2;
  min-width: 0;
  min-height: 34px;
  padding: 6px 3px;
  justify-content: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}
#workspace .legend .typebtn:nth-child(n+4) { grid-column: span 3; }
#workspace .legend .type-emoji { flex: 0 0 auto; width: auto; font-size: 13px; }
#workspace .legend .evt-client,
#workspace .legend .evt-student {
  border: 1px solid color-mix(in srgb, var(--event-color) 24%, white);
  background: color-mix(in srgb, var(--event-color) 12%, white);
  color: var(--event-color);
}
#workspace .legend .evt-student { background: #eee6f7; }
#workspace .legend .typebtn:hover { border-color: var(--event-color); }
#workspace .month-event.evt-student,
#workspace .event.evt-student,
#workspace .allday-event.evt-student {
  background: #e9dff4;
  border-left: 3px solid var(--event-color);
  color: var(--event-color);
}
#workspace .event.evt-student[role="button"] { cursor: pointer; }
#studentBookingDialog {
  width: min(88%, 400px);
  max-height: 70dvh;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--ink, #252221);
  background: white;
}
#studentBookingDialog::backdrop { background: rgb(24 20 18 / 45%); }
#studentBookingDialog p { margin: 10px 0 0; }
#workspace:has(.legend) .cal-title,
#workspace:has(.legend) .day-head strong {
  font-family: inherit;
  font-weight: 650;
}

#bookingActionDialog {
  width: min(89%, 420px);
  max-height: 70dvh;
  border-radius: 15px;
  background: #fff;
  color: #202020;
}
#bookingActionDialog .modalhead { padding-bottom: 11px; border-bottom: 1px solid #eae8e5; margin-bottom: 12px; }
#bookingActionDialog h3 { font: 700 25px/1.15 -apple-system,BlinkMacSystemFont,sans-serif; }
#bookingFields:not([hidden]), #bookingFields .booking-panel,
#projectRows, #bookingProjectDetails:not([hidden]), #bookingBillable:not([hidden]) { display: grid; gap: 9px; }
#bookingFields [hidden], #bookingActionDialog [hidden] { display: none !important; }
#bookingFields .booking-panel { padding: 10px; border: 1px solid #efeeeb; background: #f7f6f4; border-radius: 10px; }
#bookingDateAnchor { display: none; }
#bookingFields h4 { margin: 0; font: 700 21px/1.2 -apple-system,BlinkMacSystemFont,sans-serif; }
#bookingActionDialog input { width: 100%; min-width: 0; min-height: 32px; padding: 5px 9px; border-radius: 8px; background: #fff; color: #202020; }
#bookingActionDialog .two { grid-template-columns: repeat(2,minmax(0,1fr)); align-items: end; gap: 10px; }
.booking-pair { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; font-size: 13px; }
.booking-pair > span { color: #686866; }
#bookingProjectDetails progress { width: 100%; height: 7px; appearance: none; }
#bookingProjectDetails progress::-webkit-progress-bar { background: #e8e6df; border-radius: 10px; }
#bookingProjectDetails progress::-webkit-progress-value { background: #8ca082; border-radius: 10px; }
.booking-payment-part { display: grid; gap: 7px; border-top: 1px solid #e3e0dc; padding-top: 10px; }
.client-booking-editor .pay-toggle { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 5px; }
.client-booking-editor .pay-option input { position: absolute; opacity: 0; }
.client-booking-editor .pay-option:has(input:focus-visible) { outline: 2px solid #8056a5; }
.booking-included { display: grid; gap: 6px; background: #efede5; padding: 10px; border-radius: 8px; }
#bookingWholePayment .booking-included { margin-top: 7px; background: #eeefe6; display: block; }
#bookingPhotoList { display: flex; gap: 7px; flex-wrap: wrap; }
#bookingPhotoList figure { position: relative; margin: 0; }
#bookingPhotoList img, .booking-photo-add { width: 80px; height: 80px; object-fit: cover; border-radius: 8px; }
#bookingPhotoList button { position: absolute; right: 2px; top: 2px; border-radius: 50%; }
.client-booking-editor .booking-photo-add { display: grid; place-content: center; text-align: center; cursor: pointer; position: relative; border: 1px solid #eeece8; margin: 6px 0; }
#bookingPhotoInput { display: none !important; }
.documents-file-drop input[type=file],
.student-case-modal .person-photo-picker input[type=file] {
  pointer-events: none;
}
.documents-file-drop:focus-within,
.student-case-modal .person-photo-picker:focus-within {
  outline: 2px solid var(--accent, #8056a5);
  outline-offset: 2px;
}
.client-booking-editor .booking-actions #repeatBookingBtn { display: none !important; }
#bookingActionDialog .savebtn { background: #242322; color: white; }
#bookingActionDialog { padding: 14px; border: 1px solid #eae8e5; }
#bookingActionDialog::backdrop { background: #201a1666; }
.booking-session-photo { width: 48px; height: 48px; object-fit: cover; border-radius: 6px; }

.documents-page .documents-archive-list li {
  grid-template-columns: 36px minmax(0, 1fr) auto;
  gap: 7px 10px;
}
.documents-page .documents-archive-list li > button {
  overflow-wrap: anywhere;
}
.documents-page .documents-archive-list .document-archive-status {
  grid-column: 1 / -1;
  justify-self: start;
  white-space: normal;
}
.document-row-actions {
  display: flex;
  align-items: center;
  gap: 5px;
}
.document-row-action {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: white;
  color: var(--ink);
}
.document-row-action svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.document-row-remove { color: #a33636; }
.document-remove-dialog {
  width: min(340px, calc(100% - 32px));
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px;
  color: var(--ink);
}
.document-remove-dialog::backdrop { background: #201c1a66; }
.document-remove-dialog form > div, .document-trash > div {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
}
.document-remove-dialog button, .document-trash button {
  padding: 8px 10px;
}
@media (max-width: 700px) {
  .documents-page [data-document-panel="signed"] .documents-archive-list li {
    grid-template-columns: 32px minmax(0, 1fr) auto;
    gap: 7px;
  }
}

#modalback:is(.student-booking-editor, .client-booking-editor) > .modal,
.modalback.project-editor.stage4-editor > .modal {
  display: flex;
  flex-direction: column;
  width: min(calc(100% - 24px), 420px);
  max-height: min(800px, calc(100dvh - 24px));
  padding: 14px;
  overflow: hidden;
}
:is(.student-booking-editor, .client-booking-editor) .modalhead,
.modalback.project-editor.stage4-editor .modalhead { flex: none; margin: 0; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
:is(.student-booking-editor, .client-booking-editor) .modalhead h3,
.modalback.project-editor.stage4-editor .modalhead h3 { font: 700 clamp(19px, 5vw, 25px)/1.15 system-ui, sans-serif; }
:is(.student-booking-editor, .client-booking-editor) #eventForm { display: block; overflow: hidden auto; min-height: 0; padding-top: 10px; }
:is(.student-booking-editor, .client-booking-editor) #eventForm > :is(.two, label, fieldset, #studentBookingStatus) { margin-bottom: 10px; }
:is(.student-booking-editor, .client-booking-editor) .two { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.student-booking-editor .two:has([name=date]) { grid-template-columns: minmax(0, 1fr); }
:is(.student-booking-editor, .client-booking-editor) :is(label, input, select, textarea) { min-width: 0; }
:is(.student-booking-editor, .client-booking-editor) :is(input:not([type=radio]), select, textarea) { width: 100%; min-height: 40px; font-size: 16px; border-radius: 12px; }
.student-booking-editor #studentBookingFields { padding: 0; border: 0; min-inline-size: 0; }
.student-booking-editor :is(#studentBookingFields, #studentBookingCourse, #studentBookingService, #studentBookingStatus):not([hidden]) { display: grid; gap: 10px; }
.student-booking-editor [hidden] { display: none !important; }
.student-booking-mode > span { color: var(--muted); font-size: 13px; }
.student-booking-mode .pay-toggle { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.student-booking-mode .pay-option,
.client-booking-editor .pay-toggle .pay-option { justify-content: center; position: relative; min-height: 40px; padding-inline: 4px; font-size: 12px; }
.student-booking-mode .pay-option:has(input:focus-visible) { outline: 2px solid #8056a5; }
.student-booking-progress { padding: 8px; border-radius: 10px; background: #eee8f4; }
.student-booking-progress label { display: flex; justify-content: space-between; }
.student-booking-progress progress { width: 100%; height: 8px; accent-color: #8056a5; }
#studentCoursePaymentHint { margin: 0; padding: 8px; background: #eef3eb; border-radius: 8px; }
#studentBookingError { margin: 0; color: #a33d32; }
:is(.student-booking-editor, .client-booking-editor) #noteWrap textarea { min-height: 68px; }
:is(.student-booking-editor, .client-booking-editor) .modal-actions { position: sticky; bottom: 0; display: flex; gap: 6px; background: var(--paper); border-top: 1px solid var(--line); padding: 8px 0 0; z-index: 4; }
:is(.student-booking-editor, .client-booking-editor) .modal-actions button,
.modalback.project-editor.stage4-editor .modal-actions button { min-height: 40px; padding: 6px 8px; font-size: 12px; }
:is(.student-booking-editor, .client-booking-editor) .modal-actions .savebtn { flex: 1; }

.client-booking-editor #bookingFields:not([hidden]),
.client-booking-editor #bookingFields .booking-panel,
.client-booking-editor #projectRows,
.client-booking-editor #bookingProjectDetails:not([hidden]),
.client-booking-editor #bookingBillable:not([hidden]) { gap: 10px; }
.client-booking-editor #bookingFields #bookingProjects { padding: 8px; background: #eee8f4; border-color: transparent; }
.client-booking-editor #bookingProjectDetails progress::-webkit-progress-bar { background: #ded4e8; }
.client-booking-editor #bookingProjectDetails progress::-webkit-progress-value { background: #8056a5; }
.client-booking-editor .modal-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.client-booking-editor .modal-actions #saveEventBtn { grid-column: 1 / -1; width: 100%; }

.client-booking-editor .booking-service-picker { min-width: 0; position: relative; }

.reserve-expense-dialog { z-index: 1500; }
.reserve-expense-dialog > .modal { width: min(calc(100% - 24px), 420px); max-height: min(800px, calc(100dvh - 24px)); overflow: hidden; }
.reserve-expense-dialog .modalhead { flex: none; }
.reserve-expense-card { display: grid; gap: 8px; min-width: 0; padding: 10px; margin: 8px 0; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); }
.reserve-expense-card .stage4-line { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.reserve-expense-card .two { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.reserve-expense-card :is(input, select) { width: 100%; min-width: 0; min-height: 40px; border-radius: 12px; }
.reserve-expense-card progress { width: 100%; height: 8px; accent-color: #8056a5; }
.reserve-expense-card .savebtn { width: 100%; }
.reserve-expense-preview { display: grid; gap: 5px; padding: 8px; border-radius: 10px; background: #eee8f4; }
.reserve-expense-card :is([data-reserve-error], [data-reserve-overage]) { color: #a33d32; }

:is(.student-booking-editor, .client-booking-editor) .modal-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
:is(.student-booking-editor, .client-booking-editor) .modal-actions #saveEventBtn { grid-column: 1 / -1; width: 100%; }
#studentWorkplaceFields:not([hidden]) { display: grid; gap: 8px; padding: 8px; border-radius: 10px; background: #eee8f4; }
.calendar-habits:has(+ .month-grid) { margin: 0 0 10px; }
.workspace-input-choices { position: fixed; z-index: 2400; max-height: 180px; overflow: auto; border: 1px solid var(--line); border-radius: 10px; padding: 3px; background: #fff; box-shadow: 0 7px 20px #0002; }
.workspace-input-choices button { display: block; width: 100%; padding: 7px 9px; text-align: left; border: 0; border-radius: 7px; background: transparent; color: var(--ink); }
.workspace-input-choices button:is(:hover,[aria-selected=true]) { background: #efeeeb; }
.student-booking-editor .booking-photos { margin-bottom: 10px; }
.student-booking-editor .booking-photo-add { width: 80px; height: 80px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); }
.unpaid-booking-section .finance-row {
  background: color-mix(in srgb, var(--pending-booking-color) 9%, white);
  border-color: color-mix(in srgb, var(--pending-booking-color) 32%, var(--line));
  border-inline-start: 3px solid var(--pending-booking-color);
}
.unpaid-booking-section .calendar-booking-actions { display: grid; gap: 5px; min-width: 0; }
.unpaid-booking-section .calendar-booking-actions > .addmini { min-height: 36px; white-space: normal; }

.calendar-summary > h2 { margin: 0 0 8px; font: 700 22px/1.2 system-ui, sans-serif; }
.calendar-summary > p { margin: 0 0 12px; color: var(--muted); font-size: 12px; }
.calendar-summary .summary-month-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; margin: 0 0 10px; }
.calendar-summary :is(.summary-month-card, .summary-year) { min-width: 0; padding: 8px; font-family: system-ui, sans-serif; }
.calendar-summary .summary-year { padding-inline: 0; border-inline: 0; }
.calendar-summary :is(.summary-month-card, .summary-year) h3 { margin: 0 0 8px; font: 650 13px/1.3 system-ui, sans-serif; }
.calendar-summary .summary-count { min-width: 0; gap: 3px; padding: 6px; border: 0; border-radius: 8px; background: #f4f2f1; color: var(--ink); font: inherit; font-size: 11px; min-height: 36px; }
.calendar-summary .summary-count strong { font-size: 19px; }
.calendar-summary .summary-stat-pair { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 4px; margin-top: 5px; }
.calendar-summary .summary-metric { min-width: 0; min-height: 36px; padding: 4px 3px; text-align: left; border: 1px solid var(--line); border-radius: 7px; background: #fff; color: var(--muted); font: inherit; font-size: 11px; }
.calendar-summary .summary-metric strong { display: block; color: var(--ink); font-size: 12px; margin-top: 2px; }
.calendar-summary .summary-training { margin-top: 6px; padding: 5px; border-radius: 8px; background: #eee8f4; }
.calendar-summary .summary-training .summary-count { background: transparent; padding-inline: 2px; }
.calendar-summary .summary-training .summary-count + .summary-count { border-radius: 0; border-top: 1px solid #dbd2e3; }
.calendar-summary .summary-training .summary-count + .summary-count strong { font-size: 13px; }
.calendar-summary .summary-month-card dl { margin: 9px 0 0; padding-top: 8px; border-top: 1px solid var(--line); gap: 7px; font-size: 11px; }
.calendar-summary .summary-month-card dl > div { display: grid; gap: 2px; }
.calendar-summary .summary-month-card dd { overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.calendar-summary .summary-received { color: #287856; }
.calendar-summary .summary-year table { width: 100%; table-layout: fixed; border-collapse: collapse; font-size: 12px; font-variant-numeric: tabular-nums; }
.calendar-summary .summary-year :is(td, th) { padding: 6px 2px; text-align: right; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.calendar-summary .summary-year :is(td, th):first-child { width: 28%; text-align: left; text-transform: capitalize; }
.calendar-summary .summary-year th { font-weight: 500; }
.calendar-summary .summary-year thead th { color: var(--muted); }
.calendar-summary .summary-year tbody td:nth-child(3) { color: #8056a5; }
.calendar-summary .summary-year-total { margin-top: 8px; padding: 8px; border: 0; border-radius: 8px; display: flex; align-items: baseline; justify-content: space-between; gap: 6px; background: #eee8f4; font-size: 12px; }
.calendar-summary .summary-year-total strong { font-size: 17px; text-align: right; overflow-wrap: anywhere; }
.summary-modal-back .summary-modal { display: flex; flex-direction: column; width: min(100%, 390px); max-height: 75dvh; overflow: hidden; }
.summary-modal-back .summary-modal > header { flex: none; }
.summary-modal-back .summary-booking-list { overflow-y: auto; min-height: 0; display: grid; gap: 5px; }
.summary-modal-back .summary-booking-list button { width: 100%; text-align: left; }
.calendar-summary .summary-month-card h3,
.calendar-summary .summary-year h3 { text-transform: none; }
.calendar-summary .summary-month-card h3::first-letter { text-transform: uppercase; }

/* The project editor already separates its scrolling body from its footer. */
.modalback.project-editor.stage4-editor > .modal {
  width: min(calc(100% - 24px), 420px) !important;
  max-height: min(800px, calc(var(--vi-visible-height, 100dvh) - 24px)) !important;
}
.modalback.project-editor.stage4-editor .modalhead h3 { letter-spacing: normal; }
.project-editor.stage4-editor .form {
  flex: 1 1 auto;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 0;
}
.project-editor.stage4-editor .stage4-editor-body { gap: 10px; padding-top: 10px; }
.project-editor.stage4-editor .form label { font-size: 11px; }
.project-editor.stage4-editor .form :is(input:not([type=radio], [type=checkbox], [type=file], [type=hidden]), select, textarea) {
  min-height: 40px;
  font-size: 16px;
  border-radius: 12px;
}
.project-editor.stage4-editor .form textarea { min-height: 68px; }
.project-editor.stage4-editor .modal-actions {
  position: static;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  padding: 8px 0 0;
  background: var(--paper);
  border-top: 1px solid var(--line);
}
.project-editor.stage4-editor .modal-actions button { border-radius: 8px; }
.project-editor.stage4-editor .modal-actions .savebtn { background: var(--ink); }
.project-editor.stage4-editor .project-add-client { min-height: 40px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); color: var(--ink); font: inherit; font-weight: 600; }
.project-editor.stage4-editor .project-add-client:hover { background: #f4f2f1; }
.project-editor .form:has([data-project-whole]:not([hidden])) .project-planned-cost { display: none; }

/* Finance cards and analytics */
#workspace :is(.finance-operation-card, .finance-income-operation-card, .combined-operation-row, .finance-client-income-card) {
  font-size: 14px;
}
#workspace :is(.finance-operation-title, .finance-income-operation-title, .expense-row .expense-name, .finance-client-operation-details b) {
  font-size: 15px;
}
#workspace :is(.finance-operation-amount, .combined-operation-row > strong, .finance-client-income-card strong) {
  font-size: 14px;
}
#workspace .vi-analytics { gap: 12px; font-size: 14px; }
#workspace .vi-analytics .vi-analytics-panel { padding: 12px; border: 1px solid var(--line); border-radius: 12px; }
#workspace .vi-analytics h3 { font-weight: 600; line-height: 1.3; font-family: inherit; font-size: 16px; }
#workspace .vi-analytics :is(.vi-analytics-periods, .vi-analytics-controls, .vi-analytics-quarter-links) :is(button, select, input) {
  min-height: 34px;
  border-radius: 10px;
  font-family: inherit;
  font-size: 13px;
}
#workspace .vi-analytics .vi-analytics-chart svg { display: block; width: 100%; height: auto; }
#workspace .vi-analytics :is(.vi-analytics-muted, .vi-analytics-entry) { font-size: 12px; }

/* Directories use the existing education list scale. */
#workspace :is(.education-service-row, .service-row td, .documents-template-copy strong, .documents-history strong) {
  font-size: 15px;
}
#workspace .service-row td { padding-block: 10px; }
#workspace :is(.service-row small, .documents-template-copy small, .documents-history small, .documents-note) {
  font-size: 12px;
}
#workspace .manage-table:has(.service-row) { width: 100%; }
#workspace .manage-table:has(.service-row) :is(th, td) { overflow-wrap: anywhere; }
#workspace .service-row td:nth-child(2) { font-variant-numeric: tabular-nums; }
#workspace .sms-template-editor .sms-template-text {
  width: 100%;
  min-height: 112px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  font: inherit;
  line-height: 1.5;
  resize: vertical;
}
#workspace .documents-page .documents-tabs { gap: 5px; margin: 14px 0; overflow: visible; }
#workspace .documents-page .documents-tabs button {
  flex: 1 1 0;
  justify-content: center;
  min-width: 0;
  min-height: 36px;
  padding: 6px;
  gap: 4px;
  border-radius: 999px;
}
#workspace .documents-page :is(.documents-card, .documents-template-card) { border-color: var(--line); border-radius: 12px; }
#workspace .documents-page :is(.documents-panel-heading, .documents-category-heading) { font-size: 15px; }
#workspace .campaign-table td { font-size: 14px; }
#workspace .campaign-table .campaign-name-button { font-size: 15px; }
#workspace .campaign-table .campaign-count { font-size: 12px; }

/* Calendar summary follows the calendar scale while retaining two columns. */
.calendar-summary > h2 { font-weight: 700; line-height: 1.2; font-family: inherit; font-size: 22px; }
.calendar-summary :is(.summary-month-card, .summary-year) { font-family: inherit; }
.calendar-summary :is(.summary-month-card, .summary-year) h3 { font-weight: 600; line-height: 1.3; font-family: inherit; font-size: 15px; }
.calendar-summary .summary-count { font-size: 13px; }
.calendar-summary .summary-metric { font-size: clamp(10px, 3.25vw, 13px); overflow-wrap: anywhere; }
.calendar-summary .summary-metric strong { font-size: 15px; }
.calendar-summary .summary-month-card dl { font-size: 12px; }
.calendar-summary .summary-month-card dd { font-size: 15px; }
.calendar-summary .summary-year table { font-size: 13px; }
.calendar-summary .summary-year thead { font-size: 12px; }
.calendar-summary .summary-year-total { font-size: 14px; }

.studio-event-editor :is(#bookingFields, #eventTaskPriceWrap) { display: none !important; }

#workspace .documents-page { width: 100%; min-width: 0; }
#workspace .documents-page :is(.documents-card, .documents-heading, .documents-tabs) { min-width: 0; }
@media (max-width: 360px) {
  #workspace .documents-page .documents-tabs button { font-size: 12px !important; padding-inline: 3px; }
}
#workspace .documents-page .documents-form { grid-template-columns: minmax(0, 1fr); min-width: 0; }
#workspace .documents-page .documents-form > * { min-width: 0; }
#workspace .documents-page :is(.document-paper-editor, .documents-selected-template, .documents-signatures) { overflow-wrap: anywhere; }
#workspace .documents-page .document-editor-toolbar { flex-wrap: wrap; }

.calendar-habit-row > label { display: flex; align-items: center; flex: none; }
.calendar-habit-row > button { flex: none; }

#workspace .course-payment-editor-link {
  width: 100%;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  text-align: left;
  color: inherit;
}
.course-payment-editor-link small { display: block; }
.course-payment-editor-link > span:last-child { text-align: right; }
#workspace .course-payment-editor-link[hidden] { display: none; }

.saving-goal-card > summary { display: grid; gap: 6px; cursor: pointer; list-style: none; }
.saving-goal-card > summary::-webkit-details-marker { display: none; }
.saving-goal-head > span { display: inline-flex; align-items: center; gap: 8px; }
.saving-goal-card[open] > summary .business-reserve-chevron { transform: rotate(225deg); }
.saving-goal-card[open] > .saving-goal-meta { margin-block: 8px; }

.habit-month-open {
  flex: 1;
  min-width: 0;
  padding: 5px 0;
  border: 0;
  background: none;
  color: inherit;
  text-align: left;
  overflow-wrap: anywhere;
}
.habit-month-dialog {
  width: min(calc(100% - 24px), 390px);
  max-height: calc(100dvh - 24px);
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--paper, white);
  color: var(--ink);
}
.habit-month-dialog::backdrop { background: #1c191766; }
.habit-month-dialog :is(header, .habit-month-nav) {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.habit-month-dialog h3 { margin: 0; font-size: 17px; overflow-wrap: anywhere; }
.habit-month-nav strong { text-transform: capitalize; }
.habit-month-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; text-align: center; }
.habit-month-grid small { color: var(--muted); }
.habit-month-grid button {
  min-width: 0;
  min-height: 32px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper, white);
  color: inherit;
}
.habit-month-grid button:disabled { opacity: .5; }
.habit-month-grid button[aria-pressed="true"] { background: #e2efe4; border-color: #afccb3; color: #245d39; font-weight: 700; }
.habit-month-totals { display: grid; gap: 3px; margin-top: 12px; }
.habit-month-totals small { color: var(--muted); }

#workspace .finance-operation-course { font-family: inherit; }
#workspace .finance-operation-course small { color: var(--muted); font-size: 10px; line-height: 1.05; }
#workspace .finance-operation-course .finance-operation-main small { display: block; }
#workspace .finance-operation-course .finance-operation-actions { min-height: 28px; align-items: center; }
#workspace :is([data-operation-search], [data-operation-search-empty])[hidden] { display: none !important; }

.document-template-body { display: grid; gap: 6px; min-width: 0; }
.document-template-dialog .document-paper-editor { overflow: auto; }
.document-table-picker:not([hidden]) { display: flex; flex-wrap: wrap; align-items: end; gap: 8px; padding: 6px 0; }
.document-table-picker label { display: grid; gap: 3px; font-size: 12px; }
.document-table-picker input { width: 72px; font: inherit; padding: 5px; }
:is(.document-paper-editor, .document-preview-dialog article) table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  margin-block: 8px;
}
:is(.document-paper-editor, .document-preview-dialog article) :is(td, th) {
  border: 1px solid var(--line, #ddd);
  min-width: 0;
  padding: 4px;
  vertical-align: top;
  overflow-wrap: anywhere;
}

/* Shared account list, with a distinct accent for business reserves. */
#workspace .account-category-sections .account-section {
  border-radius: 12px;
  box-shadow: none;
}
#workspace .account-category-sections .account-section > .account-section-head {
  min-height: 44px;
  gap: 8px;
  padding: 8px 12px;
}
#workspace .account-category-sections .account-section-head h3 {
  min-width: 0;
  margin: 0;
  font-family: inherit;
  font-size: 14px;
  font-weight: 650;
  line-height: 1.25;
}
#workspace .account-category-sections .account-section-head > :is(span, strong) {
  flex: none;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
#workspace .account-category-sections .account-record {
  min-height: 52px;
  gap: 8px;
  padding: 8px 12px;
  transform: none;
}
#workspace .account-category-sections .account-record-main { gap: 8px; }
#workspace .account-category-sections .account-record-icon {
  width: 32px;
  height: 32px;
  flex-basis: 32px;
  border-radius: 9px;
  font-size: 16px;
}
#workspace .account-category-sections .account-record-copy > strong { color: var(--ink); overflow-wrap: anywhere; }
#workspace .account-category-sections .account-record-amount { font-size: 14px; font-variant-numeric: tabular-nums; }
#workspace .account-head h2 { font-family: inherit; font-weight: 650; }
#workspace .account-category-sections :is(.account-record-copy > strong, .saving-goal-amounts > strong, .business-reserve-inner summary > strong) {
  font-family: inherit;
  font-size: 14px;
}
#workspace .account-category-sections :is(.saving-goals > header h3, .saving-goal-head > strong, .business-reserve-label > strong) {
  font-family: inherit;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.25;
}
#workspace .account-category-sections .saving-goals > header h3 { font-weight: 700; }

#workspace .account-category-sections .business-reserves > .account-section-head {
  grid-template-columns: minmax(0, 1fr) auto 12px;
  background: #faf5df;
  border-bottom: 1px solid var(--line);
}
#workspace .account-category-sections .business-reserves > .account-section-head::before { background: #b39a4d; }
#workspace .account-category-sections .business-reserves > .account-section-head > .business-reserve-chevron { align-self: center; margin-block: 0; }
#workspace .account-category-sections .business-reserve-inner { padding-inline: 12px; }
#workspace .account-category-sections .business-reserve-inner > details > summary {
  min-height: 52px;
  align-items: center;
  padding: 8px 0;
}
#workspace .account-category-sections .business-reserve-total { padding: 10px 0; }

.saving-goals > header h3 { flex: 1; }
.saving-goals-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 5px 0;
  border: 0;
  background: none;
  color: inherit;
  text-align: left;
  font: inherit;
  cursor: pointer;
}
.saving-goals-toggle .business-reserve-chevron { align-self: center; margin-top: 0; }
.saving-goals-toggle[aria-expanded="true"] .business-reserve-chevron { transform: rotate(225deg); }
.saving-goals { gap: 4px; padding: 4px 0; }
.saving-goals > header { padding-inline: 12px; }
.saving-goals-list:not([hidden]) { display: grid; gap: 4px; min-width: 0; }
.saving-goals [hidden] { display: none !important; }
.saving-goals-list .saving-goal-card {
  width: 100%;
  min-width: 0;
  gap: 3px;
  padding: 4px 12px;
  border-inline: 0;
}
.saving-goals-list .saving-goal-card > summary { gap: 2px; line-height: 1.25; }
.saving-goals-list .saving-goal-progress { height: 4px; }
.saving-goals-list .saving-goal-card[open] > .saving-goal-meta { margin-block: 3px; }
.saving-goals-list .saving-goal-actions { width: 100%; }
.saving-goal-completed-row { position: relative; min-width: 0; }
.saving-goal-completed-row .saving-goal-head { padding-inline-end: 70px; }
.saving-goal-completed-row > button {
  position: absolute;
  inset: 3px 8px auto auto;
  padding: 2px 5px;
  font-size: 11px;
}

/* Hidden booking panels must override their original display:grid styles. */
#eventForm :is(#bookingFields, #studentBookingFields, #studentBookingStatus, .booking-photos)[hidden] {
  display: none !important;
}
.calendar-habit-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 7px;
}
.calendar-habit-chips .calendar-habit-row {
  min-width: 0;
  max-width: 100%;
  gap: 3px;
  padding: 2px 5px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--paper, #fff);
}
.calendar-habit-chips .calendar-habit-row input { margin: 0 2px; accent-color: #486c57; }
.calendar-habit-chips .habit-month-open { padding: 2px 3px; font-size: 13px; }
.habit-month-actions { display: flex; gap: 6px; margin-top: 8px; }

#workspace .finance-client-income-grid.finance-integrated-plans {
  grid-template-columns: minmax(0, 1fr);
}
#workspace .finance-integrated-plans .finance-planned-income-card {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) minmax(0, max-content) !important;
  align-items: start;
  gap: 6px 9px;
  width: 100%;
  padding: 8px 9px !important;
  border: 1px solid color-mix(in srgb, var(--plan-color) 24%, var(--line));
  border-inline-start: 4px solid var(--plan-color);
  border-radius: 12px;
  background: color-mix(in srgb, var(--plan-color) 7%, #fff);
  box-shadow: none;
  opacity: 1;
  text-align: left;
  white-space: normal !important;
}
#workspace .finance-planned-income-card .finance-plan-card-label {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr);
  gap: 2px;
  min-width: 0;
  overflow: visible;
}
#workspace .finance-planned-income-card .finance-plan-card-label :is(b, span, small) {
  min-width: 0;
  white-space: normal !important;
  overflow: visible;
  overflow-wrap: anywhere;
  line-height: 1.25;
  font-size: 12px;
}
#workspace .finance-planned-income-card .finance-plan-card-label b { font-size: 14px; }
#workspace .finance-planned-income-card .finance-planned-income-side {
  display: grid;
  justify-items: end;
  min-width: 0;
  max-width: min(42vw, 166px);
  gap: 4px;
  text-align: right;
}
#workspace .finance-planned-income-card .finance-planned-income-side > strong {
  font-size: 14px;
  line-height: 1.25;
  white-space: normal;
  overflow-wrap: anywhere;
}
#workspace .finance-planned-income-card .finance-planned-income-side > small {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.25;
}
#workspace .finance-planned-income-card .finance-client-payment-actions {
  display: grid !important;
  justify-items: stretch;
  min-width: 0;
  gap: 3px;
  margin: 0;
}
#workspace .finance-planned-income-card .finance-client-payment-actions button {
  width: 100% !important;
  max-width: 100% !important;
  margin: 0 !important;
  padding: 3px 4px !important;
  white-space: normal !important;
  line-height: 1.2;
}

.plan-month-navigation,
.habit-month-dialog .habit-month-nav {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  width: 100%;
}
:is(.plan-month-navigation, .habit-month-nav) > strong {
  min-width: 0;
  text-align: center;
}

#workspace :is(.project-search-field, .finance-operation-search-field) {
  position: relative;
  display: block;
  min-width: 0;
  margin: 0 0 10px;
  color: var(--muted);
}
#workspace :is(.project-search-field, .finance-operation-search-field)::before,
#workspace :is(.project-search-field, .finance-operation-search-field)::after {
  position: absolute;
  z-index: 1;
  content: "";
  pointer-events: none;
}
#workspace :is(.project-search-field, .finance-operation-search-field)::before {
  top: calc(50% - 7px);
  left: 13px;
  width: 11px;
  height: 11px;
  border: 1.5px solid currentColor;
  border-radius: 50%;
}
#workspace :is(.project-search-field, .finance-operation-search-field)::after {
  top: calc(50% + 3px);
  left: 23px;
  width: 6px;
  height: 1.5px;
  border-radius: 2px;
  background: currentColor;
  transform: rotate(45deg);
  transform-origin: left center;
}
#workspace :is(#projectSearch, #financeOperationSearch) {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 40px;
  padding: 8px 12px 8px 36px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #faf8f6;
  color: var(--ink);
  font: inherit;
}
#workspace :is(#projectSearch, #financeOperationSearch):focus {
  outline: 2px solid color-mix(in srgb, var(--accent) 40%, transparent);
  outline-offset: 1px;
  background: var(--paper);
}
#workspace :is([data-project-search], [data-project-search-empty])[hidden] { display: none !important; }

#workspace .finance-search-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 6px 12px;
  margin: 8px 0 12px;
}
#workspace .finance-search-input { flex: 1 1 235px; min-width: 0; }
#workspace .finance-operation-search-field { margin: 0; }
#workspace #financeOperationSearchHint {
  display: block;
  margin: 5px 0 0 2px;
  font-size: 11px;
  color: var(--muted);
}
#workspace .finance-search-period {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #faf8f6;
  font-size: 13px;
  cursor: pointer;
}

/* Match the booking actions in the calendar and the finance plan. */
#workspace .unpaid-booking-section .payment-actions,
#workspace .unpaid-booking-section .calendar-booking-actions,
#workspace .finance-planned-income-card .finance-client-payment-actions {
  display: grid !important;
  gap: 4px;
}
#workspace .unpaid-booking-section .calendar-booking-actions .payment-actions {
  margin: 0;
}

#workspace .unpaid-booking-section :is([data-booking-payment], [data-calendar-attend]),
#workspace .finance-planned-income-card .finance-client-payment-actions > button,
#workspace:has(.finance-integrated-plans) :is(.finance-plan-pay, .finance-plan-pay-label, .expense-status > button, [data-finance-line-toggle]) {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 40px;
  max-width: 100%;
  padding: 5px 8px !important;
  border: 1px solid #ded8d2 !important;
  border-radius: 9px !important;
  background: #fff !important;
  color: #4c4641 !important;
  box-shadow: none !important;
  font-family: inherit !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  line-height: 1.15 !important;
  text-align: center;
  text-decoration: none !important;
  white-space: normal !important;
  overflow-wrap: anywhere;
}
#workspace :is(.unpaid-booking-section .payment-actions, .unpaid-booking-section .calendar-booking-actions) > button {
  width: 100%;
}
#workspace .unpaid-booking-section :is([data-booking-payment], [data-calendar-attend]):hover:not(:disabled),
#workspace .finance-planned-income-card .finance-client-payment-actions > button:hover:not(:disabled),
#workspace:has(.finance-integrated-plans) :is(.finance-plan-pay, .finance-plan-pay-label, .expense-status > button, [data-finance-line-toggle]):hover:not(:disabled) {
  border-color: #b6aaa0 !important;
  background: #f5f2ef !important;
  transform: none;
}
