/* The System view (system.js): the tab bar, problem rows and the checks. */
/* The two views wrap what used to sit directly in the page's grid: the same
   grid again, and no wider than the screen (the tables scroll inside). */
#viewCompanies, #viewSystem { display: grid; gap: 20px; min-width: 0; }
.views { display: flex; gap: 4px; margin-left: 18px; }
.view-tab { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border-radius: 9px; color: var(--text); font-weight: 600; text-decoration: none; }
.view-tab:hover { background: var(--soft); }
.view-tab.on { background: var(--brand-soft); color: var(--brand-dark); }
.view-tab .n { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--bad); color: #fff; font-size: 12px; line-height: 20px; text-align: center; }

.src { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 6px; font-size: 11px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; background: var(--soft); color: var(--muted); }
.src.api { background: #ede9fe; color: #5b21b6; }
.src.web { background: #dbeafe; color: #1e40af; }
.src.phone { background: #d1fae5; color: #065f46; }
.src.check { background: #fef3c7; color: #92400e; }
.where { display: grid; gap: 2px; min-width: 0; }
.where code { font: 12px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--ink); overflow-wrap: anywhere; }
.what { max-width: 520px; color: var(--ink); overflow-wrap: anywhere; }
.what .note { color: var(--muted); font-size: 12px; }
.sys-sub { padding-left: 8px; border-left: 1px solid var(--line); }
.level { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.level::before { content: ''; width: 9px; height: 9px; border-radius: 50%; background: currentColor; }
.level.ok { color: var(--good); }
.level.warn { color: var(--warn); }
.level.fail { color: var(--bad); }
.checks-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); color: var(--muted); }
.checks-head strong { color: var(--ink); }
.pre { margin: 0; max-height: 320px; overflow: auto; padding: 12px; border-radius: 8px; background: #0f172a; color: #e2e8f0; font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
.events { display: grid; margin: 0; padding: 0; list-style: none; }
.events li { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 13px; }
.events li:first-child { border-top: 0; }
.events time { color: var(--muted); white-space: nowrap; }
.events .co { color: var(--ink); }
.companies { display: flex; flex-wrap: wrap; gap: 6px; }
.companies .badge { cursor: default; }
.drawer-head .what-title { margin: 0; color: var(--ink); font-size: 17px; font-weight: 700; overflow-wrap: anywhere; }
.btn.good { border-color: var(--good); color: var(--good); }
.btn.good:hover { background: var(--good-soft); }
.empty-state { padding: 48px 16px; text-align: center; color: var(--muted); }
.empty-state strong { display: block; margin-bottom: 4px; color: var(--ink); font-size: 16px; }

@media (max-width: 560px) {
  /* The header wraps: brand and Sign out on one line, the tabs under them. */
  .topbar-row { flex-wrap: wrap; row-gap: 6px; }
  .views { order: 3; width: 100%; margin-left: 0; }
  .view-tab { padding: 0 9px; }
  .events li { grid-template-columns: minmax(0, 1fr); gap: 2px; }
}

/* Fixes (system.js): a card per fix, in the problem's drawer and the Fixes view. */
.fix-cards { display: grid; gap: 0; border-bottom: 1px solid var(--line); }
.fix { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 14px 16px; border-top: 1px solid var(--line); }
.fix:first-child { border-top: 0; }
.section .fix { padding: 12px 0; }
.fix-text { display: grid; gap: 4px; min-width: 0; }
.fix-text strong { color: var(--ink); }
.fix-text p { margin: 0; }
.fix .btn { flex: none; }
.fix-progress:empty { display: none; }
.fix-progress { display: grid; gap: 6px; margin-top: 4px; }
textarea.bundle { width: 100%; min-height: 220px; padding: 10px; border: 1px solid var(--line); border-radius: 8px; font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; }
@media (max-width: 560px) {
  .fix { flex-direction: column; }
}
