:root {
  color-scheme: light;
  --bg: #f8f8f7;
  --panel: #ffffff;
  --panel-muted: #f3f3f2;
  --line: #e5e5e2;
  --text: #111111;
  --muted: #666666;
  --soft: #8b8b85;
  --primary: #111111;
  --primary-hover: #2a2a2a;
  --danger: #b42318;
  --success: #207a3b;
  --radius: 12px;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
}

button,
input {
  font: inherit;
}

a {
  color: inherit;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

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

.login-card {
  width: min(100%, 390px);
  padding: 24px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 13px;
}

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

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

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

h3 {
  margin-bottom: 4px;
  font-size: 15px;
  letter-spacing: 0;
}

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

.form {
  display: grid;
  gap: 14px;
  margin-top: 22px;
}

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

.field label {
  font-size: 13px;
  font-weight: 600;
}

.input {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  color: var(--text);
  outline: none;
}

.input:focus {
  border-color: #111;
  box-shadow: 0 0 0 3px rgba(17, 17, 17, 0.08);
}

.button {
  min-height: 40px;
  max-width: 100%;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  white-space: nowrap;
}

.button.primary {
  border-color: var(--primary);
  background: var(--primary);
  color: white;
}

.button.primary:hover {
  background: var(--primary-hover);
}

.button.danger {
  color: var(--danger);
}

.error {
  min-height: 20px;
  color: var(--danger);
  font-size: 13px;
}

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

.sidebar {
  border-right: 1px solid var(--line);
  background: var(--panel);
  padding: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 28px;
  font-weight: 700;
  min-width: 0;
}

.brand span:last-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mark {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #111;
  color: #fff;
  font-size: 13px;
}

.nav {
  display: grid;
  gap: 6px;
}

.nav button {
  width: 100%;
  justify-content: flex-start;
  color: var(--muted);
}

.nav button.active {
  border-color: #111;
  color: #111;
  background: #f4f4f2;
}

.main {
  min-width: 0;
  padding: 28px;
  width: 100%;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

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

.card {
  padding: 18px;
}

.panel-block {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-muted);
}

.metric {
  font-size: 30px;
  font-weight: 700;
  line-height: 1;
}

.section-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(280px, 0.7fr);
  gap: 14px;
  margin-top: 14px;
}

.list {
  display: grid;
  gap: 10px;
}

.row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.row > div {
  min-width: 0;
}

.site-card {
  align-items: start;
}

.site-main,
.site-meta {
  min-width: 0;
  overflow-wrap: anywhere;
}

.site-name {
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.row-actions,
.button-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.site-status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

.site-status a {
  color: var(--text);
  text-decoration: none;
  overflow-wrap: anywhere;
}

.site-url {
  display: inline-block;
  max-width: 100%;
  font-weight: 500;
  line-height: 1.35;
}

.pill {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 8px;
  color: var(--muted);
  background: var(--panel-muted);
  font-size: 12px;
}

.pill.pass,
.pill.ok {
  border-color: rgba(32, 122, 59, 0.25);
  color: var(--success);
  background: #f0f8f2;
}

.pill.warn {
  border-color: rgba(156, 99, 12, 0.28);
  color: #8a5a10;
  background: #fff8e6;
}

.pill.fail,
.pill.bad {
  border-color: rgba(180, 35, 24, 0.25);
  color: var(--danger);
  background: #fff1ef;
}

.empty {
  padding: 32px 18px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  text-align: center;
}

.settings {
  display: grid;
  gap: 8px;
}

.job-card {
  margin-top: 16px;
}

.steps {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.step {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

.step span {
  width: 10px;
  height: 10px;
  margin-top: 5px;
  border-radius: 999px;
  background: var(--soft);
}

.step.completed span {
  background: var(--success);
}

.step.failed span {
  background: var(--danger);
}

.step strong {
  display: block;
  font-size: 13px;
}

.step p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.setting {
  display: grid;
  grid-template-columns: minmax(0, 0.42fr) minmax(0, 0.58fr);
  gap: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

.setting-label {
  font-weight: 600;
}

.setting-value {
  color: var(--muted);
  text-align: right;
  overflow-wrap: anywhere;
}

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.audit-row {
  align-items: start;
}

.audit-detail {
  max-height: 160px;
  overflow: auto;
  margin: 10px 0 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-muted);
  color: var(--muted);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.recovery-result {
  min-height: 22px;
  margin-top: 12px;
  font-size: 13px;
}

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

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 2;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 14px;
  }

  .brand {
    margin-bottom: 12px;
  }

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

  .nav button {
    min-width: 0;
    justify-content: center;
  }

  .main {
    padding: 20px;
  }

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

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

  .topbar {
    flex-direction: column;
  }

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

  .section-heading {
    flex-direction: column;
  }
}

@media (max-width: 560px) {
  h1 {
    font-size: 24px;
  }

  h2 {
    font-size: 18px;
  }

  .login-shell {
    align-items: start;
    padding: 14px;
    padding-top: 9vh;
  }

  .login-card,
  .card {
    border-radius: 10px;
  }

  .login-card,
  .card,
  .panel-block {
    padding: 14px;
  }

  .sidebar {
    padding: 12px;
  }

  .brand {
    margin-bottom: 10px;
  }

  .mark {
    width: 26px;
    height: 26px;
    border-radius: 7px;
    font-size: 12px;
  }

  .nav {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 5px;
  }

  .nav button {
    min-height: 36px;
    padding-inline: 10px;
    font-size: 13px;
  }

  .main {
    padding: 14px;
  }

  .topbar {
    gap: 12px;
    margin-bottom: 14px;
  }

  .topbar #logout {
    width: 100%;
  }

  .grid {
    gap: 10px;
  }

  .metric {
    font-size: 26px;
  }

  .section-grid {
    gap: 10px;
    margin-top: 10px;
  }

  .row {
    gap: 12px;
    padding: 11px;
  }

  .row-actions,
  .button-row {
    width: 100%;
    align-items: stretch;
  }

  .site-card {
    gap: 10px;
  }

  .site-name {
    font-size: 16px;
  }

  .site-meta {
    line-height: 1.3;
  }

  .site-card .site-status {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: stretch;
  }

  .site-card .site-status .pill {
    justify-content: center;
  }

  .site-url {
    grid-column: 1 / -1;
    padding-top: 2px;
  }

  .site-actions {
    display: grid;
    grid-template-columns: minmax(74px, 0.72fr) minmax(0, 1fr) minmax(0, 1fr);
    gap: 6px;
  }

  .row-actions .button,
  .button-row .button {
    width: 100%;
    min-height: 40px;
    padding-inline: 10px;
  }

  .row-actions .pill {
    min-height: 36px;
    justify-content: center;
  }

  .site-status {
    gap: 6px;
  }

  .pill {
    min-width: 0;
    white-space: normal;
    text-align: center;
  }

  .setting {
    grid-template-columns: 1fr;
    gap: 4px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: var(--panel-muted);
  }

  .setting-value {
    text-align: left;
  }

  .audit-detail {
    max-height: 220px;
    font-size: 11px;
  }
}

@media (max-width: 360px) {
  .main,
  .sidebar,
  .login-shell {
    padding-left: 10px;
    padding-right: 10px;
  }

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

  .button {
    white-space: normal;
  }

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

  .status-pill {
    grid-column: 1 / -1;
  }
}
