/* Vwake admin / enterprise commercial workbench.
   Reuses style.css tokens and system sans; the ledger rail is the sole signature. */

.admin-enterprise-active .container {
  width: 100%;
  max-width: 1380px;
  padding-inline: clamp(12px, 2.5vw, 36px);
}

.admin-enterprise-active .admin-panel {
  min-width: 0;
  padding: clamp(12px, 2vw, 20px);
}

.admin-enterprise[hidden] { display: none; }
.admin-enterprise { min-width: 0; }

.enterprise-workbench {
  position: relative;
  display: grid;
  grid-template-columns: minmax(190px, 230px) minmax(0, 1fr);
  gap: 18px;
  min-height: 68vh;
}

.enterprise-sidebar {
  align-self: start;
  position: sticky;
  top: 14px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
}

.enterprise-sidebar h2,
.enterprise-detail-head h2,
.enterprise-card h3,
.enterprise-tool h4 {
  margin: 0;
  color: var(--text);
  font-family: inherit;
}

.enterprise-sidebar h2 { margin-top: 3px; font-size: 20px; }
.enterprise-sidebar > div:first-child > p,
.enterprise-detail-head p,
.enterprise-tool p,
.enterprise-simulator > p {
  margin-top: 4px;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.55;
}

.enterprise-eyebrow {
  color: var(--accent-light);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .1em;
}

.enterprise-org-lookup { margin: 18px 0; }
.enterprise-org-lookup > label,
.enterprise-confirm-label {
  display: block;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.5;
}
.enterprise-org-lookup > div { display: flex; gap: 6px; margin-top: 5px; }
.enterprise-org-lookup input { min-width: 0; flex: 1; }

.enterprise-sidebar-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 700;
}
.enterprise-sidebar-head small { color: var(--text-muted); font-weight: 400; }
.enterprise-org-list { display: grid; gap: 5px; margin-top: 8px; }
.enterprise-org-button {
  display: block;
  width: 100%;
  padding: 8px 9px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--text-secondary);
  text-align: left;
  cursor: pointer;
  font: inherit;
}
.enterprise-org-button span,
.enterprise-org-button code { display: block; overflow: hidden; text-overflow: ellipsis; }
.enterprise-org-button span { color: var(--text); font-size: 12px; font-weight: 600; }
.enterprise-org-button code { margin-top: 2px; color: var(--text-muted); font-size: 10px; }
.enterprise-org-button:hover { border-color: var(--border); background: var(--surface-hover); }
.enterprise-org-button.active { border-color: var(--accent); background: rgba(124, 92, 191, .14); }

.enterprise-detail { min-width: 0; }
.enterprise-detail-head,
.enterprise-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}
.enterprise-detail-head { align-items: center; margin-bottom: 14px; }
.enterprise-detail-head h2 { margin-top: 3px; font-size: clamp(24px, 3vw, 34px); }

.enterprise-ledger-rail {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 0 0 14px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  list-style: none;
}
.enterprise-ledger-node { position: relative; display: flex; gap: 9px; min-width: 0; }
.enterprise-ledger-node:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 6px;
  left: 12px;
  width: calc(100% - 14px);
  border-top: 1px solid var(--border);
}
.enterprise-ledger-node > span {
  position: relative;
  z-index: 1;
  width: 13px;
  height: 13px;
  flex: 0 0 auto;
  border: 2px solid var(--text-muted);
  border-radius: 50%;
  background: var(--bg);
}
.enterprise-ledger-node.ok > span { border-color: var(--success); }
.enterprise-ledger-node.warn > span { border-color: var(--bonus); }
.enterprise-ledger-node.danger > span { border-color: #ef5350; }
.enterprise-ledger-node b,
.enterprise-ledger-node small { display: block; }
.enterprise-ledger-node b { font-size: 11px; }
.enterprise-ledger-node small { margin-top: 2px; color: var(--text-secondary); font-size: 10px; line-height: 1.35; }

.enterprise-main-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.22fr) minmax(320px, .78fr);
  gap: 12px;
}
.enterprise-primary-column,
.enterprise-secondary-column { display: grid; align-content: start; gap: 12px; min-width: 0; }
.enterprise-card {
  min-width: 0;
  padding: 15px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
}
.enterprise-card h3 { margin-top: 2px; font-size: 15px; }
.enterprise-card-head > div > p { margin-top: 3px; color: var(--text-secondary); font-size: 11px; }
.enterprise-supporting { color: var(--text-secondary); font-size: 11px; line-height: 1.5; }
.enterprise-status.neutral { background: rgba(160, 160, 184, .12); color: var(--text-secondary); }
.enterprise-status.ok { background: rgba(76, 175, 80, .18); color: #8fd694; }
.enterprise-status.warn { background: rgba(255, 152, 0, .16); color: var(--bonus); }
.enterprise-status.danger { background: rgba(239, 83, 80, .16); color: #ef9a9a; }

.enterprise-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 14px 0 10px;
}
.enterprise-stat-grid > div { padding: 10px; border: 1px solid var(--border); border-radius: 8px; }
.enterprise-stat-grid span,
.enterprise-stat-grid strong { display: block; }
.enterprise-stat-grid span { color: var(--text-secondary); font-size: 10px; }
.enterprise-stat-grid strong { margin-top: 5px; font-size: 17px; font-variant-numeric: tabular-nums; }

.enterprise-policy-list { display: grid; gap: 9px; margin-top: 12px; }
.enterprise-policy {
  padding: 12px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}
.enterprise-policy.is-active { border-left-color: var(--accent-light); }
.enterprise-policy-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.enterprise-policy-head code { color: var(--text-muted); font-size: 10px; }
.enterprise-rate { margin: 9px 0 3px; color: var(--text); font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.enterprise-policy > p { color: var(--text-secondary); font-size: 12px; }
.enterprise-policy details,
.enterprise-simulator { margin-top: 10px; }
.enterprise-policy summary,
.enterprise-simulator summary { color: var(--accent-light); font-size: 11px; cursor: pointer; }
.enterprise-diff-list { display: grid; gap: 5px; margin: 8px 0 0; padding: 0; list-style: none; }
.enterprise-diff-list li { display: flex; justify-content: space-between; gap: 8px; color: var(--text-secondary); font-size: 10px; }
.enterprise-diff-list code { color: var(--text); overflow-wrap: anywhere; }
.enterprise-policy-actions { display: grid; gap: 8px; margin-top: 10px; }

.enterprise-mini-dl { display: grid; gap: 5px; margin-top: 9px; }
.enterprise-mini-dl > div { display: grid; grid-template-columns: 74px minmax(0, 1fr); gap: 8px; font-size: 11px; }
.enterprise-mini-dl dt { color: var(--text-muted); }
.enterprise-mini-dl dd { min-width: 0; color: var(--text-secondary); }
.enterprise-mini-dl code { display: inline-block; margin: 0 3px 3px 0; color: var(--text); }
.enterprise-break { overflow-wrap: anywhere; }

.enterprise-evidence { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); }
.enterprise-decision-grid { display: grid; gap: 8px; margin-top: 10px; }
.enterprise-action-form { padding-top: 9px; border-top: 1px dashed var(--border); }
.enterprise-action-form.compact { padding: 0; border: 0; }
.enterprise-confirm-label code { color: var(--text); overflow-wrap: anywhere; }
.enterprise-action-form .auth-btn,
.enterprise-tool .auth-btn { margin-top: 7px; }

.enterprise-table-wrap { margin-top: 10px; overflow-x: auto; }
.enterprise-table { width: 100%; border-collapse: collapse; font-size: 11px; }
.enterprise-table th,
.enterprise-table td { padding: 8px 7px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.enterprise-table th { color: var(--text-muted); font-weight: 600; }
.enterprise-table td { color: var(--text-secondary); }
.enterprise-table td b,
.enterprise-table td small { display: block; }
.enterprise-table td b { color: var(--text); }
.enterprise-table td small { margin-top: 3px; color: var(--text-muted); }

.enterprise-lock {
  display: flex;
  gap: 8px 12px;
  margin-top: 12px;
  padding: 10px;
  border: 1px solid rgba(255, 152, 0, .28);
  border-radius: 8px;
  background: rgba(255, 152, 0, .07);
  font-size: 11px;
}
.enterprise-lock b { color: var(--bonus); white-space: nowrap; }
.enterprise-lock span { color: var(--text-secondary); line-height: 1.45; }

.enterprise-issue-list,
.enterprise-audit-list { margin: 10px 0 0; padding: 0; list-style: none; }
.enterprise-issue-list li { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; padding: 8px 0; border-top: 1px solid var(--border); }
.enterprise-issue-copy { min-width: 0; }
.enterprise-issue-list b,
.enterprise-issue-list span { display: block; }
.enterprise-issue-list b { font-size: 11px; }
.enterprise-issue-list div > span { margin-top: 2px; color: var(--text-secondary); font-size: 10px; }
.enterprise-issue-copy > p { margin-top: 6px; color: var(--text-secondary); font-size: 10px; line-height: 1.45; }
.enterprise-issue-context { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 8px; margin-top: 7px; }
.enterprise-issue-context > div { min-width: 0; }
.enterprise-issue-context dt { color: var(--text-muted); font-size: 9px; }
.enterprise-issue-context dd { min-width: 0; margin-top: 1px; }
.enterprise-issue-context code { display: block; overflow-wrap: anywhere; color: var(--text); font-size: 9px; }
.enterprise-audit-list li { display: grid; grid-template-columns: 104px minmax(0, 1fr); gap: 9px; padding: 7px 0; border-top: 1px solid var(--border); }
.enterprise-audit-list time { color: var(--text-muted); font-size: 10px; }
.enterprise-audit-list b,
.enterprise-audit-list small { display: block; }
.enterprise-audit-list b { font-size: 11px; }
.enterprise-audit-list small { margin-top: 2px; color: var(--text-secondary); font-size: 10px; }

.enterprise-tool-grid { display: grid; gap: 9px; margin-top: 10px; }
.enterprise-tool { display: grid; gap: 6px; padding: 11px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
.enterprise-tool h4 { font-size: 12px; }
.enterprise-tool input,
.enterprise-tool select,
.enterprise-tool textarea,
.enterprise-org-lookup input,
.enterprise-action-form input,
.enterprise-simulator textarea {
  width: 100%;
  padding: 8px 9px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 12px;
}
.enterprise-simulator form { display: grid; gap: 7px; margin-top: 8px; }
.enterprise-simulator textarea { resize: vertical; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

.enterprise-empty,
.enterprise-loading,
.enterprise-empty-state {
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.6;
}
.enterprise-empty { padding: 14px 0; }
.enterprise-empty.compact { padding: 10px 0 0; }
.enterprise-loading,
.enterprise-empty-state {
  display: flex;
  min-height: 320px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px dashed var(--border);
  border-radius: 10px;
  text-align: center;
}
.enterprise-empty-state b { color: var(--text); font-size: 14px; }
.enterprise-empty-state.error b { color: #ef9a9a; }

.enterprise-notice {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  padding: 9px 11px;
  border: 1px solid rgba(76, 175, 80, .35);
  border-radius: 8px;
  background: rgba(76, 175, 80, .10);
  color: #8fd694;
  font-size: 12px;
  line-height: 1.5;
}
.enterprise-notice.error { border-color: rgba(239, 83, 80, .35); background: rgba(239, 83, 80, .10); color: #ef9a9a; }
.enterprise-notice.warn { border-color: rgba(255, 152, 0, .35); background: rgba(255, 152, 0, .10); color: var(--bonus); }
.enterprise-notice button { border: 0; background: transparent; color: inherit; cursor: pointer; font: inherit; }
.enterprise-busy-shield {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 10px;
  background: rgba(26, 26, 46, .72);
  color: var(--text);
  font-size: 12px;
}

.admin-enterprise :is(button, input, select, textarea, summary):focus-visible {
  outline: 2px solid var(--accent-light);
  outline-offset: 2px;
}

@media (max-width: 1050px) {
  .enterprise-main-grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .admin-enterprise-active .admin-tab-row { align-items: stretch; flex-direction: column; }
  .admin-enterprise-active .admin-tab-row [data-logout] { align-self: flex-end; margin: 0; }
  .admin-enterprise-active .admin-tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; }
  .admin-enterprise-active .admin-tabs .tab-btn { min-width: 0; white-space: normal; }
  .enterprise-workbench { grid-template-columns: 1fr; }
  .enterprise-sidebar { position: static; }
  .enterprise-ledger-rail { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 4px; }
  .enterprise-ledger-node:nth-child(2)::after { display: none; }
  .enterprise-stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 480px) {
  .enterprise-detail-head { align-items: flex-start; }
  .enterprise-ledger-rail { grid-template-columns: 1fr; }
  .enterprise-ledger-node::after { display: none; }
  .enterprise-mini-dl > div { grid-template-columns: 1fr; gap: 2px; }
  .enterprise-lock { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  .admin-enterprise *,
  .admin-enterprise *::before,
  .admin-enterprise *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
