:root {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --text: #1a2533;
  --muted: #5f6f83;
  --line: #d9e1ec;
  --brand: #1869d1;
  --brand-soft: #e8f1ff;
  --danger: #b42318;
  --ok: #067647;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 "Segoe UI", Tahoma, Arial, sans-serif;
}

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

a:hover {
  text-decoration: underline;
}

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

.sidebar {
  background: #0d1b2a;
  color: #fff;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

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

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

.sidebar-nav a {
  color: #c8d3e2;
  padding: 10px 12px;
  border-radius: 8px;
  display: block;
}

.sidebar-nav a.active,
.sidebar-nav a:hover {
  color: #fff;
  background: #1b3150;
  text-decoration: none;
}

.logout-link {
  margin-top: auto;
  color: #c8d3e2;
}

.page-content {
  padding: 20px;
}

.page-header h1 {
  margin: 0 0 16px;
  font-size: 24px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
}

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

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

.metric p {
  margin: 8px 0 0;
  font-size: 28px;
  font-weight: 700;
}

.section-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.section-title-row h2 {
  margin: 0;
  font-size: 18px;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 12px;
}

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

input,
select,
textarea {
  border: 1px solid #c5d0df;
  border-radius: 8px;
  padding: 9px 10px;
  font: inherit;
  color: var(--text);
  background: #fff;
}

textarea {
  resize: vertical;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--brand);
  background: var(--brand);
  color: #fff;
  border-radius: 8px;
  padding: 9px 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}

.btn.secondary {
  background: #fff;
  color: var(--brand);
}

.btn:hover {
  text-decoration: none;
  opacity: 0.95;
}

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

.table-wrap {
  overflow-x: auto;
}

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

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

th {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.status-pill {
  display: inline-block;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 12px;
  border: 1px solid #b8c6d9;
  background: #f6f9fd;
  color: #224367;
}

.status-pill.low {
  background: #fff2f1;
  border-color: #ffd0cd;
  color: #b42318;
}

.status-pill.good {
  background: #ecfdf3;
  border-color: #abefc6;
  color: #067647;
}

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

.grid-form .full {
  grid-column: 1 / -1;
}

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

.meta-grid .item {
  background: #f9fbff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
}

.meta-grid .item .k {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.meta-grid .item .v {
  display: block;
  margin-top: 4px;
  font-weight: 600;
}

.feedback {
  margin-top: 12px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid #bfd4f6;
  background: var(--brand-soft);
  color: #104286;
}

.feedback.error {
  border-color: #ffd0cd;
  background: #fff2f1;
  color: var(--danger);
}

.activity-list {
  margin: 0;
  padding-left: 18px;
}

.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}

.auth-card {
  width: min(460px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 24px;
}

.auth-card h1 {
  margin: 0 0 8px;
}

.auth-card p {
  margin: 0 0 14px;
  color: var(--muted);
}

.auth-card form {
  display: grid;
  gap: 10px;
}

.helper-text {
  margin-top: 12px;
  font-size: 13px;
}

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

  .meta-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

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

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 5;
  }

  .grid-form {
    grid-template-columns: 1fr;
  }
}
