:root {
  --ma-blue: #004AAD;
  --ma-blue-dark: #003d91;
  --ma-blue-soft: rgba(0, 74, 173, 0.08);
  --ma-bg: #f5f8fc;
  --ma-surface: #ffffff;
  --ma-border: rgba(0, 74, 173, 0.12);
  --ma-text: #1A1A1A;
  --ma-muted: #666666;
  --ma-accent: #004AAD;
  --ma-accent-2: #004AAD;
  --ma-danger: #b42318;
  --ma-success: #067647;
  --ma-warn: #b54708;
  --ma-radius: 14px;
  --ma-shadow: 0 10px 28px rgba(15, 40, 80, 0.08);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--ma-bg);
  color: var(--ma-text);
  line-height: 1.5;
}
a { color: var(--ma-blue); text-decoration: none; }
a:hover { text-decoration: underline; }

.ma-login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at top right, rgba(0, 74, 173, 0.16), transparent 42%),
    linear-gradient(160deg, #eaf1fb 0%, #f7faff 45%, #eef3fa 100%);
  padding: 1.5rem;
}
.ma-login-wrap--site {
  min-height: calc(100vh - 220px);
  padding: 2.5rem 1.5rem;
}

/* Media pages inside the public CIREP chrome */
body.ma-body,
body:has(.ma-site-wrap) {
  background: #eef3f9 !important;
}

.ma-site-wrap {
  width: min(1080px, calc(100% - 2rem));
  margin: 1.5rem auto 2.5rem;
  padding: 0;
  min-height: auto;
}

.ma-site-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin-bottom: 1rem;
  padding: 0.9rem 1.15rem;
  background: #004AAD;
  color: #fff;
  border-radius: 12px;
  box-shadow: 0 10px 24px rgba(0, 74, 173, 0.22);
}

.ma-site-bar-user {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 0.55rem;
  font-size: 0.92rem;
  color: rgba(255, 255, 255, 0.92);
}

.ma-site-bar-label { opacity: 0.8; }
.ma-site-bar-user strong { color: #fff; font-weight: 700; }
.ma-site-bar-email {
  opacity: 0.85;
  font-size: 0.86rem;
}

.ma-site-bar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.ma-panel {
  background: #fff;
  border: 1px solid rgba(0, 74, 173, 0.12);
  border-radius: 16px;
  padding: 1.35rem 1.4rem 1.5rem;
  box-shadow: 0 12px 32px rgba(15, 40, 80, 0.08);
}

.ma-site-wrap .ma-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.15rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(0, 74, 173, 0.1);
}

.ma-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin-bottom: 1rem;
}

.ma-field-label {
  display: block;
  margin: 0 0 0.35rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #004AAD;
}

.ma-search-wrap {
  flex: 1 1 260px;
  min-width: 0;
  max-width: 420px;
}

.ma-search-field {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.55rem 0.85rem;
  border: 1px solid rgba(0, 74, 173, 0.2);
  border-radius: 10px;
  background: #f7faff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.ma-search-field:focus-within {
  background: #fff;
  border-color: rgba(0, 74, 173, 0.45);
  box-shadow: 0 0 0 3px rgba(0, 74, 173, 0.12);
}

.ma-search-field svg {
  flex-shrink: 0;
  color: #004AAD;
  opacity: 0.75;
}

.ma-search-input {
  width: 100%;
  border: 0 !important;
  outline: none !important;
  background: transparent !important;
  box-shadow: none !important;
  padding: 0.1rem 0 !important;
  margin: 0 !important;
  font: inherit;
  font-size: 0.95rem;
  color: #1a1a1a;
}

.ma-toolbar-hint {
  margin: 0 0 0.35rem;
  font-size: 0.86rem;
  color: #667085;
}

.ma-site-wrap .ma-table th .ma-sort {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: 0;
  background: transparent;
  padding: 0;
  margin: 0;
  font: inherit;
  font-size: inherit;
  font-weight: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  color: inherit;
  cursor: pointer;
}

.ma-site-wrap .ma-table th .ma-sort:hover {
  color: #004AAD;
}

.ma-site-wrap .ma-table th .ma-sort[aria-pressed="true"] {
  color: #004AAD;
}

.ma-sort-ind {
  font-size: 0.85rem;
  line-height: 1;
  min-width: 0.7rem;
}

.ma-no-results {
  margin: 0.85rem 0 0;
  color: #667085;
  font-size: 0.92rem;
}

.ma-site-wrap .ma-header h1 {
  margin: 0;
  font-size: 1.55rem;
  letter-spacing: -0.02em;
  color: #004AAD;
}

.ma-site-wrap .ma-header p {
  margin: 0.3rem 0 0;
  color: #666;
  font-size: 0.92rem;
}

.ma-table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.ma-site-wrap .ma-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.ma-site-wrap .ma-table th,
.ma-site-wrap .ma-table td {
  text-align: left;
  padding: 0.85rem 0.6rem;
  border-bottom: 1px solid rgba(0, 74, 173, 0.1);
  vertical-align: middle;
}

.ma-site-wrap .ma-table th {
  color: #667085;
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.ma-site-wrap .ma-table tr:last-child td {
  border-bottom: 0;
}

.ma-site-wrap .ma-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0;
  align-items: center;
}

.ma-inline-form {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0;
}

/* Dedicated button system — avoids clash with site CSS */
.ma-site-wrap a.ma-btn,
.ma-site-wrap button.ma-btn,
.ma-modal a.ma-btn,
.ma-modal button.ma-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.55rem 1rem;
  border-radius: 999px;
  border: 1px solid transparent;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  text-decoration: none !important;
  box-shadow: none;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.ma-site-wrap a.ma-btn:hover,
.ma-site-wrap button.ma-btn:hover,
.ma-modal a.ma-btn:hover,
.ma-modal button.ma-btn:hover {
  text-decoration: none !important;
  transform: translateY(-1px);
}

.ma-btn--primary {
  background: #004AAD !important;
  color: #fff !important;
  border-color: #004AAD !important;
  box-shadow: 0 8px 18px rgba(0, 74, 173, 0.22);
}

.ma-btn--primary:hover {
  background: #003d91 !important;
}

.ma-btn--ghost {
  background: #fff !important;
  color: #004AAD !important;
  border-color: rgba(0, 74, 173, 0.28) !important;
}

.ma-site-bar .ma-btn--ghost {
  background: rgba(255, 255, 255, 0.12) !important;
  color: #fff !important;
  border-color: rgba(255, 255, 255, 0.35) !important;
}

.ma-site-bar .ma-btn--ghost:hover {
  background: rgba(255, 255, 255, 0.22) !important;
}

.ma-btn--danger {
  background: #b42318 !important;
  color: #fff !important;
  border-color: #b42318 !important;
}

.ma-btn--sm {
  padding: 0.35rem 0.7rem !important;
  font-size: 0.82rem !important;
  border-radius: 8px !important;
}

.ma-site-wrap .ma-form label {
  display: block;
  font-size: 0.9rem;
  margin: 0.85rem 0 0.3rem;
  color: #666;
  font-weight: 500;
}

.ma-site-wrap .ma-form input[type="text"],
.ma-site-wrap .ma-form input[type="url"],
.ma-site-wrap .ma-form input[type="email"],
.ma-site-wrap .ma-form input[type="password"],
.ma-site-wrap .ma-form textarea,
.ma-site-wrap .ma-form select {
  width: 100%;
  padding: 0.65rem 0.8rem;
  border: 1px solid rgba(0, 74, 173, 0.18);
  border-radius: 10px;
  background: #fff;
  font: inherit;
  color: #1a1a1a;
}

.ma-site-wrap .hint {
  font-size: 0.82rem;
  color: #666;
  margin-top: 0.25rem;
}

.ma-site-wrap .badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  font-size: 0.75rem;
  border-radius: 999px;
  background: #e8f5ee;
  color: #067647;
  font-weight: 600;
}

.ma-site-wrap .badge.inactive {
  background: #fef3e8;
  color: #b54708;
}

.ma-site-wrap .flash {
  padding: 0.8rem 1rem;
  margin-bottom: 1rem;
  border: 1px solid rgba(6, 118, 71, 0.2);
  background: #ecfdf3;
  color: #067647;
  border-radius: 12px;
}

.ma-site-wrap .flash.error {
  background: #fef3f2;
  color: #b42318;
  border-color: rgba(180, 35, 24, 0.2);
}

/* Admin View popup */
.ma-modal[hidden] { display: none !important; }
.ma-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  padding: 1rem;
}
.ma-modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(10, 24, 48, 0.55);
}
.ma-modal-dialog {
  position: relative;
  z-index: 1;
  width: min(520px, 100%);
  background: #fff;
  border-radius: 16px;
  padding: 1.35rem 1.35rem 1.5rem;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(0, 74, 173, 0.12);
}
.ma-modal-close {
  position: absolute;
  top: 0.55rem;
  right: 0.65rem;
  border: 0;
  background: transparent;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  color: #666;
}
.ma-modal-dialog h2 {
  margin: 0 1.5rem 0.25rem 0;
  font-size: 1.25rem;
  color: #004AAD;
}
.ma-modal-sub {
  margin: 0 0 1.1rem;
  color: #666;
  font-size: 0.95rem;
}
.ma-modal-actions {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.ma-modal-actions .ma-btn {
  width: 100%;
  border-radius: 10px !important;
}
.ma-modal-player { margin-top: 1rem; }
.ma-modal-frame {
  position: relative;
  width: 100%;
  padding-top: 56.25%;
  border-radius: 12px;
  overflow: hidden;
  background: #000;
}
.ma-modal-frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

@media (max-width: 700px) {
  .ma-site-wrap .ma-header {
    flex-direction: column;
    align-items: stretch;
  }
  .ma-site-wrap .ma-header .ma-btn {
    align-self: flex-start;
  }
}

.ma-login-card {
  width: min(440px, 100%);
  background: var(--ma-surface);
  border: 1px solid var(--ma-border);
  border-radius: 18px;
  padding: 2rem;
  box-shadow: var(--ma-shadow);
}
.ma-login-card h1 {
  margin: 0 0 0.35rem;
  font-size: 1.55rem;
  letter-spacing: -0.02em;
  color: var(--ma-blue);
}
.ma-login-card p { margin: 0 0 1.5rem; color: var(--ma-muted); font-size: 0.95rem; }

.ma-shell { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.ma-sidebar {
  background: linear-gradient(180deg, #004AAD 0%, #00367f 100%);
  color: #e8f0f5;
  padding: 1.5rem 1rem;
  box-shadow: 4px 0 24px rgba(0, 74, 173, 0.18);
}
.ma-sidebar .brand {
  display: block;
  font-weight: 700;
  font-size: 1.15rem;
  color: #fff;
  margin-bottom: 0.25rem;
  letter-spacing: -0.01em;
}
.ma-sidebar .brand-sub {
  font-size: 0.8rem;
  opacity: 0.8;
  margin-bottom: 1.5rem;
}
.ma-nav a {
  display: block;
  color: #dbe7f8;
  padding: 0.65rem 0.8rem;
  border-radius: 10px;
  margin-bottom: 0.25rem;
  font-weight: 500;
  transition: background 0.2s ease, color 0.2s ease;
}
.ma-nav a:hover, .ma-nav a.active {
  background: rgba(255,255,255,0.14);
  text-decoration: none;
  color: #fff;
}
.ma-user {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255,255,255,0.18);
  font-size: 0.85rem;
  opacity: 0.95;
}
.ma-main { padding: 1.75rem; }
.ma-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.ma-header h1 {
  margin: 0;
  font-size: 1.7rem;
  letter-spacing: -0.02em;
  color: var(--ma-blue);
}
.ma-header p { margin: 0.25rem 0 0; color: var(--ma-muted); }

.ma-card {
  background: var(--ma-surface);
  border: 1px solid var(--ma-border);
  border-radius: var(--ma-radius);
  padding: 1.25rem;
  margin-bottom: 1rem;
  box-shadow: var(--ma-shadow);
}
.ma-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.ma-stat {
  background: var(--ma-surface);
  border: 1px solid var(--ma-border);
  border-radius: var(--ma-radius);
  padding: 1rem 1.15rem;
  box-shadow: var(--ma-shadow);
}
.ma-stat strong { display: block; font-size: 1.75rem; color: var(--ma-blue); }
.ma-stat span { color: var(--ma-muted); font-size: 0.9rem; }

label { display: block; font-size: 0.9rem; margin: 0.75rem 0 0.3rem; color: var(--ma-muted); font-weight: 500; }
input[type="text"], input[type="email"], input[type="password"], input[type="date"], input[type="url"], textarea, select {
  width: 100%;
  padding: 0.65rem 0.8rem;
  border: 1px solid var(--ma-border);
  border-radius: 10px;
  background: #fff;
  font: inherit;
  color: var(--ma-text);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: rgba(0, 74, 173, 0.45);
  box-shadow: 0 0 0 3px var(--ma-blue-soft);
}
textarea { min-height: 120px; resize: vertical; }
.ma-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.ma-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1rem; }

.btn {
  display: inline-block;
  border: 1px solid transparent;
  padding: 0.6rem 1rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  background: var(--ma-blue);
  color: #fff;
  border-radius: 999px;
  transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 8px 18px rgba(0, 74, 173, 0.22);
}
.btn:hover {
  background: var(--ma-blue-dark);
  text-decoration: none;
  transform: translateY(-1px);
}
.btn-secondary {
  background: #fff;
  color: var(--ma-blue);
  border-color: var(--ma-border);
  box-shadow: none;
}
.btn-secondary:hover { background: var(--ma-blue-soft); }
.btn-danger { background: var(--ma-danger); box-shadow: 0 8px 18px rgba(180, 35, 24, 0.2); }
.btn-sm { padding: 0.35rem 0.7rem; font-size: 0.85rem; border-radius: 8px; box-shadow: none; }

table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td { text-align: left; padding: 0.8rem 0.55rem; border-bottom: 1px solid var(--ma-border); vertical-align: top; }
th { color: var(--ma-muted); font-weight: 600; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; }
.badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  font-size: 0.75rem;
  border-radius: 999px;
  background: #e8f5ee;
  color: var(--ma-success);
  font-weight: 600;
}
.badge.inactive { background: #fef3e8; color: var(--ma-warn); }

.flash {
  padding: 0.8rem 1rem;
  margin-bottom: 1rem;
  border: 1px solid rgba(6, 118, 71, 0.2);
  background: #ecfdf3;
  color: var(--ma-success);
  border-radius: 12px;
}
.flash.error {
  background: #fef3f2;
  color: var(--ma-danger);
  border-color: rgba(180, 35, 24, 0.2);
}

.ma-upload-zone {
  margin: 1rem 0;
  padding: 1.25rem;
  border: 2px dashed rgba(0, 74, 173, 0.25);
  background: linear-gradient(180deg, #f7faff, #fff);
  border-radius: 14px;
}
.ma-upload-label { font-weight: 600; color: var(--ma-text); margin-bottom: 0.5rem; }

.hint { font-size: 0.82rem; color: var(--ma-muted); margin-top: 0.25rem; }

@media (max-width: 800px) {
  .ma-shell { grid-template-columns: 1fr; }
  .ma-sidebar { padding-bottom: 0.75rem; }
  .ma-nav { display: flex; flex-wrap: wrap; gap: 0.25rem; }
  .ma-row { grid-template-columns: 1fr; }
}
