:root {
  color-scheme: light;
  --bg: #f4faf7;
  --surface: #ffffff;
  --surface-soft: #f8fcfa;
  --ink: #343341;
  --muted: #6c6b78;
  --line: #dbe8e3;
  --accent: #1fc99b;
  --accent-strong: #12aa82;
  --accent-soft: #def8ef;
  --ok: #1aa87f;
  --warn: #a9651d;
  --bad: #bf4050;
  --job: #5862b9;
  --shadow: 0 14px 38px rgba(52, 51, 65, 0.08);
}

* {
  box-sizing: border-box;
}

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

[hidden] {
  display: none !important;
}

button,
input,
select {
  font: inherit;
}

a {
  color: var(--accent);
}

.login-view {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(31, 201, 155, 0.18), rgba(52, 51, 65, 0.08)),
    var(--bg);
}

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

.login-logo {
  width: min(260px, 100%);
}

.eyebrow.dark {
  color: var(--accent-strong);
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 28px clamp(18px, 4vw, 48px);
  border-bottom: 4px solid var(--accent);
  background: var(--ink);
  color: #ffffff;
}

.brand-area {
  display: flex;
  align-items: center;
  gap: 18px;
  min-width: 0;
}

.brand-logo-frame {
  display: flex;
  align-items: center;
  width: clamp(178px, 22vw, 278px);
  min-height: 64px;
  padding: 10px 14px;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.16);
}

.brand-logo {
  display: block;
  width: 100%;
  height: auto;
}

.brand-copy {
  min-width: 0;
}

.eyebrow {
  margin: 0 0 4px;
  color: #b9fff0;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(30px, 4vw, 42px);
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 20px;
}

h3 {
  margin-bottom: 4px;
  font-size: 18px;
}

.header-actions,
.site-actions,
.dialog-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.current-user {
  align-self: center;
  color: #d8fff5;
  font-size: 14px;
  font-weight: 750;
}

.button,
.text-button,
.icon-button {
  border: 0;
  cursor: pointer;
}

.button {
  min-height: 40px;
  padding: 10px 14px;
  border-radius: 8px;
  font-weight: 750;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.button:not(:disabled):hover {
  transform: translateY(-1px);
}

.primary {
  background: var(--accent);
  color: #172f2b;
  box-shadow: 0 8px 22px rgba(31, 201, 155, 0.25);
}

.primary:hover {
  background: var(--accent-strong);
  color: #ffffff;
}

.secondary {
  background: #eff6f3;
  color: var(--ink);
}

.danger {
  background: #f6dee2;
  color: #87313c;
}

.ghost {
  background: transparent;
  color: var(--muted);
  box-shadow: inset 0 0 0 1px var(--line);
}

.text-button {
  background: transparent;
  color: var(--accent);
  font-weight: 750;
}

.icon-button {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #eef7f3;
  color: var(--ink);
  font-size: 24px;
  line-height: 1;
}

.layout {
  width: min(1480px, 100%);
  margin: 0 auto;
  padding: 24px clamp(16px, 4vw, 48px) 48px;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

.metric {
  min-height: 108px;
  padding: 18px;
  border: 1px solid var(--line);
  border-top: 4px solid transparent;
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.metric-label {
  display: block;
  color: var(--muted);
  font-weight: 700;
}

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 38px;
  line-height: 1;
}

.metric:first-child {
  border-top-color: var(--accent);
}

.metric.critical strong {
  color: var(--bad);
}

.metric.recommended strong {
  color: var(--warn);
}

.metric.jobs strong {
  color: var(--job);
}

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

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

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

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

.site-list,
.job-list,
.user-list {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.site-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.site-title-row,
.job-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.site-name,
.job-name {
  overflow-wrap: anywhere;
}

.site-url {
  display: inline-block;
  max-width: 100%;
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 14px;
  text-decoration: none;
}

.status-pill,
.job-status {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.status-good,
.job-completed {
  background: var(--accent-soft);
  color: #0d7358;
}

.status-recommended {
  background: #f6e8d2;
  color: #7d4a12;
}

.status-critical,
.job-failed {
  background: #f6dce1;
  color: #8d2f3c;
}

.status-unknown,
.job-queued,
.job-running {
  background: #e5e7fa;
  color: #464f9b;
}

.version-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.version-grid div {
  min-height: 74px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.version-grid span,
.site-meta span,
.job-time {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.version-grid strong {
  display: block;
  margin-top: 5px;
  overflow-wrap: anywhere;
  font-size: 16px;
}

.issue-list {
  display: grid;
  gap: 6px;
  margin-top: 12px;
}

.issue {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  font-size: 14px;
}

.issue strong {
  color: var(--ink);
}

.site-side {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
}

.site-meta {
  display: grid;
  gap: 6px;
}

.site-actions {
  justify-content: flex-end;
}

.site-actions .button {
  width: 100%;
}

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

.job-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.user-manager {
  display: grid;
  gap: 14px;
  padding: 20px;
}

.user-list {
  max-height: 340px;
  padding: 0;
  overflow: auto;
}

.user-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.user-card h3 {
  margin-bottom: 2px;
}

.user-role,
.user-state {
  color: var(--muted);
  font-size: 13px;
}

.user-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.compact-form {
  padding: 14px 0 0;
  border-top: 1px solid var(--line);
}

.job-log {
  display: grid;
  gap: 8px;
  max-height: 360px;
  margin: 12px 0 0;
  padding-left: 20px;
  overflow: auto;
  color: var(--muted);
  font-size: 14px;
}

.job-log li::marker {
  color: var(--job);
}

.dialog {
  width: min(620px, calc(100vw - 28px));
  padding: 0;
  border: 0;
  border-radius: 8px;
  box-shadow: 0 24px 80px rgba(38, 35, 31, 0.28);
}

.dialog::backdrop {
  background: rgba(38, 35, 31, 0.42);
}

.site-form {
  display: grid;
  gap: 14px;
  padding: 20px;
}

.dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 750;
}

input,
select {
  width: 100%;
  min-height: 42px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}

input:focus,
select:focus {
  border-color: var(--accent);
  outline: 3px solid rgba(31, 201, 155, 0.2);
}

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

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

.toggle-row input {
  width: 18px;
  min-height: 18px;
}

.form-error {
  margin: 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: #f4d8dc;
  color: #8f2e36;
  font-weight: 750;
}

.loading {
  opacity: 0.62;
  pointer-events: none;
}

@media (max-width: 1120px) {
  .content-grid,
  .site-card {
    grid-template-columns: 1fr;
  }

  .site-actions .button {
    width: auto;
  }
}

@media (max-width: 760px) {
  .app-header,
  .panel-header,
  .site-title-row,
  .job-title-row {
    align-items: stretch;
    flex-direction: column;
  }

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

  .brand-logo-frame {
    width: min(280px, 100%);
  }

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

  .header-actions,
  .site-actions,
  .dialog-actions {
    flex-direction: column;
  }

  .button {
    width: 100%;
  }

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

  .user-card,
  .user-actions {
    align-items: stretch;
    flex-direction: column;
  }
}
