/* Appointment actions stay in the visit card instead of a hidden table column. */
.drb-schedule-panel:has(.provider-visit-table) { container: provider-visits / inline-size; }
@container provider-visits (max-width: 760px) {
  .drb-schedule-panel:has(.provider-visit-table) .home-table,
  .drb-schedule-panel:has(.provider-visit-table) .dataTables_wrapper {
    overflow: visible;
    min-width: 0;
  }
  .drb-schedule-panel:has(.provider-visit-table) .dataTables_filter {
    float: none;
    text-align: left;
    margin: 0 0 10px;
  }
  .drb-schedule-panel:has(.provider-visit-table) .dataTables_filter label {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
  }
  .drb-schedule-panel:has(.provider-visit-table) .dataTables_filter input {
    flex: 1;
    width: 0;
    min-width: 0;
    margin: 0;
  }
  .drb-portal-root[data-portal-role=provider] #portal-main table.provider-visit-table {
    display: block;
    width: 100% !important;
    min-width: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    overflow: visible;
  }
  .provider-visit-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }
  .provider-visit-table tbody { display: grid; gap: 8px; }
  .provider-visit-table tbody tr {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 5px 8px;
    padding: 10px;
    border: 1px solid #dce5ed;
    border-radius: 12px;
    background: #fff !important;
    box-shadow: none;
  }
  .drb-portal-root[data-portal-role=provider] #portal-main .provider-visit-table td {
    display: block;
    min-width: 0;
    width: auto !important;
    padding: 0 !important;
    border: 0;
    background: transparent;
    font-size: 13px !important;
    line-height: 1.35;
    white-space: normal;
    overflow-wrap: anywhere;
  }
  .provider-visit-table .pvl-avatar { grid-column: 11 / -1; grid-row: 1; justify-self: end; }
  .provider-visit-table .pvl-avatar img { display: block; width: 28px; height: 28px; object-fit: cover; border-radius: 50%; }
  .provider-visit-table .pvl-patient { grid-column: 1 / 11; grid-row: 1; align-self: center; }
  .provider-visit-table .pvl-patient a { font-size: 14px; font-weight: 700; line-height: 1.3; }
  .provider-visit-table .pvl-age { grid-column: 1 / 5; grid-row: 2; }
  .provider-visit-table .pvl-gender { grid-column: 5 / 9; grid-row: 2; }
  .provider-visit-table .pvl-time { grid-column: 1 / -1; grid-row: 3; }
  .provider-visit-table .pvl-mode { grid-column: 9 / -1; grid-row: 2; }
  .provider-visit-table .pvl-claim { grid-column: 1 / -1; }
  .provider-visit-table td[data-label]::before { content: none; }
  .provider-visit-table td.pvl-claim::before {
    content: "Insurance: ";
    color: #627587;
    font-size: 11px;
    font-weight: 600;
  }
  .drb-portal-root[data-portal-role=provider] #portal-main .provider-visit-table td.pvl-actions {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    padding-top: 6px !important;
    border-top: 1px solid #e7edf2;
  }
  .provider-visit-table .pvl-actions .btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-width: 0;
    min-height: 44px;
    margin: 0;
    padding: 7px 6px;
    box-sizing: border-box;
    white-space: normal;
    font-size: 13px;
    line-height: 1.3;
    border: 1px solid #1c5d98;
    border-radius: 9px;
    background: #1c5d98;
    color: #fff !important;
    font-weight: 700;
  }
  .provider-visit-table .pvl-actions .btn.tertiary { background: #ed9b26; border-color: #d98914; color: #30210e !important; }
  .provider-visit-table .pvl-actions .btn:only-child { grid-column: 1 / -1; }
  .provider-visit-table .dataTables_empty { grid-column: 1 / -1; text-align: center; }

}

.ps-agenda { container: provider-agenda / inline-size; }
@container provider-agenda (max-width: 760px) {
  .ps-workspace .ps-appointment { grid-template-columns: max-content minmax(0, 1fr); gap: 6px 10px; padding: 10px; margin-bottom: 8px; border-radius: 12px; }
  .ps-workspace .ps-when { gap: 2px; padding-right: 8px; }
  .ps-workspace .ps-patient { gap: 6px; }
  .ps-workspace .ps-avatar { width: 26px; height: 26px; flex-basis: 26px; border-radius: 8px; }
  .ps-workspace .ps-patient a { line-height: 1.3; }
  .ps-workspace .ps-patient p, .ps-workspace .ps-claim { margin-top: 2px; line-height: 1.3; }
  .ps-workspace .ps-when, .ps-workspace .ps-patient > div { min-width: 0; }
  .ps-workspace .ps-claim { overflow-wrap: anywhere; }
  .ps-workspace .ps-visit-actions {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 4px;
    padding-top: 6px;
    margin-top: 0;
    min-width: 0;
    width: 100%;
    align-items: stretch;
  }
  .ps-workspace .ps-status { justify-self: start; white-space: normal; padding: 2px 6px; line-height: 1.3; }
  .ps-workspace .ps-visit-actions > div {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    min-width: 0;
  }
  .ps-workspace .ps-visit-actions a {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    min-height: 44px;
    padding: 7px 6px;
    font-size: 13px;
    line-height: 1.35;
    text-align: center;
    white-space: normal;
  }
  .ps-workspace .ps-visit-actions a:only-child { grid-column: 1 / -1; }
  .ps-workspace .ps-filters { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); min-width: 0; overflow: visible; }
  .ps-workspace .ps-filters button { min-width: 0; padding-inline: 4px; }
}
/* Shared patient portraits and calmer visit cards. */
.ps-avatar{overflow:hidden;background:#eff5f8;border:1px solid #dce6ec;border-radius:50%;width:52px;height:52px;flex-shrink:0}.ps-avatar img{width:100%;height:100%;object-fit:cover;display:block}.ps-appointment{box-shadow:0 4px 18px #18394b04}.ps-patient>div{min-width:0}.ps-patient a{overflow-wrap:anywhere}.ps-visit-actions a{min-height:44px}.ps-filters button{min-height:44px}
@media(max-width:640px){.ps-patient{gap:12px}.ps-appointment{border-radius:18px!important}.ps-patient a{font-size:17px!important}.ps-when strong{font-size:20px!important}}

/* Keep the full time clear of the portrait, including with enlarged text. */
@container provider-agenda (max-width: 480px) {
  .ps-workspace .ps-appointment { grid-template-columns: minmax(0, 1fr); gap: 12px; padding: 14px; }
  .ps-workspace .ps-when { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; border-right: 0; padding-right: 0; }
  .ps-workspace .ps-when span, .ps-workspace .ps-when small { font-size: 12px; }
  .ps-workspace .ps-when strong { font-size: 18px !important; font-variant-numeric: tabular-nums; }
  .ps-workspace .ps-patient { gap: 10px; align-items: flex-start; }
  .ps-workspace .ps-patient .ps-avatar { display: grid; width: 40px; height: 40px; flex: 0 0 40px; border-radius: 50%; }
  .ps-workspace .ps-patient a { font-size: 17px !important; }
  .ps-workspace .ps-patient p, .ps-workspace .ps-claim { font-size: 12px; }
  .ps-workspace .ps-visit-actions { border-top: 1px solid #e7edf2; padding-top: 10px; gap: 6px; }
}

/* A diagnosis fits the existing metadata line; full text remains in the tooltip and record. */
.ps-workspace .ps-patient>div{flex:1;min-width:0}
.ps-workspace .ps-name-line{display:flex;align-items:center;gap:4px;min-height:32px;margin-top:-5px;margin-bottom:-5px}
.ps-workspace .ps-name-line>a{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;flex:1}
.ps-workspace .ps-visit-meta{display:block;max-width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.ps-workspace .ps-diagnosis{color:#335d7d}
.ps-workspace .ps-open-chevron svg{width:15px;height:15px;vertical-align:middle}
.ps-workspace .ps-refresh-status{min-height:16px;font-size:11px;line-height:1.4;margin:4px 0 12px;color:#60758a}
.ps-workspace--unsigned .ps-heading{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:5px 12px;align-items:center;margin-bottom:4px}
.ps-workspace--unsigned .ps-heading>div:first-child{grid-column:1;grid-row:1;min-width:0}
.ps-workspace--unsigned .ps-eyebrow{display:none}
#portal-main .ps-workspace--unsigned .ps-heading h1{font-size:28px!important;line-height:1.15;margin:0 0 5px}
#portal-main .ps-workspace--unsigned .ps-heading p:not(.ps-eyebrow){max-width:none;width:auto;font-size:12px;line-height:1.4;margin:0}
.ps-workspace--unsigned .ps-heading-actions{display:contents}
.ps-workspace--unsigned .ps-refresh-icon{grid-column:2;grid-row:1;display:grid;place-items:center;min-width:44px;width:44px;min-height:44px;height:44px;padding:10px!important;border-radius:12px!important}
.ps-workspace--unsigned .ps-refresh-icon svg{width:20px;height:20px}
#portal-main .ps-workspace--unsigned .ps-heading-actions :is(.ps-back,.ps-overview){grid-row:2;width:max-content;min-height:36px;padding:6px 0!important;border:0!important;border-radius:0!important;background:transparent!important;box-shadow:none!important;font-size:12px;color:#1660ab!important}
.ps-workspace--unsigned .ps-back{grid-column:1;justify-self:start}
.ps-workspace--unsigned .ps-overview{grid-column:2;justify-self:end}
@media(max-width:640px){#portal-main .ps-workspace--unsigned .ps-heading h1{font-size:25px!important}.ps-workspace--unsigned .ps-heading p:not(.ps-eyebrow){font-size:11px}}
