/* smsportal design system. Colors are initial approximations from the UNISA logo; keep them here so
   brand-approved values can be substituted without touching views. */
:root {
  --brand-navy: #152d78;
  --brand-navy-dark: #0d1d52;
  --brand-gold: #b5a167;
  --brand-gold-dark: #897746;
  --brand-white: #ffffff;
  --surface-light: #f5f6f8;
  --border-light: #d8dce3;
  --text-primary: #1d2433;
  --text-muted: #5c6575;
  --success: #287a4b;
  --warning: #a86600;
  --danger: #b4232d;
  --info: #2864a8;

  --radius: 8px;
  --shadow-sm: 0 1px 2px rgba(13, 29, 82, 0.08);
  --shadow-md: 0 2px 8px rgba(13, 29, 82, 0.10);
  --focus-ring: 0 0 0 3px rgba(21, 45, 120, 0.35);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text-primary);
  background: var(--surface-light);
  line-height: 1.5;
}

a { color: var(--brand-navy); }
a:hover { color: var(--brand-navy-dark); }

h1, h2, h3 { color: var(--brand-navy); line-height: 1.25; }

/* Visible keyboard focus everywhere. */
:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: 4px; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ---- Header / navigation ---- */
.app-header {
  background: var(--brand-navy);
  color: var(--brand-white);
  border-bottom: 3px solid var(--brand-gold);
}
.app-header__bar {
  max-width: 1200px; margin: 0 auto; padding: 0.6rem 1rem;
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
}
.app-brand { display: flex; align-items: center; gap: 0.6rem; text-decoration: none; color: var(--brand-white); }
.app-brand__logo { height: 40px; width: auto; max-width: 160px; display: block; }
.app-brand__name { font-weight: 700; font-size: 1.1rem; letter-spacing: 0.02em; }
.app-nav { display: flex; gap: 0.25rem; flex-wrap: wrap; margin-left: auto; }
.app-nav a {
  color: var(--brand-white); text-decoration: none; padding: 0.4rem 0.7rem;
  border-radius: var(--radius); font-size: 0.95rem;
}
.app-nav a:hover { background: rgba(255, 255, 255, 0.12); color: var(--brand-white); }
.app-nav a.is-active { background: var(--brand-gold); color: var(--brand-navy-dark); font-weight: 600; }

.env-badge {
  background: var(--warning); color: #fff; font-size: 0.72rem; font-weight: 700;
  padding: 0.15rem 0.5rem; border-radius: 999px; text-transform: uppercase; letter-spacing: 0.04em;
}
.user-menu { display: flex; align-items: center; gap: 0.6rem; font-size: 0.9rem; }
.user-menu__name { color: var(--brand-white); }

/* ---- Layout ---- */
.app-main { max-width: 1200px; margin: 1.25rem auto; padding: 0 1rem; }
.breadcrumbs { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 0.75rem; }
.breadcrumbs a { color: var(--text-muted); }
.breadcrumbs [aria-current="page"] { color: var(--text-primary); font-weight: 600; }

.app-footer {
  max-width: 1200px; margin: 2rem auto 1rem; padding: 1rem; color: var(--text-muted);
  font-size: 0.82rem; border-top: 1px solid var(--border-light);
  display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
}

/* ---- Cards / tables / forms ---- */
.card {
  background: var(--brand-white); border: 1px solid var(--border-light);
  border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 1.25rem; margin-bottom: 1.25rem;
}
.card__title { margin: 0 0 0.75rem; font-size: 1.15rem; }

.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
table.data caption { text-align: left; color: var(--text-muted); font-size: 0.85rem; padding-bottom: 0.4rem; }
table.data th, table.data td { text-align: left; padding: 0.55rem 0.65rem; border-bottom: 1px solid var(--border-light); }
table.data thead th { color: var(--brand-navy); border-bottom: 2px solid var(--brand-gold); white-space: nowrap; }
table.data tbody tr:nth-child(even) { background: var(--surface-light); }

label { display: block; font-weight: 600; margin-bottom: 0.25rem; color: var(--text-primary); }
.form-field { margin-bottom: 1rem; }
input, select, textarea {
  width: 100%; padding: 0.5rem 0.6rem; border: 1px solid var(--border-light);
  border-radius: 6px; font: inherit; color: var(--text-primary); background: #fff;
}
.form-row { display: flex; gap: 1rem; flex-wrap: wrap; }
.form-row > .form-field { flex: 1 1 220px; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; gap: 0.4rem; cursor: pointer;
  padding: 0.5rem 0.95rem; border-radius: var(--radius); border: 1px solid transparent;
  font: inherit; font-weight: 600; text-decoration: none;
}
.btn-primary { background: var(--brand-navy); color: #fff; }
.btn-primary:hover { background: var(--brand-navy-dark); color: #fff; }
.btn-secondary { background: #fff; color: var(--brand-navy); border-color: var(--brand-navy); }
.btn-secondary:hover { background: var(--surface-light); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(0.94); }
.btn:not(.btn-primary):not(.btn-danger) { background: #fff; color: var(--brand-navy); border-color: var(--brand-navy); }
.btn-row { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-bottom: 0.75rem; }
.inline-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0.6rem; margin-top: 0.75rem; }
.inline-form .form-field { margin-bottom: 0; }

/* ---- Status badges: color + text + icon, never color alone ---- */
.badge {
  display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.78rem; font-weight: 700;
  padding: 0.12rem 0.5rem; border-radius: 999px; border: 1px solid; white-space: nowrap;
}
.badge::before { font-weight: 700; }
.badge-neutral { color: var(--text-muted); border-color: var(--border-light); background: var(--surface-light); }
.badge-neutral::before { content: "•"; }
.badge-success { color: var(--success); border-color: var(--success); background: #eaf5ee; }
.badge-success::before { content: "✓"; }
.badge-warning { color: var(--warning); border-color: var(--warning); background: #fbf1e0; }
.badge-warning::before { content: "▲"; }
.badge-danger { color: var(--danger); border-color: var(--danger); background: #fbe9ea; }
.badge-danger::before { content: "✕"; }
.badge-info { color: var(--info); border-color: var(--info); background: #e8f0f9; }
.badge-info::before { content: "→"; }

/* ---- Alerts / validation ---- */
.alert { border-radius: var(--radius); padding: 0.75rem 1rem; margin-bottom: 1rem; border: 1px solid; }
.alert-danger { color: var(--danger); border-color: var(--danger); background: #fbe9ea; }
.alert-success { color: var(--success); border-color: var(--success); background: #eaf5ee; }
.validation-summary { color: var(--danger); }
.validation-summary ul { margin: 0.25rem 0 0 1rem; }
.field-error { color: var(--danger); font-size: 0.85rem; margin-top: 0.2rem; }

/* ---- Misc ---- */
.empty-state { text-align: center; color: var(--text-muted); padding: 2rem 1rem; }
.masked { font-variant-numeric: tabular-nums; letter-spacing: 0.02em; }
.muted { color: var(--text-muted); }
.pagination { display: flex; gap: 0.5rem; align-items: center; margin-top: 1rem; font-size: 0.9rem; }
.dashboard-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 1rem; }
.tile { display: block; text-decoration: none; color: inherit; }
.tile:hover { box-shadow: var(--shadow-md); }
.tile__label { color: var(--brand-navy); font-weight: 700; }
.skip-link { position: absolute; left: -999px; }
.skip-link:focus { left: 0.5rem; top: 0.5rem; background: #fff; padding: 0.5rem; z-index: 10; }
