:root {
  --bg: #111820;
  --surface: #18212b;
  --surface-2: #202b37;
  --line: #2d3a48;
  --text: #e9f0f7;
  --muted: #95a3b4;
  --green: #26d07c;
  --red: #ff5c72;
  --yellow: #f0b84a;
  --blue: #57b8ff;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    linear-gradient(135deg, rgba(255,255,255,0.03) 0 25%, transparent 25% 50%, rgba(255,255,255,0.025) 50% 75%, transparent 75%),
    #111820;
  background-size: 38px 38px;
  font-family: "Segoe UI", "Microsoft YaHei", sans-serif;
}

button, input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 28px;
}

.hidden {
  display: none !important;
}

.footer-unified {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto 20px;
  padding: 10px 0 4px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}

.footer-unified p {
  margin: 0;
  display: inline-flex;
  align-items: center;
}

.footer-link {
  margin-left: 6px;
  margin-right: 4px;
  text-decoration: none;
  font-weight: 700;
  background: linear-gradient(90deg, #00f0ff, #35ff7a, #ffd35f, #ff6cab, #00f0ff);
  background-size: 300% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: wob-rainbow 3.5s linear infinite;
}

.footer-heart {
  display: inline-block;
  transform-origin: center;
  animation: heart-bounce 1.5s ease-in-out infinite;
}

.login-view {
  min-height: calc(100vh - 80px);
  display: grid;
  align-content: center;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 42px;
}

.login-copy h1,
.topbar h1 {
  margin: 0;
  font-size: 34px;
  letter-spacing: 0;
}

.login-copy p:last-child {
  max-width: 460px;
  color: var(--muted);
  line-height: 1.7;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.login-form,
.summary-strip,
.site-row,
.modal-panel {
  background: rgba(24, 33, 43, 0.94);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 20px 70px rgba(0, 0, 0, 0.26);
}

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

input {
  width: 100%;
  color: var(--text);
  background: #101720;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px 14px;
  outline: none;
}

input:focus {
  border-color: var(--blue);
}

button {
  color: #081017;
  background: var(--green);
  border: 0;
  border-radius: 6px;
  padding: 10px 14px;
  font-weight: 800;
}

button:disabled {
  cursor: progress;
  opacity: 0.6;
}

.ghost,
.icon-btn {
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--line);
}

.icon-btn {
  width: 36px;
  height: 36px;
  padding: 0;
  font-size: 24px;
  line-height: 1;
}

.msg,
.empty,
.loading {
  color: var(--muted);
}

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

.toolbar {
  display: flex;
  gap: 10px;
}

.summary-strip {
  display: grid;
  grid-template-columns: 1.3fr repeat(3, 1fr);
  gap: 1px;
  overflow: hidden;
  margin-bottom: 18px;
}

.summary-strip > div {
  min-width: 0;
  background: var(--surface);
  padding: 16px;
}

.summary-strip span,
.metric span,
.detail-summary span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.summary-strip strong {
  display: block;
  margin-top: 6px;
  font-size: 18px;
}

.state-dot {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  margin-right: 8px;
  background: var(--yellow);
  box-shadow: 0 0 18px rgba(240, 184, 74, 0.35);
  vertical-align: middle;
}

.state-dot.ok {
  background: var(--green);
  box-shadow: 0 0 18px rgba(38, 208, 124, 0.35);
  animation: breathe-green 1.8s ease-in-out infinite;
}

.state-dot.bad {
  background: var(--red);
  box-shadow: 0 0 18px rgba(255, 92, 114, 0.35);
  animation: breathe-red 1.8s ease-in-out infinite;
}

.state-dot.idle {
  background: var(--muted);
  box-shadow: none;
}

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

.site-row {
  padding: 16px;
  animation: rise 360ms ease both;
}

.site-main {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 150px minmax(220px, 0.8fr);
  gap: 18px;
  align-items: center;
}

.site-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

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

.site-row a {
  display: inline-block;
  max-width: 100%;
  margin-top: 6px;
  color: var(--muted);
  text-decoration: none;
  word-break: break-all;
}

.metric strong {
  display: block;
  margin-top: 5px;
  font-size: 15px;
  overflow-wrap: anywhere;
}

.history-bar {
  display: grid;
  grid-template-columns: repeat(30, minmax(0, 1fr));
  gap: 6px;
  width: 100%;
  margin-top: 16px;
}

.day-pill {
  height: 24px;
  width: 100%;
  min-width: 0;
  padding: 0;
  border-radius: 3px;
  background: #394655;
  transition: transform 140ms ease, filter 140ms ease;
}

.day-pill.ok {
  background: var(--green);
  animation: breathe-green-bar 1.9s ease-in-out infinite;
}

.day-pill.bad {
  background: var(--red);
  animation: breathe-red-bar 1.9s ease-in-out infinite;
}

.day-pill.none {
  background: #36414d;
}

.day-pill:hover {
  transform: translateY(-3px);
  filter: brightness(1.14);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(5, 10, 16, 0.74);
}

.modal-panel {
  width: min(860px, 100%);
  max-height: min(760px, calc(100vh - 36px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.modal-head h2 {
  margin: 0;
  font-size: 21px;
}

.modal-body {
  overflow: auto;
  padding: 18px;
}

.detail-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}

.detail-summary div {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
}

.detail-summary strong {
  display: block;
  margin-top: 6px;
  font-size: 20px;
}

.log-table {
  display: grid;
  gap: 6px;
}

.log-row {
  display: grid;
  grid-template-columns: 120px 80px 90px 90px minmax(140px, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 38px;
  padding: 9px 10px;
  background: #121a23;
  border-left: 3px solid var(--green);
  border-radius: 5px;
  color: #dce7f1;
}

.log-row.bad {
  border-left-color: var(--red);
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes breathe-green {
  0%, 100% {
    box-shadow: 0 0 8px rgba(38, 208, 124, 0.35), 0 0 0 0 rgba(38, 208, 124, 0.24);
  }
  50% {
    box-shadow: 0 0 20px rgba(38, 208, 124, 0.68), 0 0 0 9px rgba(38, 208, 124, 0.06);
  }
}

@keyframes breathe-red {
  0%, 100% {
    box-shadow: 0 0 8px rgba(255, 92, 114, 0.35), 0 0 0 0 rgba(255, 92, 114, 0.22);
  }
  50% {
    box-shadow: 0 0 20px rgba(255, 92, 114, 0.7), 0 0 0 9px rgba(255, 92, 114, 0.06);
  }
}

@keyframes breathe-green-bar {
  0%, 100% {
    box-shadow: 0 0 0 rgba(38, 208, 124, 0);
    filter: brightness(1);
  }
  50% {
    box-shadow: 0 0 16px rgba(38, 208, 124, 0.38);
    filter: brightness(1.1);
  }
}

@keyframes breathe-red-bar {
  0%, 100% {
    box-shadow: 0 0 0 rgba(255, 92, 114, 0);
    filter: brightness(1);
  }
  50% {
    box-shadow: 0 0 16px rgba(255, 92, 114, 0.38);
    filter: brightness(1.1);
  }
}

@keyframes wob-rainbow {
  0% {
    background-position: 0% 50%;
  }
  100% {
    background-position: 300% 50%;
  }
}

@keyframes heart-bounce {
  0%, 100% {
    transform: scale(1);
  }
  35% {
    transform: scale(1.08);
  }
  55% {
    transform: scale(1.02);
  }
}

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

  .topbar,
  .toolbar {
    align-items: stretch;
  }

  .topbar {
    flex-direction: column;
  }

  .summary-strip,
  .site-main,
  .detail-summary {
    grid-template-columns: 1fr;
  }

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

  .day-pill {
    height: 22px;
  }

  .log-row {
    grid-template-columns: 1fr 70px 80px;
  }

  .log-row span:nth-child(4),
  .log-row span:nth-child(5) {
    grid-column: 1 / -1;
  }
}
