:root {
  --bt-bg: #f4f6fb;
  --bt-card: #ffffff;
  --bt-ink: #1f2933;
  --bt-muted: #6b7280;
  --bt-primary: #3f6fd1;
  --bt-primary-dark: #2f57a8;
  --bt-accent: #f0f4ff;
  --bt-danger: #d14b4b;
  --bt-border: #e3e8f0;
  --bt-radius: 14px;
  --bt-shadow: 0 2px 10px rgba(31, 41, 51, .06);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bt-bg);
  color: var(--bt-ink);
  line-height: 1.5;
}

/* Header / nav */
.bt-header {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 12px 20px;
  background: var(--bt-card);
  border-bottom: 1px solid var(--bt-border);
  box-shadow: var(--bt-shadow);
}
.bt-brand { font-weight: 700; font-size: 1.05rem; }
.bt-nav { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
.bt-nav a {
  text-decoration: none;
  color: var(--bt-ink);
  padding: 6px 12px;
  border-radius: 8px;
  font-size: .94rem;
}
.bt-nav a:hover { background: var(--bt-accent); color: var(--bt-primary-dark); }

.bt-lang { display: flex; align-items: center; gap: 10px; }
.bt-lang a { text-decoration: none; color: var(--bt-muted); font-weight: 600; font-size: .85rem; }
.bt-lang a.active { color: var(--bt-primary); }
.bt-manual-link { white-space: nowrap; }
.bt-user { font-size: .85rem; color: var(--bt-muted); }
.bt-logout {
  font-size: .85rem; color: var(--bt-danger) !important; font-weight: 600;
}

.bt-viewer-banner {
  background: #fff7e6;
  color: #8a6d3b;
  border-bottom: 1px solid #f0e0c0;
  padding: 8px 20px;
  font-size: .9rem;
  text-align: center;
}

/* Layout */
.bt-main { max-width: 1000px; margin: 22px auto; padding: 0 16px; }
.bt-card {
  background: var(--bt-card);
  border: 1px solid var(--bt-border);
  border-radius: var(--bt-radius);
  box-shadow: var(--bt-shadow);
  padding: 20px 22px;
  margin-bottom: 18px;
}
.bt-card h1 { margin-top: 0; font-size: 1.3rem; }
.bt-card h2 { margin-top: 0; font-size: 1.08rem; }

.bt-grid { display: grid; gap: 16px; }
.bt-grid-2 { grid-template-columns: repeat(2, 1fr); }
.bt-grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 720px) {
  .bt-grid-2, .bt-grid-4 { grid-template-columns: 1fr 1fr; }
}

/* Stats */
.bt-stat { text-align: center; padding: 10px; background: var(--bt-accent); border-radius: 10px; }
.bt-stat-value { font-size: 1.5rem; font-weight: 700; color: var(--bt-primary-dark); }
.bt-stat-label { font-size: .82rem; color: var(--bt-muted); }

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

/* Next feeding */
.bt-next-feeding .bt-next-time { font-size: 1.3rem; font-weight: 700; color: var(--bt-primary); }
.bt-plan {
  margin-top: 8px; font-size: .92rem; color: var(--bt-ink);
  background: var(--bt-accent); padding: 8px 12px; border-radius: 8px; display: inline-block;
}

/* Lists */
.bt-list { list-style: none; margin: 0; padding: 0; }
.bt-list li {
  display: flex; justify-content: space-between;
  padding: 8px 0; border-bottom: 1px solid var(--bt-border);
}
.bt-list li:last-child { border-bottom: none; }
.bt-list-sub { color: var(--bt-muted); font-size: .85rem; }

/* Forms */
.bt-form label, .bt-settings label { display: block; font-size: .9rem; margin-bottom: 10px; }
.bt-form-row { display: flex; gap: 14px; flex-wrap: wrap; }
.bt-form-row > label { flex: 1; min-width: 150px; }
.bt-form input, .bt-form select,
.bt-settings input, .bt-settings select {
  width: 100%; padding: 8px 10px; margin-top: 4px;
  border: 1px solid var(--bt-border); border-radius: 8px; font-size: .95rem;
  background: #fff;
}
.bt-form small { color: var(--bt-muted); font-size: .78rem; }
.bt-check { display: flex !important; align-items: center; gap: 8px; }
.bt-check input { width: auto !important; margin-top: 0 !important; }

/* Buttons */
.bt-btn, .bt-btn-secondary {
  display: inline-block; cursor: pointer; border: none;
  padding: 9px 18px; border-radius: 9px; font-size: .95rem; font-weight: 600;
  text-decoration: none;
}
.bt-btn { background: var(--bt-primary); color: #fff; }
.bt-btn:hover { background: var(--bt-primary-dark); }
.bt-btn-secondary { background: var(--bt-accent); color: var(--bt-primary-dark); }
.bt-btn-secondary:hover { background: #e2e9fb; }
.bt-actions-row { display: flex; gap: 10px; flex-wrap: wrap; margin: 6px 0 4px; }

.bt-link, .bt-link-danger {
  background: none; border: none; cursor: pointer;
  font-size: .88rem; font-weight: 600; padding: 2px 6px;
}
.bt-link { color: var(--bt-primary); }
.bt-link-danger { color: var(--bt-danger); }
.bt-actions { display: flex; gap: 6px; }

/* Tables */
.bt-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.bt-table th, .bt-table td {
  text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--bt-border);
}
.bt-table th { color: var(--bt-muted); font-weight: 600; font-size: .82rem; text-transform: uppercase; }

/* Footer */
.bt-footer {
  text-align: center; color: var(--bt-muted); font-size: .85rem;
  padding: 20px; max-width: 1000px; margin: 0 auto;
}
.bt-footer a { color: var(--bt-primary); }

/* 403 */
.bt-forbidden { text-align: center; }
.bt-forbidden-icon { font-size: 3rem; }

/* Toast */
.bt-toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  background: var(--bt-ink); color: #fff; padding: 10px 18px;
  border-radius: 10px; font-size: .9rem; opacity: 0; pointer-events: none;
  transition: opacity .25s, transform .25s; z-index: 50;
}
.bt-toast.show { opacity: 1; transform: translateX(-50%) translateY(-4px); }
.bt-toast.error { background: var(--bt-danger); }

/* ---------- Login page ---------- */
.bt-login-body {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; background: linear-gradient(135deg, #eef2fb, #f7f4ff);
}
.bt-login-card {
  background: #fff; border-radius: 18px; box-shadow: 0 8px 30px rgba(31,41,51,.12);
  padding: 36px 40px; width: 100%; max-width: 400px; text-align: center;
}
.bt-login-logo { font-size: 3rem; }
.bt-login-card h1 { font-size: 1.3rem; margin: 6px 0 16px; }
.bt-login-lang { display: flex; gap: 12px; justify-content: center; margin-bottom: 18px; }
.bt-login-lang a { text-decoration: none; color: var(--bt-muted); font-weight: 600; }
.bt-login-lang a.active { color: var(--bt-primary); }
.bt-login-intro { color: var(--bt-muted); font-size: .95rem; margin-bottom: 22px; }
.bt-login-error {
  background: #fdecea; color: #b3261e; border: 1px solid #f5c6c0;
  padding: 10px 14px; border-radius: 10px; font-size: .9rem; margin-bottom: 16px;
}
.bt-login-code {
  background: #f4f6fb; border: 1px solid var(--bt-border); border-radius: 8px;
  padding: 10px; font-size: .82rem; text-align: left; overflow-x: auto;
}
/* Login form */
.bt-login-form { text-align: left; margin-bottom: 16px; }
.bt-login-form label { display: block; font-size: .9rem; margin-bottom: 12px; }
.bt-login-form input {
  width: 100%; padding: 10px 12px; margin-top: 6px;
  border: 1px solid var(--bt-border); border-radius: 8px; font-size: 1rem;
}
.bt-login-form input[name="code"] {
  font-size: 1.5rem; letter-spacing: .3em; text-align: center; font-weight: 700;
}
.bt-login-form .bt-btn-primary {
  width: 100%; margin-top: 12px; text-align: center;
}
.bt-btn-primary { display: inline-block; cursor: pointer; border: none; padding: 9px 18px; border-radius: 9px; font-size: .95rem; font-weight: 600; background: var(--bt-primary); color: #fff; }
.bt-btn-primary:hover { background: var(--bt-primary-dark); }
.bt-login-back { margin-top: 12px; font-size: .88rem; }
.bt-login-back a { color: var(--bt-primary); }

/* Baby switcher */
.bt-header-right { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.bt-baby-switcher { display: flex; gap: 4px; }
.bt-baby-btn {
  text-decoration: none; color: var(--bt-muted); padding: 4px 10px;
  border-radius: 8px; font-size: .88rem; font-weight: 600;
  border: 1px solid var(--bt-border); transition: all .2s;
}
.bt-baby-btn:hover { background: var(--bt-accent); color: var(--bt-primary); }
.bt-baby-btn.active {
  background: var(--bt-primary); color: #fff; border-color: var(--bt-primary);
}