/* Shared field-service workspace surfaces and control states. */
@media screen {
  body:is([data-portal="office"], [data-portal="technician"], [data-portal="customer"]) {
    --workspace-ink: #17392c;
    --workspace-line: #bdc8c1;
    --workspace-active: #dce9dd;
    --workspace-paper: #f7f8f4;
    background-color: var(--workspace-paper);
  }

  body:is([data-portal="office"], [data-portal="technician"]) > aside {
    background: var(--workspace-paper);
    color: var(--workspace-ink);
    border-inline-end: 1px solid var(--workspace-line);
  }
  body:is([data-portal="office"], [data-portal="technician"]) > aside :is(button, small, .aside-bottom) { color: var(--workspace-ink); }
  body:is([data-portal="office"], [data-portal="technician"]) > aside nav button { background: transparent; }
  body:is([data-portal="office"], [data-portal="technician"]) > aside nav button:is(.active,[aria-current="page"]) { background: var(--workspace-active); }

  body:is([data-portal="office"], [data-portal="technician"], [data-portal="customer"]) :is(.workspace, dialog, .portal-shell, #client-portal-header) {
    --line: #d7dfd8;
    --ink: #17392c;
  }
  body:is([data-portal="office"], [data-portal="technician"], [data-portal="customer"]) :is(.workspace, dialog, .portal-shell, #client-portal-header) :is(button, a.button-link):where(:not(nav *, .service-tile, .training-play)) {
    color: var(--workspace-ink);
    background: white;
    border: 1px solid var(--workspace-line);
    border-radius: 8px;
    box-shadow: none;
  }
  body:is([data-portal="office"], [data-portal="technician"], [data-portal="customer"]) :is(.workspace, dialog, .portal-shell, #client-portal-header) :is(button, a.button-link) {
    &:where(:not(nav *, .service-tile)):hover:enabled { background-color: #edf3ee; color: #17392c; }
    &:is(.primary, [type="submit"]):enabled { background: #164c37; color: white; }
    &:is(.active, .selected, [aria-selected="true"], [aria-pressed="true"], [aria-current="page"]) { background: #dce9dd; color: #17392c; }
    &:is(.danger, .tn-destructive, [data-destructive]) { background: #fff5f3; border-color: #ceaaa4; color: #852d29; }
    &:disabled { background: #eff1ef; color: #666f68; border-color: #d5ddd7; }
    & :is(small, .muted) { color: inherit; }
  }
  body:is([data-portal="office"], [data-portal="technician"], [data-portal="customer"]) :is(.workspace, dialog, .portal-shell) :is(select,textarea,input:not([type]),input:is([type="text"],[type="email"],[type="search"],[type="password"],[type="number"],[type="date"])) {
    color: var(--workspace-ink);
    background-color: white;
    border: 1px solid var(--workspace-line);
    border-radius: 7px;
    max-width: 100%;
  }
  body:is([data-portal="office"], [data-portal="technician"], [data-portal="customer"]) :is(button,a,input,select,textarea,summary):focus-visible {
    outline: 3px solid #558068;
    outline-offset: 2px;
  }
}

@media screen {
  body :is(.workspace, dialog, .portal-shell, #client-portal-header) :is(#history-search button[type="submit"], #portal-search button.primary, #save-template, #owner-profile-save, #tech-save-profile):enabled {
    background: white;
    color: #17392c;
    border: 1px solid #bdc8c1;
    border-radius: 8px;
    box-shadow: none;
  }
  body :is(.workspace, dialog, .portal-shell, #client-portal-header) :is(#history-search button[type="submit"], #portal-search button.primary, #save-template, #owner-profile-save, #tech-save-profile):enabled:hover {
    background: #edf3ee;
    border-color: #70917b;
  }
}

@media screen and (min-width: 801px) {
  #app section[aria-label="Selected property"] + .actions > button[onclick="scan()"]:enabled {
    background: white !important;
    color: var(--workspace-ink, #17392c) !important;
    border-color: var(--workspace-line, #bdc8c1) !important;
  }
  #app section[aria-label="Selected property"] + .actions > button[onclick="scan()"]:enabled:hover {
    background: #edf3ee !important;
  }
}

/* Account actions are also opened before a workspace is selected. */
@media screen {
  #modal:has(.staff-account-actions, .staff-portal-options, .owner-profile-form) {
    box-sizing: border-box;
    width: min(30rem, calc(100% - 24px));
    max-height: 86dvh;
    overflow: auto;
    padding: clamp(16px, 4vw, 24px);
    border: 1px solid #c9d5cc;
    border-radius: 14px;
    color: #17392c;
    background: white;
  }
  #modal :is(.staff-account-actions, .staff-portal-options) {display: grid; grid-template-columns: 1fr; gap: 6px}
  #modal :is(.staff-account-actions, .staff-portal-options, .menu-navigation) button {
    min-height: 44px;
    margin: 0;
    padding: 8px 12px;
    text-align: start;
    justify-content: flex-start;
    background: white;
    color: #17392c;
    border: 1px solid #bdc8c1;
    border-radius: 8px;
  }
  #modal .staff-account-actions #staff-remove-passkeys {color: #852d29; border-color: #ceaaa4}
  #modal :is(.staff-account-actions, .staff-portal-options) button:focus-visible {outline: 3px solid #558068; outline-offset: 1px}
}

@media screen {
  #my-employee-profile section {padding: 12px 0; border-top: 1px solid #d7dfd8}
  #my-employee-profile h3 {margin: 0 0 8px}
  #my-employee-profile dl {display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: 6px 12px; margin: 0}
  #my-employee-profile dd {margin: 0; overflow-wrap: anywhere}
  #my-employee-profile dt {color: #52665a}
  #modal:has(#my-employee-profile) {box-sizing: border-box; width: min(32rem, calc(100% - 24px)); max-height: 86dvh; overflow: auto}
  body.workspace-locked #modal :is(.staff-portal-options,.staff-account-actions) button:not(:disabled):hover {background: #edf3ee}
}

@media screen {
  body[data-portal="office"] :is(#modal :is(.estimate-office-tabs, .scheduling-tabs), #app .topline .section-tabs) button[aria-current] {
    background: white; color: var(--workspace-ink); border: 1px solid var(--workspace-line);
  }
  body[data-portal="office"] :is(#modal :is(.estimate-office-tabs, .scheduling-tabs), #app .topline .section-tabs) button[aria-current="false"]:hover {
    background: #edf3ee;
  }
  body[data-portal="office"] :is(#modal :is(.estimate-office-tabs, .scheduling-tabs), #app .topline .section-tabs) button[aria-current="page"] {
    background: var(--workspace-active); border-color: #51775d;
  }
}
