.lom-rm-scope {
  --lom-blue: #1a4a7a;
  --lom-blue-dark: #123a61;
  --lom-orange: #c8500a;
  --lom-bg: #f4f5f7;
  --lom-border: #e2e4e8;
  --lom-text: #1a1a1a;
  --lom-radius: 10px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  color: var(--lom-text);
  background: var(--lom-bg);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  isolation: isolate;
}
.lom-rm-scope, .lom-rm-scope * { box-sizing: border-box; }
.lom-rm-scope button, .lom-rm-scope input, .lom-rm-scope select, .lom-rm-scope textarea { font-family: inherit; }

/* ── Login screen ─────────────────────────────────────────── */
.lom-login-wrap {
  min-height: 70vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
  background: linear-gradient(160deg, var(--lom-blue) 0%, var(--lom-blue-dark) 100%);
}
.lom-login-card {
  width: 100%;
  max-width: 380px;
  background: #fff;
  border-radius: 14px;
  padding: 32px 28px;
  box-shadow: 0 12px 36px rgba(0,0,0,0.25);
}
.lom-login-title { font-size: 22px; font-weight: 700; color: var(--lom-blue); text-align: center; }
.lom-login-sub { font-size: 13px; color: #777; text-align: center; margin-bottom: 20px; }
.lom-login-card label { display: block; font-size: 12px; color: #555; margin: 14px 0 4px; font-weight: 600; }
.lom-login-card label:first-of-type { margin-top: 0; }
.lom-login-card input, .lom-login-card select {
  width: 100%; font-size: 15px; padding: 11px 12px; border: 1px solid #d5d8dd; border-radius: 8px; background: #fff;
}
.lom-login-card input:focus, .lom-login-card select:focus {
  outline: none; border-color: var(--lom-blue); box-shadow: 0 0 0 3px rgba(26,74,122,0.15);
}

/* ── Top bar & nav ────────────────────────────────────────── */
.lom-rm-scope .topbar {
  background: var(--lom-blue);
  color: #fff;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 20;
}
.lom-rm-scope .topbar-title { font-size: 17px; font-weight: 700; letter-spacing: -0.01em; }
.lom-rm-scope .topbar-sub { font-size: 12px; opacity: 0.75; margin-top: 2px; }
.lom-rm-scope .topbar-right { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.lom-rm-scope .topbar-right #today-date { font-size: 12px; opacity: 0.8; white-space: nowrap; }
.lom-logout-btn { background: rgba(255,255,255,0.12) !important; color: #fff !important; border-color: rgba(255,255,255,0.3) !important; }
.lom-logout-btn:hover { background: rgba(255,255,255,0.22) !important; }
.lom-nav-toggle {
  display: none;
  background: none; border: none; color: #fff; font-size: 22px; line-height: 1; cursor: pointer; padding: 4px 6px;
}

.lom-rm-scope .nav {
  display: flex; gap: 2px; padding: 8px 12px; background: #fff; border-bottom: 1px solid var(--lom-border);
  flex-wrap: wrap; position: sticky; top: 54px; z-index: 19;
}
.lom-rm-scope .nav-btn {
  padding: 8px 14px; border: 1px solid transparent; border-radius: 6px; font-size: 13px; cursor: pointer;
  background: transparent; color: #555; white-space: nowrap; transition: background .12s, color .12s;
}
.lom-rm-scope .nav-btn:hover { background: var(--lom-bg); color: var(--lom-text); }
.lom-rm-scope .nav-btn.active { background: #e3f0fb; border-color: #b5d4f4; color: var(--lom-blue); font-weight: 700; }

.lom-rm-scope .content { padding: 20px; max-width: 1080px; width: 100%; margin: 0 auto; }
.lom-rm-scope .section { display: none; }
.lom-rm-scope .section.active { display: block; animation: lom-fade .15s ease; }
@keyframes lom-fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

.lom-rm-scope .page-title { font-size: 21px; font-weight: 700; margin-bottom: 4px; }
.lom-rm-scope .page-sub { font-size: 13px; color: #666; margin-bottom: 20px; }

/* ── Cards & grids ────────────────────────────────────────── */
.lom-rm-scope .card {
  background: #fff; border: 1px solid var(--lom-border); border-radius: var(--lom-radius);
  padding: 18px 20px; margin-bottom: 16px; box-shadow: 0 1px 2px rgba(16,24,40,0.03);
}
.lom-rm-scope .card-title {
  font-size: 14px; font-weight: 700; margin-bottom: 14px; padding-bottom: 10px;
  border-bottom: 1px solid #eee; color: #303030;
}
.lom-rm-scope .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.lom-rm-scope .grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.lom-rm-scope .grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }

.lom-rm-scope .metric { background: var(--lom-bg); border-radius: 10px; padding: 14px 16px; }
.lom-rm-scope .metric-label { font-size: 12px; color: #666; margin-bottom: 4px; }
.lom-rm-scope .metric-val { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; }
.lom-rm-scope .metric-val.blue { color: var(--lom-blue); }
.lom-rm-scope .metric-val.warn { color: var(--lom-orange); }

/* ── Forms ────────────────────────────────────────────────── */
.lom-rm-scope label { display: block; font-size: 12px; color: #555; margin-bottom: 4px; margin-top: 12px; font-weight: 600; }
.lom-rm-scope label:first-child { margin-top: 0; }
.lom-rm-scope input, .lom-rm-scope select, .lom-rm-scope textarea {
  width: 100%; font-size: 14.5px; padding: 10px 12px; border: 1px solid #ccc; border-radius: 7px; background: #fff; color: var(--lom-text);
}
.lom-rm-scope input:focus, .lom-rm-scope select:focus, .lom-rm-scope textarea:focus {
  outline: none; border-color: var(--lom-blue); box-shadow: 0 0 0 3px rgba(26,74,122,0.12);
}
.lom-rm-scope textarea { resize: vertical; min-height: 60px; }

.lom-rm-scope .btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 9px 18px; border: 1px solid #ccc; border-radius: 7px;
  font-size: 13.5px; cursor: pointer; background: #fff; color: var(--lom-text); font-weight: 600; transition: background .12s;
  min-height: 40px;
}
.lom-rm-scope .btn:hover { background: var(--lom-bg); }
.lom-rm-scope .btn-primary { background: var(--lom-blue); color: #fff; border-color: var(--lom-blue); }
.lom-rm-scope .btn-primary:hover { background: var(--lom-blue-dark); }
.lom-rm-scope .btn-danger { color: #a32d2d; border-color: #e24b4a; }
.lom-rm-scope .btn-danger:hover { background: #fcebeb; }
.lom-rm-scope .btn-sm { padding: 6px 12px; font-size: 12px; min-height: 32px; }

.lom-rm-scope .form-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; align-items: center; }
.lom-rm-scope .toolbar-row { display: flex; gap: 10px; margin-bottom: 14px; align-items: flex-end; flex-wrap: wrap; }

/* ── Badges & alerts ──────────────────────────────────────── */
.lom-rm-scope .badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 700; }
.lom-rm-scope .badge-green { background: #e6f4ea; color: #1e6b2e; }
.lom-rm-scope .badge-amber { background: #fef3e2; color: #7a4a00; }
.lom-rm-scope .badge-red { background: #fce8e8; color: #8b1a1a; }
.lom-rm-scope .badge-blue { background: #e3f0fb; color: #0d4585; }
.lom-rm-scope .badge-teal { background: #e0f4f1; color: #0a5246; }
.lom-rm-scope .badge-gray { background: #f0f0f0; color: #555; }

.lom-rm-scope .alert { padding: 11px 15px; border-radius: 8px; font-size: 13px; margin-bottom: 12px; }
.lom-rm-scope .alert-info { background: #e3f0fb; color: #0d4585; border: 1px solid #b5d4f4; }
.lom-rm-scope .alert-success { background: #e6f4ea; color: #1e6b2e; border: 1px solid #a8d5b0; }
.lom-rm-scope .alert-warning { background: #fef3e2; color: #7a4a00; border: 1px solid #f5c842; }

.lom-rm-scope .divider { border: none; border-top: 1px solid #eee; margin: 16px 0; }
.lom-rm-scope .muted { color: #888; }
.lom-rm-scope .muted-sm { color: #888; font-size: 12px; }
.lom-rm-scope .empty-cell { color: #888; text-align: center; padding: 24px; }
.lom-rm-scope .empty-inline { color: #aaa; font-size: 13px; padding: 4px 0; }

/* ── Tables ───────────────────────────────────────────────── */
.lom-rm-scope table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.lom-rm-scope th { text-align: left; padding: 10px; font-weight: 700; font-size: 12px; color: #555; border-bottom: 1px solid #eee; background: #fafafa; }
.lom-rm-scope td { padding: 10px; border-bottom: 1px solid #f0f0f0; vertical-align: top; }
.lom-rm-scope tr:last-child td { border-bottom: none; }
.lom-rm-scope tr:hover td { background: #fafbfc; }
.lom-rm-scope .table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.lom-rm-scope .tab-row { display: flex; border-bottom: 1px solid var(--lom-border); margin-bottom: 16px; overflow-x: auto; }
.lom-rm-scope .tab { padding: 9px 18px; font-size: 13px; cursor: pointer; color: #666; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.lom-rm-scope .tab.active { color: var(--lom-blue); font-weight: 700; border-bottom-color: var(--lom-blue); }
.lom-rm-scope .sub-section { display: none; }
.lom-rm-scope .sub-section.active { display: block; }

.lom-rm-scope .attend-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid #f0f0f0; flex-wrap: wrap; }
.lom-rm-scope .attend-row:last-child { border-bottom: none; }
.lom-rm-scope .attend-name { flex: 1; font-size: 13.5px; min-width: 160px; }
.lom-rm-scope .chip-group { display: flex; gap: 5px; flex-wrap: wrap; }
.lom-rm-scope .chip { padding: 6px 13px; border-radius: 20px; font-size: 12px; cursor: pointer; border: 1px solid #ccc; background: #fff; color: #555; }
.lom-rm-scope .chip:hover { border-color: #999; }
.lom-rm-scope .chip.sel-present { background: #e6f4ea; color: #1e6b2e; border-color: #5cb370; }
.lom-rm-scope .chip.sel-apology { background: #fef3e2; color: #7a4a00; border-color: #f0a500; }
.lom-rm-scope .chip.sel-represented { background: #e3f0fb; color: #1a4a7a; border-color: #5b9bd5; }
.lom-rm-scope .chip.sel-absent { background: #fce8e8; color: #8b1a1a; border-color: #e24b4a; }

.lom-rm-scope .report-header { background: var(--lom-blue); color: #fff; padding: 16px 20px; border-radius: 10px; margin-bottom: 16px; }
.lom-rm-scope .report-header h2 { font-size: 17px; font-weight: 700; color: #fff !important; margin: 0; }
.lom-rm-scope .report-header p { font-size: 12px; color: #fff !important; opacity: 0.9; margin-top: 4px; }
.lom-rm-scope .vis-checks { display: flex; flex-direction: column; gap: 6px; margin: 4px 0 8px; }
.lom-rm-scope .vis-check { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 400; margin: 0; cursor: pointer; }
.lom-rm-scope .vis-check input { width: auto; margin: 0; }
.lom-rm-scope .rt td:first-child { color: #555; font-size: 12.5px; width: 65%; }
.lom-rm-scope .rt td:last-child { font-weight: 700; text-align: right; }
.lom-rm-scope .hundred-item { background: #e6f4ea; color: #1e6b2e; border: 1px solid #5cb370; padding: 7px 13px; border-radius: 7px; font-size: 13px; margin-bottom: 6px; font-weight: 600; }
/* View-only logins: hide every write control; visited/form toggles become read-only */
.lom-rm-scope.lom-viewer .lom-write-only,
.lom-rm-scope.lom-viewer [data-edit],
.lom-rm-scope.lom-viewer [data-editp],
.lom-rm-scope.lom-viewer [data-rm],
.lom-rm-scope.lom-viewer [data-rmvis],
.lom-rm-scope.lom-viewer [data-editvis] { display: none !important; }
.lom-rm-scope.lom-viewer [data-toggle] { pointer-events: none; cursor: default; }
.lom-rm-scope .report-signoff { margin-top: 4px; }
.lom-rm-scope .sign-block { text-align: center; padding: 28px 10px 10px; }
.lom-rm-scope .sign-line { border-bottom: 1.5px solid #444; margin-bottom: 6px; height: 0; }
.lom-rm-scope .sign-name { font-weight: 700; font-size: 14px; }
.lom-rm-scope .sign-role { font-size: 12px; color: #666; margin-top: 2px; }
.lom-rm-scope .sign-caption { font-size: 11px; color: #999; text-transform: uppercase; letter-spacing: 0.05em; margin-top: 10px; }
.lom-rm-scope .officer-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid #f0f0f0; }
.lom-rm-scope .officer-row:last-child { border-bottom: none; }
.lom-rm-scope .officer-role { font-size: 12px; color: #666; min-width: 130px; }
.lom-rm-scope .praes-row { display: flex; align-items: center; gap: 10px; padding: 11px 0; border-bottom: 1px solid #f0f0f0; }
.lom-rm-scope .praes-row:last-child { border-bottom: none; }
.lom-rm-scope .loader { text-align: center; color: #888; padding: 24px; font-size: 13px; }
.lom-rm-scope .list-row { padding: 6px 0; border-bottom: 1px solid #f0f0f0; font-size: 13px; }
.lom-rm-scope .removable-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid #f0f0f0; flex-wrap: wrap; }
.lom-rm-scope .hint { font-size: 13px; color: #666; margin-bottom: 12px; }

.lom-rm-scope .toast {
  position: fixed; bottom: 24px; right: 24px; left: auto; background: #1e6b2e; color: #fff; padding: 12px 20px;
  border-radius: 9px; font-size: 13px; font-weight: 600; z-index: 999; display: none; box-shadow: 0 6px 20px rgba(0,0,0,0.2);
  max-width: calc(100% - 48px);
}
.lom-rm-scope .toast.show { display: block; }

.lom-rm-scope .month-block { margin-bottom: 20px; }
.lom-rm-scope .month-label {
  font-size: 13px; font-weight: 800; color: var(--lom-blue); text-transform: uppercase; letter-spacing: 0.05em;
  margin-bottom: 8px; padding: 7px 12px; background: #e3f0fb; border-radius: 7px; display: flex; align-items: center;
  justify-content: space-between; flex-wrap: wrap; gap: 6px;
}
.lom-rm-scope .sched-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--lom-border);
  border-radius: 9px; margin-bottom: 6px; background: #fff; flex-wrap: wrap;
}
.lom-rm-scope .sched-item.done { background: #f4fbf6; border-color: #a8d5b0; }
.lom-rm-scope .sched-visitor { font-weight: 700; font-size: 13px; flex: 1; min-width: 100px; }
.lom-rm-scope .sched-arrow { color: #aaa; font-size: 16px; }
.lom-rm-scope .sched-visitee { font-size: 13px; color: #555; flex: 1; min-width: 100px; }
.lom-rm-scope .toggle-done { padding: 6px 13px; border-radius: 20px; font-size: 12px; cursor: pointer; border: 1px solid #ccc; background: #fff; color: #555; white-space: nowrap; }
.lom-rm-scope .toggle-done.is-done { background: #e6f4ea; color: #1e6b2e; border-color: #5cb370; }
.lom-rm-scope .rep-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border: 1px solid var(--lom-border); border-radius: 9px; margin-bottom: 6px; background: #fff; font-size: 13px; }
.lom-rm-scope .rep-item span { flex: 1; font-weight: 600; }
.lom-rm-scope .year-selector { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.lom-rm-scope .year-selector button { padding: 7px 14px; border: 1px solid #ccc; border-radius: 7px; cursor: pointer; background: #fff; font-size: 13px; }
.lom-rm-scope .year-selector span { font-size: 17px; font-weight: 800; color: var(--lom-blue); min-width: 60px; text-align: center; }

/* ── Tablet (<=900px) ─────────────────────────────────────── */
@media (max-width: 900px) {
  .lom-rm-scope .grid4 { grid-template-columns: 1fr 1fr; }
  .lom-rm-scope .grid3 { grid-template-columns: 1fr 1fr; }
  .lom-rm-scope .grid2 { grid-template-columns: 1fr; }
}

/* ── Mobile (<=640px) ─────────────────────────────────────── */
@media (max-width: 640px) {
  .lom-rm-scope { font-size: 15px; border-radius: 0; }
  .lom-rm-scope .content { padding: 14px; }
  .lom-rm-scope .grid4 { grid-template-columns: 1fr 1fr; gap: 10px; }
  .lom-rm-scope .grid3 { grid-template-columns: 1fr; }
  .lom-rm-scope .card { padding: 14px 15px; }
  .lom-rm-scope .page-title { font-size: 19px; }

  .lom-nav-toggle { display: inline-block; }
  .lom-rm-scope .nav {
    display: none; flex-direction: column; position: fixed; top: 54px; left: 0; right: 0; bottom: 0;
    background: #fff; z-index: 30; padding: 10px; overflow-y: auto;
  }
  .lom-rm-scope .nav.lom-nav-open { display: flex; }
  .lom-rm-scope .nav-btn { text-align: left; padding: 13px 14px; font-size: 15px; border-radius: 8px; }
  .lom-rm-scope .topbar-right #today-date { display: none; }

  .lom-rm-scope .form-actions .btn, .lom-rm-scope .toolbar-row .btn { width: 100%; justify-content: center; }
  .lom-rm-scope .toolbar-row { flex-direction: column; align-items: stretch; }
  .lom-rm-scope .toolbar-row > div { width: 100%; }

  /* Members tables collapse into stacked cards */
  .lom-rm-scope #section-members table thead { display: none; }
  .lom-rm-scope #section-members table, .lom-rm-scope #section-members tbody, .lom-rm-scope #section-members tr, .lom-rm-scope #section-members td {
    display: block; width: 100%;
  }
  .lom-rm-scope #section-members tr { border: 1px solid var(--lom-border); border-radius: 9px; margin-bottom: 10px; padding: 6px 12px; }
  .lom-rm-scope #section-members td { border-bottom: none; padding: 6px 0; display: flex; justify-content: space-between; gap: 10px; }
  .lom-rm-scope #section-members td[data-label]::before { content: attr(data-label); font-weight: 700; color: #777; font-size: 11px; text-transform: uppercase; }
  .lom-rm-scope #section-members td:last-child { justify-content: flex-end; }

  .lom-rm-scope .toast { left: 12px; right: 12px; bottom: 12px; text-align: center; }
}

/* ── Print (report output) ───────────────────────────────── */
@media print {
  .lom-rm-scope .topbar, .lom-rm-scope .nav, .lom-rm-scope .btn, .lom-rm-scope .tab-row,
  .lom-rm-scope select, .lom-rm-scope input[type="file"] { display: none !important; }
  .lom-rm-scope .card { border: 1px solid #ccc; page-break-inside: avoid; box-shadow: none; }
  .lom-rm-scope .report-header { background: #1a4a7a !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .lom-rm-scope { box-shadow: none; border-radius: 0; }
}
