/* Dashboard templates are scoped to desktop; shared controls remain responsive. */
.auth-toolbar .template-picker { display: flex; flex-direction: row; align-items: center; gap: 8px; flex: 0 1 auto; min-width: 0; margin: 0; }
.auth-toolbar .template-picker select { width: auto; min-width: 90px; min-height: 44px; padding: 8px 10px; border: 1px solid #c8d0dc; border-radius: 8px; background: white; color: #243047; font: inherit; font-size: 14px; }
.auth-toolbar .template-picker select:focus-visible { outline: 3px solid #1677ff; outline-offset: 2px; }
@media (max-width: 600px) {
  .auth-toolbar .template-picker { margin-left: auto; }
  .auth-toolbar .template-picker > span { display: none; }
}
@media (min-width: 1024px) {
  html[data-template="horizontal"] #app-content:has(#machine-list),
  html[data-template="sidebar"] #app-content:has(#machine-list) { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 0; }
  html[data-template="horizontal"] #app-content:has(#machine-list) { grid-template-columns: minmax(230px, 1fr) auto; }
  html:not([data-template="simple"]) #app-content:has(#machine-list) > h1 { grid-column: 1; grid-row: 1; display: flex; align-items: center; gap: 10px; margin: 0; padding: 20px; font-size: 24px; text-align: left; background: #163752; color: white; }
  html:not([data-template="simple"]) #app-content:has(#machine-list) > h1::before { content: ''; display: block; flex-shrink: 0; width: 40px; height: 40px; background: url('/assets/icons/favicon-l3.png') center / contain no-repeat; }
  html:not([data-template="simple"]) #app-content:has(#machine-list) > .auth-toolbar { grid-column: 2; grid-row: 1; margin: 0; padding: 16px 20px; background: #163752; justify-content: flex-end; }
  html:not([data-template="simple"]) #app-content:has(#machine-list) > .auth-toolbar span,
  html:not([data-template="simple"]) #app-content:has(#machine-list) #admin-menu-link { color: white; }
  html[data-template="horizontal"] .desktop-shell { grid-column: 1 / -1; padding: 20px; background: #f5f7fa; }
  html[data-template="horizontal"] #desktop-navigation { justify-content: flex-start; gap: 12px; }
  html[data-template="sidebar"] .desktop-shell { display: contents; }
  html[data-template="sidebar"] #desktop-navigation { grid-column: 1; grid-row: 2; flex-direction: column; justify-content: flex-start; align-items: stretch; gap: 8px; margin: 0; padding: 16px 12px; border: 0; background: #163752; }
  html[data-template="sidebar"] #desktop-navigation button { justify-content: flex-start; padding: 16px 12px; border: 0; border-radius: 10px; color: #d6e5f2; text-align: left; }
  html[data-template="sidebar"] #desktop-navigation button[aria-current="page"] { background: #1677ff; color: white; }
  html[data-template="sidebar"] .dashboard-views { grid-column: 2; grid-row: 2; padding: 24px; background: #f5f7fa; }
  html:not([data-template="simple"]) #desktop-monitor .machine-summary > div { box-shadow: none; border-radius: 12px; }
  html:not([data-template="simple"]) #machine-list { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
  html:not([data-template="simple"]) #machine-list .machine-card { border-radius: 12px; }
}
@media (min-width: 1440px) {
  html:not([data-template="simple"]) #machine-list { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (min-width: 1024px) {
  html:not([data-template="simple"]) #machine-list .machine-card { box-shadow: none; padding: 14px; gap: 8px; }
  html:not([data-template="simple"]) #machine-list .machine-name { font-size: 23px; }
  html:not([data-template="simple"]) #desktop-monitor .machine-filters button[aria-pressed="true"] { background: #1677ff; border-color: #1677ff; }
}

.app-brand-logo { display: inline-block; width: 40px; height: 40px; flex-shrink: 0; object-fit: contain; vertical-align: middle; }
#app-content:has(#machine-list) > h1 { display: flex; align-items: center; justify-content: center; gap: 12px; }
.admin-brand { display: inline-flex; align-items: center; gap: 10px; }
html:not([data-template="simple"]) #app-content:has(#machine-list) > h1::before { display: none; }
@media (max-width: 1023px) { #app-content:has(#machine-list) > h1 { justify-content: flex-start; } }

@media (min-width: 1024px) { html:not([data-template="simple"]) #machine-list .status-normal:has(.machine-illustration) { --machine-accent: #1677ff; } }
@media (min-width: 1024px) { html:not([data-template="simple"]) #app-content:has(#machine-list) > h1 { justify-content: flex-start; } }

.pc-machine-render { display: none; }
@media (min-width: 1024px) {
  html:not([data-template="simple"]) #machine-list .machine-illustration svg { display: none; }
  html:not([data-template="simple"]) #machine-list .pc-machine-render { display: block; width: 100%; height: 100%; object-fit: contain; }
  html:not([data-template="simple"]) #machine-list .machine-illustration { aspect-ratio: 900 / 320; }
  html:not([data-template="simple"]) #desktop-monitor .machine-summary > div:nth-child(1) { background: #edf5ff; border-color: #d9eaff; }
  html:not([data-template="simple"]) #desktop-monitor .machine-summary > div:nth-child(2) { background: #f2fbef; border-color: #e1f2dc; }
  html:not([data-template="simple"]) #desktop-monitor .machine-summary > div:nth-child(3) { background: #fff9e9; border-color: #fff0c7; }
  html:not([data-template="simple"]) #desktop-monitor .machine-summary > div:nth-child(4) { background: #fff1f2; border-color: #ffe0e3; }
}
/* PC B follows the sample: neutral machine, status tint on the card. */
@media (min-width: 1024px) {
  html[data-template="sidebar"] #machine-list .pc-machine-render { filter: grayscale(1); }
  html[data-template="sidebar"] #machine-list .machine-card.status-normal { background: white; }
  html[data-template="sidebar"] #machine-list .machine-card.status-warning { background: #fff9e9; }
  html[data-template="sidebar"] #machine-list .machine-card.status-error { background: #fff1f2; }
}
@media (min-width: 1024px) {
  html[data-template] #desktop-monitor .machine-summary > div:has([aria-pressed="true"]) { border-color: #1677ff; box-shadow: inset 0 0 0 1px #1677ff; }
}
.mobile-template-menu, .mobile-menu-dialog { display: none; }
.mobile-menu-dialog::backdrop { background: rgba(15,35,53,.5); }
@media (max-width: 1023px) {
  html:not([data-template="simple"]) #app-content:has(#machine-list) > h1 { padding: 16px; margin: 0 0 16px; border-radius: 12px; background: #163752; color: white; font-size: 22px; }
  html:not([data-template="simple"]) #desktop-monitor { display: block; margin: 16px 0; }
  html:not([data-template="simple"]) #desktop-monitor .machine-summary { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; margin: 0; }
  html:not([data-template="simple"]) #desktop-monitor .machine-summary > div { position: relative; padding: 12px 14px; border: 1px solid #e0e6ef; border-radius: 12px; background: white; }
  html:not([data-template="simple"]) #desktop-monitor dt { min-height: 20px; }
  html:not([data-template="simple"]) #desktop-monitor dd { position: relative; pointer-events: none; margin: 6px 0 0; font-size: 26px; font-weight: 800; }
  html:not([data-template="simple"]) #desktop-monitor .summary-filter { position: absolute; inset: 0; display: flex; align-items: flex-start; width: 100%; padding: 12px 14px; border: 0; border-radius: inherit; background: transparent; color: #596579; font: inherit; font-size: 13px; text-align: left; cursor: pointer; }
  html:not([data-template="simple"]) #desktop-monitor .machine-summary > div:has([aria-pressed="true"]) { border-color: #1677ff; box-shadow: inset 0 0 0 1px #1677ff; }
  html:not([data-template="simple"]) #summary-normal { color: #237804; }
  html:not([data-template="simple"]) #summary-warning { color: #874d00; }
  html:not([data-template="simple"]) #summary-error { color: #a8071a; }
  html:not([data-template="simple"]) #summary-message { display: block; padding-top: 16px; margin-top: 20px; color: #596579; font-size: 12px; line-height: 1.7; overflow-wrap: anywhere; }
  html:not([data-template="simple"]) #machine-list .machine-illustration { display: block; aspect-ratio: 900 / 320; }
  html:not([data-template="simple"]) #machine-list .machine-illustration svg { display: none; }
  html:not([data-template="simple"]) #machine-list .pc-machine-render { display: block; width: 100%; height: 100%; object-fit: contain; }
  html:not([data-template="simple"]) #machine-list .machine-card { background: white; color: #243047; border-radius: 12px; }
  html:not([data-template="simple"]) #machine-list .machine-name { font-size: 20px; }
  html[data-template="sidebar"] #machine-list .pc-machine-render { filter: grayscale(1); }
  html[data-template="sidebar"] #machine-list .machine-card.status-warning { background: #fff9e9; }
  html[data-template="sidebar"] #machine-list .machine-card.status-error { background: #fff1f2; }
  html[data-template="sidebar"] #desktop-navigation { display: none; }
  html[data-template="sidebar"] .mobile-template-menu { display: inline-block; min-width: 44px; font-size: 22px; }
  .mobile-menu-dialog[open] { display: block; position: fixed; width: min(280px,85vw); height: 100dvh; max-height: 100dvh; max-width: 85vw; inset: 0 auto 0 0; margin: 0; padding: 16px; border: 0; background: #163752; color: white; }
  .mobile-menu-close { display: block; margin-left: auto; min-height: 44px; min-width: 44px; border: 1px solid #ffffff60; border-radius: 8px; background: transparent; color: white; font-size: 26px; }
  html[data-template="sidebar"] .mobile-menu-dialog #desktop-navigation { display: flex; flex-direction: column; gap: 10px; border: 0; margin-top: 20px; background: transparent; }
  html[data-template="sidebar"] .mobile-menu-dialog #desktop-navigation button { flex-direction: row; justify-content: flex-start; padding: 16px; border: 0; border-radius: 10px; color: white; font-size: 15px; }
  html[data-template="sidebar"] .mobile-menu-dialog #desktop-navigation button[aria-current="page"] { background: #1677ff; }
}
@media (max-width: 1023px) {
  html:not([data-template="simple"]) #machine-list .machine-card { grid-template-columns: minmax(0,1fr) auto; grid-template-rows: auto auto auto; gap: 8px; padding: 10px; }
  html:not([data-template="simple"]) #machine-list .machine-name { grid-column: 1; grid-row: 1; text-align: left; }
  html:not([data-template="simple"]) #machine-list .machine-status { grid-column: 2; grid-row: 1; font-size: 11px; padding: 3px 6px; }
  html:not([data-template="simple"]) #machine-list .machine-illustration { grid-column: 1 / -1; grid-row: 2; }
  html:not([data-template="simple"]) #machine-list .machine-mold, html:not([data-template="simple"]) #machine-list .machine-product { grid-column: 1; grid-row: 3; font-size: 12px; }
  html:not([data-template="simple"]) #machine-list .issue-count { grid-column: 2; grid-row: 3; }
  html:not([data-template="simple"]) #desktop-monitor .summary-filter:focus-visible { outline: 3px solid #1677ff; outline-offset: 2px; }
  html:not([data-template="simple"]) #desktop-monitor .summary-filter:disabled { opacity: .5; cursor: default; }
}

/* Keep summary labels and counts on one compact line. */
html[data-template] #desktop-monitor .machine-summary > div {
  display: flex; align-items: center; gap: 12px; padding: 10px 14px;
}
html[data-template] #desktop-monitor .machine-summary dt { flex: 1; min-width: 0; min-height: 0; }
html[data-template] #desktop-monitor .machine-summary .summary-filter,
html[data-template] #desktop-monitor .machine-summary .summary-filter[aria-pressed="true"] {
  position: static; min-height: 28px; padding: 0; align-items: center; line-height: 1.35;
}
html[data-template] #desktop-monitor .machine-summary .summary-filter::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
html[data-template] #desktop-monitor .machine-summary dd { flex: 0 0 auto; margin: 0; font-size: 24px; line-height: 1.2; }
