:root {
  --primary: #004d61;
  --secondary: #348498;
  --accent: #5bd1d7;
  --orange: #ff502f;
  --ink: #17343d;
  --muted: #536d75;
  --line: #dbe6e9;
  --canvas: #f5f8fa;
  --soft: #e7f7f8;
  --radius: 12px;
  font-family:
    Inter,
    system-ui,
    -apple-system,
    "Segoe UI",
    sans-serif;
  color: var(--ink);
  font-size: 16px;
  background: var(--canvas);
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
button,
input,
select,
textarea {
  font: inherit;
}
button,
a,
input,
select,
textarea {
  -webkit-tap-highlight-color: transparent;
}
button {
  background: var(--primary);
  color: #fff;
  border: 1px solid transparent;
  border-radius: 9px;
  padding: 10px 15px;
  min-height: 44px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
}
button:hover {
  background: #063e4c;
}
button:disabled {
  opacity: 0.55;
  cursor: wait;
}
.secondary {
  background: #e9f2f4;
  color: var(--primary);
  border-color: #cbdde2;
}
.secondary:hover {
  background: #d4e9ed;
}
.danger {
  background: #ffede9;
  color: #952715;
}
.danger:hover {
  background: #f9d7cf;
}
a {
  color: var(--primary);
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}
input,
select,
textarea {
  border: 1px solid #a9bfc6;
  border-radius: 8px;
  padding: 10px 12px;
  min-height: 44px;
  background: #fff;
  color: var(--ink);
  width: 100%;
  min-width: 0;
}
textarea {
  resize: vertical;
  line-height: 1.6;
  min-height: 115px;
}
label {
  font-size: 14px;
  font-weight: 600;
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
}
small {
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
}
h1,
h2,
h3,
p {
  margin: 0;
}
h1 {
  font-size: 28px;
  line-height: 1.3;
  letter-spacing: -0.6px;
}
h2 {
  font-size: 22px;
  line-height: 1.4;
}
h3 {
  font-size: 17px;
}
p {
  line-height: 1.6;
}
hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 24px 0;
}
[hidden] {
  display: none !important;
}
.brand-full,
.brand-symbol {
  position: relative;
  display: block;
  overflow: hidden;
  width: 100%;
  aspect-ratio: 1630/495;
}
.brand-full img,
.brand-symbol img {
  position: absolute;
  width: 108.8344%;
  max-width: none;
  height: auto;
  left: -4.908%;
  top: -40.404%;
}
.brand-symbol {
  aspect-ratio: 575/495;
  width: 44px;
  flex: 0 0 44px;
}
.brand-symbol img {
  width: 308.5217%;
  left: -13.913%;
}
.brand-box {
  display: block;
  background: #fff;
  border-radius: 12px;
  padding: 12px;
  margin: 24px 20px 32px;
}
.loading {
  min-height: 100vh;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 20px;
}
.loading .brand-symbol {
  width: 72px;
}
.access {
  padding: 40px 20px;
  min-height: 100vh;
  display: grid;
  place-items: center;
}
.access-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 38px;
  width: min(100%, 460px);
  box-shadow: 0 8px 32px #004d6108;
}
.access-card .brand-full {
  width: 180px;
  margin-bottom: 32px;
}
.access-card h1 {
  font-size: 25px;
}
.access-card > p {
  color: var(--muted);
  margin: 12px 0 24px;
}
.access form {
  display: grid;
  gap: 18px;
  margin-top: 20px;
}
#access-error,
.form-error {
  color: #a12a22;
  margin-top: 12px;
  white-space: pre-line;
}
#shell {
  display: flex;
  min-height: 100vh;
}
#sidebar {
  width: 244px;
  position: fixed;
  inset: 0 auto 0 0;
  background: var(--primary);
  color: #fff;
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow-y: auto;
}
.nav-label {
  font-size: 12px;
  letter-spacing: 1.5px;
  color: #bbd9df;
  margin: 0 28px 12px;
}
#navigation {
  display: grid;
  gap: 5px;
  padding: 0 12px;
}
#navigation a {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #d7e8eb;
  text-decoration: none;
  padding: 12px 16px;
  font-size: 14px;
  border-radius: 9px;
  min-height: 46px;
}
#navigation a:hover {
  background: #ffffff13;
}
#navigation a.current {
  background: var(--accent);
  color: var(--primary);
  font-weight: 700;
}
.nav-icon {
  width: 23px;
  font-size: 20px;
  display: inline-flex;
  justify-content: center;
}
.sidebar-footer {
  margin-top: auto;
  padding: 30px 24px;
  font-size: 13px;
  color: #bce1e5;
  line-height: 1.8;
}
.sidebar-footer small {
  display: block;
  color: #bce1e5;
}
.connection-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  background: #5bd1d7;
  border-radius: 50%;
  margin-right: 6px;
}
.workspace {
  margin-left: 244px;
  width: calc(100% - 244px);
  min-width: 0;
}
.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 28px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  min-height: 78px;
}
.topbar-title {
  font-size: 14px;
  color: var(--muted);
}
.account {
  margin-left: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  font-size: 14px;
}
.account small {
  text-transform: capitalize;
}
.icon-button {
  padding: 8px 12px;
  font-size: 20px;
  background: #e8f1f3;
  color: var(--primary);
  min-width: 44px;
}
#menu-toggle {
  display: none;
}
main {
  padding: 30px 32px;
  max-width: 1680px;
  margin: 0 auto;
  min-height: calc(100vh - 126px);
}
.page-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 26px;
}
.page-heading p:not(.eyebrow) {
  color: var(--muted);
  margin-top: 8px;
  font-size: 14px;
}
.eyebrow {
  font-size: 12px;
  letter-spacing: 1.5px;
  color: var(--secondary);
  font-weight: 700;
  margin-bottom: 8px;
}
.filters {
  padding: 18px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: flex;
  align-items: end;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.filters label {
  flex: 1 1 135px;
}
.filters label.search {
  flex: 2 1 200px;
}
.filters input,
.filters select {
  font-size: 14px;
}
.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 26px;
}
.metric {
  padding: 22px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  min-width: 0;
}
.metric .label {
  color: var(--muted);
  font-size: 14px;
}
.metric strong {
  display: block;
  font-size: 29px;
  line-height: 1.5;
  letter-spacing: -0.5px;
  margin-top: 8px;
  color: var(--primary);
}
.metric small {
  display: block;
}
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 24px 0 16px;
}
.panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: visible;
  margin-bottom: 18px;
}
.list-head,
.record-row {
  display: grid;
  grid-template-columns: minmax(180px, 1.5fr) minmax(130px, 1fr) minmax(
      140px,
      1fr
    ) minmax(100px, 0.8fr) auto;
  align-items: center;
  gap: 16px;
  padding: 18px 20px;
}
.list-head {
  font-size: 12px;
  letter-spacing: 0.6px;
  color: var(--muted);
  text-transform: uppercase;
  background: #f0f5f6;
  border-radius: 12px 12px 0 0;
}
.record-row + .record-row {
  border-top: 1px solid var(--line);
}
.record-row .cell {
  min-width: 0;
  font-size: 14px;
  overflow-wrap: anywhere;
}
.cell strong {
  font-weight: 650;
  display: block;
}
.cell small {
  display: block;
  margin-top: 4px;
}
.cell-label {
  display: none;
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 650;
  padding: 5px 9px;
  border-radius: 6px;
  background: #e6f3f5;
  color: var(--primary);
  white-space: normal;
}
.badge.warning {
  color: #76520b;
  background: #fff3d8;
}
.badge.danger {
  color: #8c2b22;
  background: #fce7e3;
}
.badge.success {
  color: #215542;
  background: #e3f4eb;
}
.actions {
  position: relative;
  justify-self: end;
}
.actions summary {
  list-style: none;
  cursor: pointer;
  border-radius: 8px;
  background: #e9f2f4;
  color: var(--primary);
  font-weight: 600;
  padding: 10px 12px;
  min-height: 44px;
  font-size: 14px;
  white-space: nowrap;
}
.actions summary::-webkit-details-marker {
  display: none;
}
.actions[open] {
  z-index: 150;
}
.action-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 5px);
  min-width: 210px;
  background: white;
  border: 1px solid var(--line);
  box-shadow: 0 8px 24px #102a3220;
  border-radius: 10px;
  padding: 6px;
  display: grid;
  gap: 4px;
  z-index: 160;
}
.action-menu button {
  background: #edf4f6;
  color: var(--primary);
  text-align: left;
  font-size: 14px;
  border-radius: 6px;
  width: 100%;
}
.empty,
.error-panel {
  padding: 42px 24px;
  text-align: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.empty h3,
.error-panel h3 {
  margin-bottom: 8px;
}
.empty p,
.error-panel p {
  color: var(--muted);
  max-width: 560px;
  margin: 0 auto 18px;
}
.error-panel p {
  white-space: pre-line;
}
#pagination {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin: 22px 0;
}
#pagination span {
  margin-right: auto;
  font-size: 14px;
  color: var(--muted);
}
#pagination button {
  background: #e9f2f4;
  color: var(--primary);
  padding: 8px 12px;
}
#pagination button.current {
  background: var(--primary);
  color: #fff;
}
.footer {
  padding: 16px 32px;
  font-size: 12px;
  color: var(--muted);
  border-top: 1px solid var(--line);
}
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: #0c273e66;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal {
  background: #fff;
  border-radius: 16px;
  width: min(100%, 900px);
  max-height: calc(100dvh - 40px);
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px #092f4030;
  min-height: 0;
}
.modal > header {
  padding: 22px 26px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  flex-shrink: 0;
}
.modal > header .eyebrow {
  margin-bottom: 4px;
}
#record-form {
  overflow: auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
#form-fields {
  padding: 24px 26px;
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.wide {
  grid-column: 1/-1;
}
.field > span {
  font-weight: 600;
  font-size: 14px;
}
.field.check {
  flex-direction: row;
  align-items: center;
  gap: 12px;
  background: var(--soft);
  padding: 14px;
  border-radius: 8px;
}
.field.check input {
  width: 20px;
  min-height: 20px;
  order: -1;
  flex-shrink: 0;
}
.lookup {
  display: grid;
  gap: 8px;
}
.lookup small {
  font-weight: 400;
}
.modal footer {
  border-top: 1px solid var(--line);
  padding: 16px 26px;
  background: #f8fafb;
  display: flex;
  gap: 10px;
  align-items: center;
  position: sticky;
  bottom: 0;
  z-index: 1;
}
.modal footer span {
  font-size: 12px;
  color: var(--muted);
  margin-right: auto;
}
#form-error {
  padding: 0 26px 16px;
  margin: 0;
}
#modal-context:not(:empty) {
  padding: 12px 26px;
  background: var(--soft);
  font-size: 14px;
  flex-shrink: 0;
}
.callout {
  padding: 14px 18px;
  border-radius: 9px;
  background: #e9f6f7;
  color: var(--primary);
  font-size: 14px;
  line-height: 1.6;
}
.invoice-line {
  display: grid;
  grid-template-columns: 1fr 100px auto;
  gap: 12px;
  align-items: end;
  border-bottom: 1px solid var(--line);
  padding: 14px 0;
}
.amount {
  font-size: 24px;
  font-weight: 700;
  text-align: right;
  color: var(--primary);
}
.tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 20px 0;
}
.tabs button {
  background: #e8f1f3;
  color: var(--primary);
}
.tabs button.current {
  background: var(--primary);
  color: #fff;
}
.profile-card {
  padding: 24px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.profile-card .identity {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.profile-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-top: 22px;
}
.profile-grid label {
  color: var(--muted);
  font-size: 12px;
}
.profile-grid p {
  font-size: 14px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.clinical-notes {
  padding: 22px;
  display: grid;
  gap: 20px;
}
.clinical-notes p {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 14px;
}
.swal2-container {
  z-index: 3000 !important;
}
.notifyjs-corner {
  z-index: 4000 !important;
  max-width: calc(100vw - 28px);
}
.notifyjs-bootstrap-base {
  font-family: inherit !important;
  white-space: normal !important;
  max-width: 440px;
  padding: 15px 20px !important;
  border-radius: 10px !important;
  box-shadow: 0 6px 20px #102a3218;
  border: 1px solid var(--line) !important;
  background-image: none !important;
  font-size: 14px !important;
  line-height: 1.5 !important;
}
.notifyjs-bootstrap-success {
  background: #e3f4eb !important;
  color: #215542 !important;
}
.notifyjs-bootstrap-error {
  background: #fce7e3 !important;
  color: #8c2b22 !important;
}
.notifyjs-bootstrap-info {
  background: #e6f3f5 !important;
  color: #004d61 !important;
}
.notifyjs-bootstrap-warn {
  background: #fff3d8 !important;
  color: #76520b !important;
}
body.modal-open {
  overflow: hidden;
}
@media (max-width: 1200px) {
  .list-head,
  .record-row {
    grid-template-columns: minmax(160px, 1.5fr) minmax(110px, 1fr) minmax(
        100px,
        1fr
      ) auto;
  }
  .record-row .cell:nth-child(4),
  .list-head span:nth-child(4) {
    display: none;
  }
  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  main {
    padding: 24px;
  }
}
@media (max-width: 900px) {
  #sidebar {
    transform: translateX(-100%);
    transition: transform 0.18s;
  }
  body.menu-open #sidebar {
    transform: translateX(0);
  }
  .workspace {
    width: 100%;
    margin-left: 0;
  }
  #menu-toggle {
    display: block;
  }
  .profile-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 600px) {
  main {
    padding: 22px 16px;
  }
  .topbar {
    padding: 12px 16px;
    gap: 10px;
  }
  .topbar-title {
    display: none;
  }
  .account strong {
    max-width: 130px;
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .topbar .brand-symbol {
    width: 36px;
    flex-basis: 36px;
  }
  .account small {
    font-size: 12px;
  }
  .page-heading {
    align-items: start;
    flex-direction: column;
    gap: 14px;
  }
  h1 {
    font-size: 25px;
  }
  .metrics {
    gap: 10px;
  }
  .metric {
    padding: 16px;
  }
  .metric strong {
    font-size: 24px;
  }
  .filters {
    padding: 14px;
    gap: 10px;
  }
  .list-head {
    display: none;
  }
  .record-row {
    grid-template-columns: 1fr 1fr;
    padding: 18px 16px;
    gap: 14px;
  }
  .record-row .cell:first-child {
    grid-column: 1/-1;
  }
  .record-row .cell:nth-child(4) {
    display: block;
  }
  .cell-label {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 4px;
  }
  .actions {
    grid-column: 1/-1;
    width: 100%;
  }
  .actions summary {
    text-align: center;
  }
  .action-menu {
    width: 100%;
  }
  #pagination {
    justify-content: center;
  }
  #pagination span {
    width: 100%;
    text-align: center;
    margin: 0 0 8px;
  }
  .modal-backdrop {
    padding: 12px;
  }
  .modal {
    max-height: calc(100dvh - 24px);
    border-radius: 12px;
  }
  .modal > header {
    padding: 16px 18px;
  }
  .modal h2 {
    font-size: 20px;
  }
  #form-fields {
    padding: 18px;
  }
  .form-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .wide {
    grid-column: auto;
  }
  .modal footer {
    padding: 12px 18px;
    flex-wrap: wrap;
  }
  .modal footer span {
    flex-basis: 100%;
  }
  .modal footer button {
    flex: 1;
  }
  .invoice-line {
    grid-template-columns: 1fr 84px;
  }
  .invoice-line .remove-line {
    grid-column: 1/-1;
  }
  .profile-grid {
    grid-template-columns: 1fr;
  }
  .profile-card {
    padding: 18px;
  }
  .access-card {
    padding: 26px;
  }
  .footer {
    padding: 16px;
  }
  .tabs {
    gap: 6px;
  }
  .tabs button {
    padding: 8px 10px;
    font-size: 13px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
  }
}
