/* ==========================================================
   RMMC SSO System Hub
   Navy + gold, the college's own colors. One strong element:
   the navy header with its gold rule. Everything below it is
   quiet paper and ink so the module list reads first.
   ========================================================== */
:root {
  --navy: #151B6B;
  --navy-deep: #0D1147;
  --navy-hover: #232C94;
  --gold: #3FA9F5;
  --gold-deep: #1E7FC9;
  --paper: #F4F5FA;
  --card: #FFFFFF;
  --line: #E1E3EF;
  --line-strong: #CDD1E6;
  --ink: #1B1F3B;
  --muted: #5E6386;
  --tint: #EEF0FA;
  --green: #1E7A45;
  --green-bg: #E3F4EA;
  --red: #B3261E;
  --red-bg: #FCE8E6;
  --radius: 10px;
  --radius-lg: 14px;
  --focus: 0 0 0 3px rgba(35, 44, 148, 0.25);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: 'Montserrat', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 15px;
  line-height: 1.5;
  background: var(--paper);
  color: var(--ink);
}
h1, h2, h3 { margin: 0; color: var(--navy); line-height: 1.2; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 0.82rem; }
.hint { font-weight: 500; color: var(--muted); font-size: 0.78rem; }
button, input, select { font: inherit; }
:focus-visible { outline: none; box-shadow: var(--focus); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 0 18px;
  border-radius: var(--radius); border: 1.5px solid transparent;
  font-weight: 700; font-size: 0.9rem; text-decoration: none; cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.btn:disabled { opacity: 0.6; cursor: default; }
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-hover); }
.btn-secondary { background: #fff; color: var(--navy); border-color: var(--line-strong); }
.btn-secondary:hover { background: var(--tint); }
.btn-on-dark { background: transparent; color: #fff; border-color: rgba(255,255,255,0.4); min-height: 36px; padding: 0 14px; }
.btn-on-dark:hover { background: rgba(255,255,255,0.12); }
.btn-block { width: 100%; }

/* ---------- Inputs ---------- */
label { display: block; font-size: 0.82rem; font-weight: 700; color: var(--ink); }
input[type="text"], input[type="password"], select {
  display: block; width: 100%; margin-top: 6px;
  min-height: 44px; padding: 10px 12px;
  border: 1.5px solid var(--line-strong); border-radius: var(--radius);
  background: #fff; color: var(--ink); font-size: 0.95rem; font-weight: 500;
  transition: border-color 0.15s ease;
}
input:hover, select:hover { border-color: var(--navy-hover); }
input:focus, select:focus { outline: none; border-color: var(--navy); box-shadow: var(--focus); }
input:disabled { background: var(--tint); color: var(--muted); }
select {
  appearance: none; -webkit-appearance: none; padding-right: 36px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23151B6B' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 13px center;
}
.error { color: var(--red); background: var(--red-bg); border-radius: 8px; padding: 8px 12px; font-size: 0.85rem; font-weight: 600; margin: 4px 0 12px; }

/* ---------- Sign in ---------- */
/* ---------- Sign in (split screen: photo left, form right; form only on phones) ---------- */
#loginScreen { min-height: 100dvh; display: flex; background: #fff; }
.login-visual {
  flex: 1 1 52%; position: relative; overflow: hidden;
  background: url("login-bg.webp") center/cover no-repeat, var(--navy);
}
.login-visual::before {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(160deg, rgba(21,27,107,0.55), rgba(35,44,148,0.35)); mix-blend-mode: multiply;
}
.login-curve { position: absolute; top: 0; right: -1px; width: 110px; height: 100%; color: #fff; }
.login-panel {
  flex: 1 1 48%; min-width: 0;
  display: flex; align-items: center; justify-content: center;
  padding: 40px 32px; background: #fff; position: relative; z-index: 1;
}
.login-content { width: 100%; max-width: 400px; display: flex; flex-direction: column; }
.brand { text-align: center; margin-bottom: 22px; }
.logo-row { display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: 14px; }
.header-logo { height: 60px; width: auto; object-fit: contain; }
.logo-row a { display: inline-flex; border-radius: 50%; transition: transform .15s ease; }
.logo-row a:hover { transform: translateY(-2px); }
.logo-row a:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.header-logo-ims { display: block; height: 40px; width: auto; margin: 0 auto 10px; object-fit: contain; }
.brand h1 { font-size: 1.1rem; font-weight: 800; letter-spacing: 0.01em; }
.brand-sub { margin: 4px 0 0; font-size: 0.75rem; font-weight: 700; color: var(--gold-deep); letter-spacing: 0.22em; text-transform: uppercase; }
.login-greet { margin: 0 0 16px; font-size: 1.45rem; font-weight: 800; text-align: center; }
.audience-note {
  margin: 0 0 20px; padding: 10px 12px;
  border-left: 3px solid var(--gold); background: #EAF5FE; border-radius: 0 8px 8px 0;
  font-size: 0.82rem; line-height: 1.45; color: var(--ink);
}
.audience-note b { color: var(--navy); }
.audience-note a { color: var(--navy); font-weight: 700; }
#loginForm .field { margin-bottom: 16px; }
#loginForm .field > label { margin-bottom: 6px; }
.req { color: var(--red); margin-left: 3px; }
.input-icon { position: relative; }
.input-icon > svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: #8A90AD; pointer-events: none; }
.input-icon input { margin-top: 0; min-height: 50px; padding-left: 44px; }
.password-wrap { position: relative; }
.password-wrap input { padding-right: 52px; }
.password-toggle {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  display: inline-flex; align-items: center; justify-content: center;
  background: none; border: none; color: #6B7190; padding: 8px; border-radius: 8px; cursor: pointer;
}
.password-toggle:hover { background: var(--tint); color: var(--navy); }
.password-toggle .eye-off { display: none; }
.password-toggle.is-visible .eye-on { display: none; }
.password-toggle.is-visible .eye-off { display: inline; }
#loginBtn { margin-top: 4px; min-height: 52px; border-radius: 999px; font-size: 1rem; }
.cf-turnstile { margin: 16px 0 0; min-height: 65px; }
.login-footer { margin-top: 28px; text-align: center; }
@media (max-width: 900px) {
  .login-visual { display: none; }
  .login-panel { flex: 1 1 100%; min-height: 100dvh; padding: 36px 22px; }
}
.dev-credit {
  position: fixed; right: 20px; bottom: max(20px, env(safe-area-inset-bottom)); z-index: 40;
  display: flex; align-items: center; gap: 8px; padding: 7px 14px;
  background: #fff; border: 1px solid var(--line); border-radius: 999px;
  box-shadow: 0 4px 14px rgba(13, 17, 71, 0.12);
  font-size: 0.75rem; font-weight: 600; color: var(--muted);
}
.footer-logo { height: 22px; width: auto; display: block; }
.footer-copy { margin: 0; font-size: 0.72rem; color: var(--muted); }
.login-legal { margin: 0 0 8px; font-size: 0.75rem; color: var(--muted); }
.login-legal a { color: var(--navy); font-weight: 600; text-decoration: none; }
.login-legal a:hover { text-decoration: underline; }

/* ---------- Header ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px 28px; padding-top: max(12px, env(safe-area-inset-top));
  background: var(--navy-deep);
  background-image: linear-gradient(100deg, var(--navy) 0%, var(--navy-deep) 70%);
  border-bottom: 3px solid var(--gold);
  color: #fff;
}
.topbar-brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.topbar-logo { height: 38px; width: 38px; object-fit: contain; flex-shrink: 0; }
.topbar-ims { height: 24px; width: auto; flex-shrink: 0; display: block; }
.topbar-text { display: flex; flex-direction: column; min-width: 0; margin-left: 4px; }
.topbar-org { font-size: 0.7rem; font-weight: 600; color: #C9CDF2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-title { font-size: 1.05rem; font-weight: 800; white-space: nowrap; }
.topbar-user { display: flex; align-items: center; gap: 10px; font-size: 0.85rem; font-weight: 600; min-width: 0; }
.topbar-user #userLabel { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
.user-dot { width: 8px; height: 8px; border-radius: 50%; background: #5EE08F; flex-shrink: 0; }

/* ---------- Dashboard ---------- */
.dashboard { max-width: 1120px; margin: 0 auto; padding: 32px 28px 64px; }
.dash-intro h2 { font-size: 1.5rem; font-weight: 800; }
.dash-intro p { margin: 4px 0 0; }
.dash-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 24px; align-items: start; margin-top: 22px; }

/* Module list */
.sidebar {
  display: flex; flex-direction: column; gap: 2px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 8px; position: sticky; top: 90px;
}
.sidebar-tab {
  position: relative; display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 11px 12px; border: none; border-radius: var(--radius); background: none;
  color: var(--ink); text-align: left; cursor: pointer; transition: background 0.15s ease;
}
.sidebar-tab:hover { background: var(--tint); }
.sidebar-tab.active { background: var(--tint); }
.sidebar-tab.active::before {
  content: ""; position: absolute; left: -8px; top: 10px; bottom: 10px; width: 4px;
  background: var(--gold); border-radius: 0 4px 4px 0;
}
.sidebar-tab-icon {
  flex-shrink: 0; width: 36px; height: 36px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  background: var(--tint); color: var(--navy);
}
.sidebar-tab.active .sidebar-tab-icon { background: var(--navy); color: #fff; }
.sidebar-tab-icon svg { width: 18px; height: 18px; }
.sidebar-tab-text { display: flex; flex-direction: column; min-width: 0; }
.sidebar-tab .tab-name { font-weight: 700; font-size: 0.9rem; color: var(--navy); line-height: 1.3; }
.sidebar-tab .tab-role { font-size: 0.75rem; font-weight: 500; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-divider { border: none; border-top: 1px solid var(--line); margin: 6px 8px; }

/* Content cards */
.content-panel { min-width: 0; }
.content-placeholder, .module-panel, .accounts-panel {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg);
}
.content-placeholder { padding: 48px 24px; text-align: center; border-style: dashed; }
.module-panel { padding: 28px 30px; }
.module-panel-head { display: flex; align-items: center; gap: 14px; }
.module-panel-icon {
  flex-shrink: 0; width: 48px; height: 48px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  background: var(--navy); color: #fff;
}
.module-panel-icon svg { width: 24px; height: 24px; }
.module-panel h3 { font-size: 1.3rem; font-weight: 800; }
.role-line { margin: 14px 0 22px; color: var(--muted); font-size: 0.9rem; }
.role-line b { color: var(--ink); }
.open-note { margin: 10px 0 0; }

/* Accounts */
.accounts-panel { padding: 24px 26px; }
.accounts-panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.accounts-panel-head h3 { font-size: 1.3rem; font-weight: 800; }
.accounts-panel-head p { margin: 2px 0 0; }

/* Homepage Announcements panel */
.ann-new { padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); margin-bottom: 18px; }
.ann-new textarea {
  display: block; width: 100%; margin-top: 6px; min-height: 84px; padding: 10px 12px;
  border: 1.5px solid var(--line-strong); border-radius: var(--radius); background: #fff;
  color: var(--ink); font: inherit; font-size: 0.95rem; font-weight: 500; resize: vertical;
}
.ann-new textarea:focus { outline: none; border-color: var(--navy); box-shadow: var(--focus); }
.ann-count { text-align: right; font-size: 0.74rem; color: var(--muted); margin: 4px 0 10px; }
.ann-new .checkbox-row { background: #fff; margin-bottom: 12px; }
.ann-item { padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 10px; }
.ann-item-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.ann-text { flex: 1; font-size: 0.92rem; line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
.ann-item .acct-actions { justify-content: flex-start; margin-top: 10px; }

.table-wrap { border: 1px solid var(--line); border-radius: var(--radius); overflow-x: auto; }
.accounts-table { width: 100%; border-collapse: collapse; font-size: 0.87rem; }
.accounts-table th {
  text-align: left; padding: 11px 12px; background: var(--tint);
  font-size: 0.78rem; font-weight: 700; color: var(--navy);
  border-bottom: 1px solid var(--line); white-space: nowrap; user-select: none;
}
.accounts-table th.sortable { cursor: pointer; }
.accounts-table th .sort-arrow { margin-left: 5px; font-size: 0.7em; opacity: 0.35; }
.accounts-table th.sort-active .sort-arrow { opacity: 1; }
.accounts-table td { padding: 12px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.accounts-table tr:last-child td { border-bottom: none; }
.accounts-table tbody tr:hover td { background: #FAFBFE; }

.acct-identity { display: flex; align-items: center; gap: 11px; }
.acct-avatar {
  flex-shrink: 0; width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--navy); color: #fff; font-size: 0.75rem; font-weight: 800;
}
.acct-name { font-weight: 700; color: var(--ink); }
.acct-username { font-size: 0.78rem; color: var(--muted); }
.badge {
  display: inline-block; margin-left: 6px; padding: 2px 8px; border-radius: 20px;
  background: #D8ECFC; color: var(--gold-deep); font-size: 0.68rem; font-weight: 800; vertical-align: middle;
}
.acct-mods { display: flex; flex-wrap: wrap; gap: 5px; max-width: 280px; }
.mod-chip {
  font-size: 0.74rem; font-weight: 500; padding: 3px 9px; border-radius: 6px;
  background: var(--tint); color: var(--ink); white-space: nowrap;
}
.mod-chip b { color: var(--navy); font-weight: 700; }
.acct-status { display: inline-flex; align-items: center; gap: 6px; font-size: 0.8rem; font-weight: 700; }
.acct-status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.acct-status.active { color: var(--green); }
.acct-status.inactive { color: var(--muted); }
.acct-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: nowrap; }
.acct-actions button {
  min-height: 34px; padding: 0 12px; border-radius: 8px;
  border: 1.5px solid var(--line-strong); background: #fff; color: var(--navy);
  font-size: 0.8rem; font-weight: 700; white-space: nowrap; cursor: pointer;
}
.acct-actions button:hover { background: var(--tint); }
.acct-actions .danger { color: var(--red); border-color: #EFC4C0; }
.acct-actions .danger:hover { background: var(--red-bg); }

/* ---------- Account form ---------- */
.modal {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center; padding: 20px;
  background: rgba(13, 17, 71, 0.55);
}
.modal-card {
  width: 100%; max-width: 520px; max-height: calc(100dvh - 40px); overflow-y: auto;
  background: #fff; border-radius: var(--radius-lg); padding: 26px 28px;
  box-shadow: 0 24px 60px rgba(13, 17, 71, 0.3);
  border-top: 4px solid var(--gold);
}
.modal-head h3 { font-size: 1.25rem; font-weight: 800; margin-bottom: 18px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 18px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.form-grid .hint { margin-left: 4px; }

.access-set { border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 16px 10px; margin: 0 0 16px; }
.access-set legend { padding: 0 6px; font-size: 0.82rem; font-weight: 800; color: var(--navy); }
.module-row { display: grid; grid-template-columns: 110px minmax(0, 1fr); align-items: center; gap: 12px; padding: 7px 0; }
.module-row + .module-row { border-top: 1px solid var(--line); }
.module-row label { font-size: 0.86rem; }
.module-row select { margin-top: 0; }

.checkbox-row {
  display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: var(--radius); font-weight: 500; cursor: pointer;
}
.checkbox-row input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--navy); flex-shrink: 0; }
.checkbox-row b { color: var(--ink); }

.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

/* ---------- Tablet ---------- */
@media (max-width: 900px) {
  .dash-layout { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: static; flex-direction: row; overflow-x: auto; gap: 6px; padding: 6px;
    scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch;
  }
  .sidebar-tab { width: auto; flex: 0 0 auto; scroll-snap-align: start; padding: 9px 12px 9px 9px; }
  .sidebar-tab.active::before { left: 12px; right: 12px; top: auto; bottom: -6px; width: auto; height: 3px; border-radius: 3px 3px 0 0; }
  .sidebar-tab .tab-name { max-width: 190px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .sidebar-divider { border-top: none; border-left: 1px solid var(--line); margin: 6px 2px; }
}

/* ---------- Phone ---------- */
@media (max-width: 640px) {
  body { font-size: 14.5px; }
  .topbar { padding: 10px 14px; padding-top: max(10px, env(safe-area-inset-top)); gap: 10px; }
  .topbar-logo { height: 32px; width: 32px; }
  .topbar-ims { height: 20px; }
  .topbar-text { display: none; }
  .topbar-title { font-size: 0.95rem; }
  .topbar-user #userLabel, .user-dot { display: none; }

  .dashboard { padding: 20px 14px 76px; }
  .dash-intro h2 { font-size: 1.3rem; }
  .module-panel { padding: 22px 18px; }
  .module-panel .open-btn { width: 100%; }
  .accounts-panel { padding: 18px 14px; }
  .accounts-panel-head #newAccountBtn { width: 100%; }

  /* Accounts table becomes a stack of cards */
  .table-wrap { border: none; border-radius: 0; overflow: visible; }
  .accounts-table, .accounts-table tbody, .accounts-table tr, .accounts-table td { display: block; width: 100%; }
  .accounts-table thead { display: none; }
  .accounts-table tr { border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 10px; padding: 4px 0; background: #fff; }
  .accounts-table tbody tr:hover td { background: none; }
  .accounts-table td { border-bottom: none; padding: 8px 14px; }
  .accounts-table td[data-label]::before {
    content: attr(data-label); display: block; margin-bottom: 4px;
    font-size: 0.72rem; font-weight: 700; color: var(--muted);
  }
  .acct-mods { max-width: none; }
  .acct-actions { justify-content: stretch; }
  .acct-actions button { flex: 1 1 0; min-height: 40px; }

  /* Account form slides up as a sheet */
  .modal { align-items: flex-end; padding: 0; }
  .modal-card {
    max-width: none; max-height: 92dvh; border-radius: 18px 18px 0 0;
    padding: 22px 18px calc(18px + env(safe-area-inset-bottom));
  }
  .form-grid { grid-template-columns: 1fr; }
  .module-row { grid-template-columns: 1fr; gap: 4px; }
  .modal-actions { position: sticky; bottom: calc(-18px - env(safe-area-inset-bottom)); background: #fff; padding: 12px 0 4px; margin-bottom: -4px; }
  .modal-actions .btn { flex: 1; }

  /* Sign in on phones (photo already hidden below 900px) */
  .header-logo { height: 52px; }
  .login-footer { padding-bottom: 52px; }
}

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

/* ---------- Homepage News & Updates ---------- */
.news-item { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 10px; background: #fff; }
.news-thumb { width: 72px; height: 48px; flex-shrink: 0; border-radius: 8px; overflow: hidden; background: var(--tint); display: flex; align-items: center; justify-content: center; font-size: 1.3rem; }
.news-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.news-item-main { flex: 1 1 auto; min-width: 0; }
.news-item-title { font-weight: 700; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.news-pin-tag { font-size: 0.72rem; font-weight: 700; color: var(--gold-deep); }
.news-item .acct-status { flex-shrink: 0; }
.news-item .acct-actions { flex-shrink: 0; }
.news-form > label { margin: 16px 0 6px; }
.news-form > label:first-child { margin-top: 0; }
.news-form textarea, .news-form input[type="date"] {
  width: 100%; font: inherit; font-size: 0.95rem; color: var(--ink); background: #fff;
  border: 1px solid var(--line-strong); border-radius: 8px; padding: 10px 12px; margin-top: 6px;
}
.news-form textarea { resize: vertical; min-height: 60px; }
.news-form textarea:focus, .news-form input[type="date"]:focus { outline: none; border-color: var(--navy); box-shadow: var(--focus); }
.news-row { display: grid; grid-template-columns: minmax(0, 220px) minmax(0, 1fr); gap: 14px; align-items: end; margin-top: 16px; }
.news-pin { margin: 0; }
.news-cover { border: 1px dashed var(--line-strong); border-radius: var(--radius); background: var(--paper); overflow: hidden; max-width: 420px; aspect-ratio: 16 / 9; display: flex; align-items: center; justify-content: center; }
.news-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.news-cover-empty { color: var(--muted); font-size: 0.85rem; padding: 12px; text-align: center; }
.news-cover-actions { display: flex; gap: 8px; margin-top: 10px; }
.rte-toolbar { display: flex; flex-wrap: wrap; gap: 4px; padding: 6px; border: 1px solid var(--line-strong); border-bottom: none; border-radius: 8px 8px 0 0; background: var(--paper); }
.rte-toolbar button { font: inherit; font-size: 0.8rem; font-weight: 600; color: var(--ink); background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 5px 10px; cursor: pointer; }
.rte-toolbar button:hover { background: var(--tint); border-color: var(--line-strong); }
.rte { min-height: 260px; max-height: 60vh; overflow-y: auto; border: 1px solid var(--line-strong); border-radius: 0 0 8px 8px; padding: 14px 16px; background: #fff; color: var(--ink); font-size: 0.95rem; line-height: 1.65; }
.rte:focus { outline: none; border-color: var(--navy); box-shadow: var(--focus); }
.rte:empty::before { content: "Write the article here…"; color: var(--muted); }
.rte h2 { font-size: 1.2rem; margin: 14px 0 6px; }
.rte p { margin: 0 0 10px; }
.rte img { max-width: 100%; height: auto; border-radius: 8px; margin: 8px 0; }
.rte a { color: var(--gold-deep); }
.news-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
/* Homepage Editor tabs */
.hp-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.hp-tab { font: inherit; font-size: 0.88rem; font-weight: 700; color: var(--muted); background: none; border: none; border-bottom: 2.5px solid transparent; padding: 10px 14px; margin-bottom: -1px; cursor: pointer; white-space: nowrap; }
.hp-tab:hover { color: var(--navy); }
.hp-tab.active { color: var(--navy); border-bottom-color: var(--navy); }
.hp-pane-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.hp-pane-head p { margin: 0; flex: 1 1 260px; }

/* Partner logos */
.logo-form h4 { margin: 0 0 12px; font-size: 1rem; color: var(--ink); }
.logo-form-grid { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 16px; margin-bottom: 14px; }
.logo-preview { aspect-ratio: 4 / 3; background: #fff; border: 1px dashed var(--line-strong); border-radius: var(--radius); display: flex; align-items: center; justify-content: center; padding: 14px; }
.logo-preview img { max-width: 100%; max-height: 100%; object-fit: contain; display: block; }
.logo-form-fields label { margin: 12px 0 6px; }
.logo-form-fields .hint { margin: 6px 0 0; font-size: 0.78rem; }
.logo-item { cursor: grab; }
.logo-item.dragging { opacity: 0.45; }
.logo-item.drop-target { border-color: var(--navy); box-shadow: var(--focus); }
.logo-item .news-thumb { background: #fff; border: 1px solid var(--line); padding: 4px; }
.logo-item .news-thumb img { object-fit: contain; }
.logo-grip { color: var(--muted); font-size: 1.1rem; line-height: 1; flex-shrink: 0; user-select: none; }
.logo-move { display: flex; flex-direction: column; gap: 2px; flex-shrink: 0; }
.logo-move button { font: inherit; font-size: 0.7rem; line-height: 1; padding: 3px 7px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--navy); cursor: pointer; }
.logo-move button:disabled { opacity: 0.35; cursor: default; }
/* Campus life photos */
.photo-form h4 { margin: 0 0 12px; font-size: 1rem; color: var(--ink); }
.photo-preview { max-width: 420px; aspect-ratio: 16 / 9; background: #fff; border: 1px dashed var(--line-strong); border-radius: var(--radius); overflow: hidden; display: flex; align-items: center; justify-content: center; }
.photo-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-form .news-cover-actions { margin-top: 10px; }
.photo-form .hint { margin: 6px 0 0; font-size: 0.78rem; }
.photo-form > label { margin: 14px 0 6px; }
.photo-form textarea {
  display: block; width: 100%; padding: 10px 12px; margin-bottom: 12px;
  border: 1.5px solid var(--line-strong); border-radius: var(--radius); background: #fff;
  color: var(--ink); font: inherit; font-size: 0.95rem; resize: vertical;
}
.photo-form textarea:focus { outline: none; border-color: var(--navy); box-shadow: var(--focus); }
.photo-item .news-item-title { white-space: normal; font-weight: 600; }

@media (max-width: 640px) {
  .logo-form-grid { grid-template-columns: 1fr; }
  .logo-preview { max-width: 220px; }
  .logo-grip { display: none; }
}
@media (max-width: 640px) {
  .news-item { flex-wrap: wrap; }
  .news-item-main { flex-basis: calc(100% - 90px); }
  .news-item .acct-actions { width: 100%; }
  .news-row { grid-template-columns: 1fr; }
  .news-actions { flex-direction: column-reverse; }
  .news-actions .btn { width: 100%; }
}

/* ---------- Login Activity ---------- */
.activity-filters {
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px;
}
.activity-filters input[type="date"] {
  display: block; width: 100%; margin-top: 6px; min-height: 44px; padding: 10px 12px;
  border: 1.5px solid var(--line-strong); border-radius: var(--radius);
  background: #fff; color: var(--ink); font: inherit; font-size: 0.95rem; font-weight: 500;
}
.activity-filters input[type="date"]:focus { outline: none; border-color: var(--navy); box-shadow: var(--focus); }
.activity-summary { margin: 0 0 10px; min-height: 1.2em; }
.activity-table td { vertical-align: top; }
.act-status { display: inline-flex; align-items: baseline; gap: 7px; font-size: 0.82rem; font-weight: 700; line-height: 1.35; }
.act-status::before { content: ""; flex-shrink: 0; width: 7px; height: 7px; border-radius: 50%; background: currentColor; transform: translateY(-1px); }
.act-status.active { color: var(--green); }
.act-status.ended { color: var(--ink); }
.act-status.closed { color: var(--muted); }
.act-status.open { color: var(--gold-deep); }
.act-status.failed { color: var(--red); }
.act-row.act-failed td { background: #FFFAFA; }
.activity-more { display: flex; justify-content: center; margin-top: 14px; }
@media (max-width: 900px) {
  .activity-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .activity-filters { gap: 10px; }
  .accounts-panel-head #activityExportBtn { width: 100%; }
  .act-row.act-failed td { background: none; }
}

/* ==========================================================
   Dashboard redesign: module boxes for everyone, plus a
   full-width layout with a side panel for superadmins.
   ========================================================== */
.back-link {
  display: inline-flex; align-items: center; gap: 6px; margin: 0 0 14px; padding: 6px 10px 6px 6px;
  border: none; border-radius: 8px; background: none; color: var(--navy);
  font: inherit; font-size: 0.88rem; font-weight: 700; cursor: pointer;
}
.back-link:hover { background: var(--tint); }
.back-link svg { width: 18px; height: 18px; }

.open-notice {
  margin: 0 0 16px; padding: 11px 14px; border-radius: var(--radius);
  background: var(--green-bg); color: var(--green); font-size: 0.86rem; font-weight: 600;
}
.open-notice.is-error { background: var(--red-bg); color: var(--red); }

.dash-hello { margin: 0 0 2px; font-size: 0.85rem; font-weight: 700; color: var(--gold-deep); }
.home-panel .dash-intro { margin-bottom: 22px; }

/* Module boxes */
.module-grid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
}
.mod-tile {
  position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 6px;
  min-height: 188px; padding: 20px; text-align: left; cursor: pointer;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg);
  font: inherit; color: var(--ink);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}
.mod-tile:hover { border-color: var(--line-strong); box-shadow: 0 10px 24px rgba(13, 17, 71, 0.09); transform: translateY(-2px); }
.mod-tile:focus-visible { outline: none; box-shadow: var(--focus); border-color: var(--navy); }
.mod-tile-top { display: flex; align-items: flex-start; justify-content: space-between; width: 100%; margin-bottom: 8px; }
.mod-tile-icon {
  width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center;
  background: var(--navy); color: #fff;
}
.mod-tile-icon svg { width: 24px; height: 24px; }
.mod-tile-go { color: var(--muted); transition: color 0.15s ease, transform 0.15s ease; }
.mod-tile-go svg { width: 20px; height: 20px; display: block; }
.mod-tile:hover .mod-tile-go { color: var(--navy); transform: translate(2px, -2px); }
.mod-tile-name { font-size: 1.02rem; font-weight: 800; color: var(--navy); line-height: 1.3; }
.mod-tile-desc { font-size: 0.84rem; color: var(--muted); line-height: 1.45; }
.mod-tile-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; margin-top: auto; padding-top: 12px; }
.mod-tile-role {
  font-size: 0.72rem; font-weight: 700; padding: 3px 9px; border-radius: 20px;
  background: var(--tint); color: var(--navy); white-space: nowrap;
}
.mod-tile-hint { font-size: 0.72rem; font-weight: 600; color: var(--muted); white-space: nowrap; }
.mod-tile.is-opening { cursor: progress; border-color: var(--navy); }
.mod-tile.is-opening .mod-tile-hint { color: var(--navy); }
.mod-tile.is-opening .mod-tile-hint::after { content: " · opening…"; }

/* Staff view: centered page, no side panel */
.dashboard { max-width: 1120px; }
#dashboardScreen:not(.is-superadmin) .dash-layout { display: block; margin-top: 0; }

/* Superadmin view: full width, side panel down the left */
#dashboardScreen.is-superadmin .dashboard { max-width: none; margin: 0; padding: 0; }
#dashboardScreen.is-superadmin .dash-layout {
  grid-template-columns: 272px minmax(0, 1fr); gap: 0; margin-top: 0; align-items: stretch;
  min-height: calc(100dvh - var(--topbar-h, 67px));
}
#dashboardScreen.is-superadmin .sidebar {
  position: sticky; top: var(--topbar-h, 67px); align-self: start;
  height: calc(100dvh - var(--topbar-h, 67px)); overflow-y: auto;
  border: none; border-right: 1px solid var(--line); border-radius: 0;
  padding: 16px 12px 90px; gap: 2px;
}
#dashboardScreen.is-superadmin .content-panel { padding: 30px 36px 90px; }
#dashboardScreen.is-superadmin .sidebar-tab.active::before { left: -12px; }
.sidebar-label {
  margin: 16px 12px 6px; font-size: 0.68rem; font-weight: 800; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--muted);
}
.sidebar-tab-trail { margin-left: auto; color: var(--muted); flex-shrink: 0; }
.sidebar-tab-trail svg { width: 15px; height: 15px; display: block; }
.sidebar-tab.is-opening { cursor: progress; }
.sidebar-tab.is-opening .sidebar-tab-trail { color: var(--navy); }

@media (max-width: 900px) {
  #dashboardScreen.is-superadmin .dash-layout { grid-template-columns: minmax(0, 1fr); min-height: 0; }
  #dashboardScreen.is-superadmin .sidebar {
    position: sticky; top: var(--topbar-h, 60px); z-index: 15; height: auto; overflow-x: auto; overflow-y: hidden;
    flex-direction: row; align-items: center; padding: 8px 10px;
    border-right: none; border-bottom: 1px solid var(--line); box-shadow: 0 4px 10px rgba(13, 17, 71, 0.05);
  }
  #dashboardScreen.is-superadmin .sidebar-label { display: none; }
  #dashboardScreen.is-superadmin .sidebar-tab.active::before { left: 12px; }
  #dashboardScreen.is-superadmin .content-panel { padding: 22px 20px 90px; }
  .sidebar-tab-trail { margin-left: 4px; }
}
@media (max-width: 640px) {
  .module-grid { grid-template-columns: 1fr; gap: 12px; }
  .mod-tile { min-height: 0; padding: 16px; }
  .mod-tile-top { margin-bottom: 4px; }
  .mod-tile-icon { width: 42px; height: 42px; }
  #dashboardScreen.is-superadmin .content-panel { padding: 18px 14px 90px; }
}

/* ---- Student-number hint on the IMS login ---- */
.student-hint {
  margin-top: 10px; padding: 12px 14px;
  border: 1px solid #F3C98B; background: #FFF6E8; border-radius: var(--radius);
  font-size: 0.82rem; line-height: 1.45; color: var(--ink);
}
.student-hint.hidden { display: none; }
.student-hint-title { margin: 0 0 4px; font-weight: 700; color: #8A4B00; }
.student-hint-text { margin: 0 0 10px; }
.student-hint-btn {
  display: inline-block; padding: 8px 14px; border-radius: 999px;
  background: var(--navy); color: #fff; font-weight: 700; text-decoration: none;
}
.student-hint-btn:hover { background: var(--navy-hover); }
.student-hint-skip {
  display: block; margin-top: 8px; padding: 0; border: none; background: none;
  font: inherit; font-size: 0.78rem; color: var(--muted); text-decoration: underline; cursor: pointer;
}
