/* =========================================================
   Elti Group Maintenance System — Theme
   Color system is entirely blue, dark navy through pastel.
   All colors are CSS variables defined here so the whole UI
   can be re-themed from one place. Status/priority badges
   layer a few semantic accents (green/amber/red) on top.
   ========================================================= */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=Inter:wght@400;500;600;700&display=swap');

:root {
  /* Blue scale — darkest to lightest, built on the ELTI Group brand palette
     (ELTI Dark Blue #193E87 = blue-700, ELTI Blue #2457B8 = blue-600,
     ELTI Light Blue #8FA8CC = blue-300) */
  --blue-900: #0d2352;
  --blue-800: #163564;
  --blue-700: #193e87; /* ELTI Dark Blue */
  --blue-600: #2457b8; /* ELTI Blue */
  --blue-500: #2d64c9;
  --blue-400: #5580c7;
  --blue-300: #8fa8cc; /* ELTI Light Blue */
  --blue-200: #b9c8e0;
  --blue-100: #dce4f0;
  --blue-50:  #eef2f8;

  --white: #ffffff;
  --ink: #14213f;
  --muted: #5b6b85;
  --border: #d7e2f0;
  --bg: #f3f6fb;
  --surface: #ffffff;

  /* Semantic accents — used for status/priority badges, alerts and buttons.
     --green is tuned from ELTI Green (Pantone 2377C, #00A83B) so white
     button text and badge text both clear WCAG AA against these surfaces.
     --green-solid keeps the exact brand hex for large filled surfaces
     (buttons, chart fills, dots) where hue fidelity matters most. */
  --green: #058a3a;
  --green-solid: #00a83b; /* exact ELTI Green */
  --green-bg: #dcf6ec;
  --amber: #b3760a;
  --amber-bg: #fdf0da;
  --red: #d1395a;
  --red-solid: #d1395a;
  --red-bg: #fce4ea;
  --gray: #5b6b85;
  --gray-bg: #e7edf5;

  /* ADDED ("make it full color" — maintenance/admin dashboard
     stat cards): solid, fully-saturated fills (paired with a white icon)
     for the stat-card icon chips, as an alternative to the pastel
     tint+text-color pairs above. --amber-solid / --orange-solid /
     --violet-solid are new; --green-solid and --red-solid already existed
     above and are reused as-is so "Done" / "Can't Fix" match everywhere. */
  --amber-solid: #c8860f;
  --orange-solid: #e8720c;
  --violet-solid: #6d55c9;

  --font-sans: 'Plus Jakarta Sans', 'Inter', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;

  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 22px;

  --shadow-xs: 0 1px 2px rgba(11, 37, 87, 0.06);
  --shadow: 0 4px 14px rgba(11, 37, 87, 0.08);
  --shadow-md: 0 10px 28px rgba(11, 37, 87, 0.11);
  --shadow-lg: 0 14px 36px rgba(11, 37, 87, 0.16);
  --shadow-xl: 0 26px 60px rgba(7, 26, 59, 0.24);

  --ease: cubic-bezier(.2,.75,.25,1);
  color-scheme: light;
}

/* ---------- DARK MODE ----------
   ENHANCED: All colors use elevated contrast ratios for WCAG AA compliance
   and ensure text remains readable on dark backgrounds.
   Shadow adjustments for dark mode to maintain visual hierarchy. */
:root[data-theme="dark"] {
  --ink: #f0f5fa;                     /* Light text for dark background */
  --muted: #a8bcd4;                   /* Improved muted text contrast */
  --border: #2a4a7b;                  /* Lighter borders in dark mode */
  --bg: #0a1420;                      /* Slightly lighter dark bg */
  --surface: #0f1e32;                 /* Surface elevation for depth */

  --blue-50: #1a3660;
  --blue-100: #203c6f;
  --blue-200: #2a4a7f;

  /* ENHANCED: Brightened semantic colors for proper contrast on dark surfaces
     Each color now passes WCAG AAA (7:1 ratio) for enhanced readability */
  --green: #4ae894;                   /* Brighter green for dark mode */
  --green-bg: #0f3a2a;                /* Darker green bg for contrast */
  --amber: #ffc966;                   /* Brighter amber */
  --amber-bg: #4a3a15;                /* Darker amber bg */
  --red: #ff8fa3;                     /* Brighter red */
  --red-bg: #442228;                  /* Darker red bg */
  --gray: #c5d0e0;                    /* Brighter gray text */
  --gray-bg: #1a2a45;                 /* Darker gray bg */

  /* Dark mode shadows: increased alpha for visibility on darker surfaces */
  --shadow-xs: 0 1px 2px rgba(0,0,0,0.4);
  --shadow: 0 4px 16px rgba(0,0,0,0.45);
  --shadow-md: 0 10px 30px rgba(0,0,0,0.5);
  --shadow-lg: 0 16px 40px rgba(0,0,0,0.55);
  --shadow-xl: 0 30px 70px rgba(0,0,0,0.65);
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 15px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background .25s ease, color .25s ease;
}

::selection { background: var(--blue-300); color: var(--blue-900); }

* { scrollbar-width: thin; scrollbar-color: var(--blue-300) transparent; }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--blue-300); border-radius: 20px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--blue-400); }

:focus-visible {
  outline: 2px solid var(--blue-500);
  outline-offset: 2px;
  border-radius: 4px;
}

a { color: var(--blue-600); text-decoration: none; transition: color .15s ease; }
a:hover { color: var(--blue-800); }
:root[data-theme="dark"] a { color: var(--blue-300); }
:root[data-theme="dark"] a:hover { color: var(--blue-100); }

/* ---------- MOTION / KEYFRAMES ---------- */
@keyframes fadeInUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeIn    { from { opacity: 0; } to { opacity: 1; } }
@keyframes scaleIn   { from { opacity: 0; transform: scale(.93); } to { opacity: 1; transform: scale(1); } }
@keyframes slideDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideInRight { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: translateX(0); } }
@keyframes spin      { to { transform: rotate(360deg); } }
@keyframes pulseDot  { 0%,100% { box-shadow: 0 0 0 0 rgba(209,57,90,0.35); } 50% { box-shadow: 0 0 0 6px rgba(209,57,90,0); } }
@keyframes shimmer   { 0% { background-position: -300px 0; } 100% { background-position: 300px 0; } }
@keyframes countIn   { from { opacity: 0; transform: translateY(6px) scale(.9); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes floatBlob { 0%,100% { transform: translate(0,0) scale(1); } 50% { transform: translate(-16px, 18px) scale(1.06); } }
@keyframes floatBlob2 { 0%,100% { transform: translate(0,0) scale(1); } 50% { transform: translate(20px, -14px) scale(1.08); } }
@keyframes ripple { to { transform: scale(2.6); opacity: 0; } }
@keyframes glowPulse { 0%,100% { opacity: .55; } 50% { opacity: 1; } }
@keyframes barGrow { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes rotateIn { from { opacity: 0; transform: rotate(-8deg) scale(.9); } to { opacity: 1; transform: rotate(0) scale(1); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

/* ---------- ICONS ---------- */
.icon-svg { width: 1em; height: 1em; display: inline-block; vertical-align: -0.15em; flex-shrink: 0; }
.btn .icon-svg, a .icon-svg { width: 15px; height: 15px; }
h2 .icon-svg, h3 .icon-svg { width: 17px; height: 17px; margin-right: 4px; vertical-align: -3px; }

h1, h2, h3, h4 { color: var(--ink); margin: 0 0 8px; font-weight: 800; letter-spacing: -0.015em; }
h1 { font-size: 27px; }
h2 { font-size: 20px; }
h3 { font-size: 16px; }
p { margin: 0 0 10px; color: var(--muted); line-height: 1.6; }

/* ---------- LOGIN PAGE ----------
   Full-bleed cover: the branded hotel banner (cover_3) fills the ENTIRE
   viewport as the page background, edge to edge, instead of splitting the
   screen into a photo half and a form half. The image's own right side is
   already a clean navy field, so the form card floats there directly on
   top of it — a thin frosted panel (blur + soft tint), not a solid block —
   so the photo keeps reading through behind the card.

   Desktop: locked to exactly one viewport (html/body overflow hidden via
   .login-page below) — nothing ever scrolls. Every size inside the card
   is a clamp() tied to vh, so on a short laptop screen the whole card
   quietly scales itself down to fit instead of overflowing.

   Tablet/mobile (<=860px): the card recenters instead of hugging the
   right edge, gets a solid scrim behind it (the image crops in tighter
   there and needs the contrast), and the page is allowed to scroll
   normally again since a phone in landscape, or with its keyboard open,
   may need more room than 100vh gives it. */
html.login-page, body.login-page {
  height: 100%;
  overflow: hidden;
  margin: 0;
}

.login-wrap {
  height: 100vh;
  box-sizing: border-box;
  background-color: var(--blue-900);
  background-image: var(--login-cover, none);
  background-size: cover;
  background-position: center right;
  background-repeat: no-repeat;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: clamp(20px, 4vh, 40px) clamp(24px, 6vw, 64px);
}

.login-panel {
  position: relative;
  width: 100%;
  max-width: 620px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card {
  width: 100%;
  max-width: 560px;
  max-height: 100%;
  overflow-y: auto;
  padding: clamp(26px, 6vh, 56px) clamp(28px, 5vw, 60px) clamp(22px, 5vh, 52px);
  border-radius: 28px;
  background: rgba(7, 18, 43, .46);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255,255,255,.14);
  box-shadow: 0 24px 60px rgba(2,8,22,.45);
  animation: scaleIn .5s var(--ease);
}

.login-panel-logo {
  width: clamp(48px, 8vh, 68px); height: clamp(48px, 8vh, 68px);
  margin-bottom: clamp(12px, 2.5vh, 22px);
  border-radius: 50%;
  background: #fff;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-md);
  overflow: hidden;
  animation: fadeInUp .55s ease .04s both;
}
.login-panel-logo .icon-svg { width: 40%; height: 40%; color: var(--blue-700); }
.login-panel-logo img.company-logo-img { width: 100%; height: 100%; object-fit: contain; padding: 7px; border-radius: 50%; }

.login-brand {
  display: flex; width: fit-content; margin-left: auto; margin-right: auto;
  align-items: center; gap: clamp(10px, 1.8vh, 16px);
  background: none; border: 0; border-radius: 0; box-shadow: none;
  padding: 0;
  margin-bottom: clamp(14px, 3vh, 24px);
  max-width: 100%;
  animation: fadeInUp .5s ease .04s both;
}
.login-brand .login-panel-logo {
  margin: 0; box-shadow: none; flex-shrink: 0;
  animation: none;
}
.login-brand-text { min-width: 0; line-height: 1.25; }
.login-brand-name {
  font-size: clamp(16px, 2.6vh, 22px); font-weight: 800; letter-spacing: -.01em;
  color: #fff;
}
.login-brand-sub {
  font-size: clamp(12.5px, 1.9vh, 16px); font-weight: 600; color: #8cc4ff;
}

.login-title {
  font-size: clamp(24px, 4.4vh, 36px); font-weight: 800; letter-spacing: -.01em;
  color: #fff; margin-bottom: clamp(4px, 1vh, 8px);
  animation: fadeInUp .5s ease .08s both;
}
.login-subtitle {
  font-size: clamp(13.5px, 2vh, 17px); color: #eaf1fc; margin-bottom: clamp(16px, 4vh, 34px);
  animation: fadeInUp .5s ease .12s both;
}

.login-card form { animation: fadeInUp .4s ease .16s both; }

/* Base icon-in-field layout: the wrapping div is a flex row so the icon and
   input sit on the same line, and the icon is pinned absolutely to the left
   so it overlaps the input's left padding instead of sitting above it. */
.input-icon-field {
  position: relative;
  margin-bottom: clamp(10px, 2.2vh, 18px);
  display: flex; align-items: center;
}
.input-icon-field .icon-svg {
  position: absolute; left: 18px;
  width: 20px; height: 20px; color: var(--blue-200); pointer-events: none;
}

.login-card .input-icon-field input {
  width: 100%;
  padding: clamp(12px, 2.2vh, 17px) 18px clamp(12px, 2.2vh, 17px) 52px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(255,255,255,.09);
  font-size: clamp(14px, 2vh, 16px);
  font-family: inherit;
  color: #fff;
  transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}
.login-card .input-icon-field input::placeholder { color: #b9c8e0; }
.login-card .input-icon-field input:focus {
  outline: none;
  background: rgba(255,255,255,.12);
  border-color: var(--blue-300);
  box-shadow: 0 0 0 3px rgba(143,168,204,0.18);
}
.login-card .input-icon-field.has-toggle input { padding-right: 68px; }

/* Message box on the forgot-password page: same glass style as the fields above */
.login-card textarea.forgot-message {
  width: 100%; display: block;
  padding: clamp(12px, 2.2vh, 17px) 18px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(255,255,255,.09);
  font-size: clamp(14px, 2vh, 16px);
  font-family: inherit;
  color: #fff;
  resize: vertical;
  transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}
.login-card textarea.forgot-message::placeholder { color: #b9c8e0; }
.login-card textarea.forgot-message:focus {
  outline: none;
  background: rgba(255,255,255,.12);
  border-color: var(--blue-300);
  box-shadow: 0 0 0 3px rgba(143,168,204,0.18);
}

.pw-toggle {
  position: absolute; right: 8px;
  height: 36px; padding: 0 14px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center; gap: 4px;
  background: transparent; border: none; cursor: pointer; color: var(--blue-200);
  font-size: 13px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase;
  transition: background .15s ease, color .15s ease;
}
.pw-toggle:hover { background: rgba(255,255,255,.1); color: #fff; }
.pw-toggle .icon-svg { display: none; }

.remember-row {
  display: flex; align-items: center; justify-content: space-between;
  font-size: clamp(13px, 1.8vh, 15px); color: #fff; font-weight: 500;
  margin: clamp(2px, 1vh, 6px) 0 clamp(14px, 3vh, 28px);
}
.remember-row .check-label { display: flex; align-items: center; gap: 9px; cursor: pointer; color: #fff; }
.remember-row input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--blue-300); cursor: pointer; }
.remember-row a { color: #d6e3f5; font-weight: 600; text-decoration: none; }
.remember-row a:hover { color: #fff; text-decoration: underline; }

.login-btn {
  background: linear-gradient(120deg, var(--blue-500), var(--blue-300));
  color: var(--blue-900);
  font-size: clamp(14px, 2vh, 17px); padding: clamp(13px, 2.2vh, 18px) 22px; letter-spacing: .01em;
  border-radius: 16px;
  background-size: 160% 160%;
  transition: background-position .4s ease, transform .12s ease, box-shadow .15s ease;
}
.login-btn:hover { background-position: 100% 0; box-shadow: 0 10px 24px rgba(0,0,0,.3); }

.demo-box {
  margin-top: clamp(14px, 3vh, 26px); padding: clamp(10px, 2vh, 16px) 18px;
  background: rgba(255,255,255,.09); border: 1px dashed rgba(255,255,255,.28);
  border-radius: 14px; font-size: clamp(11.5px, 1.6vh, 13.5px); color: #dce4f0; text-align: left;
}
.demo-box strong { color: #fff; }

.login-footer {
  margin: clamp(12px, 3vh, 24px) 0 0; font-size: clamp(11.5px, 1.6vh, 13.5px); color: #b9c8e0; text-align: center;
}
.login-footer a { color: #dce4f0; font-weight: 600; text-decoration: none; }
.login-footer a:hover { color: #fff; text-decoration: underline; }

/* ---------- FORM ELEMENTS ---------- */
label { display: block; font-size: 13px; font-weight: 600; color: var(--ink); margin: 14px 0 6px; }
label:first-of-type { margin-top: 0; }
/* ADDED (staff "Report Damage" page: "Fix the layout and design of date
   and time" — the "Needed By" field uses <input type="datetime-local">,
   which was missing from this selector list, so it rendered with none of
   the padding/border/font styling below and looked cramped next to the
   other fields). input[type=datetime-local] added so it now matches every
   other field on the form. */
input[type=text], input[type=password], input[type=email], input[type=number],
input[type=date], input[type=datetime-local], input[type=tel], select, textarea {
  width: 100%;
  padding: 10px 13px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  background: var(--surface);
  color: var(--ink);
  transition: border-color .15s ease, box-shadow .15s ease;
}
textarea { resize: vertical; min-height: 90px; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--blue-400);
  box-shadow: 0 0 0 4px var(--blue-100);
}
/* ADDED (Admin "Add New Property" / "Add New User": the plain
   <input type=file> for Property Logo / Profile Picture was picking up
   the same border+padding as text inputs above, but a native file input
   is really a small button plus a "no file chosen" label, not a text
   box — stretching it to width:100% with 10px/13px padding just left a
   tall mostly-empty rectangle around a tiny control. Given its own
   compact style here instead: a slim dashed dropzone-style border sized
   to its content, with the native browser button restyled to match the
   app's blue buttons via ::file-selector-button so it doesn't look like
   an unstyled OS control dropped onto a designed page. Kept OUT of the
   shared selector above on purpose — .media-drop input[type=file]
   (report/task photo & video uploads) already has its own different,
   invisible-overlay style further down this file and must not be
   affected by this. */
input[type=file] {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: inherit;
  background: var(--bg);
  color: var(--muted);
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}
input[type=file]:hover { border-color: var(--blue-400); background: var(--blue-50); }
input[type=file]:focus { outline: none; border-color: var(--blue-400); box-shadow: 0 0 0 4px var(--blue-100); }
input[type=file]::file-selector-button {
  margin-right: 12px;
  padding: 7px 14px;
  border: none;
  border-radius: 7px;
  background: var(--blue-500);
  color: #fff;
  font-weight: 600;
  font-size: 12.5px;
  font-family: inherit;
  cursor: pointer;
  transition: background .15s ease;
}
input[type=file]:hover::file-selector-button { background: var(--blue-600); }
/* ADDED (staff "Report Damage" page: "Edit the design of the date and
   time, make it similar to the design of other element in the page" —
   input[type=datetime-local] picked up the same border/padding/font as
   the other fields above once it was added to that shared selector, but
   the native browser date/time widget still rendered a touch shorter than
   the Priority dropdown next to it, and its built-in calendar icon looked
   like a plain unstyled OS control next to this app's own icon set. This
   block sets a matching min-height so both fields in that row line up,
   and dims/softens the calendar icon so it reads as part of the page
   instead of a bare browser default). */
input[type=date],
input[type=datetime-local] {
  min-height: 42px;
}
input[type=date]::-webkit-calendar-picker-indicator,
input[type=datetime-local]::-webkit-calendar-picker-indicator {
  cursor: pointer;
  opacity: .55;
  border-radius: 4px;
  transition: opacity .15s ease;
}
input[type=date]:hover::-webkit-calendar-picker-indicator,
input[type=datetime-local]:hover::-webkit-calendar-picker-indicator,
input[type=date]:focus::-webkit-calendar-picker-indicator,
input[type=datetime-local]:focus::-webkit-calendar-picker-indicator {
  opacity: 1;
}
.form-row { display: flex; gap: 16px; flex-wrap: wrap; }
.form-row > div { flex: 1; min-width: 200px; }
.form-hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.form-hint.hint-ok  { color: var(--green); font-weight: 600; }
.form-hint.hint-bad { color: var(--red); font-weight: 600; }
input.input-invalid { border-color: var(--red) !important; }
.form-actions { margin-top: 22px; display: flex; gap: 10px; }

/* ---------- MEDIA UPLOAD (photo / video dropzones) ---------- */
.media-upload-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 6px; }
.media-drop {
  position: relative;
  border: 1.5px dashed var(--border);
  border-radius: var(--radius);
  padding: 22px 14px;
  text-align: center;
  cursor: pointer;
  background: var(--bg);
  transition: border-color .15s ease, background .15s ease, transform .15s ease;
}
.media-drop:hover { border-color: var(--blue-400); background: var(--blue-50); }
.media-drop.dragover { border-color: var(--blue-500); background: var(--blue-50); transform: scale(1.01); }
.media-drop.has-file { border-style: solid; border-color: var(--green-solid); background: var(--green-bg); }
/* ADDED: client-side "file is bigger than the server will accept" state
   (see initMediaDropzones()'s MAX_UPLOAD_BYTES in assets/js/script.js) —
   flags an oversized photo/video the moment it's chosen instead of
   letting the person wait through a full upload only to have it
   rejected server-side with no preview ever having been shown. */
.media-drop.media-drop-error { border-style: solid; border-color: var(--red); background: var(--red-bg); }
.media-drop.media-drop-error .media-drop-filename {
  display: block; color: var(--red); white-space: normal; overflow: visible;
}
.media-drop input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.media-drop .media-drop-icon {
  width: 42px; height: 42px; margin: 0 auto 10px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  background: var(--blue-100); color: var(--blue-600);
}
.media-drop .media-drop-icon .icon-svg { width: 22px; height: 22px; }
.media-drop .media-drop-label { font-size: 13.5px; font-weight: 700; color: var(--ink); }
.media-drop .media-drop-hint { font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.media-drop .media-drop-filename {
  display: none; font-size: 12.5px; font-weight: 700; color: var(--green);
  margin-top: 6px; max-width: 100%; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; padding: 0 4px;
}
.media-drop.has-file .media-drop-filename { display: block; }
.media-preview { margin-top: 10px; text-align: center; }
.media-preview img, .media-preview video {
  max-width: 100%; max-height: 220px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: #000;
}
.media-clear-btn {
  display: none; margin-top: 8px; font-size: 11.5px; font-weight: 700;
  color: var(--red); background: none; border: none; cursor: pointer;
  text-decoration: underline; position: relative; z-index: 2;
}
.media-drop.has-file .media-clear-btn,
.media-drop.media-drop-error .media-clear-btn { display: inline-block; }

@media (max-width: 600px) {
  .media-upload-grid { grid-template-columns: 1fr; }
}

/* ADDED: chip-list preview for multi-file dropzones (inputs with
   `multiple` — photos[]/videos[] on Report Damage / After-Fix forms).
   Each selected file gets its own thumbnail + name + remove button,
   wired up by the `input.multiple` branch of initMediaDropzones() in
   assets/js/script.js. Single-file zones (avatar, property logo) are
   unaffected and keep using .media-preview img/video above. */
.media-preview:has(.media-chip) {
  text-align: left; display: flex; flex-direction: column; gap: 8px;
}
.media-chip {
  display: flex; align-items: center; gap: 10px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 6px 8px; background: var(--surface);
}
.media-chip img, .media-chip video {
  width: 40px; height: 40px; object-fit: cover; border-radius: 8px;
  background: #000; flex-shrink: 0;
}
.media-chip-name {
  flex: 1; font-size: 12.5px; color: var(--ink); overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
.media-chip-error .media-chip-name { color: var(--red); }
.media-chip-remove {
  flex-shrink: 0; width: 22px; height: 22px; border-radius: 50%;
  border: none; background: var(--red-bg); color: var(--red);
  font-size: 15px; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.media-chip-remove:hover { background: var(--red); color: #fff; }

/* ---------- MEDIA GALLERY (multiple photos/videos shown on a report) ---------- */
.media-gallery {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 10px; margin: 8px 0 4px;
}
.media-gallery-item {
  display: block; border-radius: var(--radius-sm); overflow: hidden;
  border: 1px solid var(--border); background: #000; aspect-ratio: 1/1;
  transition: transform .15s ease, box-shadow .15s ease;
}
.media-gallery-item:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.media-gallery-item img {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.media-gallery-video { grid-template-columns: 1fr; }
.media-gallery-item-video {
  aspect-ratio: auto; border: none; background: none;
}
.media-gallery-item-video:hover { transform: none; box-shadow: none; }

/* ---------- FORM SECTIONS (grouped fields with a small heading) ---------- */
.form-section { padding: 18px 0; border-bottom: 1px dashed var(--border); }
.form-section:first-of-type { padding-top: 2px; }
.form-section:last-of-type { border-bottom: none; padding-bottom: 2px; }
.form-section-title {
  display: flex; align-items: center; gap: 8px;
  margin: 0 0 14px; font-size: 14.5px; font-weight: 800; color: var(--blue-700);
}
:root[data-theme="dark"] .form-section-title { color: var(--blue-300); }
.form-section-title .icon-svg { width: 18px; height: 18px; color: var(--blue-500); }
/* Center the "Report New Damage" form in the available content width
   instead of it sitting flush left, so it reads as one balanced card on
   wide screens; on narrower screens it just fills the width as before. */
.report-form-panel { animation: fadeInUp .35s ease both; margin-left: auto; margin-right: auto; }
.needed-by-preview { font-size: 12px; font-weight: 700; color: var(--blue-600); margin-top: 4px; min-height: 15px; }

/* ---------- BUTTONS ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  border: none;
  font-size: 14px; font-weight: 600;
  cursor: pointer;
  background: var(--blue-600); color: #fff;
  box-shadow: 0 1px 2px rgba(11,37,87,0.15);
  transition: background .15s ease, transform .12s ease, box-shadow .15s ease;
  position: relative;
  overflow: hidden;
}
.btn:hover { background: var(--blue-700); transform: translateY(-1.5px); box-shadow: 0 8px 20px rgba(31,99,191,0.28); }
.btn:active { transform: scale(0.97) translateY(0); box-shadow: none; }
.btn-block { width: 100%; }
.btn-outline { background: var(--surface); color: var(--blue-700); border: 1.5px solid var(--blue-300); box-shadow: none; }
.btn-outline:hover { background: var(--blue-50); }
.btn-light { background: var(--blue-100); color: var(--blue-800); box-shadow: none; }
.btn-light:hover { background: var(--blue-200); }
.btn-danger { background: var(--red-solid); }
.btn-danger:hover { background: #b22c4c; }
.btn-success { background: var(--green-solid); }
.btn-success:hover { background: #048a34; }

/* ADDED: a distinct, attention-grabbing color for the "Download" report
   button on the All Reports list (admin/reports.php), separate from the
   existing solid button colors (blue = primary, green = success/positive
   action, red = danger) so it doesn't blend in as "just another action". */
/* FIX (admin request: "Remove the shadow in download button, fix it" — the
   glow was still showing after the first attempt because the base .btn /
   .btn:hover rules above already set their own box-shadow, and simply
   leaving box-shadow out of .btn-highlight / .btn-highlight:hover let that
   base shadow show through instead of removing it. Setting box-shadow:
   none explicitly here, on BOTH the resting and hover states, is what
   actually overrides it). Color/background are untouched. */
.btn-highlight { background: #e8720c; color: #fff; box-shadow: none; }
.btn-highlight:hover { background: #c95f09; box-shadow: none; }
.btn-sm { padding: 6px 12px; font-size: 12.5px; }

.btn .ripple {
  position: absolute; border-radius: 50%;
  background: rgba(255,255,255,0.55);
  transform: scale(0); pointer-events: none;
  animation: ripple .55s ease-out forwards;
}
.btn-outline .ripple, .btn-light .ripple { background: rgba(31,99,191,0.25); }

/* ---------- APP LAYOUT ---------- */
.app { display: flex; height: 100vh; overflow: hidden; }

.sidebar {
  width: 260px;
  flex-shrink: 0;
  background: linear-gradient(190deg, var(--blue-900), var(--blue-800) 60%, var(--blue-900));
  color: #fff;
  padding: 22px 0;
  height: 100%; overflow-y: auto;
  transition: left .25s ease, width .25s ease;
}
.sidebar .brand {
  display: flex; align-items: center; gap: 12px;
  padding: 0 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  margin-bottom: 16px;
}
.sidebar .brand .logo {
  width: 40px; height: 40px; border-radius: 13px;
  background: linear-gradient(135deg, var(--blue-400), var(--blue-400));
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; color: #fff; font-size: 16px;
  box-shadow: 0 6px 16px rgba(31,99,191,0.35);
  animation: rotateIn .5s var(--ease) both;
}
.sidebar .brand .logo .icon-svg { width: 20px; height: 20px; }
.sidebar .brand .logo img.company-logo-img {
  width: 100%; height: 100%; object-fit: contain; border-radius: 10px; padding: 3px;
}
.sidebar .brand .name { font-size: 14.5px; font-weight: 700; line-height: 1.2; letter-spacing: -.005em; }
.sidebar .brand .role { font-size: 11px; color: var(--blue-300); margin-top: 1px; }

.sidebar .section-label {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .09em;
  color: var(--blue-300); padding: 16px 24px 8px; font-weight: 700;
  opacity: .85;
}
.sidebar nav { padding: 0 12px; display: flex; flex-direction: column; gap: 2px; }
.sidebar nav a {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px;
  color: var(--blue-100);
  font-size: 13.5px; font-weight: 500;
  border-radius: 11px;
  position: relative;
  transition: background .18s ease, color .18s ease, transform .12s ease;
}
.sidebar nav a:hover { background: rgba(255,255,255,0.08); color: #fff; transform: translateX(2px); }
.sidebar nav a.active {
  background: linear-gradient(90deg, rgba(61,132,224,0.28), rgba(31,99,191,0.12));
  color: #fff; font-weight: 700;
  box-shadow: inset 3px 0 0 0 var(--blue-300);
}
.sidebar nav a .icon-svg { width: 17px; height: 17px; opacity: .85; }
.sidebar nav a.active .icon-svg, .sidebar nav a:hover .icon-svg { opacity: 1; }
.sidebar .logout-link { margin-top: 20px; padding: 12px 12px 0; border-top: 1px solid rgba(255,255,255,0.1); }
.sidebar .logout-link nav { padding: 0; }
.sidebar .logout-link a:hover { background: rgba(209,57,90,0.22); color: #ffd6e0; }

.main { flex: 1; min-width: 0; height: 100%; display: flex; flex-direction: column; overflow: hidden; }

.menu-toggle {
  display: none;
  align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: var(--radius-sm);
  background: var(--blue-50); border: 1px solid var(--border);
  color: var(--blue-700); cursor: pointer; margin-right: 10px;
  transition: background .15s ease, transform .1s ease;
}
.menu-toggle:hover { background: var(--blue-100); }
.menu-toggle:active { transform: scale(0.94); }

/* Back button: same look as the menu button, only shown where the menu button is. */
.back-btn {
  display: none;
  align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: var(--radius-sm); flex: none;
  background: var(--blue-50); border: 1px solid var(--border);
  color: var(--blue-700); cursor: pointer; margin-right: 10px;
  transition: background .15s ease, transform .1s ease;
}
.back-btn:hover { background: var(--blue-100); }
.back-btn:active { transform: scale(0.94); }
.back-btn .icon-svg { width: 18px; height: 18px; }
:root[data-theme="dark"] .back-btn { color: #dce4f0; }
:root[data-theme="dark"] .back-btn:hover { background: #2a4a7f; color: #fff; }
@media (max-width: 1024px) { .back-btn { display: inline-flex; } }
@media (max-width: 600px) { .menu-toggle, .back-btn { margin-right: 8px; } }
.topbar-left { display: flex; align-items: center; min-width: 0; flex: 1; }
.topbar h1 { font-size: 19px; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }

.topbar {
  background: color-mix(in srgb, var(--surface) 85%, transparent);
  backdrop-filter: blur(12px) saturate(160%);
  -webkit-backdrop-filter: blur(12px) saturate(160%);
  border-bottom: 1px solid var(--border);
  padding: 15px 28px;
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
  z-index: 5;
  animation: slideDown .35s ease both;
  gap: 14px;
}
.topbar-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

.theme-toggle {
  width: 38px; height: 38px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--blue-50); border: 1px solid var(--border);
  color: var(--blue-700); cursor: pointer;
  transition: background .15s ease, transform .25s var(--ease);
}
.theme-toggle:hover { background: var(--blue-100); transform: rotate(18deg); }
.theme-toggle .icon-svg { width: 17px; height: 17px; }
/* Notification bell stays put on hover/tap/focus (no rotate). */
#notifToggle, #notifToggle:hover, #notifToggle:active, #notifToggle:focus { transform: none; }

/* ---------- NOTIFICATION BELL + POPUP (topbar, beside dark-mode toggle) ---------- */
.notif-wrap { position: relative; }
.notif-dot {
  position: absolute; top: -3px; right: -3px;
  min-width: 16px; height: 16px; padding: 0 3px;
  border-radius: 999px; background: #d4183d; color: #fff;
  font-size: 10px; font-weight: 800; line-height: 16px; text-align: center;
  box-shadow: 0 0 0 2px var(--surface);
}
/* (--red turns pale pink in dark mode, which made the white count unreadable) */
:root[data-theme="dark"] .notif-dot { background: #e5334f; }
.notif-panel {
  position: absolute; top: calc(100% + 10px); right: 0;
  width: min(340px, 88vw);
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-md);
  max-height: 420px; overflow-y: auto;
  opacity: 0; visibility: hidden; transform: translateY(-6px);
  transition: opacity .15s ease, transform .15s ease, visibility .15s;
  z-index: 40;
}
.notif-panel.open { opacity: 1; visibility: visible; transform: translateY(0); }
.notif-panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  font-weight: 800; font-size: 13px; padding: 12px 14px;
  border-bottom: 1px solid var(--border); color: var(--ink);
}
.notif-panel-unread {
  font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px;
  background: #d4183d; color: #fff;
}
.notif-panel-unread[hidden] { display: none; }
:root[data-theme="dark"] .notif-panel-unread { background: #e5334f; }
.notif-empty { padding: 22px 14px; text-align: center; color: var(--muted); font-size: 13px; }
.notif-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 11px 14px 11px 11px; text-decoration: none; color: inherit;
  border-bottom: 1px solid var(--border);
  border-left: 3px solid transparent;
  transition: background .12s ease;
}
.notif-item:last-child { border-bottom: none; }
.notif-item-icon {
  width: 28px; height: 28px; flex: none; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
}
.notif-item-icon .icon-svg { width: 15px; height: 15px; }
.notif-item-body { min-width: 0; }
.notif-item-text { display: block; font-size: 12.5px; line-height: 1.35; color: var(--ink); }
.notif-item-time { display: block; font-size: 11px; margin-top: 2px; }

/* UNREAD: bold text, tinted row with a blue accent bar, solid blue icon chip. */
.notif-item.is-unread {
  background: #e3edff; border-left-color: var(--blue-600);
}
.notif-item.is-unread:hover { background: #d3e2ff; }
.notif-item.is-unread .notif-item-text { font-weight: 700; color: #0d1b3a; }
.notif-item.is-unread .notif-item-time { color: var(--blue-700); font-weight: 600; }
.notif-item.is-unread .notif-item-icon { background: var(--blue-600); color: #fff; }

/* READ: normal weight, plain row, calmer (but still readable) colors. */
.notif-item.is-read { background: transparent; }
.notif-item.is-read:hover { background: var(--blue-50); }
.notif-item.is-read .notif-item-text { font-weight: 400; color: #3c4a66; }
.notif-item.is-read .notif-item-time { color: #5f6e88; font-weight: 400; }
.notif-item.is-read .notif-item-icon { background: var(--blue-100); color: var(--blue-700); }

.topbar .user-chip {
  display: flex; align-items: center; gap: 10px;
  font-size: 13px; color: var(--ink);
  padding: 5px 8px 5px 5px; border-radius: 30px;
  transition: background .15s ease;
}
.topbar .user-chip:hover { background: var(--blue-50); }
.topbar .avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, var(--blue-400), var(--blue-400));
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px;
  box-shadow: 0 3px 8px rgba(31,99,191,0.35);
  transition: transform .2s ease;
}
.topbar .user-chip:hover .avatar { transform: scale(1.08) rotate(-4deg); }

/* Generic .avatar bubble usable anywhere user_avatar() is called (not just
   the topbar) — e.g. the Admin Users table and edit form preview. */
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, var(--blue-400), var(--blue-400));
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; flex: none;
}
.avatar.avatar-sm { width: 28px; height: 28px; font-size: 11px; }
/* ADDED: a smaller modifier for showing a reporter/assignee's avatar
   inline in a line of small text (e.g. "Reported by ..." on report
   detail pages), where avatar-sm (28px) would be too big. */
.avatar.avatar-xs { width: 16px; height: 16px; font-size: 8px; border-radius: 5px; vertical-align: -3px; }
/* Uploaded profile photo (Admin -> Users) rendered through the same
   .avatar bubble as the initial-letter fallback — see user_avatar() in
   includes/functions.php. */
.avatar.avatar-photo { object-fit: cover; background: var(--blue-100); }

/* Property logo bubble (Admin -> Properties), mirrors .avatar above
   but square/rounded-square since a hotel logo isn't a portrait — see
   property_logo_img() in includes/functions.php. */
.property-logo {
  width: 34px; height: 34px; border-radius: 8px;
  background: var(--blue-50); color: var(--blue-400);
  display: flex; align-items: center; justify-content: center;
  flex: none; overflow: hidden;
}
.property-logo.avatar-sm { width: 28px; height: 28px; border-radius: 6px; }
.property-logo svg { width: 60%; height: 60%; }
.property-logo.property-logo-photo { object-fit: contain; background: #fff; padding: 3px; }

.content { padding: 28px 28px 60px; animation: fadeInUp .45s var(--ease) both; flex: 1; min-height: 0; overflow-y: auto; }

/* ---------- ALERTS / TOASTS ---------- */
.alert {
  padding: 13px 16px; border-radius: var(--radius-sm); margin-bottom: 18px;
  font-size: 13.5px; border: 1px solid transparent;
  display: flex; align-items: center; gap: 8px;
  animation: slideDown .3s ease both;
}
.alert-success { background: var(--green-bg); color: var(--green); border-color: color-mix(in srgb, var(--green) 30%, transparent); }
.alert-error   { background: var(--red-bg); color: var(--red); border-color: color-mix(in srgb, var(--red) 30%, transparent); }
.alert-info    { background: var(--blue-50); color: var(--blue-700); border-color: var(--blue-200); }

.toast-stack {
  position: fixed; top: 20px; right: 20px; z-index: 200;
  display: flex; flex-direction: column; gap: 10px;
  max-width: min(340px, calc(100vw - 40px));
}
.toast {
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--border); border-left: 4px solid var(--blue-500);
  border-radius: 12px; box-shadow: var(--shadow-lg);
  padding: 12px 14px; font-size: 13px; font-weight: 500;
  display: flex; align-items: flex-start; gap: 8px;
  animation: slideInRight .3s var(--ease) both;
}
.toast.success { border-left-color: var(--green); }
.toast.error { border-left-color: var(--red); }
.toast.leaving { animation: fadeIn .25s ease reverse forwards; }

/* ---------- STAT CARDS ---------- */
.stat-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 16px; margin-bottom: 26px;
}
.stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  display: flex; align-items: center; gap: 14px;
  animation: fadeInUp .45s var(--ease) both;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
  position: relative;
  overflow: hidden;
  /* ADDED ("make dashboard stat cards clickable"): stat cards are now
     rendered as <a> tags linking to the matching filtered list, so undo
     the default link styling (blue text + underline) that would
     otherwise clash with the numbers/labels below. */
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}
.stat-card::after {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  background: linear-gradient(180deg, var(--blue-400), var(--blue-400));
  opacity: 0; transition: opacity .18s ease;
}
.stat-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: transparent; }
.stat-card:hover::after { opacity: 1; }
.stat-grid .stat-card:nth-child(1) { animation-delay: .02s; }
.stat-grid .stat-card:nth-child(2) { animation-delay: .08s; }
.stat-grid .stat-card:nth-child(3) { animation-delay: .14s; }
.stat-grid .stat-card:nth-child(4) { animation-delay: .2s; }
.stat-grid .stat-card:nth-child(5) { animation-delay: .26s; }
.stat-grid .stat-card:nth-child(6) { animation-delay: .32s; }
.stat-card .stat-icon {
  width: 46px; height: 46px; border-radius: 14px; flex-shrink: 0;
  /* CHANGED ("make it full color" — maintenance/admin dashboard
     stat cards): these chips used to be a pale tint with a matching-hue
     icon (e.g. faint blue bg + blue icon), which read as washed-out in the
     screenshots. Default (no modifier — "Total Reports" / "Unassigned
     Pool") now gets a solid, fully-saturated fill with a white icon, same
     treatment as the semantic modifiers below. */
  background: var(--blue-600); color: #fff;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 12px color-mix(in srgb, var(--blue-600) 45%, transparent);
  transition: transform .25s var(--ease);
}
.stat-card:hover .stat-icon { transform: scale(1.1) rotate(-6deg); }
.stat-card .stat-icon .icon-svg { width: 22px; height: 22px; }
.stat-card .stat-num { font-size: 27px; font-weight: 800; color: var(--ink); line-height: 1; letter-spacing: -.01em; }
.stat-card .stat-label { font-size: 12.5px; color: var(--muted); margin-top: 5px; }
/* CHANGED ("make it full color"): every modifier now fills the chip with
   its full-strength solid color (--*-solid) and a white icon instead of a
   pastel tint + colored icon, so each stat card reads as a distinct,
   vivid color at a glance rather than several similarly-pale chips. Each
   also gets a soft glow in its own color via color-mix(), echoing the
   glow the "Done" status badge (.st-done) already used elsewhere. */
.stat-card.pending .stat-icon { background: var(--amber-solid); color: #fff; box-shadow: 0 4px 12px color-mix(in srgb, var(--amber-solid) 45%, transparent); }
.stat-card.progress .stat-icon { background: var(--blue-600); color: #fff; box-shadow: 0 4px 12px color-mix(in srgb, var(--blue-600) 45%, transparent); }
.stat-card.done .stat-icon { background: var(--green-solid); color: #fff; box-shadow: 0 4px 12px color-mix(in srgb, var(--green-solid) 45%, transparent); }
.stat-card.cannot .stat-icon { background: var(--red-solid); color: #fff; box-shadow: 0 4px 12px color-mix(in srgb, var(--red-solid) 45%, transparent); }
.stat-card.urgent .stat-icon { background: var(--orange-solid); color: #fff; box-shadow: 0 4px 12px color-mix(in srgb, var(--orange-solid) 45%, transparent); }
/* ADDED: a "pool" modifier for cards that represent a neutral/shared
   queue rather than a status (e.g. maintenance dashboard's "Unassigned
   (Pool)" card) — gives it its own violet accent instead of doubling up
   on the same blue as "progress", so the two cards stay visually
   distinct even though neither is a semantic status color. */
.stat-card.pool .stat-icon { background: var(--violet-solid); color: #fff; box-shadow: 0 4px 12px color-mix(in srgb, var(--violet-solid) 45%, transparent); }


/* IMPORTANT (fix): in dark mode --blue-50/100/200 are re-defined above as
   DARK background shades (#1a3660 / #203c6f / #2a4a7f). The first version of
   this block used them as TEXT colors, which made icons/text dark-on-dark
   (e.g. the notification bell and dark-mode toggle vanished). Text/icon
   colors below now use literal light hex values instead. */
/* ---------- DARK MODE — READABILITY FIXES ----------
   ADDED ("for darkmode make sure that the contents and icons will still be
   visible" — staff, maintenance; admin's dashboard is the
   reference). Many shared components colored their text/icons with the
   DARK blue steps (--blue-600/700/800), which are only re-tinted for
   backgrounds in the dark theme, so text like table headers, outline
   buttons, badges and chip icons ended up dark-blue-on-dark-navy. In dark
   mode these now use the light blue steps (--blue-100/200/300) instead.
   Solid-fill elements with white text (primary .btn, stat-card icon chips,
   .st-done) are left alone — they already contrast fine on both themes. */
:root[data-theme="dark"] table.data-table th { color: #b9c8e0; }
:root[data-theme="dark"] table.data-table tr.row-link td:first-child,
:root[data-theme="dark"] table.data-table tbody tr.row-link td:first-child { color: var(--blue-300); }
:root[data-theme="dark"] .btn-outline { color: #dce4f0; border-color: var(--blue-300); background: transparent; }
:root[data-theme="dark"] .btn-outline:hover { background: var(--blue-50); }
:root[data-theme="dark"] .btn-light { color: #dce4f0; }
:root[data-theme="dark"] .btn-light:hover { background: var(--blue-200); }
:root[data-theme="dark"] .st-assigned,
:root[data-theme="dark"] .pr-medium { color: #dce4f0; }
:root[data-theme="dark"] .st-reassigned { color: #e6d6ff; background: color-mix(in srgb, #8b5cf6 40%, var(--surface)); }
:root[data-theme="dark"] .st-progress { color: #cfe0ff; background: color-mix(in srgb, var(--blue-500) 45%, var(--surface)); }
:root[data-theme="dark"] .type-chip,
:root[data-theme="dark"] .property-tag,
:root[data-theme="dark"] .media-badge { color: #dce4f0; border-color: #b9c8e0; }
:root[data-theme="dark"] .alert-info { color: #dce4f0; border-color: #b9c8e0; }
:root[data-theme="dark"] .menu-toggle,
:root[data-theme="dark"] .theme-toggle { color: #dce4f0; }
/* Notifications in dark mode: bright text on the unread rows, softer on read. */
:root[data-theme="dark"] .notif-item.is-unread { background: #17376b; border-left-color: #6ea0ff; }
:root[data-theme="dark"] .notif-item.is-unread:hover { background: #1e4482; }
:root[data-theme="dark"] .notif-item.is-unread .notif-item-text { color: #ffffff; }
:root[data-theme="dark"] .notif-item.is-unread .notif-item-time { color: #bcd3ff; }
:root[data-theme="dark"] .notif-item.is-unread .notif-item-icon { background: #3d7be8; color: #fff; }
:root[data-theme="dark"] .notif-item.is-read:hover { background: var(--blue-50); }
:root[data-theme="dark"] .notif-item.is-read .notif-item-text { color: #c3d0e4; }
:root[data-theme="dark"] .notif-item.is-read .notif-item-time { color: #98aac4; }
:root[data-theme="dark"] .notif-item.is-read .notif-item-icon { color: #dce4f0; background: var(--blue-200); }
:root[data-theme="dark"] .media-drop .media-drop-icon { color: #dce4f0; background: var(--blue-200); }
:root[data-theme="dark"] .needed-by-preview { color: var(--blue-300); }
:root[data-theme="dark"] .empty-state .icon { color: #b9c8e0; }
:root[data-theme="dark"] .welcome-banner .btn-outline { color: #fff; }
:root[data-theme="dark"] input[type=date]::-webkit-calendar-picker-indicator,
:root[data-theme="dark"] input[type=datetime-local]::-webkit-calendar-picker-indicator { filter: invert(1); opacity: .8; }
:root[data-theme="dark"] .timeline .t-notes { color: var(--ink); }
:root[data-theme="dark"] .form-hint { color: var(--muted); }
:root[data-theme="dark"] input::placeholder,
:root[data-theme="dark"] textarea::placeholder { color: #7f93b0; }
:root[data-theme="dark"] .filter-bar select,
:root[data-theme="dark"] .filter-bar input { background: var(--surface); color: var(--ink); }
:root[data-theme="dark"] .chart-legend-row { color: var(--muted); }

/* ADDED (fix — screenshot: bell + dark-mode buttons invisible in dark
   mode): .theme-toggle / .menu-toggle used color var(--blue-700), a dark
   navy that disappears on the dark topbar. Explicit light icon color, a
   visible border, and a lighter fill so the round buttons read clearly. */
:root[data-theme="dark"] .theme-toggle,
:root[data-theme="dark"] .menu-toggle {
  color: #dce4f0;
  background: #1f3a66;
  border-color: #4a6aa3;
}
:root[data-theme="dark"] .theme-toggle:hover,
:root[data-theme="dark"] .menu-toggle:hover { background: #2a4a7f; color: #fff; }
:root[data-theme="dark"] .theme-toggle .icon-svg,
:root[data-theme="dark"] .menu-toggle .icon-svg { color: #dce4f0; stroke: currentColor; }
:root[data-theme="dark"] .form-section-title .icon-svg { color: var(--blue-300); }
:root[data-theme="dark"] .topbar .user-chip { color: var(--ink); }

/* ADDED (dark mode): folder-card icon chips (staff/maintenance Properties +
   dashboard) and the admin expenses amount were colored --blue-600,
   which is too dim on the dark surface; lightened in dark mode only. */
.expense-amount { color: var(--blue-600); }
:root[data-theme="dark"] .expense-amount,
:root[data-theme="dark"] .folder-icon,
:root[data-theme="dark"] .folder-icon-sm { color: #b9c8e0; }

/* ADDED: "Materials & Expenses" highlight card (render_materials_expenses_card()).
   Theme variables only, so it stays readable in light and dark mode. */
.expense-card { border: 1.5px solid var(--green-solid); background: var(--green-bg); border-radius: var(--radius-sm); padding: 14px 16px; margin: 14px 0; }
.expense-card-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-weight: 800; font-size: 14px; color: var(--green); margin-bottom: 8px; }
.expense-card-head > span { font-weight: 500; font-size: 12px; color: var(--muted); }
.expense-card-row { display: flex; gap: 12px; padding: 6px 0; font-size: 13.5px; color: var(--ink); border-top: 1px dashed var(--border); }
.expense-card-row:first-of-type { border-top: none; }
.expense-card-row > span { flex: 0 0 130px; font-weight: 700; color: var(--muted); }
.expense-card-amt { color: var(--green); font-size: 16px; }

/* ---------- WELCOME BANNER ---------- */
.welcome-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap;
  background: linear-gradient(120deg, var(--blue-900), var(--blue-600) 75%, var(--blue-400));
  background-size: 180% 180%;
  animation: fadeInUp .4s ease both, bannerShift 10s ease-in-out infinite;
  color: #fff; border-radius: var(--radius-lg);
  padding: 24px 28px; margin-bottom: 24px;
  box-shadow: var(--shadow-lg);
  position: relative; overflow: hidden;
}
@keyframes bannerShift { 0%,100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }
.welcome-banner::after {
  content: ''; position: absolute; right: -40px; top: -40px;
  width: 200px; height: 200px; border-radius: 50%;
  background: rgba(255,255,255,0.09);
  animation: floatBlob 9s ease-in-out infinite;
}
.welcome-banner::before {
  content: ''; position: absolute; right: 80px; bottom: -80px;
  width: 140px; height: 140px; border-radius: 50%;
  background: rgba(255,255,255,0.07);
  animation: floatBlob2 11s ease-in-out infinite;
}
.welcome-banner .wb-text h2 { color: #fff; margin-bottom: 4px; font-size: 21px; }
.welcome-banner .wb-text p { color: #fff; margin: 0; font-size: 13px; opacity: 0.9; }
:root[data-theme="dark"] .welcome-banner .wb-text p { color: #fff; opacity: 0.95; }
.welcome-banner .wb-icon {
  width: 54px; height: 54px; border-radius: 16px;
  background: rgba(255,255,255,0.16);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.2);
  animation: glowPulse 2.4s ease-in-out infinite;
}
.welcome-banner .wb-icon .icon-svg { width: 26px; height: 26px; }
.welcome-banner .wb-actions { display: flex; gap: 10px; flex-wrap: wrap; position: relative; z-index: 1; }
.welcome-banner .wb-left { display: flex; align-items: center; gap: 16px; position: relative; z-index: 1; }
.welcome-banner .btn-outline { background: rgba(255,255,255,0.12); color: #fff; border-color: rgba(255,255,255,0.45); }
.welcome-banner .btn-outline:hover { background: rgba(255,255,255,0.22); }

/* ---------- PANELS / CARDS ---------- */
.panel {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  padding: 22px 24px;
  margin-bottom: 22px;
  animation: fadeInUp .45s var(--ease) both;
  animation-delay: .1s;
  transition: box-shadow .2s ease;
}
.panel:hover { box-shadow: var(--shadow-md); }
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px; padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap; gap: 10px;
}
.panel-head h2 { margin: 0; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 22px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }

/* ---------- CHART CARD ---------- */
.chart-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  padding: 22px 24px;
  margin-bottom: 22px;
  animation: fadeInUp .45s var(--ease) both;
  transition: box-shadow .2s ease;
}
.chart-card:hover { box-shadow: var(--shadow-md); }
.chart-card .chart-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; gap: 10px; flex-wrap: wrap; }
.chart-card .chart-head h2, .chart-card .chart-head h3 { margin: 0; }
/* FIX ("My Report Status" circle layout): .chart-body used to be a bare
   `position: relative` box, so its WIDTH came from the panel (nearly the
   full card on desktop, the full screen width on mobile once the 2-column
   grid collapses to 1) while its HEIGHT stayed fixed at the 210px set
   inline in staff/dashboard.php and maintenance/dashboard.php. Chart.js
   filled that mismatched rectangle, so the donut rendered as a stretched
   oval pinned to the left edge instead of a centered circle — most obvious
   on phones and tablets, which is what was reported. Pinning both
   dimensions to the same fixed size here (matching the height the pages
   already use) and centering the box with margin/flex makes it a true
   circle and keeps it centered at every screen width, with no separate
   mobile override needed. */
.chart-card .chart-body {
  position: relative;
  width: 210px;
  height: 210px;
  max-width: 100%;
  margin: 0 auto;
}
/* FIX ("Reports — Last 14 Days" trend graph on admin/dashboard.php, and any
   other bar/line chart sharing .chart-card/.chart-body with the donut
   charts above): the 210x210 square above is sized for a circular donut
   and was being inherited by every chart in a .chart-card, including wide
   trend/bar charts. Pages only ever override the *height* inline
   (style="height:260px"), so the *width* stayed pinned at 210px — Chart.js
   then had to squeeze the whole 14-day line graph into a 210px-wide box
   inside a much wider card, which is why the line/area chart rendered
   tiny and off to one side instead of spanning the panel. Add this
   modifier class to any .chart-body that holds a bar or line chart (not a
   donut) to let it use the card's full width instead. */
.chart-card .chart-body.chart-body-fluid {
  width: 100%;
  max-width: 100%;
  margin: 0;
}
.chart-legend-row {
  display: flex; flex-wrap: wrap; gap: 14px; margin-top: 14px; font-size: 12.5px; color: var(--muted);
  justify-content: center; /* legend now sits centered under the centered circle */
}
.chart-legend-row .dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; }
.chart-empty { text-align: center; padding: 40px 10px; color: var(--muted); font-size: 13px; }

/* ---------- TABLE ---------- */
.table-wrap { overflow-x: auto; margin: -2px; padding: 2px; }
table.data-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
table.data-table th {
  text-align: left; background: var(--blue-50); color: var(--blue-700);
  padding: 11px 14px; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
table.data-table th:first-child { border-top-left-radius: 10px; }
table.data-table th:last-child { border-top-right-radius: 10px; }
table.data-table td {
  padding: 13px 14px; border-bottom: 1px solid var(--border); vertical-align: middle;
}
table.data-table tbody tr { transition: background .12s ease; }
table.data-table tbody tr:last-child td { border-bottom: none; }
table.data-table tr:hover td { background: var(--blue-50); }
table.data-table .muted-cell { color: var(--muted); font-size: 12.5px; }

/* ADDED: "Media" column on the admin All Reports table (admin/reports.php)
   — small clickable thumbnails for any submitted photo(s), plus a little
   pill badge when a video was submitted, so admins can tell at a glance
   which reports have attachments without opening each one. */
.media-cell-link { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; text-decoration: none; }
.media-thumb {
  /* FIX (admin "All Reports" table): the thumbnail's actual pixel dimensions
     (e.g. a large square property logo image) were rendering at full size
     because nothing constrained max-width/max-height — width/height alone
     only set the *intrinsic* box when unconstrained by content. Locking
     both width AND max-width/max-height (with !important so a stray inline
     size attribute or looser rule can't reopen the bug) plus flex-shrink:0
     keeps every thumbnail a fixed 36x36 tile no matter the source image's
     real size. */
  width: 36px !important; height: 36px !important;
  max-width: 36px !important; max-height: 36px !important;
  min-width: 36px; min-height: 36px;
  flex-shrink: 0;
  object-fit: cover;
  border-radius: 6px;
  border: 1.5px solid var(--border);
  display: block;
}
.media-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11.5px; font-weight: 600;
  color: var(--blue-600);
  background: var(--blue-50);
  border: 1px solid var(--blue-100);
  border-radius: 20px;
  padding: 3px 8px;
}
.media-badge svg { width: 12px; height: 12px; }

/* Rows that open a detail page on click (data-href, wired up in script.js) —
   used so a whole "Recent Reports" row opens its ticket without needing a
   separate View button/column. */
table.data-table tbody tr.row-link { cursor: pointer; }
table.data-table tbody tr.row-link td:first-child { color: var(--blue-600); }

/* ---------- BADGES ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 4px 11px; border-radius: 20px;
  font-size: 11.5px; font-weight: 700; white-space: nowrap;
}
.badge::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex-shrink: 0;
}
.st-pending   { background: var(--gray-bg); color: var(--gray); }
.st-assigned  { background: var(--blue-100); color: var(--blue-700); }
.st-progress  { background: color-mix(in srgb, var(--blue-400) 22%, var(--blue-50)); color: var(--blue-600); }
.st-reassigned { background: #efe6fb; color: #6b2fb3; }
.st-hold      { background: var(--amber-bg); color: var(--amber); }
/* Done is deliberately a solid, unambiguous green pill (not just a tint)
   so a completed report is instantly recognizable at a glance in any table. */
.st-done      { background: var(--green-solid); color: #fff; box-shadow: 0 2px 8px rgba(0,168,59,0.35); }
.st-done::before { background: #fff; }
.st-cannot    { background: var(--red-bg); color: var(--red); }
.st-cancelled { background: var(--gray-bg); color: var(--gray); }

.pr-low    { background: var(--gray-bg); color: var(--gray); }
.pr-medium { background: var(--blue-100); color: var(--blue-700); }
.pr-high   { background: var(--amber-bg); color: var(--amber); }
.pr-urgent { background: var(--red-bg); color: var(--red); animation: pulseDot 1.8s ease-in-out infinite; }

.type-chip { background: var(--blue-50); color: var(--blue-700); border: 1px solid var(--blue-200); }

/* ---------- FILTER BAR ---------- */
.filter-bar {
  display: flex; flex-wrap: wrap; gap: 12px; align-items: end; margin-bottom: 18px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow-xs);
}
.filter-bar .fitem { min-width: 150px; }
.filter-bar label { margin: 0 0 5px; font-size: 12px; }
.filter-bar select, .filter-bar input { padding: 9px 11px; font-size: 13px; }

/* Quick client-side table search */
.table-search { position: relative; margin-bottom: 14px; max-width: 320px; }
.table-search .icon-svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--muted); }
.table-search input { padding-left: 36px; }

/* ---------- TIMELINE ---------- */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li {
  position: relative; padding: 0 0 20px 26px; border-left: 2px solid var(--blue-100);
}
.timeline li:last-child { border-color: transparent; padding-bottom: 0; }
.timeline li::before {
  content: ''; position: absolute; left: -7px; top: 2px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--blue-400); border: 2px solid var(--surface); box-shadow: 0 0 0 2px var(--blue-200);
}
.timeline .t-action { font-weight: 700; font-size: 13.5px; color: var(--ink); }
.timeline .t-meta { font-size: 12px; color: var(--muted); margin: 2px 0 4px; }
.timeline .t-notes { font-size: 13px; color: var(--ink); background: var(--blue-50); padding: 9px 12px; border-radius: 10px; }

/* ---------- MISC ---------- */
.report-photo { width: 100%; max-width: 320px; border-radius: var(--radius-sm); border: 1px solid var(--border); }
.report-video { width: 100%; max-width: 420px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: #000; }
/* ADDED ("make sure video will be displayed too"): wraps render_report_video()'s
   output (includes/functions.php). The video itself always has a black
   background regardless of theme (it's a media surface, not page chrome),
   but the fallback text INSIDE <video>...</video> (shown only if the
   browser truly can't decode the file) and the "open in new tab" link
   below it both need to stay readable in dark mode, so those use the
   theme variables like everything else on the page. */
.video-wrap { max-width: 420px; }
.report-video { color: var(--ink); background: #000; }
.video-open-link {
  display: inline-flex; align-items: center; gap: 5px;
  margin-top: 6px; font-size: 12.5px; color: var(--blue-600);
}
:root[data-theme="dark"] .video-open-link { color: var(--blue-300); }
.video-open-link:hover { text-decoration: underline; }
.video-open-link svg { width: 13px; height: 13px; }

/* Company logo wherever it substitutes for the generic building icon
   inside a property folder card (Properties page / Browse-by-Property). */
.folder-icon img.company-logo-img,
.folder-icon-sm img.company-logo-img {
  width: 100%; height: 100%; object-fit: contain; border-radius: inherit; padding: 15%;
}
/* ADDED (per-property logo now shown on every property card, not just
   the generic company logo — see property_logo_img() in
   includes/functions.php): the same "fill the card's icon box" sizing
   as the company-logo-img rule just above, applied to a per-property
   logo/fallback-icon wherever it sits inside a folder-style card. */
.folder-icon .property-logo,
.folder-icon-sm .property-logo {
  width: 100%; height: 100%; border-radius: inherit;
}
.folder-icon .property-logo.property-logo-photo,
.folder-icon-sm .property-logo.property-logo-photo {
  object-fit: contain; padding: 15%; background: none;
}
.chip-group { display: flex; gap: 8px; flex-wrap: wrap; }
.empty-state { text-align: center; padding: 56px 20px; color: var(--muted); animation: fadeIn .4s ease both; }
.empty-state .icon {
  width: 60px; height: 60px; margin: 0 auto 16px;
  border-radius: 50%; background: var(--blue-50); color: var(--blue-300);
  display: flex; align-items: center; justify-content: center;
}
.empty-state .icon .icon-svg { width: 26px; height: 26px; }
/* PILL COUNT: Small badge for displaying counts
   Light mode: Blue background with white text
   Dark mode: Lighter blue for better visibility */
.pill-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 20px;
  background: var(--blue-500); color: #fff; font-size: 11px; font-weight: 700;
  transition: background-color 0.2s ease, color 0.2s ease;
}

/* DARK MODE: Enhanced colors for pill-count */
:root[data-theme="dark"] .pill-count {
  background: var(--blue-300);
  color: var(--blue-900);
}
.text-right { text-align: right; }
.mt-0 { margin-top: 0; }
.small { font-size: 12.5px; color: var(--muted); }
hr.divider { border: none; border-top: 1px solid var(--border); margin: 18px 0; }

.property-tag {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--blue-50); border: 1px solid var(--blue-200);
  color: var(--blue-700); font-size: 11.5px; font-weight: 600;
  padding: 3px 10px; border-radius: 20px;
}
/* ADDED: the property-tag pill (report detail pages, every role) now
   shows that property's real logo instead of a generic building icon —
   sized to match the other small icons already used in this pill. */
.property-tag .property-logo {
  width: 15px; height: 15px; border-radius: 4px; background: none; color: inherit;
}
.property-tag .property-logo svg { width: 100%; height: 100%; }
.property-tag .property-logo.property-logo-photo { object-fit: contain; background: #fff; }

/* ---------- SPINNER / SKELETON ---------- */
.spinner {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.4); border-top-color: #fff;
  animation: spin .7s linear infinite; display: inline-block;
}
.skeleton {
  background: linear-gradient(90deg, var(--blue-50) 25%, var(--blue-100) 37%, var(--blue-50) 63%);
  background-size: 400px 100%;
  animation: shimmer 1.4s ease-in-out infinite;
  border-radius: 8px;
}
.sidebar-overlay {
  display: none; position: fixed; inset: 0; background: rgba(7,26,59,0.55); z-index: 40;
  animation: fadeIn .2s ease both;
}

html, body { overflow-x: hidden; }

/* ---------- RESPONSIVE: TABLET & MOBILE ----------
   Sidebar becomes an off-canvas drawer (toggled by the hamburger button)
   on anything narrower than a small laptop, so tablets in portrait don't
   get squeezed by a persistent 260px rail eating into content width. */
@media (max-width: 1024px) {
  .menu-toggle { display: inline-flex; }
  .sidebar {
    position: fixed; left: -280px; top: 0; z-index: 50;
    width: min(280px, 82vw);
    height: 100vh;
    box-shadow: none;
  }
  .sidebar.open { left: 0; box-shadow: 8px 0 30px rgba(0,0,0,0.35); }
  .sidebar.open ~ .sidebar-overlay,
  .sidebar-overlay.open { display: block; }
  .content { padding: 22px; }
  .stat-grid { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
}

/* Login cover: below desktop width (this covers tablets, including
   portrait iPad Pro at 1032px) the card recenters on both axes instead
   of hugging the right edge, and the banner's blank navy field is no
   longer guaranteed to land under it, so a darker scrim goes behind the
   card for contrast against whatever part of the photo shows there. The
   desktop "locked to one screen, never scrolls" behavior is switched off
   here too — a tablet or phone may need to scroll to the Sign In button
   (keyboard open, short landscape height, etc.), and clamp()'d sizes
   would otherwise get squeezed too small trying to force-fit one screen. */
@media (max-width: 1080px) {
  html.login-page, body.login-page { height: auto; overflow: visible; }
  .login-wrap {
    height: auto; min-height: 100vh;
    align-items: center; justify-content: center;
    padding: 24px;
  }
  .login-panel { max-width: 460px; }
  .login-card { max-width: 100%; max-height: none; padding: 44px 36px 38px; background: rgba(6,16,38,.62); }
}

/* Tablet: comfortable two-column stat grid, slightly tighter spacing */
@media (max-width: 900px) and (min-width: 601px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}

/* Phone & tablet: turn every data-table into a stack of labeled
   cards instead of a horizontally-scrolling table. This is what keeps
   column headers (Ticket #, Property, Status, etc.) fully readable on
   small AND medium screens — nothing gets clipped, cut off, or hidden
   behind a scrollbar (this used to only kick in below 760px, which left
   tablets in between doing an awkward horizontal scroll that cropped the
   header row — bumped to 1024px so every tablet breakpoint that already
   collapses the sidebar also gets the full-header card layout). Each
   <td> shows its own column header (from data-label, set by script.js)
   as a small caption above its value. */
@media (max-width: 1024px) {
  .table-wrap { margin: 0; padding: 0; -webkit-overflow-scrolling: touch; }
  .table-wrap:has(> table.data-table) { overflow-x: visible; }
  table.data-table, table.data-table tbody, table.data-table tr, table.data-table td {
    display: block; width: 100%;
  }
  table.data-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  table.data-table tbody tr {
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 12px;
    padding: 6px 4px;
    box-shadow: var(--shadow-xs);
  }
  table.data-table tbody tr:hover td { background: transparent; }
  table.data-table td {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    text-align: right;
    padding: 9px 12px;
    border-bottom: 1px dashed var(--border);
  }
  table.data-table td:last-child { border-bottom: none; }
  table.data-table td[data-label]::before {
    content: attr(data-label);
    font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
    color: var(--muted); text-align: left; padding-right: 10px; flex-shrink: 0;
  }
  /* Only hide cells that are truly empty. Cells under a blank column header
     (Edit / Delete / Reset buttons, avatars) MUST stay visible on tablet &
     phone — they used to be hidden here, which is why action buttons
     vanished on smaller viewports. */
  table.data-table td:empty { display: none; }
  table.data-table td[data-label=""]:not(:empty) {
    display: flex; justify-content: flex-start; text-align: left; flex-wrap: wrap; gap: 8px;
  }
}

/* ---------- CLICKABLE ROWS: desktop = whole row, tablet/phone = button ----------
   Desktop (>1024px): every ticket row is clickable (tr.row-link, see
   initRowLinks in script.js) and the separate View/Open button column is
   hidden. Tablet & phone (<=1024px): rows turn into cards, and the
   "View Ticket" button comes back at the bottom of each card, with the
   ticket number promoted to a header bar on top of the card. */
table.data-table th.row-action,
table.data-table td.row-action { display: none; }

@media (max-width: 1024px) {
  table.data-table tbody td.row-action,
  table.data-table tbody td.row-action[data-label=""] {
    display: block; text-align: stretch; padding: 10px 12px 8px; border-bottom: none;
  }
  table.data-table td.row-action .btn { display: flex; width: 100%; justify-content: center; padding: 11px 14px; }
  /* Ticket number = card header */
  table.data-table tbody tr { padding: 0 0 4px; overflow: hidden; }
  table.data-table tbody td.cell-ticket {
    display: flex; justify-content: flex-start; text-align: left;
    background: var(--blue-50); border-bottom: 1.5px solid var(--border);
    padding: 12px 14px; margin-bottom: 4px; font-size: 15px;
  }
  table.data-table tbody td.cell-ticket::before { content: none; }
  table.data-table tbody td.cell-ticket strong { color: var(--blue-600); letter-spacing: .01em; }
  table.data-table tbody tr.row-link { cursor: default; }
}
:root[data-theme="dark"] table.data-table tbody td.cell-ticket { background: rgba(255,255,255,.05); }

/* ---------- RESPONSIVE SAFETY NET (every page, every viewport) ----------
   Nothing may be clipped by the page-level overflow-x:hidden, so: long
   words/emails/ticket text wrap, media never exceeds its box, grid/flex
   children are allowed to shrink, and non-card tables scroll inside their
   own wrapper instead of pushing the page wider than the screen. */
img, video, canvas, svg { max-width: 100%; }
img, video { height: auto; }
.panel, .chart-card, .stat-card, .alert, .expense-card, .grid-2 > *, .grid-3 > * { min-width: 0; }
.panel, .alert, table.data-table td, .expense-card, .stat-card .stat-label { overflow-wrap: anywhere; word-break: normal; }
.expense-table, .exp-hist-table { min-width: 460px; }
.table-wrap:has(> .expense-table) { overflow-x: auto; }
.app { height: 100vh; height: 100dvh; }

@media (max-width: 1024px) {
  .panel-head { flex-wrap: wrap; gap: 10px; }
  .topbar-right { gap: 6px; }
  .form-row > div { min-width: min(200px, 100%); }
  .filter-bar { flex-wrap: wrap; }
  .filter-bar .fitem { flex: 1 1 180px; min-width: 0; }
  .chip-group, .action-buttons { flex-wrap: wrap; }
}
@media (max-width: 600px) {
  .btn-row, .form-actions { flex-wrap: wrap; }
  .form-actions .btn { flex: 1 1 140px; justify-content: center; }
  .chart-card .chart-body { max-width: 100%; }
  .expense-table, .exp-hist-table { min-width: 420px; }
}

/* Phone */
@media (max-width: 600px) {
  .content { padding: 16px; }
  .topbar { padding: 12px 14px; }
  .topbar h1 { font-size: 16px; }
  .topbar .user-chip > div:not(.avatar) { display: none; }
  .stat-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-card { padding: 14px; gap: 10px; }
  .stat-card .stat-icon { width: 38px; height: 38px; border-radius: 11px; }
  .stat-card .stat-num { font-size: 21px; }
  .stat-card .stat-label { font-size: 11px; }
  .welcome-banner { padding: 18px; flex-direction: column; align-items: flex-start; }
  .welcome-banner .wb-left { width: 100%; }
  .welcome-banner .wb-actions { width: 100%; }
  .welcome-banner .wb-actions .btn { flex: 1; }
  .panel, .chart-card { padding: 16px; }
  .panel-head { flex-direction: column; align-items: flex-start; }
  .panel-head > *:last-child { width: 100%; }
  .form-row { flex-direction: column; gap: 0; }
  .form-row > div { min-width: 0; }
  /* MOBILE ONLY: the 1024px rule above gives .fitem flex:1 1 180px. When the bar
     stacks into a column that 180px becomes a HEIGHT, which left big empty gaps
     between fields. Size each field to its content and tighten spacing. */
  .filter-bar { flex-direction: row; flex-wrap: wrap; align-items: flex-end; gap: 8px; padding: 12px; margin-bottom: 12px; }
  .filter-bar .fitem { flex: 1 1 100% !important; min-width: 0; margin: 0; }
  .filter-bar .fitem:has(> .btn, > button) { flex: 1 1 120px !important; }
  .filter-bar .fitem > .btn, .filter-bar .fitem > button { width: 100%; justify-content: center; }
  .filter-bar label { margin: 0 0 3px; }
  .login-card { padding: 28px 22px 26px; }
  .demo-box { font-size: 11.5px; }
  table.data-table { font-size: 13px; }
}

/* MOBILE ONLY: notification popup + toasts fit the viewport.
   The bell is not at the right edge on phones (dark-mode toggle + avatar sit
   beside it), so the desktop `right:0` panel could spill off-screen. Anchor the
   panel to the topbar instead and stretch it between 10px side margins. */
@media (max-width: 600px) {
  .topbar { position: relative; }
  .notif-wrap { position: static; }
  #notifToggle { position: relative; } /* keeps the count badge on the bell */
  .notif-panel {
    top: calc(100% + 6px); left: 10px; right: 10px;
    width: auto; max-width: none;
    max-height: calc(100vh - 100px); max-height: calc(100dvh - 100px);
    -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
  }
  .notif-panel-head { padding: 12px 14px; position: sticky; top: 0; background: var(--surface); z-index: 1; }
  .notif-item { padding: 12px 14px; gap: 12px; }
  .notif-item-icon { width: 32px; height: 32px; }
  .notif-item-text { font-size: 13px; overflow-wrap: anywhere; }
  .notif-item-time { font-size: 11.5px; }

  .toast-stack { top: 10px; left: 10px; right: 10px; max-width: none; }
  .toast { font-size: 13px; overflow-wrap: anywhere; }
}

/* Very small phones */
@media (max-width: 380px) {
  .stat-grid { grid-template-columns: 1fr; }
}

/* ---------- PRINT / "DOWNLOAD REPORT" (admin view_report) ----------
   The "Download Report" button calls window.print(); this stylesheet turns
   that into a clean one-page report instead of printing the whole app
   chrome (sidebar, topbar, action forms, timeline buttons, etc). */
/* ===========================================================
   PRINTABLE REPORT FORM ("Download Report" on admin/view_report.php)
   FIX: "Fix the format of the form in print and downloadable file,
   it should be like a form format in paper."
   -----------------------------------------------------------
   .print-sheet is the paper-form layout itself (see the "print-sheet"
   block in admin/view_report.php). It's built once, in normal HTML/CSS,
   and simply hidden on screen — @media print below is what reveals it
   and hides the on-screen dashboard UI (.screen-only, .no-print) in its
   place, so printing (or "Save as PDF") produces a clean, letterheaded,
   boxed-field form instead of a screenshot of the admin dashboard.
   =========================================================== */
.print-sheet { display: none; }

@media print {
  /* FIX ("remove this in the lower left of the downloadable file"): when
     printed / saved as PDF, Chrome adds its own header/footer text (page
     title top-left, URL bottom-left, date top-right, page number
     bottom-right) inside the default print margin. Setting the page
     margin to 0 removes the space that text is drawn in, so it no longer
     shows up on the downloaded file. The padding added on .print-sheet
     below puts a normal-looking margin back on the actual content. */
  @page { margin: 0; }
  body { margin: 0; }

  .sidebar, .sidebar-overlay, .topbar, .toast-stack,
  .no-print, .screen-only, .form-actions, .notif-panel { display: none !important; }
  /* ADDED (fix header layout on the downloadable file): the on-screen
     ticket header (plain-text ticket number + unstyled status/priority)
     was printing above the real letterhead, producing a duplicated,
     messy header on the downloaded PDF — visible in the "third ss".
     It's now scoped as .report-onscreen-head in admin/view_report.php;
     hiding it here leaves only the designed .print-sheet header. */
  .report-onscreen-head { display: none !important; }
  .app, .main, .content { display: block !important; overflow: visible !important; padding: 0 !important; }
  .grid-2 { display: block !important; }
  .panel { box-shadow: none !important; border: none !important; break-inside: avoid; padding: 0 !important; }
  body { background: #fff !important; color: #000 !important; }

  .print-sheet {
    display: block !important;
    font-family: Georgia, 'Times New Roman', serif;
    color: #111;
    max-width: 100%;
    padding: 14mm 14mm 18mm !important;
  }

  /* Letterhead: company name/logo on the left, ticket number + print
     date on the right — like the header block on a real paper form. */
  .print-sheet .ps-head {
    display: flex; justify-content: space-between; align-items: flex-end;
    border-bottom: 3px solid #111; padding-bottom: 10px; margin-bottom: 14px;
  }
  .print-sheet .ps-brand { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 700; }
  .print-sheet .ps-brand img, .print-sheet .ps-brand svg { height: 26px; width: auto; }
  .print-sheet .ps-doc-info { text-align: right; font-size: 11.5px; line-height: 1.5; }
  .print-sheet .ps-doc-title { font-size: 16px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; margin-bottom: 2px; }

  /* ADDED: the Status/Priority pills now included in the print-sheet
     header (see admin/view_report.php .ps-status-line). Right-aligned
     under the ticket/printed-date lines, with the badge's background
     color forced to actually print (browsers strip background colors
     from print by default unless print-color-adjust is set). */
  /* REMOVED: the .ps-status-line markup this rule targeted was taken back
     out of admin/view_report.php (it duplicated the labeled Status/Priority
     row in the ps-fields table below and confused users). Left this rule
     commented out, not deleted, per "just add / don't remove" — it's inert
     either way since no element has the class anymore.
  .print-sheet .ps-status-line { margin-top: 4px; }
  .print-sheet .ps-status-line .badge {
    -webkit-print-color-adjust: exact; print-color-adjust: exact;
    border: 1px solid rgba(0,0,0,0.25);
  }
  */

  /* ADDED (fix the letterhead header on the downloadable/printed report):
     the uploaded company logo (assets/img/logo.*) has "ELTI GROUP INC"
     baked into the image itself, but the rule above shrinks it to a
     26px-tall square, so it printed as an illegible speck next to the
     separate "Elti Group" text. This more specific rule (targets the
     .company-logo-img class the real uploaded logo always has) enlarges
     just that image so the letterhead reads clearly, without touching
     the fallback building icon's size above. */
  .print-sheet .ps-brand img.company-logo-img { height: 44px; width: auto; }

  /* Field grid: bordered cells with a shaded label column, the way a
     printed intake/incident form lays out "Label: ____ value ____". */
  .print-sheet table.ps-fields {
    width: 100%; border-collapse: collapse; margin-bottom: 16px; font-size: 12.5px;
  }
  .print-sheet table.ps-fields th, .print-sheet table.ps-fields td {
    border: 1px solid #111; padding: 6px 9px; text-align: left; vertical-align: top;
  }
  .print-sheet table.ps-fields th {
    width: 15%; background: #eee !important; -webkit-print-color-adjust: exact; print-color-adjust: exact;
    font-weight: 700; white-space: nowrap;
  }
  .print-sheet table.ps-fields td { width: 35%; }

  .print-sheet .ps-section-label {
    font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
    margin: 14px 0 5px;
  }
  /* A ruled box, like the blank writing area on a paper form. */
  .print-sheet .ps-box {
    border: 1px solid #111; padding: 8px 10px; font-size: 12.5px; min-height: 20px;
  }
  .print-sheet .ps-box-lg { min-height: 70px; }

  .print-sheet .ps-photos { display: flex; gap: 14px; margin-top: 4px; }
  .print-sheet .ps-photos figure { margin: 0; text-align: center; }
  .print-sheet .ps-photos img { max-width: 200px; max-height: 200px; border: 1px solid #111; display: block; }
  .print-sheet .ps-photos figcaption { font-size: 10.5px; margin-top: 3px; }

  /* Signature lines at the bottom, like any paper sign-off form. */
  .print-sheet .ps-signatures { display: flex; gap: 24px; margin-top: 40px; }
  .print-sheet .ps-sig { flex: 1; text-align: center; }
  .print-sheet .ps-sig-line { border-top: 1px solid #111; margin-bottom: 4px; height: 34px; }
  .print-sheet .ps-sig-label { font-size: 11px; }
}

/* Itemized materials & expenses (card, print form, maintenance form) */
.expense-table { width:100%; border-collapse:collapse; font-size:13.5px; color:var(--ink); }
.expense-table th, .expense-table td { padding:7px 8px; border-top:1px dashed var(--border); text-align:left; vertical-align:top; }
.expense-table thead th { border-top:none; color:var(--muted); font-size:12px; text-transform:uppercase; letter-spacing:.03em; }
.expense-table tfoot td { border-top:2px solid var(--green-solid); }
.expense-table .amt, .ps-expense-table .amt { text-align:right; white-space:nowrap; }
.expense-input-row { display:grid; grid-template-columns:2fr 1fr; gap:8px; margin-bottom:8px; }
.ps-expense-table { width:100%; border-collapse:collapse; margin-bottom:8px; font-size:13px; }
.ps-expense-table th, .ps-expense-table td { border:1px solid #333; padding:6px 8px; text-align:left; color:#111; }
.ps-expense-table th { background:#eee; }
.ps-expense-table td:first-child, .ps-expense-table th:first-child { width:36px; text-align:center; }

/* PRINT: the phone/tablet stacked-card table layout (max-width:1024px) also matched a narrow
   print preview, so printed tables came out as stacked label/value cards. Force real tables. */
@media print {
  .table-wrap { overflow: visible !important; }
  table.data-table { display: table !important; width: 100% !important; border-collapse: collapse; }
  table.data-table thead { display: table-header-group !important; position: static !important; width: auto !important; height: auto !important; overflow: visible !important; clip: auto !important; }
  table.data-table tbody { display: table-row-group !important; width: auto !important; }
  table.data-table tr { display: table-row !important; width: auto !important; border: none !important; border-radius: 0 !important; margin: 0 !important; padding: 0 !important; box-shadow: none !important; background: none !important; break-inside: avoid; }
  table.data-table th, table.data-table td { display: table-cell !important; width: auto !important; text-align: left !important; vertical-align: top; }
  table.data-table td[data-label]::before { content: none !important; }
  table.data-table td:empty, table.data-table td[data-label=""] { display: table-cell !important; }
  table.data-table td.no-print, table.data-table th.no-print { display: none !important; }
}

/* Itemized "material .... price" list used on the Expenses pages */
.exp-items { list-style: none; margin: 0; padding: 0; min-width: 180px; }
.exp-items li { display: flex; justify-content: space-between; gap: 14px; padding: 2px 0; border-bottom: 1px dotted var(--border); }
.exp-items li:last-child { border-bottom: none; }
.exp-items b { white-space: nowrap; }

/* Property placeholder icons (assets/img/properties) + logo-with-name chip used across pages */
.property-logo.property-logo-placeholder { object-fit: contain; background: #fff; padding: 3px; }
.folder-icon .property-logo.property-logo-placeholder,
.folder-icon-sm .property-logo.property-logo-placeholder { object-fit: contain; padding: 10%; background: none; }
.property-chip { display: inline-flex; align-items: center; gap: 8px; vertical-align: middle; }
.property-chip .property-chip-logo { width: 22px; height: 22px; border-radius: 5px; padding: 1px; }
.eg-property-initial .property-logo.property-logo-placeholder { padding: 2px; }

/* ---------- Editable expenses (maintenance edit-until-submitted, admin edit) ----------
   Rows show text (.exp-view) until Edit is clicked, then swap to inputs
   (.exp-edit) via the .editing class toggled in render_materials_expenses_card(). */
.expense-card-head > span.expense-card-state { margin-left: auto; font-size: inherit; font-weight: inherit; color: inherit; }
.expense-table .exp-edit { display: none; }
.expense-table tr.editing .exp-view { display: none; }
.expense-table tr.editing input.exp-edit { display: block; width: 100%; min-width: 90px; padding: 7px 9px; }
.expense-table tr.editing span.exp-edit { display: inline-flex; gap: 6px; }
.expense-table td.amt input.exp-edit { text-align: right; max-width: 130px; margin-left: auto; }
.expense-table .exp-actions { text-align: right; white-space: nowrap; }
.expense-table .exp-actions .exp-view { display: inline-flex; gap: 6px; }
.expense-table tr.editing .exp-actions .exp-view { display: none; }
.expense-table tr.editing { background: color-mix(in srgb, var(--green-solid) 8%, transparent); }
.expense-submit { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--border); }
.expense-note { display: flex; align-items: center; gap: 8px; margin: 12px 0 0; padding-top: 12px; border-top: 1px dashed var(--border); font-size: 13px; color: var(--muted); }
.expense-note svg { width: 15px; height: 15px; flex-shrink: 0; }
.badge svg { width: 12px; height: 12px; flex-shrink: 0; }

/* ---------- Expense edit history (admin audit panel) ---------- */
.expense-history { margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--border); }
.expense-history > summary { display: flex; align-items: center; gap: 10px; cursor: pointer; list-style: none; font-size: 14px; color: var(--ink); }
.expense-history > summary::-webkit-details-marker { display: none; }
.expense-history > summary::before { content: '\25B8'; color: var(--muted); transition: transform .15s; }
.expense-history[open] > summary::before { transform: rotate(90deg); }
.exp-hist-table td, .exp-hist-table th { font-size: 12.5px; }
.exp-hist-table tr.exp-hist-flag td { background: var(--red-bg); }
.exp-hist-table .badge { margin: 1px 2px 1px 0; }


/* ---- Receipts (maintenance upload; admin print switch) ---- */
.receipt-card { border: 1.5px solid var(--border); background: var(--surface); border-radius: var(--radius-sm); padding: 14px 16px; margin: 14px 0; }
.receipt-card-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-weight: 800; font-size: 14px; color: var(--ink); margin-bottom: 10px; }
.receipt-card-head > span { font-weight: 500; font-size: 12px; color: var(--muted); }
.receipt-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin-bottom: 12px; }
.receipt-item { border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.receipt-thumb { display: flex; align-items: center; justify-content: center; height: 180px; background: rgba(128,128,128,.12); }
.receipt-thumb img { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; }
.receipt-pdf { font-weight: 800; letter-spacing: 1px; color: var(--muted); border: 2px solid var(--muted); border-radius: 6px; padding: 6px 12px; }
.receipt-meta { padding: 8px 10px; font-size: 12.5px; color: var(--ink); display: flex; flex-direction: column; gap: 2px; }
.receipt-meta > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.receipt-meta small { color: var(--muted); }
.receipt-print-toggle { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 8px 0 0; padding-top: 10px; border-top: 1px dashed var(--border); }
.receipt-upload input[type=file] { width: 100%; }
@media print {
  /* Each photo receipt prints on its own page, full width, uncropped. */
  .print-sheet .ps-receipt-page {
    break-before: page; page-break-before: always;
    break-inside: avoid; page-break-inside: avoid;
    padding: 14mm 0 0; text-align: center;
  }
  .print-sheet .ps-receipt-page .ps-section-label { text-align: left; margin-top: 0; }
  .print-sheet .ps-receipt-page img {
    display: block; margin: 6px auto 0;
    width: auto; height: auto; max-width: 100%; max-height: 225mm;
    object-fit: contain; border: 1px solid #111;
  }
}

/* ---- Print: allow the report to run onto more than one page ----
   Root cause of receipts being cut off: on screen the app is locked to one
   viewport (.app { height:100vh; overflow:hidden }, .main { height:100% }).
   The print rules only reset overflow/display, so everything past the first
   page was clipped. Height is now released too, the panel may break across
   pages, and the fade-in animation/transform is switched off (a transformed
   ancestor also breaks pagination in Chrome). */
@media print {
  html, body { height: auto !important; min-height: 0 !important; overflow: visible !important; }
  .app, .main, .content { height: auto !important; min-height: 0 !important; max-height: none !important; overflow: visible !important; position: static !important; }
  .content, .panel, .grid-2, .grid-2 > div { animation: none !important; transform: none !important; opacity: 1 !important; }
  .panel { break-inside: auto !important; page-break-inside: auto !important; margin: 0 !important; }
  .print-sheet { overflow: visible !important; }

  /* Receipts: always start on a fresh page; the receipt fills the page. */
  .print-sheet .ps-receipt-page {
    display: block !important;
    break-before: page !important; page-break-before: always !important;
    break-after: auto; break-inside: avoid !important; page-break-inside: avoid !important;
    height: 250mm; padding: 14mm 14mm 0 !important; margin: 0 -14mm; text-align: center; overflow: hidden;
  }
  .print-sheet .ps-receipt-page img {
    display: block; margin: 8px auto 0 !important;
    width: auto !important; height: auto !important;
    max-width: 100% !important; max-height: 225mm !important; object-fit: contain !important;
  }
}

@media print { table.data-table th.row-action, table.data-table td.row-action { display: none !important; } }

/* Admin dashboard "By Property" / "Urgent" tables (.eg-table) -> labeled cards
   on tablet & phone, same idea as table.data-table (labels set in script.js). */
@media (max-width: 1024px) {
  .eg-table-wrap { overflow-x: visible; padding: 0 12px 12px; }
  table.eg-table, table.eg-table tbody, table.eg-table tr, table.eg-table td { display: block; width: 100%; }
  table.eg-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  table.eg-table tbody tr {
    background: var(--surface); border: 1.5px solid var(--border); border-radius: var(--radius-sm);
    margin: 0 0 12px; padding: 6px 4px; overflow: hidden;
  }
  table.eg-table tbody td {
    display: flex; align-items: center; justify-content: space-between; gap: 12px; text-align: right;
    padding: 9px 12px !important; border-bottom: 1px dashed var(--border) !important;
    overflow-wrap: anywhere;
  }
  table.eg-table tbody td:last-child { border-bottom: none !important; }
  table.eg-table tbody td[data-label]::before {
    content: attr(data-label); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
    color: var(--muted); text-align: left; flex-shrink: 0;
  }
  table.eg-table tbody td[data-label=""] { justify-content: stretch; }
  table.eg-table tbody td[data-label=""] .btn { width: 100%; justify-content: center; padding: 11px 14px; }
  table.eg-table tbody td:empty { display: none; }
}

/* Admin dashboard donut + legend: stack under each other when the card is narrow */
@media (max-width: 600px) { .eg-donut-wrap { flex-wrap: wrap; justify-content: center; } .eg-donut-legend { min-width: 0; width: 100%; } }

/* ---------- CHARTS: never wider than their card ---------- */
.chart-card { max-width: 100%; overflow: hidden; }
.chart-card .chart-body { min-width: 0; }
.chart-card .chart-body canvas { max-width: 100% !important; }
@media (max-width: 600px) {
  .chart-card .chart-body.chart-body-fluid { height: 260px !important; }
  .chart-legend-row { gap: 8px 12px; font-size: 12px; }
}

/* ---------- ROLE HEADER (.rh) — same hero as the Admin dashboard, tinted per role ---------- */
.rh {
  --rh-a: var(--blue-900); --rh-b: var(--blue-700); --rh-c: var(--blue-600);   /* same gradient as the Admin header */
  --rh-accent1: var(--blue-400); --rh-accent2: var(--blue-300);        /* name highlight + eyebrow (same as Admin) */
  --rh-glow: rgba(59,130,246,.22);
  position: relative; overflow: hidden; margin-bottom: 1.5rem; border-radius: 20px;
  background: linear-gradient(135deg, var(--rh-a) 0%, var(--rh-b) 55%, var(--rh-c) 100%);
  box-shadow: 0 20px 45px -18px rgba(15,30,61,.55);
  animation: fadeInUp .5s var(--ease) both; color: #fff;
}
.rh::before { content:''; position:absolute; top:-55%; right:-5%; width:420px; height:420px; max-width:80vw; max-height:80vw;
  background: radial-gradient(circle, var(--rh-glow) 0%, transparent 70%); border-radius:50%; pointer-events:none; }
.rh::after { content:''; position:absolute; bottom:-70%; left:5%; width:300px; height:300px; max-width:70vw; max-height:70vw;
  background: radial-gradient(circle, rgba(255,255,255,.05) 0%, transparent 70%); border-radius:50%; pointer-events:none; }

.rh-strip { position:relative; z-index:2; display:flex; align-items:center; justify-content:space-between; gap:1rem; flex-wrap:wrap; padding:.9rem 1.6rem; min-height:68px; }
.rh-brand { display:flex; align-items:center; gap:.75rem; min-width:0; }
.rh-brand-icon { width:40px; height:40px; border-radius:12px; flex-shrink:0; display:flex; align-items:center; justify-content:center; color:#fff;
  background: linear-gradient(135deg, rgba(255,255,255,.28), rgba(255,255,255,.1)); box-shadow: 0 8px 14px -6px rgba(0,0,0,.4), inset 0 0 0 1px rgba(255,255,255,.22); transition: transform .3s ease; }
.rh-brand:hover .rh-brand-icon { transform: rotate(-8deg) scale(1.05); }
.rh-brand-icon .icon-svg { width:21px; height:21px; }
.rh-brand-text { line-height:1.15; min-width:0; }
.rh-brand-text .name { font-size:1rem; font-weight:800; color:#fff; letter-spacing:-.01em; }
.rh-brand-text .sub { font-size:.7rem; color:rgba(255,255,255,.7); font-weight:500; letter-spacing:.02em; }
.rh-role-pill { font-size:.68rem; font-weight:800; letter-spacing:.1em; text-transform:uppercase; color:#fff; padding:6px 12px; border-radius:999px;
  background: rgba(255,255,255,.12); border:1px solid rgba(255,255,255,.2); }
.rh-role-pill:empty { display:none; }

.rh-body { position:relative; z-index:2; display:flex; align-items:center; justify-content:space-between; gap:1.5rem 2rem; flex-wrap:wrap; padding:1.6rem 2rem 1.9rem; }
.rh-welcome { flex: 1 1 420px; min-width:0; }
.rh-eyebrow { display:inline-flex; align-items:center; gap:.45rem; font-size:.7rem; font-weight:700; letter-spacing:.1em; text-transform:uppercase; color:var(--rh-accent2); margin-bottom:.7rem; }
.rh-dot { width:7px; height:7px; border-radius:50%; background:var(--rh-accent1); animation: egPulse 2s ease-in-out infinite; }
@keyframes egPulse { 0%,100% { opacity:1; } 50% { opacity:.4; } }
.rh h1 { font-size:2rem; font-weight:800; color:#fff; letter-spacing:-.025em; margin:0 0 .5rem; line-height:1.15; overflow-wrap:anywhere; }
.rh h1 .accent { background: linear-gradient(135deg, var(--rh-accent1), var(--rh-accent2)); -webkit-background-clip:text; background-clip:text; -webkit-text-fill-color:transparent; }
.rh-welcome p { color:rgba(255,255,255,.75); font-size:.92rem; margin:0 0 1.2rem; max-width:520px; line-height:1.5; }
.rh-welcome p strong { color:#fff; }
.rh-chips { display:flex; flex-wrap:wrap; gap:.6rem; align-items:center; }
.rh-chip { display:inline-flex; align-items:center; gap:.5rem; min-height:38px; padding:0 1.1rem; border-radius:40px; color:#fff; font-size:.78rem; font-weight:600; line-height:1.2;
  background: rgba(255,255,255,.08); border:1px solid rgba(255,255,255,.14); backdrop-filter: blur(6px); }
.rh-chip .icon-svg { width:15px; height:15px; opacity:.75; flex-shrink:0; }

/* Action bar under the banner — matches the Admin dashboard (.eg-actions / .eg-btn-primary) */
.rh-actionbar { display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:1rem; margin:-.5rem 0 1.5rem; }
.rh-actionbar-left:empty { display:none; }
.rh-actionbar-left h2 { font-size:1.25rem; font-weight:700; color:var(--ink); margin:0; letter-spacing:-.01em; }
.rh-actionbar-left p { color:var(--muted); font-size:.85rem; margin:.2rem 0 0; }
.rh-actions { display:flex; flex-wrap:wrap; gap:.5rem; align-items:center; margin-left:auto; }
.rh-btn { display:inline-flex; align-items:center; justify-content:center; gap:.5rem; height:40px; padding:0 1.4rem; border-radius:10px; font-size:.83rem; font-weight:600; line-height:1; white-space:nowrap;
  background:var(--blue-600); color:#fff; border:none; text-decoration:none !important; box-shadow:0 10px 18px -8px rgba(30,64,175,.5); transition:all .2s ease; }
.rh-btn:hover { background:var(--blue-700); color:#fff; transform:translateY(-2px); }
.rh-btn .icon-svg { width:16px; height:16px; }

@media (max-width: 900px) {
  .rh-body { padding:1.4rem 1.5rem 1.6rem; }
  .rh h1 { font-size:1.6rem; }
  .rh-actions { margin-left:0; }
}
@media (max-width: 600px) {
  .rh { border-radius:16px; margin-bottom:1.1rem; }
  .rh-strip { padding:.8rem 1rem; min-height:0; }
  .rh-body { padding:1.1rem 1.1rem 1.3rem; gap:1rem; }
  .rh h1 { font-size:1.4rem; }
  .rh-welcome { flex-basis:100%; }
  .rh-welcome p { font-size:.85rem; margin-bottom:1rem; }
  .rh-chip { padding:0 .85rem; min-height:34px; font-size:.74rem; }
  /* MINIMIZED quick-action buttons on phones: compact pills that sit side by
     side (they used to be one full-width 40px bar each, stacked). */
  .rh-actionbar { gap:.6rem; margin:-.25rem 0 1rem; }
  .rh-actionbar-left h2 { font-size:1.05rem; }
  .rh-actionbar-left p { font-size:.78rem; margin-top:.1rem; }
  .rh-actions { width:100%; gap:.4rem; }
  .rh-btn { flex:1 1 auto; height:34px; padding:0 .75rem; gap:.35rem; font-size:.74rem; border-radius:9px; box-shadow:0 6px 12px -8px rgba(30,64,175,.5); }
  .rh-btn .icon-svg { width:14px; height:14px; }
}
@media (max-width: 380px) {
  .rh-btn { padding:0 .55rem; font-size:.7rem; }
}
@media (prefers-reduced-motion: reduce) { .rh, .rh-dot { animation:none; } }
@media print { .rh, .rh-actionbar { display:none !important; } }

/* ---------- Image viewer (lightbox) ---------- */
.img-viewer {
  position: fixed; inset: 0; z-index: 2000;
  display: none; align-items: center; justify-content: center;
  background: rgba(8, 14, 28, 0.88); padding: 56px 12px 16px;
}
.img-viewer.open { display: flex; }
.img-viewer-img {
  max-width: 100%; max-height: 100%; object-fit: contain;
  border-radius: 8px; box-shadow: 0 10px 40px rgba(0,0,0,.5); background: #fff;
}
.img-viewer-close {
  position: absolute; top: calc(10px + env(safe-area-inset-top, 0px)); right: 12px;
  width: 40px; height: 40px; border-radius: 50%; border: 0;
  background: rgba(255,255,255,.95); color: #1b2a4a;
  font-size: 28px; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.img-viewer-close:hover { background: #fff; }
/* Name shown under a status badge (status_badge_named) */
.status-name { margin-top: 4px; font-size: 12px; font-weight: 600; color: var(--muted); line-height: 1.3; }
