:root {
  --bg: #f4f7f6;
  --panel: #ffffff;
  --panel-soft: #eef5f2;
  --ink: #1d2b28;
  --muted: #64756f;
  --line: #d9e3df;
  --brand: #168a69;
  --brand-dark: #0f624d;
  --accent: #f2b84b;
  --danger: #c94f4f;
  --shadow: 0 18px 50px rgba(25, 50, 44, 0.12);
}

* {
  box-sizing: border-box;
}

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

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

button {
  border: 0;
  cursor: pointer;
}

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

.login-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 36px;
  background: var(--panel);
}

.login-card {
  width: min(100%, 380px);
}

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

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #fff;
  background: var(--brand);
}

.login-visual {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  padding: 56px;
  color: #fff;
  background:
    linear-gradient(120deg, rgba(18, 60, 52, 0.9), rgba(22, 138, 105, 0.52)),
    url("https://images.unsplash.com/photo-1581578731548-c64695cc6952?auto=format&fit=crop&w=1600&q=80") center/cover;
}

.login-visual h1 {
  max-width: 720px;
  margin: 0 0 14px;
  font-size: clamp(42px, 6vw, 78px);
  line-height: 0.96;
  letter-spacing: 0;
}

.login-visual p {
  max-width: 580px;
  margin: 0;
  font-size: 19px;
  line-height: 1.6;
}

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

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

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

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

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(22, 138, 105, 0.14);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  border-radius: 8px;
  padding: 0 15px;
  color: #fff;
  background: var(--brand);
  font-weight: 800;
}

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

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

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

.btn.icon {
  width: 38px;
  min-height: 38px;
  padding: 0;
}

.error {
  min-height: 22px;
  color: var(--danger);
  font-size: 14px;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px 18px;
  background: #16352e;
  color: #fff;
}

.sidebar .brand {
  margin-bottom: 28px;
  font-size: 21px;
}

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

.nav button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.78);
  background: transparent;
  text-align: left;
}

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

.content {
  padding: 28px;
}

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

.topbar h1 {
  margin: 0;
  font-size: 30px;
  letter-spacing: 0;
}

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

.stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.stat {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

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

.stat strong {
  display: block;
  margin-top: 10px;
  font-size: 28px;
}

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

.search {
  max-width: 420px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 14px;
}

.card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.card h3 {
  margin: 0 0 8px;
  font-size: 18px;
}

.meta {
  display: grid;
  gap: 7px;
  margin: 12px 0;
  color: var(--muted);
  font-size: 14px;
}

.tag {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  color: var(--brand-dark);
  background: #dff2ea;
  font-size: 12px;
  font-weight: 800;
}

.tag.warn {
  color: #8a5f0e;
  background: #fff0ca;
}

.tag.danger {
  color: #923838;
  background: #ffe2e2;
}

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

.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(11, 30, 26, 0.48);
  z-index: 10;
}

.modal-card {
  width: min(760px, 100%);
  max-height: min(760px, 92vh);
  overflow: auto;
  border-radius: 8px;
  padding: 22px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

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

.modal-head h2 {
  margin: 0;
  font-size: 22px;
}

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

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

.empty {
  padding: 42px 20px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.6);
  text-align: center;
}

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

  .login-visual {
    min-height: 42vh;
    order: -1;
    padding: 34px;
  }

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

  .stats {
    grid-template-columns: repeat(2, minmax(150px, 1fr));
  }
}

@media (max-width: 640px) {
  .content,
  .login-panel {
    padding: 18px;
  }

  .topbar,
  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }

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