/* ─────────────────────────────────────────────────────────────────────
   MCP Portal — shared stylesheet
   Mirrors the Michaelhouse Portal (mhs-portal) brand tokens so the gateway
   matches the SSO shell users launch it from. Single source of truth for
   all server-rendered pages — keep in sync with
   mhs-portal/client/src/styles/variables.css.
   ───────────────────────────────────────────────────────────────────── */

:root {
  /* Michaelhouse brand colours */
  --mhs-red: #e13a3e;
  --mhs-red-dark: #c4292d;
  --mhs-blue: #23346a;
  --mhs-blue-dark: #1a2750;
  --mhs-white: #ffffff;
  --mhs-grey: #a7a9ac;
  --mhs-grey-light: #d1d3d4;
  --mhs-bg: #f4f5f7;

  /* Semantic */
  --color-success: #2e7d32;
  --color-success-bg: #e8f5e9;
  --color-warning: #f57c00;
  --color-warning-bg: #fff3e0;
  --color-error: #e13a3e;
  --color-error-bg: #fce4ec;
  --color-info: #1976d2;
  --color-info-bg: #e3f2fd;

  /* Typography */
  --font-heading: "Orpheus Pro", Georgia, "Times New Roman", serif;
  --font-body: "Franklin Gothic Medium", -apple-system, BlinkMacSystemFont,
    "Segoe UI", Roboto, sans-serif;
  /* Legacy aliases — referenced by inline styles in server-rendered pages */
  --font-serif: var(--font-heading);
  --font-sans: var(--font-body);

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;

  /* Border radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-full: 50%;
}

/* ── Reset & base ─────────────────────────────────────────────────── */

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  background: var(--mhs-bg);
  color: #1a1a1a;
  line-height: 1.5;
  min-height: 100dvh;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.2;
}

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

button {
  font-family: var(--font-body);
  cursor: pointer;
  border: none;
  font-size: 1rem;
}

input, select, textarea {
  font-family: var(--font-body);
  font-size: 1rem;
}

/* ── Header (red, sticky — matches mhs-portal) ────────────────────── */

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-sm) var(--space-xl);
  background: var(--mhs-red);
  color: var(--mhs-white);
  min-height: 56px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-left {
  display: flex;
  align-items: center;
}

.header-left a {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  color: var(--mhs-white);
  text-decoration: none;
}

.header-left img {
  /* Negative (white) crest on the red header — per brand guidelines,
     the logo is never placed in a container shape. */
  height: 36px;
  width: auto;
  object-fit: contain;
}

.header-left h1 {
  font-family: var(--font-heading);
  font-size: 1.125rem;
  font-weight: 700;
  white-space: nowrap;
}

.header-right {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  font-size: 0.875rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.header-right a {
  color: var(--mhs-white);
  opacity: 0.85;
  font-weight: 600;
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-sm);
  transition: opacity 0.15s, background 0.15s;
}

.header-right a:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.12);
}

.header-right a.active {
  opacity: 1;
  background: rgba(255, 255, 255, 0.15);
}

/* ── Layout ───────────────────────────────────────────────────────── */

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

.section-title {
  font-family: var(--font-heading);
  font-size: 1.125rem;
  color: var(--mhs-blue);
  margin-bottom: 0.75rem;
}

/* ── Cards ────────────────────────────────────────────────────────── */

.card,
.stat {
  background: var(--mhs-white);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.card { margin-bottom: 1.5rem; }

/* ── Tables ───────────────────────────────────────────────────────── */

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}

th {
  text-align: left;
  padding: 0.625rem 0.75rem;
  border-bottom: 2px solid var(--mhs-bg);
  color: var(--mhs-blue);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

td {
  padding: 0.625rem 0.75rem;
  border-bottom: 1px solid var(--mhs-bg);
  vertical-align: top;
}

tr:hover td { background: rgba(0, 0, 0, 0.015); }

/* ── Badges (semantic, token-driven) ──────────────────────────────── */

.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 10px;
  font-size: 0.6875rem;
  font-weight: 600;
}

.badge-green  { background: var(--color-success-bg); color: var(--color-success); }
.badge-red    { background: var(--color-error-bg);   color: var(--color-error); }
.badge-blue   { background: var(--color-info-bg);    color: var(--color-info); }
.badge-orange { background: var(--color-warning-bg); color: var(--color-warning); }
.badge-grey   { background: #f5f5f5;                 color: #757575; }

/* ── Pagination ───────────────────────────────────────────────────── */

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 1rem;
  font-size: 0.8125rem;
  color: var(--mhs-grey);
}

.pagination a {
  padding: 0.4rem 1rem;
  border: 1px solid var(--mhs-grey-light);
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--mhs-blue);
  font-size: 0.8125rem;
  transition: all 0.15s;
}

.pagination a:hover { border-color: var(--mhs-blue); background: var(--mhs-bg); }

/* ── Utilities ────────────────────────────────────────────────────── */

.mono { font-family: "SF Mono", "Fira Code", monospace; font-size: 0.75rem; }
.text-grey { color: var(--mhs-grey); }
.text-sm { font-size: 0.75rem; }

/* ── Login card (landing page) ────────────────────────────────────── */

.login {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-xl) var(--space-md);
  background: var(--mhs-bg);
}

.login__card {
  background: var(--mhs-white);
  border-radius: var(--radius-lg);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  padding: var(--space-xl);
  max-width: 400px;
  width: 100%;
  text-align: center;
}

.login__logo {
  width: 96px;
  height: 96px;
  object-fit: contain;
  margin: 0 auto var(--space-md);
  display: block;
}

.login__title {
  font-family: var(--font-heading);
  color: var(--mhs-blue);
  font-size: 1.75rem;
  margin-bottom: var(--space-xs);
}

.login__subtitle {
  color: var(--mhs-grey);
  font-size: 0.875rem;
  margin-bottom: var(--space-lg);
  line-height: 1.5;
}

.login__sso {
  display: block;
  width: 100%;
  background: var(--mhs-red);
  color: var(--mhs-white);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-weight: 700;
  transition: background 0.15s;
}

.login__sso:hover { background: var(--mhs-red-dark); }

.login__footer {
  margin-top: var(--space-lg);
  font-size: 0.75rem;
  color: var(--mhs-grey);
  text-align: center;
}
