:root {
  --bg: #f4f6f8;
  --panel: #ffffff;
  --border: #e2e6ea;
  --text: #1f2a37;
  --muted: #6b7280;
  --primary: #1976d2;
  --primary-dark: #115293;
  --danger: #d32f2f;
  --warn: #ed6c02;
  --success: #2e7d32;
  --code-bg: #0f172a;
  --code-text: #e2e8f0;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; font-family: 'Inter', 'Roboto', system-ui, -apple-system, Segoe UI, sans-serif; background: var(--bg); color: var(--text); font-size: 14px; }

#app { min-height: 100vh; }

/* ---------- Login ---------- */
.login-wrap { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 24px; }
.login-card { background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 32px 24px; max-width: 420px; width: 100%; text-align: center; box-shadow: 0 1px 3px rgba(0,0,0,0.05); }
.login-card h1 { margin: 0 0 6px 0; font-size: 20px; }
.login-card p { color: var(--muted); margin: 0 0 24px 0; font-size: 13px; }
.login-card .brand { font-size: 11px; letter-spacing: 2px; text-transform: uppercase; color: var(--primary); font-weight: 600; margin-bottom: 12px; }
#gbtn { display: flex; justify-content: center; }
.login-error { margin-top: 18px; padding: 10px 14px; background: #fdecea; border: 1px solid #f9c7c2; color: var(--danger); border-radius: 6px; font-size: 13px; text-align: left; }

/* ---------- Topbar ---------- */
header.topbar { display: flex; align-items: center; justify-content: space-between; background: var(--panel); border-bottom: 1px solid var(--border); padding: 10px 16px; position: sticky; top: 0; z-index: 10; gap: 8px; }
header.topbar .title { font-weight: 600; font-size: 14px; flex-shrink: 0; }
header.topbar .title small { color: var(--muted); font-weight: 400; margin-left: 6px; }
header.topbar .user { display: flex; align-items: center; gap: 8px; min-width: 0; }
header.topbar .user img { width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0; }
header.topbar .user .user-info { min-width: 0; overflow: hidden; }
header.topbar .user .user-name { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
header.topbar .user .email { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
header.topbar .user button { background: transparent; border: 1px solid var(--border); padding: 4px 10px; border-radius: 4px; cursor: pointer; font-size: 12px; flex-shrink: 0; }
header.topbar .user button:hover { background: var(--bg); }
.owner-badge { background: var(--primary); color: white; font-size: 10px; padding: 2px 6px; border-radius: 3px; letter-spacing: 0.5px; text-transform: uppercase; margin-left: 6px; }
.admin-badge { background: #6a1b9a; color: white; font-size: 10px; padding: 2px 6px; border-radius: 3px; letter-spacing: 0.5px; text-transform: uppercase; margin-left: 6px; }

@media (max-width: 520px) {
  header.topbar .user .user-info { display: none; }
  header.topbar .title small { display: none; }
}

/* ---------- Tabs (scrolláveis em mobile) ---------- */
nav.tabs {
  display: flex; gap: 2px; background: var(--panel); border-bottom: 1px solid var(--border);
  padding: 0 16px; overflow-x: auto; scrollbar-width: thin;
}
nav.tabs::-webkit-scrollbar { height: 2px; }
nav.tabs button { background: transparent; border: none; padding: 12px 16px; font-size: 13px; cursor: pointer; color: var(--muted); border-bottom: 2px solid transparent; font-weight: 500; white-space: nowrap; }
nav.tabs button.active { color: var(--primary); border-bottom-color: var(--primary); }
nav.tabs button:hover:not(.active) { color: var(--text); }

/* ---------- Layout principal ---------- */
main { padding: 16px; max-width: 1400px; margin: 0 auto; }
@media (min-width: 640px) { main { padding: 20px 24px; } }

.section-title { display: flex; align-items: center; justify-content: space-between; margin: 0 0 16px 0; gap: 12px; }
.section-title h2 { margin: 0; font-size: 16px; font-weight: 600; }
.icon-btn { background: var(--panel); border: 1px solid var(--border); border-radius: 4px; cursor: pointer; padding: 6px 10px; font-size: 14px; }
.icon-btn:hover { background: var(--bg); }
.hint { color: var(--muted); font-size: 12px; }
.hint code { background: var(--bg); padding: 1px 5px; border-radius: 3px; border: 1px solid var(--border); font-size: 11px; }
.muted { color: var(--muted); }
.small { font-size: 11px; }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; }
.empty { padding: 40px; text-align: center; color: var(--muted); font-size: 13px; }
.empty-row { padding: 10px 0; color: var(--muted); font-size: 12px; }
.loader { border: 3px solid var(--border); border-top-color: var(--primary); border-radius: 50%; width: 18px; height: 18px; animation: spin 0.8s linear infinite; display: inline-block; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Stacks ---------- */
.env-group { margin-bottom: 28px; }
.env-group-title {
  display: flex; align-items: center; gap: 8px; margin-bottom: 12px;
  flex-wrap: wrap;
}
.env-group-title h3 {
  margin: 0; font-size: 13px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 1px; color: var(--muted);
}
.env-badge { font-size: 10px; padding: 2px 8px; border-radius: 10px; font-weight: 600; letter-spacing: 0.5px; }
.env-badge.prod { background: #fff4e5; color: var(--warn); border: 1px solid #ffcf99; }
.env-badge.staging { background: #e8f4fd; color: var(--primary); border: 1px solid #9cd0f7; }
.env-badge.infra { background: #ede7f6; color: #5e35b1; border: 1px solid #b39ddb; }

.env-health {
  margin-left: auto;
  font-size: 11px; font-variant-numeric: tabular-nums;
  padding: 2px 8px; border-radius: 10px; font-weight: 600;
}
.env-health.health-ok   { background: #e8f5e9; color: var(--success); border: 1px solid #b9dfbb; }
.env-health.health-warn { background: #fff4e5; color: var(--warn);    border: 1px solid #ffcf99; }
.env-health.health-down { background: #fdecea; color: var(--danger);  border: 1px solid #f5c6c6; }
.env-count { font-size: 11px; color: var(--muted); }

.stack-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
@media (min-width: 640px) { .stack-grid { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; } }

.stack-card {
  background: var(--panel); border: 1px solid var(--border); border-radius: 8px;
  padding: 14px; position: relative; overflow: visible;
  transition: border-color 0.15s, box-shadow 0.15s;
  border-top: 3px solid var(--border);
}
.stack-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.06); }
.stack-card.status-ok    { border-top-color: var(--success); }
.stack-card.status-warn  { border-top-color: var(--warn); }
.stack-card.status-down  { border-top-color: var(--danger); }
.stack-card.status-empty { border-top-color: var(--muted); }

.stack-card header {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 10px; margin-bottom: 12px;
}
.stack-card .card-title { display: flex; align-items: flex-start; gap: 8px; min-width: 0; flex: 1; }
.stack-card .card-title-text { min-width: 0; flex: 1; }
.stack-card h4 { margin: 0; font-size: 14px; font-weight: 600; word-break: break-word; }
.stack-card .stack-key {
  font-size: 10px; color: var(--muted); font-family: ui-monospace, Menlo, monospace;
  word-break: break-all; margin-top: 2px;
}

.status-dot {
  flex-shrink: 0; width: 10px; height: 10px; border-radius: 50%;
  margin-top: 5px; box-shadow: 0 0 0 2px var(--panel), 0 0 0 3px var(--border);
}
.status-dot.ok    { background: var(--success); box-shadow: 0 0 0 2px var(--panel), 0 0 0 3px #b9dfbb; }
.status-dot.warn  { background: var(--warn);    box-shadow: 0 0 0 2px var(--panel), 0 0 0 3px #ffcf99; animation: pulse 2s infinite; }
.status-dot.down  { background: var(--danger);  box-shadow: 0 0 0 2px var(--panel), 0 0 0 3px #f5c6c6; }
.status-dot.empty { background: var(--muted); }
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.replicas-summary {
  font-variant-numeric: tabular-nums; font-size: 12px; font-weight: 600;
  padding: 3px 10px; border-radius: 12px; white-space: nowrap; flex-shrink: 0;
  background: var(--bg); border: 1px solid var(--border);
}
.replicas-summary.ok    { background: #e8f5e9; color: var(--success); border-color: #b9dfbb; }
.replicas-summary.warn  { background: #fff4e5; color: var(--warn);    border-color: #ffcf99; }
.replicas-summary.down  { background: #fdecea; color: var(--danger);  border-color: #f5c6c6; }
.replicas-summary.empty { color: var(--muted); }

.stack-card .services { list-style: none; margin: 0; padding: 0; font-size: 12px; }
.stack-card .services li {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 0; border-top: 1px solid #f0f2f5;
}
.stack-card .services li:first-child { border-top: none; }
.stack-card .svc-dot {
  flex-shrink: 0; width: 6px; height: 6px; border-radius: 50%;
  background: var(--muted);
}
.stack-card .svc-dot.ok   { background: var(--success); }
.stack-card .svc-dot.warn { background: var(--warn); }
.stack-card .svc-dot.down { background: var(--danger); }
.stack-card .svc-info { min-width: 0; flex: 1; }
.stack-card .svc-name {
  font-family: ui-monospace, Menlo, monospace; font-size: 11px;
  color: var(--text); word-break: break-all; line-height: 1.3;
}
.stack-card .svc-img {
  font-size: 10px; color: var(--muted); word-break: break-all; margin-top: 1px;
}
.stack-card .replicas {
  font-variant-numeric: tabular-nums; font-size: 11px; padding: 2px 7px;
  border-radius: 3px; background: var(--bg); border: 1px solid var(--border);
  flex-shrink: 0; font-weight: 500;
}
.stack-card .replicas.ok   { color: var(--success); border-color: #b9dfbb; background: #e8f5e9; }
.stack-card .replicas.warn { color: var(--danger);  border-color: #f5c6c6; background: #fdecea; }
.stack-card .replicas.zero { color: var(--muted); }

.card-meta {
  font-size: 10px; color: var(--muted); margin-top: 8px;
  padding-top: 8px; border-top: 1px solid #f0f2f5;
}

/* ---------- Card actions (hierarquia) ---------- */
.card-actions {
  display: flex; gap: 6px; margin-top: 12px; align-items: stretch;
}
.card-actions button {
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  padding: 7px 10px; border: 1px solid var(--border);
  background: var(--panel); border-radius: 5px; cursor: pointer;
  font-size: 12px; font-weight: 500; color: var(--text);
  transition: all 0.12s;
}
.card-actions .act-icon { font-size: 13px; line-height: 1; }
.card-actions .act-label { line-height: 1; }
.card-actions button.primary-action {
  flex: 1.3; background: var(--primary); color: white; border-color: var(--primary);
}
.card-actions button.primary-action:hover { background: var(--primary-dark); }
.card-actions button.secondary-action { flex: 1; }
.card-actions button.secondary-action:hover { background: var(--bg); border-color: #cfd4da; }

.action-menu-wrap { position: relative; flex-shrink: 0; }
.card-actions .menu-btn {
  width: 32px; padding: 7px 0; font-size: 18px;
  color: var(--muted); line-height: 1;
}
.card-actions .menu-btn:hover { background: var(--bg); }

.action-menu {
  display: none; position: absolute; right: 0; top: calc(100% + 4px);
  background: var(--panel); border: 1px solid var(--border); border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1); z-index: 20;
  min-width: 140px; overflow: hidden;
}
.action-menu.open { display: block; }
.action-menu button {
  display: flex; align-items: center; gap: 8px; width: 100%;
  background: transparent; border: none; border-radius: 0;
  padding: 10px 12px; font-size: 12px; color: var(--text);
  cursor: pointer; text-align: left;
}
.action-menu button:hover { background: var(--bg); }
.action-menu button.danger { color: var(--danger); }
.action-menu button.danger:hover { background: #fdecea; }

.card-actions button:disabled { opacity: 0.5; cursor: not-allowed; }
.card-actions button.primary {
  background: var(--primary); color: white; border-color: var(--primary);
}
.card-actions button.primary:hover { background: var(--primary-dark); }

/* ---------- Versões ---------- */
.pkg-switch {
  display: inline-flex; border: 1px solid var(--border); border-radius: 6px; overflow: hidden;
  margin-bottom: 16px; background: var(--panel);
}
.pkg-switch button {
  background: transparent; border: none; padding: 8px 16px; cursor: pointer;
  font-size: 13px; font-weight: 500; color: var(--muted);
}
.pkg-switch button.active { background: var(--primary); color: white; }

.running-grid {
  display: grid; grid-template-columns: 1fr; gap: 12px; margin-bottom: 20px;
}
@media (min-width: 640px) {
  .running-grid { grid-template-columns: 1fr 1fr; }
}

.running-card {
  background: var(--panel); border: 1px solid var(--border); border-left-width: 4px;
  border-radius: 6px; padding: 12px 14px;
}
.running-card.prod { border-left-color: var(--warn); }
.running-card.staging { border-left-color: var(--primary); }
.running-card.empty { color: var(--muted); text-align: center; padding: 20px; }
.running-card .running-label {
  font-size: 10px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted);
  font-weight: 600;
}
.running-card .running-main {
  display: flex; align-items: center; gap: 8px; margin: 4px 0;
  flex-wrap: wrap;
}
.running-card .running-sha { font-family: ui-monospace, Menlo, monospace; font-size: 14px; font-weight: 600; }
.running-card .running-meta { font-size: 11px; color: var(--muted); word-break: break-word; }

.versions-intro { margin: 16px 0; display: flex; flex-direction: column; gap: 6px; }

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.versions-table { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.versions-table th, .versions-table td { text-align: left; padding: 10px 12px; font-size: 13px; border-bottom: 1px solid var(--border); vertical-align: top; }
.versions-table th { background: var(--bg); font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; font-size: 11px; }
.versions-table tr:last-child td { border-bottom: none; }
.versions-table .col-commit { min-width: 260px; max-width: 480px; }
.versions-table .col-when { min-width: 110px; }
.versions-table .col-tags { min-width: 150px; }
.versions-table .col-sha, .versions-table .col-digest { font-size: 12px; }
.versions-table .col-actions { white-space: nowrap; text-align: right; }
.versions-table .mobile-row { display: none; }

.commit-cell { display: flex; flex-direction: column; gap: 4px; }
.commit-subject {
  font-size: 13px; font-weight: 500; color: var(--text); line-height: 1.35;
  overflow: hidden; text-overflow: ellipsis; display: -webkit-box;
  -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.commit-subject.missing { color: var(--muted); font-style: italic; font-weight: 400; }
.commit-meta {
  display: flex; align-items: center; gap: 5px; flex-wrap: wrap;
  font-size: 11px; color: var(--muted);
}
.commit-avatar {
  width: 16px; height: 16px; border-radius: 50%;
  flex-shrink: 0; vertical-align: middle;
}
.commit-avatar-placeholder {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--primary); color: white; font-size: 9px; font-weight: 600;
  flex-shrink: 0;
}
.commit-author { color: var(--text); font-weight: 500; }
.commit-sha-link {
  color: var(--primary); text-decoration: none; font-size: 10px;
  padding: 1px 5px; background: #e8f4fd; border-radius: 3px;
}
.commit-sha-link:hover { text-decoration: underline; }
.commit-sep { opacity: 0.5; }

.tag-chip { display: inline-block; font-family: ui-monospace, Menlo, monospace; font-size: 10px; padding: 2px 6px; border-radius: 3px; border: 1px solid var(--border); margin-right: 4px; margin-bottom: 3px; }
.tag-chip.tag-latest { background: #fff4e5; color: var(--warn); border-color: #ffcf99; font-weight: 600; }
.tag-chip.tag-staging { background: #e8f4fd; color: var(--primary); border-color: #9cd0f7; font-weight: 600; }
.tag-chip.tag-cand { background: #f3e5f5; color: #8e24aa; border-color: #ce93d8; font-weight: 600; }
.tag-chip.tag-sha { background: var(--bg); color: var(--text); }
.tag-chip.tag-default { background: var(--bg); color: var(--muted); }

.badge-prod, .badge-staging {
  display: inline-block; font-size: 10px; padding: 2px 6px; border-radius: 3px;
  font-weight: 600; letter-spacing: 0.3px; margin-left: 4px;
}
.badge-prod { background: #fff4e5; color: var(--warn); border: 1px solid #ffcf99; }
.badge-staging { background: #e8f4fd; color: var(--primary); border: 1px solid #9cd0f7; }

button.mini {
  padding: 4px 10px; font-size: 11px; border: 1px solid var(--border);
  background: var(--panel); border-radius: 4px; cursor: pointer;
  margin-left: 4px; font-weight: 500;
}
button.mini:hover:not(:disabled) { background: var(--bg); }
button.mini.primary { background: var(--primary); color: white; border-color: var(--primary); }
button.mini.primary:hover:not(:disabled) { background: var(--primary-dark); }
button.mini.danger { color: var(--danger); }
button.mini.danger:hover:not(:disabled) { background: #fdecea; border-color: #f5c6c6; }
button.mini:disabled { opacity: 0.45; cursor: not-allowed; }

/* Modo mobile da tabela de versões: esconder colunas e usar cards */
@media (max-width: 720px) {
  .versions-table thead { display: none; }
  .versions-table tr.version-row { display: none; }
  .versions-table .mobile-row { display: table-row; }
  .versions-table .mobile-row td { padding: 0; border: none; }
  .versions-table .mob-card {
    border-bottom: 1px solid var(--border); padding: 12px 14px;
    display: flex; flex-direction: column; gap: 8px;
  }
  .versions-table .mob-row {
    display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  }
  .versions-table .mob-commit { flex-direction: column; align-items: stretch; gap: 4px; }
  .versions-table .mob-tags { gap: 4px; }
  .versions-table .mob-actions { display: flex; gap: 6px; margin-top: 4px; }
  .versions-table .mob-actions button { flex: 1; margin-left: 0; padding: 8px; font-size: 12px; }
}
@media (min-width: 721px) {
  .versions-table .mobile-row { display: none !important; }
}

/* ---------- Operações ---------- */
.ops-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 720px) { .ops-grid { grid-template-columns: 1fr 1fr; } }

.ops-card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 8px; padding: 18px 20px;
}
.ops-card h3 { margin: 0 0 6px 0; font-size: 14px; font-weight: 600; }
.ops-card p { color: var(--muted); font-size: 12px; line-height: 1.5; margin: 0 0 12px 0; }
.ops-card code { background: var(--bg); padding: 1px 5px; border-radius: 3px; border: 1px solid var(--border); font-size: 11px; }

/* ---------- Modal ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(15, 23, 42, 0.6); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 12px; }
@media (min-width: 640px) { .modal-backdrop { padding: 24px; } }
.modal { background: var(--panel); border-radius: 8px; max-width: 900px; width: 100%; max-height: 94vh; display: flex; flex-direction: column; overflow: hidden; }
.modal header { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.modal header h3 { margin: 0; font-size: 14px; font-weight: 600; }
.modal header button.close { background: transparent; border: none; font-size: 24px; cursor: pointer; color: var(--muted); padding: 2px 8px; line-height: 1; }
.modal .body { padding: 14px 16px; overflow-y: auto; flex: 1; }
.log-console {
  background: var(--code-bg); color: var(--code-text);
  font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px;
  padding: 12px; border-radius: 6px; white-space: pre-wrap; word-break: break-word;
  min-height: 260px; max-height: 65vh; overflow-y: auto; line-height: 1.5;
}

/* ---------- Tabelas genéricas (usuários, audit) ---------- */
table { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
table th, table td { text-align: left; padding: 10px 12px; font-size: 13px; border-bottom: 1px solid var(--border); }
table th { background: var(--bg); font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; font-size: 11px; }
table tr:last-child td { border-bottom: none; }
table tr:nth-child(even) { background: #fafbfc; }
code { font-family: ui-monospace, Menlo, monospace; font-size: 11px; background: var(--bg); padding: 1px 5px; border-radius: 3px; border: 1px solid var(--border); }

/* ---------- Form ---------- */
input[type=email], input[type=text] {
  padding: 8px 10px; border: 1px solid var(--border); border-radius: 4px;
  font-size: 13px; font-family: inherit; background: var(--panel); color: var(--text);
}
input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 2px rgba(25,118,210,0.1); }
.form-inline { display: flex; gap: 8px; align-items: center; margin-top: 16px; flex-wrap: wrap; }
.form-inline input { flex: 1; min-width: 140px; }
.form-inline button { padding: 8px 14px; background: var(--primary); color: white; border: 1px solid var(--primary); border-radius: 4px; cursor: pointer; font-size: 13px; font-weight: 500; }
.form-inline button:hover { background: var(--primary-dark); }
.inline-check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); user-select: none; cursor: pointer; }
.inline-check input { flex: 0 0 auto; min-width: 0; margin: 0; }

/* ---------- Auditoria (timeline visual) ---------- */
.audit-filters {
  display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px;
  padding-bottom: 12px; border-bottom: 1px solid var(--border);
}
.filter-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 16px;
  background: var(--panel); border: 1px solid var(--border);
  cursor: pointer; font-size: 12px; color: var(--muted);
  transition: all 0.15s;
}
.filter-chip:hover { background: var(--bg); color: var(--text); }
.filter-chip.active { background: var(--primary); color: white; border-color: var(--primary); }
.filter-chip .fc-count {
  background: rgba(0,0,0,0.08); padding: 1px 7px; border-radius: 10px;
  font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums;
}
.filter-chip.active .fc-count { background: rgba(255,255,255,0.25); }

.audit-timeline { display: flex; flex-direction: column; gap: 20px; }

.audit-day-label {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 1px; color: var(--muted); margin-bottom: 8px;
  padding: 0 4px;
}

.audit-items { display: flex; flex-direction: column; gap: 6px; }

.audit-item {
  display: flex; gap: 12px; padding: 10px 12px;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 6px; align-items: flex-start;
  transition: border-color 0.15s;
}
.audit-item:hover { border-color: #cfd4da; }

.audit-icon {
  flex-shrink: 0; width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; line-height: 1;
  background: var(--bg); border: 1px solid var(--border);
}
.audit-icon.audit-color-primary { background: #e8f4fd; border-color: #9cd0f7; }
.audit-icon.audit-color-success { background: #e8f5e9; border-color: #b9dfbb; }
.audit-icon.audit-color-danger  { background: #fdecea; border-color: #f5c6c6; }
.audit-icon.audit-color-warn    { background: #fff4e5; border-color: #ffcf99; }
.audit-icon.audit-color-info    { background: #ede7f6; border-color: #b39ddb; }
.audit-icon.audit-color-staging { background: #e8f4fd; border-color: #9cd0f7; }

.audit-main { flex: 1; min-width: 0; }

.audit-line-1 {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-bottom: 3px;
}
.audit-action { font-size: 13px; font-weight: 600; color: var(--text); }

.audit-target { display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.audit-target code { font-size: 11px; padding: 1px 6px; }
.audit-target .user-target { font-size: 12px; color: var(--muted); }
.audit-target .pkg-badge {
  font-size: 10px; padding: 1px 7px; border-radius: 3px;
  background: var(--bg); border: 1px solid var(--border);
  color: var(--muted); font-weight: 500;
}

.audit-line-2 {
  font-size: 11px; color: var(--muted);
  display: flex; gap: 4px; align-items: center; flex-wrap: wrap;
}
.audit-who { font-weight: 500; color: var(--text); }
.audit-sep { opacity: 0.6; }
.audit-when { }

.audit-details {
  display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px;
}
.detail-chip {
  display: inline-flex; align-items: center; gap: 0;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 4px; overflow: hidden;
  font-size: 11px;
}
.detail-chip .dc-k {
  padding: 2px 8px; background: #eceff3; color: var(--muted);
  font-weight: 500; text-transform: lowercase;
}
.detail-chip .dc-v {
  padding: 2px 8px; color: var(--text);
}
.detail-chip .dc-v.mono { font-family: ui-monospace, Menlo, monospace; font-size: 10px; }
.detail-chip .dc-arrow { padding: 2px 4px; color: var(--muted); }

/* Audit mobile */
@media (max-width: 520px) {
  .audit-item { padding: 10px; gap: 10px; }
  .audit-icon { width: 28px; height: 28px; font-size: 13px; }
  .audit-line-1 { gap: 6px; }
  .audit-action { font-size: 12px; }
  .audit-details { gap: 4px; }
  .detail-chip { font-size: 10px; }
}

/* ---------- Toast ---------- */
.toast { position: fixed; bottom: 16px; right: 16px; background: var(--panel); border: 1px solid var(--border); padding: 12px 16px; border-radius: 6px; font-size: 13px; box-shadow: 0 4px 12px rgba(0,0,0,0.12); z-index: 200; max-width: calc(100vw - 32px); }
.toast.success { border-color: #b9dfbb; background: #e8f5e9; color: var(--success); }
.toast.error { border-color: #f5c6c6; background: #fdecea; color: var(--danger); }
