/* =============================================================================
   cpf-theme-a.css - Option A "Crime Watch"   (GPX6 CPF admin look-and-feel)
   LOAD   One additive file, linked LAST in common/common-template.php (after
          css/custom.css). Remove the <link> and the old look returns exactly.
   SCOPE  Admin pages only. Each selector hangs off a hook the template prints for
          a logged-in admin and never for the public register.php:
            #header:not([style])  #user-nav[style*=block]  #sidebar[style*=block]
            #content:not([style])   (anonymous pages get inline styles instead)
          If those inline styles ever change, the theme switches itself off (fails
          safe). Print pages and the member portal (user-template.php) never load it.
   PRINT  Everything is inside @media screen, so printing is unchanged.
   B      cpf-theme-b.css is these same rules with a different token block.
   ============================================================================= */

@media screen {

/* 1. TOKENS ------------------------------------------------------------------ */
:root {
  /* main-site tokens (gpx6crimewatch.co.za) */
  --cw-deep: #0a0a0a; --cw-panel: #16181b; --cw-card-dark: #1f2226;
  --cw-gold: #d4af37; --cw-gold-light: #fde047; --cw-gold-dark: #a17f1a;
  --cw-gold-grad: linear-gradient(135deg, #d4af37 0%, #fde047 50%, #a17f1a 100%);
  --cw-on-dark: #e2e8f0; --cw-on-dark-muted: #94a3b8;
  /* derived for light surfaces (contrast-checked, see DESIGN.md) */
  --cw-gold-ink: #806414;  /* gold for TEXT on white, 5.6:1 */
  --cw-gold-tint: #fbf3d6; /* hover / selected wash */
  --cw-card: #fff; --cw-row-alt: #fbfaf7; --cw-row-hover: #fbf3d6;
  --cw-line: #e2dfd6; --cw-field-line: #8a8f98; --cw-field-ro: #f1f0eb;
  --cw-text: #1f2226; --cw-label: #3b414a; --cw-muted: #5a6270;
  --cw-success: #15803d; --cw-success-hover: #166534; /* site #22c55e is 2.3:1 with white text */
  --cw-focus: #a17f1a; --cw-focus-on-dark: #d4af37; --cw-ring: rgba(212, 175, 55, .45);
  --cw-radius: 10px; --cw-radius-sm: 8px;
  --cw-font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --cw-side-w: 220px; /* sidebar column width, changed per breakpoint below */

  /* ---- THEME SWITCHES: Option B changes only the values from here down ---- */
  --cw-body: var(--cw-deep); --cw-page: #f4f3ef; --cw-card-head: #faf9f6;
  --cw-shadow: 0 1px 2px rgba(10, 10, 10, .06), 0 6px 16px rgba(10, 10, 10, .06);
  --cw-hdr-bg: var(--cw-deep); --cw-hdr-line: rgba(212, 175, 55, .45); --cw-hdr-text: var(--cw-on-dark);
  --cw-side-bg: var(--cw-panel); --cw-side-bg2: var(--cw-card-dark); --cw-side-edge: transparent;
  --cw-side-line: rgba(255, 255, 255, .07); --cw-side-text: var(--cw-on-dark); --cw-side-icon: var(--cw-on-dark-muted);
  --cw-side-hover: var(--cw-card-dark); --cw-side-active-bg: var(--cw-card-dark); --cw-side-active-text: #fff;
  --cw-side-active-icon: var(--cw-gold); --cw-side-bar: var(--cw-gold); --cw-side-focus: var(--cw-gold);
  --cw-primary-bg: var(--cw-gold-grad); --cw-primary-text: #0a0a0a; --cw-primary-line: var(--cw-gold-dark);
  --cw-primary-hover: linear-gradient(135deg, #e2c04c 0%, var(--cw-gold-light) 60%, #c09a2a 100%);
  --cw-danger-bg: #dc2626; --cw-danger-text: #fff; --cw-danger-line: #dc2626;
  --cw-danger-hover: #b91c1c; --cw-danger-hover-text: #fff;
  --cw-current-bg: var(--cw-gold); --cw-current-text: #0a0a0a;
  --cw-tile-icon-bg: var(--cw-gold-grad); --cw-tile-icon-text: #0a0a0a; --cw-tile-lift: -2px;
  --cw-bar-bg: var(--cw-panel); --cw-bar-text: var(--cw-on-dark); --cw-bar-ghost-line: var(--cw-on-dark-muted);
  --cw-bar-ghost-hover: rgba(255, 255, 255, .08);
  --cw-foot-bg: var(--cw-deep); --cw-foot-text: var(--cw-on-dark-muted); --cw-foot-line: rgba(212, 175, 55, .3);
  --cw-login-page: radial-gradient(ellipse at 50% 0%, rgba(212, 175, 55, .14), transparent 60%) #0a0a0a;
  --cw-login-card: var(--cw-panel); --cw-login-line: rgba(212, 175, 55, .35); --cw-login-band: var(--cw-panel);
  --cw-login-field-line: transparent; --cw-login-addon-bg: var(--cw-card-dark); --cw-login-addon-text: var(--cw-gold);
  --cw-login-focus: var(--cw-gold); --cw-login-shadow: 0 24px 60px rgba(0, 0, 0, .45);
}

/* 2. PAGE SHELL --------------------------------------------------------------- */
body:has(> #sidebar[style*=block]) { background: var(--cw-body); } /* progressive; only overscroll shows it */
#content:not([style]) {
  background: var(--cw-page); color: var(--cw-text);
  font-family: var(--cw-font); font-size: 14px; line-height: 1.45;
  /* Paints the sidebar column full height without touching <body>: a copy of this
     box shifted left by the sidebar width (shadows never cause scrolling). */
  box-shadow: -1px 0 0 var(--cw-side-edge), calc(-1 * var(--cw-side-w)) 0 0 var(--cw-side-bg);
}
#content:not([style]) .container-fluid .container-fluid { padding: 0; } /* index.php nests two */
#content:not([style]) label { margin-bottom: 6px; font-size: 13px; font-weight: 600; color: var(--cw-label); }
#content:not([style]) .help-block { color: var(--cw-muted); font-size: 13px; }

/* 3. HEADER + BRAND -------------------------------------------------------------
   Shield logo via CSS (replaces the missing img/logo.png that matrix-style.css
   requests - that 404 goes away). Text fits one line from 320px up.           */
#header:not([style]) {
  height: 60px; box-sizing: border-box; font-family: var(--cw-font);
  background: var(--cw-hdr-bg); border-bottom: 1px solid var(--cw-hdr-line);
  z-index: 1; /* matrix: -9, which puts it under <body> so the brand link can't be clicked */
}
#header:not([style]) h1 {
  position: absolute; top: 0; left: 16px; width: auto; height: 59px;
  max-width: calc(100% - 300px); margin: 0; background: none; overflow: hidden;
}
#header:not([style]) h1 a { /* font-size here beats the inline style="font-size:34px" on <h1> */
  display: block; height: 59px; line-height: 59px; padding-left: 54px;
  background: url(../img/gpx6-logo-96.png) no-repeat 0 50% / 44px 44px;
  background-image: -webkit-image-set(url(../img/gpx6-logo-96.png) 1x, url(../img/gpx6-logo-192.png) 2x);
  background-image: image-set(url(../img/gpx6-logo-96.png) 1x, url(../img/gpx6-logo-192.png) 2x);
  color: var(--cw-hdr-text); font-size: 20px; font-weight: 700; letter-spacing: .02em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-decoration: none;
}
#header:not([style]) h1 a:hover { color: #fff; }
#header:not([style]) h1 a .brand-accent { color: var(--cw-gold); } /* optional <span> hook */

/* 4. USER MENU (Bootstrap 2 dropdown - behaviour untouched) ------------------- */
#user-nav[style*=block] { top: 12px; right: 16px; left: auto; font-family: var(--cw-font); }
#user-nav[style*=block] > ul, #user-nav[style*=block] > ul > li { border: 0; }
#user-nav[style*=block] > ul > li > a {
  display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px; text-shadow: none;
  border-radius: var(--cw-radius-sm); color: var(--cw-hdr-text); font-size: 14px; line-height: 36px;
}
#user-nav[style*=block] > ul > li > a:hover,
#user-nav[style*=block] > ul > li.open > a { background: rgba(255, 255, 255, .1); color: #fff; }
#user-nav[style*=block] > ul > li > a > i { opacity: 1; margin: 0; color: var(--cw-gold); }
#user-nav[style*=block] .text { max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#user-nav[style*=block] .caret { margin: 0; border-top-color: currentColor; border-bottom-color: currentColor; }
#user-nav[style*=block] .dropdown-menu { /* right-aligned so it never runs off a phone screen */
  left: auto; right: 0; min-width: 200px; margin-top: 8px; padding: 6px; background: #fff;
  border: 1px solid var(--cw-line); border-radius: var(--cw-radius); box-shadow: 0 12px 32px rgba(10, 10, 10, .28);
}
#user-nav[style*=block] .dropdown-menu::before, #user-nav[style*=block] .dropdown-menu::after { display: none; }
#user-nav[style*=block] .dropdown-menu > li > a {
  display: flex; align-items: center; gap: 8px; padding: 9px 12px; border-radius: 6px;
  background: none; color: var(--cw-text); font-size: 14px; line-height: 20px;
}
#user-nav[style*=block] .dropdown-menu > li > a:hover,
#user-nav[style*=block] .dropdown-menu > li > a:focus { background: var(--cw-gold-tint); color: var(--cw-text); }
#user-nav[style*=block] .dropdown-menu .divider { height: 1px; margin: 6px 0; background: var(--cw-line); border: 0; }

/* 5. SIDEBAR (desktop; rail + phone variants further down) ------------------- */
#sidebar[style*=block] { font-family: var(--cw-font); }
#sidebar[style*=block] > ul { padding: 12px 0; background: var(--cw-side-bg); border: 0; }
#sidebar[style*=block] > ul > li { border: 0; background: none; }
#sidebar[style*=block] > ul > li > a {
  display: flex; align-items: center; gap: 12px; min-height: 44px; box-sizing: border-box;
  padding: 0 16px 0 17px; border-left: 3px solid transparent;
  color: var(--cw-side-text); font-size: 14px; font-weight: 500; text-decoration: none;
}
#sidebar[style*=block] > ul > li > a > i { opacity: 1; margin: 0; width: 18px; text-align: center; font-size: 15px; color: var(--cw-side-icon); }
#sidebar[style*=block] > ul > li > a:hover { background: var(--cw-side-hover); color: var(--cw-side-active-text); }
#sidebar[style*=block] > ul > li.active > a { /* !important only to beat matrix's own !important arrow image */
  background: var(--cw-side-active-bg) !important; border-left-color: var(--cw-side-bar);
  color: var(--cw-side-active-text); font-weight: 600;
}
#sidebar[style*=block] > ul > li.active > a > i,
#sidebar[style*=block] > ul > li > a:hover > i { color: var(--cw-side-active-icon); }

/* 6. CONTENT HEADER: the single breadcrumb becomes the page title ----------- */
#content:not([style]) #content-header { margin-top: 0; } /* was -38px, which slid it under the header */
#content:not([style]) #breadcrumb {
  display: flex; align-items: center; min-height: 56px; padding: 0 20px;
  background: var(--cw-card); border-bottom: 1px solid var(--cw-line);
}
#content:not([style]) #breadcrumb a {
  display: inline-flex; align-items: center; gap: 10px; min-height: 44px; padding: 0;
  background: none; color: var(--cw-text); font-size: 18px; font-weight: 700;
}
#content:not([style]) #breadcrumb a i { margin: 0; opacity: 1; font-size: 16px; color: var(--cw-gold-ink); }

/* 7. WIDGETS -> CARDS ---------------------------------------------------------- */
#content:not([style]) .widget-box {
  margin: 20px 0; background: var(--cw-card); border: 1px solid var(--cw-line);
  border-radius: var(--cw-radius); box-shadow: var(--cw-shadow);
  overflow: clip; /* rounds child corners; NOT a scroll container, so sticky still works */
}
#content:not([style]) .widget-title { /* fixed 46px: the DataTables search box is aligned to it */
  display: flex; align-items: center; gap: 10px; height: 46px; box-sizing: border-box; padding: 0 16px;
  background: var(--cw-card-head); border-bottom: 1px solid var(--cw-line);
}
#content:not([style]) .widget-title span.icon { float: none; padding: 0; border: 0; line-height: 1; font-size: 15px; color: var(--cw-gold-ink); }
#content:not([style]) .widget-title h5 {
  float: none; flex: 1 1 auto; min-width: 0; margin: 0; padding: 0; font-size: 14px; line-height: 20px;
  font-weight: 700; color: var(--cw-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#content:not([style]) .widget-title .buttons { float: none; margin: 0; }
#content:not([style]) .widget-content { padding: 20px; border-bottom: 0; }

/* 8. BUTTONS ----------------------------------------------------------------- */
#content:not([style]) .btn {
  min-height: 38px; box-sizing: border-box; padding: 8px 16px;
  font: 600 14px/20px var(--cw-font); text-shadow: none; box-shadow: none;
  color: var(--cw-text); background: var(--cw-card); border: 1px solid var(--cw-field-line);
  border-radius: var(--cw-radius-sm); transition: background-color .15s, border-color .15s, color .15s;
}
#content:not([style]) .btn:hover { background: #f3f1ea; color: var(--cw-text); }
#content:not([style]) .btn-primary { background: var(--cw-primary-bg); border-color: var(--cw-primary-line); color: var(--cw-primary-text); }
#content:not([style]) .btn-primary:hover,
#content:not([style]) .btn-primary:active { background: var(--cw-primary-hover); color: var(--cw-primary-text); }
#content:not([style]) .btn-success { background: var(--cw-success); border-color: var(--cw-success); color: #fff; }
#content:not([style]) .btn-success:hover,
#content:not([style]) .btn-success:active { background: var(--cw-success-hover); border-color: var(--cw-success-hover); color: #fff; }
#content:not([style]) .btn-danger { background: var(--cw-danger-bg); border-color: var(--cw-danger-line); color: var(--cw-danger-text); }
#content:not([style]) .btn-danger:hover,
#content:not([style]) .btn-danger:active { background: var(--cw-danger-hover); border-color: var(--cw-danger-line); color: var(--cw-danger-hover-text); }
#content:not([style]) .btn-mini { min-height: 32px; padding: 5px 10px; font-size: 13px; }
/* Reset sits next to Save on every form; it was red (gold on change-password) and
   competed with Save. Inside .form-actions any type=reset button is a quiet ghost. */
#content:not([style]) .form-actions .btn[type=reset] { background: transparent; color: var(--cw-text); border-color: var(--cw-field-line); }
#content:not([style]) .form-actions .btn[type=reset]:hover { background: rgba(10, 10, 10, .05); }

/* 9. FORM CONTROLS --------------------------------------------------------------- */
#content:not([style]) input[type=text], #content:not([style]) input[type=email],
#content:not([style]) input[type=password], #content:not([style]) input[type=number],
#content:not([style]) input[type=tel], #content:not([style]) input[type=search],
#content:not([style]) select, #content:not([style]) textarea {
  box-sizing: border-box; height: 38px; margin-bottom: 12px; padding: 8px 12px;
  font: 14px/20px var(--cw-font); color: var(--cw-text); background: var(--cw-card);
  border: 1px solid var(--cw-field-line); border-radius: var(--cw-radius-sm); box-shadow: none;
}
#content:not([style]) textarea { height: auto; }
#content:not([style]) input[readonly] { background: var(--cw-field-ro); color: var(--cw-muted); } /* .domestic/.gardener "No" */

/* select2 3.2 - the visible widget (the real <select> sits right after it, off-screen) */
#content:not([style]) .select2-container { margin-bottom: 12px; font-family: var(--cw-font); }
#content:not([style]) .select2-container .select2-choice {
  box-sizing: border-box; height: 38px; line-height: 36px; padding: 0 0 0 12px; font-size: 14px;
  color: var(--cw-text); background: var(--cw-card); border: 1px solid var(--cw-field-line);
  border-radius: var(--cw-radius-sm); box-shadow: none;
}
#content:not([style]) .select2-container .select2-choice span { margin-right: 36px; }
#content:not([style]) .select2-container .select2-choice div { width: 34px; background: none; border: 0; }
#content:not([style]) .select2-container .select2-choice div b { /* !important: select2.css forces select2x2.png (missing) on retina */
  position: relative; background: none !important;
}
#content:not([style]) .select2-container .select2-choice div b::after { /* CSS arrow instead of the sprite */
  content: ""; position: absolute; top: 50%; left: 50%; margin: -3px 0 0 -5px;
  border: 5px solid transparent; border-top: 6px solid var(--cw-muted); border-bottom: 0;
}
#content:not([style]) .select2-dropdown-open .select2-choice div b::after { transform: rotate(180deg); }
#content:not([style]) .select2-container-active .select2-choice,
#content:not([style]) .select2-dropdown-open .select2-choice { background: var(--cw-card); border-color: var(--cw-focus); box-shadow: 0 0 0 3px var(--cw-ring); }
#content:not([style]) .select2-dropdown-open .select2-choice { border-radius: var(--cw-radius-sm) var(--cw-radius-sm) 0 0; }
#content:not([style]) .select2-dropdown-open.select2-drop-above .select2-choice { border-radius: 0 0 var(--cw-radius-sm) var(--cw-radius-sm); }
#content:not([style]) .select2-container-disabled .select2-choice { /* radio Make/Model before a Band is picked */
  background: var(--cw-field-ro); color: var(--cw-muted); border-color: var(--cw-line); cursor: not-allowed;
}
#content:not([style]) .dataTables_length .select2-container { margin: 0; min-width: 84px; }

/* select2 3.2 moves the open list to the end of <body>, hence the sibling selector */
#content:not([style]) ~ .select2-drop {
  font-family: var(--cw-font); font-size: 14px; color: var(--cw-text); box-shadow: 0 12px 24px rgba(10, 10, 10, .18);
  border: 1px solid var(--cw-focus); border-top: 0; border-radius: 0 0 var(--cw-radius-sm) var(--cw-radius-sm);
}
#content:not([style]) ~ .select2-drop.select2-drop-above {
  border-top: 1px solid var(--cw-focus); border-bottom: 0; border-radius: var(--cw-radius-sm) var(--cw-radius-sm) 0 0;
}
#content:not([style]) ~ .select2-drop .select2-search { padding: 8px 8px 4px; }
#content:not([style]) ~ .select2-drop .select2-search input {
  min-height: 36px; padding: 6px 10px; font: 14px var(--cw-font); color: var(--cw-text);
  background: #fff none !important; border: 1px solid var(--cw-field-line); border-radius: 6px;
}
#content:not([style]) ~ .select2-drop .select2-results { max-height: 260px; margin: 4px; padding: 0; }
#content:not([style]) ~ .select2-drop .select2-results .select2-result-label { padding: 7px 10px; border-radius: 6px; }
#content:not([style]) ~ .select2-drop .select2-results .select2-highlighted { background: var(--cw-gold-tint); color: var(--cw-text); }

/* uniform.js file input + photo (edit-member) */
#content:not([style]) #file-upload .uploader {
  display: flex; width: 100%; height: 44px; box-sizing: border-box; overflow: hidden; cursor: pointer;
  background: var(--cw-card); border: 1px dashed var(--cw-field-line); border-radius: var(--cw-radius-sm);
}
#content:not([style]) #file-upload .uploader .filename {
  flex: 1 1 auto; width: auto; height: 42px; margin: 0; padding: 0 12px; line-height: 42px; border: 0; font-size: 13px; color: var(--cw-muted);
}
#content:not([style]) #file-upload .uploader .action {
  flex: 0 0 auto; width: auto; height: 42px; padding: 0 16px; line-height: 42px;
  background: var(--cw-card-dark); color: #fff; text-shadow: none; font-size: 13px; font-weight: 600;
}
#content:not([style]) #file-upload .uploader input { width: 100%; height: 100%; cursor: pointer; }
#content:not([style]) #file-upload .uploader.hover,
#content:not([style]) #file-upload .uploader.focus { border-color: var(--cw-focus); }
#content:not([style]) #file-upload .uploader.focus { box-shadow: 0 0 0 3px var(--cw-ring); }
#content:not([style]) #photo-container {
  width: 200px; height: 200px; padding: 6px; background: var(--cw-card); border: 1px solid var(--cw-line); border-radius: 14px; box-shadow: none;
}
#content:not([style]) #photo-container img { object-fit: cover; border-radius: 10px; }

/* 10. EDIT MEMBER: patrol-car + radio rows ---------------------------------------
   Six span2 cells (~60px each) become a 3-up grid (2-up on phones) with the
   "Radio N" / "Patrol Car N" cell as a sub-heading. The grid is on the INNER
   .row-fluid; .hiden still lands on .radioc/.patrolcar/.pc1tracker as before.  */
#content:not([style]) .radioc > .row-fluid,
#content:not([style]) .patrolcar > .row-fluid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: 12px; }
#content:not([style]) .radioc > .row-fluid::before, #content:not([style]) .radioc > .row-fluid::after,
#content:not([style]) .patrolcar > .row-fluid::before, #content:not([style]) .patrolcar > .row-fluid::after { content: none; }
#content:not([style]) .radioc > .row-fluid > [class*=span],
#content:not([style]) .patrolcar > .row-fluid > [class*=span] { float: none; width: auto; min-height: 0; margin-left: 0; }
#content:not([style]) .radioc > .row-fluid > .span2:first-child,
#content:not([style]) .patrolcar > .row-fluid > .span3:only-child { grid-column: 1 / -1; margin-top: 8px; padding-top: 14px; border-top: 1px solid var(--cw-line); }
#content:not([style]) .radioc > .row-fluid > .span2:first-child > label:first-child,
#content:not([style]) .patrolcar > .row-fluid > .span3:only-child > label:first-child { display: none; } /* &nbsp; spacer */
#content:not([style]) .radioc big, #content:not([style]) .patrolcar big {
  font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--cw-gold-ink);
}

/* 11. FORM ACTIONS + STICKY SAVE BAR --------------------------------------------
   Every .form-actions: centred Save + ghost Reset. On edit-member the actions row
   is the form's LAST .row-fluid; it becomes a bar pinned to the bottom of the
   screen (keyboard rules in the min-height block near the end of the file).    */
#content:not([style]) .form-actions { margin: 0; padding: 16px 20px; background: var(--cw-card-head); border: 0; border-top: 1px solid var(--cw-line); }
#content:not([style]) .form-actions > .row-fluid { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 12px; }
#content:not([style]) .form-actions > .row-fluid::before,
#content:not([style]) .form-actions > .row-fluid::after { content: none; }
#content:not([style]) .form-actions > .row-fluid > [class*=span] { float: none; width: auto; min-height: 0; margin: 0; }
#content:not([style]) .form-actions .pull-right { float: none; }
#content:not([style]) .form-actions .btn { min-width: 140px; }
#content:not([style]) form > .row-fluid + .row-fluid:last-child { margin-top: 4px; }
#content:not([style]) form > .row-fluid + .row-fluid:last-child .widget-box { margin: 0 0 20px; }
#content:not([style]) form > .row-fluid + .row-fluid:last-child .form-actions {
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px)); background: var(--cw-bar-bg); color: var(--cw-bar-text); border-top: 0;
}
#content:not([style]) form > .row-fluid + .row-fluid:last-child .btn[type=reset] { color: var(--cw-bar-text); border-color: var(--cw-bar-ghost-line); }
#content:not([style]) form > .row-fluid + .row-fluid:last-child .btn[type=reset]:hover { background: var(--cw-bar-ghost-hover); }

/* 12. TABLES (View Members, Pending, View Users) ------------------------------ */
#content:not([style]) .table { margin: 0; font-size: 13px; color: var(--cw-text); border-collapse: separate; border-spacing: 0; }
#content:not([style]) .table-bordered { border: 0; border-radius: 0; }
#content:not([style]) .table th, #content:not([style]) .table td {
  padding: 10px 12px; line-height: 20px; vertical-align: middle; background: var(--cw-card); border-left: 0; border-top: 1px solid var(--cw-line);
}
#content:not([style]) .table thead th {
  background: var(--cw-card-head); color: var(--cw-label); font-size: 12px; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; text-align: left; white-space: nowrap; border-top: 0; border-bottom: 1px solid var(--cw-line);
}
#content:not([style]) .table tbody > tr:first-child > td { border-top: 0; }
#content:not([style]) .table tbody > tr:nth-child(even) > td { background: var(--cw-row-alt); }
#content:not([style]) .table tbody > tr:hover > td { background: var(--cw-row-hover); }
#content:not([style]) .table td > img { display: block; width: 40px; height: 40px; max-width: none; margin: 6px 10px; object-fit: cover; border-radius: 8px; }
#content:not([style]) .table .taskOptions { white-space: nowrap; }
#content:not([style]) .table .taskOptions a {
  display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px;
  margin: 0 2px; padding: 0; border-radius: var(--cw-radius-sm); font-size: 15px; color: var(--cw-muted);
}
#content:not([style]) .table .taskOptions a:hover { background: var(--cw-gold-tint); color: var(--cw-gold-ink); }
#content:not([style]) .table .taskOptions a[onclick*=confirmDelete]:hover { background: #fee2e2; color: #b91c1c; }

/* DataTables 1.9.4 (bJQueryUI, but no jQuery UI CSS -> the sort arrows were invisible) */
#content:not([style]) .dataTable thead th { cursor: pointer; }
#content:not([style]) .DataTables_sort_wrapper { position: relative; padding-right: 16px; }
#content:not([style]) .DataTables_sort_icon { position: absolute; top: 50%; right: 0; width: 8px; height: 12px; margin-top: -6px; }
#content:not([style]) .DataTables_sort_icon::before,
#content:not([style]) .DataTables_sort_icon::after {
  content: ""; position: absolute; left: 0; width: 0; height: 0; opacity: .35;
  border-left: 4px solid transparent; border-right: 4px solid transparent;
}
#content:not([style]) .DataTables_sort_icon::before { top: 0; border-bottom: 5px solid currentColor; }
#content:not([style]) .DataTables_sort_icon::after { bottom: 0; border-top: 5px solid currentColor; }
#content:not([style]) .ui-icon-triangle-1-n, #content:not([style]) .ui-icon-triangle-1-s { color: var(--cw-gold-ink); }
#content:not([style]) .ui-icon-triangle-1-n::before, #content:not([style]) .ui-icon-triangle-1-s::after { opacity: 1; }
#content:not([style]) .ui-icon-triangle-1-n::after, #content:not([style]) .ui-icon-triangle-1-s::before { opacity: 0; }

/* Controls: the wrapper becomes a flex column so the search box can sit above the
   table on small screens (DOM/tab order unchanged); the footer toolbar dissolves. */
#content:not([style]) .dataTables_wrapper { display: flex; flex-direction: column; }
#content:not([style]) .dataTables_wrapper > .fg-toolbar { display: contents; }
#content:not([style]) .dataTables_wrapper > div:first-child { order: 0; padding: 10px 16px; }
#content:not([style]) .dataTables_wrapper > .table { order: 2; }
#content:not([style]) .dataTables_length { position: static; width: auto; margin: 0; }
#content:not([style]) .dataTables_length label,
#content:not([style]) .dataTables_filter label { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 13px; font-weight: 500; color: var(--cw-muted); }
#content:not([style]) .dataTables_filter { order: 1; margin: 0; padding: 0 16px 12px; text-align: left; }
#content:not([style]) .dataTables_filter input { width: 220px; margin: 0; }
#content:not([style]) .dataTables_paginate {
  order: 3; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; margin: 0; padding: 12px 16px; border-top: 1px solid var(--cw-line);
}
#content:not([style]) .dataTables_paginate > span { display: contents; }
#content:not([style]) .dataTables_paginate .ui-button { /* padding !important: matrix uses !important */
  display: inline-flex; align-items: center; justify-content: center; box-sizing: border-box;
  min-width: 34px; height: 34px; padding: 0 10px !important; text-decoration: none; text-shadow: none;
  font-size: 13px; font-weight: 600; line-height: 1; color: var(--cw-text);
  background: var(--cw-card); border: 1px solid var(--cw-line); border-radius: var(--cw-radius-sm);
}
#content:not([style]) .dataTables_paginate .ui-button:hover { background: var(--cw-gold-tint); border-color: var(--cw-gold-dark); color: var(--cw-text); }
#content:not([style]) .dataTables_paginate > .ui-state-disabled,
#content:not([style]) .dataTables_paginate > .ui-state-disabled:hover { background: var(--cw-card); border-color: var(--cw-line); color: var(--cw-muted) !important; opacity: .6; }
#content:not([style]) .dataTables_paginate span .ui-state-disabled { /* = current page */
  background: var(--cw-current-bg) !important; border-color: var(--cw-current-bg); color: var(--cw-current-text) !important;
}

/* 13. DASHBOARD TILES ---------------------------------------------------------- */
#content:not([style]) .quick-actions_homepage { float: none; margin: 20px 0 0; text-align: left; }
#content:not([style]) .quick-actions { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; margin: 0; padding: 0; }
#content:not([style]) .quick-actions > li { /* replaces the four Metro colours (bg_lg/ly/lo/ls) */
  float: none; min-width: 0; min-height: 0; margin: 0; padding: 0; background: var(--cw-card);
  border: 1px solid var(--cw-line); border-radius: var(--cw-radius); box-shadow: var(--cw-shadow);
  transition: transform .15s, border-color .15s, box-shadow .15s;
}
#content:not([style]) .quick-actions > li:hover,
#content:not([style]) .quick-actions > li:active {
  background: var(--cw-card); border-color: var(--cw-gold); transform: translateY(var(--cw-tile-lift)); box-shadow: 0 10px 24px rgba(10, 10, 10, .1);
}
#content:not([style]) .quick-actions > li > a {
  display: flex; align-items: center; gap: 14px; min-height: 84px; box-sizing: border-box; padding: 18px 20px;
  border-radius: inherit; background: none; color: var(--cw-text); font-size: 16px; font-weight: 600;
}
#content:not([style]) .quick-actions > li > a:hover { background: none; color: var(--cw-text); }
#content:not([style]) .quick-actions > li > a > i {
  display: inline-flex; align-items: center; justify-content: center; flex: 0 0 48px; width: 48px; height: 48px;
  margin: 0; border-radius: 12px; font-size: 22px; background: var(--cw-tile-icon-bg); color: var(--cw-tile-icon-text);
}

/* 14. FOCUS (matrix-style.css kills ALL outlines with * {outline:none !important}) */
#header:not([style]) h1 a:focus-visible,
#user-nav[style*=block] > ul > li > a:focus-visible { outline: 3px solid var(--cw-focus-on-dark) !important; outline-offset: 2px; }
#user-nav[style*=block] .dropdown-menu a:focus-visible { outline: 3px solid var(--cw-focus) !important; outline-offset: -3px; }
#sidebar[style*=block] a:focus-visible { outline: 3px solid var(--cw-side-focus) !important; outline-offset: -3px; }
#content:not([style]) a:focus-visible, #content:not([style]) button:focus-visible,
#content:not([style]) [tabindex]:focus-visible { outline: 3px solid var(--cw-focus) !important; outline-offset: 2px; }
#content:not([style]) .table a:focus-visible, #content:not([style]) .table th:focus-visible { outline-offset: -3px; }
#content:not([style]) .select2-choice:focus-visible { outline: 2px solid transparent !important; } /* ring is on the container */
#content:not([style]) input:focus, #content:not([style]) select:focus, #content:not([style]) textarea:focus,
#content:not([style]) ~ .select2-drop .select2-search input:focus {
  border-color: var(--cw-focus); box-shadow: 0 0 0 3px var(--cw-ring);
  outline: 2px solid transparent !important; /* transparent outline = still visible in Windows High Contrast */
}

/* 15. FOOTER ------------------------------------------------------------------ */
#content:not([style]) + .row-fluid > #footer {
  padding: 16px; font: 13px/1.5 var(--cw-font); color: var(--cw-foot-text); background: var(--cw-foot-bg); border-top: 1px solid var(--cw-foot-line);
}
/* "Powered by STRATUS" + its card style themselves (common/stratus-credit.php); this only places it
   under the box on both sign-in pages */
.cw-powered-login { margin: 20px 0 24px; text-align: center; font: 13px/1.5 var(--cw-font); color: var(--cw-on-dark-muted); }

/* 16. LOGIN - only if the optional <link> is added to login.php (#loginbox exists only there) */
body:has(> #loginbox) { background: var(--cw-login-page); }
#loginbox {
  width: 92%; max-width: 400px; font-family: var(--cw-font); background: var(--cw-login-card);
  border: 1px solid var(--cw-login-line); border-radius: 14px; box-shadow: var(--cw-login-shadow);
}
#loginbox form { background: transparent; }
#loginbox .normal_text { padding: 28px 20px 20px; background: var(--cw-login-band); border-bottom: 1px solid var(--cw-hdr-line); }
#loginbox .normal_text h1 { margin: 0; font-size: 24px; line-height: 1.25; font-weight: 700; letter-spacing: .02em; color: var(--cw-on-dark); }
#loginbox .normal_text h1::before { /* logo above the title, CSS only */
  content: ""; display: block; width: 88px; height: 88px; margin: 0 auto 14px;
  background: url(../img/gpx6-logo-96.png) no-repeat 50% 50% / contain;
  background-image: -webkit-image-set(url(../img/gpx6-logo-96.png) 1x, url(../img/gpx6-logo-192.png) 2x);
  background-image: image-set(url(../img/gpx6-logo-96.png) 1x, url(../img/gpx6-logo-192.png) 2x);
}
#loginbox .normal_text h1 .brand-accent { color: var(--cw-gold); }
#loginbox .normal_text .login-subtitle { /* "Admin sign-in" under the name (login.php) */
  margin: 6px 0 0; font: 600 12px var(--cw-font); letter-spacing: .12em; text-transform: uppercase; color: var(--cw-gold);
}
#loginbox .control-group { padding: 16px 0 0; }
#loginbox .controls { padding: 0 24px; }
#loginbox .main_input_box { display: flex; overflow: hidden; background: #fff; border: 1px solid var(--cw-login-field-line); border-radius: var(--cw-radius-sm); }
#loginbox .main_input_box .add-on {
  display: flex; align-items: center; justify-content: center; flex: 0 0 44px; width: 44px; padding: 0;
  background: var(--cw-login-addon-bg); color: var(--cw-login-addon-text);
}
#loginbox .main_input_box input { /* 16px = no iOS zoom */
  flex: 1 1 auto; min-width: 0; width: auto; height: 44px; margin: 0; padding: 0 12px; font: 16px var(--cw-font);
  color: var(--cw-text); border: 0; border-radius: 0; box-shadow: none; outline: 2px solid transparent;
}
#loginbox .main_input_box:focus-within { border-color: var(--cw-login-focus); box-shadow: 0 0 0 3px var(--cw-ring); }
#loginbox .form-actions { padding: 20px 24px 24px; background: none; border-top: 0; }
#loginbox .btn-success {
  min-height: 44px; padding: 10px 28px; font: 700 15px var(--cw-font); text-shadow: none; box-shadow: none; color: var(--cw-primary-text);
  background: var(--cw-primary-bg); border: 1px solid var(--cw-primary-line); border-radius: var(--cw-radius-sm);
}
#loginbox .btn-success:hover { background: var(--cw-primary-hover); color: var(--cw-primary-text); }
#loginbox .btn-success:focus-visible { outline: 3px solid var(--cw-login-focus); outline-offset: 2px; }
#loginbox .btn-primary { /* "Register" on the member login (user-login.php): quiet secondary button */
  display: inline-flex; align-items: center; box-sizing: border-box; height: 44px; padding: 0 22px; line-height: 1; font: 600 15px var(--cw-font);
  text-shadow: none; box-shadow: none; color: var(--cw-on-dark); background: transparent;
  border: 1px solid var(--cw-login-line); border-radius: var(--cw-radius-sm);
}
#loginbox .btn-primary:hover { color: var(--cw-gold); border-color: var(--cw-gold); background: transparent; text-decoration: none; }
#loginbox .btn-primary:focus-visible { outline: 3px solid var(--cw-login-focus); outline-offset: 2px; }

/* 17. PUBLIC PAGES + MEMBER PORTAL - pages without the admin sidebar:
   - register.php for visitors (sets $cpf_public_theme; common-template.php prints
     <body class="cw-public">), no user menu;
   - the member portal, dashboard.php (common/user-template.php prints
     <body class="cw-public cw-member">), with the member's Log Out menu.
   Both have no inline styles on #header/#content, so the rules above apply.
   "body.cw-public" outranks every #content:not([style]) rule in this file, the
   breakpoint ones further down included. */
body.cw-public { background: var(--cw-body); }
body.cw-public:not(.cw-member) #header:not([style]) h1 { max-width: calc(100% - 32px); } /* no user menu to make room for */
body.cw-public #content:not([style]) { margin-left: 0; margin-top: 0; box-shadow: none; }

} /* end @media screen */

/* ---- >= 980px: line the DataTables search up with "Show N entries" (title 46 + 10) */
@media screen and (min-width: 980px) {
  #content:not([style]) .dataTables_filter { top: 56px; right: 16px; padding: 0; }
}

/* ---- 481-970px: Matrix's icon rail, widened 43 -> 60px, labels fly out on hover/focus */
@media screen and (min-width: 481px) and (max-width: 970px) {
  :root { --cw-side-w: 60px; }
  #sidebar[style*=block], #sidebar[style*=block] > ul { width: 60px; }
  #content:not([style]) { margin-left: 60px; }
  #sidebar[style*=block] > ul > li > a { justify-content: center; min-height: 52px; padding: 0; }
  #sidebar[style*=block] > ul > li > a > i { width: auto; font-size: 18px; }
  #sidebar[style*=block] > ul > li > a:hover > span,
  #sidebar[style*=block] > ul > li > a:focus > span {
    display: flex; align-items: center; position: absolute; top: 0; bottom: 0; left: 100%; z-index: 2;
    padding: 0 16px; white-space: nowrap; background: var(--cw-side-hover); color: var(--cw-side-active-text);
    border-radius: 0 var(--cw-radius-sm) var(--cw-radius-sm) 0; box-shadow: 6px 6px 16px rgba(10, 10, 10, .2);
  }
}

/* ---- <= 979px: tables scroll INSIDE their card; the action column stays pinned right */
@media screen and (max-width: 979px) {
  #content:not([style]) .dataTables_wrapper > .table,
  #content:not([style]) .widget-content > .table { display: block; width: 100%; overflow-x: auto; }
  #content:not([style]) .table th:last-child,
  #content:not([style]) .table td:last-child:not([colspan]) { position: sticky; right: 0; z-index: 1; box-shadow: -10px 0 10px -10px rgba(10, 10, 10, .35); }
  #content:not([style]) .dataTables_filter input { flex: 1 1 auto; width: auto; min-width: 0; }
}
@media screen and (max-width: 979px) { /* :has() browsers: keep real table layout, scroll the card */
  #content:not([style]) .widget-content:has(> .table) { overflow-x: auto; }
  #content:not([style]) .widget-content:has(> .table) > .table { display: table; }
}

/* ---- <= 767px: phones + small tablets -------------------------------------- */
@media screen and (max-width: 767px) {
  #header:not([style]) h1 { max-width: calc(100% - 100px); } /* user menu is icon-only here */
  #content:not([style]) { font-size: 15px; }
  #content:not([style]) .container-fluid { padding-left: 16px; padding-right: 16px; }
  #content:not([style]) #breadcrumb { min-height: 52px; padding: 0 16px; }
  #content:not([style]) #breadcrumb a { font-size: 17px; }
  #content:not([style]) .widget-box { margin: 16px 0; }
  #content:not([style]) .widget-content { padding: 16px 14px; }
  #content:not([style]) .widget-title h5 { font-size: 15px; }
  #content:not([style]) label { font-size: 14px; }
  #content:not([style]) input[type=text], #content:not([style]) input[type=email],
  #content:not([style]) input[type=password], #content:not([style]) input[type=number],
  #content:not([style]) input[type=tel], #content:not([style]) input[type=search],
  #content:not([style]) select, #content:not([style]) textarea { height: 44px; padding: 10px 12px; font-size: 16px; line-height: 22px; }
  #content:not([style]) textarea { height: auto; }
  #content:not([style]) .select2-container { width: 100%; }
  #content:not([style]) .select2-container .select2-choice { height: 44px; line-height: 42px; font-size: 16px; }
  #content:not([style]) ~ .select2-drop .select2-search input { min-height: 44px; font-size: 16px; }
  #content:not([style]) ~ .select2-drop .select2-results .select2-result-label { padding: 11px 12px; font-size: 16px; }
  #content:not([style]) .btn { min-height: 44px; padding: 11px 18px; font-size: 15px; }
  #content:not([style]) .btn-mini { min-height: 40px; padding: 9px 14px; font-size: 14px; }
  #content:not([style]) .row-fluid > [class*=span] > .btn { display: block; width: 100%; float: none; margin-bottom: 8px; }
  #content:not([style]) .form-actions > .row-fluid { flex-wrap: nowrap; }
  #content:not([style]) .form-actions > .row-fluid > .span6 { flex: 2 1 0; }        /* Save  */
  #content:not([style]) .form-actions > .row-fluid > .span6 + .span6 { flex: 1 1 0; } /* Reset */
  #content:not([style]) .form-actions > .row-fluid > [class*=span] > .btn { min-width: 0; margin-bottom: 0; }
  #content:not([style]) .form-horizontal .control-label { padding: 12px 16px 0; }
  #content:not([style]) .form-horizontal .controls { margin-left: 0; padding: 8px 16px 12px; }
  #content:not([style]) #file-upload { width: 100%; }
  /* stacked side-by-side fields (Name, Street No., Town) kept Bootstrap's left gap and stuck out on the right */
  #content:not([style]) .controls-row > [class*=span] + [class*=span] { margin-left: 0; }
  /* same inside a nested .row-fluid (Tel No., Domestic/Gardener names, CPF-radio call sign) */
  #content:not([style]) .controls-row > .row-fluid > [class*=span] + [class*=span] { margin-left: 0; }
  #content:not([style]) .radioc > .row-fluid,
  #content:not([style]) .patrolcar > .row-fluid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #content:not([style]) .table { font-size: 14px; }
  #content:not([style]) .table th, #content:not([style]) .table td { padding: 12px; }
  #content:not([style]) .table .taskOptions a { width: 40px; height: 40px; }
  /* Pending: stack View / Approve / Reject so the pinned column stays narrow
     (!important only to beat the inline style="display:inline;margin:0") */
  #content:not([style]) .table td:last-child > form { display: block !important; margin: 6px 0 0 !important; }
  #content:not([style]) .table td:last-child > .btn,
  #content:not([style]) .table td:last-child > form > .btn { display: block; width: 100%; }
  #content:not([style]) .dataTables_paginate { justify-content: center; }
  #content:not([style]) .dataTables_paginate .ui-button { min-width: 40px; height: 40px; }
  #content:not([style]) .quick-actions > li > a { min-height: 72px; }
}

/* ---- <= 480px: phone header + "Main Menu" sidebar ---------------------------- */
@media screen and (max-width: 480px) {
  :root { --cw-side-w: 0px; }
  #header:not([style]) { height: 56px; }
  #header:not([style]) h1 { left: 12px; height: 55px; max-width: calc(100% - 84px); }
  #header:not([style]) h1 a { height: 55px; line-height: 55px; padding-left: 48px; background-size: 38px 38px; font-size: 18px; }
  /* Matrix drops the user menu into the flow with negative offsets (the overlap).
     Pin it top-right instead; !important beats the inline width/margin-left that
     matrix.js fix_position() writes on #user-nav > ul. */
  #user-nav[style*=block] { position: absolute; top: 6px; right: 8px; left: auto; float: none; width: auto; margin: 0; background: none; border: 0; text-align: left; }
  #user-nav[style*=block] > ul { width: auto !important; margin: 0 !important; background: none; }
  #user-nav[style*=block] > ul > li > a { height: 44px; line-height: 44px; }
  #user-nav[style*=block] .dropdown-menu > li > a { padding: 12px 14px; font-size: 15px; }
  #sidebar[style*=block] { top: 0; }
  #content:not([style]) { margin-top: 0; }
  #content:not([style]) #content-header { text-align: left; }
  #sidebar[style*=block] > a { /* the matrix.js "Main Menu" toggle */
    display: flex !important; align-items: center; gap: 10px; min-height: 48px; box-sizing: border-box; padding: 0 16px;
    background: var(--cw-side-bg2); color: var(--cw-side-text); font-size: 15px; font-weight: 600; border-bottom: 1px solid var(--cw-side-line);
  }
  #sidebar[style*=block] > a > i { color: var(--cw-side-active-icon); }
  #sidebar[style*=block] > a::after {
    content: ""; width: 8px; height: 8px; margin: -4px 4px 0 auto; transform: rotate(45deg); transition: transform .2s;
    border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  }
  #sidebar[style*=block].open > a::after { margin-top: 4px; transform: rotate(-135deg); }
  #sidebar[style*=block] > ul { padding: 0; } /* its display stays with matrix.js (inline style) */
  #sidebar[style*=block] > ul > li { padding: 0; border-top: 1px solid var(--cw-side-line); }
  #sidebar[style*=block] > ul > li:hover { background: none; }
  #sidebar[style*=block] > ul > li > a { min-height: 48px; padding: 0 16px 0 13px; font-size: 15px; }
  #sidebar[style*=block] > ul li span { margin: 0; color: inherit; font-size: inherit; font-weight: inherit; }
  #sidebar[style*=block] > ul li a i { margin: 0; vertical-align: middle; }
}

/* ---- Sticky Save bar (edit-member), screens >= 500px tall --------------------
   1. sticky, not fixed: pinned only while the form is on screen; it settles at the
      end of the form, so the last fields are never underneath it.
   2. While a text field in the form has focus (keyboard open), :has() drops the bar
      back to static, out of the way; it returns on blur.
   3. Short viewports (landscape, browsers that shrink for the keyboard) get none.
   4. Without :has(), sticky-bottom sits on the layout viewport = behind the iOS /
      modern Android keyboard, not over the focused field.
   z-index 15: above the page; below select2 lists (9999), tooltips, user menu (20). */
@media screen and (min-height: 500px) {
  #content:not([style]) form > .row-fluid + .row-fluid:last-child { position: sticky; bottom: 0; z-index: 15; }
  #content:not([style]) form > .row-fluid + .row-fluid:last-child .widget-box {
    margin-bottom: 0; border-radius: var(--cw-radius) var(--cw-radius) 0 0; box-shadow: 0 -8px 24px rgba(10, 10, 10, .18);
  }
}
@media screen and (min-height: 500px) {
  #content:not([style]) form:has(input[type=text]:focus, input[type=email]:focus, input[type=password]:focus,
    input[type=number]:focus, input[type=tel]:focus, textarea:focus) > .row-fluid + .row-fluid:last-child { position: static; }
}

@media screen and (prefers-reduced-motion: reduce) {
  #content:not([style]) *, #sidebar[style*=block] > a::after { transition: none !important; }
  #content:not([style]) .quick-actions > li:hover { transform: none; }
}

/* ---- PRINT GUARD: every rule above is screen-only, so a printed admin page uses
   exactly the old stylesheets. This is a second lock in case a rule ever moves out
   of a screen block. (print-member*.php never load this file at all.)          */
@media print {
  #content:not([style]) form > .row-fluid + .row-fluid:last-child { position: static !important; }
}
