/* ═══════════════════════════════════════════════════════════════════════════
   Audit Log — "Commit Log" direction (approved comp, 2026-09-07)

   Every event is a commit: an author, a subject line, a label, a diff stat and
   a short id. The format is one nobody has to learn, which is the whole point —
   the page borrows trust from a log every person here already reads fluently.

   Scoped under .audit-cl so nothing here can reach the rest of the app. The
   page keeps Mirrors' teal for the primary action and the active tab only;
   label colours are semantic (create / update / delete / security) and are not
   the accent.
   ═══════════════════════════════════════════════════════════════════════════ */

.audit-cl {
  --acl-bg:      #F6F8FA;
  --acl-surface: #FFFFFF;
  --acl-ink:     #1F2328;
  --acl-muted:   #656D76;
  --acl-faint:   #8C959F;
  --acl-line:    #D8DEE4;
  --acl-line-2:  #EAEEF2;
  --acl-accent:  #0FB8A2;
  --acl-accent-deep: #088E89;
  --acl-link:    #0969DA;

  --acl-create-bg: #DAFBE1; --acl-create-fg: #116329;
  --acl-update-bg: #DDF4FF; --acl-update-fg: #0969DA;
  --acl-delete-bg: #FFEBE9; --acl-delete-fg: #CF222E;
  --acl-secure-bg: #FFF8C5; --acl-secure-fg: #9A6700;

  --acl-sans: "Onest", "IBM Plex Sans", system-ui, -apple-system, sans-serif;
  --acl-mono: "Sometype Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  position: relative;
  /* The comp draws this page edge to edge against the sidebar. Every other page
     sits inside .app-content's 26px padding, so the page cancels it here rather
     than changing a container every other page depends on. */
  margin: -26px;
  /* .page-content sets width:100%, which measures the padded box and would leave
     the right edge 26px short once the margin pulls the left out. Auto lets the
     margins define the box on both sides. */
  width: auto;
  min-height: calc(100vh - 64px);
  padding: 0 0 8px;
  background: var(--acl-bg);
  color: var(--acl-ink);
  font-family: var(--acl-sans);
  font-variant-numeric: tabular-nums;
}
.audit-cl *:focus-visible { outline: 2px solid var(--acl-accent); outline-offset: 2px; border-radius: 4px; }

/* ── Header ──────────────────────────────────────────────────────────────── */
.acl-hd {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 20px;
  padding: 20px 24px 14px; background: var(--acl-surface); border-bottom: 1px solid var(--acl-line);
}
.acl-hd h1 { font-size: 20px; font-weight: 600; letter-spacing: -.01em; margin: 0 0 3px; }
.acl-hd p  { margin: 0; font-size: 12.5px; color: var(--acl-muted); max-width: 92ch; }
.acl-hd-actions { display: flex; gap: 8px; flex: none; }

.acl-btn {
  display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 12px;
  border: 1px solid var(--acl-line); border-radius: 6px; background: var(--acl-surface);
  font-family: inherit; font-size: 12.5px; font-weight: 500; color: var(--acl-ink);
  cursor: pointer; white-space: nowrap;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.acl-btn:hover:not(:disabled) { background: var(--acl-line-2); border-color: #C3CBD3; color: var(--acl-ink); }
.acl-btn:disabled { opacity: .55; cursor: not-allowed; }
.acl-btn--primary { background: var(--acl-accent); border-color: var(--acl-accent); color: #052D28; }
.acl-btn--primary:hover:not(:disabled) { background: var(--acl-accent-deep); border-color: var(--acl-accent-deep); color: #fff; }
.acl-btn i { font-size: 13px; line-height: 1; }

/* ── Query bar ───────────────────────────────────────────────────────────── */
.acl-tb { display: flex; align-items: center; gap: 10px; padding: 12px 24px; background: var(--acl-surface); border-bottom: 1px solid var(--acl-line); }
.acl-q { position: relative; flex: 1; display: flex; align-items: center; gap: 8px; height: 32px; padding: 0 10px; border: 1px solid var(--acl-line); border-radius: 6px; background: var(--acl-surface); }
.acl-q:focus-within { border-color: var(--acl-accent); box-shadow: 0 0 0 3px rgba(15,184,162,.15); }
.acl-q > i { color: var(--acl-muted); font-size: 13px; flex: none; }
.acl-q input {
  flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; padding: 0;
  font-family: var(--acl-mono); font-size: 12px; color: var(--acl-ink);
}
.acl-q input::placeholder { color: var(--acl-faint); }
.acl-q-clear { border: 0; background: transparent; color: var(--acl-muted); cursor: pointer; padding: 2px 4px; line-height: 1; border-radius: 4px; }
.acl-q-clear:hover { background: var(--acl-line-2); color: var(--acl-ink); }
.acl-q-err { border-color: #CF222E; }

/* Completion menu. Fixed-positioned so it escapes any scrolling ancestor. */
.acl-ac {
  position: absolute; top: calc(100% + 4px); left: 0; z-index: 30; min-width: 280px; max-height: 260px;
  overflow-y: auto; background: var(--acl-surface); border: 1px solid var(--acl-line);
  border-radius: 8px; box-shadow: 0 8px 24px -8px rgba(31,35,40,.28); padding: 4px;
}
.acl-ac-item { display: flex; align-items: baseline; gap: 8px; padding: 6px 8px; border-radius: 5px; cursor: pointer; font-size: 12.5px; }
.acl-ac-item b { font-family: var(--acl-mono); font-weight: 500; color: var(--acl-ink); }
.acl-ac-item span { color: var(--acl-muted); font-size: 11.5px; }
.acl-ac-item:hover, .acl-ac-item.is-on { background: var(--acl-line-2); }
.acl-q-hint { font-size: 11.5px; color: var(--acl-muted); padding: 0 24px 10px; background: var(--acl-surface); }
.acl-q-hint code { font-family: var(--acl-mono); font-size: 11px; background: var(--acl-line-2); color: var(--acl-ink); padding: 1px 5px; border-radius: 4px; }

/* ── Section tabs ────────────────────────────────────────────────────────── */
.acl-tabs { display: flex; gap: 2px; padding: 0 24px; background: var(--acl-surface); border-bottom: 1px solid var(--acl-line); overflow-x: auto; scrollbar-width: none; }
.acl-tabs::-webkit-scrollbar { display: none; }
.acl-tab {
  display: inline-flex; align-items: center; gap: 6px; padding: 9px 10px; border: 0; background: transparent;
  font-family: inherit; font-size: 12.5px; color: var(--acl-muted); cursor: pointer; white-space: nowrap;
  box-shadow: inset 0 -2px 0 transparent; transition: color .15s ease, box-shadow .15s ease;
}
.acl-tab:hover { color: var(--acl-ink); }
.acl-tab b { font-weight: 500; color: var(--acl-muted); background: var(--acl-line-2); border-radius: 10px; padding: 0 6px; font-size: 11px; }
.acl-tab.is-on { color: var(--acl-ink); font-weight: 500; box-shadow: inset 0 -2px 0 var(--acl-accent); }
.acl-tab.is-on b { background: #D6F3EE; color: var(--acl-accent-deep); }

/* ── Activity strip ──────────────────────────────────────────────────────── */
.acl-act { display: flex; align-items: center; gap: 10px; padding: 12px 24px 0; font-size: 12px; color: var(--acl-muted); flex-wrap: wrap; }
.acl-heat { display: flex; gap: 3px; }
.acl-heat i { width: 11px; height: 11px; border-radius: 2px; background: var(--acl-line-2); display: block; cursor: pointer; transition: transform .12s ease; }
.acl-heat i:hover { transform: scale(1.25); }
.acl-heat i.is-on { box-shadow: 0 0 0 1.5px var(--acl-ink); }

/* ── Day group ───────────────────────────────────────────────────────────── */
.acl-day { padding: 16px 24px 6px; font-size: 12.5px; color: var(--acl-muted); display: flex; align-items: center; gap: 8px; }
.acl-day::before { content: ""; width: 8px; height: 8px; border-radius: 50%; border: 2px solid var(--acl-line); background: var(--acl-surface); flex: none; }

.acl-grp { margin: 0 24px; border: 1px solid var(--acl-line); border-radius: 8px; background: var(--acl-surface); overflow: hidden; }
.acl-row {
  display: grid; grid-template-columns: 34px minmax(0,1fr) auto; gap: 12px; align-items: center;
  padding: 9px 14px; border-top: 1px solid var(--acl-line-2); cursor: pointer;
  transition: background .12s ease;
}
.acl-row:first-child { border-top: 0; }
.acl-row:hover { background: #FAFDFC; }
.acl-row.is-on { background: #F0FBF9; box-shadow: inset 2px 0 0 var(--acl-accent); }

.acl-av { width: 24px; height: 24px; border-radius: 50%; background: #DCE9E6; color: var(--acl-ink); font-size: 10.5px; font-weight: 600; display: flex; align-items: center; justify-content: center; }
.acl-av--sys { background: var(--acl-ink); color: #fff; }

.acl-subj { font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 8px; min-width: 0; }
.acl-subj > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acl-lbl { font-family: var(--acl-sans); font-size: 11px; font-weight: 500; padding: 1px 7px; border-radius: 10px; white-space: nowrap; flex: none; }
.acl-lbl--create { background: var(--acl-create-bg); color: var(--acl-create-fg); }
.acl-lbl--update { background: var(--acl-update-bg); color: var(--acl-update-fg); }
.acl-lbl--delete { background: var(--acl-delete-bg); color: var(--acl-delete-fg); }
.acl-lbl--secure { background: var(--acl-secure-bg); color: var(--acl-secure-fg); }

.acl-meta { font-size: 12px; color: var(--acl-muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acl-meta .acl-mono { font-family: var(--acl-mono); font-size: 11.5px; }

.acl-rt { display: flex; align-items: center; gap: 12px; font-size: 12px; color: var(--acl-muted); flex: none; }
.acl-stat { font-family: var(--acl-mono); font-size: 11.5px; }
.acl-stat b { color: #1A7F37; font-weight: 500; }
.acl-stat i { color: #CF222E; font-style: normal; }
.acl-id { font-family: var(--acl-mono); font-size: 11.5px; color: var(--acl-link); }
.acl-rt > i.bi { font-size: 12px; color: var(--acl-muted); }

/* ── States ──────────────────────────────────────────────────────────────── */
.acl-skel { margin: 16px 24px 0; border: 1px solid var(--acl-line); border-radius: 8px; background: var(--acl-surface); overflow: hidden; }
.acl-skel-row { height: 48px; border-top: 1px solid var(--acl-line-2); padding: 10px 14px; display: grid; grid-template-columns: 34px 1fr 90px; gap: 12px; align-items: center; }
.acl-skel-row:first-child { border-top: 0; }
.acl-skel-row span { display: block; height: 10px; border-radius: 5px; background: linear-gradient(90deg,var(--acl-line-2) 25%,#F4F7F9 37%,var(--acl-line-2) 63%); background-size: 400% 100%; animation: acl-shimmer 1.4s ease infinite; }
.acl-skel-row span.acl-sk-av { width: 24px; height: 24px; border-radius: 50%; }
.acl-skel-row span.acl-sk-l { width: 62%; }
@keyframes acl-shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

.acl-empty { margin: 16px 24px; border: 1px solid var(--acl-line); border-radius: 8px; background: var(--acl-surface); padding: 44px 24px; text-align: center; }
.acl-empty i.bi { font-size: 26px; color: var(--acl-faint); }
.acl-empty h3 { font-size: 15px; font-weight: 600; margin: 12px 0 4px; }
.acl-empty p { font-size: 13px; color: var(--acl-muted); margin: 0 auto 14px; max-width: 52ch; }

/* ── Pagination ──────────────────────────────────────────────────────────── */
.acl-pgn { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 24px 28px; font-size: 12.5px; color: var(--acl-muted); flex-wrap: wrap; }
.acl-pp { display: inline-flex; gap: 2px; }
.acl-pp button { min-width: 28px; height: 28px; padding: 0 7px; border: 1px solid transparent; background: transparent; border-radius: 6px; font-family: inherit; font-size: 12.5px; color: var(--acl-muted); cursor: pointer; transition: background .12s ease, color .12s ease; }
.acl-pp button:hover:not(:disabled):not(.is-on) { background: var(--acl-line-2); color: var(--acl-ink); }
.acl-pp button.is-on { background: var(--acl-ink); color: #fff; }
.acl-pp button:disabled { opacity: .4; cursor: not-allowed; }
.acl-pgn select { height: 28px; border: 1px solid var(--acl-line); border-radius: 6px; background: var(--acl-surface); font-family: inherit; font-size: 12.5px; color: var(--acl-ink); padding: 0 6px; cursor: pointer; }

/* ── Detail drawer ───────────────────────────────────────────────────────── */
.acl-dr {
  position: fixed; top: 0; right: 0; bottom: 0; width: 420px; max-width: 92vw; z-index: 1050;
  background: var(--acl-surface); border-left: 1px solid var(--acl-line);
  box-shadow: -16px 0 44px -20px rgba(31,35,40,.4);
  padding: 18px 20px; overflow-y: auto; font-family: var(--acl-sans); color: var(--acl-ink);
  animation: acl-slide .2s cubic-bezier(.2,0,0,1);
}
@keyframes acl-slide { from { transform: translateX(16px); opacity: 0; } to { transform: none; opacity: 1; } }
.acl-dr-scrim { position: fixed; inset: 0; z-index: 1040; background: rgba(31,35,40,.18); border: 0; padding: 0; cursor: default; }
.acl-dr-x { position: absolute; top: 14px; right: 14px; border: 0; background: transparent; color: var(--acl-muted); cursor: pointer; font-size: 15px; line-height: 1; padding: 4px; border-radius: 5px; }
.acl-dr-x:hover { background: var(--acl-line-2); color: var(--acl-ink); }
.acl-dr-t { font-size: 11px; font-weight: 500; letter-spacing: .06em; text-transform: uppercase; color: var(--acl-muted); margin-bottom: 8px; font-family: var(--acl-mono); }
.acl-dr h3 { font-size: 15px; font-weight: 600; margin: 0 0 4px; padding-right: 30px; }
.acl-dr-who { font-size: 12.5px; color: var(--acl-muted); margin-bottom: 14px; }
.acl-kv { display: grid; grid-template-columns: 92px minmax(0,1fr); gap: 6px 12px; font-size: 12.5px; margin-bottom: 16px; }
.acl-kv dt { color: var(--acl-muted); font-weight: 400; }
.acl-kv dd { margin: 0; overflow-wrap: anywhere; }
.acl-kv .acl-mono { font-family: var(--acl-mono); font-size: 11.5px; }

.acl-dtabs { display: flex; gap: 2px; border-bottom: 1px solid var(--acl-line); margin-bottom: 12px; }
.acl-dtab { padding: 7px 10px; border: 0; background: transparent; font-family: inherit; font-size: 12.5px; color: var(--acl-muted); cursor: pointer; box-shadow: inset 0 -2px 0 transparent; transition: color .15s ease, box-shadow .15s ease; }
.acl-dtab:hover { color: var(--acl-ink); }
.acl-dtab.is-on { color: var(--acl-ink); font-weight: 500; box-shadow: inset 0 -2px 0 var(--acl-accent); }
.acl-dtab b { font-weight: 500; background: var(--acl-line-2); border-radius: 10px; padding: 0 5px; font-size: 11px; margin-left: 5px; }

.acl-diff { border: 1px solid var(--acl-line); border-radius: 6px; overflow: hidden; font-family: var(--acl-mono); font-size: 12px; line-height: 1.65; }
.acl-diff div { padding: 0 10px; overflow-wrap: anywhere; }
.acl-diff .acl-d-hunk { color: var(--acl-muted); background: var(--acl-bg); }
.acl-diff .acl-d-del  { background: var(--acl-delete-bg); color: #82071E; }
.acl-diff .acl-d-add  { background: var(--acl-create-bg); color: var(--acl-create-fg); }

.acl-raw { margin: 0; border: 1px solid var(--acl-line); border-radius: 6px; background: var(--acl-bg); padding: 10px; font-family: var(--acl-mono); font-size: 11.5px; line-height: 1.6; max-height: 340px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--acl-ink); }

.acl-rel { display: flex; flex-direction: column; gap: 6px; }
.acl-rel-item { display: grid; grid-template-columns: 58px minmax(0,1fr); gap: 8px; align-items: baseline; padding: 7px 9px; border: 1px solid var(--acl-line); border-radius: 6px; background: var(--acl-surface); font-size: 12.5px; cursor: pointer; text-align: left; font-family: inherit; color: var(--acl-ink); transition: background .12s ease, border-color .12s ease; }
.acl-rel-item:hover { background: var(--acl-line-2); border-color: #C3CBD3; }
.acl-rel-item time { font-family: var(--acl-mono); font-size: 11.5px; color: var(--acl-muted); }
.acl-rel-item span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acl-rel-none { font-size: 12.5px; color: var(--acl-muted); }

.acl-dr-foot { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.acl-dr-foot .acl-btn { height: 30px; font-size: 12px; }
.acl-dr-nav { margin-left: auto; display: flex; gap: 4px; }

/* ── Responsive: the drawer becomes a sheet, the header stacks ───────────── */
@media (max-width: 900px) {
  .acl-hd { flex-direction: column; }
  .acl-tb { flex-wrap: wrap; }
  .acl-dr { width: 100%; max-width: 100%; }
  .acl-row { grid-template-columns: 28px minmax(0,1fr); }
  .acl-rt { grid-column: 2; margin-top: 4px; }
}
@media (prefers-reduced-motion: reduce) {
  .audit-cl *, .audit-cl *::before, .audit-cl *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
