:root {
  color-scheme: light;
  --bg: #fff8f2;
  --surface: #ffffff;
  --text: #1f2937;
  --muted: #64748b;
  --brand: #ff6b35;
  --brand-dark: #d14d28;
  --line: #ffd9c5;
  --ok-bg: #ecfdf3;
  --ok-text: #166534;
  --err-bg: #fef2f2;
  --err-text: #991b1b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: linear-gradient(145deg, var(--bg), #ffe9de);
  color: var(--text);
  min-height: 100vh;
}

.container {
  max-width: 920px;
  margin: 0 auto;
  padding: 0 1rem;
}

.topbar {
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar-inner {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  color: inherit;
  font-weight: 700;
}

.brand-logo {
  width: 180px;
  max-width: 100%;
  height: 50px;
  object-fit: contain;
}

.health {
  font-size: 0.8rem;
  font-weight: 700;
  border-radius: 999px;
  border: 1px solid transparent;
  padding: 0.35rem 0.6rem;
  white-space: nowrap;
}

.health-ok {
  background: #ecfdf3;
  border-color: #86efac;
  color: #166534;
}

.health-error {
  background: #fef2f2;
  border-color: #fca5a5;
  color: #991b1b;
}

.health-unknown {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: #475569;
}

.main {
  padding-top: 1.25rem;
  padding-bottom: 2.5rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1.1rem;
  box-shadow: 0 8px 24px rgba(17, 24, 39, 0.06);
  margin-bottom: 1rem;
}

.auth-card {
  max-width: 520px;
  margin-left: auto;
  margin-right: auto;
}

h1, h2 {
  margin-top: 0;
  margin-bottom: 0.45rem;
  line-height: 1.2;
}

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

.small {
  font-size: 0.86rem;
}

form {
  margin-top: 1rem;
  display: grid;
  gap: 0.6rem;
}

label {
  font-weight: 600;
  font-size: 0.95rem;
}

input {
  width: 100%;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 0.7rem 0.75rem;
  font-size: 1rem;
}

input:focus {
  outline: 2px solid rgba(255, 107, 53, 0.22);
  border-color: var(--brand);
}

.password-wrap {
  position: relative;
}

.password-wrap input {
  padding-right: 2.8rem;
}

.icon-btn {
  position: absolute;
  right: 0.45rem;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 1rem;
  color: #475569;
  line-height: 1;
}

.link-btn {
  margin-top: -0.2rem;
  width: max-content;
  border: none;
  background: transparent;
  color: #b45309;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0;
  cursor: pointer;
}

.link-btn:hover {
  text-decoration: underline;
}

.forgot-panel {
  margin-top: 0.2rem;
  display: grid;
  gap: 0.45rem;
  padding: 0.6rem;
  border: 1px dashed #f9c8ad;
  border-radius: 10px;
  background: #fffaf6;
}

.btn {
  border: none;
  border-radius: 10px;
  min-height: 44px;
  padding: 0.65rem 1rem;
  font-weight: 700;
  cursor: pointer;
}

.btn-primary {
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  color: white;
  text-decoration: none;
}

.btn-secondary {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
}

.recharge-btn {
  margin-top: 0.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.hint {
  margin-top: 0.8rem;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.kv {
  margin-top: 0.6rem;
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 0.4rem 0.8rem;
  align-items: center;
}

.stats {
  margin-top: 0.7rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr));
  gap: 0.75rem;
}

.stats article {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.75rem;
  background: #fffdfa;
}

.stats span {
  display: block;
  color: var(--muted);
  font-size: 0.86rem;
  margin-bottom: 0.2rem;
}

.stats strong {
  font-size: 1.3rem;
}

.notice {
  border-radius: 12px;
  padding: 0.75rem 0.9rem;
  margin-bottom: 1rem;
  border: 1px solid transparent;
}

.notice.ok {
  background: var(--ok-bg);
  color: var(--ok-text);
  border-color: #a7f3d0;
}

.notice.error {
  background: var(--err-bg);
  color: var(--err-text);
  border-color: #fecaca;
}

.hidden {
  display: none !important;
}

@media (max-width: 640px) {
  .topbar-inner {
    min-height: 58px;
    flex-wrap: wrap;
  }

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

  .brand-logo {
    width: 150px;
    height: 42px;
  }
}
