:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --panel-soft: #eef5f1;
  --line: #dfe4e8;
  --line-strong: #c6d1d8;
  --text: #182026;
  --muted: #687581;
  --green: #12715b;
  --green-strong: #0b5b48;
  --blue: #2f5f98;
  --amber: #a45d10;
  --red: #a83232;
  --nav: #14251f;
  --nav-soft: #20382f;
  --shadow: 0 10px 28px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  letter-spacing: 0;
  background: var(--bg);
  color: var(--text);
}

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

button {
  border: 0;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
  background:
    linear-gradient(90deg, rgba(20, 37, 31, 0.94), rgba(20, 37, 31, 0.72)),
    url("/agent-bg.svg");
  background-size: cover;
  background-position: center;
}

.login-brand {
  padding: 48px;
  color: #f8fbf9;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 40px;
}

.login-brand h1 {
  margin: 0;
  font-size: 30px;
  line-height: 1.16;
  letter-spacing: 0;
}

.login-brand p {
  margin: 14px 0 0;
  color: rgba(248, 251, 249, 0.74);
  line-height: 1.75;
  max-width: 320px;
}

.login-form-wrap {
  display: grid;
  place-items: center;
  padding: 32px;
}

.login-form {
  width: min(100%, 388px);
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow: var(--shadow);
  padding: 28px;
  border-radius: 8px;
}

.login-form h2 {
  margin: 0 0 6px;
  font-size: 22px;
}

.login-form .muted {
  margin-bottom: 24px;
}

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

.sidebar {
  min-height: 100vh;
  background: var(--nav);
  color: #eef8f4;
  display: flex;
  flex-direction: column;
  padding: 22px 16px;
  position: sticky;
  top: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 8px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.11);
}

.mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  color: #10231d;
  background: #dff4e9;
  border-radius: 7px;
  font-weight: 800;
}

.brand-name {
  font-weight: 760;
  font-size: 15px;
}

.brand-sub {
  font-size: 12px;
  color: rgba(238, 248, 244, 0.62);
  margin-top: 2px;
}

.nav {
  display: grid;
  gap: 6px;
  padding: 20px 0;
}

.nav button {
  width: 100%;
  background: transparent;
  color: rgba(238, 248, 244, 0.72);
  text-align: left;
  padding: 11px 12px;
  border-radius: 7px;
  cursor: pointer;
}

.nav button:hover,
.nav button.active {
  background: var(--nav-soft);
  color: #ffffff;
}

.sidebar-foot {
  margin-top: auto;
  display: grid;
  gap: 10px;
  padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.11);
}

.content {
  min-width: 0;
  padding: 24px 28px 40px;
}

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

.topbar h1 {
  margin: 0;
  font-size: 24px;
  line-height: 1.2;
}

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

.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

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

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

.metric {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  min-height: 104px;
}

.metric-label {
  color: var(--muted);
  font-size: 12px;
}

.metric-value {
  margin-top: 12px;
  font-size: 26px;
  font-weight: 780;
}

.metric-detail {
  color: var(--muted);
  margin-top: 8px;
  font-size: 12px;
}

.surface {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.02);
}

.surface-header {
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid var(--line);
}

.surface-header h2 {
  margin: 0;
  font-size: 16px;
}

.surface-body {
  padding: 18px;
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 16px;
  align-items: start;
}

.form-grid {
  display: grid;
  gap: 12px;
}

.field {
  display: grid;
  gap: 7px;
}

.field label {
  color: var(--muted);
  font-size: 12px;
}

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

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(18, 113, 91, 0.12);
}

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

.row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.check-row {
  display: flex;
  gap: 8px;
  align-items: center;
  color: var(--text);
}

.check-row input {
  width: 16px;
  height: 16px;
}

.btn {
  min-height: 36px;
  padding: 8px 12px;
  border-radius: 7px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  color: var(--text);
  background: #e9eef2;
}

.btn:hover {
  filter: brightness(0.98);
}

.btn.primary {
  color: white;
  background: var(--green);
}

.btn.primary:hover {
  background: var(--green-strong);
}

.btn.subtle {
  background: transparent;
  color: var(--muted);
}

.btn.warn {
  background: #fff2df;
  color: var(--amber);
}

.btn.block {
  width: 100%;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

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

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

th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  background: #fafbfc;
}

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

.name-cell {
  display: grid;
  gap: 3px;
}

.name-cell strong {
  font-size: 14px;
}

.mono {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 12px;
}

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

.tag {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 12px;
  background: #edf1f5;
  color: #4c5964;
  white-space: nowrap;
}

.tag.green {
  background: #e0f3eb;
  color: var(--green);
}

.tag.blue {
  background: #e5eef8;
  color: var(--blue);
}

.tag.amber {
  background: #fff2df;
  color: var(--amber);
}

.tag.red {
  background: #ffe9e9;
  color: var(--red);
}

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

.notice {
  border: 1px solid #c7dfd4;
  background: var(--panel-soft);
  color: #255145;
  padding: 12px 14px;
  border-radius: 8px;
  line-height: 1.65;
}

.danger-note {
  border-color: #fad5d5;
  background: #fff0f0;
  color: #7d2828;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  max-width: 360px;
  padding: 12px 14px;
  border-radius: 8px;
  background: #14251f;
  color: #fff;
  box-shadow: var(--shadow);
  z-index: 20;
}

.hidden {
  display: none !important;
}

@media (max-width: 1100px) {
  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

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

  .login-brand {
    padding: 28px 24px;
  }

  .login-form-wrap {
    padding: 24px;
    align-items: start;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

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

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

  .content {
    padding: 20px 16px 32px;
  }

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

  .actions {
    justify-content: flex-start;
  }

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