/* Account pages use the same navigation, colors and compact surfaces as the ECG workspace. */
body { min-width: 0; color: var(--ink, #293340); background: #f6f7fa; }
body, input, select, button { font-family: "Source Sans Pro", -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; }
button, input, select { font-size: 13px; }
button { cursor: pointer; }
button:disabled { opacity: .5; cursor: default; }
a { color: var(--accent, #3972bd); }
button, a, input, select { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible { outline: 2px solid var(--accent, #3972bd); outline-offset: 3px; }
.account-shell { width: min(calc(100% - 40px), 1540px); margin: 20px auto 28px; }
.page-heading { margin-bottom: 16px; }
.page-heading h1 { font-size: 25px; line-height: 1.25; letter-spacing: -.5px; margin: 0 0 7px; font-weight: 650; }
.page-heading p { font-size: 13px; color: var(--muted); margin: 0; }
.page-heading p:empty { display: none; }
#content section, .account-detail { border: 1px solid var(--line); background: var(--surface, #fff); border-radius: 10px; padding: 18px; }
h2 { font-size: 16px; font-weight: 600; letter-spacing: -.2px; margin: 0 0 18px; }
h3 { font-size: 14px; font-weight: 600; margin: 0; }
p { font-size: 13px; line-height: 1.6; }
.muted { color: var(--muted); }
button { border: 1px solid var(--line); border-radius: 6px; min-height: 36px; padding: 7px 12px; background: var(--surface, #fff); color: var(--ink); font-weight: 500; }
button:hover:enabled { background: var(--accent-soft); color: var(--accent); }
button[type=submit], .primary-action, .primary-link { border-color: var(--accent); background: var(--accent); color: #fff; }
button[type=submit]:hover:enabled, .primary-action:hover:enabled, .primary-link:hover { filter: brightness(.95); background: var(--accent); color: #fff; }
.secondary-action { color: var(--accent); background: var(--accent-soft); border-color: transparent; }
.primary-link { display: inline-flex; justify-content: center; align-items: center; border-radius: 6px; padding: 10px 14px; font-size: 13px; text-decoration: none; }
.quiet-button { background: transparent; border-color: transparent; color: var(--muted); }
form { display: grid; gap: 16px; max-width: 440px; }
form > button[type=submit] { justify-self: start; }
label { display: block; font-size: 12px; font-weight: 500; color: var(--ink); }
input:not([type=checkbox]), select { display: block; width: 100%; min-height: 40px; margin-top: 7px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 6px; color: var(--ink); background: var(--surface, #fff); font-size: 13px; }
input:focus, select:focus { border-color: var(--accent); }
input[type=checkbox] { accent-color: var(--accent); width: 16px; height: 16px; }
.toggle-label { display: flex; align-items: center; gap: 10px; line-height: 1.5; }
#message:empty, .form-feedback:empty { display: none; }
#message, .form-feedback { padding: 12px 15px; border: 1px solid #cddff1; border-radius: 7px; background: #edf5fd; color: #275a89; font-size: 13px; line-height: 1.6; overflow-wrap: anywhere; }
#message { margin: 0 0 20px; }
#message[data-error=true], .form-feedback { background: #fff2f2; border-color: #f0d4d4; color: #a03b42; }
.form-feedback { margin: 0; }
.badge { display: inline-flex; align-items: center; padding: 4px 8px; border-radius: 5px; background: var(--surface-soft, #f1f4f8); color: var(--muted); font-size: 11px; font-weight: 500; white-space: nowrap; }
.badge.positive { background: #eaf6f0; color: #287353; }
.badge.role-doctor { background: #edf3fb; color: #3269b2; }
.badge.role-admin { background: #f0edfa; color: #6c50a2; }
.badge.role-patient { background: #eef5f3; color: #4a7767; }
body[data-page=account]:not(.signed-out) .account-shell { max-width: 960px; }
body[data-page=account]:not(.signed-out) #content { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; align-items: start; }
.profile-summary { grid-column: 1 / -1; display: flex; align-items: center; gap: 24px; }
.profile-summary h2 { flex: 1; margin: 0; }
.profile-summary strong { font-size: 14px; overflow-wrap: anywhere; }
#content .account-care-invitation { grid-column: 1/-1; border-color: var(--accent); }
.profile-summary p { margin: 4px 0 0; color: var(--muted); }
.account-profile-details { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 145px), 1fr)); gap: 14px; }
.account-profile-details dt { color: var(--muted); font-size: 12px; }
.account-profile-details dd { margin: 4px 0 0; overflow-wrap: anywhere; }
#content details { margin-top: 20px; }
summary { font-size: 13px; font-weight: 500; cursor: pointer; }
details form { margin-top: 18px; }
pre, code { overflow-wrap: anywhere; white-space: pre-wrap; }
#content img[src^='data:'] { max-width: 200px; width: 100%; }
.signed-out .account-shell { max-width: 420px; margin-top: clamp(24px, 7vh, 70px); }
.signed-out .page-heading { display: none; }
.signed-out #content section { padding: 30px; }
.signed-out .auth-card h2 { font-size: 23px; margin-bottom: 9px; }
.auth-intro { color: var(--muted); margin: 0 0 24px; }
.auth-card form { max-width: none; }
.auth-card form > button[type=submit] { width: 100%; min-height: 42px; margin-top: 2px; }
.auth-card > .secondary-action, .auth-footer .secondary-action { width: 100%; }
.auth-card > .secondary-action { margin-top: 18px; }
.text-action { display: block; margin: 10px auto; border: none; color: var(--accent); background: none; }
.auth-footer { padding-top: 10px; border-top: 1px solid var(--line); margin-top: 20px; text-align: center; }
.auth-footer p { color: var(--muted); margin: 0 0 12px; }
.admin-layout { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(460px, 1fr); align-items: start; gap: 20px; }
.recording-maintenance summary { cursor: pointer; color: var(--muted); }
.recording-maintenance .danger-action { margin-top: 14px; }
#content .accounts-panel { padding: 0; overflow: hidden; }
.panel-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.accounts-panel > .panel-toolbar { padding: 12px 16px; }
.panel-toolbar h2, .panel-toolbar h3 { margin: 0; }
.account-filters { display: flex; flex-wrap: wrap; gap: 8px 12px; padding: 0 16px 12px; border-bottom: 1px solid var(--line); }
.account-filters > label { flex: 0 1 155px; }
.account-filters .search-field { flex: 1 1 220px; }
.table-scroll { overflow-x: auto; }
.accounts-table { border-collapse: collapse; width: 100%; text-align: left; font-size: 12px; }
.accounts-table th { background: var(--surface-soft, #f8fafc); font-size: 11px; color: var(--muted); font-weight: 500; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.accounts-table td { padding: 5px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.accounts-table td:last-child { text-align: center; }
.accounts-table tbody tr { cursor: pointer; }
.account-security { display: inline-flex; align-items: center; vertical-align: middle; color: var(--muted); }
.account-security.enabled { color: var(--accent); }
.accounts-table tr.selected td { background: var(--accent-soft); }
.accounts-table tbody tr:not(.selected):is(:hover, :focus-within) td { background: var(--surface-soft, #f8fafc); }
.account-name { border: none; border-radius: 3px; color: var(--ink); background: transparent; font-weight: 600; text-align: left; padding: 0; min-height: 24px; overflow-wrap: anywhere; }
.accounts-table small { display: block; color: var(--muted); margin-top: 3px; font-size: 11px; overflow-wrap: anywhere; }
.pagination { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; padding: 16px 20px; font-size: 12px; color: var(--muted); }
.pagination > div { display: flex; gap: 6px; }
.pagination button { font-size: 12px; min-height: 32px; }
.empty-state { padding: 38px 24px; text-align: center; color: var(--muted); }
.empty-state strong { color: var(--ink); font-size: 14px; font-weight: 500; }
.empty-state p { margin: 8px 0 0; }
.account-detail { min-width: 0; overflow-wrap: anywhere; scroll-margin-top: 68px; }
.account-detail > .empty-state { padding: 28px 0; }
.detail-heading { display: flex; align-items: start; justify-content: space-between; gap: 10px; }
.detail-heading h2 { margin-bottom: 8px; }
.detail-heading .quiet-button { font-size: 11px; padding: 4px; white-space: nowrap; }
.account-facts {
  display: grid; grid-template-columns: repeat(auto-fit,minmax(min(100%,140px),1fr)); gap: 10px 16px;
  margin: 14px 0 0; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-soft);
  font-size: 12px;
}
.account-facts dt { color: var(--muted); margin-bottom: 3px; }
.account-facts dd { margin: 0; font-weight: 550; overflow-wrap: anywhere; }
.doctor-patients { margin-top: 26px; padding-top: 20px; border-top: 1px solid var(--line); }
.doctor-patients > .search-field { margin: 20px 0 10px; }
.doctor-patients .panel-toolbar { align-items: start; flex-wrap: wrap; }
.doctor-patients .pagination { padding: 16px 0 0; }
.patient-assignment { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); font-size: 12px; }
.patient-assignment > div { min-width: 0; }
.patient-assignment strong { font-weight: 500; overflow-wrap: anywhere; }
.patient-assignment small { display: block; color: var(--muted); margin-top: 5px; }
.admin-dialog { width: min(560px, calc(100% - 32px)); max-height: calc(100dvh - 48px); padding: 0; border: 1px solid var(--line); border-radius: 12px; background: var(--surface, #fff); color: var(--ink); box-shadow: 0 24px 80px #19334d33; }
.admin-dialog::backdrop { background: #172b4266; }
.dialog-heading { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 18px 24px; border-bottom: 1px solid var(--line); }
.dialog-heading h2 { margin: 0; }
.dialog-body { padding: 24px; }
.dialog-body > .muted { margin-top: 0; margin-bottom: 20px; }
.dialog-body form { max-width: none; }
.invitation-result { background: var(--accent-soft); border: 1px solid var(--line); border-radius: 8px; padding: 16px; margin: 16px 0; font-size: 13px; }
.invitation-result label { margin: 14px 0; }
.invitation-result strong { font-weight: 600; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
:root[data-theme=dark] body { background: var(--surface-soft); }
@media (max-width: 1100px) { .admin-layout { grid-template-columns: minmax(0, 1fr); } .account-detail { max-width: none; } }
@media (max-width: 700px) {
  .account-shell { width: calc(100% - 24px); margin-top: 14px; }
  .profile-summary { align-items: start; flex-wrap: wrap; gap: 12px; }
  .profile-summary h2 { flex-basis: 100%; }
  body[data-page=account]:not(.signed-out) #content { grid-template-columns: minmax(0, 1fr); }
  #content section, .account-detail { padding: 18px; }
  .accounts-panel > .panel-toolbar, .account-filters { padding-left: 16px; padding-right: 16px; }
  .page-heading h1 { font-size: 22px; }
  .admin-dialog { max-height: calc(100dvh - 24px); }
}

/* Dense single-line records retain full labels in the detail and title attributes. */
.accounts-table { min-width: 440px; table-layout: fixed; }
.accounts-table th, .accounts-table td { padding: 3px 9px; height: 32px; line-height: 20px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.accounts-table th:nth-child(1) { width: 25%; }
.accounts-table th:nth-child(2) { width: 29%; }
.accounts-table th:nth-child(3) { width: 16%; }
.accounts-table th:last-child { width: 72px; text-align: center; }
body[data-page="administration"] .accounts-table th:last-child { width: 35px; }
.accounts-table .account-name { display: block; max-width: 100%; min-height: 24px; line-height: 24px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.accounts-table .account-name:focus-visible { outline-offset: -2px; }
.accounts-table .badge { max-width: 100%; padding: 2px 6px; line-height: 18px; overflow: hidden; text-overflow: ellipsis; }
.patient-assignment { min-height: 36px; padding: 4px 0; }
.patient-assignment > div { display: flex; align-items: center; gap: 10px; overflow: hidden; white-space: nowrap; }
.patient-assignment strong { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.patient-assignment small { display: inline; flex: none; max-width: 110px; overflow: hidden; text-overflow: ellipsis; margin: 0; white-space: nowrap; }
.patient-assignment button { min-height: 28px; padding: 3px 8px; white-space: nowrap; flex: none; }

.dialog-body > label { margin-bottom: 16px; }

.account-action-section, .account-care { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 14px; }
.account-action-section h3 { margin-bottom: 8px; }
.account-care { padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; }
.account-care > p { margin: 6px 0 2px; }
.account-care .patient-assignment:last-child { border-bottom: 0; padding-bottom: 0; }
.account-care .panel-toolbar { flex-wrap: wrap; }
.account-operations { display: flex; flex-wrap: wrap; gap: 6px; }
.account-operations > button { font-size: 12px; }
.admin-icon {
  width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor;
  stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round;
}
:is(button, a):has(> .admin-icon) { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.dialog-body .doctor-option { min-height: 44px; gap: 12px; }
.dialog-body .doctor-option > div { display: grid; gap: 2px; }
.dialog-body .doctor-option small { max-width: none; text-overflow: ellipsis; }
.dialog-body .doctor-option > span { flex: none; font-size: 11px; }
.dialog-body .search-field + div[aria-busy="true"] { opacity: .6; }
.dialog-body input[readonly] { margin-bottom: 10px; }
.account-detail > .primary-link { margin-top: 12px; }
.account-edit-fields { display: grid; gap: 16px; }
.danger-button { border-color: transparent; color: #a63d47; background: transparent; }
button.danger-action { background: #a63d47; border-color: #a63d47; color: white; }
.assignment-card-options { border: 1px solid var(--line); border-radius: 7px; padding: 16px; margin: 18px 0; }
.assignment-card-options legend { font-size: 13px; padding: 0 6px; }
.assignment-card-options details { margin: 14px 0 0; }
.assignment-card-options details > div { margin-top: 14px; }
.assignment-card-row { padding: 8px 0; }
.assignment-card-options input[type=radio] { accent-color: var(--accent); }
.dialog-body > .toggle-label { margin: 18px 0; }

.registration-profile-fields { border: 0; padding: 0; margin: 4px 0 0; min-width: 0; display: grid; gap: 4px; }
.registration-profile-fields legend { font-size: 14px; font-weight: 600; margin-bottom: 12px; padding: 0; }
.registration-profile-fields label { display: grid; grid-template-columns: 112px minmax(0, 1fr); align-items: center; gap: 10px; min-height: 44px; }
.registration-profile-fields input:not([type=checkbox]), .registration-profile-fields select { min-width: 0; min-height: 36px; margin: 0; padding: 7px 8px; }
.registration-profile-fields p { margin: 8px 0 0; font-size: 12px; }


.accounts-table .account-mobile-email { display: none; }
@media (max-width: 520px) {
  .accounts-table { min-width: 0; }
  .accounts-table :is(th, td):nth-child(2) { display: none; }
  .accounts-table th:first-child { width: 40%; }
  .accounts-table th:nth-child(3) { width: 22%; }
  .accounts-table th:last-child { width: 48px; }
  .accounts-table .account-mobile-email { display: block; margin: 0 0 3px; overflow: hidden; text-overflow: ellipsis; }
  .accounts-table :is(th, td) { padding-inline: 6px; }
  .account-filters > label { flex: 1 1 100px; }
  .account-filters .search-field { flex-basis: 100%; }
}
