#project-audit-view { flex: 1; min-width: 0; min-height: 0; overflow: hidden; }
#project-audit { display: flex; flex-direction: column; flex: 1; min-width: 0; min-height: 0; overflow: hidden; border: 1px solid #e2e8f0; border-radius: 12px; color: #1e293b; background: #fff; font-size: 14px; }
#project-audit * { box-sizing: border-box; }
#project-audit .audit-header { flex-shrink: 0; display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 20px 24px 16px; }
#project-audit h2 { margin: 0; font-size: 22px; font-weight: 650; }
#project-audit .audit-header p { margin: 6px 0 0; color: #64748b; }
#project-audit button { cursor: pointer; font: inherit; border: 1px solid #cbd5e1; border-radius: 9px; background: #fff; color: #334155; padding: 9px 16px; }
#project-audit button:hover { background: #f1f5f9; }
#project-audit button:focus-visible, #project-audit .audit-scroll:focus-visible { outline: 2px solid #6366f1; outline-offset: -2px; }
#project-audit button:disabled { opacity: .5; cursor: wait; }
#project-audit .audit-notice { flex-shrink: 0; margin: 0; padding: 0 24px 12px; color: #64748b; font-size: 12px; line-height: 1.6; }
#project-audit .audit-notice p { margin: 6px 0 0; }
#project-audit summary { cursor: pointer; }
#project-audit :is(input, select, summary):focus-visible { outline: 2px solid #6366f1; outline-offset: 2px; }
#project-audit .audit-toolbar { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; padding: 0 24px 16px; }
#project-audit .audit-toolbar label { display: grid; gap: 6px; color: #64748b; font-size: 12px; }
#project-audit .audit-search { flex: 1; min-width: 180px; }
#project-audit :is(input, select) { width: 100%; min-width: 0; height: 38px; padding: 0 12px; font: inherit; font-size: 13px; border: 1px solid #cbd5e1; border-radius: 8px; background: #fff; color: #334155; }
#project-audit .audit-list-heading { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 16px; padding: 10px 24px; background: #f8fafc; color: #64748b; font-size: 12px; border-top: 1px solid #e2e8f0; }
#project-audit .audit-empty { padding: 20px 24px; text-align: center; color: #64748b; }
#project-audit .audit-empty p { margin: 6px 0 0; font-size: 13px; }
#project-audit [hidden] { display: none !important; }
#project-audit .audit-time small { display: block; font-size: 12px; color: #94a3b8; }
#project-audit .audit-disclosure summary { color: #334155; }
#project-audit .audit-disclosure summary small { display: block; margin-left: 15px; color: #64748b; font-size: 12px; }
#project-audit .audit-disclosure[open] summary { margin-bottom: 12px; }
#project-audit .audit-changes { padding: 12px; border: 1px solid #e2e8f0; border-radius: 8px; background: #f8fafc; }
#project-audit .audit-scroll { flex: 1; overflow: auto; min-height: 0; border-top: 1px solid #e2e8f0; }
#project-audit table { width: 100%; border-collapse: collapse; text-align: left; table-layout: fixed; }
#project-audit th { position: sticky; top: 0; background: #f8fafc; color: #64748b; font-size: 12px; font-weight: 600; padding: 12px 16px; z-index: 1; }
#project-audit th:nth-child(1) { width: 17%; }
#project-audit th:nth-child(2) { width: 18%; }
#project-audit th:nth-child(3) { width: 12%; }
#project-audit th:nth-child(4) { width: 12%; }
#project-audit td { padding: 12px 16px; border-bottom: 1px solid #e2e8f0; vertical-align: top; overflow-wrap: anywhere; line-height: 1.6; }
#project-audit tbody tr:hover { background: #fafbff; }
#project-audit .audit-time { color: #64748b; font-size: 12px; font-variant-numeric: tabular-nums; }
#project-audit .audit-project strong { display: block; font-weight: 600; }
#project-audit .audit-project small { color: #94a3b8; }
#project-audit .audit-badge { display: inline-block; border-radius: 6px; padding: 2px 8px; color: #4338ca; background: #eef2ff; font-size: 12px; }
#project-audit .audit-action-create { color: #047857; background: #ecfdf5; }
#project-audit .audit-action-delete { color: #be123c; background: #fff1f2; }
#project-audit .audit-action-sharing { color: #0369a1; background: #f0f9ff; }
#project-audit .audit-change + .audit-change { margin-top: 12px; }
#project-audit .audit-field { display: block; font-size: 12px; color: #64748b; margin-bottom: 4px; }
#project-audit .audit-values { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; }
#project-audit .audit-before, #project-audit .audit-after { min-width: 0; white-space: pre-wrap; border-radius: 4px; padding: 1px 6px; }
#project-audit .audit-before { color: #64748b; background: #f1f5f9; }
#project-audit .audit-after { color: #166534; background: #f0fdf4; }
#project-audit .audit-arrow { color: #94a3b8; }
#project-audit .audit-footer { flex-shrink: 0; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 24px; border-top: 1px solid #e2e8f0; color: #64748b; font-size: 13px; }
#project-audit .audit-footer p { margin: 4px 0 0; }
#project-audit .audit-footer p:empty { display: none; }
#project-audit .audit-footer button { flex-shrink: 0; }
#project-audit .audit-search-icon, #project-audit .audit-refresh-icon { display: none; }
@media (max-width: 768px) {
  /* Phones: the app title bar already names the page, so the header goes and refresh joins the search row. */
  #project-audit .audit-header { display: none; }
  #project-audit .audit-toolbar { flex-wrap: nowrap; align-items: center; padding: 10px 12px; gap: 8px; }
  #project-audit .audit-toolbar label { position: relative; display: block; }
  #project-audit .audit-toolbar label > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  #project-audit .audit-search { flex: 1; min-width: 0; }
  #project-audit .audit-search-icon { display: block; position: absolute; left: 12px; top: 50%; width: 16px; height: 16px; margin-top: -8px; fill: none; stroke: #94a3b8; stroke-width: 2; stroke-linecap: round; pointer-events: none; }
  #project-audit .audit-toolbar label:not(.audit-search) { flex: 0 0 auto; }
  #project-audit :is(input, select) { height: 36px; border-color: transparent; border-radius: 18px; background-color: #f1f5f9; }
  #project-audit input { padding: 0 12px 0 36px; }
  #project-audit input::placeholder { color: #94a3b8; }
  #project-audit select { width: auto; max-width: 112px; padding: 0 10px; }
  #project-audit :is(input, select):focus { border-color: #6366f1; background-color: #fff; }
  #project-audit :is(input, select):focus-visible { outline: none; }
  #project-audit .audit-toolbar button { flex-shrink: 0; height: 36px; padding: 0 8px; border: 0; border-radius: 18px; background: transparent; color: #4f46e5; font-size: 13px; white-space: nowrap; }
  #project-audit .audit-clear-suffix { display: none; }
  #project-audit .audit-toolbar .audit-refresh-icon { display: inline-flex; align-items: center; justify-content: center; width: 36px; padding: 0; color: #475569; }
  #project-audit .audit-refresh-icon svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
  #project-audit[aria-busy="true"] .audit-refresh-icon svg { animation: audit-spin .8s linear infinite; }
  #project-audit .audit-list-heading { padding: 6px 16px; }
  #project-audit .audit-notice { padding: 8px 16px 12px; }
  #project-audit table, #project-audit tbody { display: block; }
  #project-audit thead { display: none; }
  /* Phones: each record is a compact card - project and type on top, operator and time beneath, the change summary last. */
  #project-audit tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "project action" "actor time" "details details"; align-items: center; gap: 2px 12px; padding: 10px 16px; border-bottom: 1px solid #e2e8f0; }
  #project-audit td { display: block; min-width: 0; border: 0; padding: 0; line-height: 1.5; }
  #project-audit .audit-project { grid-area: project; display: flex; align-items: baseline; gap: 6px; min-width: 0; }
  #project-audit .audit-project strong { display: block; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
  #project-audit .audit-project small { flex-shrink: 0; font-size: 12px; }
  #project-audit .audit-action { grid-area: action; justify-self: end; }
  #project-audit .audit-badge { white-space: nowrap; }
  #project-audit .audit-actor { grid-area: actor; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: #64748b; font-size: 12px; }
  #project-audit .audit-time { grid-area: time; justify-self: end; white-space: nowrap; }
  #project-audit .audit-time small { display: inline; margin-left: 4px; }
  #project-audit .audit-details { grid-area: details; margin-top: 4px; font-size: 13px; }
  #project-audit .audit-disclosure summary small { display: inline; margin-left: 6px; }
  #project-audit .audit-disclosure[open] summary { margin-bottom: 8px; }
  #project-audit .audit-changes { padding: 10px; }
  /* The status line follows the last record inside the list; the next page loads on scroll (project-audit.js). */
  #project-audit .audit-footer { justify-content: center; flex-wrap: wrap; padding: 12px 16px; border-top: 0; font-size: 12px; text-align: center; }
  #project-audit .audit-footer > div { display: flex; flex-wrap: wrap; justify-content: center; gap: 0 8px; }
  #project-audit .audit-footer p { margin: 0; }
  #project-audit .audit-footer button { padding: 6px 16px; font-size: 13px; }
}
@keyframes audit-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { #project-audit .audit-refresh-icon svg { animation: none !important; } }
html[data-theme="dark"] #project-audit { background: var(--cf-bg, #17191d); color: var(--cf-text, #e2e8f0); border-color: var(--cf-line, #334155); }
html[data-theme="dark"] #project-audit :is(button, input, select) { background: var(--cf-bg, #17191d); color: var(--cf-text, #e2e8f0); border-color: var(--cf-line-strong, #475569); }
html[data-theme="dark"] #project-audit :is(th, .audit-list-heading, .audit-changes, .audit-before) { background: var(--cf-chip, #252830); }
html[data-theme="dark"] #project-audit :is(td, tr, .audit-scroll, .audit-footer, .audit-list-heading, .audit-changes) { border-color: var(--cf-line, #334155); }
html[data-theme="dark"] #project-audit :is(.audit-header p, th, .audit-actor, .audit-toolbar label, .audit-list-heading, .audit-notice, .audit-time, .audit-field, .audit-before, .audit-footer, .audit-empty, .audit-disclosure summary small) { color: var(--cf-muted, #94a3b8); }
@media (max-width: 768px) {
  html[data-theme="dark"] #project-audit .audit-toolbar :is(input, select) { border-color: transparent; background-color: var(--cf-chip, #252830); }
  html[data-theme="dark"] #project-audit .audit-toolbar :is(input, select):focus { border-color: #818cf8; }
  html[data-theme="dark"] #project-audit .audit-toolbar button { background: transparent; border-color: transparent; color: #a5b4fc; }
  html[data-theme="dark"] #project-audit .audit-toolbar .audit-refresh-icon { color: var(--cf-muted, #94a3b8); }
}
html[data-theme="dark"] #project-audit .audit-disclosure summary { color: var(--cf-text, #e2e8f0); }
html[data-theme="dark"] #project-audit :is(button:hover, tbody tr:hover) { background: var(--cf-hover, #252830); }
html[data-theme="dark"] #project-audit .audit-badge { color: #c7d2fe; background: #312e81; }
html[data-theme="dark"] #project-audit :is(.audit-after, .audit-action-create) { color: #86efac; background: #052e16; }
html[data-theme="dark"] #project-audit .audit-action-delete { color: #fda4af; background: #4c0519; }
html[data-theme="dark"] #project-audit .audit-action-sharing { color: #7dd3fc; background: #082f49; }
