/* Approved quail visual language, shared by the authenticated application.
   Keep section structure, semantic status colours and business behaviour intact. */
:root {
  --tf-canvas:#f2f8f6; --tf-surface:#fff; --tf-sidebar:#edf6f3;
  --tf-line:#d9e6e3; --tf-ink:#153740; --tf-muted:#526e74;
  --tf-accent:#087579; --tf-selected:#def1ec;
}
/* Consistent targets, including compact sales/finance tabs and settings links. */
#workspace button, #workspace .settings-menu > summary { min-height:44px; }
#workspace .health-record-open {
  font:inherit; text-align:left; color:inherit; background:transparent;
  border:0; border-radius:8px; padding:0; cursor:pointer; width:100%;
  display:flex; flex-direction:column; align-items:flex-start; gap:6px;
}
#workspace .health-record-open:hover { color:var(--tf-accent); }
#workspace .health-record-open:focus-visible { outline:2px solid var(--tf-accent); outline-offset:4px; }
/* Approved health journal concept. Scope follows the mounted page, not a stale class. */
#workspace:has(.health-refined) .health-heading h1 { font-size:clamp(32px,3vw,42px); letter-spacing:-.03em; }
#workspace:has(.health-refined) .health-tabs { width:max-content; max-width:100%; padding:5px; gap:8px; border-radius:12px; background:#e5efec; }
#workspace:has(.health-refined) .health-tabs .health-tab { border:0; border-radius:8px; background:transparent; color:#526e74; }
#workspace:has(.health-refined) .health-tabs .health-tab.active { background:#fff; color:#087579; box-shadow:0 2px 5px #1537400c; }
#workspace .health-refined .records-panel { padding:0 28px; border-color:#ccded9; }
#workspace .health-refined .health-filter-disclosure { padding:20px 0; border-bottom:1px solid var(--tf-line); }
#workspace .health-refined .health-filter-disclosure > summary { width:max-content; margin-left:auto; padding:10px 16px; min-height:44px; border:1px solid var(--tf-line); border-radius:10px; background:#f5f9f7; cursor:pointer; font-size:14px; }
#workspace .health-refined .health-toolbar { border:0; padding:20px 0 0; margin:0; display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:16px; }
#workspace .health-refined .health-toolbar label { min-width:0; }
#workspace .health-refined .health-toolbar :is(input,select) { width:100%; min-width:0; }
#workspace .health-refined .health-record-row { display:grid; grid-template-columns:48px minmax(0,1fr) auto 28px; gap:20px; align-items:center; padding:24px 0; border:0; border-bottom:1px solid var(--tf-line); border-radius:0; background:transparent; box-shadow:none; }
#workspace .health-refined .health-record-row:last-child { border-bottom:0; }
#workspace .health-refined .health-record-row::before { content:''; width:48px; height:48px; border-radius:12px; background:#e7f3ee url('/health-record-icon.svg') center no-repeat; }
#workspace .health-refined .health-journal-panel { position:relative; }
#workspace .health-refined .health-list-title { position:absolute; top:28px; left:28px; margin:0; font-size:18px; line-height:1.5; max-width:calc(100% - 195px); }
@media(max-width:600px) { #workspace .health-refined .health-list-title { left:18px; font-size:16px; } }
#workspace .health-refined .record-main { min-width:0; overflow-wrap:anywhere; }
#workspace .health-refined .record-main > strong { font-size:20px; letter-spacing:-.015em; }
#workspace .health-refined .record-main > span { font-size:14px; color:var(--tf-muted); }
#workspace .health-refined .health-record-row:hover .record-main > strong { color:var(--tf-accent); }
#workspace .health-refined .health-condition { min-height:44px; padding:8px 12px; border-radius:8px; font-size:12px; font-weight:600; box-shadow:none; }
#workspace .health-refined .health-condition.sick { background:#fbefeb; color:#93413d; border-color:#efdcd4; }
#workspace .health-refined .health-condition.observation { background:#edf3f9; color:#346987; border-color:#d7e4ee; }
#workspace .health-refined .health-record-row > span[aria-hidden] { width:28px; height:28px; text-align:center; background:#f0f6f3; color:#087579; border-radius:8px; line-height:26px; }
@media(max-width:800px) { #workspace .health-refined .health-toolbar { grid-template-columns:repeat(2,minmax(0,1fr)); } }
@media(max-width:600px) {
 #workspace .health-refined .records-panel { padding:0 18px; }
 #workspace .health-refined .health-record-row { grid-template-columns:36px minmax(0,1fr) 26px; gap:10px; padding:22px 0; }
 #workspace .health-refined .health-record-row::before { width:36px; height:40px; background-size:23px; align-self:start; grid-row:1; }
 #workspace .health-refined .record-main { grid-column:2; grid-row:1; }
 #workspace .health-refined .record-main > strong { font-size:18px; }
 #workspace .health-refined .record-meta { grid-column:2; grid-row:2; align-items:flex-start; }
 #workspace .health-refined .health-record-row > span[aria-hidden] { grid-column:3; grid-row:1/3; }
}
@media(max-width:380px) { #workspace .health-refined .health-toolbar { grid-template-columns:1fr; } }
body:has(#workspace) { background:var(--tf-canvas); }
body:has(#workspace) .sidebar { background:var(--tf-sidebar); border-color:var(--tf-line); border-radius:16px; box-shadow:none; backdrop-filter:none; }
body:has(#workspace) .sidebar .nav-button { min-height:46px; border-radius:10px; font-size:14px; color:var(--tf-muted); }
body:has(#workspace) .sidebar .nav-button.active { background:var(--tf-selected); color:var(--tf-accent); box-shadow:none; }
body:has(#workspace) .sidebar .nav-button .nav-icon { padding:0; width:22px; height:22px; background:none; box-shadow:none; color:currentColor; }
body:has(#workspace) .farm-menu summary { background:var(--tf-surface); border-color:var(--tf-line); box-shadow:none; border-radius:12px; }
body:has(#workspace) .farm-menu-panel { background:var(--tf-surface); border-color:var(--tf-line); backdrop-filter:none; }
#workspace { color:var(--tf-ink); font-size:15px; line-height:1.5; }
#workspace :is(.panel,.editor-panel,.metric-card,.egg-metric,.chick-metric,.inc-metric,.family-dashboard-card,.family-card,.customer-list-card,.vb-metric,.cd-metric) {
  background:var(--tf-surface); border:1px solid var(--tf-line); border-radius:16px; box-shadow:none; min-width:0;
}
#workspace .workspace-heading .eyebrow { display:none; }
#workspace .workspace-heading h1 { font-size:clamp(28px,3vw,36px); letter-spacing:-.025em; }
#workspace :is(.button,.row-action),body:has(#workspace) dialog .button {
  min-height:44px; border-radius:10px; font-size:14px; box-shadow:none;
}
#workspace .button-primary,body:has(#workspace) dialog .button-primary { background:var(--tf-accent); color:#fff; border-color:var(--tf-accent); }
#workspace .button-primary:hover,body:has(#workspace) dialog .button-primary:hover { background:#065f62; }
#workspace :is(.button-secondary,.button-quiet) { background:var(--tf-surface); border-color:var(--tf-line); }
#workspace :is(input:not([type=checkbox]):not([type=radio]),select,textarea),body:has(#workspace) dialog :is(input:not([type=checkbox]):not([type=radio]),select,textarea) {
  font-size:16px; min-height:44px; border-radius:10px; border-color:var(--tf-line); background:#fff; color:var(--tf-ink);
}
#workspace label,body:has(#workspace) dialog label { font-size:14px; }
body:has(#workspace) dialog { background:#fff; color:var(--tf-ink); border:1px solid var(--tf-line); border-radius:16px; }
#workspace :is(.egg-metric-icon,.chick-metric-icon) { background:#e7f6f2; color:var(--tf-accent); box-shadow:none; }
#workspace :is(.metric-card>strong,.egg-metric strong,.chick-metric strong,.inc-metric>strong,.cd-metric strong,.feeding-kpis strong,.vb-metric strong) {
  font-size:clamp(32px,3vw,44px); line-height:1.2; font-variant-numeric:tabular-nums; overflow-wrap:anywhere;
}
#workspace :is(.module-tabs,.family-work-tabs) { background:transparent; box-shadow:none; border-color:var(--tf-line); }
#workspace :is(th,td) { border-color:var(--tf-line); }
#workspace th { color:var(--tf-muted); font-size:13px; }
#workspace td { font-size:14px; }
#workspace :is(button,a,input,select,textarea,summary):focus-visible { outline:2px solid var(--tf-accent); outline-offset:3px; }
#workspace ::selection { background:var(--tf-selected); color:var(--tf-ink); }
/* Overview: related metrics share a quiet bordered strip, like Quail. */
#workspace[data-direction=""] .dashboard-main-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:0; padding:24px; background:#fff; border:1px solid var(--tf-line); border-radius:16px; }
#workspace[data-direction=""] .dashboard-main-grid>.chick-metric { border:0; border-radius:0; padding:0 24px; background:transparent; box-shadow:none; }
#workspace[data-direction=""] .dashboard-main-grid>.chick-metric:first-child { padding-left:0; }
#workspace[data-direction=""] .dashboard-main-grid>.chick-metric+.chick-metric { border-left:1px solid var(--tf-line); }
#workspace[data-direction=""] .dashboard-main-grid .chick-metric-icon { display:none; }
#workspace[data-direction=""] .dashboard-secondary-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:20px; margin-top:20px; }
#workspace[data-direction=""] .dashboard-secondary-grid .chick-metric { padding:24px; }
#workspace[data-direction=""] .dashboard-secondary-grid .chick-metric-icon { display:none; }
#workspace[data-direction=""] .dashboard-secondary-grid>.chick-metric:first-child { background:#e7f6f2; }
@media(max-width:700px) {
  #workspace[data-direction=""] .dashboard-main-grid { grid-template-columns:repeat(2,minmax(0,1fr)); padding:18px; }
  #workspace[data-direction=""] .dashboard-main-grid>.chick-metric { padding:0 12px; }
  #workspace[data-direction=""] .dashboard-main-grid>.chick-metric:last-child { grid-column:1/-1; border-left:0; border-top:1px solid var(--tf-line); padding:18px 0 0; margin-top:18px; }
  #workspace[data-direction=""] .dashboard-secondary-grid { gap:12px; }
  #workspace[data-direction=""] .dashboard-secondary-grid .chick-metric { padding:18px; }
}
@media(max-width:380px) { #workspace[data-direction=""] .dashboard-secondary-grid { grid-template-columns:1fr; } }
/* Approved six-section preview: shared metric strips, not nested cards. */
#workspace[data-direction=""] :is(.egg-metrics,.chick-metrics,.vb-metrics,.feeding-kpis,.inc-metrics:not(:has(.inc-equipment-card))) {
  display:grid; gap:0; padding:24px 0; background:#fff;
  border:1px solid var(--tf-line); border-radius:16px; box-shadow:none;
}
#workspace[data-direction=""] :is(.egg-metrics,.vb-metrics) { grid-template-columns:repeat(3,minmax(0,1fr)); }
#workspace[data-direction=""] :is(.chick-metrics,.feeding-kpis,.inc-metrics:not(:has(.inc-equipment-card))) { grid-template-columns:repeat(4,minmax(0,1fr)); }
#workspace[data-direction=""] :is(.egg-metrics,.chick-metrics,.vb-metrics,.feeding-kpis,.inc-metrics:not(:has(.inc-equipment-card))) > :is(.egg-metric,.chick-metric,.vb-metric,.inc-metric,article) {
  display:flex; flex-direction:column; align-items:flex-start; justify-content:flex-start;
  gap:8px; min-width:0; min-height:0; margin:0; padding:0 24px;
  background:transparent; border:0; border-radius:0; box-shadow:none;
}
#workspace[data-direction=""] :is(.egg-metrics,.chick-metrics,.vb-metrics,.feeding-kpis,.inc-metrics:not(:has(.inc-equipment-card))) > * + :nth-child(n) { border-left:1px solid var(--tf-line); }
#workspace[data-direction=""] :is(.egg-metrics,.chick-metrics) :is(.egg-metric-icon,.chick-metric-icon),
#workspace[data-direction=""] .vb-metric > span { display:none; }
#workspace[data-direction=""] .vb-metric > div { display:flex; flex-direction:column; gap:8px; }
#workspace[data-direction=""] .inc-metrics:not(:has(.inc-equipment-card)) > :nth-child(n+5) { border-top:1px solid var(--tf-line); margin-top:24px; padding-top:24px; }
#workspace[data-direction=""] .inc-metrics:not(:has(.inc-equipment-card)) > :nth-child(4n+1) { border-left:0; }
#workspace[data-direction=""] :is(.health-tabs,.egg-tabs,.inc-tabs,.feeding-tabs) { display:flex; flex-wrap:wrap; gap:8px; padding:0; border:0; border-radius:0; background:transparent; box-shadow:none; }
#workspace[data-direction=""] :is(.health-tabs,.egg-tabs,.inc-tabs,.feeding-tabs) button,
#workspace[data-direction=""] .feeding-presets button { min-height:44px; border:1px solid var(--tf-line); border-radius:10px; padding:10px 16px; background:#fff; color:var(--tf-ink); box-shadow:none; }
#workspace[data-direction=""] :is(.health-tabs,.egg-tabs,.inc-tabs,.feeding-tabs) :is(.active,[aria-selected=true],[aria-pressed=true]),
#workspace[data-direction=""] .button.button-primary { background:var(--tf-accent); color:#fff; border-color:var(--tf-accent); }
#workspace[data-direction=""] .ed-fields { grid-template-columns:repeat(3,minmax(165px,1fr)); gap:16px; }
#workspace[data-direction=""] .ed-fields input[type=date] { min-width:165px; }
#workspace[data-direction=""] .ed-fields > .button { justify-self:start; align-self:end; }
#workspace[data-direction=""] :is(.ed-entry,.ed-journal,.feeding-dashboard .panel) { border-radius:16px; }
#workspace[data-direction=""] .ed-journal-toolbar { align-items:flex-end; gap:16px; }
#workspace[data-direction=""] .ed-journal .egg-filters > label { border:0; background:transparent; padding:0; }
#workspace[data-direction=""] .vaccine-course-row { border-radius:0; background:transparent; border:0; border-bottom:1px solid var(--tf-line); padding:24px 0; box-shadow:none; }
#workspace[data-direction=""] .vaccine-course-row:hover { background:#f2f8f6; }
#workspace[data-direction=""] .vaccine-course-row:last-child { border-bottom:0; }
#workspace[data-direction=""] .vaccine-course-row .record-main > strong { font-size:18px; }
#workspace[data-direction=""] .vaccine-course-row .record-main > b { color:var(--tf-accent); font-size:14px; }
#workspace[data-direction=""] .panel:has(> .chick-metrics) { border:0; padding:0; background:transparent; box-shadow:none; }
@media(max-width:1050px) {
 #workspace[data-direction=""] .ed-fields { grid-template-columns:repeat(2,minmax(165px,1fr)); }
}
@media(max-width:800px) {
 #workspace[data-direction=""] :is(.egg-metrics,.chick-metrics,.vb-metrics,.feeding-kpis,.inc-metrics:not(:has(.inc-equipment-card))) { grid-template-columns:repeat(2,minmax(0,1fr)); }
 #workspace[data-direction=""] :is(.egg-metrics,.chick-metrics,.vb-metrics,.feeding-kpis,.inc-metrics:not(:has(.inc-equipment-card))) > * { padding-left:16px; padding-right:16px; }
 #workspace[data-direction=""] :is(.egg-metrics,.chick-metrics,.vb-metrics,.feeding-kpis,.inc-metrics:not(:has(.inc-equipment-card))) > :nth-child(odd) { border-left:0; }
 #workspace[data-direction=""] :is(.egg-metrics,.chick-metrics,.vb-metrics,.feeding-kpis,.inc-metrics:not(:has(.inc-equipment-card))) > :nth-child(n+3) { border-top:1px solid var(--tf-line); margin-top:20px; padding-top:20px; }
 #workspace[data-direction=""] :is(.egg-metrics,.vb-metrics) > :last-child:nth-child(odd) { grid-column:1/-1; }
}
@media(max-width:440px) {
 #workspace[data-direction=""] .ed-fields { grid-template-columns:minmax(0,1fr); }
 #workspace[data-direction=""] .ed-journal .egg-filters { min-width:0; width:100%; }
}
@media(max-width:360px) {
 #workspace[data-direction=""] :is(.egg-metrics,.chick-metrics,.vb-metrics,.feeding-kpis,.inc-metrics:not(:has(.inc-equipment-card))) { grid-template-columns:minmax(0,1fr); }
 #workspace[data-direction=""] :is(.egg-metrics,.chick-metrics,.vb-metrics,.feeding-kpis,.inc-metrics:not(:has(.inc-equipment-card))) > :nth-child(n) { border-left:0; }
 #workspace[data-direction=""] :is(.egg-metrics,.chick-metrics,.vb-metrics,.feeding-kpis,.inc-metrics:not(:has(.inc-equipment-card))) > :nth-child(n+2) { border-top:1px solid var(--tf-line); margin-top:20px; padding-top:20px; }
}
/* Approved minimal treatment editor; other health dialogs retain their layout. */
.health-record-dialog:has(.stock-treatment-editor) {
  width:min(820px,calc(100vw - 24px)); max-height:calc(100dvh - 32px);
  border:1px solid var(--tf-line,#d9e6e3); border-radius:12px;
  background:#fff; overflow:auto; overscroll-behavior:contain;
}
body:has(.health-record-dialog[open] .stock-treatment-editor) { overflow:hidden; }
.health-record-dialog .stock-treatment-editor.health-editor { padding:24px 28px 0; background:#fff; }
.stock-treatment-editor .editor-heading { margin:0 0 16px; align-items:center; }
.stock-treatment-editor .editor-heading h2 { font-size:24px; margin:0; }
.stock-treatment-editor .editor-close { background:transparent; border-radius:6px; min-width:44px; min-height:44px; }
.stock-treatment-editor .health-card-subject { display:inline-block; font-size:18px; margin:0 16px 16px 0; line-height:1.5; overflow-wrap:anywhere; }
.stock-treatment-editor .health-card-status { float:right; display:inline-flex; align-items:center; gap:8px; margin:0 0 16px; padding:0 4px; min-height:44px; background:transparent; border:0; color:#526e74; font-weight:500; }
.stock-treatment-editor .health-card-status::before { content:''; width:8px; height:8px; border-radius:50%; background:currentColor; flex:none; }
.stock-treatment-editor .entity-form { clear:both; border-top:1px solid #d9e6e3; padding-top:16px; gap:16px; }
.stock-treatment-editor .health-primary-diagnosis { padding:0; margin:0; font-weight:400; }
.stock-treatment-editor input:not([type=checkbox]),.stock-treatment-editor select,.stock-treatment-editor textarea { background:#fff; border-radius:6px; min-height:44px; font-size:16px; }
.stock-treatment-editor .course-medicine-heading { display:flex; align-items:center; justify-content:space-between; gap:12px; margin:8px 0 12px; }
.stock-treatment-editor .course-medicine-heading h3 { font-size:18px; margin:0; }
.stock-treatment-editor .course-medicine-heading button,.stock-treatment-editor .course-stock-actions button { min-height:44px; padding:8px 0; border:0; background:transparent; color:#087579; box-shadow:none; }
.stock-treatment-editor .stock-course .course-drug { grid-template-columns:minmax(0,2fr) minmax(0,1fr) 44px; gap:16px; padding:12px 0; margin:0; border-bottom:1px solid #d9e6e3; }
.stock-treatment-editor .stock-course .course-drug>button { width:44px; min-height:44px; background:transparent; border:0; margin-top:26px; }
.stock-treatment-editor .stock-course .course-stock-badge { padding:0; margin-top:8px; border-radius:0; background:transparent; color:#526e74; font-size:13px; }
.stock-treatment-editor .course-drug small,.stock-treatment-editor .muted-text { color:#526e74; font-size:13px; line-height:1.5; }
.stock-treatment-editor .course-quantity { border-radius:6px; }
.stock-treatment-editor .course-stock-actions { margin:0; }
.stock-treatment-editor .course-period { margin-top:16px; }
.stock-treatment-editor .course-period h3 { font-size:18px; }
.stock-treatment-editor .health-more,.stock-treatment-editor .course-extra { border:0; border-top:1px solid #d9e6e3; border-radius:0; padding:16px 0; margin:0; background:transparent; }
.stock-treatment-editor .course-extra summary { min-height:44px; align-content:center; }
.stock-treatment-editor .health-card-history .treatment-history { border:0; border-top:1px solid #d9e6e3; border-radius:0; padding:16px 0; margin:16px 0; }
.stock-treatment-editor .course-days { max-height:none; overflow:visible; }
.health-record-dialog .stock-treatment-editor .editor-actions { position:sticky; bottom:0; margin:0; padding:16px 0; background:#fff; border-top:1px solid #d9e6e3; z-index:3; }
.stock-treatment-editor .editor-actions button { min-height:44px; border-radius:6px; }
.stock-treatment-editor :is(button,input,select,textarea,summary):focus-visible { outline:2px solid #087579; outline-offset:3px; }
@media(max-width:600px) {
 .health-record-dialog .stock-treatment-editor.health-editor { padding:16px 16px 0; }
 .stock-treatment-editor .health-card-status { float:none; display:flex; width:fit-content; margin-bottom:12px; }
 .stock-treatment-editor .health-card-subject { margin-bottom:4px; }
 .stock-treatment-editor .stock-course .course-drug { grid-template-columns:minmax(0,1fr) 44px; gap:12px; }
 .stock-treatment-editor .stock-course .course-drug>div { grid-column:1; }
 .stock-treatment-editor .stock-course .course-drug>label { grid-column:1; grid-row:2; }
 .stock-treatment-editor .stock-course .course-drug>button { grid-column:2; grid-row:1; }
 .stock-treatment-editor .course-medicine-heading { flex-wrap:wrap; }
 .stock-treatment-editor .course-date-grid { grid-template-columns:minmax(0,1fr); }
 .stock-treatment-editor .editor-actions { gap:8px; }
}
