:root {
  color-scheme: light;
  --bg: #f5f7f8;
  --panel: #ffffff;
  --panel-soft: #eef3f2;
  --text: #1c2424;
  --muted: #667372;
  --line: #dbe3e1;
  --accent: #0f766e;
  --accent-dark: #115e59;
  --danger: #b42318;
  --warning: #b45309;
  --ok: #16803c;
  --shadow: 0 12px 30px rgba(28, 36, 36, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
  color: inherit;
}

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

button {
  border: 0;
  cursor: pointer;
}

.auth-body {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 28px;
  background:
    linear-gradient(rgba(245, 247, 248, 0.9), rgba(245, 247, 248, 0.9)),
    url("https://images.unsplash.com/photo-1497366754035-f200968a6e72?auto=format&fit=crop&w=1800&q=80") center / cover;
}

.auth-card {
  width: min(440px, 100%);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: var(--shadow);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 24px;
  font-size: 18px;
  font-weight: 800;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  font-weight: 900;
}

h1,
h2,
h3 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 28px;
  line-height: 1.15;
}

h2 {
  font-size: 20px;
}

h3 {
  font-size: 16px;
}

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

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

.field {
  display: grid;
  gap: 7px;
  margin-bottom: 14px;
}

.field label {
  color: #354241;
  font-size: 13px;
  font-weight: 700;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--text);
  padding: 11px 12px;
  outline: none;
}

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

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

.btn {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 7px;
  padding: 9px 13px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
}

.btn:hover {
  background: var(--accent-dark);
}

.btn.secondary {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
}

.btn.secondary:hover {
  background: var(--panel-soft);
}

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

.btn.full {
  width: 100%;
}

.switch-link {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}

.switch-link a {
  color: var(--accent-dark);
  font-weight: 800;
  text-decoration: none;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  border-right: 1px solid var(--line);
  background: #fff;
  padding: 22px 16px;
}

.nav {
  display: grid;
  gap: 6px;
  margin-top: 22px;
}

.nav a,
.nav button {
  display: flex;
  min-height: 40px;
  align-items: center;
  gap: 10px;
  border-radius: 7px;
  padding: 9px 10px;
  background: transparent;
  color: #30403f;
  font-weight: 750;
  text-align: left;
  text-decoration: none;
}

.nav a.active,
.nav a:hover,
.nav button:hover {
  background: var(--panel-soft);
  color: var(--accent-dark);
}

.user-block {
  margin-top: 24px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfc;
}

.user-block strong,
.user-block span {
  display: block;
  overflow-wrap: anywhere;
}

.user-block span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.main {
  padding: 28px;
}

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

.topbar p {
  margin: 7px 0 0;
}

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

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

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

.card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 8px 20px rgba(28, 36, 36, 0.04);
}

.stat {
  padding: 18px;
}

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

.stat strong {
  display: block;
  margin-top: 8px;
  font-size: 30px;
}

.panel {
  padding: 18px;
}

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

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

table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
}

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

th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

td {
  font-size: 14px;
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 9px;
  background: var(--panel-soft);
  color: #344240;
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
}

.badge.High,
.badge.Critical,
.badge.danger {
  background: #fee4e2;
  color: var(--danger);
}

.badge.Medium,
.badge.warning,
.badge.Pending,
.badge.In {
  background: #fef3c7;
  color: var(--warning);
}

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

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

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

.inline-form .wide {
  grid-column: span 2;
}

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

.inline-form > .btn {
  align-self: end;
  justify-self: start;
  min-width: 84px;
}

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

.admin-form .field {
  margin-bottom: 0;
}

.admin-form .wide,
.admin-form .full-row {
  grid-column: 1 / -1;
}

.admin-form > .btn {
  grid-column: 1 / -1;
}

.alert {
  display: none;
  margin: 0 0 16px;
  border-radius: 8px;
  padding: 11px 12px;
  background: #ecfdf3;
  color: #14532d;
  font-weight: 750;
}

.alert.error {
  background: #fee4e2;
  color: var(--danger);
}

.empty {
  padding: 24px;
  color: var(--muted);
  text-align: center;
}

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

  .sidebar {
    position: static;
    height: auto;
    padding: 16px;
  }

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

  .main {
    padding: 18px;
  }

  .grid.cols-4,
  .grid.cols-2,
  .inline-form {
    grid-template-columns: 1fr;
  }

  .inline-form .wide,
  .inline-form .full-row,
  .admin-form .wide,
  .admin-form .full-row,
  .admin-form > .btn {
    grid-column: auto;
  }

  .topbar {
    display: grid;
  }
}
