/* Present CRM status page — brand values from /brand/brand.css */
:root { --ok: #2e7d4f; --ok-bg: #dcebdf; --warn: #b9811a; --warn-bg: #f6ead0; --bad: #b3382c; --bad-bg: #f6e1dc; --maint: #2f6f8f; --maint-bg: #dbe9f0; --none: #d4d0bd; }
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; background: var(--bg); color: var(--text); font-family: var(--font-body); font-size: 16px; line-height: 1.5; }
h1, h2, h3 { font-family: var(--font-heading); font-weight: 600; color: var(--brand-primary); line-height: 1.2; margin: 0; }
a { color: var(--brand-primary); }
:focus-visible { outline: 3px solid var(--brand-accent); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }
.wrap { width: 100%; max-width: 880px; margin: 0 auto; padding: 0 20px; }
.muted { color: var(--text-muted); } .small { font-size: .85rem; }
.empty { color: var(--text-muted); margin: 8px 0; list-style: none; }

/* header */
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
.header-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 64px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--brand-primary); min-width: 0; }
.brand-logo { height: var(--logo-height); width: auto; display: block; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; min-width: 0; }
.brand-name { font-family: var(--font-heading); font-weight: 600; font-size: 1.3rem; letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; }
.brand-sub { font-size: .78rem; color: var(--text-muted); letter-spacing: .04em; }
.topnav { display: flex; gap: 4px; background: var(--surface-2); border-radius: 999px; padding: 4px; }
.topnav a { text-decoration: none; font-size: .9rem; font-weight: 600; padding: 6px 14px; border-radius: 999px; color: var(--text-muted); white-space: nowrap; }
.topnav a:hover { color: var(--brand-primary); }
.topnav a[aria-current="page"] { background: var(--brand-primary); color: var(--brand-on-primary); }

main { flex: 1; padding-top: 28px; padding-bottom: 40px; }

/* banner */
.banner { display: flex; gap: 16px; align-items: center; border-radius: 16px; padding: 22px 24px; margin-bottom: 20px; color: #fff; background: #8a8466; box-shadow: 0 1px 0 rgba(0,0,0,.04); }
.banner h1 { color: inherit; font-size: 1.7rem; }
.banner p { margin: 4px 0 0; opacity: .92; }
.banner-dot { flex: none; width: 18px; height: 18px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 6px rgba(255,255,255,.22); }
.banner-operational { background: var(--brand-primary); }
.banner-operational .banner-dot { color: #7fd39b; }
.banner-degraded { background: var(--warn); }
.banner-down { background: var(--bad); }
.banner-maintenance { background: var(--maint); }
.banner-unknown, .banner-loading { background: #8a8466; }
.banner-loading .banner-dot { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }

/* cards */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 20px 22px; margin-bottom: 20px; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.card-head h2 { font-size: 1.35rem; }
.legend { font-size: .78rem; color: var(--text-muted); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.sq { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-left: 6px; }
.sq.ok, .bar.ok { background: var(--ok); } .sq.warn, .bar.warn { background: var(--warn); } .sq.bad, .bar.bad { background: var(--bad); } .sq.none, .bar.none { background: var(--none); }

/* components */
.comp { padding: 16px 0; border-top: 1px solid var(--border); }
.comp:first-child { border-top: 0; padding-top: 6px; }
.comp-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.comp-name h3 { font-size: 1.1rem; }
.comp-name p { margin: 2px 0 0; color: var(--text-muted); font-size: .9rem; }
.comp-note { margin: 8px 0 0; background: var(--surface-2); border-radius: 8px; padding: 8px 12px; font-size: .92rem; }
.comp-meta { margin: 6px 0 0; font-size: .8rem; color: var(--text-muted); }
.pill { flex: none; display: inline-flex; align-items: center; gap: 6px; font-size: .82rem; font-weight: 700; padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.pill-operational { color: var(--ok); background: var(--ok-bg); }
.pill-degraded { color: var(--warn); background: var(--warn-bg); }
.pill-down { color: var(--bad); background: var(--bad-bg); }
.pill-maintenance { color: var(--maint); background: var(--maint-bg); }
.pill-unmonitored, .pill-pending, .pill-inc-resolved { color: var(--text-muted); background: var(--surface-2); }
.pill-inc-minor { color: var(--warn); background: var(--warn-bg); }
.pill-inc-major { color: var(--bad); background: var(--bad-bg); }
.pill-inc-maintenance { color: var(--maint); background: var(--maint-bg); }
.bars { display: flex; gap: 2px; margin-top: 12px; height: 34px; }
.bar { flex: 1; min-width: 2px; border-radius: 2px; }
.bar:hover { opacity: .7; }
.bars-foot { display: flex; justify-content: space-between; gap: 8px; font-size: .75rem; color: var(--text-muted); margin-top: 4px; }
.pct { font-weight: 600; color: var(--text); }
.d30, .pct-30 { display: none; }

/* updates */
.updates { list-style: none; margin: 0; padding: 0; }
.upd { display: grid; grid-template-columns: 150px 1fr; gap: 16px; padding: 16px 0; border-top: 1px solid var(--border); }
.upd:first-child { border-top: 0; padding-top: 6px; }
.upd-date { font-size: .88rem; font-weight: 600; color: var(--text-muted); padding-top: 2px; }
.upd-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.upd-head h3 { font-size: 1.12rem; }
.upd-text p { margin: 6px 0 0; }
.tag { font-size: .72rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; padding: 2px 8px; border-radius: 999px; }
.tag-new { background: var(--brand-accent-soft); color: #6b5a17; }
.tag-improvement { background: var(--ok-bg); color: var(--ok); }
.tag-fix { background: var(--maint-bg); color: var(--maint); }

/* incidents */
.incidents-active { margin-bottom: 20px; }
.incident { padding: 14px 0; border-top: 1px solid var(--border); }
.history .incident:first-child { border-top: 0; padding-top: 4px; }
.incident-active { background: var(--surface); border: 1px solid var(--border); border-left: 6px solid var(--warn); border-radius: 14px; padding: 16px 18px; margin-bottom: 12px; }
.incident-active.impact-major { border-left-color: var(--bad); }
.incident-active.impact-maintenance { border-left-color: var(--maint); }
.incident-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.incident-head h3 { font-size: 1.1rem; }
.incident p { margin: 4px 0 0; }
.inc-updates { list-style: none; margin: 10px 0 0; padding: 0 0 0 14px; border-left: 2px solid var(--border); }
.inc-updates li { margin-bottom: 10px; font-size: .94rem; }
.inc-updates li p { margin: 2px 0 0; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 10px; border: 1px solid transparent; font: inherit; font-weight: 600; cursor: pointer; }
.btn-primary { background: var(--brand-primary); color: var(--brand-on-primary); }
.btn-primary:hover { background: var(--brand-primary-hover); }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--brand-primary); }
#more-updates { margin-top: 8px; }

.site-footer { border-top: 1px solid var(--border); background: var(--surface); }
.footer-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-top: 14px; padding-bottom: 14px; font-size: .85rem; color: var(--text-muted); }
.footer-row p { margin: 0; }
.footer-admin { color: var(--text-muted); }

@media (max-width: 640px) {
  .wrap { padding: 0 14px; }
  .header-row { min-height: 58px; }
  .brand-logo { height: 34px; }
  .brand-name { font-size: 1.05rem; }
  .brand-sub { display: none; }
  .topnav a { padding: 6px 10px; font-size: .82rem; }
  main { padding-top: 16px; }
  .banner { padding: 18px; gap: 14px; }
  .banner h1 { font-size: 1.3rem; }
  .card { padding: 16px; }
  .bar.old { display: none; }
  .d90, .pct-90 { display: none; } .d30, .pct-30 { display: inline; }
  .upd { grid-template-columns: 1fr; gap: 4px; }
  .comp-row, .incident-head { flex-wrap: wrap; }
}
@media (max-width: 480px) { .brand-name { display: none; } }
