/* SMART NOC - calm, minimal style. One accent colour: blue. */
:root {
  --accent: #2563eb;
  --bg: #f4f5f7;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --line: #e5e7eb;
  --critical: #dc2626;
  --warning: #ea8a0c;
  --ok: #16a34a;
  --unknown: #9ca3af;
}

* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, sans-serif; font-size: 14px;
       background: var(--bg); color: var(--text); }
main { max-width: 1200px; margin: 0 auto; padding: 24px; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2 { font-weight: 600; }
h2 { font-size: 16px; margin: 24px 0 8px; }

/* Left side menu (fixed), the page content sits to its right */
.sidebar { position: fixed; top: 0; left: 0; bottom: 0; width: 200px;
           display: flex; flex-direction: column; gap: 2px; padding: 20px 12px;
           background: var(--card); border-right: 1px solid var(--line); }
.sidebar .brand { font-weight: 700; color: var(--accent); font-size: 16px; padding: 0 10px 16px; }
.sidebar a, .sidebar summary { display: block; padding: 8px 10px; border-radius: 6px; color: var(--text); }
.sidebar a:hover, .sidebar summary:hover { background: var(--bg); text-decoration: none; }
.sidebar a.active { background: #e0ecff; color: var(--accent); font-weight: 600; }
.sidebar summary { cursor: pointer; }
.sidebar details a { padding-left: 26px; }        /* items under Settings */
.sidebar .spacer { flex: 1; }
.sidebar .who { color: var(--muted); padding: 8px 10px; }
main.withmenu { margin-left: 200px; }

/* Cards, forms, buttons */
.card { background: var(--card); border: 1px solid var(--line);
        border-radius: 8px; padding: 20px; }
.login { max-width: 320px; margin: 80px auto; display: flex;
         flex-direction: column; gap: 12px; }
.login h1 { margin: 0 0 8px; text-align: center; color: var(--accent); }
label { display: flex; flex-direction: column; gap: 4px; color: var(--muted); }
input, select { padding: 7px 9px; border: 1px solid var(--line);
                border-radius: 6px; font: inherit; }
button { padding: 6px 12px; border: 0; border-radius: 6px; cursor: pointer;
         background: var(--accent); color: #fff; font: inherit; }
button:hover { opacity: .9; }
button.small { padding: 3px 8px; font-size: 12px; }
button.danger { background: var(--critical); }
form.inline { display: inline; }

/* Flash messages */
.flash { padding: 10px 14px; border-radius: 6px; margin-bottom: 12px;
         background: #e0ecff; }
.flash.error   { background: #fde2e2; }
.flash.success { background: #dcfce7; }

/* Counter boxes */
.counters { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; }
.counter { background: var(--card); border: 1px solid var(--line);
           border-left: 5px solid var(--unknown); border-radius: 8px;
           padding: 14px 18px; color: var(--muted); }
.counter b { display: block; font-size: 28px; color: var(--text); }
.counter.critical { border-left-color: var(--critical); }
.counter.warning  { border-left-color: var(--warning); }
.counter.ok       { border-left-color: var(--ok); }
.counter.healed   { border-left-color: var(--accent); }

/* Tables */
table { width: 100%; border-collapse: collapse; background: var(--card);
        border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
th, td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--line);
         vertical-align: top; }
th { background: #fafafa; color: var(--muted); font-weight: 600; }
td.output { color: var(--muted); max-width: 360px; }
td.empty { text-align: center; color: var(--muted); padding: 24px; }
pre { white-space: pre-wrap; margin: 0; font-size: 12px; }

/* State badges */
.badge { display: inline-block; padding: 2px 8px; border-radius: 10px;
         color: #fff; font-size: 12px; font-weight: 600; background: var(--unknown); }
.badge.critical, .badge.failed  { background: var(--critical); }
.badge.warning,  .badge.timeout { background: var(--warning); }
.badge.ok,       .badge.success { background: var(--ok); }

/* Playbook list on the dashboard: one "name [Heal]" per line */
td.playbooks form { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.pb { font-family: monospace; font-size: 12px; }
.muted { color: var(--muted); }

/* Add-server / add-rule forms: fields side by side */
.addform { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
label.check { flex-direction: row; align-items: center; padding-bottom: 8px; }
button.off { background: var(--unknown); }

/* Alert details: label column */
table.details th { width: 160px; }
p.muted { margin: 0 0 10px; }

/* Role tag in the top bar, status text on the alerts page, user row form */
.role { background: var(--bg); border: 1px solid var(--line); border-radius: 10px;
        padding: 1px 8px; font-size: 12px; margin-left: 4px; }
.status.open     { color: var(--critical); font-weight: 600; }
.status.resolved { color: var(--ok); }
form.rowform { display: flex; gap: 8px; align-items: center; }

/* Alerts page: one heading per host */
h3.hosthead { display: flex; gap: 12px; align-items: baseline; margin: 24px 0 8px; font-size: 15px; }
h3.hosthead .muted, h3.hosthead .status { font-size: 13px; font-weight: normal; }

/* Alert page: last result box */
.lastresult { margin-bottom: 16px; display: flex; flex-direction: column; gap: 6px; }


/* Host page: "+ Add alert" link as a button, action buttons, advanced form */
h2.withbutton { display: flex; justify-content: space-between; align-items: center; }
a.button { background: var(--accent); color: #fff; padding: 5px 12px; border-radius: 6px;
           font-size: 13px; font-weight: normal; }
a.button:hover { text-decoration: none; opacity: .9; }
td.actions { white-space: nowrap; }
.advanced { display: flex; flex-direction: column; gap: 12px; max-width: 760px; }
.advanced button { align-self: flex-start; }
.help { line-height: 1.6; }

/* Notifications page: event checkboxes side by side */
.checks { display: flex; flex-wrap: wrap; gap: 4px 12px; }

/* Evaluation page: the window in use */
tr.current td { background: #eef4ff; }

/* Learned confidence next to a playbook, and the bar on the Playbooks page */
small.conf { color: var(--ok); font-size: 11px; white-space: nowrap; }
small.conf.low { color: var(--critical); }
.bar { display: inline-block; width: 80px; height: 8px; background: var(--line);
       border-radius: 4px; vertical-align: middle; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--accent); }
.badge.skipped { background: var(--unknown); }

/* AI Advisor box on the incident page */
.ai { margin: 12px 0 16px; display: flex; flex-direction: column; gap: 8px;
      border-left: 4px solid var(--accent); }
.ai .withbutton { display: flex; justify-content: space-between; align-items: center; }
pre.answer { font-family: inherit; font-size: 14px; line-height: 1.5; }
.muted.small { font-size: 12px; }
.inline-gap { margin: 12px 0; }

/* Chaos page: one card per action */
.chaos { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.chaosaction { display: flex; flex-direction: column; gap: 8px; padding: 14px; }
.chaosaction button { align-self: flex-start; }
.chaosaction.undo { border-color: var(--ok); }

/* Wallboard: dark full-screen view for a big screen */
body.wall { background: #0b1220; color: #e5e7eb; padding: 20px 28px; min-height: 100vh; }
.wall header { display: flex; align-items: center; gap: 24px; margin-bottom: 20px; flex-wrap: wrap; }
.wall .brand { font-size: 22px; font-weight: 700; color: #60a5fa; }
.wall .wallstats { display: flex; gap: 28px; flex: 1; flex-wrap: wrap; color: #9ca3af; }
.wall .wallstats b { font-size: 26px; color: #fff; margin-right: 4px; }
.wall #clock { font-size: 26px; font-variant-numeric: tabular-nums; }
.wall h2 { color: #9ca3af; font-size: 14px; text-transform: uppercase; letter-spacing: .05em; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.tile { border-radius: 10px; padding: 16px 18px; background: #14532d; border: 2px solid #22c55e; }
.tile.warning { background: #713f12; border-color: #f59e0b; }
.tile.critical, .tile.unknown { background: #7f1d1d; border-color: #ef4444;
                                animation: pulse 1.5s ease-in-out infinite; }
@keyframes pulse { 50% { border-color: #fca5a5; } }
.tilehead { display: flex; justify-content: space-between; font-size: 18px; }
.tile .big { font-size: 34px; font-weight: 700; margin: 6px 0; }
.tile .big small { font-size: 14px; font-weight: normal; color: #d1d5db; }
.badsvc { font-size: 14px; color: #fde68a; }
.wallcols { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; margin-top: 12px; }
.wallrow { padding: 8px 0; border-bottom: 1px solid #1f2937; font-size: 15px; }
.wallrow .dim, .wall .dim { color: #9ca3af; }
.wallrow.allgood { color: #4ade80; }
.wallwarn { background: #7f1d1d; padding: 8px 12px; border-radius: 6px; margin-bottom: 12px; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin: 0 6px;
       background: #9ca3af; }
.dot.ok { background: #22c55e; } .dot.warning { background: #f59e0b; }
.dot.critical { background: #ef4444; } .dot.heal { background: #60a5fa; }
@media (max-width: 800px) { .wallcols { grid-template-columns: 1fr; } }
