:root {
  --navy: #0a2a4e;
  --navy-700: #103a66;
  --navy-300: #2d5b8e;
  --red: #e23b33;
  --page: #f4f6f9;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #e5e7eb;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--page);
  color: var(--text);
}

/* ---- Top bar ---- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
}
.topbar-brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--text); }
.topbar-logo { height: 34px; width: auto; display: block; }
.topbar-title { font-weight: 600; font-size: 15px; color: var(--navy); border-left: 1px solid var(--border); padding-left: 12px; }
.topbar-user { display: flex; align-items: center; gap: 16px; font-size: 14px; }
.topbar-username { color: var(--muted); }
.topbar-signout { color: var(--red); text-decoration: none; font-weight: 600; }
.topbar-signout:hover { text-decoration: underline; }

/* ---- Content & footer ---- */
.content { flex: 1; width: 100%; max-width: 1080px; margin: 0 auto; padding: 32px 24px; }
.footer { text-align: center; padding: 18px; color: var(--muted); font-size: 12px; border-top: 1px solid var(--border); background: var(--card); }

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  padding: 11px 18px; border-radius: 8px; font-weight: 600; font-size: 14px;
  text-decoration: none; cursor: pointer; border: 1px solid transparent;
  transition: background .15s, border-color .15s;
}
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-700); }
.btn-ghost { background: transparent; color: var(--navy); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--navy-300); }

/* ---- Landing / sign-in ---- */
body.page-landing { background: linear-gradient(135deg, #08203c, #0a2a4e 55%, #103a66); }
.page-landing .topbar, .page-landing .footer { display: none; }
.page-landing .content { max-width: none; display: flex; align-items: center; justify-content: center; padding: 24px; }
.signin-card {
  background: var(--card); width: 100%; max-width: 400px; padding: 40px 36px;
  border-radius: 16px; box-shadow: 0 24px 70px rgba(0, 0, 0, .4); text-align: center;
}
.signin-logo { height: 48px; width: auto; margin-bottom: 18px; }
.signin-card h1 { margin: 6px 0; font-size: 24px; color: var(--navy); }
.subtitle { color: var(--muted); margin: 0 0 26px; }
.signin-foot { margin-top: 20px; font-size: 12px; color: var(--muted); }
.signin-card .btn-primary { width: 100%; }

.ms-logo {
  width: 18px; height: 18px; flex: none;
  background:
    linear-gradient(to right, #f25022 50%, #7fba00 50%) top / 100% 50% no-repeat,
    linear-gradient(to right, #00a4ef 50%, #ffb900 50%) bottom / 100% 50% no-repeat;
  background-color: #fff; padding: 1px; border-radius: 2px;
}

/* ---- Hub / app grid ---- */
.hub-head h1 { font-size: 24px; margin: 0 0 4px; color: var(--navy); }
.hub-sub { color: var(--muted); margin: 0 0 24px; }
.app-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }
.app-card { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 20px; display: flex; flex-direction: column; }
.app-card-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.app-icon { width: 44px; height: 44px; border-radius: 10px; background: var(--navy); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 20px; }
.app-icon-muted { background: var(--page); color: var(--muted); border: 1px dashed var(--border); }
.app-name { font-size: 17px; margin: 0 0 6px; color: var(--text); }
.app-desc { color: var(--muted); font-size: 14px; line-height: 1.5; margin: 0 0 18px; flex: 1; }
.app-open { align-self: flex-start; }
.app-placeholder { border-style: dashed; }
.app-placeholder .app-name, .app-placeholder .app-desc { color: var(--muted); }

/* Badges */
.badge { font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: 999px; text-transform: uppercase; letter-spacing: .03em; }
.badge-available { background: #e7f6ec; color: #1d7a3e; }
.badge-in_development { background: #fdf0d5; color: #9a6700; }
.badge-coming_soon { background: #eef0f3; color: #5f6b7a; }

/* ---- App page ---- */
.back-link { color: var(--navy); text-decoration: none; font-size: 14px; font-weight: 600; }
.back-link:hover { text-decoration: underline; }
.app-page-title { color: var(--navy); margin: 16px 0 4px; }
.notice { margin-top: 22px; background: #fdf0d5; border: 1px solid #f0d9a0; color: #7a5b00; padding: 16px 18px; border-radius: 12px; font-size: 14px; line-height: 1.6; }
.notice-error { background: #fdeaea; border-color: #f0caca; color: #992222; }
code { background: #eef0f3; padding: 1px 5px; border-radius: 4px; font-size: 13px; }

/* ---- Audit results ---- */
.metrics { display: flex; flex-wrap: wrap; gap: 14px; margin: 22px 0 8px; }
.metric { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 14px 20px; min-width: 110px; display: flex; flex-direction: column; gap: 4px; }
.metric-num { font-size: 26px; font-weight: 700; color: var(--navy); }
.metric-label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.metric-warn .metric-num { color: var(--red); }
.audit-section { margin-top: 30px; }
.audit-section h2 { font-size: 17px; color: var(--navy); margin: 0 0 12px; }
.audit-table { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; font-size: 14px; }
.audit-table th, .audit-table td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.audit-table th { background: #f8fafc; color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; }
.audit-table tr:last-child td { border-bottom: none; }
.empty { color: var(--muted); font-size: 14px; }
.hint { color: var(--muted); font-size: 12px; margin-top: 8px; }
