/* RMW shared staff theme.
   Every selector is scoped under body.rmw-theme, so linking this file
   changes nothing until an app adds that class.
   Gold #C9922A is the default accent (rmw-accent-gold). Brown and blue
   are optional body classes. Light is the default; dark follows
   data-bs-theme="dark" on an ancestor (the <html> tag), which
   rmw-theme.js sets from the OS/browser prefers-color-scheme.
   Warning amber (--rmw-warning) is deliberately distinct from brand gold.
   The dashboard /preview/ legacy block (.brand-mark, .navbar-fieldwork,
   .tile-card, .btn-rmw, and the old preview gold) is intentionally omitted. */

/* Default tokens are gold, even with no accent class. */
body.rmw-theme {
  --rmw-accent: #C9922A;
  --rmw-accent-rgb: 201,146,42;
  --rmw-accent-btn: #C9922A;
  --rmw-accent-hover: #B07F1E;
  --rmw-on-accent: #1A1A1A;
  --rmw-accent-text: #7D5A12;
  --rmw-accent-text-rgb: 125,90,18;
  --rmw-accent-text-hover-rgb: 94,67,13;
  --rmw-accent-tint: rgba(201,146,42,.16);
  --rmw-page: #f4f6f9;
  --rmw-ink: #1A1A1A;
  --rmw-muted: #6c757d;
  --rmw-card: #fff;
  --rmw-card-quiet: #fbfcfd;
  --rmw-shadow: 0 4px 12px rgba(0,0,0,.05);
  --rmw-shadow-hover: 0 8px 22px rgba(0,0,0,.09);
  --rmw-nav-bg: #1a1d21;
  --rmw-warning: #F59E0B;
  --rmw-warning-tint: rgba(245,158,11,.18);
  --rmw-warning-text: #C2620A;

  --bs-primary: var(--rmw-accent);
  --bs-primary-rgb: var(--rmw-accent-rgb);
  --bs-link-color: var(--rmw-accent-text);
  --bs-link-color-rgb: var(--rmw-accent-text-rgb);
  --bs-link-hover-color: rgb(var(--rmw-accent-text-hover-rgb));
  --bs-link-hover-color-rgb: var(--rmw-accent-text-hover-rgb);
  --bs-primary-text-emphasis: var(--rmw-accent-text);
  --bs-primary-bg-subtle: var(--rmw-accent-tint);
  --bs-primary-border-subtle: rgba(var(--rmw-accent-rgb), .35);
  --bs-body-bg: var(--rmw-page);
  --bs-body-color: var(--rmw-ink);
  --bs-progress-bar-bg: var(--rmw-accent-btn);
  --bs-progress-bar-color: var(--rmw-on-accent);
  --bs-list-group-active-bg: var(--rmw-accent-btn);
  --bs-list-group-active-color: var(--rmw-on-accent);
  --bs-list-group-active-border-color: var(--rmw-accent-btn);
  --bs-nav-pills-link-active-bg: var(--rmw-accent-btn);
  --bs-nav-pills-link-active-color: var(--rmw-on-accent);
  --bs-pagination-color: var(--rmw-accent-text);
  --bs-pagination-hover-color: rgb(var(--rmw-accent-text-hover-rgb));
  --bs-pagination-active-bg: var(--rmw-accent-btn);
  --bs-pagination-active-border-color: var(--rmw-accent-btn);
  --bs-pagination-active-color: var(--rmw-on-accent);
  --bs-dropdown-link-active-bg: var(--rmw-accent-btn);
  --bs-dropdown-link-active-color: var(--rmw-on-accent);

  padding-top: 70px;
  background: var(--rmw-page);
  color: var(--rmw-ink);
}

body.rmw-theme.rmw-accent-gold {
  --rmw-accent: #C9922A;
  --rmw-accent-rgb: 201,146,42;
  --rmw-accent-btn: #C9922A;
  --rmw-accent-hover: #B07F1E;
  --rmw-on-accent: #1A1A1A;
  --rmw-accent-text: #7D5A12;
  --rmw-accent-text-rgb: 125,90,18;
  --rmw-accent-text-hover-rgb: 94,67,13;
  --rmw-accent-tint: rgba(201,146,42,.16);
}

body.rmw-theme.rmw-accent-brown {
  --rmw-accent: #B06D05;
  --rmw-accent-rgb: 176,109,5;
  --rmw-accent-btn: #9C6104;
  --rmw-accent-hover: #7A4F0A;
  --rmw-on-accent: #fff;
  --rmw-accent-text: #8B5E1A;
  --rmw-accent-text-rgb: 139,94,26;
  --rmw-accent-text-hover-rgb: 111,74,20;
  --rmw-accent-tint: rgba(176,109,5,.12);
}

body.rmw-theme.rmw-accent-blue {
  --rmw-accent: #0d6efd;
  --rmw-accent-rgb: 13,110,253;
  --rmw-accent-btn: #0d6efd;
  --rmw-accent-hover: #0b5ed7;
  --rmw-on-accent: #fff;
  --rmw-accent-text: #0d6efd;
  --rmw-accent-text-rgb: 13,110,253;
  --rmw-accent-text-hover-rgb: 10,88,202;
  --rmw-accent-tint: rgba(13,110,253,.1);
}

[data-bs-theme="dark"] body.rmw-theme {
  --rmw-page: #121418;
  --rmw-ink: #e9ecef;
  --rmw-muted: #9aa3ad;
  --rmw-card: #1b1f24;
  --rmw-card-quiet: #171a1f;
  --rmw-shadow: 0 4px 12px rgba(0,0,0,.35);
  --rmw-shadow-hover: 0 8px 22px rgba(0,0,0,.55);
  --bs-body-bg: #121418;
  --bs-body-color: #e9ecef;
}

[data-bs-theme="dark"] body.rmw-theme:not(.rmw-accent-brown):not(.rmw-accent-blue) {
  --rmw-accent-text: #E0B55A;
  --rmw-accent-text-rgb: 224,181,90;
  --rmw-accent-text-hover-rgb: 238,201,122;
  --rmw-accent-tint: rgba(201,146,42,.22);
}

[data-bs-theme="dark"] body.rmw-theme.rmw-accent-brown {
  --rmw-accent-text: #E6C08A;
  --rmw-accent-text-rgb: 230,192,138;
  --rmw-accent-text-hover-rgb: 242,214,176;
  --rmw-accent-tint: rgba(176,109,5,.22);
}

[data-bs-theme="dark"] body.rmw-theme.rmw-accent-blue {
  --rmw-accent-text: #9ec5fe;
  --rmw-accent-text-rgb: 158,197,254;
  --rmw-accent-text-hover-rgb: 185,216,254;
  --rmw-accent-tint: rgba(13,110,253,.22);
}

/* Navbar: near-black bar, 3px accent rule. */
body.rmw-theme .navbar.rmw-navbar,
body.rmw-theme > .navbar.fixed-top {
  background-color: var(--rmw-nav-bg, #1a1d21) !important;
  border-bottom: 3px solid var(--rmw-accent);
}

body.rmw-theme .navbar.rmw-navbar .nav-link,
body.rmw-theme > .navbar.fixed-top .nav-link {
  color: rgba(255,255,255,.75);
}

body.rmw-theme .navbar.rmw-navbar .nav-link:hover,
body.rmw-theme .navbar.rmw-navbar .nav-link:focus,
body.rmw-theme > .navbar.fixed-top .nav-link:hover,
body.rmw-theme > .navbar.fixed-top .nav-link:focus {
  color: #fff;
}

body.rmw-theme .navbar .navbar-nav .nav-link.active,
body.rmw-theme .navbar-dark .navbar-nav .nav-link.active {
  color: var(--rmw-accent) !important;
  font-weight: 600;
  border-bottom: 2px solid var(--rmw-accent);
}

body.rmw-theme .rmw-brand {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  font-weight: 700;
  letter-spacing: .01em;
  color: #fff;
}

body.rmw-theme .rmw-brand:hover,
body.rmw-theme .rmw-brand:focus {
  color: #fff;
}

body.rmw-theme .rmw-logo {
  height: 30px;
  width: auto;
}

/* Primary is the accent. Text on gold is #1A1A1A (on-accent). */
body.rmw-theme .btn-primary {
  --bs-btn-bg: var(--rmw-accent-btn);
  --bs-btn-border-color: var(--rmw-accent-btn);
  --bs-btn-color: var(--rmw-on-accent);
  --bs-btn-hover-bg: var(--rmw-accent-hover);
  --bs-btn-hover-border-color: var(--rmw-accent-hover);
  --bs-btn-hover-color: var(--rmw-on-accent);
  --bs-btn-active-bg: var(--rmw-accent-hover);
  --bs-btn-active-border-color: var(--rmw-accent-hover);
  --bs-btn-active-color: var(--rmw-on-accent);
  --bs-btn-disabled-bg: var(--rmw-accent-btn);
  --bs-btn-disabled-border-color: var(--rmw-accent-btn);
  --bs-btn-disabled-color: var(--rmw-on-accent);
  --bs-btn-focus-shadow-rgb: var(--rmw-accent-rgb);
  background-color: var(--rmw-accent-btn);
  border-color: var(--rmw-accent-btn);
  color: var(--rmw-on-accent) !important;
  font-weight: 700;
}

body.rmw-theme .btn-primary:hover,
body.rmw-theme .btn-primary:focus,
body.rmw-theme .btn-primary:active {
  background-color: var(--rmw-accent-hover);
  border-color: var(--rmw-accent-hover);
  color: var(--rmw-on-accent) !important;
}

body.rmw-theme .btn-outline-primary {
  --bs-btn-color: var(--rmw-accent-text);
  --bs-btn-border-color: var(--rmw-accent);
  --bs-btn-hover-bg: var(--rmw-accent-btn);
  --bs-btn-hover-border-color: var(--rmw-accent-btn);
  --bs-btn-hover-color: var(--rmw-on-accent);
  --bs-btn-active-bg: var(--rmw-accent-hover);
  --bs-btn-active-border-color: var(--rmw-accent-hover);
  --bs-btn-active-color: var(--rmw-on-accent);
  --bs-btn-focus-shadow-rgb: var(--rmw-accent-rgb);
  color: var(--rmw-accent-text);
  border-color: var(--rmw-accent);
}

body.rmw-theme .btn-outline-primary:hover,
body.rmw-theme .btn-outline-primary:focus,
body.rmw-theme .btn-outline-primary:active {
  background-color: var(--rmw-accent-btn);
  border-color: var(--rmw-accent-btn);
  color: var(--rmw-on-accent);
}

body.rmw-theme .btn-link {
  --bs-btn-color: var(--rmw-accent-text);
  --bs-btn-hover-color: rgb(var(--rmw-accent-text-hover-rgb));
  --bs-btn-active-color: rgb(var(--rmw-accent-text-hover-rgb));
}

body.rmw-theme .text-primary {
  color: var(--rmw-accent-text) !important;
}

/* bg-primary text-white stays readable: dark ink on gold. */
body.rmw-theme .bg-primary,
body.rmw-theme .bg-primary.text-white,
body.rmw-theme .text-white.bg-primary,
body.rmw-theme .text-bg-primary,
body.rmw-theme .badge.bg-primary {
  background-color: var(--rmw-accent-btn) !important;
  color: var(--rmw-on-accent) !important;
}

body.rmw-theme .progress-bar {
  background-color: var(--rmw-accent-btn);
  color: var(--rmw-on-accent);
}

body.rmw-theme .progress-bar.bg-success,
body.rmw-theme .progress-bar.bg-danger,
body.rmw-theme .progress-bar.bg-info,
body.rmw-theme .progress-bar.bg-secondary {
  color: #fff;
}

body.rmw-theme .progress-bar.bg-warning {
  color: #1A1A1A;
}

body.rmw-theme .list-group-item.active {
  background-color: var(--rmw-accent-btn) !important;
  border-color: var(--rmw-accent-btn) !important;
  color: var(--rmw-on-accent) !important;
}

body.rmw-theme .nav-pills .nav-link.active,
body.rmw-theme .nav-pills .show > .nav-link {
  background-color: var(--rmw-accent-btn) !important;
  color: var(--rmw-on-accent) !important;
}

body.rmw-theme .page-item.active .page-link {
  background-color: var(--rmw-accent-btn) !important;
  border-color: var(--rmw-accent-btn) !important;
  color: var(--rmw-on-accent) !important;
}

body.rmw-theme .dropdown-item.active,
body.rmw-theme .dropdown-item:active {
  background-color: var(--rmw-accent-btn) !important;
  color: var(--rmw-on-accent) !important;
}

body.rmw-theme .form-control:focus,
body.rmw-theme .form-select:focus,
body.rmw-theme .form-check-input:focus,
body.rmw-theme .btn:focus {
  border-color: var(--rmw-accent);
  box-shadow: 0 0 0 .2rem rgba(var(--rmw-accent-rgb), .25);
}

body.rmw-theme .form-check-input:checked {
  background-color: var(--rmw-accent-btn);
  border-color: var(--rmw-accent-btn);
}

body.rmw-theme:not(.rmw-accent-brown):not(.rmw-accent-blue) .form-check-input:checked[type="checkbox"] {
  --bs-form-check-bg-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill='none' stroke='%231A1A1A' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='m6 10 3 3 6-6'/%3e%3c/svg%3e");
}

body.rmw-theme:not(.rmw-accent-brown):not(.rmw-accent-blue) .form-check-input:checked[type="radio"] {
  --bs-form-check-bg-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='2' fill='%231A1A1A'/%3e%3c/svg%3e");
}

body.rmw-theme input[type="checkbox"],
body.rmw-theme input[type="radio"] {
  accent-color: var(--rmw-accent-btn);
}

body.rmw-theme h1,
body.rmw-theme h2,
body.rmw-theme h3,
body.rmw-theme h4,
body.rmw-theme h5,
body.rmw-theme h6 {
  color: var(--rmw-ink);
}

body.rmw-theme .text-muted {
  color: var(--rmw-muted) !important;
}

/* Cards: borderless, soft shadow, semibold header with a hairline. */
body.rmw-theme .card {
  border: 0;
  box-shadow: var(--rmw-shadow);
  background: var(--rmw-card);
  color: var(--rmw-ink);
}

body.rmw-theme .card-header {
  background: var(--rmw-card);
  font-weight: 600;
  border-bottom: 1px solid rgba(0,0,0,.06);
}

[data-bs-theme="dark"] body.rmw-theme .card-header {
  border-bottom-color: rgba(255,255,255,.08);
}

body.rmw-theme .rmw-section-title,
body.rmw-theme .hub-section-title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--rmw-muted) !important;
  margin: 0 0 .6rem;
}

body.rmw-theme .dash-icon {
  width: 2.1rem;
  height: 2.1rem;
  border-radius: .5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .95rem;
  flex-shrink: 0;
}

body.rmw-theme .tile-primary .dash-icon {
  background: var(--rmw-accent-tint);
  color: var(--rmw-accent-text);
}

body.rmw-theme .tile-success .dash-icon {
  background: rgba(25,135,84,.1);
  color: #198754;
}

body.rmw-theme .tile-danger .dash-icon {
  background: rgba(220,53,69,.1);
  color: #dc3545;
}

/* Warning is amber, not brand gold, so it never reads as "primary". */
body.rmw-theme .tile-warning .dash-icon {
  background: var(--rmw-warning-tint);
  color: var(--rmw-warning-text);
}

[data-bs-theme="dark"] body.rmw-theme .tile-warning .dash-icon {
  background: rgba(251,146,60,.18);
  color: #FB9A3C;
}

body.rmw-theme .tile-info .dash-icon {
  background: rgba(13,202,240,.12);
  color: #0a8ea8;
}

body.rmw-theme .tile-secondary .dash-icon {
  background: rgba(33,37,41,.07);
  color: #495057;
}

[data-bs-theme="dark"] body.rmw-theme .tile-success .dash-icon {
  background: rgba(117,183,152,.16);
  color: #8fd1ae;
}

[data-bs-theme="dark"] body.rmw-theme .tile-danger .dash-icon {
  background: rgba(234,134,143,.16);
  color: #f1a0a8;
}

[data-bs-theme="dark"] body.rmw-theme .tile-info .dash-icon {
  background: rgba(110,223,246,.14);
  color: #7fdcf0;
}

[data-bs-theme="dark"] body.rmw-theme .tile-secondary .dash-icon {
  background: rgba(255,255,255,.08);
  color: #c3c9cf;
}

body.rmw-theme .hub-tile {
  border: 1px solid transparent;
}

body.rmw-theme .card.hub-tile {
  border: 1px solid transparent;
}

body.rmw-theme .hub-tile .card-body {
  padding: 1.1rem 1.25rem;
}

body.rmw-theme .hub-tile-head {
  display: flex;
  align-items: center;
  gap: .6rem;
  margin-bottom: .5rem;
}

body.rmw-theme .hub-tile .tile-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--rmw-ink);
  text-decoration: none;
}

body.rmw-theme .hub-tile-text {
  font-size: .875rem;
  color: var(--rmw-muted);
  margin-bottom: .75rem;
}

body.rmw-theme .hub-links {
  font-size: .825rem;
  margin-top: .5rem;
}

body.rmw-theme .hub-links a {
  text-decoration: none;
}

body.rmw-theme .hub-tile-quiet {
  background: var(--rmw-card-quiet);
  box-shadow: 0 2px 6px rgba(0,0,0,.035);
}

body.rmw-theme .hub-tile-quiet .tile-title {
  font-size: .95rem;
}

body.rmw-theme .hub-clickable {
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}

body.rmw-theme .hub-clickable:hover {
  transform: translateY(-2px);
  box-shadow: var(--rmw-shadow-hover);
  border-color: rgba(var(--rmw-accent-rgb), .65);
}

body.rmw-theme .hub-clickable .hub-links a,
body.rmw-theme .hub-clickable .hub-inner {
  position: relative;
  z-index: 2;
}

body.rmw-theme .hub-clickable .hub-links a:hover,
body.rmw-theme .hub-clickable .hub-inner:hover {
  text-decoration: underline;
}

body.rmw-theme a.tile-title:hover {
  color: var(--rmw-accent-text);
}

body.rmw-theme .hub-card-link:focus {
  outline: none;
}

body.rmw-theme .hub-card-link:focus-visible {
  outline: 3px solid var(--rmw-accent);
  outline-offset: 2px;
  border-radius: .2rem;
}

@supports selector(:has(a)) {
  body.rmw-theme .hub-card-link:focus-visible {
    outline: none;
  }
  body.rmw-theme .hub-clickable:has(.hub-card-link:focus-visible) {
    outline: 3px solid var(--rmw-accent);
    outline-offset: 3px;
  }
}

body.rmw-theme .hub-tile-soon,
body.rmw-theme .card.hub-tile-soon {
  opacity: .72;
  box-shadow: none;
  border: 1px dashed rgba(0,0,0,.12);
  background: transparent;
}

[data-bs-theme="dark"] body.rmw-theme .hub-tile-soon {
  border-color: rgba(255,255,255,.14);
}

body.rmw-theme .hub-tile-soon .dash-icon {
  filter: grayscale(1);
}

body.rmw-theme .admin-pill {
  background: var(--rmw-accent-tint);
  color: var(--rmw-accent-text);
  border: 1px solid rgba(var(--rmw-accent-rgb), .45);
  font-weight: 600;
}

body.rmw-theme .soon-pill {
  background: transparent;
  color: var(--rmw-muted);
  border: 1px solid currentColor;
  font-weight: 600;
}

body.rmw-theme .sep-pill,
body.rmw-theme .google-pill {
  font-weight: 600;
}

[data-bs-theme="dark"] body.rmw-theme .sep-pill,
[data-bs-theme="dark"] body.rmw-theme .google-pill {
  background: #262b31 !important;
  color: #dee2e6 !important;
  border-color: #3a4048 !important;
}

body.rmw-theme .card.hub-welcome {
  border-left: 3px solid var(--rmw-accent);
}

body.rmw-theme .hub-welcome .card-body {
  padding: .9rem 1.25rem;
}

/* Login card: 3px accent top bar, 64px logo.
   .card is display:flex (column), so a bare <img> child is stretched to the
   card width (align-items: stretch) while its height stays fixed: the square
   logo came out ~400x56 on Badges / RMW Time / NDG. align-self keeps the
   intrinsic aspect ratio; max-width + object-fit guard narrow cards. */
body.rmw-theme .rmw-login-card,
body.rmw-theme .card.rmw-login-card {
  border-top: 3px solid var(--rmw-accent);
  overflow: hidden;
}

body.rmw-theme .rmw-login-logo,
body.rmw-theme .rmw-login-card .rmw-logo {
  height: 64px;
  width: auto;
  max-width: 100%;
  align-self: flex-start;
  flex: 0 0 auto;
  object-fit: contain;
}

body.rmw-theme .login-divider {
  display: flex;
  align-items: center;
  gap: .75rem;
  color: var(--rmw-muted);
  font-size: .8rem;
}

body.rmw-theme .login-divider::before,
body.rmw-theme .login-divider::after {
  content: "";
  flex: 1;
  border-top: 1px solid rgba(0,0,0,.1);
}

[data-bs-theme="dark"] body.rmw-theme .login-divider::before,
[data-bs-theme="dark"] body.rmw-theme .login-divider::after {
  border-top-color: rgba(255,255,255,.12);
}

/* Done -> Dashboard pill. The partial supplies the label and URL. */
body.rmw-theme .rmw-done-btn {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 1030;
  background: #1a1d21;
  color: #fff;
  border: 2px solid var(--rmw-accent);
  border-radius: 999px;
  font-weight: 600;
  padding: .5rem 1.05rem;
  box-shadow: var(--rmw-shadow);
  text-decoration: none;
  white-space: nowrap;
}

body.rmw-theme .rmw-done-btn:hover,
body.rmw-theme .rmw-done-btn:focus {
  background: var(--rmw-accent);
  color: var(--rmw-on-accent);
  border-color: var(--rmw-accent);
}

[data-bs-theme="dark"] body.rmw-theme .table {
  --bs-table-color: var(--rmw-ink);
  --bs-table-bg: transparent;
  --bs-table-border-color: rgba(255,255,255,.12);
  --bs-table-striped-bg: rgba(255,255,255,.04);
  --bs-table-striped-color: var(--rmw-ink);
  --bs-table-hover-bg: rgba(255,255,255,.06);
  --bs-table-hover-color: var(--rmw-ink);
  --bs-table-active-bg: rgba(201,146,42,.16);
  --bs-table-active-color: var(--rmw-ink);
  color: var(--rmw-ink);
  border-color: rgba(255,255,255,.12);
}

/* Dark mode: Bootstrap keeps .table-light / .bg-light light even in dark mode.
   Under the RMW theme they follow the dark surface so headers do not glare. */
[data-bs-theme="dark"] body.rmw-theme .table-light {
    --bs-table-color: var(--bs-emphasis-color);
    --bs-table-bg: #24282d;
    --bs-table-border-color: #373b3e;
    --bs-table-striped-bg: #2a2e33;
    --bs-table-striped-color: var(--bs-emphasis-color);
    --bs-table-active-bg: #30353a;
    --bs-table-active-color: var(--bs-emphasis-color);
    --bs-table-hover-bg: #2d3237;
    --bs-table-hover-color: var(--bs-emphasis-color);
    color: var(--bs-table-color);
    border-color: var(--bs-table-border-color);
}

[data-bs-theme="dark"] body.rmw-theme .bg-light {
    background-color: var(--bs-tertiary-bg) !important;
    color: var(--bs-body-color);
}

@media print {
  body.rmw-theme .navbar,
  body.rmw-theme .rmw-done-btn,
  body.rmw-theme .no-print {
    display: none !important;
  }
  body.rmw-theme {
    padding-top: 0 !important;
    background: #fff !important;
    color: #000 !important;
  }
  body.rmw-theme .card,
  body.rmw-theme .hub-tile,
  body.rmw-theme .rmw-login-card {
    box-shadow: none !important;
  }
}
