:root {
  color-scheme: light;
  --bg: #f5f7f8;
  --panel: #ffffff;
  --panel-strong: #eef3f5;
  --text: #15212a;
  --muted: #63717b;
  --line: #d7e0e4;
  --blue: #255f99;
  --green: #247a62;
  --red: #a84444;
  --amber: #a87516;
  --violet: #6957a8;
  --shadow: 0 16px 40px rgba(24, 38, 48, 0.08);
}

* {
  box-sizing: border-box;
}

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

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.boot,
.auth-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.boot-panel,
.auth-card {
  width: min(100%, 420px);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.boot-panel {
  padding: 28px;
}

.brand-mark,
.auth-brand {
  font-weight: 800;
  color: var(--blue);
}

.boot-line {
  height: 6px;
  margin-top: 18px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--blue), var(--green), var(--amber));
}

.auth-card {
  padding: 28px;
}

.auth-card h1 {
  margin: 12px 0 22px;
  font-size: 28px;
  line-height: 1.1;
}

.muted {
  color: var(--muted);
  line-height: 1.5;
}

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

.login-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

.login-form input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: #fbfcfd;
  padding: 10px 12px;
}

.login-form input:focus {
  outline: 3px solid rgba(37, 95, 153, 0.18);
  border-color: var(--blue);
}

.login-form button,
.primary-button,
.ghost-button,
.link-button {
  min-height: 40px;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  font-weight: 700;
}

.login-form button,
.primary-button {
  color: #ffffff;
  background: var(--blue);
  padding: 0 16px;
}

.ghost-button,
.link-button {
  color: var(--blue);
  background: #edf4f8;
  border-color: #d3e2eb;
  padding: 0 12px;
}

.form-error,
.alert {
  margin: 0;
  color: var(--red);
}

.setup-card {
  width: min(100%, 560px);
}

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

.setup-grid > div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  display: grid;
  gap: 6px;
}

.setup-label {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.setup-code {
  overflow-x: auto;
  margin: 0;
  border-radius: 8px;
  background: #14202a;
  color: #f4fbff;
  padding: 14px;
}

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

.sidebar {
  min-height: 100vh;
  background: #13202a;
  color: #f4f7f8;
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.sidebar-brand {
  display: grid;
  gap: 2px;
}

.sidebar-brand strong {
  font-size: 22px;
}

.sidebar-brand span,
.sidebar-foot span {
  color: #aebdc6;
  font-size: 13px;
}

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

.tab {
  width: 100%;
  min-height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  color: #dbe7ec;
  background: rgba(255, 255, 255, 0.04);
  text-align: left;
  padding: 0 12px;
  cursor: pointer;
}

.tab.active {
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.24);
  background: #255f99;
}

.sidebar-foot {
  margin-top: auto;
  display: grid;
  gap: 10px;
}

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

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

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

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  font-size: 30px;
  line-height: 1.15;
}

h2 {
  margin: 0;
  font-size: 17px;
}

h3 {
  margin: 0 0 12px;
  font-size: 15px;
}

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

.refresh-time {
  color: var(--muted);
  font-size: 13px;
}

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

.summary-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 16px;
}

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

.summary-card {
  min-height: 100px;
  padding: 18px;
  display: grid;
  align-content: space-between;
  border-top-width: 5px;
}

.summary-card span {
  color: var(--muted);
  font-size: 13px;
}

.summary-card strong {
  font-size: 32px;
}

.summary-card.green {
  border-top-color: var(--green);
}

.summary-card.red {
  border-top-color: var(--red);
}

.summary-card.blue {
  border-top-color: var(--blue);
}

.summary-card.amber {
  border-top-color: var(--amber);
}

.summary-card.violet {
  border-top-color: var(--violet);
}

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

.span-2 {
  grid-column: span 2;
}

.panel {
  padding: 18px;
  box-shadow: 0 1px 0 rgba(20, 32, 42, 0.02);
}

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

.section-head p,
.section-head span {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

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

.site-card {
  min-height: 132px;
  padding: 14px;
  display: grid;
  align-content: space-between;
  gap: 10px;
}

.site-card-top {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.site-card strong,
.site-card a,
.site-meta {
  min-width: 0;
}

.site-card a {
  color: var(--blue);
  text-decoration: none;
  font-size: 13px;
}

.site-meta {
  color: var(--muted);
  font-size: 13px;
}

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

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

.site-card.skeleton {
  min-height: 132px;
  background:
    linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.65), transparent),
    var(--panel-strong);
  background-size: 220px 100%, 100% 100%;
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  from {
    background-position: -220px 0, 0 0;
  }
  to {
    background-position: calc(100% + 220px) 0, 0 0;
  }
}

.document-mini {
  display: grid;
  gap: 6px;
  border-left: 4px solid var(--violet);
  padding: 4px 0 4px 12px;
}

.document-mini span,
.document-mini small,
.empty-state {
  color: var(--muted);
}

.file-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.file-pills span,
.file-kind {
  border-radius: 999px;
  color: #ffffff;
  background: var(--violet);
  font-size: 12px;
  font-weight: 800;
  padding: 4px 9px;
}

.check-list,
.path-list,
.step-list {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
  line-height: 1.9;
}

.site-groups,
.document-list {
  display: grid;
  gap: 20px;
}

.document-panel {
  display: grid;
  gap: 14px;
}

.path-line {
  border-radius: 8px;
  background: var(--panel-strong);
  color: var(--muted);
  padding: 10px 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.file-table {
  display: grid;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.file-row {
  min-height: 52px;
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr) 92px;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px solid var(--line);
}

.file-row:last-child {
  border-bottom: 0;
}

.file-row small {
  color: var(--muted);
  text-align: right;
}

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

.details {
  margin: 0;
  display: grid;
  gap: 12px;
}

.details div {
  display: grid;
  gap: 4px;
}

.details dt {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

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

.alert {
  border: 1px solid #edc8c8;
  background: #fff4f4;
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 16px;
}

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

  .sidebar {
    min-height: auto;
  }

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

  .tab {
    text-align: center;
  }

  .sidebar-foot {
    grid-template-columns: 1fr auto;
    align-items: center;
  }

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

  .span-2 {
    grid-column: span 2;
  }
}

@media (max-width: 640px) {
  .main {
    padding: 20px 14px;
  }

  .topbar,
  .section-head {
    align-items: stretch;
    flex-direction: column;
  }

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

  .summary-grid,
  .dashboard-grid,
  .ops-grid,
  .setup-grid,
  .tabs {
    grid-template-columns: 1fr;
  }

  .span-2 {
    grid-column: auto;
  }

  .file-row {
    grid-template-columns: 60px minmax(0, 1fr);
  }

  .file-row small {
    grid-column: 2;
    text-align: left;
  }
}
