:root {
  color-scheme: light;
  --ink: #172033;
  --muted: #687386;
  --line: #e2e7ef;
  --surface: #ffffff;
  --canvas: #f4f6fa;
  --navy: #17243f;
  --blue: #345bdc;
  --blue-soft: #eef2ff;
  --red: #c53545;
  --red-soft: #fff0f1;
  --amber: #a65d08;
  --amber-soft: #fff6e7;
  --green: #18794e;
  --green-soft: #eaf8f1;
  --slate-soft: #edf1f6;
  --shadow: 0 1px 2px rgba(20, 33, 56, 0.04), 0 8px 24px rgba(20, 33, 56, 0.05);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  background: var(--canvas);
  color: var(--ink);
  font-family: Inter, "Noto Sans JP", "Yu Gothic UI", "Yu Gothic", system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

button, select { font: inherit; }

.app-header {
  background: var(--navy);
  color: white;
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.header-inner,
.page-shell {
  width: min(1440px, calc(100% - 48px));
  margin: 0 auto;
}

.header-inner {
  min-height: 76px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 9px;
  background: rgba(255,255,255,.08);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .08em;
}

.eyebrow {
  margin: 0 0 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .13em;
  text-transform: uppercase;
}

.app-header .eyebrow { color: #9eadc6; }
.app-header h1 { margin: 0; font-size: 18px; letter-spacing: -.01em; }

.header-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  color: #c8d2e2;
  font-size: 12px;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #4dd59a;
  box-shadow: 0 0 0 4px rgba(77,213,154,.12);
}

.page-shell { padding: 34px 0 56px; }

.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.page-heading h2 { margin: 0; font-size: 27px; letter-spacing: -.035em; }
.page-description { margin: 5px 0 0; color: var(--muted); }

.last-updated { text-align: right; color: var(--muted); font-size: 12px; }
.last-updated span, .last-updated time { display: block; }
.last-updated time { margin-top: 2px; color: var(--ink); font-weight: 650; }

.alert {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin-bottom: 20px;
  padding: 13px 16px;
  border: 1px solid #f0b7bd;
  border-radius: 8px;
  background: var(--red-soft);
  color: #8d2632;
}

.alert[hidden] { display: none; }

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.kpi-card,
.panel {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.kpi-card {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  min-height: 128px;
  padding: 22px;
  overflow: hidden;
}

.kpi-card::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--accent);
  content: "";
}

.kpi-open { --accent: var(--blue); --tint: var(--blue-soft); }
.kpi-priority { --accent: var(--red); --tint: var(--red-soft); }
.kpi-resolved { --accent: var(--green); --tint: var(--green-soft); }
.kpi-breached { --accent: var(--amber); --tint: var(--amber-soft); }

.kpi-icon {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: var(--tint);
  color: var(--accent);
}

.kpi-icon svg { width: 20px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
.kpi-card p { margin: 0 0 4px; color: var(--muted); font-size: 12px; font-weight: 700; }
.kpi-card strong { display: block; font-size: 30px; line-height: 1.05; letter-spacing: -.04em; }
.kpi-card span { display: block; margin-top: 6px; color: var(--muted); font-size: 11px; }

.panel { padding: 22px; }
.panel-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 20px; }
.panel-heading h2 { margin: 0; font-size: 17px; letter-spacing: -.02em; }

.filters-panel { margin-bottom: 20px; }
.filters-heading { align-items: center; margin-bottom: 17px; }
.filter-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.filter-grid label { color: #526076; font-size: 12px; font-weight: 700; }

select {
  display: block;
  width: 100%;
  height: 42px;
  margin-top: 7px;
  padding: 0 36px 0 12px;
  border: 1px solid #ced5e0;
  border-radius: 7px;
  background-color: white;
  color: var(--ink);
  cursor: pointer;
}

select:focus-visible, button:focus-visible { outline: 3px solid rgba(52,91,220,.22); outline-offset: 2px; }

.text-button {
  padding: 7px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--blue);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.text-button:hover { background: var(--blue-soft); }

.summary-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }
.chart-panel { min-height: 264px; }
.panel-total { color: var(--muted); font-size: 12px; font-weight: 650; }
.bar-chart { display: grid; gap: 13px; }
.bar-row { display: grid; grid-template-columns: minmax(72px, 110px) 1fr 24px; align-items: center; gap: 12px; }
.bar-label { overflow: hidden; color: #465268; font-size: 12px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { height: 8px; overflow: hidden; border-radius: 2px; background: #edf0f5; }
.bar-fill { height: 100%; border-radius: 2px; background: var(--blue); transition: width 180ms ease; }
.chart-status-investigating .bar-fill { background: var(--amber); }
.chart-status-monitoring .bar-fill { background: var(--blue); }
.chart-status-resolved .bar-fill { background: var(--green); }
.bar-value { color: var(--ink); font-size: 12px; font-weight: 800; text-align: right; }

.incidents-panel { padding: 0; overflow: hidden; }
.incidents-panel .panel-heading { padding: 22px 22px 0; }
.table-heading { align-items: center; }
.result-count { margin: 0; color: var(--muted); font-size: 12px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th {
  padding: 11px 14px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #f8f9fb;
  color: #677387;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .07em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}
td { padding: 14px; border-bottom: 1px solid #edf0f4; color: #3b475b; font-size: 12px; vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fafbfe; }
.incident-id { color: #29364b; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; font-weight: 700; white-space: nowrap; }
.date-cell { min-width: 110px; white-space: nowrap; }
.summary-cell { min-width: 230px; max-width: 360px; color: #273449; font-weight: 550; }

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
}
.severity-critical { background: var(--red-soft); color: #a62333; }
.severity-high { background: var(--amber-soft); color: #915006; }
.severity-medium { background: var(--blue-soft); color: #3453b4; }
.severity-low { background: var(--slate-soft); color: #536074; }
.status-investigating { background: var(--amber-soft); color: #915006; }
.status-monitoring { background: var(--blue-soft); color: #3453b4; }
.status-resolved { background: var(--green-soft); color: var(--green); }
.sla { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.sla::before { width: 6px; height: 6px; border-radius: 50%; background: #aeb7c4; content: ""; }
.sla-breached { color: var(--red); font-weight: 750; }
.sla-breached::before { background: var(--red); }
.sla-met { color: var(--green); font-weight: 700; }
.sla-met::before { background: var(--green); }
.table-state { padding: 38px 20px; color: var(--muted); text-align: center; }

@media (max-width: 1000px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
  .header-inner, .page-shell { width: min(100% - 28px, 1440px); }
  .page-shell { padding-top: 24px; }
  .page-heading { align-items: flex-start; }
  .page-heading h2 { font-size: 23px; }
  .last-updated { padding-top: 3px; }
  .filter-grid, .summary-grid { grid-template-columns: 1fr 1fr; }
  .summary-grid { gap: 14px; }
}

@media (max-width: 540px) {
  .header-inner { min-height: 66px; }
  .header-status { display: none; }
  .page-heading { display: block; }
  .last-updated { margin-top: 12px; text-align: left; }
  .last-updated span, .last-updated time { display: inline; }
  .last-updated time { margin-left: 4px; }
  .kpi-grid { gap: 10px; }
  .kpi-card { min-height: 112px; padding: 16px; gap: 10px; }
  .kpi-icon { width: 32px; height: 32px; }
  .kpi-icon svg { width: 17px; }
  .kpi-card strong { font-size: 26px; }
  .panel { padding: 18px; }
  .filter-grid, .summary-grid { grid-template-columns: 1fr; }
  .incidents-panel { padding: 0; }
  .incidents-panel .panel-heading { padding: 18px 18px 0; }
  .table-heading { align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
