:root {
  /* Main content area — light */
  --bg: #f0f2f5;
  --surface: #ffffff;
  --surface-2: #f7f8fa;
  --border: #e2e8f0;
  --border-warm: #e8d9b0;

  /* Accent — Gold premium */
  --accent: #D4A847;
  --accent-hover: #C49A3A;
  --accent-glow: rgba(212,168,71,0.12);

  /* Text — dark on light bg */
  --text: #0f172a;
  --text-muted: #64748b;

  /* Sidebar — dark navy */
  --sidebar-bg: #0f172a;
  --sidebar-bg2: #1e293b;
  --sidebar-border: #334155;
  --sidebar-text: #ffffff;
  --sidebar-muted: #94a3b8;

  --success: #22c55e;
  --warning: #d4a843;
  --radius: 12px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }

/* ── Layout ── */
.layout {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar — dark ── */
.sidebar {
  width: 240px;
  background: linear-gradient(180deg, var(--sidebar-bg2) 0%, var(--sidebar-bg) 100%);
  border-right: 1px solid var(--sidebar-border);
  padding: 24px 0;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  display: flex;
  flex-direction: column;
}

.sidebar-logo {
  padding: 0 24px 24px;
  border-bottom: 1px solid var(--sidebar-border);
  font-size: 14px;
  font-weight: 700;
  color: var(--sidebar-text);
  letter-spacing: -0.3px;
}

.sidebar-logo span {
  display: block;
  font-size: 11px;
  font-weight: 400;
  color: var(--sidebar-muted);
  margin-top: 4px;
}

.logo-star {
  display: inline-block;
  font-size: 14px;
  color: #d4a843;
  animation: twinkle 2.5s ease-in-out infinite;
  vertical-align: middle;
  margin-right: 2px;
}
@keyframes twinkle {
  0%, 100% { opacity: 1; transform: scale(1) rotate(0deg); }
  25%       { opacity: 0.3; transform: scale(0.7) rotate(20deg); }
  50%       { opacity: 1; transform: scale(1.2) rotate(0deg); }
  75%       { opacity: 0.6; transform: scale(0.9) rotate(-10deg); }
}

.sidebar-nav {
  padding: 16px 12px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--sidebar-muted);
  font-size: 14px;
  font-weight: 500;
  transition: all 0.15s;
  cursor: pointer;
  text-decoration: none;
  border-left: 2px solid transparent;
}

.nav-item:hover {
  background: rgba(161,98,7,0.12);
  color: var(--sidebar-text);
  border-left-color: rgba(161,98,7,0.4);
}
.nav-item.active {
  background: rgba(212,168,67,0.15);
  color: #d4a843;
  border-left-color: #d4a843;
  font-weight: 600;
}
.nav-item .icon { width: 18px; text-align: center; }
.nav-item i { font-size: 18px; width: 18px; text-align: center; flex-shrink: 0; }

.sidebar-user {
  padding: 16px 24px;
  border-top: 1px solid var(--sidebar-border);
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-user img {
  width: 32px; height: 32px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--sidebar-border);
}

.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name  { font-size: 13px; font-weight: 600; color: #ffffff; }
.sidebar-user-email { font-size: 11px; color: rgba(255,255,255,0.6); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.logout-btn {
  background: none; border: none;
  color: var(--sidebar-muted); cursor: pointer;
  font-size: 16px; padding: 4px;
  transition: color 0.15s;
}
.logout-btn:hover { color: #d4a843; }

/* ── Main content — light ── */
.main {
  margin-left: 240px;
  flex: 1;
  padding: 40px;
  max-width: calc(100vw - 240px);
}

/* ── Page header ── */
.page-header { margin-bottom: 32px; }
.page-title {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 4px;
  color: var(--text);
}
.page-subtitle { color: var(--text-muted); font-size: 14px; }

/* ── Cards ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  transition: box-shadow 0.2s, border-color 0.2s;
}
.card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  border-color: rgba(161,98,7,0.25);
}

.card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 12px;
}

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }

/* ── Badge ── */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 600;
}
.badge-green  { background: rgba(34,197,94,0.10);  color: #16a34a; }
.badge-yellow { background: rgba(212,168,67,0.12); color: #a16207; }
.badge-purple { background: rgba(161,98,7,0.10);   color: #a16207; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
  text-decoration: none;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); color: #fff; }
.btn-ghost { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--surface-2); border-color: rgba(161,98,7,0.4); color: var(--accent); }

/* ── Login page — keep dark ── */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: radial-gradient(ellipse at 50% 0%, rgba(161,98,7,0.08) 0%, #0a0904 60%);
}

.login-box {
  background: #131108;
  border: 1px solid #3a3418;
  border-radius: 16px;
  padding: 48px 40px;
  width: 100%;
  max-width: 420px;
  text-align: center;
  box-shadow: 0 0 60px rgba(161,98,7,0.06);
}

.login-logo {
  font-size: 18px;
  font-weight: 800;
  margin-bottom: 8px;
  background: linear-gradient(90deg, #e8e0c0 0%, #d4a843 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.login-subtitle {
  color: #706848;
  font-size: 14px;
  margin-bottom: 40px;
}

.btn-google {
  width: 100%;
  justify-content: center;
  background: white;
  color: #111;
  font-size: 15px;
  padding: 14px;
  border-radius: 10px;
  margin-bottom: 16px;
}
.btn-google:hover { background: #f0f0f0; }
.btn-google img { width: 20px; }

.login-note {
  font-size: 12px;
  color: #706848;
  line-height: 1.6;
}

.error-msg {
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.3);
  color: #dc2626;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 20px;
  display: none;
}

/* ── Download item ── */
.download-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}
.download-item:last-child { border-bottom: none; padding-bottom: 0; }
.download-item:first-child { padding-top: 0; }
.download-info { flex: 1; }
.download-name { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 2px; }
.download-meta { font-size: 12px; color: var(--text-muted); }

/* ── Changelog ── */
.changelog-item { padding: 20px 0; border-bottom: 1px solid var(--border); }
.changelog-item:last-child { border-bottom: none; }
.changelog-date { font-size: 12px; color: var(--text-muted); margin-bottom: 6px; }
.changelog-version { font-size: 15px; font-weight: 700; color: var(--text); margin-bottom: 8px; }
.changelog-list { padding-left: 16px; }
.changelog-list li { font-size: 13px; color: var(--text-muted); line-height: 1.8; }
.changelog-list li strong { color: var(--text); }

/* ── Loading ── */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  color: #706848;
  background: #0a0904;
  font-size: 14px;
}

/* ── Mobile topbar ── */
.mobile-topbar { display: none; }

@media (max-width: 768px) {
  /* Top bar */
  .mobile-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 56px;
    background: var(--sidebar-bg);
    border-bottom: 1px solid var(--sidebar-border);
    padding: 0 16px;
    z-index: 200;
  }
  .mobile-topbar-brand {
    font-size: 14px; font-weight: 700; color: #fff;
    display: flex; align-items: center; gap: 6px;
  }
  .mobile-hamburger {
    background: none; border: none;
    color: #fff; font-size: 22px;
    cursor: pointer; padding: 6px 8px;
    line-height: 1;
  }

  /* Sidebar — slide in */
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    z-index: 300;
  }
  .sidebar.open { transform: translateX(0); }

  /* Overlay */
  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 250;
  }
  .sidebar-overlay.open { display: block; }

  /* Main content */
  .main { margin-left: 0; padding: 72px 16px 24px; max-width: 100vw; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}
