/* Shared NeoUEM console primitives — tenant console + owner portal.
   Requires /brand.css (Noto Sans + --neouem-* tokens). */

/* ---- Typography & copy utilities ---- */
.detail-label {
  font-size: 12px;
  font-weight: 500;
  line-height: 16px;
  color: var(--text-muted, var(--neouem-text-secondary));
  margin-bottom: 4px;
  text-transform: none;
  letter-spacing: 0;
}
.text-strong { font-weight: 500; }
.form-hint {
  font-size: 12px;
  color: var(--text-muted, var(--neouem-text-secondary));
  margin-top: 4px;
  line-height: 1.4;
}
.form-section-title {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted, var(--neouem-text-secondary));
  margin-bottom: 6px;
  text-transform: none;
  letter-spacing: 0;
}
.page-subtitle {
  margin-top: 8px;
  margin-bottom: 24px;
  font-size: 14px;
  line-height: 22px;
  color: var(--text-secondary, var(--neouem-text-secondary));
  max-width: 65ch;
}
.page-subtitle--tight {
  margin-top: 8px;
  margin-bottom: 8px;
}

/* ---- Layout utilities ---- */
.mb-16 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; }
.mb-24 { margin-bottom: 24px; }
.mt-8 { margin-top: 8px; }
.hidden { display: none !important; }

/* ---- Buttons (Brand Kit 4px radius, 36px min height) ---- */
.btn {
  min-height: 36px;
  line-height: 1.4;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 7px 16px;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 120ms ease-out, border-color 120ms ease-out;
  border: 1px solid transparent;
  font-family: inherit;
  background: var(--bg-surface, var(--neouem-surface));
  color: var(--text-primary, var(--neouem-text));
}
.btn:hover { background: var(--bg-hover, var(--neouem-surface-subtle)); }
.btn-primary {
  background: var(--accent, var(--neouem-accent));
  color: var(--on-accent, var(--neouem-on-accent));
  border-color: var(--accent, var(--neouem-accent));
}
.btn-primary:hover { background: var(--accent-hover, var(--neouem-accent-hover)); }
.btn-secondary {
  background: var(--bg-surface, var(--neouem-surface));
  color: var(--accent, var(--neouem-accent));
  border: 1px solid var(--border-strong, var(--neouem-border-strong));
}
.btn-secondary:hover { background: var(--bg-hover, var(--neouem-surface-subtle)); }
.btn-danger {
  background: var(--danger-solid, #b3261e);
  color: #fff;
  border-color: var(--danger-solid, #b3261e);
}
.btn-danger:hover { background: #a83226; }
.btn-sm { min-height: 32px; padding: 6px 12px; font-size: 12px; }
.btn:disabled, .btn[aria-disabled="true"] {
  opacity: 0.48;
  cursor: not-allowed;
}

/* ---- Simple forms (owner + dialogs) ---- */
.form-row { margin-bottom: 14px; }
.form-row label, .form-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary, var(--neouem-text-secondary));
  margin-bottom: 4px;
}
.form-row input,
.form-row select,
.form-row textarea,
.form-input {
  width: 100%;
  max-width: 100%;
  min-height: 36px;
  padding: 7px 12px;
  border: 1px solid var(--border-strong, var(--neouem-border-strong));
  border-radius: 4px;
  background: var(--bg-surface, var(--neouem-surface));
  color: var(--text-primary, var(--neouem-text));
  font-family: inherit;
}

/* ---- Modals / native dialog ---- */
.dialog-message {
  display: block;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 14px;
  margin-bottom: 16px;
  text-wrap: pretty;
}
.modal-overlay {
  border: none;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  color: var(--text-primary, var(--neouem-text));
  padding: 16px;
  margin: 0;
  position: fixed;
  inset: 0;
  background: rgba(32, 33, 36, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s, overlay 0.2s allow-discrete, display 0.2s allow-discrete;
}
.modal-overlay::backdrop {
  background: rgba(32, 33, 36, 0.45);
  backdrop-filter: blur(2px);
  opacity: 0;
  transition: opacity 0.2s, overlay 0.2s allow-discrete, display 0.2s allow-discrete;
}
.modal-overlay[open]::backdrop { opacity: 1; }
@starting-style {
  .modal-overlay[open]::backdrop { opacity: 0; }
}
.modal-overlay.active,
.modal-overlay[open] { opacity: 1; visibility: visible; }
.modal {
  background: var(--bg-surface, var(--neouem-surface));
  border: 1px solid var(--border, var(--neouem-border));
  border-radius: 8px;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 0;
  transform: scale(0.95);
  transition: transform 0.2s ease-out;
}
.modal-overlay.active .modal,
.modal-overlay[open] .modal { transform: scale(1); }
@starting-style {
  .modal-overlay[open] .modal { transform: scale(0.95); }
}
@media (prefers-reduced-motion: reduce) {
  .modal-overlay, .modal-overlay::backdrop, .modal {
    transform: none !important;
    transition-duration: 0.05s !important;
  }
  @starting-style {
    .modal-overlay[open] .modal { transform: none !important; }
  }
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-subtle, var(--neouem-border));
}
.modal-title {
  font-size: 16px;
  font-weight: 500;
  font-family: "Noto Sans", Arial, sans-serif;
}
.modal-close {
  width: 28px;
  height: 28px;
  border-radius: 4px;
  border: none;
  background: transparent;
  color: var(--text-muted, var(--neouem-text-secondary));
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  line-height: 1;
}
.modal-close:hover {
  background: var(--bg-hover, var(--neouem-surface-subtle));
  color: var(--text-primary, var(--neouem-text));
}
.modal-body { padding: 20px 24px; }
.modal-footer {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding: 16px 20px;
  border-top: 1px solid var(--border-subtle, var(--neouem-border));
}

:focus-visible {
  outline: 2px solid var(--accent, var(--neouem-accent));
  outline-offset: 2px;
}

/* Minimal workspace: shared rhythm, quiet secondary actions, line iconography. */
.line-icon { width: 18px; height: 18px; flex: 0 0 auto; display: block; }
.line-icon * { vector-effect: non-scaling-stroke; }
.btn-secondary {
  color: var(--text-primary, var(--neouem-text));
  border-color: var(--border, var(--neouem-border));
  background: var(--bg-surface, var(--neouem-surface));
}
.btn-secondary:hover { border-color: var(--border-strong, var(--neouem-border-strong)); }
.modal-close { width: 36px; height: 36px; }
.modal-overlay { background: transparent; }
.modal-overlay::backdrop { backdrop-filter: none; }
body:not(.console-auth) .page-subtitle { margin-bottom: 0; }
body:not(.console-auth) .page-header { align-items: flex-start; margin-bottom: 24px; }
body:not(.console-auth) .page-actions { padding-top: 2px; }
body:not(.console-auth) .card-title { font-size: 16px; line-height: 24px; }
body:not(.console-auth) .card-header { padding: 14px 20px; min-height: 56px; }
body:not(.console-auth) .card-subtitle { margin-top: 4px; }
body:not(.console-auth) .card { border-radius: 6px; }
body:not(.console-auth) .page-content { padding: 28px; }
body:not(.console-auth) .sidebar { background: var(--bg-surface, var(--neouem-surface)); }
.nav-item, .subnav-item { font-family: inherit; text-align: left; }
.nav-section > .nav-item { width: 100%; background: transparent; border: 0; font-weight: 400; padding: 10px 12px; }
.nav-section > .nav-item:hover { background: var(--bg-hover, var(--neouem-surface-subtle)); }
.nav-section > .nav-item.active { background: var(--accent-bg, var(--neouem-accent-subtle)); font-weight: 500; }
.subnav-item { background: transparent; border: 0; border-bottom: 2px solid transparent; min-height: 44px; }
.subnav-item.active { border-bottom-color: var(--accent, var(--neouem-accent)); }
.subnav-icon .line-icon { width: 16px; height: 16px; }
.account-chevron { margin-left: auto; color: var(--text-muted, var(--neouem-text-secondary)); }
.account-chevron .line-icon { width: 16px; height: 16px; }
.user-avatar, .header-account-avatar { background: var(--bg-elevated, var(--neouem-surface-subtle)); color: var(--text-primary, var(--neouem-text)); }
.header-search input { border-color: var(--border, var(--neouem-border)); background: var(--bg-base, var(--neouem-canvas)); }
.header-search input:focus { border-color: var(--accent, var(--neouem-accent)); }
.search-shortcut { padding: 1px 5px; border: 1px solid var(--border, var(--neouem-border)); border-radius: 3px; font-family: inherit; }
.theme-toggle { width: 36px; height: 36px; padding: 0; justify-content: center; background: transparent; border-color: transparent; }
.stats-grid { margin-bottom: 24px; border-radius: 6px; }
.stat-card { padding: 18px 20px; }
.stat-header { margin-bottom: 6px; }
.stat-icon { background: transparent !important; }
.quick-action-icon { background: transparent !important; border: 0 !important; width: 28px; height: 32px; border-radius: 0; }
.quick-action { padding: 12px 4px; gap: 10px; }
.quick-action:hover { background: var(--bg-hover, var(--neouem-surface-subtle)); border-color: var(--border, var(--neouem-border)); }
.quick-action-desc { font-size: 12px; line-height: 18px; margin-top: 2px; }
.empty-state { padding: 32px 20px; }
.empty-state-art { width: 40px; height: 40px; margin-bottom: 12px; align-items: center; }
.empty-state-art .line-icon { width: 28px; height: 28px; }
.empty-state-title { font-weight: 500; }
.empty-state-desc { font-size: 13px; line-height: 20px; }
.empty-state > .btn { margin-top: 16px; }
.callout-warning { background: var(--bg-surface, var(--neouem-surface)); border-color: var(--border, var(--neouem-border)); border-left: 3px solid var(--warning, var(--neouem-warning)); }
.callout-icon { background: transparent; width: 24px; height: 24px; }
.callout-icon .line-icon { width: 22px; height: 22px; }
.data-table th { background: var(--bg-surface, var(--neouem-surface)); font-size: 12px; padding: 12px 16px; }
.data-table td { height: 44px; padding: 10px 16px; }
.device-item { padding: 12px 0; }
.platform-distribution { display: grid; gap: 4px; }
.platform-legend-row { display: grid; grid-template-columns: minmax(104px,1fr) minmax(48px,2fr) 60px 16px; gap: 16px; width: 100%; min-height: 48px; padding: 10px 4px; border: 0; background: transparent; color: var(--text-primary); font: inherit; text-align: left; border-radius: 4px; }
.platform-name { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.platform-bar { height: 4px; background: var(--bg-elevated); border-radius: 2px; overflow: hidden; }
.platform-bar > span { display: block; height: 100%; background: var(--accent); border-radius: inherit; }
.platform-count { display: flex; align-items: center; justify-content: flex-end; gap: 8px; font-size: 13px; font-variant-numeric: tabular-nums; }
.platform-count > span { color: var(--text-muted); font-size: 12px; }
.platform-arrow { color: var(--text-muted); }
.platform-arrow .line-icon { width: 16px; height: 16px; }
.owner-nav { display: grid; gap: 4px; }
.owner-portal .page-subtitle { margin-bottom: 24px; }
.owner-portal .card h2 { font-size: 16px; line-height: 24px; }
.owner-portal th, .owner-portal td { padding: 10px 12px; height: 44px; }
.owner-portal .badge { border-radius: 4px; }
.owner-portal .badge-warn { background: var(--neouem-warning-subtle); color: var(--neouem-warning); }
.owner-portal .skip-link { position: fixed; left: 12px; top: -80px; padding: 10px 16px; z-index: 2000; background: var(--neouem-accent); color: var(--neouem-on-accent); border-radius: 4px; }
.owner-portal .skip-link:focus { top: 12px; }
.owner-session-actions { display: flex; align-items: center; gap: 4px; margin-top: 12px; }
.owner-portal .sidebar-foot .btn { justify-content: flex-start; }
.owner-theme { min-width: 36px; }
@media (max-width: 800px) {
  .owner-portal .sidebar { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 16px 12px; padding: 16px; }
  .owner-portal .brand { margin-bottom: 0; }
  .owner-nav { grid-column: 1 / -1; display: flex; gap: 4px; overflow-x: auto; }
  .owner-nav .nav-btn { flex: 0 0 auto; width: auto; white-space: nowrap; min-height: 44px; font-size: 13px; padding: 10px; }
  .owner-portal .sidebar-foot { grid-column: 2; grid-row: 1; margin: 0; padding: 0; border: 0; }
  .owner-session-meta { display: none; }
  .owner-session-actions { margin-top: 0; }
  .owner-portal .sidebar-foot .btn { margin-top: 0 !important; min-height: 44px; }
}
@media (max-width: 768px) {
  body:not(.console-auth) .page-content { padding: 24px 16px; }
  body:not(.console-auth) .page-header { align-items: flex-start; }
  .header-btn, .header-primary, .theme-toggle { min-width: 44px; min-height: 44px; }
  .btn, .nav-item, .subnav-item, .modal-close { min-height: 44px; }
  .modal-close { min-width: 44px; }
  .stats-grid { gap: 1px; }
  .stat-card { padding: 16px; }
  .subnav-item { padding: 10px 12px; }
  .platform-legend-row { grid-template-columns: minmax(100px,1fr) minmax(24px,1fr) 56px 16px; gap: 8px; }
  .page-actions .btn { flex: 0 1 auto; }
}

/* Agent fleet update: keep summary, fields and actions out of the page grids. */
.agent-update-modal { max-width: 540px; }
.agent-update-modal .modal-header { gap: 16px; }
.agent-update-modal .modal-title { margin: 0; line-height: 1.5; }
.agent-update-modal .modal-close { flex-shrink: 0; }
.agent-update-body { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; }
.agent-update-body .form-group { margin-bottom: 0; min-width: 0; }
.agent-update-release {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 16px;
  background: var(--bg-base);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 13px;
}
.agent-update-release strong { color: var(--text-primary); font-size: 16px; font-weight: 600; }
.agent-update-description { margin: 0; color: var(--text-secondary); font-size: 14px; line-height: 1.6; }
.agent-update-hint { margin: 8px 0 0; color: var(--text-muted); font-size: 12px; line-height: 1.5; }
.agent-update-note { padding: 14px 16px; border-left: 2px solid var(--border); background: var(--bg-base); }
.agent-update-note strong { font-size: 13px; font-weight: 500; color: var(--text-primary); }
.agent-update-note p { margin: 6px 0 0; color: var(--text-secondary); font-size: 13px; line-height: 1.6; }
.agent-update-error { margin: 0; color: var(--danger); font-size: 13px; line-height: 1.5; overflow-wrap: anywhere; }
.agent-update-modal .modal-footer .btn { min-width: 110px; }
@media (max-width: 480px) {
  .agent-update-modal .modal-header { padding: 16px; }
  .agent-update-body { padding: 20px 16px; gap: 18px; }
  .agent-update-modal .modal-footer { padding: 16px; flex-direction: column-reverse; }
  .agent-update-modal .modal-footer .btn { width: 100%; }
}

/* Device detail snapshots retain every reported field without widening the page. */
.inventory-timestamp { color: var(--text-muted); font-size: 12px; }
.device-inventory .card-header { gap: 12px; flex-wrap: wrap; }
.inventory-caption { margin: 0 0 20px; color: var(--text-secondary); font-size: 13px; line-height: 1.6; }
.inventory-section { border-top: 1px solid var(--border-subtle); }
.inventory-section > summary, .inventory-table-section > summary { padding: 16px 0; cursor: pointer; font-size: 14px; font-weight: 500; }
.inventory-count { margin-left: 12px; color: var(--text-muted); font-size: 12px; font-weight: 400; white-space: nowrap; }
.inventory-section-body { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(100%,200px),1fr)); gap: 20px; padding: 0 0 20px; }
.inventory-section-body > * { min-width: 0; }
.inventory-field, .device-management-fields dd, .inventory-object dd { overflow-wrap: anywhere; font-size: 13px; line-height: 1.6; }
.inventory-object, .inventory-table-section { grid-column: 1 / -1; min-width: 0; }
.inventory-object h4 { margin: 0 0 12px; font-size: 13px; font-weight: 500; }
.inventory-object dl, .device-management-fields { margin: 0; }
.inventory-object dd, .device-management-fields dd { margin: 4px 0 0; }
.device-management-fields { display: grid; gap: 16px; }
.inventory-table-scroll { max-width: 100%; overflow: auto; max-height: 420px; }
.inventory-table-scroll .data-table { min-width: 100%; width: max-content; }
.inventory-table-scroll .data-table td { max-width: 360px; white-space: normal; overflow-wrap: anywhere; vertical-align: top; }
.inventory-table-scroll .data-table th { position: sticky; top: 0; z-index: 1; }
.inventory-json { margin: 0; max-height: 240px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 12px; }
.inventory-section > summary:focus-visible, .inventory-table-section > summary:focus-visible, .inventory-table-scroll:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
