:root {
  color: #171a1d;
  background: #eef1f2;
  font-family: "Microsoft YaHei UI", "PingFang SC", "Segoe UI", sans-serif;
  font-size: 16px;
  letter-spacing: 0;
}

* { box-sizing: border-box; }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background: #eef1f2;
}

button, input { font: inherit; letter-spacing: 0; }
button, a { -webkit-tap-highlight-color: transparent; }

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

.hidden { display: none !important; }

.login-view {
  width: min(100%, 390px);
  padding: 38px;
  background: #ffffff;
  border: 1px solid #d8dddf;
  border-top: 4px solid #147d6f;
  border-radius: 6px;
  box-shadow: 0 18px 45px rgba(23, 26, 29, 0.08);
}

.brand-mark {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  color: #ffffff;
  background: #171a1d;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 800;
}

.brand-mark.small { width: 38px; height: 38px; font-size: 12px; }

h1, h2, p { margin-top: 0; }
.login-view h1 { margin: 22px 0 5px; font-size: 27px; line-height: 1.2; }
.muted { margin-bottom: 0; color: #667076; font-size: 14px; }

.login-form { display: grid; gap: 9px; margin-top: 30px; }
.login-form label { margin-top: 8px; color: #343a3e; font-size: 13px; font-weight: 650; }

input {
  width: 100%;
  height: 43px;
  padding: 0 12px;
  color: #171a1d;
  background: #ffffff;
  border: 1px solid #c8cfd2;
  border-radius: 5px;
  outline: none;
}

input:focus { border-color: #147d6f; box-shadow: 0 0 0 3px rgba(20, 125, 111, 0.13); }
.form-error { min-height: 20px; margin: 4px 0 0; color: #b42318; font-size: 13px; }

.button {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 5px;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}

.button.primary { color: #ffffff; background: #147d6f; border-color: #147d6f; font-weight: 700; }
.button.primary:hover { background: #0f695e; }
.button.secondary { color: #252a2d; background: #ffffff; border-color: #bfc7ca; font-weight: 650; }
.button.secondary:hover, .button.quiet:hover { background: #f2f5f5; }
.button.quiet { min-height: 36px; color: #525b60; background: transparent; border-color: #cbd1d3; }
.login-form .button { margin-top: 6px; }

.dashboard { width: min(100%, 1080px); align-self: start; }
.topbar { min-height: 74px; display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.identity, .topbar-actions { display: flex; align-items: center; gap: 12px; }
.identity h1 { margin: 0 0 2px; font-size: 20px; line-height: 1.2; }
.topbar-actions { justify-content: flex-end; }

.status-pill {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 11px;
  color: #316457;
  background: #e2f2ed;
  border: 1px solid #b7dacf;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 650;
}

.status-pill.offline { color: #8a341f; background: #fbe9e3; border-color: #edc3b7; }
.status-dot { width: 7px; height: 7px; background: currentColor; border-radius: 50%; }

.content-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(260px, 0.75fr); gap: 16px; }
.panel { background: #ffffff; border: 1px solid #d8dddf; border-radius: 6px; }
.services-panel { padding: 24px; }
.status-panel { padding: 24px; }
.client-panel { grid-column: 1 / -1; padding: 24px; }

.section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.section-heading.compact { margin-bottom: 8px; }
.section-heading h2 { margin: 0; font-size: 18px; line-height: 1.3; }
.eyebrow { margin: 0 0 4px; color: #758086; font-size: 11px; font-weight: 750; text-transform: uppercase; }
.save-state { color: #657076; font-size: 12px; }

.service-list { border-top: 1px solid #e3e7e8; }
.service-row { min-height: 84px; display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; align-items: center; gap: 14px; border-bottom: 1px solid #e3e7e8; }
.service-icon { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 5px; font-size: 11px; font-weight: 800; }
.github-icon { color: #ffffff; background: #24292f; }
.steam-icon { color: #ffffff; background: #1b4d6b; }
.direct-icon { color: #75520b; background: #fff0c2; }
.service-copy { min-width: 0; display: grid; gap: 4px; }
.service-copy strong { font-size: 15px; }
.service-copy span { overflow-wrap: anywhere; color: #687277; font-size: 13px; }

.switch { position: relative; width: 46px; height: 26px; flex: 0 0 auto; cursor: pointer; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch-track { position: absolute; inset: 0; background: #b8c0c3; border-radius: 999px; transition: background 150ms ease; }
.switch-track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; background: #ffffff; border-radius: 50%; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.24); transition: transform 150ms ease; }
.switch input:checked + .switch-track { background: #147d6f; }
.switch input:checked + .switch-track::after { transform: translateX(20px); }
.switch input:focus-visible + .switch-track { outline: 3px solid rgba(20, 125, 111, 0.22); outline-offset: 2px; }
.switch input:disabled + .switch-track { opacity: 0.55; cursor: wait; }

.locked-state { color: #86610f; background: #fff6da; border: 1px solid #ead592; border-radius: 999px; padding: 5px 9px; font-size: 12px; font-weight: 700; white-space: nowrap; }

.metrics { margin: 0; }
.metrics div { min-height: 49px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid #e5e8e9; }
.metrics div:last-child { border-bottom: 0; }
.metrics dt { color: #6a7479; font-size: 13px; }
.metrics dd { margin: 0; font-size: 13px; font-weight: 700; text-align: right; }
.metrics .good { color: #14735f; }

.subscription-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 10px; }
.subscription-row input { color: #4e585d; background: #f7f9f9; font-family: Consolas, monospace; font-size: 12px; }
.client-footer { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-top: 12px; color: #747e83; font-size: 12px; }
.toast { position: fixed; right: 20px; bottom: 20px; max-width: calc(100vw - 40px); padding: 11px 14px; color: #ffffff; background: #252a2d; border-radius: 5px; box-shadow: 0 10px 28px rgba(0, 0, 0, 0.2); font-size: 13px; opacity: 0; transform: translateY(8px); pointer-events: none; transition: 160ms ease; }
.toast.visible { opacity: 1; transform: translateY(0); }

@media (max-width: 760px) {
  .shell { place-items: start stretch; padding: 16px; }
  .login-view { align-self: center; justify-self: center; padding: 28px 22px; }
  .topbar { align-items: flex-start; }
  .topbar-actions { flex-wrap: wrap; }
  .content-grid { grid-template-columns: 1fr; }
  .client-panel { grid-column: 1; }
  .subscription-row { grid-template-columns: 1fr 1fr; }
  .subscription-row input { grid-column: 1 / -1; }
}

@media (max-width: 470px) {
  .topbar { flex-direction: column; }
  .topbar-actions { width: 100%; justify-content: space-between; }
  .services-panel, .status-panel, .client-panel { padding: 18px; }
  .service-row { grid-template-columns: 38px minmax(0, 1fr) auto; gap: 10px; }
  .service-copy span { font-size: 12px; }
  .locked-state { max-width: 68px; white-space: normal; text-align: center; }
  .client-footer { align-items: flex-start; flex-direction: column; gap: 4px; }
}
