:root {
  color-scheme: light;
  --green: #0f8b4c;
  --green-dark: #075f37;
  --green-ink: #083d27;
  --ink: #17231d;
  --muted: #65766e;
  --subtle: #8a9992;
  --line: #d8e4de;
  --line-strong: #c8d8d1;
  --soft: #f1f7f4;
  --surface: #ffffff;
  --surface-muted: #f8fbf9;
  --danger: #a32424;
  --shadow: 0 18px 50px rgba(23, 35, 29, 0.08);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(15, 139, 76, 0.06), transparent 260px),
    #f6faf8;
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

body.modal-open {
  overflow: hidden;
}

.admin-shell {
  width: min(100% - 40px, 1180px);
  margin: 0 auto;
  padding: 28px 0 42px;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbf9;
  padding: 16px 18px;
  box-shadow: 0 12px 30px rgba(23, 35, 29, 0.06);
}

.brand-group,
.header-actions,
.session-bar {
  display: flex;
  align-items: center;
  gap: 14px;
}

.admin-logo {
  display: block;
  width: 176px;
  height: auto;
  border-radius: 6px;
  box-shadow: none;
}

.title-group {
  display: grid;
  gap: 5px;
}

.kicker {
  color: var(--green-dark);
  font-size: 0.74rem;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  color: var(--ink);
  letter-spacing: 0;
}

h1 {
  font-size: clamp(1.55rem, 3vw, 2.35rem);
  line-height: 1.05;
}

.app-header h1 {
  color: var(--green-dark);
}

h2 {
  font-size: 1.45rem;
  line-height: 1.15;
}

button,
input,
select {
  border-radius: 8px;
  font: inherit;
}

button {
  min-height: 42px;
  border: 0;
  padding: 0 16px;
  background: var(--green);
  color: #fff;
  cursor: pointer;
  font-weight: 800;
}

button:hover {
  background: var(--green-dark);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.7;
}

.icon-button,
.secondary-button {
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--green-dark);
}

.app-header .icon-button {
  border-color: var(--line-strong);
  background: var(--surface);
  color: var(--green-dark);
}

.icon-button:hover,
.secondary-button:hover {
  border-color: var(--green);
  background: var(--soft);
}

.app-header .icon-button:hover {
  border-color: var(--green);
  background: var(--soft);
}

.auth-panel {
  display: grid;
  gap: 14px;
  place-items: start center;
  margin-bottom: 14px;
  padding-top: clamp(24px, 6vh, 58px);
}

.login-card {
  width: min(100%, 430px);
  display: grid;
  gap: 18px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.login-heading {
  display: grid;
  gap: 7px;
  padding-bottom: 4px;
}

label {
  display: grid;
  gap: 8px;
  color: var(--green-ink);
  font-size: 0.92rem;
  font-weight: 800;
}

input,
select {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line-strong);
  background: var(--surface-muted);
  padding: 0 13px;
  color: var(--ink);
  font-weight: 650;
}

input::placeholder {
  color: var(--subtle);
}

input:focus,
select:focus {
  border-color: var(--green);
  outline: 3px solid rgba(15, 139, 76, 0.16);
  background: var(--surface);
}

.login-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: -2px;
}

.checkbox-label {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 750;
  cursor: pointer;
}

.checkbox-label input {
  width: 16px;
  height: 16px;
  min-height: 16px;
  margin: 0;
  accent-color: var(--green);
  cursor: pointer;
}

.forgot-link,
.text-button {
  min-height: auto;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--green-dark);
  font-size: 0.88rem;
  font-weight: 850;
  text-decoration: none;
}

.forgot-link:hover,
.text-button:hover {
  background: transparent;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.login-card button[type="submit"],
.recovery-card button[type="submit"] {
  margin-top: 2px;
  min-height: 48px;
}

.text-button {
  justify-self: start;
  margin-top: 2px;
  color: var(--green);
  font-size: 0.95rem;
}

.session-bar {
  justify-content: space-between;
  margin-bottom: 16px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 750;
}

.status-dot {
  width: 8px;
  height: 8px;
  display: inline-block;
  margin-right: 8px;
  border-radius: 999px;
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(15, 139, 76, 0.12);
}

.message {
  min-height: 22px;
  margin: 0;
  color: var(--muted);
  font-size: 0.94rem;
  font-weight: 750;
}

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

.message.error {
  color: var(--danger);
}

.dashboard-message {
  margin-bottom: 14px;
}

.dashboard-tabs {
  display: inline-flex;
  gap: 4px;
  margin: 18px 0 2px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 4px;
  background: var(--surface);
}

.tab-button {
  min-height: 36px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 850;
}

.tab-button:hover,
.tab-button.active {
  background: var(--soft);
  color: var(--green-dark);
}

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

.metric-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 18px;
  box-shadow: 0 10px 30px rgba(23, 35, 29, 0.04);
}

.metric-card span {
  display: block;
  color: var(--muted);
  font-size: 0.83rem;
  font-weight: 800;
}

.metric-card strong {
  display: block;
  margin-top: 10px;
  color: var(--green-dark);
  font-size: 2rem;
  line-height: 1;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 12px 34px rgba(23, 35, 29, 0.05);
}

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

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

th {
  background: var(--surface-muted);
  color: var(--green-ink);
  font-size: 0.76rem;
  font-weight: 850;
  text-transform: uppercase;
}

td {
  color: var(--ink);
  font-size: 0.92rem;
  line-height: 1.45;
}

.primary-cell {
  display: block;
  color: var(--ink);
  font-size: 0.98rem;
  font-weight: 850;
  line-height: 1.25;
}

.subtext {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
  max-width: 460px;
}

.score-badge {
  min-width: 54px;
  display: inline-flex;
  justify-content: center;
  border-radius: 999px;
  padding: 4px 10px;
  background: var(--soft);
  color: var(--green-dark);
  font-size: 0.82rem;
  font-weight: 850;
}

tbody tr:hover td {
  background: #fbfdfc;
}

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

.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border-top: 1px solid var(--line);
  background: var(--surface-muted);
}

.pagination-bar p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 800;
}

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

.pagination-actions .secondary-button {
  min-height: 36px;
  padding: 0 13px;
}

.row-action-button,
.options-button {
  min-height: 38px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  font-weight: 850;
}

.row-action-button:hover,
.options-button:hover {
  border-color: var(--green);
  background: var(--green);
  color: #fff;
}

.modal-backdrop {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(8, 23, 16, 0.46);
}

.feedback-modal {
  width: min(100%, 820px);
  max-height: min(760px, calc(100vh - 48px));
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 24px;
  box-shadow: 0 28px 80px rgba(8, 23, 16, 0.24);
}

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

.detail-grid {
  display: grid;
  gap: 0;
}

.detail-row {
  display: grid;
  grid-template-columns: minmax(160px, 240px) minmax(0, 1fr);
  gap: 20px;
  padding: 13px 0;
  border-top: 1px solid var(--line);
}

.detail-row dt {
  color: var(--muted);
  font-weight: 850;
}

.detail-row dd {
  min-width: 0;
  margin: 0;
  color: var(--ink);
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.settings-panel {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.settings-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 20px;
  box-shadow: 0 12px 34px rgba(23, 35, 29, 0.05);
}

.settings-heading {
  display: grid;
  gap: 6px;
  margin-bottom: 18px;
}

.settings-form {
  display: grid;
  gap: 14px;
  max-width: 520px;
}

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

.admin-form-grid button {
  justify-self: start;
}

.inline-settings-form {
  grid-template-columns: minmax(0, 420px) auto;
  align-items: end;
  max-width: none;
}

.admin-users-wrap {
  overflow: visible;
  box-shadow: none;
}

.admin-users-wrap table {
  min-width: 860px;
}

.options-menu {
  position: relative;
  display: inline-block;
}

.options-popover {
  position: absolute;
  z-index: 20;
  top: calc(100% + 10px);
  right: 0;
  width: 224px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 8px;
  box-shadow: 0 18px 40px rgba(23, 35, 29, 0.14);
}

.menu-item {
  width: 100%;
  min-height: 42px;
  justify-content: flex-start;
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.menu-item:hover {
  background: var(--soft);
  color: var(--green-dark);
}

.menu-item:disabled {
  cursor: not-allowed;
  background: transparent;
  color: var(--subtle);
  opacity: 1;
}

.admin-action-panel {
  display: grid;
  gap: 14px;
  max-width: 540px;
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-muted);
  padding: 18px;
}

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

.role-badge,
.status-badge {
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.78rem;
  font-weight: 850;
}

.role-badge {
  background: var(--soft);
  color: var(--green-dark);
}

.status-badge {
  background: #eef1ef;
  color: var(--muted);
}

.status-badge.active {
  background: rgba(15, 139, 76, 0.12);
  color: var(--green-dark);
}

@media (max-width: 760px) {
  .admin-shell {
    width: min(100% - 28px, 1180px);
    padding-top: 18px;
  }

  .app-header,
  .brand-group,
  .header-actions,
  .session-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .brand-group {
    gap: 12px;
  }

  .admin-logo {
    width: 152px;
  }

  .icon-button {
    justify-content: center;
    width: 100%;
  }

  .auth-panel {
    padding-top: 20px;
  }

  .login-card {
    padding: 22px;
  }

  .login-options {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

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

  .pagination-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .pagination-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .admin-form-grid,
  .inline-settings-form,
  .detail-row {
    grid-template-columns: 1fr;
  }

  .admin-users-wrap {
    overflow-x: auto;
  }

  .detail-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .modal-backdrop {
    align-items: end;
    padding: 14px;
  }

  .feedback-modal {
    max-height: calc(100vh - 28px);
    padding: 20px;
  }
}
