:root {
  --majestic-purple: #9a02cc;
  --majestic-indigo: #24247C;
  --majestic-indigo-dark: #181858;
  --navy: #24247C;
  --navy-dark: #181858;
  --green: #9a02cc;
  --purple: #9a02cc;
  --surface: #fdfcfe;
  --card-bg: #fdfcfe;
  --bg: #fdfcfe;
}

body {
  background-color: #fdfcfe;
}

.btn-primary {
  background-color: var(--majestic-purple) !important;
  border-color: var(--majestic-purple) !important;
  color: #ffffff !important;
  font-weight: 600;
}

.btn-primary:hover,
.btn-primary:focus {
  background-color: #8201ad !important;
  border-color: #8201ad !important;
  color: #ffffff !important;
}

.btn-primary:active {
  background-color: #6e0094 !important;
  border-color: #6e0094 !important;
}

.login-logo {
  border-radius: 16px;
  background: transparent;
  box-shadow: none;
  width: 130px;
  height: auto;
  max-height: 120px;
  object-fit: contain;
  margin: 0 auto 16px;
  display: block;
}

/* Topbar navigation & dark headers */
.topbar {
  background: linear-gradient(135deg, var(--majestic-indigo-dark) 0%, var(--majestic-indigo) 100%) !important;
  border-bottom: 3px solid var(--majestic-purple) !important;
}

.digital-id-card .digi-header {
  background: linear-gradient(135deg, var(--majestic-indigo) 0%, var(--majestic-indigo-dark) 100%) !important;
  border-bottom: 3px solid var(--majestic-purple) !important;
}

/* Selected navigation controls and active tabs */
.topbar nav.desktop-nav a.active {
  background: rgba(154, 2, 204, 0.28) !important;
  color: #ffffff !important;
  border-radius: 8px;
}

.mobile-bottom-nav a.active {
  color: var(--majestic-purple) !important;
}

.tabs a.active,
.segmented-control a.active,
.btn-group .btn.active {
  background-color: var(--majestic-purple) !important;
  border-color: var(--majestic-purple) !important;
  color: #ffffff !important;
}

/* Program tiles and cards light surface (#FDFCFE) */
.card,
.program-tile,
.scan-tile,
.st-card,
.prog-tile,
.programs-grid .card,
.fee-tile,
.fee-program-card,
.monthly-scan-tile {
  background-color: #fdfcfe !important;
  border: 1px solid #e9e5f0 !important;
}

/* Payment status colors distinct from brand colors (indigo & purple) */
.badge-ok,
.badge-paid,
.pill-paid,
.st-status-paid,
.status-paid {
  background: #ecfdf5 !important;
  color: #065f46 !important;
  border: 1px solid #a7f3d0 !important;
  font-weight: 700 !important;
}

.badge-warn,
.badge-partial,
.pill-partial,
.st-status-partial,
.status-partial {
  background: #fffbeb !important;
  color: #92400e !important;
  border: 1px solid #fde68a !important;
  font-weight: 700 !important;
}

.badge-err,
.badge-unpaid,
.pill-unpaid,
.st-status-unpaid,
.status-unpaid {
  background: #fef2f2 !important;
  color: #991b1b !important;
  border: 1px solid #fecaca !important;
  font-weight: 700 !important;
}

/* Crest display on both light and dark backgrounds without clipping ribbon */
.brand img {
  border-radius: 8px !important;
  background: #ffffff !important;
  padding: 2px !important;
  object-fit: contain !important;
  width: 40px !important;
  height: 40px !important;
  border: 1.5px solid rgba(255, 255, 255, 0.9) !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25) !important;
}

.digi-logo {
  border-radius: 6px !important;
  background: #ffffff !important;
  padding: 2px !important;
  object-fit: contain !important;
  width: 36px !important;
  height: 36px !important;
  border: 1.5px solid rgba(255, 255, 255, 0.8) !important;
}

.idc-head img {
  border-radius: 4px !important;
  object-fit: contain !important;
  background: transparent !important;
}

/* Responsive phone sizing and tap targets */
@media (max-width: 640px) {
  .btn,
  .btn-primary,
  button {
    min-height: 44px;
    font-size: 15px !important;
    font-weight: 600 !important;
    letter-spacing: 0.01em;
    padding: 10px 18px !important;
  }

  .badge,
  .pill-paid,
  .pill-partial,
  .pill-unpaid,
  .scan-status-pill,
  .st-status-pill {
    font-size: 13px !important;
    padding: 5px 10px !important;
    letter-spacing: 0.02em;
    font-weight: 700 !important;
  }

  .brand-title {
    font-size: 1.05em !important;
    font-weight: 700 !important;
  }

  .brand-sub {
    font-size: 0.7em !important;
    color: #e6a100 !important;
    letter-spacing: 0.08em;
  }
}

/* Majestic mobile workspace */
body { background: #f7f5fb; }
.mc-home, .mc-accounts, .mc-signin { max-width: 48rem; margin: 1rem auto 3rem; }
.mc-signin { max-width: 26rem; margin-top: clamp(1rem, 7vh, 6rem); }
.mc-home-head, .mc-mast {
  background: linear-gradient(125deg,#22216e 0%,#382889 68%,#63309d 100%);
  color: white; padding: clamp(1.35rem,4vw,2.5rem); border-radius: 20px;
}
.mc-mast { text-align: center; }
.mc-mast img { border-radius: 18px; padding: 6px; background: white; object-fit: contain; }
.mc-home-head h1, .mc-mast h1 { color: white; margin: .6rem 0 .3rem; line-height: 1.15; }
.mc-home-head time, .mc-mast p { color: #ece7ff; margin: 0; }
.mc-role { display: inline-block; background: #f4eaf9; color: #40236b; border-radius: 30px; padding: .35rem .75rem; font-weight: 700; }
.mc-panel, .mc-summary a {
  padding: clamp(1rem,3vw,1.65rem); margin: 1rem 0; background: white;
  border: 1px solid #dfdaeb; border-radius: 16px; box-shadow: 0 3px 14px #28206408;
}
.mc-panel h2, .mc-lookup-head h1 { margin: 0 0 .5rem; color: #24247c; }
.mc-panel p, .mc-lookup-head p { color: #514c63; }
.mc-panel.login { width: 100%; max-width: none; text-align: left; }
.mc-panel.login .btn, .mc-task .btn { width: 100%; min-height: 48px; }
.mc-panel input, .mc-panel select, .mc-accounts input { min-height: 48px; font-size: 1rem; }
.mc-summary { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(100%,12rem),1fr)); gap: .75rem; margin: 1rem 0; }
.mc-summary a { margin: 0; display: grid; gap: .4rem; color: #24247c; text-decoration: none; }
.mc-summary strong { font-size: clamp(1.4rem,4vw,2rem); overflow-wrap: anywhere; }
.mc-link, .mc-accounts summary { min-height: 48px; display: flex; align-items: center; justify-content: space-between; border-top: 1px solid #e9e4ef; color: #452776; font-weight: 650; }
.mc-accounts summary { cursor: pointer; }
.mc-accounts details form { margin: .75rem 0; }
.mc-lookup-head { padding: 1rem 0; }
:focus-visible { outline: 3px solid #7041a9; outline-offset: 3px; }
@media(max-width:640px) {
  .scan-manual { flex-wrap: wrap; }
  .scan-manual input, .scan-manual .btn { width: 100%; min-height:48px; }
  .mobile-bottom-nav a { min-height: 48px; }
}
#lookup-camera[hidden], #lookup-start-camera[hidden] { display: none; }
#lookup-start-camera { min-height: 48px; margin-bottom: .75rem; }

/* Majestic tuition portal */
.mc-entry,.mc-desk { min-height:80vh; min-height:80svh; display:flex; flex-direction:column; justify-content:center; align-items:center; gap:18px }
.mc-entry { min-height:92svh }
.mc-entry .mc-surface,.mc-desk .mc-surface { width:min(100%,26rem); padding:22px }
.mc-surface,.mc-nav-list a,.mc-program { background:#fff; border:1px solid #dfdbea; border-radius:12px; padding:16px }
.mc-entry h1,.mc-desk h1,.mc-workspace h1,.mc-accounts h1,.mc-lookup-head h1 { color:#282274; font-size:1.4rem; margin:0 0 8px }
.mc-entry h1,.mc-entry form>p { text-align:center }
.mc-entry form>p { margin:0 0 20px }
.mc-crest { display:block; margin:0 auto 14px; object-fit:contain }
.mc-entry .btn,.mc-desk .btn,.mc-add>summary,.mc-collect-action button { width:100%; min-height:46px; justify-content:center }
.mc-secret,.mc-key-row { display:flex; align-items:center; gap:8px; margin-bottom:16px }
.mc-secret input,.mc-key-row input { min-width:0; margin:0; flex:1 }
.mc-secret button,.mc-key-row a { display:grid; place-items:center; background:#f0e6fc; color:#462378; border:0; border-radius:8px; min-width:48px; min-height:46px; font-weight:700; font-family:inherit }
.mc-workspace,.mc-accounts { max-width:44rem; margin:12px auto 2rem }
.mc-workspace h2,.mc-accounts h2,.mc-collection h3 { font-size:1rem }
.mc-workspace .mc-summary { grid-template-columns:repeat(2,minmax(0,1fr)) }
.mc-summary strong { font-size:clamp(1.08rem,4vw,1.65rem) }
.mc-nav-list { display:grid; gap:8px }
.mc-nav-list a,.mc-back { display:flex; align-items:center; justify-content:space-between; gap:8px; color:#282274; text-decoration:none; min-height:48px; font-weight:650 }
.mc-back { justify-content:center; border:1px solid #d5cce7; border-radius:8px; background:#efebfa; margin-top:16px }
.mc-status,.mc-header-role { background:#eae7ff; color:#302377; padding:3px 10px; border-radius:20px; font-size:.8rem; font-weight:700 }
.mc-status { float:right }.mc-status.inactive { background:#ffe8e8;color:#841b23 }
.mc-header-role { margin-left:auto }
.mc-self,.mc-staff-card { margin:8px 0 16px }
.mc-self span,.mc-program small { display:block }
.mc-staff-card h3,.mc-staff-card p { margin:0 0 6px }
.mc-staff-card button,.mc-staff-card summary { width:100%; min-height:44px; justify-content:center }
.mc-accounts .mc-add>summary { color:white }
.mc-month,.mc-program { display:flex; justify-content:space-between; align-items:center; gap:8px; margin:10px 0 }
.mc-month input { width:auto; max-width:65% }
.mc-program:has(:checked) { outline:2px solid #753bb0; background:#f5edff }
.mc-program input { width:20px; height:20px; flex:none; margin:0 }
.mc-program span:last-child { text-align:right; margin-left:auto }
.mc-receipts { margin-bottom:12px }
.mc-collect-action { display:grid; grid-template-columns:auto 1fr; gap:8px; padding:14px; background:white; border:1px solid #ddd6eb; border-radius:12px; margin:16px 0 }
.mc-collect-action strong { text-align:right }.mc-collect-action button { grid-column:1/-1 }.mc-collect-action button:disabled { opacity:.55 }
@media(max-width:768px) {
  header.topbar { background:white!important; border-bottom:1px solid #e4deed!important }
  .topbar .brand-title,.topbar .brand-sub { color:#302377!important }
  .topbar .user-pill { display:none }
  .mc-collect-action { position:fixed; z-index:998; left:0; right:0; bottom:calc(var(--bottom-nav-h) + env(safe-area-inset-bottom)); margin:0; border-radius:10px 10px 0 0 }
  .mc-collection:has(.mc-collect-action) { padding-bottom:10rem }
}
.mc-inner-head { display:flex; align-items:center; gap:8px; margin-bottom:16px }
.mc-inner-head h1 { margin:0; font-size:1.25rem;color:#282274 }
.mc-inner-head a { display:grid;place-items:center; min-width:44px;min-height:44px;text-decoration:none;font-size:1.4rem }
.mc-search-student summary { cursor:pointer; min-height:44px;color:#32267d;font-weight:650;padding:10px }
.mc-collection .spot-overlay { position:fixed;inset:0;z-index:1500;background:#17102c80;align-items:center;justify-content:center;padding:12px }
.mc-collection .spot-card { background:white; width:min(100%,26rem); max-height:90dvh; overflow:auto; border-radius:14px }
.mc-collection .spot-head { padding:14px;color:white;display:flex;align-items:center;justify-content:space-between }
.mc-collection .spot-head h3,.mc-collection .spot-head p { margin:0;color:white }
@media(max-width:768px){
  body:has(.mc-inner-head) .topbar,body:has(.mc-inner-head) .mobile-bottom-nav { display:none }
  .mc-collect-action { bottom:0;padding-bottom:calc(14px + env(safe-area-inset-bottom)) }
  .mobile-bottom-nav :is(a,button).active svg { background:#eee7ff;border-radius:8px;box-sizing:content-box;padding:3px 12px }
}
.mc-nav-list i { width:32px;height:32px;display:grid;place-items:center;background:#f3effb;border-radius:7px }
.mc-nav-list svg,.mc-key-row svg { width:22px;height:22px;stroke-width:1.8 }
.mc-nav-list a>span:last-child { margin-left:auto }
