/* Shared visual system, scoped away from the standalone login surface. */
body:has(#dashboard-screen:not(.hidden)) {
  --bg: #f5f7fa;
  --surface-soft: #f7f9fc;
  --text-2: #53657c;
  --text-3: #687b93;
  --line: #e3e9f1;
  --radius: 16px;
  --shadow-sm: 0 3px 14px #142c4b04;
}
body.dark:has(#dashboard-screen:not(.hidden)) {
  --bg: #0b1320;
  --surface-solid: #101d2d;
  --surface-soft: #142236;
  --text-2: #adbed2;
  --text-3: #8c9fb8;
  --line: #23344b;
  --shadow-sm: 0 4px 18px #0000000a;
}
#dashboard-screen .sidebar { padding-top: 25px; border-right-color: var(--line); }
#dashboard-screen .sidebar-brand { padding-bottom: 25px; }
#dashboard-screen .sidebar-status { border-radius: 12px; margin-bottom: 19px; padding-block: 11px; }
#dashboard-screen .main-nav { gap: 4px; }
#dashboard-screen .nav-item { min-height: 41px; border-radius: 10px; font-size: 12px; font-weight: 400; }
#dashboard-screen .nav-item.active { font-weight: 600; box-shadow: none; background: #eaf1ff; border-color: #d1e0fd; color: #215bd1; }
body.dark #dashboard-screen .nav-item.active { background: #1b3356; border-color: #314f77; color: #a7c8ff; }
#dashboard-screen .nav-item svg { width: 17px; height: 17px; flex-shrink: 0; }
#dashboard-screen.sidebar-collapsed .nav-group-head > .nav-item { padding-inline: 5px; }
#dashboard-screen .nav-item em { opacity: .45; font-size: 9px; }
#dashboard-screen .topbar { min-height: 70px; padding-inline: clamp(20px, 3.1vw, 48px); gap: 16px; background: color-mix(in srgb, var(--bg) 90%, transparent); }
#dashboard-screen .topbar-actions { gap: 8px; min-width: 0; }
#dashboard-screen .breadcrumbs { min-width: 0; line-height: 1.4; }
#dashboard-screen .breadcrumbs strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#dashboard-screen .content-scroll { padding: 32px clamp(20px, 3.1vw, 48px) 56px; }
#dashboard-screen .view { max-width: 1520px; margin-inline: auto; min-width: 0; }
#dashboard-screen .page-title { font-size: clamp(30px, 3.4vw, 44px); line-height: 1.1; letter-spacing: -.055em; }
#dashboard-screen .page-lede { font-size: 12px; line-height: 1.8; max-width: 650px; }
#dashboard-screen .eyebrow { font-size: 9px; line-height: 1.5; letter-spacing: .16em; font-weight: 600; }
#dashboard-screen .section-header-large { gap: 20px; margin-bottom: 26px; flex-wrap: wrap; }
#dashboard-screen .section-header-large > div:first-child { flex: 1 1 360px; min-width: 0; }
#dashboard-screen .section-header-large .header-actions { min-width: 0; max-width: 100%; justify-content: flex-end; }
#dashboard-screen .section-header-large .header-actions > button { max-width: 100%; }
#dashboard-screen .hero { margin-bottom: 30px; }
#dashboard-screen .stat-grid { gap: 14px; margin-bottom: 30px; }
#dashboard-screen .stat-card { border-radius: 15px; box-shadow: var(--shadow-sm); padding: 19px; }
#dashboard-screen .stat-card::after { opacity: .24; }
#dashboard-screen .stat-icon { width: 30px; height: 30px; border-radius: 9px; }
#dashboard-screen .stat-icon svg { display: block; width: 15px; height: 15px; }
body.dark #dashboard-screen .orbit-center { background: var(--surface-soft); border-color: #35547e; color: #8fb8ff; }
#dashboard-screen .provider-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 30px; }
#dashboard-screen .provider-card { padding: 20px; box-shadow: var(--shadow-sm); border-radius: 15px; }
#dashboard-screen .provider-card h4 { font-size: 13px; font-weight: 600; }
#dashboard-screen .provider-card p { min-height: 38px; line-height: 1.6; }
#dashboard-screen .provider-card:hover { transform: none; box-shadow: none; }
#dashboard-screen .panel { border-radius: 16px; box-shadow: var(--shadow-sm); }
#dashboard-screen .section-heading { margin-bottom: 15px; gap: 14px; }
#dashboard-screen .section-heading h3, #dashboard-screen .panel-heading h3 { font-size: 17px; font-weight: 600; }
#dashboard-screen .filter-row { gap: 12px; flex-wrap: wrap; margin-bottom: 17px; }
#dashboard-screen .guide-tabs { width: 100%; min-width: 0; flex-wrap: wrap; overflow: visible; }
#dashboard-screen .guide-tab { flex: 1 1 135px; min-width: 0; justify-content: center; }
#dashboard-screen .search-wrap { min-height: 40px; }
#dashboard-screen .search-wrap input { font-size: 12px; }
#dashboard-screen :is(.resource-table, .audit-table, .backup-table) th { font-size: 9px; font-weight: 600; letter-spacing: .11em; padding-block: 13px; }
#dashboard-screen :is(.resource-table, .audit-table, .backup-table) td { padding-block: 16px; line-height: 1.6; }
#dashboard-screen .table-panel { scrollbar-gutter: auto; }
#dashboard-screen #view-backups { width: 100%; }
#dashboard-screen #backup-table-wrap { min-width: 0; max-width: 100%; }
#dashboard-screen #backup-table-wrap .table-scroll { width: 100%; min-width: 0; overflow-x: auto; }
#dashboard-screen .ufw-default-overview { grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); }
#dashboard-screen .ufw-default-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; }
#dashboard-screen .ufw-default-copy > div { min-width: 0; }
#dashboard-screen .ufw-default-actions { min-width: 0; max-width: 100%; }
#dashboard-screen .ufw-default-actions button { white-space: normal; padding-block: 10px; }
dialog.modal-shell > .dropcatch-dialog { width: 100%; max-width: 100%; padding: 0; gap: 0; height: min(92dvh, 900px); max-height: min(92dvh, 900px); }
dialog.modal-shell > .modal-card:not(.dropcatch-dialog) { max-width: 100%; max-height: 92dvh; overflow-y: auto; }
dialog.modal-shell .dropcatch-dialog-actions { min-width: 0; max-width: 100%; margin: 0; padding: 13px 15px; }
#dashboard-screen .live-pill { min-height: 34px; font-weight: 500; box-shadow: none; }
#dashboard-screen .operator-card { border-top-color: var(--line); }
#dashboard-screen .operator-avatar { border-radius: 10px; }

/* A single geometry for icon-only controls prevents padding and SVG-baseline drift. */
:is(#dashboard-screen, dialog) .icon-button {
  display: inline-grid; place-items: center; padding: 0; line-height: 1; flex-shrink: 0;
}
:is(#dashboard-screen, dialog) .icon-button > svg { display: block; margin: 0; width: 16px; height: 16px; }
:is(#dashboard-screen, dialog) :is(.primary-button, .soft-button, .text-button) {
  gap: 8px; font-weight: 600; line-height: 1.35;
}
:is(#dashboard-screen, dialog) :is(.primary-button, .soft-button, .text-button) > svg {
  display: block; margin: 0; flex-shrink: 0; align-self: center; width: 16px; height: 16px;
}
:is(#dashboard-screen, dialog) button:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }
#dashboard-screen .notification-badge { line-height: 1; font-size: 9px; }

/* Shared modal rails retain specialized editor layouts and their own scroll areas. */
dialog.modal-dialog { border: 0; outline: 0; border-radius: 20px; box-shadow: 0 28px 100px #06142640; }
dialog.modal-dialog::backdrop { background: #08132380; backdrop-filter: blur(8px); }
dialog .modal-card { border-color: var(--line); box-shadow: none; }
dialog.provider-profile-dialog > .modal-card { max-height: min(88vh, 760px); }
dialog .modal-heading { align-items: flex-start; gap: 18px; min-width: 0; }
dialog .modal-heading > div { min-width: 0; }
dialog .modal-heading h3 { margin-top: 5px; font-weight: 600; line-height: 1.25; overflow-wrap: anywhere; }
dialog .modal-heading > .icon-button { width: 34px; height: 34px; margin-top: -2px; border: 1px solid var(--line); background: var(--surface-soft); border-radius: 10px; }
dialog .modal-subtitle { margin-top: 7px; line-height: 1.7; }
dialog .modal-actions { gap: 10px; flex-wrap: wrap; }
dialog .modal-actions > button { max-width: 100%; min-width: 0; }
dialog .modal-actions > :is(.primary-button, .soft-button) { padding: 10px 15px; }
dialog :is(input, select, textarea) { max-width: 100%; }
dialog :is(.form-two, .form-three) > * { min-width: 0; }
dialog label { line-height: 1.5; }
dialog :is(.form-hint, small) { line-height: 1.55; }

@media (max-width: 1100px) {
  #dashboard-screen .ufw-default-overview { grid-template-columns: minmax(0, 1fr); }
  #dashboard-screen .provider-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #dashboard-screen .content-scroll { padding-inline: 24px; }
  #dashboard-screen .stat-grid { gap: 10px; }
}
@media (max-width: 760px) {
  #dashboard-screen .hero-art { display: none; }
  #dashboard-screen .section-heading { flex-wrap: wrap; }
  #dashboard-screen .nav-group-head > .nav-item { padding-inline: 5px; }
  dialog .zone-editor-tabs { display: flex; overflow-x: auto; padding-bottom: 6px; scroll-snap-type: x proximity; }
  dialog .zone-editor-tab { flex: 0 0 158px; min-width: 158px; scroll-snap-align: start; }
  #dashboard-screen .topbar { padding: 12px 16px; flex-wrap: wrap; gap: 12px; }
  #dashboard-screen .breadcrumbs { flex: 1 1 100%; }
  #dashboard-screen .topbar-actions { width: 100%; justify-content: flex-end; flex-wrap: wrap; }
  #dashboard-screen .content-scroll { padding: 24px 16px 40px; }
  #dashboard-screen .page-title { font-size: 31px; }
  #dashboard-screen .section-header-large { align-items: flex-start; gap: 16px; }
  #dashboard-screen .section-header-large > div:first-child { flex-basis: auto; }
  #dashboard-screen .section-header-large .header-actions { justify-content: flex-start; }
  #dashboard-screen .provider-grid { gap: 10px; }
  #dashboard-screen .provider-card { padding: 16px; }
  #dashboard-screen .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #dashboard-screen .stat-card { padding: 14px; }
  #dashboard-screen .nav-item { min-height: 42px; }
  dialog.modal-dialog { max-width: calc(100vw - 20px); max-height: calc(100dvh - 24px); }
  dialog .modal-card:not(.dropcatch-dialog) { padding: 20px; }
  dialog .modal-heading h3 { font-size: 22px; }
  dialog .modal-actions { gap: 8px; }
}
@media (max-width: 480px) {
  #dashboard-screen .provider-grid { grid-template-columns: 1fr; }
  #dashboard-screen .topbar-actions { gap: 6px; }
  #dashboard-screen .live-pill small { display: none; }
  #dashboard-screen .section-header-large { flex-direction: column; }
  #dashboard-screen .provider-card p { min-height: 0; }
  dialog .modal-actions > :is(.primary-button, .soft-button) { flex: 1 1 auto; }
}
/* At narrow content widths, shrink grid items instead of clipping their controls. */
@media (max-width: 520px) {
  #dashboard-screen :is(.lower-grid > .panel, .ufw-card, .guide-page, .guide-hero, .guide-layout, .guide-steps, .guide-faq, .api-security-banner > div) { min-width: 0; }
  #dashboard-screen .profile-card .profile-meta { grid-template-columns: auto minmax(0, 1fr); }
  #dashboard-screen .profile-card .profile-meta .text-button { grid-column: 1 / -1; justify-self: start; max-width: 100%; white-space: normal; }
  #dashboard-screen .registrar-balance-row { align-items: flex-start; }
  #dashboard-screen .registrar-balance-meta { min-width: 0; max-width: 100%; }
  #dashboard-screen .registrar-balance-meta .status-label { white-space: normal; overflow-wrap: anywhere; }
  #dashboard-screen .ufw-card-actions { flex-wrap: wrap; }
  #dashboard-screen .ufw-card-actions button { min-width: 0; white-space: normal; }
  #dashboard-screen .api-security-banner { grid-template-columns: minmax(0, 1fr); }
  #dashboard-screen .api-security-banner > .status-label { grid-column: 1; justify-self: start; white-space: normal; }
  #dashboard-screen #view-api .panel-heading { flex-wrap: wrap; }
  #dashboard-screen #view-api .panel-heading > div { min-width: 0; }
  #dashboard-screen .guide-steps li { grid-template-columns: 28px minmax(0, 1fr); gap: 9px; }
  #dashboard-screen .guide-hero { grid-template-columns: minmax(0, 1fr); }
  #dashboard-screen .guide-doc-link { max-width: 100%; white-space: normal; }
  #dashboard-screen .lower-grid .panel-heading { flex-wrap: wrap; }
  #dashboard-screen .pulse-metrics { flex-wrap: wrap; gap: 16px; }
  #dashboard-screen .pulse-metrics > div { max-width: 100%; overflow-wrap: anywhere; }
  #dashboard-screen .promo-grid { grid-template-columns: minmax(0, 1fr); }
  #dashboard-screen .promo-card { min-width: 0; }
  #dashboard-screen .promo-card-top, #dashboard-screen .promo-price { flex-wrap: wrap; }
  #dashboard-screen .dropcatch-safety-banner > .status-label { flex: 0 1 auto; max-width: 100%; white-space: normal; overflow-wrap: anywhere; }
  #dashboard-screen .ufw-flow-steps > li { grid-template-columns: minmax(0, 1fr); }
  #dashboard-screen .ufw-flow-step-top { flex-wrap: wrap; }
  #dashboard-screen .ufw-flow-mode { min-width: 0; max-width: 100%; white-space: normal; overflow-wrap: anywhere; }
  #dashboard-screen .guide-steps :is(p, strong) { overflow-wrap: anywhere; }
}
@media (prefers-reduced-motion: reduce) {
  #dashboard-screen *, dialog *, dialog::backdrop { transition-duration: 0s !important; scroll-behavior: auto !important; }
}
