:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --panel: #ffffff;
  --panel-soft: #f9fbfd;
  --text: #18202d;
  --muted: #667386;
  --line: #dce3eb;
  --line-strong: #cbd5df;
  --accent: #1f6feb;
  --accent-strong: #185ac2;
  --accent-soft: #eaf2ff;
  --green: #0f7a4f;
  --green-soft: #e9f7f0;
  --amber: #9a5b00;
  --amber-soft: #fff4dc;
  --danger: #b42318;
  --danger-soft: #fff0ee;
  --shadow: 0 18px 45px rgba(24, 32, 45, 0.08);
}

* {
  box-sizing: border-box;
}

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

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

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

.topbar {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 0 32px;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 700;
}

.brand-mark {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: var(--text);
  color: #fff;
  font-size: 13px;
  letter-spacing: 0;
}

.nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  color: var(--muted);
}

.nav a,
.nav-user {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  border-radius: 7px;
  padding: 0 10px;
}

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

.nav a:hover {
  background: var(--panel-soft);
  color: var(--text);
}

.nav-user {
  background: var(--panel-soft);
  color: var(--text);
  font-weight: 600;
}

.shell {
  width: min(1120px, calc(100% - 36px));
  margin: 32px auto 56px;
}

.login-layout {
  min-height: calc(100vh - 160px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  align-items: center;
  gap: 44px;
}

.login-intro {
  max-width: 560px;
}

.login-intro h1 {
  max-width: 520px;
  font-size: 42px;
  line-height: 1.12;
}

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

.login-panel {
  padding: 32px;
}

.panel {
  padding: 24px;
}

.form-panel {
  box-shadow: none;
}

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

h1 {
  font-size: 30px;
  line-height: 1.18;
  margin-bottom: 8px;
}

h2 {
  font-size: 18px;
  line-height: 1.25;
  margin-bottom: 8px;
}

p {
  color: var(--muted);
  line-height: 1.6;
}

.eyebrow {
  margin-bottom: 8px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
}

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

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
}

input {
  width: 100%;
  height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  padding: 0 12px;
  font: inherit;
  color: var(--text);
  background: #fff;
}

input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  outline: 0;
}

button,
.button,
.secondary,
.quiet-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border: 0;
  border-radius: 7px;
  padding: 0 16px;
  font: inherit;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}

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

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

.secondary,
.quiet-button {
  color: var(--text);
  background: #eef2f6;
}

.secondary:hover,
.quiet-button:hover {
  background: #e2e8f0;
  color: var(--text);
}

.quiet-button {
  min-height: 32px;
  padding: 0 11px;
  font-size: 13px;
}

.danger-link {
  color: var(--danger);
  background: var(--danger-soft);
}

.danger-link:hover {
  color: #8f1c14;
  background: #ffe4e0;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 4px;
}

.alert,
.notice {
  margin-bottom: 16px;
  padding: 11px 12px;
  border-radius: 7px;
}

.alert {
  background: var(--danger-soft);
  color: var(--danger);
}

.notice {
  background: var(--green-soft);
  color: var(--green);
}

.page-head {
  margin-bottom: 24px;
}

.page-head.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.hero-panel {
  min-height: 210px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 240px;
  align-items: end;
  gap: 28px;
  margin-bottom: 18px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.hero-panel h1 {
  font-size: 36px;
}

.hero-status {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.hero-status span:last-child {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 13px;
}

.status-dot {
  width: 12px;
  height: 12px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--amber);
}

.status-dot.ok {
  background: var(--green);
}

.status-dot.pending {
  background: var(--amber);
}

.dashboard-grid,
.info-grid {
  display: grid;
  gap: 16px;
}

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

.info-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 16px;
}

.app-card {
  min-height: 176px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
}

.primary-card {
  box-shadow: var(--shadow);
}

.card-main {
  min-width: 0;
}

.app-icon {
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 800;
}

.app-icon.warm {
  background: var(--amber-soft);
  color: var(--amber);
}

.compact-panel {
  min-height: 150px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  box-shadow: none;
}

.form-shell {
  display: grid;
  grid-template-columns: minmax(0, 520px) minmax(260px, 1fr);
  align-items: start;
  gap: 18px;
}

.single-form {
  grid-template-columns: minmax(0, 520px);
}

.side-note {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
  background: var(--panel-soft);
}

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

.small {
  margin-top: 7px;
  font-size: 12px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 0 10px;
  background: #eef2f6;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

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

.admin-badge {
  background: var(--accent-soft);
  color: var(--accent);
}

.danger-badge {
  background: var(--danger-soft);
  color: var(--danger);
}

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

.job-log {
  margin-top: 8px;
}

.job-log summary {
  color: var(--accent);
  cursor: pointer;
}

.job-log pre {
  max-width: 520px;
  max-height: 180px;
  overflow: auto;
  margin: 8px 0 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f8fafc;
  color: var(--text);
  white-space: pre-wrap;
}

.table-wrap {
  overflow-x: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 15px 16px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  vertical-align: middle;
}

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

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

.user-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-cell strong,
.user-cell span {
  display: block;
}

.user-cell span:not(.avatar) {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.avatar {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--text);
  font-weight: 800;
}

.workspace-cell {
  display: flex;
  align-items: center;
  gap: 8px;
}

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

@media (max-width: 820px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    padding: 14px 18px;
  }

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

  .shell {
    width: min(100% - 28px, 1120px);
    margin: 22px auto 40px;
  }

  .login-layout,
  .hero-panel,
  .dashboard-grid,
  .info-grid,
  .form-shell {
    grid-template-columns: 1fr;
  }

  .login-layout {
    min-height: auto;
    gap: 20px;
  }

  .login-intro h1,
  .hero-panel h1 {
    font-size: 30px;
  }

  .page-head.row {
    align-items: flex-start;
    flex-direction: column;
  }

  .app-card,
  .compact-panel {
    flex-direction: column;
  }
}

@media (max-width: 520px) {
  .brand {
    width: 100%;
  }

  .nav a,
  .nav-user {
    padding: 0 8px;
  }

  .login-panel,
  .panel,
  .hero-panel,
  .app-card,
  .side-note {
    padding: 20px;
  }

  button,
  .button,
  .secondary {
    width: 100%;
  }

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