/* Shared spacing and controls across the management pages. */
body { line-height: 1.5; }
body > main { max-width: 1920px; margin: 0 auto; box-sizing: border-box; }
body.management-view .summary { display: none; }
body.management-view :is(#dataSource,#snmpCommunity,#snmpPort,#refreshInterval,#refreshBtn,.custom-select:has(#interfaceFilter),.custom-select:has(#statusFilter)) { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
body > header .toolbar { min-width: 0; gap: 14px; }
#mainNav { display: flex; flex-wrap: wrap; gap: 4px; padding: 0 0 12px; overflow: visible; }
#mainNav button { height: auto; min-height: 38px; padding: 8px 12px; border-radius: 7px; border: 1px solid transparent; line-height: 1.3; white-space: nowrap; flex: 0 0 auto; }
#mainNav button.active { background: var(--nav); color: var(--accent); border-color: var(--line); }
#mainNav button:hover { background: var(--panel-2); color: var(--text); }
.control-bar { row-gap: 10px; }
.control-bar select, .control-bar input, .control-bar button { min-height: 36px; }
.card-head, .settings-heading, .up-heading { gap: 16px; margin-bottom: 18px; }
.card-head > div { min-width: 0; }
.card-head > button { flex-shrink: 0; }
.card-head .site, .up h2, .settings-heading h2 { font-size: 21px; line-height: 1.35; letter-spacing: -.3px; }
.card-head .vlan { margin-top: 5px; color: var(--muted); font-size: 13px; }
.admin-panel { gap: 24px; }
.admin-table { border-collapse: separate; border-spacing: 0; border-radius: 10px; }
.admin-table th { padding: 12px 14px; font-size: 11px; letter-spacing: .3px; }
.admin-table td { padding: 14px; font-size: 13px; vertical-align: top; }
.admin-table tbody tr:last-child td { border-bottom: 0; }
.admin-table button, .admin-actions button, .card-head > button, .settings-actions button, .settings-heading button { height: auto; min-height: 38px; padding: 8px 12px; border-radius: 7px; font-size: 13px; line-height: 1.4; vertical-align: middle; }
.admin-table td > button { margin: 2px 4px 2px 0; }
.admin-table button { white-space: nowrap; }
.admin-form, body.theme-dark .admin-form, #adminAccessForm { padding: 20px; gap: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); box-sizing: border-box; }
.admin-form > label { font-size: 12px; font-weight: 600; text-transform: none; color: var(--muted); gap: 7px; }
.admin-form input:not([type=checkbox]):not([type=radio]), .admin-form select { height: auto; min-height: 42px; padding: 10px 12px; border-radius: 7px; font-weight: 400; box-sizing: border-box; }
.admin-form textarea { border-radius: 7px; padding: 12px; font-weight: 400; line-height: 1.5; box-sizing: border-box; }
.admin-actions { gap: 8px; align-items: center; }
.admin-form > .admin-actions { padding-top: 14px; border-top: 1px solid var(--line); }
.access-menu-field { padding-top: 16px; margin: 0; }
.access-menu-field legend { font-size: 14px; font-weight: 600; }
#adminAccessForm .access-menu-grid { gap: 6px 10px; }
#adminAccessForm .access-menu-grid label { border: 1px solid var(--line); border-radius: 7px; padding: 8px 10px; min-height: 40px; box-sizing: border-box; font-size: 12px; }
#adminAccessForm .access-menu-grid label:has(input:checked) { border-color: var(--accent); background: var(--nav); }
#adminAccessForm .access-menu-grid span { min-width: 0; overflow-wrap: anywhere; }
.admin-form input[type=checkbox], .admin-form input[type=radio] { min-width: 16px !important; max-width: 16px; width: 16px; height: 16px; flex: 0 0 16px; margin: 0; padding: 0; }
.interface-picker { max-height: 260px; padding: 10px; gap: 8px; border-radius: 8px; background: var(--panel-2); }
.interface-picker label { min-width: 0; align-items: flex-start; line-height: 1.5; }
.interface-picker span { min-width: 0; overflow-wrap: anywhere; }
.interface-picker input[type=checkbox] { margin-top: 3px; }
.empty-note { border-radius: 8px; font-size: 13px; line-height: 1.6; }
:is(.vpn-tabs,.ipam-tabs,.up-tabs) { gap: 6px; padding-bottom: 8px; }
:is(.vpn-tabs,.ipam-tabs,.up-tabs) button { min-height: 40px; height: auto; border-radius: 7px; line-height: 1.4; }
:is(.vpn,.ipam,.up) button:not([data-close]), .up-dialog button:not([data-close]) { height: auto; min-height: 38px; border-radius: 7px; line-height: 1.4; }
:is(.vpn,.ipam,.up) input:not([type=checkbox]):not([type=radio]), :is(.vpn,.ipam,.up) select { border-radius: 7px; }
.up-scroll { border: 1px solid var(--line); border-radius: 10px; }
.up-tools { gap: 12px; }

/* User access: balanced columns, expandable detail, and dedicated actions. */
.access-layout { grid-template-columns: minmax(0,1fr) minmax(340px,390px); gap: 24px; }
.access-users-panel { min-width: 0; }
.access-list-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 16px; }
.access-list-toolbar > div { margin-right: auto; }
.access-list-toolbar strong { display: block; font-size: 15px; }
.access-muted { display: block; font-size: 12px; color: var(--muted); }
.access-search { display: block; min-width: 150px; flex: 0 1 240px; }
.access-search input { width: 100%; min-width: 0; height: 40px; border: 1px solid var(--line); border-radius: 7px; background: var(--panel); color: var(--text); padding: 8px 12px; font: inherit; box-sizing: border-box; }
.access-list-toolbar > button { min-height: 40px; height: auto; padding: 8px 14px; border-radius: 7px; background: var(--nav-active); color: white; border: 1px solid var(--nav-active); white-space: nowrap; }
.access-table-scroll .access-users-table { table-layout: fixed; min-width: 0; }
.access-users-table th:nth-child(1) { width: 12%; }
.access-users-table th:nth-child(2) { width: 16%; }
.access-users-table th:nth-child(3) { width: 25%; }
.access-users-table th:nth-child(4) { width: 25%; }
.access-users-table th:nth-child(5) { width: 22%; }
.access-users-table td { overflow-wrap: anywhere; }
.access-user-name { font-size: 14px; font-weight: 650; }
.access-role { display: inline-block; background: var(--panel-2); color: var(--text); border: 1px solid var(--line); border-radius: 5px; padding: 3px 7px; font-size: 11px; line-height: 1.4; }
.access-chips { display: flex; flex-wrap: wrap; gap: 5px; min-width: 0; }
.access-chip { display: inline-block; min-width: 0; max-width: 100%; padding: 3px 7px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 5px; color: var(--text); font-size: 11px; line-height: 1.5; overflow-wrap: anywhere; box-sizing: border-box; }
.access-list-details { min-width: 0; }
.access-list-details summary { cursor: pointer; font-size: 12px; font-weight: 600; color: var(--accent); }
.access-list-details summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.access-preview { display: block; color: var(--muted); font-size: 11px; line-height: 1.5; font-weight: 400; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 5px; }
.access-list-details[open] .access-preview { display: none; }
.access-list-details .access-chips { margin-top: 10px; }
.access-row-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.access-row-actions button { min-height: 34px; padding: 7px 9px; margin: 0; font-size: 12px; line-height: 1.4; border: 1px solid var(--line); background: var(--panel); color: var(--text); }
.access-row-actions button:hover { background: var(--nav); color: var(--accent); }
.access-row-actions .access-delete { color: var(--down); }
.access-row-actions button:disabled { opacity: .4; }
.access-users-table [hidden], .access-users-panel > [hidden] { display: none !important; }
.access-form-heading { padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.access-form-heading h3 { font-size: 17px; margin: 0; }
.access-form-heading p { color: var(--muted); margin: 5px 0 0; font-size: 12px; }
#adminAccessForm { scroll-margin-top: 16px; }
#accessCopyNotice { margin: 0; border: 1px solid var(--line); background: var(--nav); }
#accessFormError:empty { display: none; }
@media (min-width:901px) and (max-width:1599px) {
  body > header, body.theme-dark > header { grid-template-columns: minmax(0,1fr); gap: 12px; }
}
@media (min-width:901px) and (max-width:1350px) {
  .access-layout { grid-template-columns: minmax(0,1fr); }
  #adminAccessForm { grid-template-columns: repeat(2,minmax(0,1fr)); }
  #adminAccessForm > :is(.access-form-heading,#accessCopyNotice,.admin-actions,#accessFormError) { grid-column: 1 / -1; }
  #adminAccessForm > .access-menu-field, #adminPatternField { grid-column: 1 / -1; }
  #adminAccessForm .access-menu-grid { grid-template-columns: repeat(4,minmax(0,1fr)); }
}
@media (max-width:900px) {
  .card-head { align-items: flex-start; flex-wrap: wrap; margin-bottom: 16px; }
  .card-head .site, .up h2 { font-size: 20px; }
  .admin-panel, .access-layout { grid-template-columns: minmax(0,1fr); gap: 20px; }
  .admin-form, #adminAccessForm { padding: 16px; border-radius: 10px; }
  .admin-form input:not([type=checkbox]):not([type=radio]), .admin-form select, .admin-form textarea { font-size: 16px; }
  .admin-table button, .admin-actions button { min-height: 40px; }
  .access-list-toolbar { gap: 10px; }
  .access-list-toolbar > div { flex: 1; }
  .access-search { order: 3; flex: 1 1 100%; }
  .access-search input { font-size: 16px; min-height: 44px; }
  .access-users-panel > .access-table-scroll { overflow: visible; }
  .access-users-table, .access-users-table tbody { display: block; width: 100%; border: 0; background: transparent; overflow: visible; }
  .access-users-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .access-users-table tbody tr { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); margin-bottom: 12px; padding: 16px; }
  .access-users-table td { display: block; border: 0; padding: 0; min-width: 0; }
  .access-users-table td::before { content: attr(data-label); display: block; color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .4px; margin-bottom: 5px; }
  .access-users-table td:nth-child(n+3) { grid-column: 1 / -1; }
  .access-users-table td:last-child { border-top: 1px solid var(--line); padding-top: 12px; }
  .access-users-table td:last-child::before { display: none; }
  .access-row-actions { flex-wrap: nowrap; }
  .access-row-actions button { flex: 1; min-height: 40px; }
  .access-list-details summary { min-height: 32px; }
  .mobile-menu-list button { border-radius: 9px; gap: 10px; min-height: 54px; }
  .mobile-panel { border-radius: 16px 16px 0 0; }
  .mobile-menu-list .mobile-icon { color: var(--accent); }
  .up-scroll { border: 0; border-radius: 0; }
}
@media (max-width:380px) {
  #adminAccessForm .access-menu-grid { grid-template-columns: minmax(0,1fr); }
  .admin-form, #adminAccessForm { padding: 14px; }
}
