.database-access { --db-border: #dce1e8; --db-muted: #596879; --db-accent: #245b7b; }
.db-discovery { max-width: 820px; margin: 0 auto; }
.db-setup-progress { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 0 0 24px; padding: 0; list-style: none; }
.db-setup-progress > li { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; min-width: 0; padding: 12px 8px; border-bottom: 3px solid var(--db-border); color: var(--db-muted); font-size: 14px; line-height: 1.4; overflow-wrap: anywhere; }
.db-setup-progress .db-step-number { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; flex: 0 0 28px; border: 1px solid var(--db-border); border-radius: 50%; background: var(--surface); font-size: 13px; font-weight: 700; }
.db-setup-progress > li[aria-current="step"] { border-color: var(--db-accent); color: var(--db-accent); font-weight: 700; }
.db-setup-progress > li[aria-current="step"] .db-step-number { border-color: var(--db-accent); background: #e9f2f7; box-shadow: 0 0 0 3px var(--surface-muted); }
.db-setup-progress > li[data-complete="true"] .db-step-number { border-color: #8dc6a2; background: #eaf8ef; color: #23643c; }
.db-setup-intro, .db-setup-summary { min-width: 0; padding: 18px 20px; border: 1px solid var(--db-border); border-radius: 10px; background: var(--surface); overflow-wrap: anywhere; }
.db-setup-intro { border-inline-start: 3px solid var(--db-accent); background: var(--surface-muted); }
.db-setup-intro h3, .db-setup-summary h3, .db-setup-summary h4 { margin: 0 0 8px; }
.db-setup-intro p, .db-setup-summary p { margin: 6px 0; line-height: 1.5; }
.db-setup-intro > :first-child, .db-setup-summary > :first-child { margin-top: 0; }
.db-setup-intro > :last-child, .db-setup-summary > :last-child { margin-bottom: 0; }
.db-setup-summary dl { display: grid; grid-template-columns: minmax(100px, 1fr) minmax(0, 2fr); gap: 8px 16px; margin: 12px 0 0; }
.db-setup-summary dt { color: var(--db-muted); }
.db-setup-summary dd { min-width: 0; margin: 0; }
.db-help { display: inline; font-size: 13px; font-weight: 400; line-height: 1.5; }
.db-help > summary { display: inline-flex; align-items: center; justify-content: center; width: 30px; min-height: 30px; margin-inline-start: 4px; padding: 0; border: 1px solid var(--db-border); border-radius: 50%; background: var(--surface); color: var(--db-accent); font-size: 14px; font-weight: 700; line-height: 1; list-style: none; cursor: help; vertical-align: middle; }
.db-help > summary::-webkit-details-marker { display: none; }
.db-help::details-content { content-visibility: visible; }
.db-help-content { display: none; box-sizing: border-box; width: 100%; max-width: 38rem; margin: 8px 0; padding: 12px 14px; border: 1px solid var(--db-border); border-inline-start: 3px solid var(--db-accent); border-radius: 8px; background: var(--surface-muted); color: var(--db-muted); font-size: 13px; font-weight: 400; line-height: 1.6; white-space: normal; overflow-wrap: anywhere; text-align: start; }
.db-help:hover > .db-help-content, .db-help:focus-within > .db-help-content, .db-help[open] > .db-help-content { display: block; }
.db-help[data-dismissed="true"] > .db-help-content { display: none; }
.db-help:hover > summary, .db-help:focus-within > summary, .db-help[open] > summary { border-color: var(--db-accent); background: var(--surface-muted); }
.db-help > summary:focus-visible { outline: 3px solid #448dc0; outline-offset: 3px; }
.db-help-content > :first-child { margin-top: 0; }
.db-help-content > :last-child { margin-bottom: 0; }
.database-access .field:has(> .db-help) { display: block; }
.database-access .field:has(> .db-help) > label { display: inline; }
.database-access .field:has(> .db-help) > :not(label):not(.db-help) { display: block; margin-top: 7px; }
.db-compact-details { min-width: 0; padding: 0 16px; border: 1px solid var(--db-border); border-radius: 10px; background: var(--surface); }
.db-compact-details > summary { min-height: 44px; padding: 13px 0; color: var(--db-muted); font-size: 14px; font-weight: 600; line-height: 1.4; cursor: pointer; overflow-wrap: anywhere; }
.db-compact-details[open] { padding-bottom: 16px; }
.db-compact-details[open] > summary { margin-bottom: 14px; border-bottom: 1px solid var(--db-border); color: var(--db-accent); }
.db-compact-details > :last-child { margin-bottom: 0; }
.db-setup-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 10px; margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--db-border); }
.db-setup-actions > * { margin: 0; }
.db-setup-actions .button { max-width: 100%; white-space: normal; }
.db-status-ready { display: block; border: 1px solid #8dc6a2; border-inline-start-width: 3px; background: #eaf8ef; overflow-wrap: anywhere; }
.db-status-ready h3 { color: #23643c; }
.db-discovery > .field, .db-wallet-fields { margin-bottom: 20px; }
.db-wallet-fields { padding: 18px; background: var(--surface-muted); border: 1px solid var(--db-border); border-radius: 10px; }
.db-wallet-fields .field + .field { margin-top: 16px; }
.db-levels { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 18px 0; }
.db-level-card { display: flex; gap: 10px; align-items: flex-start; padding: 18px 14px; border: 1px solid var(--db-border); border-radius: 10px; cursor: pointer; min-width: 0; }
.db-level-card:has(input:checked) { border-color: var(--db-accent); box-shadow: inset 0 0 0 1px var(--db-accent); background: var(--surface-muted); }
.db-level-card input { width: 18px; height: 18px; margin: 3px 0 0; flex: 0 0 18px; }
.db-level-card span { display: block; }
.db-level-card strong { display: block; margin-bottom: 10px; font-size: 16px; }
.db-level-card span span { font-size: 13px; line-height: 1.5; font-weight: 400; }
.db-level-card small { display: block; margin-top: 12px; color: var(--db-muted); line-height: 1.5; font-weight: 400; }
.db-capability-group { border: 0; margin: 20px 0 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 20px; min-width: 0; }
.db-capability-group > p { grid-column: 1 / -1; margin: 0; }
.db-capability-group legend { font-weight: 700; margin-bottom: 12px; }
.db-capability { border-bottom: 1px solid var(--db-border); padding-bottom: 12px; }
.db-capability small { display: block; padding-left: 28px; line-height: 1.5; }
.db-resource-note { color: var(--db-muted); }
.db-resource-high { color: var(--warning); }
.db-license-note { color: var(--warning); margin-top: 6px; }
.database-access .section-heading { align-items: flex-start; gap: 20px; }
.database-access .section-heading p { max-width: 760px; }
.db-layout { display: grid; grid-template-columns: minmax(200px, 250px) minmax(0, 1fr); gap: 20px; align-items: start; }
.db-targets { padding: 18px; display: flex; flex-direction: column; gap: 10px; }
.db-targets h3 { margin: 0 0 6px; }
.db-target.button { display: flex; flex-direction: column; align-items: flex-start; text-align: left; white-space: normal; gap: 6px; padding: 12px; width: 100%; }
.db-target small { font-weight: 400; overflow-wrap: anywhere; }
.db-target[aria-pressed="true"] { background: #e9f2f7; box-shadow: inset 3px 0 var(--db-accent); color: #173e58; }
.db-content { min-width: 0; }
.db-target-heading { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin: 0 0 16px; }
.db-target-heading h2 { margin: 0; overflow-wrap: anywhere; }
.db-tab-groups { display: flex; flex-wrap: wrap; gap: 18px 24px; border-bottom: 1px solid var(--db-border); padding-bottom: 6px; margin-bottom: 20px; }
.db-tab-group { flex: 1 1 140px; min-width: 0; }
.db-tab-group + .db-tab-group { flex: 4 1 580px; }
.db-tab-group-title { display: block; margin-bottom: 8px; color: var(--db-muted); font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.db-tabs { display: flex; flex-wrap: wrap; gap: 4px; }
.db-tabs .button { border-radius: 8px 8px 0 0; white-space: normal; max-width: 100%; }
.db-tabs [aria-selected="true"] { color: var(--db-accent); background: #e9f2f7; box-shadow: inset 0 -3px var(--db-accent); }
.db-tab-panel { display: flex; flex-direction: column; gap: 20px; }
.db-panel { padding: 24px; min-width: 0; }
.db-panel h3 { margin-top: 0; }
.db-panel > * + * { margin-top: 16px; }
.db-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.db-actions > * { margin: 0; }
.db-muted { color: var(--db-muted); line-height: 1.6; }
.db-live { min-height: 24px; color: var(--db-muted); }
.db-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.database-access .field { min-width: 0; }
.database-access input:not([type="checkbox"]), .database-access select, .database-access textarea { width: 100%; min-width: 0; }
.db-credentials, .db-options { border: 1px solid var(--db-border); border-radius: 10px; padding: 18px; margin: 20px 0; min-width: 0; }
.db-credentials legend, .db-options legend { font-weight: 600; padding: 0 8px; }
.db-credentials small { display: block; margin-top: 12px; }
.db-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 18px; }
.db-check { display: flex; gap: 10px; align-items: flex-start; min-height: 44px; padding: 10px 0; cursor: pointer; font-weight: 400; line-height: 1.45; }
.db-check input[type="checkbox"] { width: 18px; height: 18px; flex: 0 0 18px; margin: 2px 0 0; accent-color: var(--db-accent); }
.db-check:has(input:disabled) { color: var(--db-muted); cursor: default; }
.db-details { border: 1px solid var(--db-border); border-radius: 8px; padding: 12px 16px; }
.db-details summary { cursor: pointer; font-weight: 600; min-height: 32px; overflow-wrap: anywhere; }
.db-json { max-height: 430px; overflow: auto; font-size: 12px; line-height: 1.6; padding: 14px; background: #f6f8fa; border-radius: 6px; }
.db-digest { font-family: monospace; overflow-wrap: anywhere; font-size: 12px; }
.db-table { width: 100%; min-width: 460px; border-collapse: collapse; text-align: left; }
.db-table th, .db-table td { padding: 12px; border-bottom: 1px solid var(--db-border); vertical-align: top; overflow-wrap: anywhere; }
.db-table th { font-size: 12px; color: var(--db-muted); overflow-wrap: normal; }
.db-table td:first-child { min-width: 70px; }
.database-access a.button { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.database-access .table-wrap:focus-visible { outline: 3px solid #448dc0; outline-offset: 3px; }
.db-table .db-actions { min-width: 140px; }
.database-access button:focus-visible, .database-access a:focus-visible, .database-access summary:focus-visible, .database-access input:focus-visible, .database-access select:focus-visible, .database-access textarea:focus-visible, .database-access pre:focus-visible { outline: 3px solid #448dc0; outline-offset: 3px; }
.database-access .button { min-height: 44px; }
.database-access [aria-busy="true"] { cursor: progress; }
.db-session-control > * + * { margin-top: 16px; }
.db-session-control h4 { margin-bottom: 12px; }
.db-session-control .db-session-review { border-top: 1px solid var(--db-border); padding-top: 18px; }
.db-session-control .db-session-review > * + * { margin-top: 16px; }
.db-session-table td { max-width: 340px; }
.db-session-control input[type="radio"] { width: 20px; height: 20px; accent-color: var(--db-accent); }
@media (max-width: 1000px) {
  .db-layout { grid-template-columns: 1fr; }
  .db-targets { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
  .db-targets h3 { grid-column: 1 / -1; }
}
@media (max-width: 720px) {
  .db-setup-progress { gap: 6px; margin-bottom: 18px; }
  .db-setup-progress > li { gap: 6px; padding: 8px 0; font-size: 12px; }
  .db-setup-progress .db-step-number { width: 24px; height: 24px; flex-basis: 24px; font-size: 12px; }
  .db-setup-intro, .db-setup-summary { padding: 14px 16px; }
  .db-setup-summary dl { grid-template-columns: 1fr; gap: 4px; }
  .db-setup-summary dd + dt { margin-top: 8px; }
  .db-help-content { max-width: 100%; padding: 10px 12px; }
  .db-setup-actions .button { flex: 1 1 150px; }
  .database-access .section-heading { flex-direction: column; }
  .db-form-grid, .db-options { grid-template-columns: 1fr; }
  .db-levels, .db-capability-group { grid-template-columns: 1fr; }
  .db-panel { padding: 16px; }
  .db-credentials, .db-options { padding: 12px; }
  .db-actions .button { flex: 1 1 auto; }
  .db-table th, .db-table td { padding: 8px; font-size: 12px; }
}
@media (prefers-color-scheme: dark) {
  .database-access { --db-border: #465263; --db-muted: #aebdcd; --db-accent: #95c9e5; }
  .db-target[aria-pressed="true"], .db-tabs [aria-selected="true"] { background: #253d4d; color: #c8e7f7; }
  .db-json { background: #17212a; color: #d2e2ee; }
  .db-setup-progress > li[aria-current="step"] .db-step-number { background: #253d4d; }
  .db-setup-progress > li[data-complete="true"] .db-step-number, .db-status-ready { border-color: #417c57; background: #183b2b; }
  .db-setup-progress > li[data-complete="true"] .db-step-number, .db-status-ready h3 { color: #aee2bd; }
}
.database-access [hidden] { display: none !important; }
