/*
 * Maintain Hub visual system v0.3
 *
 * Loaded after the legacy and feature styles. This layer changes presentation
 * only and keeps existing page structure, routes and interaction contracts.
 */

:root {
  --blue: #175bb5;
  --blue-dark: #104a94;
  --line: #dce4ee;
  --soft: #f8fafc;
  --text: #1c2c40;
  --muted: #52657c;
  --primary-50: #f3f7fd;
  --primary-100: #e8f0fc;
  --primary-200: #c9dcf5;
  --primary-300: #9fc2eb;
  --primary-400: #6f9fdb;
  --primary-500: #3979ca;
  --primary-600: #175bb5;
  --primary-700: #104a94;
  --primary-800: #123f78;
  --primary-900: #143761;
  --neutral-50: #f8fafc;
  --neutral-100: #f1f5f9;
  --neutral-200: #dce4ee;
  --neutral-300: #c8d3e0;
  --neutral-400: #91a0b3;
  --neutral-500: #64748b;
  --neutral-600: #52657c;
  --neutral-700: #394b61;
  --neutral-800: #26384d;
  --neutral-900: #1c2c40;
  --neutral-950: #132235;
  --ui-canvas: #f8fafc;
  --ui-surface: #fff;
  --ui-surface-muted: #f8fafc;
  --ui-surface-subtle: #f3f6fa;
  --ui-text: #1c2c40;
  --ui-text-muted: #52657c;
  --ui-primary: #175bb5;
  --ui-primary-strong: #104a94;
  --ui-primary-soft: #e8f0fc;
  --ui-border: #dce4ee;
  --ui-border-strong: #c8d3e0;
  --ui-control-height: 40px;
  --ui-card-radius: 10px;
  --ui-card-header-height: 54px;
  --ui-font-body: 14px;
  --ui-font-card-title: 16px;
  --ui-font-page-title: 24px;
  --ui-line-body: 1.55;
  --ui-shell-gap: 20px;
  --ui-shadow-focus: 0 0 0 3px rgb(23 91 181 / 16%);
  font-family: Pretendard, "Malgun Gothic", "Segoe UI", sans-serif;
}

html,
body {
  color: var(--ui-text);
  background: var(--ui-canvas);
  letter-spacing: -.01em;
}

::selection { color: #fff; background: var(--ui-primary); }

.app-shell { grid-template-columns: 224px minmax(0, 1fr); }

.workspace { background: var(--ui-surface); }

.sidebar {
  border-right: 1px solid var(--ui-border);
  background: #f3f6fa;
  box-shadow: none;
}

.sidebar .brand {
  height: 76px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--ui-border);
  background: #f3f6fa;
  color: var(--ui-text);
}

.brand-logo {
  width: 94px;
  height: 40px;
  object-fit: contain;
}

.brand strong { font-size: 15px; letter-spacing: -.04em; }

.primary-nav,
.secondary-nav { gap: 4px; padding: 16px 12px; }

.primary-nav a,
.secondary-nav a,
.sidebar-logout,
.admin-nav-accordion > summary {
  min-height: 44px;
  position: relative;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--ui-text-muted);
  font-weight: 650;
}

.primary-nav a > span,
.secondary-nav a > span,
.sidebar-logout > span { color: #60748d; }

.primary-nav a:hover,
.secondary-nav a:hover,
.sidebar-logout:hover,
.admin-nav-accordion > summary:hover {
  color: var(--ui-text);
  background: #fff;
}

.primary-nav a[aria-current="page"],
.admin-nav-links a[aria-current="page"] {
  color: var(--ui-primary);
  background: var(--ui-primary-soft);
  box-shadow: inset 3px 0 var(--ui-primary);
}

.primary-nav a[aria-current="page"] > span { color: var(--ui-primary); }

.admin-nav-accordion { border: 0; background: transparent; }
.admin-nav-links { padding-left: 12px; }

.secondary-nav {
  border-bottom: 0;
  background: #f3f6fa;
}

.secondary-nav > .sidebar-user::before { background: var(--ui-border); }

.secondary-nav .sidebar-user > .avatar {
  color: var(--ui-primary);
  background: var(--ui-primary-soft);
}

.collapse-menu {
  height: 54px;
  border-top: 1px solid var(--ui-border);
  color: var(--ui-text-muted);
  background: #f3f6fa;
}

.topbar {
  min-height: 76px;
  height: 76px;
  padding: 10px 32px;
  border-bottom: 1px solid var(--ui-border);
  background: rgb(255 255 255 / 98%);
  box-shadow: none;
  backdrop-filter: none;
}

#main-content {
  width: 100%;
  max-width: none;
  margin-inline: 0;
  padding: 28px 32px 40px;
}

.app-footer {
  padding: 14px 32px;
  border-top: 1px solid var(--ui-border);
  background: var(--ui-surface);
  font-size: 11px;
}

.topbar-page-identity h1,
.topbar .site-context-title h1,
.ops-page-header h1,
.site-detail-header h1,
.portfolio-heading h1,
.directory-heading h1,
.screen-header h1,
.page-header h1 {
  color: var(--ui-text);
  font-size: var(--ui-font-page-title);
  line-height: 1.3;
  letter-spacing: -.04em;
}

.topbar-page-identity p,
.ops-page-header p,
.site-detail-header p,
.screen-header p,
.page-header p { margin-top: 7px; color: var(--ui-text-muted); font-size: 13px; }

.eyebrow,
.ops-page-header > div:first-child > span,
.site-detail-header > div > span {
  color: var(--ui-primary);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: .08em;
}

:where(.primary-action, .outline-action, .ghost-action, .compact-action, .icon-action, .site-actions button, button.primary, a.button) {
  min-height: var(--ui-control-height);
  border-radius: 8px;
  font-weight: 700;
}

:where(.primary-action, button.primary, .button.primary) {
  border-color: var(--ui-primary);
  color: #fff;
  background: var(--ui-primary);
  box-shadow: 0 2px 3px rgb(18 63 114 / 12%);
}

:where(.primary-action, button.primary, .button.primary):hover {
  border-color: var(--ui-primary-strong);
  background: var(--ui-primary-strong);
}

:where(.outline-action, .button.secondary, .ghost-action) {
  border-color: var(--ui-border-strong);
  color: var(--ui-text);
  background: #fff;
}

:where(.outline-action, .button.secondary, .ghost-action):hover {
  border-color: var(--primary-300);
  color: var(--ui-primary-strong);
  background: var(--primary-50);
}

:where(input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), select, textarea) {
  border: 1px solid var(--ui-border-strong);
  border-radius: 8px;
  color: var(--ui-text);
  background: #fff;
}

:where(input, select, textarea):hover { border-color: #9aabbd; }
:where(input, select, textarea):focus { border-color: var(--ui-primary); }

:where(.content-list-toolbar, .dashboard-scope, .operations-command-row, .operations-search-row,
  .site-directory-command, .library-command-bar, .knowledge-command-bar, .work-command-bar,
  .site-library-controls, .audit-filter-card) {
  gap: 12px;
  margin-bottom: 20px;
  padding: 14px 16px;
  border: 1px solid var(--ui-border);
  border-radius: 10px;
  background: var(--ui-canvas);
  box-shadow: none;
}

:where(.site-tabs, .detail-tabs, .operations-subtabs, .knowledge-category-tabs, .global-search-tabs, .artifact-tabs) {
  gap: 22px;
  margin-bottom: 24px;
  border-bottom-color: var(--ui-border);
}

:where(.site-tabs, .detail-tabs, .operations-subtabs, .knowledge-category-tabs, .global-search-tabs, .artifact-tabs) a {
  min-width: 0;
  padding-inline: 2px;
  color: var(--ui-text-muted);
  font-size: 13px;
  font-weight: 600;
}

:where(.site-tabs, .detail-tabs, .operations-subtabs, .knowledge-category-tabs, .global-search-tabs, .artifact-tabs) a.active {
  border-bottom-color: var(--ui-primary);
  color: var(--ui-primary);
}

:where(.ops-section, .ops-panel, .detail-card, .site-panel, .compact-panel, .portfolio-section,
  .global-search-focus, .global-search-results, .knowledge-list, .knowledge-summary, .knowledge-outline,
  .form-card, .prose-card, .quick-log-card, .admin-invite-card, .audit-filter-card,
  .bug-analysis-card, .bug-report-form, .account-metadata-card, .account-metadata-edit-card,
  .backup-settings, .external-backup-settings, .passkey-settings, .account-password-settings,
  .account-recovery-settings, .map-provider-settings, .sensitive-field-settings) {
  min-width: 0;
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-card-radius);
  background: #fff;
  box-shadow: none;
}

:where(.ops-section, .ops-panel, .detail-card, .site-panel, .compact-panel, .portfolio-section,
  .form-card, .quick-log-card, .admin-invite-card, .bug-analysis-card, .account-metadata-card,
  .account-metadata-edit-card, .backup-settings, .external-backup-settings, .passkey-settings,
  .account-password-settings, .account-recovery-settings, .map-provider-settings,
  .sensitive-field-settings) > header {
  min-height: var(--ui-card-header-height);
  padding: 13px 18px;
  border-bottom: 1px solid var(--ui-border);
  background: #fff;
}

:where(.ops-section, .ops-panel, .detail-card, .site-panel, .compact-panel, .portfolio-section,
  .form-card, .quick-log-card, .admin-invite-card, .bug-analysis-card, .account-metadata-card,
  .account-metadata-edit-card, .backup-settings, .external-backup-settings, .passkey-settings,
  .account-password-settings, .account-recovery-settings, .map-provider-settings,
  .sensitive-field-settings) > header h2 {
  color: var(--ui-text);
  font-size: 17px;
  letter-spacing: -.025em;
}

:where(.ops-section, .detail-card, .site-panel, .portfolio-section) +
:where(.ops-section, .detail-card, .site-panel, .portfolio-section) { margin-top: var(--ui-shell-gap); }

table { border-collapse: collapse; }

th {
  padding: 12px 14px;
  border-block: 1px solid var(--ui-border);
  color: var(--ui-text-muted);
  background: var(--ui-canvas);
  font-size: 12px;
  font-weight: 700;
}

td {
  padding: 14px;
  border-bottom: 1px solid var(--ui-border);
  color: var(--ui-text);
  vertical-align: middle;
}

tbody tr { transition: background-color .12s ease; }
tbody tr:hover { background: var(--primary-50); }

.status-pill,
.mini-status,
.readiness-score,
.inventory-status {
  padding: 4px 9px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
}

.empty-state { padding: 34px 20px; color: var(--ui-text-muted); }

/* Dashboard: prioritize current work and use quiet separators for summary data. */
.dashboard-v2 { display: grid; gap: 24px; }

.dashboard-find-site {
  min-height: 0;
  padding: 20px;
  border: 1px solid var(--ui-border);
  border-radius: 10px;
  color: var(--ui-text);
  background: var(--ui-canvas);
  box-shadow: none;
}

.dashboard-find-site::before { display: none; }
.dashboard-find-site h2 { color: var(--ui-text); font-size: 20px; }
.dashboard-find-site p { color: var(--ui-text-muted); }
.dashboard-find-site > label {
  border: 1px solid var(--ui-border);
  box-shadow: 0 8px 20px rgb(19 34 53 / 10%);
}
.dashboard-search-empty {
  padding: 18px;
  border: 1px dashed var(--ui-border-strong);
  border-radius: 8px;
  background: #fff;
}
.dashboard-search-empty strong { color: var(--ui-text); }
.dashboard-search-empty a { color: var(--ui-primary); }

.dashboard-find-site .dashboard-site-result {
  border: 1px solid var(--ui-border);
  color: var(--ui-text);
  background: #fff;
  backdrop-filter: none;
}

.dashboard-find-site .dashboard-site-result:hover {
  border-color: var(--primary-300);
  background: var(--primary-50);
}

.dashboard-find-site .dashboard-site-result small,
.dashboard-find-site .dashboard-site-result em,
.dashboard-find-site .dashboard-result-badges > i { color: var(--ui-text-muted); }
.dashboard-find-site .dashboard-site-result strong { color: var(--ui-text); }
.dashboard-find-site .dashboard-site-result > b { color: var(--ui-primary); }

.dashboard-find-site .dashboard-site-result .status-pill.success {
  color: #157347;
  background: #e8f6ef;
}

.dashboard-find-site .dashboard-site-result .status-pill.warning {
  color: #9a6200;
  background: #fff3d6;
}

.dashboard-find-site .dashboard-site-result .status-pill.danger {
  color: #b42318;
  background: #fff0ee;
}

.dashboard-find-site .dashboard-site-result .status-pill.neutral {
  color: #52657c;
  background: #edf1f5;
}

.dashboard-find-site .dashboard-site-results-more {
  border: 1px solid var(--primary-200);
  color: var(--ui-text);
  background: var(--primary-50);
}

.dashboard-find-site .dashboard-site-results-more span,
.dashboard-find-site .dashboard-site-results-more strong { color: var(--ui-text); }
.dashboard-find-site .dashboard-site-results-more b { color: var(--ui-primary); }

.dashboard-signal-row {
  gap: 0;
  padding: 20px 0;
  border-bottom: 1px solid var(--ui-border);
}

.dashboard-signal-row a {
  min-height: 0;
  padding: 0 22px;
  border: 0;
  border-left: 1px solid var(--ui-border);
  border-radius: 0;
  background: transparent;
}

.dashboard-signal-row a:first-child { padding-left: 0; border-left: 0; }
.dashboard-signal-row a::before { display: none; }
.dashboard-signal-row strong { font-size: 27px; letter-spacing: -.04em; }
.dashboard-signal-row a:first-child strong { color: var(--ui-primary); }

.dashboard-today,
.dashboard-recent-sites,
.dashboard-recent-evidence {
  border-radius: 10px;
  box-shadow: none;
}

.dashboard-today > header,
.dashboard-recent-sites > header,
.dashboard-recent-evidence > header {
  min-height: 54px;
  padding: 13px 18px;
  border-bottom: 2px solid var(--ui-border);
}

.dashboard-today-list > a,
.dashboard-recent-sites > div > a { padding-block: 15px; }

.service-type-badge,
.worklog-history .worklog-type {
  white-space: nowrap;
  word-break: keep-all;
}

@media (min-width: 761px) {
  .worklog-history > a {
    grid-template-columns: 94px 112px minmax(0, 1fr) 80px;
  }

  .worklog-record-details > summary {
    grid-template-columns: 84px auto minmax(0, 1fr);
    gap: 8px 12px;
  }

  .worklog-record-details > summary > span:nth-child(3) {
    grid-row: 2;
    grid-column: 1 / -1;
  }

  .worklog-record-summary-meta {
    grid-row: 1;
    grid-column: 3;
    flex-wrap: wrap;
  }
}

/* Let the result form define the row height so its save action remains visible. */
.inspection-workspace { grid-template-rows: auto minmax(0, 1fr); }
.inspection-top-grid { height: auto; align-items: start; }
.inspection-top-grid .quick-note-card,
.inspection-top-grid .inspection-result-card {
  height: auto;
}

.admin-users-page .admin-account-table th:last-child,
.admin-users-page .admin-account-table td:last-child { width: 230px; }

.admin-user-delete-action {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  white-space: nowrap;
}

.admin-user-delete-action svg {
  width: 16px;
  height: 16px;
}

.admin-users-page .table-actions .admin-user-delete-action span {
  color: inherit;
  font-size: inherit;
}

/* Directory and metric rows keep the same data while reducing repeated card chrome. */
.portfolio-metrics,
.ops-metrics,
.admin-user-metrics,
.bug-report-metrics,
.artifact-metrics {
  gap: 0;
  padding: 20px 0;
  border-bottom: 1px solid var(--ui-border);
}

:where(.portfolio-metrics, .ops-metrics, .admin-user-metrics, .bug-report-metrics, .artifact-metrics) > * {
  padding: 0 18px;
  border: 0;
  border-left: 1px solid var(--ui-border);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

:where(.portfolio-metrics, .ops-metrics, .admin-user-metrics, .bug-report-metrics, .artifact-metrics) > *:first-child {
  padding-left: 0;
  border-left: 0;
}

:where(.portfolio-metrics, .ops-metrics, .admin-user-metrics, .bug-report-metrics, .artifact-metrics) strong {
  color: var(--ui-text);
  font-size: 26px;
  letter-spacing: -.04em;
}

.portfolio-site-grid,
.directory-grid,
.ops-site-grid,
.site-directory-grid { gap: 12px; padding: 16px; }

.portfolio-site-card,
.directory-card,
.ops-site-card,
.site-directory-card {
  border-color: var(--ui-border);
  border-radius: 9px;
  box-shadow: none;
}

.portfolio-site-card:hover,
.directory-card:hover,
.ops-site-card:hover,
.site-directory-card:hover {
  border-color: var(--primary-300);
  background: var(--primary-50);
}

/* Forms and detail pages use one readable label and action rhythm. */
:where(.form-card, .quick-log-card, .bug-report-form, .account-metadata-edit-form,
  .admin-tag-form, .handover-request-form, .inventory-upload-form) form,
:where(form.form-card, form.quick-log-card, form.bug-report-form, form.account-metadata-edit-form,
  form.admin-tag-form, form.handover-request-form, form.inventory-upload-form) {
  gap: 22px;
  padding: 20px;
}

form label,
form legend { color: var(--ui-text); font-weight: 700; }
form label small,
.form-help { color: var(--ui-text-muted); font-weight: 400; }

.form-actions {
  gap: 8px;
  padding-top: 18px;
  border-top: 1px solid var(--ui-border);
}

.field-capture-dropzone,
.bug-capture-dropzone,
.inline-artifact-upload,
.inventory-import-start {
  border-color: var(--ui-border-strong);
  border-radius: 10px;
  background: var(--ui-canvas);
}

.field-quick-form > header {
  border-bottom: 1px solid var(--ui-border);
  color: var(--ui-text);
  background: var(--ui-canvas);
}

.field-quick-form > header span { color: var(--ui-primary); }
.field-quick-form > header h2 { color: var(--ui-text); }
.field-quick-form > header p { color: var(--ui-text-muted); }

.site-context-header,
.site-detail-header,
.ops-page-header,
.portfolio-heading,
.directory-heading {
  padding-bottom: 20px;
  border-bottom: 1px solid var(--ui-border);
}

.site-scope-banner,
.preview-banner,
.post-action-banner {
  border-color: var(--primary-200);
  border-radius: 8px;
  color: var(--primary-800);
  background: var(--primary-50);
}

.site-side-summary,
.detail-facts,
.account-summary,
.identity-account-summary {
  border-color: var(--ui-border);
  border-radius: 10px;
  background: var(--ui-canvas);
}

.app-modal-backdrop { background: rgb(19 34 53 / 48%); }
.app-modal {
  border-color: var(--ui-border);
  border-radius: 14px;
  color: var(--ui-text);
  background: #fff;
  box-shadow: 0 22px 64px rgb(19 34 53 / 22%);
}
.app-modal-body { color: var(--ui-text-muted); background: #fff; }

/* Authentication follows the same product typography and control language. */
.auth-screen {
  color: var(--ui-text);
  background: #f3f6fa;
}

.auth-brand { color: var(--ui-text); }
.auth-card {
  border: 1px solid var(--ui-border);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 18px 50px rgb(19 34 53 / 10%);
}

.auth-card > header { border-bottom-color: var(--ui-border); }
.auth-card > header span { color: var(--ui-primary); }
.auth-card > header h1 { color: var(--ui-text); letter-spacing: -.04em; }
.auth-card > header p,
.auth-note { color: var(--ui-text-muted); }
.auth-form { gap: 18px; }
.auth-form .primary-action { width: 100%; }

@media (max-width: 1024px) {
  .app-shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { width: min(288px, calc(100vw - 48px)); }
  .topbar { padding-inline: 20px; }
  #main-content { padding-inline: 20px; }
}

@media (max-width: 760px) {
  :root {
    --ui-font-page-title: 23px;
    --ui-control-height: 44px;
    --ui-shell-gap: 16px;
  }

  .topbar { min-height: 68px; height: auto; padding: 10px 16px; }
  #main-content { padding: 20px 16px 30px; }
  .app-footer { padding-inline: 16px; }

  .topbar-page-identity h1,
  .topbar .site-context-title h1,
  .ops-page-header h1,
  .site-detail-header h1,
  .portfolio-heading h1,
  .directory-heading h1,
  .screen-header h1,
  .page-header h1 { font-size: 23px; }

  :where(.content-list-toolbar, .dashboard-scope, .operations-command-row, .operations-search-row,
    .site-directory-command, .library-command-bar, .knowledge-command-bar, .work-command-bar,
    .site-library-controls, .audit-filter-card) { padding: 12px; }

  .dashboard-signal-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px 0;
    padding-block: 8px 22px;
  }

  .dashboard-signal-row a { padding-inline: 14px; }
  .dashboard-signal-row a:nth-child(odd) { padding-left: 0; border-left: 0; }
  .dashboard-signal-row strong { font-size: 24px; }

  :where(.portfolio-metrics, .ops-metrics, .admin-user-metrics, .bug-report-metrics, .artifact-metrics) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px 0;
  }

  :where(.portfolio-metrics, .ops-metrics, .admin-user-metrics, .bug-report-metrics, .artifact-metrics) > *:nth-child(odd) {
    padding-left: 0;
    border-left: 0;
  }

  .site-context-header,
  .site-detail-header,
  .ops-page-header,
  .portfolio-heading,
  .directory-heading { padding-bottom: 16px; }

  .site-context-header { margin-inline: 0; }

  th { padding: 11px 10px; }
  td { padding: 13px 10px; }
}

/* Shell hierarchy: navigation stays available without becoming a second page
 * header.  The same surface tokens support both light and dark themes. */
.workspace { background: var(--ui-canvas); }

.sidebar,
.sidebar .brand,
.sidebar .secondary-nav { background: var(--ui-surface-subtle); }

.sidebar .brand {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-inline: 10px;
}

.brand-identity {
  flex: 1 1 auto;
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 6px;
}

.brand-identity .brand-logo { flex: 0 0 auto; width: 40px; height: 28px; }
.brand-identity strong { overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }

.sidebar-collapse-toggle,
.sidebar-theme-toggle {
  border: 0;
  color: var(--ui-text-muted);
  background: transparent;
  font: inherit;
  cursor: pointer;
}

.sidebar-collapse-toggle {
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  padding: 0;
  border-radius: 7px;
  font-size: 22px;
  line-height: 1;
}

.sidebar-collapse-toggle:hover,
.sidebar-collapse-toggle:focus-visible { color: var(--ui-text); background: var(--ui-surface); }

.sidebar-theme-toggle {
  width: 100%;
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  text-align: left;
  font-weight: 650;
}

.sidebar-theme-toggle > span:first-child { width: 20px; color: currentColor; font-size: 18px; text-align: center; }
.sidebar-theme-toggle:hover,
.sidebar-theme-toggle:focus-visible { color: var(--ui-text); background: var(--ui-surface); }

.app-footer {
  min-height: 38px;
  padding-block: 10px;
  border-top: 1px solid var(--ui-border);
  color: var(--ui-text-muted);
  background: transparent;
}

.topbar {
  background: var(--ui-surface);
  box-shadow: none;
}

.topbar-page-actions .page-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-page-actions .dashboard-scope {
  height: var(--ui-control-height);
  min-height: var(--ui-control-height);
  padding: 3px;
  box-sizing: border-box;
}

.topbar-page-actions .dashboard-scope > .sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.topbar-page-actions .dashboard-scope a {
  min-height: calc(var(--ui-control-height) - 8px);
}

.site-directory-card[data-site-open] { cursor: pointer; }
.site-directory-card[data-site-open]:focus-visible {
  outline: 3px solid rgb(23 91 181 / 24%);
  outline-offset: 2px;
  border-color: var(--ui-primary);
}
.site-directory-card[data-site-open] footer { justify-content: flex-start; }

.user-preferences-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.user-preferences-form .full { grid-column: 1 / -1; }
.user-preferences-identity {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  align-items: baseline;
  gap: 8px 10px;
  padding: 12px 14px;
  border: 1px solid var(--ui-border);
  border-radius: 8px;
  background: var(--ui-surface-muted);
}
.user-preferences-identity > span { color: var(--ui-text-muted); font-size: 12px; }
.user-preferences-identity strong { color: var(--ui-text); }
.user-preferences-identity small { color: var(--ui-text-muted); font-size: 12px; }

.sidebar-collapsed .brand { padding-inline: 10px; }
.sidebar-collapsed .brand-identity strong { display: none; }
.sidebar-collapsed .brand-identity .brand-logo { width: 42px; }
.sidebar-collapsed .sidebar-theme-toggle { justify-content: center; padding-inline: 0; }
.sidebar-collapsed .sidebar-theme-toggle > span:last-child { display: none; }

html[data-theme="dark"] {
  --ui-canvas: #0d1520;
  --ui-surface: #172332;
  --ui-surface-subtle: #121d2b;
  --ui-surface-muted: #111c2a;
  --ui-text: #e8eef6;
  --ui-text-muted: #a6b4c5;
  --ui-border: #2d4055;
  --ui-border-strong: #40566d;
}

html[data-theme="dark"] .workspace,
html[data-theme="dark"] #main-content { background: var(--ui-canvas); }
html[data-theme="dark"] .sidebar,
html[data-theme="dark"] .sidebar .brand,
html[data-theme="dark"] .sidebar .secondary-nav { background: var(--ui-surface-subtle); }
html[data-theme="dark"] .topbar { background: var(--ui-canvas); }
html[data-theme="dark"] .app-footer { background: transparent; }
html[data-theme="dark"] .sidebar-collapse-toggle:hover,
html[data-theme="dark"] .sidebar-theme-toggle:hover { background: #1a2a3d; }
html[data-theme="dark"] .site-directory-card { background: var(--ui-surface); }

@media (max-width: 760px) {
  .user-preferences-form { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .user-preferences-identity { grid-template-columns: 1fr; gap: 3px; }
  .sidebar-collapse-toggle { display: grid; }
}

@media (max-width: 420px) {
  #main-content { padding-inline: 12px; }
  .app-footer { padding-inline: 12px; }
  .auth-card { border-radius: 12px; box-shadow: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
.site-location-picker { width: 100%; min-width: 0; display: grid; gap: 10px; }
.site-location-picker > p { margin: 0; color: var(--ui-text-muted); }
.site-location-map { height: 320px; width: 100%; min-width: 0; z-index: 0; border: 1px solid var(--ui-border); border-radius: 8px; }
.site-location-picker > button { justify-self: start; }
.site-location-picker > small { color: var(--ui-text-muted); }
.site-location-map .leaflet-control a { color: #23354c; }
.site-location-map .leaflet-marker-icon { max-width: none; }
@media (max-width: 760px) {
  .site-location-map { height: 280px; }
}

.worklog-record-summary-meta { display: flex; flex-wrap: wrap; width: auto; }
.site-location-picker .google-location-pin {
  position: absolute; transform: translate(-50%, -100%); display: block;
  width: 30px; height: 40px; min-height: 0; padding: 0;
  border: 0; border-radius: 0; background: transparent;
  cursor: grab; touch-action: none; z-index: 2;
}
.site-location-picker .google-location-pin:active { cursor: grabbing; }
.site-location-picker .google-location-pin:focus-visible { outline: 3px solid #175bb5; outline-offset: 4px; }
.site-location-map .gm-style button { min-height: 0; }
.site-location-map { overflow: hidden; }

/* Ordinary pages, including the dashboard, keep document scrolling so content
   below the fold always remains reachable.  Fixed workspaces opt in below. */
@media (min-width: 1025px) {
  html,
  body {
    height: auto;
    min-height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
  }

  .app-shell,
  .workspace {
    height: auto;
    min-height: 100dvh;
    overflow: visible;
  }

  html:has(.site-detail-page),
  body:has(.site-detail-page),
  html:has(.site-directory-page),
  body:has(.site-directory-page) {
    height: 100%;
    overflow: hidden;
  }

  body:has(.site-detail-page) :is(.app-shell, .workspace),
  body:has(.site-directory-page) :is(.app-shell, .workspace) {
    height: 100dvh;
    min-height: 0;
    overflow: hidden;
  }

  #main-content:has(.site-detail-page) {
    height: auto;
    min-height: 0;
    display: flex;
    flex: 1 1 auto;
    overflow: hidden;
  }

  .site-detail-page { height: 100%; }

  #main-content:has(.site-directory-page) {
    min-height: 0;
    display: flex;
    flex: 1 1 auto;
    overflow: hidden;
  }

  .site-directory-page {
    width: 100%;
    min-height: 0;
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr);
    overflow: hidden;
  }

  .site-directory-page > :is(.site-directory-grid, .handover-directory-grid) {
    min-height: 0;
    align-content: start;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
    padding-right: 8px;
    padding-bottom: 16px;
  }

  .site-detail-page .worklog-layout {
    align-items: stretch;
  }

  .site-detail-page .worklog-layout > :is(.quick-log-card, .worklog-history-card) {
    height: auto;
    max-height: none;
    min-height: 0;
    display: block;
    overflow: visible;
  }

  .site-detail-page .quick-log-card > form,
  .site-detail-page .worklog-history-card .worklog-history {
    min-height: initial;
    display: block;
    flex: initial;
    overflow: visible;
    overscroll-behavior: auto;
    scrollbar-gutter: auto;
  }

  .site-overview-evidence {
    align-items: stretch;
  }

  .site-overview-evidence > .site-panel {
    min-height: 255px;
    height: 100%;
    align-self: stretch;
    display: flex;
    flex-direction: column;
    margin: 0;
  }

  .site-overview-evidence > .site-panel > :is(.compact-list, .photo-grid, .compact-empty) {
    flex: 1 1 auto;
  }

  .site-overview-evidence > .site-panel > .compact-empty {
    display: grid;
    place-content: center;
    margin: 0;
    padding: 18px;
  }

  .site-context-header .site-tabs {
    display: flex;
    justify-content: flex-start;
    gap: 0;
    overflow: visible;
    padding: 0;
  }

  .site-context-header .site-tabs a,
  .site-context-header .site-tabs a.active {
    flex: 0 0 156px;
    min-width: 156px;
  }
}

/* Reduced viewport height usually means browser zoom or a small display.  In
   that case a normal document scrollbar is safer than a cramped inner list. */
@media (min-width: 1025px) and (max-height: 760px) {
  html:has(.site-detail-page),
  body:has(.site-detail-page),
  html:has(.site-directory-page),
  body:has(.site-directory-page) {
    height: auto;
    min-height: 100%;
    overflow-y: auto;
  }

  body:has(.site-detail-page) :is(.app-shell, .workspace),
  body:has(.site-directory-page) :is(.app-shell, .workspace),
  #main-content:has(.site-directory-page),
  .site-directory-page {
    height: auto;
    min-height: 0;
    display: block;
    overflow: visible;
  }

  .site-directory-page > :is(.site-directory-grid, .handover-directory-grid) {
    overflow: visible;
    padding-right: 0;
  }
}

/* The dashboard range selector belongs in the same action row as the field
   capture button; its generic toolbar spacing must not affect that row. */
.topbar-page-actions,
.topbar-page-actions .page-header-actions {
  display: flex;
  align-items: center;
}

.topbar-page-actions .dashboard-scope {
  margin: 0;
}

/* The expanded sidebar carries the company mark first and its name below it.
   The collapse control remains available without competing with the mark. */
@media (min-width: 1025px) {
  .sidebar .brand {
    position: relative;
    flex-direction: column;
    justify-content: center;
    gap: 1px;
    padding: 7px 42px 7px 12px;
  }

  .brand-identity {
    min-width: 0;
    flex: 0 0 auto;
    flex-direction: column;
    align-items: center;
    gap: 1px;
  }

  .brand-identity .brand-logo {
    width: 76px;
    height: 34px;
  }

  .brand-identity strong {
    overflow: visible;
    color: var(--ui-text);
    font-size: 12px;
    line-height: 1.2;
    text-overflow: clip;
    white-space: nowrap;
  }

  .sidebar-collapse-toggle {
    position: absolute;
    top: 50%;
    right: 8px;
    transform: translateY(-50%);
  }

  .sidebar-collapsed .sidebar .brand {
    padding: 0;
    justify-content: center;
  }

  .sidebar-collapsed .brand-identity { display: none; }

  .sidebar-collapsed .sidebar-collapse-toggle {
    position: static;
    transform: none;
  }
}

/* Work records use one shared desktop work surface. The card frames end on the
   same baseline; only the record list owns overflow when its rows exceed the
   available space. */
.worklog-history-card > header .record-actions {
  align-items: center;
  gap: 10px;
}

.worklog-result-count {
  color: var(--ui-text-muted);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.worklog-history-card .worklog-trash-link {
  min-height: 40px;
  padding-inline: 11px;
}

@media (min-width: 1025px) and (min-height: 761px) {
  .site-detail-page .worklog-layout {
    height: 100%;
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(320px, 42fr) minmax(480px, 58fr);
    grid-template-rows: minmax(0, 1fr);
    align-items: stretch;
    gap: 14px;
    overflow: hidden;
  }

  .site-detail-page .worklog-layout > :is(.quick-log-card, .worklog-history-card) {
    height: 100%;
    min-height: 0;
    max-height: none;
    overflow: hidden;
  }

  .site-detail-page .worklog-layout > .quick-log-card {
    grid-column: 1;
    grid-row: 1;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
  }

  .site-detail-page .quick-log-card > header,
  .site-detail-page .worklog-history-card > header {
    min-height: 54px;
    padding: 12px 16px;
  }

  .site-detail-page .quick-log-card > form {
    min-height: 0;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto auto;
    gap: 0;
    overflow: hidden;
    padding: 0;
  }

  .site-detail-page .quick-log-title {
    margin: 0;
    padding: 14px 16px 0;
  }

  .site-detail-page .quick-log-body {
    min-height: 0;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    padding: 12px 16px 14px;
  }

  .site-detail-page .quick-log-card textarea {
    height: 100%;
    min-height: 150px;
    resize: none;
  }

  .site-detail-page .quick-log-attachments:not([hidden]) {
    max-height: 76px;
    margin: 0;
    padding: 8px 16px;
    overflow-y: auto;
    border-top: 1px solid var(--ui-border);
    background: var(--ui-surface-subtle);
  }

  .site-detail-page .quick-log-actions {
    min-height: 62px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 8px;
    margin: 0;
    padding: 11px 16px;
    border-top: 1px solid var(--ui-border);
    background: var(--ui-surface-subtle);
  }

  .site-detail-page .quick-log-actions > label {
    width: auto;
    min-width: 0;
    white-space: nowrap;
  }

  .site-detail-page .quick-log-actions > span {
    min-width: 0;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .site-detail-page .quick-log-actions .quick-log-file-button,
  .site-detail-page .quick-log-actions .primary-action {
    min-height: 40px;
    justify-content: center;
  }

  .site-detail-page .worklog-layout > .worklog-history-card {
    grid-column: 2;
    grid-row: 1;
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr);
  }

  .site-detail-page .worklog-history-card > :is(header, .worklog-filter, .worklog-history) {
    width: auto;
    min-width: 0;
  }

  .site-detail-page .worklog-history-card.showing-deleted {
    grid-column: 1 / -1;
  }

  .site-detail-page .worklog-history-card .worklog-history {
    min-height: 0;
    display: block;
    flex: none;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
  }

  .site-detail-page .worklog-record-details > summary,
  .site-detail-page .worklog-history > a {
    min-height: 78px;
    grid-template-columns: 82px 72px minmax(0, 1fr) auto;
    grid-template-rows: auto;
    gap: 10px;
    padding: 11px 14px;
  }

  .site-detail-page .worklog-record-details > summary > span:nth-child(3) {
    grid-row: auto;
    grid-column: auto;
  }

  .site-detail-page .worklog-record-summary-meta {
    grid-row: auto;
    grid-column: auto;
    justify-self: end;
  }

  .site-detail-page .worklog-history .worklog-type {
    width: fit-content;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .site-detail-page .worklog-layout > .worklog-note {
    display: none;
  }
}

@media (min-width: 1025px) and (max-width: 1600px) and (min-height: 761px) {
  .site-detail-page .worklog-layout {
    grid-template-columns: minmax(300px, 38fr) minmax(500px, 62fr);
  }

}

@media (max-width: 1024px), (max-height: 760px) {
  .site-detail-page .worklog-layout > .worklog-note {
    display: flex;
  }
}

/* Approved tidy record controls: one search line and contextual actions. */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.site-detail-page .worklog-filter { grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 8px; padding: 12px 16px; }
.site-detail-page .worklog-filter:has(.worklog-filter-reset) { grid-template-columns: minmax(0, 1fr) auto auto auto; }
.site-detail-page .worklog-filter .worklog-search-field { grid-column: 1; grid-row: 1; }
.site-detail-page .worklog-filter > button { grid-column: 2; grid-row: 1; }
.site-detail-page .worklog-filter .worklog-filter-reset { grid-column: 4; grid-row: 1; }
.worklog-filter-options { display: contents; }
.worklog-filter-options:not([open]) > .worklog-filter-fields { display: none; }
.worklog-filter-options > summary { grid-column: 3; grid-row: 1; list-style: none; cursor: pointer; }
.worklog-filter-options > summary::-webkit-details-marker { display: none; }
.worklog-filter-fields { grid-column: 1 / -1; grid-row: 2; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; padding-top: 8px; }
.site-detail-page .worklog-filter :is(input, select, button, a, summary) { min-height: 40px; }
.site-detail-page .worklog-filter label > span:not(.sr-only) { font-size: 12px; }
.site-detail-page .worklog-record-details[open] > summary > span:nth-child(3) > small { display: none; }
.site-detail-page .worklog-record-details { position: relative; }
.site-detail-page .worklog-record-details:not([open]) > .worklog-record-body { display: none; }
.worklog-attachment-form > input[type="file"] { display: none; }
.site-detail-page .worklog-record-heading p { font-size: 14px; line-height: 1.6; overflow-wrap: anywhere; }
.worklog-attachment-form { display: block; }
.worklog-attachment-pending:not([hidden]) { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 8px; margin-top: 16px; padding: 12px; border: 1px solid var(--ui-border); border-radius: 8px; background: var(--ui-surface-subtle); }
.worklog-attachment-pending > span { overflow-wrap: anywhere; color: var(--ui-text-muted); font-size: 12px; }
.worklog-record-attribution { min-width: 0; color: var(--ui-text-muted); font-size: 12px; }
.worklog-record-attribution .worklog-revision-note { margin: 0; }
.artifact-page-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.artifact-detail-page .artifact-version-history > header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.artifact-detail-page .artifact-version-row { grid-template-columns: 90px minmax(0, 1fr); min-height: 64px; padding: 12px 16px; }
.artifact-detail-page .artifact-version-row strong { font-size: 14px; overflow-wrap: anywhere; }
.artifact-detail-page .artifact-version-row :is(time, small) { color: var(--ui-text-muted); font-size: 12px; }
.artifact-previous-versions > summary, .artifact-admin-details > summary { min-height: 44px; padding: 12px 16px; color: var(--ui-text-muted); font-size: 14px; cursor: pointer; }
.artifact-previous-versions > summary { border-top: 1px solid var(--ui-border); }
.artifact-previous-versions > summary span { margin-left: 8px; font-size: 12px; }
.artifact-detail-page .artifact-information-list { display: grid; gap: 0; margin: 0; padding: 0 16px; }
.artifact-information-list > div { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--ui-border); }
.artifact-information-list > div:last-child { border-bottom: 0; }
.artifact-information-list dt { color: var(--ui-text-muted); font-size: 12px; }
.artifact-information-list dd { margin: 0; font-size: 14px; overflow-wrap: anywhere; }
.artifact-detail-page .artifact-link-row { grid-template-columns: 90px minmax(0, 1fr); padding: 12px 16px; }
.artifact-detail-page .artifact-link-row :is(small, span) { font-size: 12px; }
.artifact-detail-page .artifact-link-row strong { font-size: 14px; overflow-wrap: anywhere; }
.artifact-preview-page .file-preview { padding: 0; overflow: hidden; }
.artifact-preview-page .file-preview iframe { width: 100%; min-height: 65vh; border: 0; }
.artifact-preview-page .artifact-preview-image { display: block; max-width: 100%; max-height: 70vh; margin: auto; object-fit: contain; }
.site-detail-page .worklog-management-actions { margin-left: auto; }
.worklog-more-popover .worklog-photo-download > span { display: inline; }
.site-detail-page .worklog-file-download { width: 40px; min-width: 40px; height: 40px; }
.site-detail-page .worklog-file-download .ui-icon { width: 18px; height: 18px; }
@media (max-width: 760px) {
  .site-detail-page .worklog-filter { padding: 12px; }
  .site-detail-page .worklog-filter .worklog-filter-reset { grid-column: 1 / -1; grid-row: 3; justify-self: end; }
  .site-detail-page .worklog-filter:has(.worklog-filter-reset) { grid-template-columns: minmax(0, 1fr) auto auto; }
  .worklog-filter-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .worklog-filter-fields > label:last-child { grid-column: 1 / -1; }
  .site-detail-page .worklog-filter :is(input, select, button, a, summary), .site-detail-page .worklog-record-actions :is(button, summary) { min-height: 44px; }
  .worklog-attachment-pending:not([hidden]) { grid-template-columns: 1fr 1fr; }
  .worklog-attachment-pending > span { grid-column: 1 / -1; }
  .worklog-attachment-pending > button { min-height: 44px; justify-content: center; }
  .worklog-record-actions .worklog-record-attribution { flex: 1; }
  .artifact-information-list > div { grid-template-columns: 90px minmax(0, 1fr); }
  .artifact-page-actions > a { min-height: 44px; }
}

/* Organized operations: one navigation rail and a bounded content workspace.
   Use the shared type/control tokens without changing forms or API contracts. */
.site-detail-page .operations-workspace {
  min-width: 0;
  width: 100%;
  grid-template-columns: minmax(0, 1fr);
}
.site-detail-page .operations-command-row {
  position: relative;
  z-index: 3;
  min-height: 52px;
  display: flex;
  align-items: center;
  margin: 0;
  padding: 0 0 10px;
  border: 0;
  border-bottom: 1px solid var(--ui-border);
  border-radius: 0;
  background: transparent;
}
.site-detail-page .operations-command-row .operations-subtabs {
  min-width: 0;
  min-height: 42px;
  display: flex;
  flex: 1 1 auto;
  align-items: stretch;
  gap: 20px;
  margin: 0;
  padding: 0;
  border: 0;
}
.site-detail-page .operations-command-row .operations-subtabs a {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  padding: 0 2px;
  font-size: 14px;
  line-height: 22px;
  white-space: nowrap;
}
.site-detail-page .operations-board-actions {
  min-width: 0;
  display: flex;
  flex: 0 1 auto;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.site-detail-page .operations-workspace :is(.primary-action, .outline-action, .icon-action, .operations-export-menu > summary) {
  min-height: 40px;
  box-sizing: border-box;
  font-size: 13px;
  line-height: 20px;
}
.site-detail-page .operations-workspace .icon-action {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  padding: 0;
}
.site-detail-page .operations-workspace .icon-action .ui-icon { width: 18px; height: 18px; }
.site-detail-page .operations-workspace > .detail-card { margin-top: 0; }
.site-detail-page .operations-access-note {
  flex: 0 0 auto;
  min-width: 0;
  border-bottom: 1px solid var(--ui-border);
  background: var(--ui-surface);
}
.site-detail-page .operations-access-note > summary {
  min-height: 44px;
  padding: 12px 16px;
  cursor: pointer;
  color: var(--ui-text);
  font-size: 14px;
  line-height: 20px;
}
.site-detail-page .operations-access-note > summary span {
  margin-left: 12px;
  color: var(--ui-text-muted);
  font-size: 12px;
}
.site-detail-page .operations-access-note-body {
  max-height: min(220px, 28vh);
  overflow: auto;
  padding: 0 16px 12px;
  overflow-wrap: anywhere;
}
.site-detail-page .operations-access-note .note-content { padding: 0; }
.site-detail-page .operations-access-note .note-inline-image {
  max-width: 100%;
  border-color: var(--ui-border);
  background: var(--ui-surface);
}
.site-detail-page .operations-access-note .note-inline-image img { max-width: 100%; }
.site-detail-page .operations-access-note .note-inline-image figcaption {
  color: var(--ui-text-muted);
  background: var(--ui-surface);
}
.site-detail-page .operations-access-note-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 0 16px 12px;
}
.site-detail-page .operations-access-note-actions small {
  margin-right: auto;
  color: var(--ui-text-muted);
  font-size: 12px;
}

.site-detail-page .operations-memo-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
}
.site-detail-page .operations-memo-body .operations-access-note-body {
  max-height: none;
  overflow: visible;
}
.site-detail-page .operations-inspection-note { padding: 16px; }
.site-detail-page .operations-inspection-note h3 {
  margin: 0 0 12px;
  color: var(--ui-text-muted);
  font-size: 14px;
  line-height: 22px;
}
.site-detail-page .operations-inspection-note .note-content { padding: 0; }
@media (max-width: 1024px), (max-height: 760px) {
  .site-detail-page .operations-memo-body { flex: none; overflow: visible; }
}
.site-detail-page .operations-account-tools {
  min-height: 64px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 16px;
  background: var(--ui-surface);
}
.site-detail-page .operations-account-tools .operations-search-row {
  min-width: 0;
  min-height: 40px;
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto auto auto;
  flex: 1 1 100%;
  align-items: center;
  gap: 12px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}
.site-detail-page .operations-search-row label { min-width: 0; max-width: none; display: block; }
.site-detail-page .operations-search-row .sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  border: 0;
  white-space: nowrap;
}
.site-detail-page .operations-search-input { position: relative; display: block; min-width: 0; }
.site-detail-page .operations-search-input > .ui-icon {
  position: absolute;
  top: 50%;
  left: 12px;
  z-index: 1;
  width: 18px;
  height: 18px;
  transform: translateY(-50%);
  color: var(--ui-text-muted);
  pointer-events: none;
}
.site-detail-page .operations-search-input > input {
  width: 100%;
  min-width: 0;
  min-height: 40px;
  height: 40px;
  padding: 8px 12px 8px 40px;
  font-size: 14px;
  line-height: 22px;
  background: var(--ui-input, var(--ui-surface));
}
.site-detail-page .operations-search-submit { height: 40px; padding-inline: 14px; justify-content: center; }
.site-detail-page .operations-search-count,
.site-detail-page .operations-search-row .vault-summary {
  color: var(--ui-text-muted);
  font-size: 12px;
  line-height: 20px;
  white-space: nowrap;
}
.site-detail-page .operations-search-row .vault-summary { min-width: 0; justify-self: end; margin: 0; }
.site-detail-page .operations-workspace > .detail-card > .responsive-table :is(th, td) {
  padding: 10px 16px;
  font-size: 14px;
  line-height: 22px;
  vertical-align: middle;
  border-width: 0 0 1px;
  border-color: var(--ui-border);
}
.site-detail-page .operations-workspace th { color: var(--ui-text-muted); font-weight: 600; }
.site-detail-page .operations-workspace .account-line { min-height: 40px; }
.site-detail-page .operations-workspace .account-line + .account-line { margin-top: 4px; padding-top: 4px; border-color: var(--ui-border); }
.site-detail-page .operations-workspace .server-group-cell dl { margin-top: 4px; }
.site-detail-page .operations-workspace :is(.server-group-cell dd, .account-access-cell small) { font-size: 12px; line-height: 20px; }
.site-detail-page .operations-workspace .server-group-cell dt { font-size: 11px; }
.site-detail-page .operations-workspace :is(.masked-secret, .server-group-cell dt, .server-group-cell dd, .account-access-cell small) { color: var(--ui-text-muted); font-weight: 500; }
.site-detail-page .operations-workspace input[type="checkbox"] { width: 18px; height: 18px; min-height: 18px; margin: 0; }
.site-detail-page .operations-workspace .detail-card > .operations-board-header {
  position: relative;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  min-height: 64px;
  flex: 0 0 auto;
  gap: 12px;
  padding: 12px 16px;
}
.site-detail-page .operations-board-title { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.site-detail-page .operations-board-title h2 { margin: 0; font-size: 16px; line-height: 24px; }
.site-detail-page .operations-board-title small { color: var(--ui-text-muted); font-size: 12px; }
.site-detail-page .operations-workspace .inventory-data-table table { min-width: 1040px; }
.site-detail-page .operations-workspace .inventory-archived-guide { margin: 0; padding: 8px 16px; font-size: 12px; }
.site-detail-page .operations-workspace > .operations-inventory-board.inventory-focus-mode { width: auto; height: auto; display: flex; flex-direction: column; }
.site-detail-page .operations-inventory-board.inventory-focus-mode > :is(header, .secret-reveal-status, .inventory-archived-guide) { flex: 0 0 auto; }
.site-detail-page .operations-inventory-board.inventory-focus-mode > .inventory-data-table { min-height: 0; height: auto; flex: 1 1 auto; overflow: auto; }
.site-detail-page .operations-history-board > header p { font-size: 12px; }

/* Inspection keeps the approved two-card layout and matching edges. */
.site-detail-page .inspection-workspace { width: 100%; min-height: 0; height: 100%; display: grid; grid-template-rows: minmax(0, 1fr); overflow: hidden; }
.site-detail-page .inspection-top-grid { width: 100%; height: 100%; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: stretch; gap: 16px; }
.site-detail-page .inspection-top-grid > :is(.quick-note-card, .inspection-files-card) { height: 100%; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.site-detail-page .inspection-top-grid > :is(.quick-note-card, .inspection-files-card) > header {
  box-sizing: border-box;
  min-height: 64px;
  height: auto;
  flex: 0 0 auto;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
}
.site-detail-page .inspection-top-grid > :is(.quick-note-card, .inspection-files-card) > header > div:first-child { min-width: 0; flex: 1 1 auto; }
.site-detail-page .inspection-top-grid > :is(.quick-note-card, .inspection-files-card) > header h2 { margin: 0; font-size: 16px; line-height: 24px; }
.site-detail-page .inspection-top-grid .record-actions { flex: 0 0 auto; flex-wrap: wrap; gap: 8px; }
.site-detail-page .inspection-top-grid .record-actions :is(a, button),
.site-detail-page .inspection-top-grid .quick-note-card > header > a { min-height: 40px; padding-inline: 12px; white-space: nowrap; }
.site-detail-page .inspection-top-grid :is(.note-content, .site-artifact-list) { min-height: 0; max-height: none; flex: 1 1 auto; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; }
.site-detail-page .inspection-top-grid .note-content { padding: 16px; font-size: 14px; line-height: 1.6; }
.site-detail-page .inspection-top-grid .operations-memo-body .note-content {
  padding: 0;
  flex: none;
  overflow: visible;
  scrollbar-gutter: auto;
}
.site-detail-page .inspection-top-grid .site-artifact-list > a { padding: 12px 16px; border-color: var(--ui-border); }
.site-detail-page .inspection-top-grid .site-artifact-list :is(strong, b) { font-size: 14px; line-height: 22px; }
.site-detail-page .inspection-top-grid .site-artifact-list small { font-size: 12px; line-height: 20px; }
.site-detail-page .inspection-top-grid .site-artifact-list > a > span { color: var(--ui-text-muted); }
.site-detail-page .inspection-top-grid .note-inline-image { border-color: var(--ui-border); background: var(--ui-surface); }
.site-detail-page .inspection-top-grid .note-inline-image figcaption { color: var(--ui-text-muted); background: var(--ui-surface); }
.site-detail-page .inspection-top-grid .quick-note-card > small,
.site-detail-page .inspection-top-grid .inspection-files-footer { min-height: 36px; display: flex; flex: 0 0 auto; align-items: center; margin: 0; padding: 8px 16px; border-top: 1px solid var(--ui-border); color: var(--ui-text-muted); font-size: 12px; line-height: 20px; overflow: visible; }
.site-detail-page .inspection-top-grid .inspection-files-footer small { font-size: inherit; }

@media (max-width: 1280px) {
  .site-detail-page .operations-command-row .operations-subtabs { width: 100%; max-width: 100%; overflow-x: auto; }
  .site-detail-page .operations-account-tools .operations-search-row { grid-template-columns: minmax(180px, 1fr) auto auto; }
  .site-detail-page .operations-search-row .vault-summary { grid-column: 1 / -1; justify-self: start; }
  .site-detail-page .inspection-top-grid > :is(.quick-note-card, .inspection-files-card) > header { align-items: stretch; flex-direction: column; }
}
@media (max-width: 1024px), (max-height: 760px) {
  .site-detail-page .operations-access-note-body { max-height: none; overflow: visible; }
  .site-detail-page .operations-workspace { height: auto; overflow: visible; }
  .site-detail-page .operations-workspace > .detail-card { height: auto; overflow: visible; }
  .site-detail-page .inspection-workspace { height: auto; overflow: visible; }
  .site-detail-page .inspection-top-grid { height: auto; grid-template-columns: minmax(0, 1fr); }
  .site-detail-page .inspection-top-grid > :is(.quick-note-card, .inspection-files-card) { height: auto; min-height: 0; overflow: visible; }
  .site-detail-page .inspection-top-grid :is(.note-content, .site-artifact-list) { overflow: visible; }
}
@media (max-width: 760px) {
  .site-detail-page .operations-command-row .operations-subtabs { gap: 18px; }
  .site-detail-page .operations-workspace :is(.primary-action, .outline-action, .icon-action, .operations-export-menu > summary) { min-height: 44px; }
  .site-detail-page .operations-workspace .icon-action { width: 44px; height: 44px; }
  .site-detail-page .operations-account-tools .operations-search-row { grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
  .site-detail-page .operations-search-count { grid-column: 1 / -1; }
  .site-detail-page .operations-search-input > input,
  .site-detail-page .operations-search-submit { height: 44px; }
  .site-detail-page .operations-workspace .operations-board-header .operations-board-actions {
    display: flex;
    width: 100%;
  }
  .site-detail-page .operations-workspace .operations-board-header .operations-board-actions > .outline-action {
    width: auto;
  }
  .site-detail-page .operations-workspace .operations-export-menu > div { right: 0; left: auto; box-sizing: border-box; width: min(240px, calc(100vw - 48px)); }
  .site-detail-page .operations-inventory-board:not(.inventory-focus-mode) .inventory-data-table table { min-width: 0; }
  .site-detail-page .operations-history-board table,
  .site-detail-page .operations-history-board tbody { display: block; min-width: 0; }
  .site-detail-page .operations-history-board thead { display: none; }
  .site-detail-page .operations-history-board tr:not(:has(td[colspan])) { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); padding: 8px; border-bottom: 1px solid var(--ui-border); }
  .site-detail-page .operations-history-board td[data-label] { min-width: 0; display: grid; gap: 4px; padding: 8px; border: 0; overflow-wrap: anywhere; }
  .site-detail-page .operations-history-board td[data-label]::before { content: attr(data-label); color: var(--ui-text-muted); font-size: 12px; }
  .site-detail-page .inspection-top-grid .record-actions { display: flex; width: 100%; }
  .site-detail-page .inspection-top-grid .record-actions > * { flex: 1 1 auto; justify-content: center; }
}

/* Brand lockups: A is the default vertical signature; C preserves the
   official-color artwork inside a neutral badge. */
.brand-lockup {
  width: 100%;
  min-width: 0;
  align-items: center;
  justify-content: center;
}

.brand-lockup-vertical {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.brand-wordmark {
  position: relative;
  display: inline-flex;
  align-items: baseline;
  color: var(--ui-text);
  font-family: "Segoe UI", Arial, sans-serif;
  font-size: 38px;
  font-weight: 500;
  letter-spacing: -3px;
  line-height: 1;
}

.brand-wordmark .brand-orbit {
  position: relative;
  display: inline-block;
  color: #4f78a8;
  font-style: italic;
  letter-spacing: -6px;
}

.brand-wordmark .brand-orbit::after {
  content: "";
  position: absolute;
  top: 16px;
  left: -5px;
  width: 31px;
  height: 8px;
  border-top: 3px solid #1769d2;
  border-radius: 50%;
  transform: rotate(-13deg);
}

.brand-wordmark .brand-n { color: #1769d2; }
.brand-wordmark .brand-it { margin-left: 3px; color: #526173; }

.sidebar .brand-lockup-vertical > strong {
  color: var(--ui-text);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: 0;
  white-space: nowrap;
}

.brand-lockup-official {
  display: none;
  gap: 5px;
}

.brand-logo-badge {
  flex: 0 0 46px;
  width: 46px;
  height: 32px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid #d7e0ea;
  border-radius: 8px;
  background: #fff;
}

.brand-lockup-official .brand-logo {
  width: 42px;
  height: 23px;
  object-fit: contain;
}

.brand-copy {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.brand-copy strong,
.brand-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-copy strong {
  color: var(--ui-text);
  font-size: 9.5px;
  line-height: 1.25;
}

.brand-copy small {
  color: var(--ui-text-muted);
  font-size: 7.5px;
  font-weight: 650;
  line-height: 1.25;
}

html[data-brand-mode="official"] .brand-lockup-vertical { display: none; }
html[data-brand-mode="official"] .brand-lockup-official { display: flex; }

@media (max-width: 760px) {
  .brand-identity { justify-content: center; }
  .brand-lockup-official { justify-content: flex-start; }
}
