:root {
  --navy: #12203A;
  --navy-deep: #0B1730;
  --gold: #C4A265;
  --gold-soft: #E8D5A8;
  --gold-dim: #8A6A2A;
  --text: #12203A;
  --muted: #6B7289;
  --line: #E6E8EE;
  --card: #FFFFFF;
  --bg: #F7F8FB;
  --shadow: 0 8px 28px rgba(18, 32, 58, 0.06);
  --shadow-hover: 0 14px 36px rgba(18, 32, 58, 0.10);
  --radius: 18px;
  --font: "DM Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); font-family: var(--font); -webkit-font-smoothing: antialiased; }
body { min-height: 100vh; overflow-x: hidden; }
button, a.btn { font: inherit; }
.boot-msg { min-height: 100vh; display: flex; align-items: center; justify-content: center; color: var(--muted); letter-spacing: .16em; font-size: 12px; text-transform: uppercase; }

/* Top bar */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 28px; background: rgba(255,255,255,.92); border-bottom: 1px solid var(--line); backdrop-filter: blur(10px); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--navy); font-weight: 600; font-size: 16px; letter-spacing: -0.01em; }
.brand-mark { width: 32px; height: 32px; flex-shrink: 0; }
.userbox { display: flex; align-items: center; gap: 10px; position: relative; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--navy); color: #fff; display: grid; place-items: center; font-size: 13px; font-weight: 600; letter-spacing: .02em; }
.uname { font-size: 14px; font-weight: 500; color: var(--navy); }
.user-toggle { display: flex; align-items: center; gap: 8px; background: none; border: 0; padding: 4px 2px 4px 4px; cursor: pointer; border-radius: 999px; color: inherit; }
.user-toggle:hover, .user-toggle:focus { background: #F1F3F7; outline: none; }
.chev { width: 16px; height: 16px; color: var(--muted); transition: transform .15s; }
.userbox.open .chev { transform: rotate(180deg); }
.menu { position: absolute; right: 0; top: calc(100% + 8px); min-width: 160px; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-hover); padding: 6px; display: none; }
.userbox.open .menu { display: block; }
.menu button { width: 100%; text-align: left; background: none; border: 0; padding: 9px 12px; border-radius: 8px; cursor: pointer; font-size: 14px; color: var(--navy); }
.menu button:hover, .menu button:focus { background: #F4F5F8; outline: none; }

/* Sign in */
.signin { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 28px 16px; }
.signbox { width: 100%; max-width: 420px; text-align: center; background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 36px 28px 32px; box-shadow: var(--shadow); }
.signbox .brand { justify-content: center; margin-bottom: 18px; }
.signbox h1 { font-size: 26px; margin: 0 0 8px; letter-spacing: -0.03em; color: var(--navy-deep); }
.signbox p { font-size: 14px; color: var(--muted); margin: 0 0 24px; line-height: 1.55; }
.btn { border: 1px solid var(--line); background: #fff; color: var(--navy); border-radius: 12px; padding: 11px 16px; font-size: 14px; font-weight: 600; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 10px; }
.btn.primary { border-color: var(--navy); background: var(--navy); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }
.btn:disabled { opacity: .55; cursor: default; }
.signbox .btn { width: 100%; padding: 13px 16px; font-size: 15px; }
.ms-icon { width: 16px; height: 16px; }
.signerr { color: #9A6B12; font-size: 13px; margin-top: 16px; line-height: 1.4; }

/* Portal */
.page { max-width: 1180px; margin: 0 auto; padding: 36px 28px 64px; }
.hello { font-size: clamp(28px, 5vw, 40px); font-weight: 700; letter-spacing: -0.035em; color: var(--navy-deep); margin: 0 0 6px; line-height: 1.15; }
.sub { font-size: 16px; color: var(--muted); margin: 0 0 28px; }
.modules { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 18px; }
.module, .soon { display: flex; flex-direction: column; text-decoration: none; color: var(--text); background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 20px 20px; box-shadow: var(--shadow); min-height: 196px; position: relative; }
a.module { cursor: pointer; transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease; }
a.module:hover, a.module:focus { transform: translateY(-2px); box-shadow: var(--shadow-hover); border-color: #D5D8E0; outline: none; }
.module.featured { background:
    radial-gradient(120% 80% at 100% 100%, rgba(196,162,101,.22) 0%, rgba(196,162,101,0) 55%),
    linear-gradient(165deg, #FFFFFF 0%, #FBF6EC 55%, #F4EBDA 100%);
  border-color: #E4D3A8;
}
.icon { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: #F3F4F8; color: var(--navy); margin-bottom: 18px; }
.module.featured .icon { background: #F3E6C4; color: #8A6A2A; box-shadow: 0 0 0 6px rgba(196,162,101,.12); }
.mname { font-size: 20px; font-weight: 700; letter-spacing: -0.02em; margin: 0; }
.mdetail { font-size: 14px; color: var(--muted); margin-top: 8px; line-height: 1.45; flex: 1; }
.mmeta { margin-top: 14px; font-size: 12.5px; font-weight: 600; color: var(--navy); letter-spacing: -0.01em; }
.mmeta span { color: var(--muted); font-weight: 500; }
.badge { display: inline-flex; align-items: center; gap: 6px; margin-top: 16px; font-size: 12.5px; font-weight: 600; color: var(--gold-dim); }
.badge svg { width: 14px; height: 14px; }
.soon-flag { position: absolute; top: 16px; right: 16px; display: inline-flex; align-items: center; gap: 6px; background: #F1F3F7; color: #6B7289; font-size: 11.5px; font-weight: 500; padding: 5px 10px; border-radius: 999px; }
.soon { opacity: .92; cursor: default; }
.soon .icon { color: #6B7289; }
.empty { font-size: 14px; color: var(--muted); background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 20px; box-shadow: var(--shadow); grid-column: 1 / -1; }

@media (max-width: 640px) {
  .topbar { padding: 12px 16px; }
  .page { padding: 24px 16px 48px; }
  .hello { font-size: 28px; }
  .uname { display: none; }
  .modules { grid-template-columns: 1fr; gap: 14px; }
  .module, .soon { min-height: 168px; }
}
