/* Little Loves v36.8 — visual consistency, responsive cleanup and shared design tokens. */
:root{
  --app-header-height:68px;
  --sticky-gap:8px;
  --sticky-secondary-height:50px;
  --sticky-top-1:var(--app-header-height);
  --sticky-top-2:calc(var(--app-header-height) + var(--sticky-secondary-height));
  --z-dropdown:120;
  --z-drawer:300;
  --z-modal:500;
  --z-compliance:700;
  --z-kiosk:800;
  --border-subtle:#d7e0da;
  --border-group:#aebdb3;
  --border-strong:#71897a;
  --surface-soft:#f7faf8;
  --surface-selected:var(--theme-primary-soft,#eef6f0);
}

/* One sticky-header system. */
.app-topbar{height:var(--app-header-height)!important;min-height:var(--app-header-height)!important;top:0!important;z-index:60!important}
.settings-tabs,.directory-toolbar,.stories-head-row,.daily-datebar,.care-type-tabs,.page-policies .policy-toolbar,.page-reports .report-toolbar,.notification-toolbar,.child-profile-panel .profile-tabs,.template-only-tabs{top:var(--sticky-top-1)!important;z-index:35!important}
.story-editor-sticky,.story-toolbar-inline{top:var(--sticky-top-1)!important;z-index:36!important}
.story-live-preview,.template-settings-preview{top:var(--sticky-top-2)!important}
.llc363 .filters{top:0!important}

/* Three-level border hierarchy: cards < groups < focused/selected. */
.panel,.item-card,.stat,.table-wrap,.report-tile,.report-workspace,.v365-diary-entry,.v365-sleep-status,.v36-profile-identity,.llc363 .card,.llc363 .criterion,.llc363 .kpis>div{border-color:var(--border-subtle)!important}
fieldset,.ef-fieldset,.v365-fieldset,.operational-sleep-check-editor,.v36-design-options,.v36-audience-choice,.settings-category-card,.operational-register-filters,.report-filter-grid,.module-access-row,.v365-inline-sleep,.v365-report-count{border-color:var(--border-group)!important}
fieldset:focus-within,.ef-fieldset:focus-within,.v365-fieldset:focus-within,.operational-sleep-check-editor:focus-within,.module-access-row:focus-within,.settings-category-card:focus-within{border-color:var(--border-strong)!important;box-shadow:0 0 0 2px color-mix(in srgb,var(--theme-primary) 8%,transparent)}
input,select,textarea{border-color:var(--border-group)}

/* Portal theme now flows through major interactive surfaces, not warning/danger semantics. */
#portal .sidebar{background:linear-gradient(180deg,var(--theme-primary-strong,#20362a),color-mix(in srgb,var(--theme-primary-strong,#20362a) 82%,#14241b))}
#portal .sidebar nav button.active,#portal .sidebar-settings-link.active{background:color-mix(in srgb,var(--theme-primary) 76%,#13251a)!important;box-shadow:inset 3px 0 0 color-mix(in srgb,var(--theme-primary) 25%,#f4d179)!important}
#portal .sidebar nav button:hover,#portal .sidebar-settings-link:hover{background:color-mix(in srgb,var(--theme-primary) 52%,transparent)!important}
#portal .app-topbar{background:color-mix(in srgb,var(--theme-primary-soft-2,#f7faf8) 76%,white)!important}
#portal .report-tile:hover,#portal .item-card:hover{border-color:var(--theme-primary-border)!important}
#portal .data-table tr:focus-within,#portal .v365-diary-entry:focus-within{outline:2px solid color-mix(in srgb,var(--theme-primary) 20%,transparent);outline-offset:1px}

/* Routine text is readable; tiny metadata is reserved for truly secondary content. */
.data-table th,.badge,.status-badge,.en-form-chip,.v36-child-status,.v36-profile-alert-strip span,.module-access-row small,.v36-activity-result-head em,.v36-activity-result>small,.v36-activity-result-meta i,.v36-activity-safety,.v36-use-activity,.v36-pgc-timeline span,.v36-enrol-progress span,.v36-enrol-progress small,.mobile-nav button>span:last-child{font-size:10px!important;line-height:1.3}
.data-table td,.item-card p,.operational-register-filters label,.report-filter-grid label{font-size:12px}
.llc363 .small,.llc363 small{font-size:11px}

/* Compact ERO workspace without long horizontal menu scrollbar. */
.llc363{z-index:var(--z-compliance)!important}
.llc363>nav{flex-wrap:wrap!important;overflow:visible!important;gap:4px!important;padding:6px 10px!important}
.llc363>nav button{padding:7px 9px!important;font-size:12px!important}
.llc363 .form.compact{grid-template-columns:repeat(4,minmax(150px,1fr))!important}
.llc363 .criterion-edit{grid-template-columns:135px minmax(180px,1fr) 135px 135px minmax(220px,2fr) auto!important}
.llc363 .records article{grid-template-columns:minmax(180px,1.2fr) repeat(3,minmax(120px,1fr)) auto!important}

/* One modal/drawer scale. Existing specialised editors inherit safely. */
.modal{z-index:var(--z-modal)!important;padding:16px!important}
.modal-card{max-height:calc(100dvh - 32px);overflow:auto;border-radius:18px!important}
.modal-card.v368-size-sm{width:min(460px,100%)}.modal-card.v368-size-md{width:min(720px,100%)}.modal-card.v368-size-lg{width:min(980px,100%)}
#staffEditor:not(.hidden),#learningActivityEditor:not(:empty),#resourceEditor:not(:empty),#taskEditArea:not(:empty),#taskCompletionArea:not(:empty),#enrolmentDetail:not(:empty),#editChildForm:not(.hidden){inset:var(--app-header-height) 0 0 auto!important;z-index:var(--z-drawer)!important;border-left-color:var(--border-group)!important}
.v36-drawer-modal{padding-top:var(--app-header-height)!important;z-index:var(--z-modal)!important}
.v36-more-menu,.floating-menu,.user-menu,.global-search-results{z-index:var(--z-dropdown)!important}
.operational-record-modal{z-index:var(--z-modal)!important}

/* Shared empty/error state treatment. */
.app-view .empty:not(td),.app-view .error-state{border:1px dashed var(--border-group);border-radius:14px;background:var(--surface-soft);padding:26px 18px;text-align:center;color:var(--muted)}
.app-view .empty.compact{padding:14px;min-height:0}
.app-view .error-state{border-style:solid}

/* Standard SVG icon containers used by v36.8 normaliser. */
.v368-icon{width:22px;height:22px;display:inline-grid;place-items:center;flex:0 0 auto;color:currentColor}
.v368-icon svg{width:100%;height:100%;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.v365-diary-icon .v368-icon,.v365-record-chooser i .v368-icon,.v364-record-chooser .v368-icon,.kiosk-ops-grid .v368-icon,.kiosk-choice-icon .v368-icon{width:24px;height:24px}
.v365-record-chooser i{display:grid;place-items:center}
.v364-record-chooser button{display:flex;align-items:center;gap:9px}

/* Responsive cleanup for wide administrative forms. */
@media(max-width:1180px){
  .llc363 .form.compact{grid-template-columns:repeat(2,minmax(0,1fr))!important}
  .llc363 .criterion-edit{grid-template-columns:repeat(3,minmax(0,1fr))!important}
  .llc363 .criterion-edit input[data-cnotes]{grid-column:1/-1}
  .module-access-matrix{grid-template-columns:1fr!important}
  .group-create-panel{grid-template-columns:1fr!important}
}
@media(max-width:900px){
  .operational-register-filters,.report-filter-grid{grid-template-columns:repeat(2,minmax(0,1fr))!important}
  .v365-hazard-item{grid-template-columns:1fr!important}
  .v365-hazard-item>input{grid-column:auto!important}
  .llc363 .records article{grid-template-columns:repeat(2,minmax(0,1fr))!important}
}
@media(max-width:680px){
  :root{--app-header-height:60px;--sticky-secondary-height:46px}
  .app-topbar{height:var(--app-header-height)!important;min-height:var(--app-header-height)!important}
  .app-view{padding-left:11px!important;padding-right:11px!important}
  .modal{padding:0!important;align-items:stretch!important}
  .modal-card{width:100%!important;max-width:none!important;max-height:100dvh!important;min-height:100dvh;border-radius:0!important;padding:20px 16px!important}
  .modal-card .close{position:sticky;float:right;top:8px;z-index:2}
  #staffEditor:not(.hidden),#learningActivityEditor:not(:empty),#resourceEditor:not(:empty),#taskEditArea:not(:empty),#taskCompletionArea:not(:empty),#enrolmentDetail:not(:empty),#editChildForm:not(.hidden){inset:var(--app-header-height) 0 0 0!important;width:auto!important;max-width:none!important}
  .operational-register-filters,.report-filter-grid,.llc363 .form.compact,.llc363 .criterion-edit,.llc363 .records article{grid-template-columns:1fr!important}
  .llc363>nav{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr));position:sticky;top:0;z-index:8}
  .llc363>nav button{white-space:normal!important;text-align:left}
  .v367-pref-actions{padding-bottom:max(12px,env(safe-area-inset-bottom))!important}
}
