:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-soft: #eef7f5;
  --text: #202124;
  --muted: #6b7280;
  --line: #d9dee6;
  --primary: #0f766e;
  --primary-dark: #115e59;
  --danger: #b42318;
  --danger-soft: #fee4e2;
  --warning: #a15c07;
  --warning-soft: #fff4d6;
  --success: #067647;
  --success-soft: #dcfae6;
  --info: #175cd3;
  --info-soft: #e0edff;
  --radius: 8px;
  --shadow: 0 10px 30px rgba(17, 24, 39, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  font-size: 15px;
  letter-spacing: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
  letter-spacing: 0;
}

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

.sidebar {
  background: #202124;
  color: #ffffff;
  padding: 22px;
}

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

.brand__mark {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: var(--radius);
  background: var(--primary);
  color: #ffffff;
  font-weight: 800;
}

.brand small,
.eyebrow {
  display: block;
  margin-top: 3px;
  color: #aeb5bf;
  font-size: 13px;
}

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

.nav a {
  padding: 11px 12px;
  border-radius: var(--radius);
  color: #e5e7eb;
}

.nav a:hover,
.nav a.active {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

.main {
  min-width: 0;
  padding: 28px;
}

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

.topbar h1 {
  margin: 4px 0 0;
  font-size: 28px;
  line-height: 1.15;
}

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

.topbar__actions,
.actions,
.form-actions,
.filters__actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.role {
  color: var(--muted);
  font-size: 14px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid var(--primary);
  border-radius: var(--radius);
  background: var(--primary);
  color: #ffffff;
  cursor: pointer;
  font-weight: 700;
  white-space: nowrap;
}

.button:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.button--ghost {
  background: #ffffff;
  color: var(--text);
  border-color: var(--line);
}

.button--ghost:hover {
  background: #eef1f4;
  border-color: #c9ced8;
}

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

.button--danger:hover {
  background: #911b13;
  border-color: #911b13;
}

.button--small {
  min-height: 34px;
  padding: 0 11px;
  font-size: 13px;
}

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

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

.metric {
  padding: 18px;
}

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

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 31px;
}

.grid {
  display: grid;
  gap: 18px;
}

.grid--two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 18px;
}

.panel {
  padding: 20px;
}

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

.section-head h2 {
  margin: 0;
  font-size: 20px;
}

.text-link,
.table-link,
.task-item a {
  color: var(--primary-dark);
  font-weight: 700;
}

.text-link:hover,
.table-link:hover,
.task-item a:hover {
  text-decoration: underline;
}

.alert {
  padding: 13px;
  border-radius: var(--radius);
  margin-bottom: 12px;
  border: 1px solid transparent;
}

.alert ul {
  margin: 8px 0 0;
  padding-left: 20px;
}

.alert--danger {
  background: var(--danger-soft);
  border-color: #fecdca;
  color: #7a271a;
}

.alert--warning {
  background: var(--warning-soft);
  border-color: #fedf89;
  color: #713b12;
}

.task-list,
.user-list {
  display: grid;
  gap: 10px;
}

.task-item,
.user-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
}

.task-item p,
.user-item span {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.user-item__meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.empty {
  padding: 18px;
  border: 1px dashed #c7ced8;
  border-radius: var(--radius);
  color: var(--muted);
  text-align: center;
  background: #fbfcfd;
}

.filters {
  display: grid;
  grid-template-columns: 1.4fr repeat(3, 1fr) auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 16px;
}

.form {
  display: grid;
  gap: 14px;
}

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

.span-2 {
  grid-column: span 2;
}

label {
  display: grid;
  gap: 7px;
  color: #34373d;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #cbd3df;
  border-radius: var(--radius);
  background: #ffffff;
  color: var(--text);
  min-height: 42px;
  padding: 9px 11px;
  outline: none;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.16);
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

table {
  width: 100%;
  min-width: 920px;
  border-collapse: collapse;
  background: #ffffff;
}

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

th {
  background: #eef1f4;
  color: #4b5563;
  font-size: 13px;
}

tr:last-child td {
  border-bottom: 0;
}

.row--danger {
  background: #fff6f5;
}

.row--warning {
  background: #fffaf0;
}

.table-actions {
  display: flex;
  gap: 8px;
}

.inline-select {
  min-width: 130px;
  min-height: 34px;
  padding: 5px 8px;
}

.tag,
.mini-alert {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: var(--radius);
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

.tag--muted {
  background: #eef1f4;
  color: #4b5563;
}

.tag--info {
  background: var(--info-soft);
  color: var(--info);
}

.tag--success {
  background: var(--success-soft);
  color: var(--success);
}

.tag--warning {
  background: var(--warning-soft);
  color: var(--warning);
}

.tag--danger,
.mini-alert {
  background: var(--danger-soft);
  color: var(--danger);
}

.mini-alert {
  margin-left: 8px;
}

.mini-alert--soon {
  background: var(--warning-soft);
  color: var(--warning);
}

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

.detail-grid div {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 13px;
}

.detail-grid span {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 13px;
}

.description {
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.description h3 {
  margin: 0 0 8px;
}

.description p {
  margin: 0;
  color: #3f4650;
  line-height: 1.6;
}

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

.login-panel {
  width: min(100%, 430px);
  padding: 28px;
}

.login-panel h1 {
  margin: 16px 0 8px;
}

.login-panel p {
  margin: 0 0 18px;
  color: var(--muted);
  line-height: 1.5;
}

.hint {
  margin-top: 14px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 20;
  max-width: min(420px, calc(100vw - 36px));
  padding: 13px 15px;
  border-radius: var(--radius);
  background: #202124;
  color: #ffffff;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast--visible {
  opacity: 1;
  transform: translateY(0);
}

.toast--danger {
  background: var(--danger);
}

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

  .sidebar {
    position: static;
    padding: 14px;
  }

  .brand {
    margin-bottom: 14px;
  }

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

  .nav a {
    text-align: center;
  }

  .main {
    padding: 18px;
  }

  .metrics,
  .grid--two,
  .filters,
  .detail-grid {
    grid-template-columns: 1fr;
  }

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

  .span-2 {
    grid-column: span 1;
  }
}

@media (max-width: 640px) {
  body {
    font-size: 14px;
  }

  .topbar,
  .section-head,
  .task-item,
  .user-item {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar__actions,
  .user-item__meta {
    justify-content: flex-start;
  }

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

  .button {
    width: 100%;
  }

  .table-actions .button,
  .topbar__actions .button,
  .section-head .button,
  .actions .button,
  .filters__actions .button,
  .user-item__meta .button {
    width: auto;
  }

  .panel,
  .login-panel {
    padding: 16px;
  }
}
