/*
 * Copyright (c) 2026 Rodrigo Teti. Todos os direitos reservados.
 * SPDX-License-Identifier: LicenseRef-SUPERIERP-Proprietary
 * Consulte LICENSE e THIRD_PARTY_NOTICES para o escopo e os direitos de terceiros.
 */
@layer reset, base, components, responsive;
@layer reset {
  * {
    box-sizing: border-box;
  }
  body,
  h1,
  h2,
  h3,
  p {
    margin: 0;
  }
  button,
  input,
  select,
  textarea {
    font: inherit;
  }
  button,
  a,
  input,
  select,
  textarea {
    touch-action: manipulation;
  }
  button {
    cursor: pointer;
  }
  a {
    color: inherit;
    text-decoration: none;
  }
  button:disabled {
    opacity: 0.5;
    cursor: wait;
  }
}
@layer base {
  :root {
    --ink: #12302C;
    --muted: #5D7A76;
    --pine: #009090;
    --pine-deep: #007878;
    --mint: #E7F1EF;
    --paper: #F2F8F7;
    --line: #CFE0DD;
    --action: #D5EDEA;
    --action-hover: #C3E6E2;
    --action-ink: #0A4A46;
    --control-border: #7FA5A0;
    --white: #fff;
    --danger: #A63832;
    --radius: 15px;
    --sans: "Aptos", "Trebuchet MS", sans-serif;
    --serif: "Iowan Old Style", Georgia, serif;
  }
  body {
    font-family: var(--sans);
    background: var(--paper);
    color: var(--ink);
    font-size: 14px;
    line-height: 1.5;
  }
  h1,
  h2 {
    font-family: var(--serif);
    font-weight: 400;
    letter-spacing: -0.035em;
  }
  h1 {
    font-size: 38px;
    line-height: 1.2;
  }
  h2 {
    font-size: 25px;
  }
  h3 {
    font-size: 16px;
  }
  small,
  .muted {
    color: var(--muted);
  }
  button {
    border: 0;
    background: transparent;
    color: inherit;
  }
  input,
  select,
  textarea {
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: 9px;
    padding: 10px 12px;
    color: var(--ink);
    min-width: 0;
    max-width: 100%;
  }
  input:focus,
  select:focus,
  textarea:focus {
    outline: 2px solid var(--pine);
    outline-offset: 1px;
  }
  input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--pine);
  }
  label {
    display: grid;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
  }
  textarea {
    min-height: 95px;
    resize: vertical;
  }
  svg {
    width: 19px;
    height: 19px;
    stroke: currentColor;
    stroke-width: 1.7;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex-shrink: 0;
  }
  :focus-visible {
    outline: 2px solid #5d9b75;
    outline-offset: 4px;
  }
  ::selection {
    background: var(--mint);
  }
}
@layer components {
  .loading {
    min-height: 100vh;
    display: grid;
    place-items: center;
  }
  .layout {
    display: grid;
    grid-template-columns: 245px minmax(0, 1fr);
    min-height: 100vh;
  }
  .sidebar {
    background: var(--pine);
    color: #d1dfd7;
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding: 28px 18px 16px;
  }
  .brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 27px;
    font-weight: 650;
    letter-spacing: -1px;
    color: #fff;
    padding: 0 12px 30px;
  }
  .brand-mark {
    display: grid;
    place-items: center;
    width: 35px;
    height: 35px;
    background: var(--mint);
    border-radius: 11px;
    color: var(--pine);
  }
  .brand-mark svg {
    width: 22px;
    height: 22px;
    stroke-width: 2.5;
  }
  .brand span:last-child {
    font-size: 10px;
    letter-spacing: 0.13em;
    background: #28483f;
    border-radius: 4px;
    padding: 3px 6px;
    color: #b8d5bd;
    margin-left: 4px;
  }
  .nav-group {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.17em;
    margin: 19px 13px 7px;
    color: #8fae9d;
  }
  .nav-item {
    display: flex;
    align-items: center;
    gap: 11px;
    width: 100%;
    padding: 10px 13px;
    border-radius: 8px;
    text-align: left;
    font-size: 13px;
    color: #c1d3c7;
    margin: 2px 0;
  }
  .nav-item:hover {
    background: #25463c;
    color: #fff;
  }
  .nav-item.active {
    background: var(--mint);
    color: var(--pine);
    font-weight: 650;
  }
  .sidebar-bottom {
    margin-top: auto;
    padding: 24px 12px 5px;
  }
  .sidebar-note {
    font-size: 11px;
    color: #9eb8a9;
    line-height: 1.6;
  }
  .main {
    min-width: 0;
  }
  .topbar {
    min-height: 81px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    border-bottom: 1px solid var(--line);
    padding: 16px 42px;
    background: #fafbf7;
  }
  .breadcrumb {
    font-size: 12px;
    color: var(--muted);
    display: flex;
    align-items: center;
    gap: 10px;
  }
  .breadcrumb strong {
    color: var(--ink);
    font-weight: 500;
  }
  .user {
    display: flex;
    align-items: center;
    gap: 11px;
  }
  .avatar {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: #e1e8dc;
    font-size: 12px;
    font-weight: 700;
  }
  .user-info strong {
    font-size: 12px;
    display: block;
  }
  .user-info small {
    font-size: 10px;
  }
  .icon-button {
    padding: 7px;
    display: grid;
    place-items: center;
    border-radius: 7px;
  }
  .icon-button:hover {
    background: var(--mint);
  }
  .content {
    padding: 34px 42px 38px;
    max-width: 1700px;
    margin: auto;
  }
  .eyebrow {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: #66806c;
    margin-bottom: 8px;
  }
  .page-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    margin-bottom: 27px;
  }
  .page-heading p {
    color: var(--muted);
    font-size: 13px;
    margin-top: 8px;
  }
  .button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--pine);
    color: white;
    padding: 11px 17px;
    border-radius: 9px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    min-height: 40px;
  }
  .button:hover {
    background: #2c5044;
  }
  .button.secondary {
    background: white;
    border: 1px solid var(--line);
    color: var(--ink);
  }
  .button.secondary:hover {
    background: #eef2e9;
  }
  .button.quiet {
    background: transparent;
    color: var(--ink);
    border: 1px solid var(--line);
  }
  .button.danger {
    background: #f8e9e5;
    color: var(--danger);
  }
  .button.small {
    padding: 6px 10px;
    min-height: 30px;
    font-size: 11px;
  }
  .hero-strip {
    background: #e6eddf;
    border: 1px solid #d7e2ce;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 23px 25px;
    margin-bottom: 24px;
  }
  .hero-strip h2 {
    font-size: 26px;
  }
  .hero-strip p {
    font-size: 12px;
    color: #526e58;
    max-width: 650px;
    margin-top: 5px;
  }
  .hero-art {
    width: 98px;
    height: 74px;
    opacity: 0.8;
    flex-shrink: 0;
  }
  .hero-art svg {
    width: 98px;
    height: 74px;
    stroke-width: 1.1;
  }
  .cards {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 17px;
    margin-bottom: 24px;
  }
  .metric {
    padding: 21px;
    background: white;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    min-height: 142px;
  }
  .metric-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--muted);
    font-size: 11px;
  }
  .metric-icon {
    width: 31px;
    height: 31px;
    border-radius: 9px;
    background: #eff4e9;
    display: grid;
    place-items: center;
    color: #627c58;
  }
  .metric-value {
    font-size: 32px;
    letter-spacing: -0.04em;
    font-weight: 600;
    line-height: 1.3;
    margin-top: 9px;
    font-variant-numeric: tabular-nums;
  }
  .metric small {
    font-size: 10px;
  }
  .dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.8fr) minmax(280px, 1fr);
    gap: 24px;
  }
  .panel {
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 23px;
  }
  .panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    padding: 20px 23px;
    border-bottom: 1px solid var(--line);
  }
  .panel-header h2 {
    font-family: var(--sans);
    font-size: 14px;
    font-weight: 650;
    letter-spacing: 0;
  }
  .panel-header small {
    font-size: 11px;
  }
  .panel-body {
    padding: 23px;
  }
  .text-link {
    font-size: 11px;
    color: #3e7551;
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
  }
  .text-link:hover {
    text-decoration: underline;
  }
  .table-wrap {
    overflow: auto;
  }
  table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 12px;
  }
  th {
    font-size: 10px;
    color: var(--muted);
    font-weight: 600;
    background: #fafbf8;
    white-space: nowrap;
    padding: 12px 19px;
    border-bottom: 1px solid var(--line);
  }
  td {
    padding: 14px 19px;
    border-bottom: 1px solid var(--line);
    max-width: 310px;
    vertical-align: middle;
  }
  tr:last-child td {
    border-bottom: 0;
  }
  tr:hover td {
    background: #fbfcf9;
  }
  td strong {
    font-weight: 600;
  }
  td small {
    display: block;
    font-size: 10px;
    margin-top: 2px;
  }
  .badge {
    font-size: 10px;
    font-weight: 600;
    padding: 4px 9px;
    border-radius: 20px;
    background: #eef1ea;
    color: #637461;
    white-space: nowrap;
    display: inline-block;
  }
  .badge.confirmed,
  .badge.completed,
  .badge.paid {
    background: #e5f2e3;
    color: #3b7447;
  }
  .badge.arrived,
  .badge.in_service {
    background: #E1EDF4;
    color: #41688c;
  }
  .badge.scheduled,
  .badge.open {
    background: #faf0d9;
    color: #926a29;
  }
  .badge.cancelled,
  .badge.no_show {
    background: #f7e7e1;
    color: #a45545;
  }
  .row-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
  }
  .toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    justify-content: space-between;
    margin-bottom: 18px;
    flex-wrap: wrap;
  }
  .search {
    position: relative;
    flex: 1;
    max-width: 390px;
    display: flex;
    align-items: center;
    gap: 9px;
    border: 1px solid var(--line);
    background: white;
    border-radius: 9px;
    padding: 0 12px;
  }
  .search input {
    border: 0;
    padding-left: 0;
    width: 100%;
    background: transparent;
    outline: none;
  }
  .search svg {
    width: 16px;
    color: var(--muted);
  }
  .date-filter {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 12px;
  }
  .empty {
    text-align: center;
    padding: 52px 22px;
    color: var(--muted);
  }
  .empty svg {
    width: 31px;
    height: 31px;
    margin-bottom: 10px;
    color: #7c997a;
  }
  .empty h3 {
    color: var(--ink);
    margin-bottom: 5px;
    font-size: 14px;
  }
  .empty p {
    font-size: 12px;
    margin: 0 auto 16px;
    max-width: 440px;
  }
  .empty .button {
    margin-top: 5px;
  }
  .status-line {
    display: flex;
    justify-content: space-between;
    gap: 15px;
    font-size: 11px;
    margin-top: 17px;
  }
  .status-line:first-child {
    margin-top: 0;
  }
  meter {
    display: block;
    width: 100%;
    height: 9px;
    margin: 7px 0 0;
    border: 0;
    border-radius: 10px;
    background: var(--mint);
  }
  meter::-webkit-meter-bar {
    background: var(--mint);
    border: 0;
    border-radius: 10px;
  }
  meter::-webkit-meter-optimum-value {
    background: #82ab7b;
    border-radius: 10px;
  }
  .notice {
    padding: 14px 16px;
    background: #f8f1e1;
    border: 1px solid #e9dfc8;
    border-radius: 10px;
    color: #7c6539;
    font-size: 12px;
    line-height: 1.6;
    margin: 18px 0;
  }
  .notice.subtle {
    background: #edf2e8;
    border-color: #dfe8d7;
    color: #53694d;
  }
  .footer-note {
    color: #85917e;
    font-size: 10px;
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-top: 25px;
  }
  .activity {
    display: flex;
    gap: 13px;
    align-items: flex-start;
    padding: 14px 0;
    border-bottom: 1px solid var(--line);
  }
  .activity:last-child {
    border: 0;
  }
  .activity .metric-icon {
    flex-shrink: 0;
  }
  .activity strong {
    font-size: 12px;
    display: block;
  }
  .activity p {
    font-size: 11px;
    color: var(--muted);
    margin-top: 3px;
  }
  .pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    padding: 15px 19px;
    font-size: 11px;
    color: var(--muted);
  }
  .pagination div {
    display: flex;
    gap: 8px;
  }
  .mobile-menu {
    display: none;
  }
  .auth-shell {
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-height: 100vh;
  }
  .auth-story {
    background: var(--pine);
    color: #e9f0e6;
    padding: 58px max(45px, 10vw);
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    overflow: hidden;
  }
  .auth-story .brand {
    position: absolute;
    top: 40px;
    left: 45px;
  }
  .auth-story h1 {
    font-size: clamp(45px, 5vw, 75px);
    max-width: 560px;
    line-height: 1.09;
    position: relative;
  }
  .auth-story h1 em {
    color: var(--mint);
    font-style: italic;
  }
  .auth-story p {
    color: #b6cebc;
    max-width: 390px;
    margin-top: 26px;
    font-size: 14px;
  }
  .auth-story .eyebrow {
    color: #a4c5a6;
    margin-bottom: 18px;
  }
  .auth-story-footer {
    position: absolute;
    bottom: 35px;
    left: 55px;
    font-size: 11px;
    color: #97b49c;
  }
  .auth-form-wrap {
    display: grid;
    place-items: center;
    padding: 45px 24px;
  }
  .auth-form {
    width: 100%;
    max-width: 380px;
  }
  .auth-form h2 {
    font-size: 35px;
    margin-bottom: 9px;
  }
  .auth-form > p {
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 28px;
  }
  .auth-form form {
    display: grid;
    gap: 16px;
  }
  .auth-form .button {
    margin-top: 5px;
  }
  .checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-weight: 400;
    font-size: 12px;
  }
  .auth-form-footer {
    font-size: 11px;
    margin-top: 24px;
    color: var(--muted);
  }
  .form-error {
    font-size: 12px;
    color: var(--danger);
    background: #fbebe6;
    border-radius: 7px;
    padding: 10px 12px;
  }
  .form-error:empty {
    display: none;
  }
  dialog {
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 0;
    width: min(720px, calc(100vw - 30px));
    max-height: 90vh;
    color: var(--ink);
    box-shadow: 0 25px 100px #12362935;
  }
  dialog::backdrop {
    background: #102b2759;
    backdrop-filter: blur(3px);
  }
  .modal-header {
    padding: 22px 26px;
    border-bottom: 1px solid var(--line);
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  .modal-header h2 {
    font-size: 26px;
  }
  .modal-form {
    padding: 24px 26px;
  }
  .form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
  }
  .field-wide {
    grid-column: 1/-1;
  }
  .form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 23px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
  }
  .ref-search {
    display: flex;
    gap: 5px;
  }
  .ref-search input {
    font-size: 11px;
    padding: 6px 8px;
    flex: 1;
  }
  .ref-search button {
    font-size: 10px;
    padding: 5px 8px;
    background: #eef3e9;
    border-radius: 6px;
  }
  .read-field {
    padding: 12px;
    background: #f5f7f1;
    border-radius: 8px;
  }
  .read-field strong {
    font-size: 10px;
    display: block;
    color: var(--muted);
    margin-bottom: 4px;
  }
  .read-field p {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    font-size: 13px;
  }
  .source-list {
    display: grid;
    gap: 8px;
  }
  .source-list details {
    border: 1px solid var(--line);
    border-radius: 9px;
    padding: 12px 15px;
    background: var(--white);
  }
  .source-list summary {
    cursor: pointer;
    font-size: 12px;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
  }
  .source-list code {
    font-size: 10px;
    overflow-wrap: anywhere;
  }
  .source-list p {
    font-size: 11px;
    margin-top: 10px;
    color: var(--muted);
  }
  .tagline {
    font-size: 11px;
    display: flex;
    gap: 9px;
    align-items: center;
    color: var(--muted);
    margin-bottom: 20px;
  }
  .dot {
    height: 6px;
    width: 6px;
    border-radius: 50%;
    background: #6e9b6c;
    display: inline-block;
  }
  #toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    max-width: 400px;
    z-index: 10;
    background: var(--pine);
    color: #fff;
    border-radius: 11px;
    padding: 0;
    box-shadow: 0 10px 40px #16352f25;
    transition: transform 0.18s;
    transform: translateY(120px);
    font-size: 13px;
  }
  #toast.visible {
    padding: 14px 20px;
    transform: translateY(0);
  }
  .coverage-number {
    font-family: var(--serif);
    font-size: 35px;
    color: #4c7450;
  }
  .table-note {
    font-size: 11px;
    color: var(--muted);
    padding: 13px 20px;
    border-top: 1px solid var(--line);
  }
}
@layer responsive {
  @media (min-width: 1600px) {
    .content {
      padding-top: 43px;
    }
    .cards {
      gap: 23px;
    }
    .metric {
      padding: 25px;
    }
  }
  @media (max-width: 1150px) {
    .layout {
      grid-template-columns: 215px minmax(0, 1fr);
    }
    .content {
      padding: 28px;
    }
    .topbar {
      padding: 17px 28px;
    }
    .cards {
      grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .dashboard-grid {
      grid-template-columns: 1fr;
    }
    .user-info {
      display: none;
    }
    .metric {
      min-height: 130px;
    }
    .auth-story {
      padding: 65px 45px;
    }
  }
  @media (max-width: 720px) {
    .layout {
      display: block;
    }
    .sidebar {
      display: none;
      position: fixed;
      width: 245px;
      z-index: 5;
      box-shadow: 20px 0 100px #0b25195e;
    }
    .sidebar.open {
      display: flex;
    }
    .mobile-menu {
      display: grid;
    }
    .topbar {
      padding: 13px 18px;
      min-height: 65px;
    }
    .content {
      padding: 24px 16px;
    }
    .page-heading {
      align-items: flex-start;
      gap: 10px;
    }
    .page-heading .button {
      font-size: 11px;
      padding: 10px 12px;
    }
    .page-heading p {
      font-size: 12px;
    }
    h1 {
      font-size: 31px;
    }
    .eyebrow {
      font-size: 9px;
    }
    .hero-strip {
      padding: 19px;
      gap: 10px;
    }
    .hero-strip h2 {
      font-size: 23px;
    }
    .hero-art {
      display: none;
    }
    .cards {
      gap: 11px;
    }
    .metric {
      padding: 16px;
      min-height: 125px;
    }
    .metric-value {
      font-size: 27px;
    }
    .metric-top {
      font-size: 10px;
    }
    .metric-icon {
      width: 27px;
      height: 27px;
    }
    .panel-header {
      padding: 17px;
    }
    .form-grid {
      grid-template-columns: 1fr;
    }
    .field-wide {
      grid-column: auto;
    }
    .modal-form {
      padding: 20px;
    }
    .modal-header {
      padding: 18px 20px;
    }
    .auth-shell {
      display: block;
    }
    .auth-story {
      min-height: 240px;
      padding: 95px 25px 28px;
    }
    .auth-story h1 {
      font-size: 37px;
      max-width: none;
    }
    .auth-story .brand {
      top: 24px;
      left: 25px;
      padding: 0;
    }
    .auth-story p,
    .auth-story-footer,
    .auth-story .eyebrow {
      display: none;
    }
    .auth-form-wrap {
      padding: 33px 23px;
    }
    .auth-form h2 {
      font-size: 30px;
    }
    .footer-note {
      display: block;
    }
    .source-list summary {
      display: block;
    }
    .source-list summary .badge {
      margin-top: 7px;
    }
    .date-filter {
      width: 100%;
      justify-content: space-between;
    }
    .toolbar .search {
      max-width: none;
    }
    #toast {
      left: 16px;
      right: 16px;
      bottom: 16px;
      max-width: none;
    }
  }
  @media (prefers-reduced-motion: reduce) {
    * {
      scroll-behavior: auto !important;
      transition: none !important;
    }
  }
}

.json-edit {
  min-height: 310px;
  font-family: Consolas, monospace;
  font-size: 12px;
  margin-bottom: 16px;
}
.history-json {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 11px;
}
.read-field + .read-field {
  margin-top: 12px;
}

.form-field {
  display: grid;
  gap: 6px;
  align-content: start;
}
.form-field > label {
  font-size: 13px;
  font-weight: 600;
}

/* Minimal, legible workspace: emphasis is reserved for actionable patient alerts. */
.dashboard-grid > * {
  min-width: 0;
}
body {
  font-size: 15px;
  background: var(--paper);
}
h1,
h2 {
  font-family: var(--sans);
  letter-spacing: -0.025em;
}
h1 {
  font-size: 32px;
  font-weight: 650;
}
.eyebrow,
.hero-strip {
  display: none;
}
.sidebar {
  background: var(--white);
  color: #283c34;
  border-right: 1px solid var(--line);
  padding-top: 24px;
}
.brand {
  color: var(--pine);
  font-size: 26px;
  padding-bottom: 23px;
}
.brand span:last-child {
  background: var(--mint);
  color: #4b6353;
}
.nav-group {
  color: #758077;
  font-size: 10px;
  letter-spacing: 0.08em;
}
.nav-item {
  color: #46564a;
  font-size: 14px;
  padding: 11px 12px;
}
.nav-item:hover {
  background: var(--mint);
  color: var(--pine);
}
.nav-item.active {
  background: var(--action);
  color: var(--action-ink);
  font-weight: 700;
}
.sidebar-note {
  color: #6d796e;
}
.topbar {
  background: var(--white);
  min-height: 72px;
}
.content {
  padding-top: 28px;
}
.page-heading p {
  font-size: 14px;
}
.metric,
.panel {
  box-shadow: none;
  border-radius: 10px;
}
.metric {
  min-height: 120px;
}
.metric-top {
  font-size: 12px;
}
.metric small {
  font-size: 12px;
}
.metric-value {
  font-size: 29px;
}
.cards button h3.metric-value {
  font-size: 20px;
}
.panel-header h2 {
  font-size: 16px;
}
table {
  font-size: 14px;
}
th {
  font-size: 12px;
}
td small {
  font-size: 12px;
}
.button {
  font-size: 14px;
  min-height: 44px;
  background: var(--action);
  color: var(--action-ink);
  border: 1px solid var(--control-border);
}
.button:hover {
  background: var(--action-hover);
}
.button.secondary,
.button.quiet {
  background: var(--white);
  color: var(--pine);
  border-color: var(--control-border);
}
.button.secondary:hover,
.button.quiet:hover {
  background: var(--mint);
}
.button.danger {
  background: #fff1ed;
  color: var(--danger);
  border-color: #c6897f;
}
.metric-icon,
.avatar {
  background: #e5f4ec;
  color: var(--pine);
}
.button.small {
  font-size: 12px;
}
input,
select,
textarea {
  min-height: 42px;
  font-size: 15px;
}
label,
.form-field > label {
  font-size: 14px;
}
.form-grid {
  gap: 17px;
}
.badge {
  font-size: 12px;
}
.auth-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--paper);
}
.auth-story {
  padding: 24px;
  min-height: 0;
  background: transparent;
  display: block;
}
.auth-story .brand {
  position: static;
  padding: 0;
  justify-content: center;
}
.auth-story > h1,
.auth-story > p,
.auth-story > .eyebrow,
.auth-story-footer {
  display: none;
}
.auth-form-wrap {
  flex: 1;
  align-items: start;
  padding-top: 24px;
}
.auth-form {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 30px;
  max-width: 440px;
}
.auth-form h2 {
  font-size: 26px;
  font-weight: 650;
}
.auth-form > p {
  font-size: 14px;
}
.auth-form-footer {
  font-size: 12px;
}
.password-control {
  display: flex;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: white;
  align-items: center;
}
.password-control input {
  border: 0;
  flex: 1;
  width: 0;
  background: transparent;
  min-width: 0;
}
.password-toggle {
  font-size: 13px;
  font-weight: 650;
  padding: 10px 12px;
  color: #31523c;
}
.password-control:focus-within {
  outline: 2px solid var(--pine);
  outline-offset: 1px;
}
.password-control input:focus {
  outline: 0;
}
.patient-flags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 6px;
}
.priority-flag,
.observation-flag {
  display: inline-block;
  padding: 3px 6px;
  border: 1px solid #777;
  font-size: 11px;
  font-weight: 700;
  border-radius: 4px;
  white-space: normal;
}
.priority-flag.super-priority {
  border: 2px solid #111;
  color: #000;
}
.observation-flag {
  font-weight: 500;
  background: #f6f6f1;
}
.patient-alerts {
  margin-bottom: 18px;
}
.patient-alerts:empty {
  display: none;
}
.priority-banner {
  border: 1px solid #222;
  border-radius: 7px;
  padding: 12px 15px;
  margin-bottom: 12px;
  background: var(--white);
}
.priority-banner strong {
  display: block;
  font-size: 17px;
  line-height: 1.4;
}
.priority-banner span {
  font-size: 13px;
  display: block;
  margin-top: 3px;
}
.priority-banner.super-priority {
  border: 3px double #111;
}
.priority-banner.super-priority strong {
  font-size: 20px;
}
.patient-observation {
  border: 2px solid #222;
  border-left-width: 6px;
  border-radius: 6px;
  padding: 14px 16px;
  background: var(--white);
}
.patient-observation strong {
  font-size: 13px;
  letter-spacing: 0.025em;
}
.patient-observation p {
  margin-top: 7px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 15px;
  line-height: 1.55;
}
.patient-heading {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.patient-heading h3 {
  font-size: 21px;
}
.patient-heading > span {
  font-size: 12px;
  color: #667064;
}
.patient-tabs {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 19px;
  padding-bottom: 10px;
  flex-wrap: wrap;
}
.patient-tabs button {
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 14px;
  background: #f4f6f1;
}
.patient-tabs button[aria-pressed="true"] {
  background: #233e30;
  color: #fff;
  font-weight: 600;
}
.patient-proof {
  font-size: 12px;
  margin-top: 15px;
  color: var(--muted);
}
.priority-options {
  border: 1px solid var(--line);
  padding: 16px;
  border-radius: 8px;
  margin: 18px 0;
}
.priority-options fieldset {
  border: 0;
  padding: 16px 0 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 13px;
}
.priority-options legend {
  font-size: 13px;
  font-weight: 600;
  padding-top: 13px;
  margin-bottom: 7px;
}
.priority-options input[type="checkbox"],
.checkbox-label input[type="checkbox"] {
  min-height: 18px;
  flex-shrink: 0;
}
.multiselect-options {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 4px 16px;
  width: 100%;
}
.clinical-section {
  border: 1px solid var(--line, #dfe5ea);
  border-radius: 10px;
  padding: 14px 16px 16px;
  margin: 0 0 14px;
  min-width: 0;
}
.sidebar-item-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 2px;
  border-bottom: 1px solid var(--line, #dfe5ea);
}
.sidebar-item-row .checkbox-label { flex: 1; }
.sidebar-icon-field {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85em;
  color: var(--muted, #6b7480);
}
.clinical-section legend {
  font-weight: 700;
  font-size: 0.95em;
  padding: 0 8px;
  color: var(--ink, #1a2230);
}
.clinical-attachments {
  border-top: 1px solid var(--line, #dfe5ea);
  margin-top: 16px;
  padding-top: 12px;
}
.clinical-attachments h3 {
  margin: 0 0 6px;
}
.attachment-list ul {
  list-style: none;
  padding: 0;
  margin: 0 0 10px;
  display: grid;
  gap: 6px;
}
.attachment-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line, #dfe5ea);
  border-radius: 8px;
  padding: 6px 10px;
}
.attachment-list small {
  color: var(--muted, #6b7480);
  margin-left: 10px;
}
.attachment-upload {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.donor-fields {
  padding-top: 18px;
  display: grid;
  gap: 13px;
}
.donor-fields[hidden],
#manual-priority-options[hidden],
#duplicate-confirm[hidden] {
  display: none;
}
.context-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}
.form-patient-context:empty {
  display: none;
}
.form-patient-context {
  margin-bottom: 18px;
}
.wide-modal {
  width: min(940px, calc(100vw - 24px));
}
.print-preview {
  padding: 24px;
  background: #eee;
  overflow: auto;
}
.patient-sheet {
  background: var(--white);
  color: #000;
  font-family: Arial, sans-serif;
  line-height: 1.45;
  padding: 24px;
  max-width: 800px;
  margin: auto;
  font-size: 14px;
}
.sheet-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  border-bottom: 2px solid #000;
  padding-bottom: 12px;
  gap: 20px;
  margin-bottom: 17px;
}
.sheet-header > div:last-child {
  font-size: 11px;
  text-align: right;
}
.sheet-header strong {
  font-size: 17px;
}
.sheet-header h1 {
  font:
    700 20px Arial,
    sans-serif;
  margin-top: 6px;
  color: #000;
}
.sheet-priority {
  border: 2px solid #000;
  padding: 11px 15px;
  margin: 16px 0;
}
.sheet-priority strong {
  font-size: 20px;
  letter-spacing: 0.04em;
}
.sheet-priority p {
  font-size: 13px;
  margin-top: 5px;
}
.sheet-priority.sheet-super {
  border: 5px double #000;
}
.sheet-super strong {
  font-size: 24px;
}
.sheet-patient h2 {
  font:
    bold 23px Arial,
    sans-serif;
  margin: 14px 0;
  text-transform: uppercase;
  color: #000;
}
.sheet-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px 16px;
}
.sheet-grid b {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  margin-bottom: 4px;
}
.sheet-grid p {
  overflow-wrap: anywhere;
}
.sheet-address {
  margin-top: 13px;
}
.sheet-observation {
  border: 3px solid #000;
  border-left-width: 8px;
  padding: 13px 15px;
  margin: 20px 0;
}
.sheet-observation h2,
.sheet-visit h2,
.sheet-check h2 {
  font:
    700 15px Arial,
    sans-serif;
  letter-spacing: 0.02em;
  margin-bottom: 9px;
  color: #000;
}
.sheet-observation p {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 15px;
  line-height: 1.5;
}
.sheet-visit {
  border-top: 1px solid #000;
  padding-top: 15px;
  margin-top: 18px;
}
.sheet-visit > p {
  margin-top: 12px;
}
.sheet-check {
  border-top: 1px solid #000;
  margin-top: 24px;
  padding-top: 14px;
}
.sheet-check p {
  margin-top: 15px;
}
.sheet-footer {
  border-top: 1px solid #888;
  margin-top: 24px;
  padding-top: 10px;
  font-size: 10px;
}
#print-area {
  display: none;
}
.welcome-tour p {
  margin-top: 12px;
  color: #536250;
  font-size: 15px;
}
.tour-panel {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 360px;
  max-width: calc(100vw - 32px);
  padding: 22px;
  background: var(--white);
  border: 2px solid #90bda4;
  border-radius: 12px;
  z-index: 40;
  box-shadow: 0 7px 32px #28664a20;
  max-height: 55dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.tour-panel h2 {
  font-size: 22px;
  font-weight: 650;
  margin: 12px 0;
}
.tour-panel p {
  font-size: 15px;
  line-height: 1.6;
}
.tour-panel .form-actions {
  margin-top: 15px;
  padding-top: 15px;
}
.tour-progress {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: var(--muted);
}
.tour-progress button {
  display: grid;
  place-items: center;
  min-width: 44px;
  min-height: 44px;
}
.tour-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 12px;
  margin-top: 12px;
}
.tour-tools button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 44px;
  padding: 5px 0;
  font-size: 13px;
  color: var(--pine);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.tour-tools [hidden] {
  display: none;
}
.tour-motion-note {
  font-size: 12px;
  color: var(--muted);
}
.tour-target {
  outline: 3px solid var(--pine);
  outline-offset: 5px;
  scroll-margin-top: 90px;
  box-shadow: 0 0 0 6px #d2efdf;
}
.tour-target.tour-pulse {
  animation: tour-halo 1.9s ease-out infinite;
}
@keyframes tour-halo {
  0% {
    box-shadow: 0 0 0 5px #48a67870;
  }
  75%,
  100% {
    box-shadow: 0 0 0 17px #48a67800;
  }
}
.tour-marker {
  position: fixed;
  z-index: 35;
  pointer-events: none;
  background: var(--pine);
  color: #fff;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.06em;
}
.tour-marker::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 16px;
  border: 6px solid transparent;
  border-top-color: var(--pine);
}
.tour-marker.below::after {
  top: auto;
  bottom: 100%;
  border-top-color: transparent;
  border-bottom-color: var(--pine);
}
@media (prefers-reduced-motion: reduce) {
  .tour-target.tour-pulse {
    animation: none;
  }
}
@media (max-width: 720px) {
  body {
    font-size: 15px;
  }
  .sidebar {
    width: 240px;
  }
  .content {
    padding: 24px 15px;
  }
  .auth-story {
    padding: 22px;
  }
  .auth-form-wrap {
    padding: 0 15px 24px;
  }
  .auth-form {
    padding: 24px;
    max-width: 440px;
  }
  .auth-form h2 {
    font-size: 24px;
  }
  .priority-options fieldset {
    grid-template-columns: 1fr;
  }
  .patient-observation {
    padding: 12px;
  }
  .patient-heading h3 {
    font-size: 19px;
  }
  .print-preview {
    padding: 0;
  }
  .patient-sheet {
    padding: 14px;
    font-size: 12px;
  }
  .sheet-header {
    display: block;
  }
  .sheet-header > div:last-child {
    text-align: left;
    margin-top: 10px;
  }
  .sheet-grid {
    grid-template-columns: 1fr 1fr;
  }
  .tour-panel {
    right: 16px;
    bottom: 16px;
  }
  .metric-value {
    font-size: 26px;
  }
  .metric small {
    font-size: 11px;
  }
  .row-actions select {
    max-width: 175px;
  }
}
@page {
  size: A4;
  margin: 14mm;
}
@media print {
  html,
  body {
    margin: 0 !important;
    padding: 0 !important;
    background: #fff !important;
    color: #000 !important;
    height: auto !important;
    overflow: visible !important;
  }
  body > *:not(#print-area) {
    display: none !important;
  }
  body > #print-area {
    display: block !important;
    position: static !important;
    width: auto !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  #print-area * {
    color: #000 !important;
    background: transparent !important;
    box-shadow: none !important;
    text-shadow: none !important;
  }
  .patient-sheet {
    padding: 0 !important;
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    font-size: 12pt;
    line-height: 1.4;
  }
  .sheet-header {
    display: flex !important;
    break-inside: avoid;
    break-after: avoid;
  }
  .sheet-header h1 {
    font-size: 16pt;
  }
  .sheet-header > div:last-child {
    font-size: 9pt;
  }
  .sheet-priority {
    break-inside: avoid;
    break-after: avoid;
  }
  .sheet-priority strong {
    font-size: 17pt;
  }
  .sheet-super strong {
    font-size: 21pt;
  }
  .sheet-priority p {
    font-size: 10pt;
  }
  .sheet-patient h2 {
    font-size: 17pt;
  }
  .sheet-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    break-inside: avoid;
  }
  .sheet-grid b {
    font-size: 9pt;
  }
  .sheet-observation h2 {
    font-size: 12pt;
    break-after: avoid;
  }
  .sheet-observation p {
    font-size: 12pt;
    orphans: 3;
    widows: 3;
  }
  .sheet-observation {
    break-inside: auto;
  }
  .sheet-visit,
  .sheet-check {
    break-inside: avoid;
  }
  .sheet-footer {
    font-size: 8pt;
    break-inside: avoid;
  }
}

.heading-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.ref-search input { min-width: 0; }
[hidden] { display: none !important; }
.form-grid > label, .form-grid > .form-field { align-self: start; min-width: 0; }
@media (max-width: 680px) {
  .page-heading { flex-direction: column; align-items: stretch; }
  .page-heading > .button { align-self: flex-start; max-width: 100%; white-space: normal; }
}
