:root {
  color-scheme: light;
  --bg: #f5f7fa;
  --panel: #ffffff;
  --panel-soft: #f9fafb;
  --line: #d7dde6;
  --line-strong: #bac4d1;
  --text: #17202b;
  --muted: #5d6978;
  --accent: #0f6b53;
  --accent-dark: #0a513f;
  --danger: #a43d31;
  --warning: #916515;
  --sidebar: #1d2936;
  --sidebar-link: #eef4f8;
  --focus: #2d7ff9;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.45;
}

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

a:hover {
  text-decoration: underline;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--focus) 30%, transparent);
  outline-offset: 2px;
}

.login-body {
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(15, 107, 83, 0.08), transparent 38%),
    linear-gradient(315deg, rgba(23, 32, 43, 0.08), transparent 34%),
    var(--bg);
}

.login-shell {
  align-items: center;
  display: flex;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}

.login-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 24px 70px rgba(23, 32, 43, 0.12);
  max-width: 420px;
  padding: 28px;
  width: 100%;
}

.login-panel h1 {
  margin-top: 28px;
}

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

.sidebar {
  background: var(--sidebar);
  color: var(--sidebar-link);
  height: 100vh;
  padding: 18px 14px;
  position: sticky;
  top: 0;
}

.brand-block {
  align-items: center;
  display: flex;
  gap: 10px;
}

.brand-mark {
  align-items: center;
  background: var(--accent);
  border-radius: 8px;
  color: #fff;
  display: inline-flex;
  font-weight: 800;
  height: 38px;
  justify-content: center;
  width: 38px;
}

.brand,
.brand-subtitle,
.eyebrow {
  margin: 0;
}

.brand {
  font-weight: 800;
}

.brand-subtitle,
.eyebrow,
.identity,
.muted {
  color: var(--muted);
}

.sidebar .brand-subtitle {
  color: #aeb9c6;
  font-size: 13px;
}

.nav {
  display: grid;
  gap: 4px;
  margin-top: 24px;
}

.nav a {
  border-radius: 6px;
  color: var(--sidebar-link);
  display: block;
  padding: 10px;
}

.nav a:hover {
  background: rgba(255, 255, 255, 0.1);
  text-decoration: none;
}

.content {
  min-width: 0;
}

.topbar {
  align-items: center;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 16px;
  justify-content: space-between;
  min-height: 72px;
  padding: 14px 24px;
}

.eyebrow {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.identity {
  font-size: 14px;
}

main {
  max-width: 1280px;
  padding: 24px;
}

h1 {
  font-size: 28px;
  letter-spacing: 0;
  line-height: 1.15;
  margin: 0 0 20px;
}

h2 {
  font-size: 18px;
  letter-spacing: 0;
  margin: 0;
}

.grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

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

.form-panel {
  max-width: 820px;
}

.metric {
  font-size: 30px;
  font-weight: 800;
  margin-top: 4px;
}

.section-header,
.toolbar,
.actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.section-header,
.toolbar {
  justify-content: space-between;
  margin-bottom: 14px;
}

.actions.compact {
  gap: 6px;
}

.button,
button {
  appearance: none;
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 6px;
  color: #fff;
  cursor: pointer;
  display: inline-block;
  font: inherit;
  font-weight: 700;
  padding: 8px 12px;
}

.button:hover,
button:hover {
  background: var(--accent-dark);
  text-decoration: none;
}

.button.secondary,
button.secondary {
  background: #fff;
  color: var(--accent);
}

.button.secondary:hover,
button.secondary:hover {
  background: #f0f5f3;
}

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

.full-width {
  text-align: center;
  width: 100%;
}

.divider {
  color: var(--muted);
  margin: 16px 0;
  text-align: center;
}

label {
  display: block;
  font-weight: 700;
  margin: 12px 0 5px;
}

input,
select,
textarea {
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  color: var(--text);
  font: inherit;
  min-height: 40px;
  padding: 9px;
  width: 100%;
}

textarea {
  min-height: 110px;
  resize: vertical;
}

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

.inline-form {
  align-items: end;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.inline-form label,
.inline-form select,
.inline-form input {
  width: auto;
}

.role-form select,
.role-form input {
  min-width: 180px;
}

.alert,
.form-error {
  color: var(--danger);
}

.alert {
  background: #fff5f3;
  border: 1px solid #efc8c1;
  border-radius: 6px;
  padding: 10px 12px;
}

table {
  background: var(--panel);
  border: 1px solid var(--line);
  border-collapse: collapse;
  border-radius: 8px;
  overflow: hidden;
  width: 100%;
}

th,
td {
  border-bottom: 1px solid var(--line);
  overflow-wrap: anywhere;
  padding: 11px;
  text-align: left;
  vertical-align: top;
}

th {
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

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

dl {
  display: grid;
  gap: 8px 14px;
  grid-template-columns: minmax(140px, 220px) minmax(0, 1fr);
}

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

dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.badge,
.status-pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  display: inline-block;
  font-size: 13px;
  line-height: 1.3;
  padding: 3px 8px;
}

.badge {
  background: #fff;
  color: var(--muted);
  white-space: nowrap;
}

.status-pill {
  background: #eef8f4;
  color: var(--accent-dark);
  font-weight: 700;
  min-width: 74px;
  text-align: center;
  white-space: nowrap;
}

.status-disabled,
.status-locked,
.status-blocked {
  background: #fff3ef;
  color: var(--danger);
}

.status-pending,
.status-review {
  background: #fff8e8;
  color: var(--warning);
}

.status-ready {
  background: #eef8f4;
  color: var(--accent-dark);
}

.empty-state {
  background: var(--panel);
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  color: var(--muted);
  padding: 18px;
}

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

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

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

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  main {
    padding: 16px;
  }

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

  .responsive-table,
  .responsive-table thead,
  .responsive-table tbody,
  .responsive-table tr,
  .responsive-table th,
  .responsive-table td {
    display: block;
  }

  .responsive-table thead {
    display: none;
  }

  .responsive-table tr {
    border-bottom: 1px solid var(--line);
    padding: 10px;
  }

  .responsive-table td {
    border-bottom: 0;
    display: grid;
    gap: 8px;
    grid-template-columns: minmax(110px, 40%) minmax(0, 1fr);
    padding: 7px 0;
  }

  .responsive-table td::before {
    color: var(--muted);
    content: attr(data-label);
    font-weight: 750;
  }
}
