:root {
  --spark-blue: #0664a8;
  --spark-blue-dark: #05578f;
  --action-blue: #087dd3;
  --action-blue-hover: #086eb9;
  --aqua: #08a7b5;
  --danger: #e33d43;
  --text: #242424;
  --muted: #666a6d;
  --border: #d7d9da;
  --surface: #ffffff;
  --workspace: #f4f5f5;
  --shadow: 0 2px 7px rgba(0, 0, 0, 0.08);
  --font: Arial, Helvetica, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-width: 320px;
  min-height: 100%;
  margin: 0;
}

body {
  color: var(--text);
  background: var(--workspace);
  font-family: var(--font);
  font-size: 14px;
}

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

button,
select {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid rgba(8, 125, 211, 0.32);
  outline-offset: 2px;
}

.spark-app {
  display: flex;
  min-height: 100vh;
  flex-direction: column;
}

/* Header */

.spark-header {
  display: flex;
  min-height: 65px;
  align-items: center;
  padding: 0 25px;
  color: #fff;
  background: var(--spark-blue);
}

.spark-brand {
  display: inline-flex;
  align-items: center;
  color: #fff;
  text-decoration: none;
  white-space: nowrap;
}

.ormco-wordmark {
  position: relative;
  font-size: 33px;
  font-weight: 700;
  letter-spacing: -2px;
  line-height: 1;
}

.trademark {
  position: relative;
  top: -13px;
  font-size: 7px;
  letter-spacing: 0;
}

.brand-separator {
  width: 1px;
  height: 31px;
  margin: 0 10px;
  background: rgba(255, 255, 255, 0.95);
}

.dtx-wordmark {
  font-size: 25px;
  font-weight: 300;
}

.clinic-selector {
  display: inline-flex;
  height: 35px;
  align-items: center;
  gap: 8px;
  margin-left: 25px;
  padding: 0 13px;
  border: 0;
  border-radius: 3px;
  color: #b8d2e5;
  background: rgba(0, 55, 101, 0.32);
}

.building-icon {
  font-size: 17px;
}

.small-caret {
  width: 0;
  height: 0;
  border-top: 4px solid currentColor;
  border-right: 4px solid transparent;
  border-left: 4px solid transparent;
}

.spark-global-nav {
  display: flex;
  height: 65px;
  flex: 1;
  align-items: center;
  justify-content: flex-end;
  gap: 26px;
}

.global-nav-item {
  position: relative;
  display: inline-flex;
  height: 65px;
  align-items: center;
  gap: 8px;
  padding: 0;
  border: 0;
  color: #a9cce3;
  background: transparent;
  white-space: nowrap;
}

.global-nav-item:hover,
.global-nav-item.active {
  color: #fff;
}

.global-nav-item.active::after {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 2px;
  background: #fff;
  content: "";
}

.round-help-icon,
.round-user-icon {
  display: inline-grid;
  width: 15px;
  height: 15px;
  place-items: center;
  border: 1px solid currentColor;
  border-radius: 50%;
  font-size: 9px;
}

.round-user-icon {
  font-size: 5px;
}

.spark-journey-button {
  height: 34px;
  padding: 0 18px;
  border: 0;
  border-radius: 3px;
  color: #fff;
  background: #49c0df;
}

/* Workflow navigation */

.case-navigation {
  display: flex;
  min-height: 66px;
  align-items: center;
  justify-content: space-between;
  padding: 0 35px;
  border-bottom: 1px solid #d5d7d8;
  background: #fff;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.07);
}

.case-navigation h1 {
  margin: 0;
  font-size: 24px;
}

.case-navigation-right {
  display: flex;
  height: 66px;
  min-width: 0;
  align-items: center;
  gap: 24px;
}

.workflow-navigation {
  display: flex;
  height: 100%;
  min-width: 0;
  align-items: center;
  gap: 23px;
  overflow-x: auto;
  scrollbar-width: none;
}

.workflow-navigation::-webkit-scrollbar {
  display: none;
}

.workflow-step {
  position: relative;
  align-self: stretch;
  padding: 0;
  border: 0;
  color: #b3b3b3;
  background: transparent;
  font-size: 16px;
  white-space: nowrap;
}

.workflow-step.active {
  color: var(--action-blue);
}

.workflow-step.active::after {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 2px;
  background: var(--action-blue);
  content: "";
}

.workflow-arrow {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-top: 1px solid #bfc2c4;
  border-right: 1px solid #bfc2c4;
  transform: rotate(45deg);
}

.navigation-divider {
  width: 1px;
  height: 25px;
  background: #e3e4e5;
}

.add-note-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0;
  border: 0;
  color: var(--action-blue);
  background: transparent;
  white-space: nowrap;
}

.add-note-button svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

/* Workspace and cards */

.spark-workspace {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 15px;
  min-height: 650px;
  padding: 23px 25px 40px;
  background: var(--workspace);
}

.patient-card,
.dental-monitoring-sync-card,
.tps-card {
  border: 1px solid #e1e2e3;
  border-radius: 9px;
  background: #fff;
  box-shadow: var(--shadow);
}

.patient-card {
  overflow: hidden;
}

.patient-card > h2 {
  height: 52px;
  margin: 0;
  padding: 17px 16px;
  border-bottom: 1px solid #dedfe0;
  font-size: 16px;
}

#patientForm {
  width: 785px;
  max-width: calc(100% - 32px);
  padding: 16px;
}

.form-row {
  display: grid;
  grid-template-columns: 216px minmax(320px, 552px);
  min-height: 50px;
  align-items: start;
}

.form-row > label,
.form-row > legend {
  padding: 9px 20px 0 0;
  border: 0;
  text-align: left;
  white-space: nowrap;
}

fieldset.form-row {
  padding: 0;
  border: 0;
}

.form-row > legend {
  width: 216px;
  float: left;
}

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

.field-container {
  position: relative;
}

input,
select,
textarea {
  border: 1px solid #c9cbcd;
  border-radius: 3px;
  color: var(--text);
  background: #fff;
}

input,
select {
  width: 100%;
  height: 33px;
  padding: 0 15px;
}

input::placeholder,
textarea::placeholder {
  color: #b5b7b8;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--action-blue);
  outline: none;
  box-shadow: 0 0 0 1px rgba(8, 125, 211, 0.1);
}

input.invalid,
select.invalid {
  border-color: var(--danger);
}

.field-error {
  display: none;
  margin-top: 3px;
  color: var(--danger);
  font-size: 11px;
}

.field-container.has-error .field-error {
  display: block;
}

select {
  padding-right: 35px;
  appearance: none;
}

.select-arrow {
  position: absolute;
  top: 12px;
  right: 17px;
  width: 7px;
  height: 7px;
  border-right: 1px solid #aaaeb0;
  border-bottom: 1px solid #aaaeb0;
  pointer-events: none;
  transform: rotate(45deg);
}

.gender-selector {
  display: inline-flex;
  height: 33px;
}

.gender-button {
  min-width: 77px;
  padding: 0 15px;
  border: 1px solid #c9cbcd;
  background: #fff;
}

.gender-button:first-child {
  border-radius: 3px 0 0 3px;
}

.gender-button:last-child {
  margin-left: -1px;
  border-radius: 0 3px 3px 0;
}

.gender-button.selected {
  position: relative;
  z-index: 1;
  border-color: var(--action-blue);
  color: var(--action-blue);
}

.form-separator {
  width: 100%;
  height: 1px;
  margin: 0 0 16px;
  background: #eef0f1;
}

.identifier-label {
  display: flex;
  align-items: center;
  gap: 8px;
}

.info-button {
  display: inline-grid;
  width: 14px;
  height: 14px;
  padding: 0;
  place-items: center;
  border: 1px solid var(--action-blue);
  border-radius: 50%;
  color: var(--action-blue);
  background: #fff;
  font-size: 9px;
  font-weight: 700;
}

/* Dental Monitoring sync panel */

.dental-monitoring-sync-card {
  display: flex;
  min-height: 80px;
  align-items: center;
  gap: 15px;
  padding: 14px 16px;
}

.sync-button {
  display: inline-flex;
  height: 35px;
  flex: 0 0 auto;
  align-items: center;
  gap: 9px;
  padding: 0 16px;
  border: 0;
  border-radius: 4px;
  color: #fff;
  background: var(--action-blue);
}

.sync-button:hover {
  background: var(--action-blue-hover);
}

.sync-button:disabled {
  cursor: wait;
  opacity: 0.75;
}

.sync-button svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.sync-divider {
  width: 1px;
  height: 42px;
  background: #e1e2e3;
}

.dm-brand-inline {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  font-size: 20px;
  white-space: nowrap;
}

.dm-symbol {
  position: relative;
  display: inline-block;
  width: 23px;
  height: 23px;
  margin-right: 4px;
}

.dm-symbol-left,
.dm-symbol-right {
  position: absolute;
  top: 2px;
  width: 0;
  height: 0;
  border-top: 10px solid transparent;
  border-bottom: 10px solid transparent;
}

.dm-symbol-left {
  left: 0;
  border-right: 13px solid #08a9b4;
}

.dm-symbol-right {
  right: 0;
  border-left: 13px solid #7ed8dc;
}

.dental-monitoring-sync-card p {
  max-width: 880px;
  margin: 0 0 0 5px;
  color: #63676a;
  font-size: 12px;
  line-height: 1.35;
}

/* TPS panel */

.tps-card {
  display: none;
  min-height: 75px;
  align-items: center;
  gap: 20px;
  padding: 15px;
}

.tps-card.prototype-visible {
  display: flex;
}

.tps-heading-area {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-right: 20px;
  border-right: 1px solid #e1e2e3;
}

.tps-heading-area h2 {
  margin: 0;
  font-size: 16px;
  white-space: nowrap;
}

.toggle {
  position: relative;
  width: 41px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: 20px;
  background: #b7b9bb;
}

.toggle span {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  transition: transform 150ms ease;
}

.toggle[aria-checked="true"] {
  background: var(--action-blue);
}

.toggle[aria-checked="true"] span {
  transform: translateX(19px);
}

.tps-card p {
  margin: 0;
  color: var(--muted);
}

.tps-provider {
  margin-left: auto;
}

.tps-provider label {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 11px;
}

.tps-provider select {
  min-width: 220px;
}

/* Actions and footer */

.spark-actions {
  display: flex;
  min-height: 72px;
  align-items: center;
  justify-content: space-between;
  padding: 0 25px;
  border-top: 1px solid #e3e4e5;
  border-bottom: 1px solid #d8dadb;
  background: #fff;
}

.right-actions {
  display: flex;
  gap: 15px;
}

.action-button {
  display: inline-flex;
  height: 40px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 0 17px;
  border-radius: 4px;
  background: #fff;
  font-size: 15px;
}

.cancel-button {
  border: 1px solid #f07b7e;
  color: var(--danger);
}

.save-button {
  border: 1px solid var(--action-blue);
  color: var(--action-blue);
}

.next-button {
  min-width: 95px;
  border: 1px solid var(--action-blue);
  color: #fff;
  background: var(--action-blue);
}

.next-button:hover {
  background: var(--action-blue-hover);
}

.next-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.action-circle {
  display: inline-grid;
  width: 14px;
  height: 14px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: currentColor;
  font-size: 10px;
  line-height: 1;
}

.cancel-button .action-circle {
  color: #fff;
  background: var(--danger);
}

.save-button .action-circle {
  color: #fff;
  background: var(--action-blue);
}

.spark-footer {
  display: grid;
  min-height: 38px;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 25px;
  color: #999c9e;
  background: #fff;
  font-size: 11px;
}

.footer-links {
  display: flex;
  justify-content: flex-end;
  gap: 20px;
}

.footer-link {
  padding: 0;
  border: 0;
  color: var(--action-blue);
  background: transparent;
  font-size: inherit;
}

/* Spark dialogs */

.modal-overlay[hidden] {
  display: none;
}

.modal-overlay {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  padding: 20px;
  place-items: center;
  background: rgba(23, 34, 42, 0.45);
}

.spark-modal {
  width: min(500px, 100%);
  overflow: hidden;
  border-radius: 7px;
  background: #fff;
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.3);
}

.confirmation-modal {
  width: min(440px, 100%);
}

.spark-modal > header,
.spark-modal > footer {
  display: flex;
  min-height: 55px;
  align-items: center;
  padding: 0 20px;
}

.spark-modal > header {
  justify-content: space-between;
  border-bottom: 1px solid #e4e5e6;
}

.spark-modal > header h2 {
  margin: 0;
  font-size: 18px;
}

.spark-modal > footer {
  justify-content: flex-end;
  gap: 10px;
  border-top: 1px solid #e4e5e6;
  background: #fafafa;
}

.modal-content {
  padding: 20px;
}

.modal-content label {
  display: block;
  margin-bottom: 8px;
  font-weight: 700;
}

.modal-content textarea {
  width: 100%;
  min-height: 120px;
  padding: 10px;
  resize: vertical;
}

.modal-content p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.modal-close {
  padding: 4px 8px;
  border: 0;
  color: #666;
  background: transparent;
  font-size: 25px;
}

.character-count {
  margin-top: 4px;
  color: #999;
  font-size: 11px;
  text-align: right;
}

.modal-primary-button,
.modal-secondary-button,
.modal-danger-button {
  min-height: 35px;
  padding: 0 15px;
  border-radius: 3px;
}

.modal-primary-button {
  border: 1px solid var(--action-blue);
  color: #fff;
  background: var(--action-blue);
}

.modal-secondary-button {
  border: 1px solid #bfc2c4;
  color: #555;
  background: #fff;
}

.modal-danger-button {
  border: 1px solid var(--danger);
  color: #fff;
  background: var(--danger);
}

/* Toast */

.toast {
  position: fixed;
  z-index: 150;
  right: 24px;
  bottom: 24px;
  display: flex;
  min-width: 275px;
  max-width: calc(100vw - 48px);
  align-items: center;
  gap: 10px;
  padding: 14px 17px;
  border-radius: 5px;
  color: #fff;
  background: #273740;
  box-shadow: 0 9px 28px rgba(0, 0, 0, 0.25);
  opacity: 0;
  pointer-events: none;
  transform: translateY(15px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

.toast-status-icon {
  display: grid;
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  background: #16a36f;
  font-size: 12px;
  font-weight: 700;
}

/* Responsive behavior */

@media (max-width: 1250px) {
  .spark-global-nav {
    gap: 15px;
  }

  .doctor-menu {
    display: none;
  }

  .workflow-navigation {
    gap: 15px;
  }

  .dental-monitoring-sync-card {
    flex-wrap: wrap;
  }

  .dental-monitoring-sync-card p {
    width: 100%;
    max-width: none;
    margin-left: 0;
  }
}

@media (max-width: 950px) {
  .clinic-selector,
  .global-nav-item:not(.active) {
    display: none;
  }

  .case-navigation {
    display: block;
    padding: 12px 20px 0;
  }

  .case-navigation h1 {
    margin-bottom: 8px;
  }

  .case-navigation-right {
    height: 50px;
  }

  #patientForm {
    width: 100%;
  }

  .form-row {
    grid-template-columns: 190px minmax(0, 1fr);
  }

  .form-row > legend {
    width: 190px;
  }
}

@media (max-width: 650px) {
  .spark-header {
    min-height: 58px;
    padding: 0 15px;
  }

  .ormco-wordmark {
    font-size: 27px;
  }

  .dtx-wordmark {
    font-size: 21px;
  }

  .spark-global-nav {
    height: 58px;
  }

  .global-nav-item.active {
    display: none;
  }

  .spark-journey-button {
    margin-left: auto;
  }

  .case-navigation-right {
    overflow: hidden;
  }

  .navigation-divider,
  .add-note-button {
    flex: 0 0 auto;
  }

  .spark-workspace {
    padding: 15px 12px 25px;
  }

  #patientForm {
    max-width: none;
  }

  .form-row {
    display: block;
    min-height: auto;
    margin-bottom: 15px;
  }

  .form-row > label,
  .form-row > legend {
    display: block;
    width: auto;
    padding: 0 0 6px;
    float: none;
  }

  .gender-selector {
    width: 100%;
  }

  .gender-button {
    flex: 1;
  }

  .dental-monitoring-sync-card {
    align-items: flex-start;
  }

  .sync-divider {
    display: none;
  }

  .sync-button {
    width: 100%;
    justify-content: center;
  }

  .tps-card {
    align-items: flex-start;
    flex-direction: column;
  }

  .tps-heading-area {
    width: 100%;
    padding: 0 0 12px;
    border-right: 0;
    border-bottom: 1px solid #e1e2e3;
  }

  .tps-provider {
    width: 100%;
    margin-left: 0;
  }

  .tps-provider select {
    width: 100%;
  }

  .spark-actions {
    padding: 10px 12px;
  }

  .action-button {
    padding: 0 11px;
    font-size: 13px;
  }

  .spark-footer {
    display: block;
    padding: 13px;
    text-align: center;
  }

  .spark-footer > div + div {
    margin-top: 5px;
  }

  .footer-links {
    justify-content: center;
  }
}
