*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
}

a {
  color: var(--rust);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

button,
input,
select,
textarea {
  font: inherit;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--side);
  color: var(--side-text);
  display: flex;
  flex-direction: column;
  border-right: 1px solid #1a1510;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-mark {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  background: var(--rust);
  color: #fff;
  font-family: var(--mono);
  font-weight: 600;
  font-size: 13px;
  border-radius: var(--radius);
}

.sidebar-brand strong {
  display: block;
  font-size: 13px;
  font-weight: 600;
}

.brand-sub {
  font-size: 11px;
  color: var(--side-muted);
}

.sidebar-nav {
  flex: 1;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius);
  color: var(--side-text);
  text-decoration: none;
  font-size: 13px;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
}

.nav-link:hover {
  background: var(--side-hover);
  text-decoration: none;
}

.nav-link.active {
  background: var(--rust);
  color: #fff;
}

.nav-icon {
  width: 18px;
  text-align: center;
  opacity: 0.85;
  font-family: var(--mono);
  font-size: 11px;
}

.sidebar-foot {
  padding: 12px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.hub-link {
  color: var(--side-muted);
  font-size: 12px;
}

.hub-link:hover {
  color: var(--side-text);
}

.main-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  height: var(--top-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 20px;
  background: var(--panel-raised);
  border-bottom: 1px solid var(--line);
}

.search-form {
  position: relative;
  flex: 1;
  max-width: 420px;
}

.search-form input {
  width: 100%;
  padding: 7px 36px 7px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
}

.search-form input:focus {
  outline: 2px solid var(--focus);
  outline-offset: 1px;
}

.search-form kbd {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--mono);
  font-size: 10px;
  padding: 2px 5px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 3px;
  color: var(--muted);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-pill {
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green);
  font-weight: 500;
}

.status-pill.degraded {
  background: var(--amber-soft);
  color: var(--amber);
}

.status-pill.critical {
  background: var(--red-soft);
  color: var(--red);
}

.content {
  flex: 1;
  padding: 24px;
  overflow: auto;
}

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.page-head h1 {
  margin: 0 0 4px;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.page-head p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 8px;
}

.breadcrumb a {
  color: var(--muted);
}

.breadcrumb a:hover {
  color: var(--rust);
}

.btn,
.btn-primary,
.btn-ghost,
.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--panel-raised);
  color: var(--ink);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
}

.btn-primary {
  background: var(--rust);
  border-color: var(--rust);
  color: #fff;
}

.btn-primary:hover {
  background: var(--rust-hover);
  border-color: var(--rust-hover);
}

.btn-ghost:hover {
  background: var(--rust-soft);
  border-color: var(--line-strong);
}

.btn-icon {
  width: 32px;
  height: 32px;
  padding: 0;
  font-size: 18px;
  line-height: 1;
}

.btn-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--panel-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow);
}

.stat-card .label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 6px;
}

.stat-card .value {
  font-size: 28px;
  font-weight: 600;
  font-family: var(--mono);
  line-height: 1.1;
}

.stat-card .delta {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

.panel {
  background: var(--panel-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.panel-head h2 {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
}

.panel-body.padded {
  padding: 16px;
}

.split-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 900px) {
  .split-grid {
    grid-template-columns: 1fr;
  }
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  font-family: var(--mono);
  text-transform: lowercase;
}

.sev-critical { background: var(--red-soft); color: var(--red); }
.sev-high { background: var(--rust-soft); color: var(--rust); }
.sev-medium { background: var(--amber-soft); color: var(--amber); }
.sev-low { background: var(--blue-soft); color: var(--blue); }

.st-open { background: var(--red-soft); color: var(--red); }
.st-investigating { background: var(--amber-soft); color: var(--amber); }
.st-mitigated { background: var(--blue-soft); color: var(--blue); }
.st-resolved { background: var(--green-soft); color: var(--green); }

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  padding: 10px 16px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}

.data-table th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  background: var(--panel);
  font-weight: 600;
}

.data-table tbody tr {
  cursor: pointer;
}

.data-table tbody tr:hover {
  background: var(--rust-soft);
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
  padding: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}

.filters input,
.filters select {
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-raised);
  min-width: 140px;
}

.timeline {
  list-style: none;
  margin: 0;
  padding: 16px;
}

.timeline li {
  position: relative;
  padding-left: 24px;
  padding-bottom: 20px;
}

.timeline li::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 6px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--rust);
  border: 2px solid var(--panel-raised);
  box-shadow: 0 0 0 1px var(--line);
}

.timeline li::after {
  content: "";
  position: absolute;
  left: 7px;
  top: 16px;
  bottom: 0;
  width: 2px;
  background: var(--line);
}

.timeline li:last-child::after {
  display: none;
}

.timeline .time {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
}

.timeline .event-title {
  font-weight: 500;
  margin: 2px 0;
}

.timeline .event-body {
  font-size: 13px;
  color: var(--muted);
}

.team-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  padding: 16px;
}

.member-card {
  display: flex;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel);
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  background: var(--side);
  color: var(--side-text);
  display: grid;
  place-items: center;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  flex-shrink: 0;
}

.member-card .name {
  font-weight: 600;
  font-size: 14px;
}

.member-card .role {
  font-size: 12px;
  color: var(--muted);
}

.member-card .meta {
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
  font-family: var(--mono);
}

.settings-form {
  max-width: 520px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

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

.field label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.field input,
.field select,
.field textarea {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
}

.field textarea {
  min-height: 80px;
  resize: vertical;
}

.field-check {
  flex-direction: row;
  align-items: center;
  gap: 10px;
}

.field-check input {
  width: 16px;
  height: 16px;
}

.schedule-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.schedule-day {
  background: var(--panel-raised);
  padding: 12px;
  min-height: 100px;
}

.schedule-day.today {
  background: var(--rust-soft);
}

.schedule-day .day-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 8px;
}

.schedule-day .day-num {
  font-size: 18px;
  font-weight: 600;
  font-family: var(--mono);
  margin-bottom: 8px;
}

.schedule-day .oncall-name {
  font-size: 12px;
  font-weight: 500;
}

.detail-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
}

@media (max-width: 800px) {
  .detail-grid {
    grid-template-columns: 1fr;
  }
}

.meta-list {
  list-style: none;
  margin: 0;
  padding: 16px;
}

.meta-list li {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

.meta-list li:last-child {
  border-bottom: none;
}

.meta-list .key {
  color: var(--muted);
}

.description-block {
  padding: 16px;
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-wrap;
}

.war-room {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 16px;
}

@media (max-width: 900px) {
  .war-room {
    grid-template-columns: 1fr;
  }
}

.war-sidebar {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.action-box {
  padding: 12px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--panel);
}

.action-box h3 {
  margin: 0 0 8px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.checklist {
  list-style: none;
  margin: 0;
  padding: 0;
}

.checklist li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  font-size: 13px;
}

.checklist input {
  accent-color: var(--rust);
}

.state-empty,
.state-error {
  text-align: center;
  padding: 48px 24px;
  background: var(--panel-raised);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-lg);
}

.state-empty .icon,
.state-error .icon {
  font-size: 32px;
  margin-bottom: 12px;
  opacity: 0.5;
}

.state-empty h2,
.state-error h2 {
  margin: 0 0 8px;
  font-size: 16px;
}

.state-empty p,
.state-error p {
  margin: 0 0 16px;
  color: var(--muted);
  max-width: 360px;
  margin-left: auto;
  margin-right: auto;
}

.state-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 24px;
  color: var(--muted);
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--line);
  border-top-color: var(--rust);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 12px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.modal {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 0;
  max-width: 440px;
  width: calc(100% - 32px);
  box-shadow: var(--shadow);
  background: var(--panel-raised);
}

.modal::backdrop {
  background: rgba(26, 22, 18, 0.4);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.modal-head h2 {
  margin: 0;
  font-size: 15px;
}

.modal-body {
  padding: 16px;
}

.shortcut-list {
  margin: 0;
}

.shortcut-list > div {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.shortcut-list > div:last-child {
  border-bottom: none;
}

.shortcut-list dt {
  min-width: 80px;
}

.shortcut-list dd {
  margin: 0;
  color: var(--muted);
}

kbd {
  font-family: var(--mono);
  font-size: 11px;
  padding: 2px 6px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 3px;
  box-shadow: 0 1px 0 var(--line-strong);
}

.activity-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.activity-list li {
  display: flex;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

.activity-list li:last-child {
  border-bottom: none;
}

.activity-list .act-time {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}

.search-hit {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}

.search-hit:hover {
  background: var(--rust-soft);
}

.search-hit:last-child {
  border-bottom: none;
}

.search-hit .hit-type {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.search-hit .hit-title {
  font-weight: 500;
  margin: 2px 0;
}

.search-hit .hit-snippet {
  font-size: 12px;
  color: var(--muted);
}
