:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --ink: #1d2430;
  --muted: #6b7280;
  --line: #d8dde6;
  --accent: #0f766e;
  --accent-dark: #115e59;
  --danger: #b42318;
  --warn: #b7791f;
  --ok: #15803d;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
}

a {
  color: inherit;
}

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 240px 1fr;
}

.sidebar {
  background: #18212f;
  color: #f8fafc;
  padding: 20px 16px;
}

.brand {
  font-weight: 700;
  font-size: 18px;
  margin-bottom: 24px;
}

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

.nav a,
.nav button {
  display: block;
  width: 100%;
  border: 0;
  border-radius: 6px;
  padding: 10px 12px;
  background: transparent;
  color: #dbe4ee;
  text-align: left;
  text-decoration: none;
  font: inherit;
  cursor: pointer;
}

.nav a.active,
.nav a:hover,
.nav button:hover {
  background: #263447;
  color: #ffffff;
}

.main {
  padding: 24px;
}

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

h1 {
  margin: 0;
  font-size: 24px;
  line-height: 1.2;
}

h2 {
  margin: 0 0 12px;
  font-size: 16px;
}

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

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

.metric,
.panel,
.item {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.metric {
  padding: 14px;
}

.metric strong {
  display: block;
  font-size: 24px;
  margin-top: 6px;
}

.panel {
  padding: 16px;
  margin-bottom: 16px;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}

.filters,
.bulk-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 12px;
  align-items: end;
}

.bulk-grid {
  grid-template-columns: repeat(3, minmax(180px, 1fr));
}

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

.checkbox-label {
  display: flex;
  gap: 8px;
  align-items: center;
}

.checkbox-label input,
.table input[type="checkbox"] {
  width: auto;
}

.actions-cell {
  min-width: 180px;
}

.actions-cell form {
  margin-bottom: 6px;
}

.actions-cell details {
  margin-top: 8px;
}

.actions-cell summary {
  color: var(--accent-dark);
  cursor: pointer;
}

button,
.button {
  border: 1px solid var(--accent);
  border-radius: 6px;
  padding: 9px 12px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  text-decoration: none;
  cursor: pointer;
}

button.secondary,
.button.secondary {
  background: #fff;
  color: var(--accent-dark);
}

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

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 10px;
  font: inherit;
}

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

.table {
  width: 100%;
  border-collapse: collapse;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

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

.table th {
  color: var(--muted);
  font-weight: 600;
  background: #fbfcfd;
}

.badge {
  display: inline-block;
  border-radius: 999px;
  padding: 3px 8px;
  background: #e8eef7;
  color: #263447;
  font-size: 12px;
  white-space: nowrap;
}

.badge.high,
.badge.urgent,
.badge.critical {
  background: #fee2e2;
  color: var(--danger);
}

.badge.ok,
.badge.approved {
  background: #dcfce7;
  color: var(--ok);
}

.badge.warn,
.badge.pending {
  background: #fef3c7;
  color: var(--warn);
}

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

.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(420px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
}

.error {
  color: var(--danger);
  margin-bottom: 12px;
}

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

  .grid,
  .split,
  .filters,
  .bulk-grid {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

  .grid,
  .split {
    grid-template-columns: 1fr;
  }
}
