:root {
  --bg: #f4f4f5;
  --card: #ffffff;
  --text: #0a0a0a;
  --muted: #6b7280;
  --border: #e5e5e5;
  /* Brand (RadioManager): Violet #7C3AED primary (distinct from OM aqua), Nunito. */
  --brand: #7c3aed;
  --brand-dark: #5b21b6;
  --accent: #7c3aed;
  --accent-text: #ffffff;

  /* Brand quadrant colours (from the OM infographic) */
  --brand-blue: #35bced;    /* Media Agency  */
  --brand-magenta: #df5fc4; /* Media Owner   */
  --brand-green: #8bc53f;   /* Advertiser    */
  --brand-orange: #f9a825;  /* Municipality  */
  --danger: #c0392b;

  --error-bg: #fdecec;
  --error-text: #9b1c1c;
  --success-bg: #eaf7ef;
  --success-text: #1f6f43;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0b0d;
    --card: #161619;
    --text: #f4f4f5;
    --muted: #9ca3af;
    --border: #2a2a2e;
    --accent: #8b5cf6;
    --accent-text: #ffffff;
    --error-bg: #3a1f1f;
    --error-text: #ffb3b3;
    --success-bg: #16311f;
    --success-text: #9fe3bb;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Nunito", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-weight: 400;
  background: var(--bg);
  color: var(--text);
}
/* Brand type scale: Heading 1 = Extra Bold (800), Heading 2/3 = Bold/ExtraBold. */
h1 { font-weight: 800; letter-spacing: -0.01em; }
h2, h3 { font-weight: 800; }
a { color: var(--text); }

/* ---- Brand / logo ---- */
.om-mark { height: 26px; width: auto; max-width: 100%; display: block; }
.rm-word { font-size: 20px; font-weight: 800; letter-spacing: -.01em; color: var(--brand); display: inline-block; }
.rm-word b { font-weight: 800; color: var(--text); }
.auth-hero .rm-word { font-size: clamp(28px, 7vw, 46px); }
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--brand);
  text-decoration: none;
  font-weight: 800;
}
.brand-word { font-size: 15px; letter-spacing: .02em; }

.auth-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  margin: 8px 0 34px;
}
.auth-hero .om-mark { height: auto; width: min(380px, 82%); }
.om-pill {
  background: var(--brand);
  color: #00332e;
  font-weight: 800;
  letter-spacing: .22em;
  font-size: 15px;
  padding: 9px 14px 9px 20px;
  border-radius: 10px;
  text-transform: uppercase;
}

/* ---- Top bar ---- */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 24px;
  background: var(--card);
  border-bottom: 3px solid transparent;
  border-image: linear-gradient(90deg, var(--brand), var(--brand-dark)) 1;
}
.topbar nav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.topbar nav a {
  color: var(--text); text-decoration: none; font-size: .86rem; font-weight: 600;
  padding: 7px 13px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--bg); transition: background .15s, color .15s, border-color .15s;
}
.topbar nav a:hover { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.who { color: var(--muted); font-size: 0.85rem; font-weight: 600; }

.wrap { max-width: 820px; margin: 0 auto; padding: 32px 20px 60px; }

h1 { margin-top: 0; }
.lede { color: var(--muted); }
.hint { color: var(--muted); font-size: 0.85rem; font-weight: normal; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 28px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.card label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-weight: 600;
  font-size: 0.9rem;
}
.card .row { display: flex; gap: 14px; }
.card .row label { flex: 1; }
input, select, textarea {
  font: inherit;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--brand-blue);
  outline-offset: 1px;
  border-color: var(--brand-blue);
}
button, .button {
  align-self: flex-start;
  background: var(--accent);
  color: var(--accent-text);
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
button:hover, .button:hover { opacity: .9; }
button.danger, .button.danger { background: var(--danger); color: #fff; }
.btn-google {
  background: #fff; color: #1f1f1f; border: 1px solid #dadce0; font-weight: 600;
  padding-left: 44px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 48 48'%3E%3Cpath fill='%23EA4335' d='M24 9.5c3.5 0 6.6 1.2 9.1 3.6l6.8-6.8C35.9 2.4 30.3 0 24 0 14.6 0 6.5 5.4 2.5 13.2l7.9 6.1C12.3 13.2 17.7 9.5 24 9.5z'/%3E%3Cpath fill='%234285F4' d='M46.1 24.5c0-1.6-.1-3.1-.4-4.5H24v9h12.4c-.5 2.9-2.1 5.3-4.6 7l7.1 5.5c4.1-3.8 6.5-9.4 6.5-16z'/%3E%3Cpath fill='%23FBBC05' d='M10.4 28.3c-.5-1.5-.8-3.1-.8-4.8s.3-3.3.8-4.8l-7.9-6.1C.9 16.1 0 19.9 0 24s.9 7.9 2.5 11.4l7.9-7.1z'/%3E%3Cpath fill='%2334A853' d='M24 48c6.3 0 11.6-2.1 15.5-5.7l-7.1-5.5c-2 1.3-4.5 2.1-8.4 2.1-6.3 0-11.7-3.7-13.6-9.3l-7.9 7.1C6.5 42.6 14.6 48 24 48z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: 16px center;
}
.btn-google:hover { opacity: 1; background-color: #f7f8f8; }
.link-btn {
  background: none;
  border: none;
  color: var(--danger);
  padding: 0;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
}
form.inline { display: inline; margin-left: 10px; }
/* Compact table-row action button (e.g. admin "Log in as") */
.btn-sm { padding: 5px 12px; font-size: .8rem; border-radius: 7px; align-self: auto; }
/* Admin impersonation exit button in the top bar */
.topbar-app .top-actions form.inline { margin: 0; }
.view-exit { padding: 6px 12px; font-size: .85rem; border-radius: 8px; align-self: auto; }

.thumb { max-width: 220px; border-radius: 8px; border: 1px solid var(--border); }

.flash { padding: 12px 16px; border-radius: 8px; margin-bottom: 20px; }
.flash-error { background: var(--error-bg); color: var(--error-text); }
.flash-success, .flash-info { background: var(--success-bg); color: var(--success-text); }

.stats { display: flex; gap: 14px; margin-bottom: 20px; flex-wrap: wrap; }
.stat {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 20px;
  min-width: 110px;
  text-align: center;
}
.stat strong { display: block; font-size: 1.6rem; }
.stat span { color: var(--muted); font-size: 0.85rem; }

.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 10px; border-bottom: 1px solid var(--border); font-size: 0.92rem; }
.table th { color: var(--muted); font-weight: 600; text-transform: uppercase; font-size: 0.72rem; letter-spacing: .04em; }

.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 700;
  background: var(--border);
  color: var(--text);
  text-transform: capitalize;
}
.badge-certified { background: rgba(139, 197, 63, .18); color: #4e7a10; }
.badge-submitted { background: rgba(249, 168, 37, .18); color: #9a6800; }
.badge-pending, .badge-draft { background: var(--border); color: var(--muted); }
.badge-rejected, .badge-expired { background: var(--error-bg); color: var(--error-text); }
@media (prefers-color-scheme: dark) {
  .badge-certified { color: #b6e58a; }
  .badge-submitted { color: #f6c667; }
}

/* ---- Logged-in sidebar shell (global left menu) ---- */
body.app { margin: 0; }
.app { display: flex; min-height: 100vh; align-items: stretch; }
.side {
  flex: 0 0 220px; width: 220px; background: var(--card);
  border-right: 1px solid var(--border); padding: 18px 12px;
  display: flex; flex-direction: column; gap: 4px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.side .brand { margin: 0 8px 18px; }
.side nav { display: flex; flex-direction: column; gap: 4px; }
.side nav a {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border-radius: 8px; color: var(--text); text-decoration: none;
  font-weight: 600; font-size: .92rem;
}
.side nav a:hover { background: var(--bg); }
.side nav a.active { background: var(--accent); color: var(--accent-text); }
.side nav a .ico { width: 1.3em; text-align: center; font-size: 1.05em; }
.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar-app {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 12px 24px; background: var(--card);
  border-bottom: 3px solid transparent;
  border-image: linear-gradient(90deg, var(--brand), var(--brand-dark)) 1;
}
.topbar-app .who { color: var(--muted); font-weight: 600; font-size: .9rem; }
.topbar-app .top-actions { display: flex; gap: 8px; }
.topbar-app .top-actions a {
  color: var(--text); text-decoration: none; font-size: .85rem; font-weight: 600;
  padding: 6px 12px; border: 1px solid var(--border); border-radius: 8px;
}
.topbar-app .top-actions a:hover { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
@media (max-width: 860px) {
  .app { display: block; }
  .side { position: static; width: auto; height: auto; flex-direction: row; flex-wrap: wrap;
          border-right: none; border-bottom: 1px solid var(--border); }
  .side .brand { flex-basis: 100%; margin-bottom: 8px; }
  .side nav { flex-direction: row; flex-wrap: wrap; }
}

/* 2026-10-19: fluid layout, never a sideways page scroll. Filter rows wrap to the available
   width instead of overflowing; wide tables scroll inside their own box. */
html, body { max-width: 100%; overflow-x: hidden; }
*, *::before, *::after { box-sizing: border-box; }
.main-col, .wrap, .card { max-width: 100%; min-width: 0; }
.card .row { flex-wrap: wrap; }
.card .row label, .card .row > div { flex: 1 1 200px; min-width: 0; }
input, select, textarea { max-width: 100%; }
.table { max-width: 100%; }
.table th, .table td { overflow-wrap: anywhere; }
img, iframe, #map { max-width: 100%; }
