:root {
  --ink: #172126;
  --muted: #68777d;
  --line: #dce6e3;
  --paper: #f4f7f6;
  --panel: #ffffff;
  --accent: #08705f;
  --accent-dark: #07584c;
  --accent-soft: #e8f4f1;
  --warn: #b45f06;
  --danger: #b42318;
  --ok: #0f7a3a;
  --shadow-sm: 0 1px 2px rgba(23, 33, 38, 0.06), 0 8px 24px rgba(23, 33, 38, 0.06);
  --shadow-md: 0 16px 48px rgba(23, 33, 38, 0.13);
  --radius: 12px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(8, 112, 95, 0.12), transparent 32rem),
    linear-gradient(180deg, #fbfdfc 0%, var(--paper) 42%);
}

.login-screen,
.report-screen {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
  background:
    radial-gradient(circle at 20% 20%, rgba(8, 112, 95, 0.16), transparent 28rem),
    radial-gradient(circle at 80% 10%, rgba(15, 122, 58, 0.10), transparent 24rem),
    #f3f7f6;
}

.login-card,
.report-card {
  display: grid;
  gap: 14px;
  width: min(420px, 100%);
  padding: 28px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow-md);
}

.login-card h1,
.report-card h1 {
  margin: 0;
  font-size: 30px;
  letter-spacing: 0;
}

.report-context {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.report-note {
  color: var(--muted);
  line-height: 1.4;
}

.login-error {
  min-height: 18px;
  margin: 0;
  color: var(--danger);
  font-size: 13px;
  font-weight: 700;
}

.login-message {
  min-height: 18px;
  margin: 0;
  color: var(--ok);
  font-size: 13px;
  font-weight: 700;
}

.login-qr-report {
  display: grid;
  gap: 8px;
  padding: 12px;
  background: var(--accent-soft);
  border: 1px solid #b7d8d1;
  border-radius: 12px;
}

.login-qr-report strong {
  font-size: 14px;
}

.login-qr-report p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.login-qr-actions {
  display: grid;
  gap: 8px;
}

.login-qr-actions .primary-action {
  color: white;
  background: linear-gradient(180deg, #0b806e 0%, var(--accent) 100%);
  border-color: var(--accent);
}

.login-qr-actions .primary-action:hover {
  color: white;
  background: var(--accent-dark);
}

.access-request {
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.access-request summary {
  cursor: pointer;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

.access-request form {
  margin-top: 12px;
}

.demo-login-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  min-height: 42px;
  border: 0;
  border-radius: 10px;
  padding: 0 16px;
  background: linear-gradient(180deg, #0b806e 0%, var(--accent) 100%);
  color: white;
  cursor: pointer;
  font-weight: 800;
  box-shadow: 0 8px 18px rgba(8, 112, 95, 0.18);
  transition: background 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

button:hover {
  background: var(--accent-dark);
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(8, 112, 95, 0.22);
}

button.secondary {
  color: var(--ink);
  background: #f7faf9;
  border: 1px solid var(--line);
  box-shadow: none;
}

a.secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border-radius: 10px;
  padding: 0 16px;
  color: var(--ink);
  background: #f7faf9;
  border: 1px solid var(--line);
  box-shadow: none;
  font-weight: 800;
  text-decoration: none;
}

button.secondary:hover {
  background: var(--accent-soft);
  border-color: #b7d8d1;
}

a.secondary:hover {
  background: var(--accent-soft);
  border-color: #b7d8d1;
}

a.disabled-link {
  pointer-events: none;
  opacity: 0.62;
}

button.mini {
  min-height: 34px;
  padding: 0 10px;
  font-size: 12px;
}

button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 20px 28px;
  background: rgba(255, 255, 255, 0.88);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8), 0 10px 30px rgba(23, 33, 38, 0.05);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.app-header h1,
.workspace h2,
.workspace h3 {
  margin: 0;
}

.app-header h1 {
  font-size: 28px;
  letter-spacing: 0;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.header-actions,
.section-title,
.status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.role-picker {
  min-width: 150px;
  color: var(--muted);
  text-align: left;
}

.user-switcher {
  display: grid;
  gap: 4px;
  min-width: 190px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.user-switcher select {
  min-height: 38px;
  padding: 0 34px 0 12px;
}

.user-chip {
  display: grid;
  gap: 2px;
  min-width: 150px;
  padding: 9px 12px;
  background: #f8fbfa;
  border: 1px solid var(--line);
  border-radius: 999px;
}

.user-chip span {
  color: var(--muted);
  font-size: 12px;
}

.user-chip strong {
  font-size: 13px;
}

.backup-controls {
  display: grid;
  gap: 8px;
}

.backup-controls span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.backup-location {
  display: grid;
  gap: 6px;
  padding: 10px;
  background: #f8fbfa;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.backup-location strong {
  font-size: 13px;
}

.backup-location small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.backup-location form {
  margin: 0;
}

.backup-controls button {
  min-height: 36px;
  font-size: 12px;
}

.sidebar-sub-drawer {
  display: grid;
  gap: 8px;
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfdfc;
  overflow: hidden;
}

.sidebar-sub-drawer > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 44px;
  padding: 10px 12px;
  cursor: pointer;
  list-style: none;
  font-weight: 900;
}

.sidebar-sub-drawer > summary::-webkit-details-marker {
  display: none;
}

.sidebar-sub-drawer > summary::before {
  content: ">";
  color: var(--accent);
  font-size: 12px;
}

.sidebar-sub-drawer[open] > summary::before {
  content: "v";
}

.sidebar-sub-drawer > summary span:first-child {
  margin-right: auto;
}

.sidebar-sub-drawer > summary span:last-child {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--muted);
}

.sidebar-sub-drawer .user-list {
  padding: 0 10px 10px;
}

.user-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.location-list {
  display: grid;
  gap: 8px;
  max-height: 260px;
  margin-top: 10px;
  overflow: auto;
}

.location-editor {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfdfc;
}

.location-editor summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
  font-weight: 800;
}

.location-editor summary span {
  display: grid;
  gap: 2px;
}

.location-editor summary small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.user-list-item {
  display: grid;
  gap: 2px;
  padding: 9px 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.user-list-item span {
  color: var(--muted);
  font-size: 12px;
}

.user-editor summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
}

.user-editor summary span {
  display: grid;
  gap: 2px;
}

.user-editor summary small {
  color: var(--muted);
  font-size: 12px;
}

.user-editor form {
  margin-top: 10px;
}

.current-user-label {
  padding: 3px 7px;
  border-radius: 999px;
  background: #eef6f1;
  color: var(--ok);
  font-size: 11px;
  font-weight: 800;
}

.user-actions,
.record-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.danger-action {
  color: var(--danger);
}

.access-request-title {
  margin-top: 14px;
}

.access-request-item p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.request-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.activity-log-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
  max-height: 340px;
  overflow: auto;
}

.activity-log-item {
  display: grid;
  gap: 4px;
  padding: 9px 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.activity-log-item span {
  color: var(--muted);
  font-size: 11px;
}

.activity-log-item p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.hidden-input {
  display: none;
}

.app-shell {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  min-height: calc(100vh - 86px);
}

.app-shell.no-sidebar {
  grid-template-columns: minmax(0, 1fr);
}

.sidebar {
  padding: 18px;
  background: rgba(239, 245, 243, 0.76);
  border-right: 1px solid var(--line);
}

.sidebar-section {
  margin-top: 14px;
}

.sidebar-work-nav {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

.sidebar-nav-btn {
  width: 100%;
  min-height: 54px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 1px 2px rgba(23, 33, 38, 0.04);
  font-weight: 800;
  text-align: left;
}

.sidebar-nav-btn:hover {
  background: #fff;
  border-color: rgba(14, 129, 110, 0.35);
}

.sidebar-nav-btn.is-active {
  color: var(--ink);
  background: #fff;
  border-color: rgba(14, 129, 110, 0.35);
  box-shadow: inset 4px 0 0 var(--accent), 0 1px 2px rgba(23, 33, 38, 0.04);
}

.sidebar-nav-hint {
  flex: 0 0 auto;
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(14, 129, 110, 0.08);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.sidebar-nav-btn.is-active .sidebar-nav-hint {
  color: #fff;
  background: var(--accent);
}

.quick-add,
.setup-drawer {
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: 0 1px 2px rgba(23, 33, 38, 0.04);
}

.setup-drawer > summary,
.setup-subdrawer > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  color: var(--ink);
  font-size: 15px;
  font-weight: 800;
}

.setup-drawer[open] > summary {
  margin-bottom: 14px;
}

.setup-subdrawer {
  margin-top: 10px;
  padding: 12px;
  background: #fbfcfb;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.setup-subdrawer > summary {
  font-size: 14px;
}

.setup-subdrawer > summary span:last-child {
  display: inline-grid;
  place-items: center;
  min-width: 26px;
  height: 26px;
  border-radius: 999px;
  background: var(--panel);
  color: var(--muted);
  font-weight: 800;
}

.setup-subdrawer[open] > summary {
  margin-bottom: 12px;
}

.admin-tools-drawer > .setup-drawer {
  margin-top: 10px;
  background: #fbfcfb;
}

.admin-tools-drawer > .setup-drawer > summary {
  font-size: 14px;
}

.section-title {
  margin-bottom: 12px;
}

.inline-section-title {
  margin: 4px 0 0;
}

.section-title h2,
.section-title h3 {
  font-size: 18px;
}

.section-title span {
  display: inline-grid;
  place-items: center;
  min-width: 28px;
  height: 28px;
  border-radius: 999px;
  background: var(--panel);
  color: var(--muted);
  font-weight: 700;
}

.section-title .panel-title-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  height: auto;
  padding: 0;
  border-radius: 0;
  background: transparent;
}

.history-title-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.history-title-actions span {
  display: inline-grid;
  place-items: center;
  min-width: 28px;
  height: 28px;
  border-radius: 999px;
  background: var(--panel);
  color: var(--muted);
  font-weight: 700;
}

.drawer-count {
  display: inline-grid;
  place-items: center;
  min-width: 28px;
  height: 28px;
  border-radius: 999px;
  background: var(--panel);
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.stack,
.pm-form {
  display: grid;
  gap: 12px;
}

.compact-form {
  gap: 10px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  color: var(--ink);
  background: var(--panel);
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

input:focus,
select:focus,
textarea:focus,
button:focus-visible,
summary:focus-visible {
  outline: 0;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(8, 112, 95, 0.14);
}

textarea {
  resize: vertical;
}

.filters {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr) minmax(260px, 1.2fr);
  gap: 12px;
  padding: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.global-search-field {
  position: relative;
}

.global-search-results {
  position: absolute;
  z-index: 30;
  top: calc(100% + 8px);
  right: 0;
  left: 0;
  display: grid;
  gap: 8px;
  max-height: min(430px, 70vh);
  overflow: auto;
  padding: 12px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 18px 48px rgba(15, 35, 32, 0.18);
}

.search-results-title {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.global-search-result {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 12px;
  color: var(--text);
  text-align: left;
  background: #f7fbfa;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.global-search-result:hover,
.global-search-result:focus-visible {
  background: #eef8f5;
  border-color: rgba(8, 112, 95, 0.36);
}

.global-search-result strong,
.global-search-result small {
  display: block;
}

.global-search-result small {
  margin-top: 3px;
  color: var(--muted);
}

.global-search-result em {
  flex: 0 0 auto;
  padding: 5px 8px;
  color: var(--accent);
  font-size: 11px;
  font-style: normal;
  font-weight: 800;
  background: #e6f6f1;
  border-radius: 999px;
}

.workspace {
  display: grid;
  align-content: start;
  gap: 18px;
  padding: 22px;
}

.work-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
}

.work-header h2 {
  margin: 4px 0 0;
  font-size: 20px;
}

.new-action-bar {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.work-create-drawer {
  position: absolute;
  z-index: 45;
  top: calc(100% + 10px);
  right: 0;
  width: min(440px, calc(100vw - 44px));
  max-height: min(680px, 76vh);
  overflow: auto;
  margin: 0;
  background: #ffffff;
  box-shadow: 0 18px 48px rgba(15, 35, 32, 0.18);
}

.work-create-drawer:not([open]) {
  display: none;
}

.work-create-drawer summary {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #ffffff;
}

.work-create-drawer form {
  padding: 0 14px 14px;
}

.asset-import-drawer {
  margin: 0 14px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8fbfa;
}

.asset-import-drawer summary {
  padding: 12px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
}

.asset-import-body {
  display: grid;
  gap: 10px;
  padding: 0 12px 12px;
}

.asset-import-hint {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.inline-check {
  display: flex;
  flex-direction: row;
  gap: 8px;
  align-items: center;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

.inline-check input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--accent);
}

.asset-import-preview {
  display: grid;
  gap: 6px;
  max-height: 150px;
  overflow: auto;
}

.asset-import-preview div {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.choice-field {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfdfc;
}

.choice-field legend {
  padding: 0 4px;
  color: var(--muted);
  font-weight: 800;
}

.choice-field label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  font-weight: 800;
}

.new-action-bar .service-request-create-drawer {
  margin: 0;
  background: #ffffff;
}

.dashboard-panel,
.empty-state,
.asset-panel,
.work-orders-panel,
.asset-table-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
}

.dashboard-panel {
  display: grid;
  grid-template-columns: minmax(180px, 0.8fr) minmax(0, 2.2fr);
  gap: 14px;
  padding: 18px;
  align-items: center;
}

.panel-heading,
.panel-title-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.panel-heading {
  min-width: 0;
}

.panel-toggle {
  flex: 0 0 auto;
}

.clickable-panel-title {
  cursor: pointer;
  user-select: none;
}

.collapsible-panel.is-collapsed [data-panel-body] {
  display: none !important;
}

.dashboard-panel.is-collapsed {
  grid-template-columns: 1fr;
}

.dashboard-panel.is-collapsed .panel-heading {
  width: 100%;
}

.dashboard-panel h2 {
  margin: 4px 0 0;
  font-size: 22px;
}

.asset-register-drawer {
  overflow: hidden;
}

.asset-register-drawer > summary {
  cursor: pointer;
  list-style: none;
}

.asset-register-drawer > summary::-webkit-details-marker {
  display: none;
}

.drawer-title {
  position: relative;
}

.drawer-toggle-label,
.panel-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: #f7faf9;
  font-size: 12px;
  font-weight: 900;
}

.section-title .drawer-toggle-label,
.section-title .panel-toggle {
  display: inline-flex;
  height: auto;
  min-width: 0;
}

.drawer-toggle-label::before {
  content: "Show";
}

.asset-register-drawer[open] .drawer-toggle-label::before {
  content: "Hide";
}

.dashboard {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.metric-card {
  display: grid;
  gap: 4px;
  min-height: 92px;
  padding: 16px;
  border: 1px solid var(--line);
  border-top-width: 4px;
  border-left-width: 1px;
  border-radius: 14px;
  background: linear-gradient(180deg, #ffffff 0%, #fbfdfc 100%);
  color: var(--ink);
  text-align: left;
  box-shadow: none;
}

.metric-card:hover {
  background: #f7fbfa;
  border-color: #c8dad5;
}

.metric-static {
  cursor: default;
}

.metric-static:hover {
  background: linear-gradient(180deg, #ffffff 0%, #fbfdfc 100%);
  border-color: var(--line);
  transform: none;
}

.metric-card span {
  font-size: 26px;
  font-weight: 800;
}

.metric-card p {
  margin: 4px 0 0;
  color: var(--muted);
  font-weight: 800;
}

.metric-menu-wrap {
  position: relative;
  min-width: 0;
}

.metric-menu-wrap .metric-card {
  width: 100%;
}

.metric-dropdown {
  position: absolute;
  z-index: 20;
  top: calc(100% + 8px);
  left: 0;
  right: auto;
  width: min(360px, calc(100vw - 32px));
  display: grid;
  gap: 6px;
  padding: 8px;
  border: 1px solid #b8cbc5;
  border-top: 4px solid var(--accent);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 16px 34px rgba(23, 33, 38, 0.18);
}

.metric-dropdown.is-right-aligned {
  left: auto;
  right: 0;
}

.metric-dropdown button,
.metric-dropdown-item {
  justify-content: flex-start;
  width: 100%;
  border-color: #c8dad5;
  background: #ffffff;
  color: var(--ink);
  font-weight: 850;
  text-align: left;
}

.metric-dropdown button:hover,
.metric-dropdown-item:hover {
  background: #eaf3f0;
  border-color: var(--accent);
}

.metric-dropdown-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 54px;
  padding: 10px 12px;
}

.metric-dropdown-item span {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.metric-dropdown-item strong,
.metric-dropdown-item small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric-dropdown-item small,
.metric-dropdown-empty,
.metric-dropdown-more {
  color: var(--muted);
}

.metric-dropdown-item em {
  flex: 0 0 auto;
  padding: 5px 9px;
  border-radius: 999px;
  background: #e6f4ef;
  color: var(--accent-strong);
  font-style: normal;
  font-size: 12px;
  font-weight: 800;
}

.metric-dropdown-empty,
.metric-dropdown-more {
  margin: 0;
  padding: 10px 12px;
  font-weight: 700;
}

.metric-warn {
  border-top-color: var(--warn);
}

.metric-danger {
  border-top-color: var(--danger);
}

.metric-ok {
  border-top-color: var(--ok);
}

.metric-neutral {
  border-top-color: var(--accent);
}

.empty-state {
  padding: 36px;
}

.empty-state p {
  max-width: 620px;
  color: var(--muted);
}

.asset-panel {
  display: grid;
  gap: 22px;
  padding: 22px;
}

.asset-panel.is-collapsed {
  gap: 0;
}

.asset-panel-body {
  display: grid;
  gap: 22px;
}

.work-orders-panel {
  padding: 14px;
}

.pm-calendar-body {
  display: grid;
  gap: 14px;
  padding-top: 10px;
}

.pm-calendar-toolbar {
  display: grid;
  grid-template-columns: minmax(120px, 180px) minmax(150px, 220px) minmax(220px, 1fr);
  gap: 12px;
  align-items: end;
}

.pm-calendar-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.pm-calendar-summary {
  display: grid;
  grid-template-columns: minmax(220px, auto) 1fr auto;
  gap: 12px;
  align-items: center;
  color: var(--muted);
  font-weight: 800;
}

.pm-calendar-summary strong {
  color: var(--ink);
  font-size: 15px;
}

.pm-calendar-list {
  display: grid;
  gap: 14px;
}

.pm-calendar-month-wrap {
  display: grid;
  gap: 10px;
}

.pm-calendar-month-grid-wrap {
  overflow-x: auto;
  padding-bottom: 2px;
}

.pm-calendar-month-grid {
  min-width: 920px;
  display: grid;
  grid-template-columns: repeat(7, minmax(120px, 1fr));
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 12px 24px rgba(15, 32, 39, 0.06);
}

.pm-calendar-weekday {
  padding: 8px 10px;
  border-right: 1px solid var(--line);
  background: #f4f9f7;
  color: var(--ink);
  font-size: 12px;
  font-weight: 900;
}

.pm-calendar-weekday:nth-child(7n) {
  border-right: 0;
}

.pm-calendar-cell {
  min-height: 96px;
  padding: 7px;
  border-top: 1px solid var(--line);
  border-right: 1px solid var(--line);
  background: #fbfdfc;
  position: relative;
  display: grid;
  align-content: start;
  gap: 6px;
}

.pm-calendar-cell:nth-child(7n) {
  border-right: 0;
}

.pm-calendar-cell.is-outside {
  background: #f7faf9;
  color: #94a3ad;
}

.pm-calendar-cell.is-today {
  box-shadow: inset 0 0 0 2px rgba(10, 124, 108, 0.25);
}

.pm-calendar-cell-date {
  position: absolute;
  top: 6px;
  right: 8px;
  font-size: 12px;
  font-weight: 900;
  color: var(--muted);
}

.pm-calendar-cell-items {
  display: grid;
  gap: 4px;
  padding-top: 18px;
}

.pm-calendar-task {
  width: 100%;
  min-height: 24px;
  padding: 4px 7px;
  border: 0;
  border-radius: 6px;
  box-shadow: none;
  text-align: left;
  font-size: 12px;
  font-weight: 900;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pm-calendar-task:hover {
  filter: brightness(0.96);
  transform: none;
}

.pm-calendar-task-success {
  background: #0f8a61;
  color: #fff;
}

.pm-calendar-task-warning {
  background: #f6d75a;
  color: #172126;
}

.pm-calendar-task-danger {
  background: #c43d3d;
  color: #fff;
}

.pm-calendar-task-info {
  background: #2b83ba;
  color: #fff;
}

.pm-calendar-more {
  padding: 3px 6px;
  border-radius: 6px;
  background: #eef5f2;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.pm-calendar-day {
  display: grid;
  gap: 8px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.pm-calendar-day-heading,
.pm-calendar-item {
  display: grid;
  grid-template-columns: minmax(180px, 1.1fr) minmax(180px, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.pm-calendar-day-heading h3 {
  margin: 0;
  font-size: 16px;
}

.pm-calendar-day-heading span {
  grid-column: 3;
  color: var(--muted);
  font-weight: 900;
}

.pm-calendar-items {
  display: grid;
  gap: 6px;
}

.pm-calendar-item {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfdfc;
  color: var(--ink);
  text-align: left;
  box-shadow: none;
}

.pm-calendar-item:hover {
  border-color: var(--accent);
  background: #eef7f4;
}

.pm-calendar-item span {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.pm-calendar-item strong,
.pm-calendar-item small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pm-calendar-item small {
  color: var(--muted);
  font-weight: 800;
}

.pm-calendar-item em {
  justify-self: end;
  padding: 5px 9px;
  border-radius: 999px;
  background: #e6f4ef;
  color: var(--accent-strong);
  font-size: 12px;
  font-style: normal;
  font-weight: 900;
  white-space: nowrap;
}

.pm-calendar-key-section {
  display: grid;
  gap: 10px;
}

.pm-calendar-key-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.pm-calendar-key-heading h3 {
  margin: 0;
  font-size: 16px;
}

.pm-calendar-key-heading span {
  color: var(--muted);
  font-weight: 900;
}

.pm-calendar-equipment-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.pm-calendar-equipment-card {
  width: 100%;
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfdfc;
  color: var(--ink);
  text-align: left;
  box-shadow: none;
}

.pm-calendar-equipment-card:hover {
  border-color: var(--accent);
  background: #eef7f4;
  transform: none;
}

.pm-calendar-equipment-thumb {
  width: 54px;
  height: 44px;
  border-radius: 8px;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: #eef5f2;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.pm-calendar-equipment-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.pm-calendar-equipment-main {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.pm-calendar-equipment-main strong,
.pm-calendar-equipment-main small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pm-calendar-equipment-main small {
  color: var(--muted);
  font-weight: 800;
}

.pm-calendar-mini-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.pm-calendar-mini-chip {
  padding: 3px 7px;
  border-radius: 999px;
  background: #e6f4ef;
  color: var(--accent-strong);
  font-size: 11px;
  font-style: normal;
  font-weight: 900;
}

.pm-calendar-card-action {
  color: var(--muted);
  font-size: 20px;
  font-weight: 900;
}

.service-request-create-drawer {
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfdfc;
}

.service-request-create-drawer summary {
  cursor: pointer;
  padding: 12px 14px;
  font-weight: 800;
}

.service-request-create-drawer form {
  padding: 0 14px 14px;
}

.asset-table-panel {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.asset-tools {
  display: grid;
  grid-template-columns: minmax(220px, 2fr) repeat(4, minmax(112px, 1fr)) minmax(260px, auto);
  gap: 10px;
  align-items: end;
}

.table-actions,
.table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.table-actions {
  justify-content: flex-end;
}

.table-actions button {
  white-space: nowrap;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: white;
}

.asset-table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
  font-size: 13px;
}

.asset-table th,
.asset-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.asset-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f3f8f6;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.asset-table tbody tr {
  cursor: pointer;
}

.asset-table tbody tr:hover,
.asset-table .selected-row {
  background: #f0f8f5;
}

.asset-table td strong,
.asset-table td span {
  display: block;
}

.asset-table td span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.asset-table th:last-child,
.asset-table td:last-child {
  width: 86px;
  text-align: right;
}

.asset-table th:first-child,
.asset-table td:first-child {
  width: 72px;
  text-align: center;
}

.select-cell input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--accent);
}

.table-edit-btn {
  min-width: 58px;
}

.empty-cell {
  color: var(--muted);
  text-align: center;
}

.hidden {
  display: none;
}

.asset-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 176px;
  gap: 18px;
  align-items: start;
  padding: 18px;
  background:
    linear-gradient(135deg, rgba(8, 112, 95, 0.08), rgba(255, 255, 255, 0) 48%),
    #f8fbfa;
  border: 1px solid var(--line);
  border-radius: 16px;
}

.selected-asset-summary {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
}

.asset-thumb {
  display: grid;
  place-items: center;
  width: 86px;
  height: 86px;
  overflow: hidden;
  background: #eef6f3;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-align: center;
  cursor: pointer;
}

.asset-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

#selectedMeta {
  color: var(--muted);
}

.selected-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 26px;
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

.badge-danger {
  background: #fff1ef;
  border-color: #f2b8b1;
  color: var(--danger);
}

.badge-warn {
  background: #fff7e8;
  border-color: #f0d6a8;
  color: var(--warn);
}

.badge-ok {
  background: #eef8f1;
  border-color: #b8dfc4;
  color: var(--ok);
}

.badge-muted {
  background: #eef3f1;
  border-color: var(--line);
  color: var(--muted);
}

.qr-box {
  display: grid;
  place-items: center;
  width: 176px;
  height: 176px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: white;
  box-shadow: 0 10px 28px rgba(23, 33, 38, 0.08);
}

.qr-box img {
  width: 156px;
  height: 156px;
}

.status-row {
  display: flex;
  align-items: end;
  gap: 12px;
  flex-wrap: wrap;
  padding: 16px;
  background: #f8fbfa;
  border: 1px solid var(--line);
  border-radius: 16px;
}

.status-tile {
  min-width: 120px;
}

.next-pm-form {
  display: grid;
  grid-template-columns: minmax(150px, 180px) auto auto;
  gap: 8px;
  align-items: end;
}

.next-pm-form input {
  min-height: 36px;
  padding: 7px 10px;
}

.asset-drawer-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}

.asset-primary-grid {
  display: grid;
  grid-template-columns: minmax(320px, 1.1fr) minmax(300px, 0.9fr);
  gap: 16px;
  align-items: start;
}

.asset-details,
.pm-form {
  padding: 16px;
  background: #f8fbfa;
  border: 1px solid var(--line);
  border-radius: 16px;
}

.asset-sub-drawer {
  overflow: hidden;
  background: #f8fbfa;
  border: 1px solid var(--line);
  border-radius: 16px;
}

.asset-sub-drawer summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  cursor: pointer;
  list-style: none;
}

.asset-sub-drawer summary::-webkit-details-marker {
  display: none;
}

.asset-sub-drawer summary h3 {
  margin: 0;
}

.asset-sub-drawer > .pm-form {
  margin: 0 16px 16px;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
}

.asset-sub-drawer.asset-details {
  padding: 0;
}

.asset-sub-drawer.asset-details > :not(summary) {
  margin-right: 16px;
  margin-left: 16px;
}

.asset-detail-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
}

.asset-sub-drawer.asset-details > :last-child {
  margin-bottom: 16px;
}

.asset-sub-drawer > .history-title-actions,
.asset-sub-drawer > .history-list,
.asset-sub-drawer > .work-order-list {
  margin-right: 16px;
  margin-left: 16px;
}

.asset-sub-drawer > .history-list,
.asset-sub-drawer > .work-order-list {
  margin-bottom: 16px;
}

.asset-history-actions {
  justify-content: flex-end;
  margin-bottom: 12px;
}

.asset-photo-panel {
  margin-bottom: 12px;
}

.asset-photo-card {
  display: grid;
  grid-template-columns: minmax(130px, 180px) minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  margin: 0;
  padding: 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
}

.photo-open-button {
  display: block;
  width: 100%;
  min-height: 0;
  padding: 0;
  overflow: hidden;
  background: transparent;
  border: 0;
}

.photo-open-button:hover {
  background: transparent;
}

.asset-photo-card img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.asset-photo-card figcaption,
.asset-photo-empty {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.asset-photo-card figcaption span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.asset-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 112px));
  gap: 10px;
}

.asset-gallery-item {
  display: grid;
  gap: 6px;
  width: 100%;
  min-height: 0;
  padding: 8px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  box-shadow: none;
}

.asset-gallery-item:hover {
  background: #f0f7f4;
}

.asset-gallery-item img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 9px;
}

.asset-gallery-item span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.thumb-grid {
  grid-template-columns: repeat(auto-fill, 96px);
}

.asset-gallery-panel {
  padding: 12px;
  background: #f8fbfa;
  border: 1px solid var(--line);
  border-radius: 14px;
}

.asset-gallery-panel p {
  margin: 0;
}

.inline-status {
  min-height: 18px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.asset-manual-panel {
  margin-bottom: 12px;
}

.asset-manual-card {
  display: grid;
  gap: 8px;
  padding: 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
}

.manual-link {
  display: grid;
  gap: 3px;
  padding: 8px;
  background: #f8fbfa;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  text-decoration: none;
}

.manual-link:hover {
  background: #f0f7f4;
}

.manual-link span {
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.manual-link-muted span a {
  color: var(--accent);
  font-weight: 800;
}

.asset-photo-empty {
  padding: 10px;
  background: var(--panel);
  border: 1px dashed var(--line);
  border-radius: 14px;
}

.photo-viewer {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 12px;
  place-items: center;
  padding: 20px;
  background: rgba(12, 20, 17, 0.9);
}

.photo-viewer.hidden {
  display: none;
}

.photo-viewer img {
  max-width: 100%;
  max-height: 82vh;
  object-fit: contain;
  border-radius: 14px;
}

.photo-viewer p {
  margin: 0;
  color: white;
  font-weight: 700;
  text-align: center;
}

.photo-viewer-close {
  justify-self: end;
  background: white;
  color: var(--ink);
}

.contractor-picker {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(23, 33, 38, 0.42);
}

.contractor-picker-card {
  width: min(560px, 100%);
  max-height: min(720px, 92vh);
  overflow: auto;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
  box-shadow: 0 24px 70px rgba(23, 33, 38, 0.28);
}

.contractor-picker-card h2 {
  font-size: 18px;
}

.contractor-picker-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.contractor-choice {
  display: grid;
  justify-items: start;
  gap: 4px;
  width: 100%;
  min-height: 58px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  text-align: left;
}

.contractor-choice:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.contractor-choice span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.contractor-manual-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
  margin-top: 16px;
}

.asset-info-editor {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.asset-info-editor summary {
  cursor: pointer;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

.asset-info-editor form {
  margin-top: 12px;
}

.details-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.details-grid div {
  min-height: 58px;
  padding: 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.details-grid strong {
  display: block;
  margin-top: 4px;
  overflow-wrap: anywhere;
}

.label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.pm-form {
  padding-top: 8px;
}

.checklist-fields {
  display: grid;
  gap: 10px;
}

.check-row {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  font-weight: 600;
  background: white;
}

.check-row input {
  width: 18px;
}

.check-row button {
  justify-self: end;
  white-space: nowrap;
}

.checklist-add-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.history-list {
  display: grid;
  gap: 10px;
}

.history-item,
.work-order-item {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fbfdfc;
  box-shadow: 0 1px 2px rgba(23, 33, 38, 0.04);
}

.history-item header,
.work-order-item header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  font-weight: 800;
}

.history-item p,
.work-order-item p {
  margin: 0;
  color: var(--muted);
}

.work-order-content {
  display: grid;
  gap: 12px;
  margin: 14px 0;
}

.ticket-meta-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(150px, 1fr));
  gap: 10px;
  max-width: 980px;
}

.ticket-meta-card,
.ticket-note-block {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.78);
  padding: 10px 12px;
}

.ticket-meta-card span,
.ticket-note-block > span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.ticket-meta-card strong {
  display: block;
  overflow-wrap: anywhere;
}

.ticket-note-block {
  max-width: 980px;
}

.ticket-note-block p {
  color: var(--ink);
  line-height: 1.5;
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.pm-history-record {
  display: block;
}

.pm-history-record summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  list-style: none;
  font-weight: 800;
}

.pm-history-record summary::-webkit-details-marker {
  display: none;
}

.pm-history-record summary small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.history-open-label {
  display: inline-grid;
  place-items: center;
  min-width: 48px;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: white;
  font-size: 12px;
  font-weight: 900;
}

.pm-history-record[open] .history-open-label {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: #b7d8d1;
}

.history-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.history-detail-grid div,
.history-checklist,
.history-notes,
.history-evidence {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
}

.history-detail-grid strong,
.history-checklist strong,
.history-notes strong,
.history-evidence strong {
  display: block;
  color: var(--ink);
}

.history-checklist,
.history-notes,
.history-evidence {
  margin-top: 10px;
}

.history-checklist ul {
  margin: 8px 0 0;
  padding-left: 18px;
  color: var(--muted);
}

.history-checklist li + li {
  margin-top: 4px;
}

.history-photo-button {
  display: block;
  width: fit-content;
  min-height: 0;
  margin-top: 8px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.history-photo-button:hover {
  background: transparent;
  box-shadow: none;
}

.ticket-photo-gallery {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 12px 0;
}

.ticket-photo-card {
  width: 132px;
  padding: 0;
  text-align: left;
}

.ticket-photo-card .history-photo {
  width: 132px;
  height: 96px;
  margin-top: 0;
}

.ticket-photo-card span {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.work-order-list {
  display: grid;
  gap: 10px;
}

.ticket-filter-bar {
  display: flex;
  align-items: end;
  justify-content: flex-start;
  gap: 12px;
  padding: 0 14px 12px;
}

.ticket-filter-bar label {
  width: min(460px, 100%);
  margin: 0;
}

.ticket-filter-bar select {
  min-height: 40px;
}

.issue-group-drawer {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  overflow: hidden;
}

.issue-group-drawer > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 56px;
  padding: 12px 14px;
  cursor: pointer;
  list-style: none;
  font-weight: 900;
}

.issue-group-drawer > summary::-webkit-details-marker {
  display: none;
}

.issue-group-drawer > summary small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.issue-group-count {
  min-width: 30px;
  border-radius: 999px;
  padding: 5px 10px;
  background: var(--accent-soft);
  color: var(--accent);
  text-align: center;
  font-weight: 900;
}

.issue-group-drawer > .work-order-list {
  padding: 0 14px 14px;
}

.work-order-item header span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.work-order-item header .assigned-label {
  color: var(--accent);
  font-weight: 800;
}

.work-order-drawer {
  display: block;
}

.work-order-drawer > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  list-style: none;
  font-weight: 900;
}

.work-order-drawer > summary::-webkit-details-marker {
  display: none;
}

.work-order-drawer > summary strong {
  display: block;
}

.work-order-drawer > summary span:not(.history-open-label) {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.work-order-drawer > summary .assigned-label {
  color: var(--accent);
  font-weight: 850;
}

.work-order-drawer[open] > summary {
  margin-bottom: 8px;
}

.work-order-drawer[open] > summary .history-open-label {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: #b7d8d1;
}

.work-order-header-actions {
  display: flex;
  justify-content: flex-end;
  margin: 8px 0;
}

.work-order-assignment {
  display: grid;
  gap: 5px;
  max-width: 360px;
  margin: 10px 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.work-order-assignment select {
  min-height: 38px;
}

.assigned-readonly {
  margin: 10px 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.work-order-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.inline-edit-drawer {
  flex: 1 1 100%;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8fbfa;
}

.inline-edit-drawer summary {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  margin: 8px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font-weight: 850;
  cursor: pointer;
  user-select: none;
}

.inline-edit-drawer summary::-webkit-details-marker {
  display: none;
}

.inline-edit-form {
  padding: 0 12px 12px;
}

.service-request-audit {
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.service-request-audit summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 42px;
  padding: 0 12px;
  cursor: pointer;
  list-style: none;
  font-weight: 900;
}

.service-request-audit summary::-webkit-details-marker {
  display: none;
}

.service-request-audit summary span:last-child {
  display: inline-grid;
  place-items: center;
  min-width: 28px;
  min-height: 28px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
}

.service-request-audit-list {
  display: grid;
  gap: 8px;
  padding: 0 12px 12px;
}

.service-request-audit-entry {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8fbfa;
}

.service-request-audit-entry strong,
.service-request-audit-entry span {
  display: block;
}

.service-request-audit-entry span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.service-request-audit-entry p {
  margin-top: 6px;
}

.history-photo {
  display: block;
  width: min(180px, 100%);
  max-height: 180px;
  object-fit: cover;
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.muted {
  color: var(--muted);
}

.status-ok {
  color: var(--ok);
}

.status-warn {
  color: var(--warn);
}

.status-danger {
  color: var(--danger);
}

.label-sheet {
  display: none;
}

@media (max-width: 1380px) {
  .app-shell {
    grid-template-columns: minmax(260px, 300px) minmax(0, 1fr);
  }

  .sidebar {
    padding: 14px;
  }

  .quick-add,
  .setup-drawer {
    padding: 10px;
    border-radius: 10px;
  }

  .setup-drawer > summary,
  .setup-subdrawer > summary {
    font-size: 14px;
  }

  .setup-drawer > summary {
    min-height: 36px;
  }

  .workspace {
    gap: 14px;
    padding: 18px;
  }

  .filters {
    grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr);
  }

  .global-search-field {
    grid-column: 1 / -1;
  }

  .work-header {
    align-items: stretch;
    flex-direction: column;
  }

  .new-action-bar {
    justify-content: stretch;
  }

  .new-action-bar > button {
    flex: 1 1 180px;
  }

  .dashboard-panel {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .dashboard {
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  }

  .metric-card {
    min-height: 82px;
    padding: 14px;
  }

  .metric-card span {
    font-size: 24px;
  }

  .metric-dropdown {
    position: absolute;
    width: min(360px, calc(100vw - 32px));
    margin-top: 0;
  }

  .pm-calendar-toolbar {
    grid-template-columns: minmax(120px, 1fr) minmax(150px, 1fr);
  }

  .pm-calendar-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }

  .pm-calendar-equipment-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1120px) {
  .app-shell {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .admin-tools-drawer {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  }

  .admin-tools-drawer > .setup-drawer {
    margin-top: 0;
  }
}

@media (max-width: 840px) {
  html,
  body {
    max-width: 100%;
    overflow-x: hidden;
  }

  body {
    font-size: 14px;
  }

  .app-header,
  .header-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .app-header {
    position: static;
    gap: 12px;
    padding: 14px;
  }

  .app-header h1 {
    font-size: 24px;
  }

  .eyebrow {
    font-size: 11px;
  }

  .header-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    width: 100%;
  }

  .user-switcher,
  .role-picker,
  .user-chip {
    min-width: 0;
    width: 100%;
  }

  .user-chip {
    border-radius: 14px;
  }

  #logoutBtn {
    width: 100%;
  }

  .app-shell {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 10px 12px;
  }

  .sidebar-section {
    margin-top: 8px;
  }

  .quick-add,
  .setup-drawer {
    padding: 10px;
    border-radius: 12px;
  }

  .ticket-meta-grid {
    grid-template-columns: 1fr;
  }

  .asset-heading,
  .asset-drawer-row,
  .asset-primary-grid,
  .form-grid,
  .next-pm-form,
  .details-grid,
  .history-detail-grid,
  .asset-tools,
  .dashboard-panel,
  .dashboard,
  .pm-calendar-toolbar,
  .pm-calendar-summary,
  .pm-calendar-day-heading,
  .pm-calendar-item,
  .filters {
    grid-template-columns: 1fr;
  }

  .pm-calendar-month-grid {
    min-width: 760px;
  }

  .pm-calendar-equipment-grid {
    grid-template-columns: 1fr;
  }

  .workspace {
    gap: 12px;
    padding: 12px;
  }

  .filters {
    gap: 10px;
    padding: 10px;
  }

  .pm-calendar-actions {
    grid-column: auto;
  }

  .pm-calendar-actions button {
    flex: 1 1 140px;
  }

  .pm-calendar-day-heading span,
  .pm-calendar-item em {
    grid-column: auto;
    justify-self: start;
  }

  label {
    font-size: 12px;
  }

  input,
  select,
  textarea {
    min-width: 0;
    padding: 9px 10px;
    font-size: 14px;
  }

  button,
  a.secondary {
    min-height: 38px;
    padding: 0 12px;
    font-size: 14px;
  }

  .global-search-results {
    position: fixed;
    z-index: 60;
    top: 96px;
    right: 12px;
    left: 12px;
    max-height: min(70vh, 520px);
  }

  .work-header {
    align-items: stretch;
    flex-direction: column;
    gap: 12px;
    padding: 12px;
    border-radius: 14px;
  }

  .work-header h2 {
    font-size: 20px;
  }

  .new-action-bar {
    display: grid;
    grid-template-columns: 1fr;
    justify-content: stretch;
  }

  .new-action-bar button {
    flex: 1 1 100%;
  }

  .work-create-drawer {
    position: fixed;
    top: 12px;
    right: 0;
    left: 0;
    width: calc(100vw - 24px);
    max-height: calc(100vh - 24px);
    margin: 0 auto;
  }

  .dashboard-panel {
    gap: 12px;
    padding: 12px;
    border-radius: 14px;
  }

  .dashboard-panel h2 {
    font-size: 20px;
  }

  .dashboard {
    gap: 8px;
  }

  .metric-card {
    min-height: 72px;
    padding: 12px;
  }

  .metric-card span {
    font-size: 24px;
  }

  .panel-heading,
  .panel-title-actions {
    align-items: flex-start;
  }

  .asset-table-panel,
  .work-orders-panel,
  .asset-panel,
  .empty-state {
    border-radius: 14px;
  }

  .work-order-item,
  .history-item {
    padding: 12px;
    border-radius: 12px;
  }

  .work-order-drawer > summary {
    align-items: flex-start;
  }

  .work-order-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .work-order-actions button,
  .work-order-actions .secondary,
  .work-order-actions .primary {
    width: 100%;
  }

  .asset-photo-card {
    grid-template-columns: 1fr;
  }

}

@media print {
  body > :not(.label-sheet) {
    display: none !important;
  }

  .label-sheet {
    display: grid;
    grid-template-columns: repeat(2, 3.5in);
    gap: 0.25in;
    padding: 0.25in;
    background: white;
  }

  .print-label {
    position: relative;
    display: grid;
    grid-template-columns: 1.35in minmax(0, 1fr);
    gap: 0.15in;
    align-items: center;
    min-height: 1.25in;
    padding: 0.12in;
    border: 1px solid #222;
    color: #111;
    page-break-inside: avoid;
  }

  .print-label > div {
    padding-bottom: 0.15in;
  }

  .print-label img {
    width: 1.35in;
    height: 1.35in;
  }

  .print-label strong,
  .print-label span {
    display: block;
  }

  .print-label .label-brand {
    position: absolute;
    right: 0.12in;
    bottom: 0.08in;
    color: #08705f;
    font-size: 9px;
    font-weight: 900;
    letter-spacing: 0.04em;
    text-transform: uppercase;
  }

  .print-label strong {
    font-size: 12px;
    line-height: 1.15;
  }

  .print-label span {
    font-size: 10px;
  }
}
