:root {
  color-scheme: light;
  --bg: #f4f6f5;
  --surface: #ffffff;
  --surface-2: #eef2f0;
  --text: #18201d;
  --muted: #66736c;
  --border: #d9e0dc;
  --accent: #147a63;
  --accent-2: #0f5d73;
  --danger: #b83232;
  --warning: #a76712;
  --shadow: 0 10px 32px rgba(24, 32, 29, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

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

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px;
  background: #1d2521;
  color: #edf5f1;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
}

.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 6px;
  color: #ffffff;
  background: #147a63;
  font-weight: 800;
}

.brand h1 {
  margin: 0;
  font-size: 18px;
}

.brand p {
  margin: 3px 0 0;
  color: #aebbb5;
  font-size: 13px;
}

nav {
  display: grid;
  gap: 6px;
}

nav a {
  color: #dce8e3;
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 14px;
}

nav a.active,
nav a:hover {
  background: rgba(255, 255, 255, 0.1);
}

.sidebar-footer {
  margin-top: auto;
  display: flex;
  gap: 8px;
  align-items: center;
  color: #c5d2cd;
  font-size: 13px;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--warning);
}

.status-dot.online {
  background: #3fb277;
}

main {
  padding: 24px;
  display: grid;
  gap: 20px;
  align-content: start;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

.topbar h2 {
  margin: 0;
  font-size: 24px;
}

.topbar p {
  margin: 5px 0 0;
  color: var(--muted);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.actions.compact {
  margin-top: 10px;
}

.button {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  min-height: 38px;
  padding: 0 14px;
  border-radius: 6px;
  cursor: pointer;
}

.button.primary {
  color: white;
  background: var(--accent);
  border-color: var(--accent);
}

.button.danger {
  color: white;
  background: var(--danger);
  border-color: var(--danger);
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.metric,
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: var(--shadow);
}

.metric {
  padding: 16px;
  display: grid;
  gap: 8px;
}

.metric span {
  color: var(--muted);
  font-size: 13px;
}

.metric strong {
  font-size: 22px;
}

.work-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(360px, 0.9fr);
  gap: 20px;
}

.work-grid.lower {
  align-items: start;
}

.panel {
  min-width: 0;
}

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

.panel h3 {
  margin: 0;
  font-size: 16px;
}

.panel header span {
  color: var(--muted);
  font-size: 13px;
}

.timeline,
.call-list,
.server-list,
.approval-list,
.engagement-list {
  padding: 12px;
  display: grid;
  gap: 10px;
}

.timeline {
  max-height: 520px;
  overflow: auto;
}

.event,
.call,
.server,
.engagement {
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent-2);
  border-radius: 6px;
  padding: 10px;
  background: #fbfcfb;
}

.event.high,
.event.critical,
.call.failed,
.call.blocked {
  border-left-color: var(--danger);
}

.event.medium,
.call.review_required {
  border-left-color: var(--warning);
}

.event-title,
.call-title,
.server-title,
.engagement-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-weight: 700;
  font-size: 14px;
}

.event p,
.call p,
.server p,
.engagement p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

code {
  color: #24423a;
  background: var(--surface-2);
  padding: 2px 5px;
  border-radius: 4px;
  white-space: normal;
  overflow-wrap: anywhere;
}

.form {
  padding: 12px;
  display: grid;
  gap: 12px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px;
  color: var(--text);
  background: white;
}

textarea {
  min-height: 86px;
  resize: vertical;
}

@media (max-width: 980px) {
  .app-shell,
  .work-grid,
  .metrics-grid {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }
}
