/* ============================================================================
   HCON-flow — Design System v3  (2026-09)
   One stylesheet for both portals. Loaded after Bootstrap 5.3 on every page.

   Sections
     0. Fonts (self-hosted Inter, Greek + Latin)
     1. Design tokens
     2. Bootstrap variable overrides
     3. Base
     4. Components (buttons, forms, cards, tables, badges, alerts, modals …)
     5. Office layout (sidebar, topbar, mobile header, stat tiles, filters, lists)
     6. Live-update animations (class names are used by the pollers — keep)
     7. Field portal (senior-friendly: 17px base, 48-56px targets, high contrast)
     8. Field card compatibility (.task-card/.log-card/… still rendered by pollers)
     9. TV mode
    10. Print (A4 case view)
   ========================================================================== */

/* ---------- 0. Fonts ------------------------------------------------------ */
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url('/assets/fonts/inter-greek-ext.woff2') format('woff2'); unicode-range: U+1F00-1FFF; }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url('/assets/fonts/inter-greek.woff2') format('woff2');
  unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF; }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url('/assets/fonts/inter-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url('/assets/fonts/inter-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

/* ---------- 1. Tokens ----------------------------------------------------- */
:root {
  /* Brand */
  --brand:        #CF1820;   /* text-safe brand red (logo red is #ED1C24) */
  --brand-hover:  #B0141B;
  --brand-active: #93111A;
  --brand-tint:   #FDECEC;
  --brand-line:   #ED1C24;   /* thin accent lines only */

  /* Neutrals */
  --ink:      #111827;
  --text:     #1F2937;
  --muted:    #6B7280;
  --faint:    #9CA3AF;
  --bg:       #F4F5F7;
  --surface:  #FFFFFF;
  --subtle:   #F9FAFB;
  --hover:    #F3F4F6;
  --border:   #E5E7EB;
  --border-2: #D1D5DB;

  /* Semantic (text / background / border) */
  --ok:       #15803D; --ok-bg:   #DCFCE7; --ok-bd:   #86EFAC;
  --warn:     #B45309; --warn-bg: #FEF3C7; --warn-bd: #FCD34D;
  --info:     #0369A1; --info-bg: #E0F2FE; --info-bd: #7DD3FC;
  --bad:      #B91C1C; --bad-bg:  #FEE2E2; --bad-bd:  #FCA5A5;
  --vio:      #6D28D9; --vio-bg:  #EDE9FE; --vio-bd:  #C4B5FD;
  --neu:      #374151; --neu-bg:  #F3F4F6; --neu-bd:  #D1D5DB;

  /* Shape & depth */
  --r-sm: 6px; --r: 10px; --r-lg: 14px; --r-pill: 999px;
  --shadow-1: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .04);
  --shadow-2: 0 4px 12px rgba(16, 24, 40, .08);
  --shadow-up: 0 -4px 16px rgba(16, 24, 40, .08);
  --ring: 0 0 0 3px rgba(207, 24, 32, .18);

  /* Layout */
  --sidebar-bg: #0F1419;
  --sidebar-line: rgba(255, 255, 255, .08);
  --nav-h: 64px;

  /* Legacy names still referenced by inline page styles */
  --primary-red: var(--brand);
  --dark-red: var(--brand-hover);
  --light-red: #E5323B;
  --hcon-red: var(--brand);
  --hcon-black: var(--ink);
  --black: var(--ink);
  --dark-gray: #2C2C2C;
  --light-gray: var(--bg);
  --white: #FFFFFF;
}

/* ---------- 2. Bootstrap overrides ---------------------------------------- */
:root {
  --bs-body-font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --bs-body-font-size: .9375rem;
  --bs-body-line-height: 1.5;
  --bs-body-color: var(--text);
  --bs-body-bg: var(--bg);
  --bs-heading-color: var(--ink);
  --bs-primary: var(--brand);
  --bs-primary-rgb: 207, 24, 32;
  --bs-secondary: var(--muted);
  --bs-secondary-rgb: 107, 114, 128;
  --bs-success: #16A34A; --bs-success-rgb: 22, 163, 74;
  --bs-info: #0284C7;    --bs-info-rgb: 2, 132, 199;
  --bs-warning: #D97706; --bs-warning-rgb: 217, 119, 6;
  --bs-danger: #DC2626;  --bs-danger-rgb: 220, 38, 38;
  --bs-dark: var(--ink); --bs-dark-rgb: 17, 24, 39;
  --bs-light: var(--subtle); --bs-light-rgb: 249, 250, 251;
  --bs-border-color: var(--border);
  --bs-border-radius: .5rem;
  --bs-border-radius-sm: .375rem;
  --bs-border-radius-lg: .75rem;
  --bs-border-radius-xl: 1rem;
  --bs-link-color: var(--brand);
  --bs-link-color-rgb: 207, 24, 32;
  --bs-link-hover-color: var(--brand-hover);
  --bs-link-hover-color-rgb: 176, 20, 27;
  --bs-secondary-color: var(--muted);
  --bs-tertiary-color: var(--faint);
  --bs-secondary-bg: var(--subtle);
  --bs-tertiary-bg: var(--hover);
  --bs-emphasis-color: var(--ink);
  --bs-box-shadow-sm: var(--shadow-1);
  --bs-box-shadow: var(--shadow-2);
  --bs-focus-ring-color: rgba(207, 24, 32, .18);
}

/* Bootstrap hard-codes its blue in several components — repoint them. */
.btn-primary { --bs-btn-bg: var(--brand); --bs-btn-border-color: var(--brand); --bs-btn-hover-bg: var(--brand-hover); --bs-btn-hover-border-color: var(--brand-hover); --bs-btn-active-bg: var(--brand-active); --bs-btn-active-border-color: var(--brand-active); --bs-btn-disabled-bg: #E79A9E; --bs-btn-disabled-border-color: #E79A9E; --bs-btn-focus-shadow-rgb: 207, 24, 32; }
.btn-outline-primary { --bs-btn-color: var(--brand); --bs-btn-border-color: var(--border-2); --bs-btn-hover-bg: var(--brand-tint); --bs-btn-hover-color: var(--brand-hover); --bs-btn-hover-border-color: var(--brand); --bs-btn-active-bg: var(--brand); --bs-btn-active-color: #fff; --bs-btn-active-border-color: var(--brand); --bs-btn-focus-shadow-rgb: 207, 24, 32; }
.btn-secondary { --bs-btn-bg: var(--surface); --bs-btn-color: var(--text); --bs-btn-border-color: var(--border-2); --bs-btn-hover-bg: var(--hover); --bs-btn-hover-color: var(--ink); --bs-btn-hover-border-color: var(--border-2); --bs-btn-active-bg: var(--border); --bs-btn-active-color: var(--ink); --bs-btn-active-border-color: var(--border-2); }
.btn-outline-secondary { --bs-btn-color: var(--text); --bs-btn-border-color: var(--border-2); --bs-btn-hover-bg: var(--hover); --bs-btn-hover-color: var(--ink); --bs-btn-hover-border-color: var(--border-2); --bs-btn-active-bg: var(--border); --bs-btn-active-color: var(--ink); --bs-btn-active-border-color: var(--border-2); }
.btn-light { --bs-btn-bg: var(--surface); --bs-btn-color: var(--text); --bs-btn-border-color: var(--border-2); --bs-btn-hover-bg: var(--hover); --bs-btn-hover-border-color: var(--border-2); --bs-btn-active-bg: var(--border); }
.btn-outline-light { --bs-btn-color: var(--text); --bs-btn-border-color: var(--border-2); --bs-btn-hover-bg: var(--hover); --bs-btn-hover-color: var(--ink); --bs-btn-hover-border-color: var(--border-2); }
.btn-success { --bs-btn-bg: #16A34A; --bs-btn-border-color: #16A34A; --bs-btn-hover-bg: #15803D; --bs-btn-hover-border-color: #15803D; --bs-btn-active-bg: #166534; --bs-btn-active-border-color: #166534; }
.btn-outline-success { --bs-btn-color: var(--ok); --bs-btn-border-color: var(--border-2); --bs-btn-hover-bg: var(--ok-bg); --bs-btn-hover-color: var(--ok); --bs-btn-hover-border-color: var(--ok-bd); --bs-btn-active-bg: #16A34A; --bs-btn-active-border-color: #16A34A; }
.btn-danger { --bs-btn-bg: #DC2626; --bs-btn-border-color: #DC2626; --bs-btn-hover-bg: #B91C1C; --bs-btn-hover-border-color: #B91C1C; --bs-btn-active-bg: #991B1B; --bs-btn-active-border-color: #991B1B; }
.btn-outline-danger { --bs-btn-color: var(--bad); --bs-btn-border-color: var(--border-2); --bs-btn-hover-bg: var(--bad-bg); --bs-btn-hover-color: var(--bad); --bs-btn-hover-border-color: var(--bad-bd); --bs-btn-active-bg: #DC2626; --bs-btn-active-border-color: #DC2626; }
.btn-warning { --bs-btn-bg: #C2410C; --bs-btn-border-color: #C2410C; --bs-btn-color: #fff; --bs-btn-hover-bg: #9A3412; --bs-btn-hover-border-color: #9A3412; --bs-btn-hover-color: #fff; --bs-btn-active-bg: #7C2D12; --bs-btn-active-border-color: #7C2D12; --bs-btn-active-color: #fff; --bs-btn-disabled-bg: #E8A27F; --bs-btn-disabled-border-color: #E8A27F; }
.btn-warning.text-dark { color: #fff !important; }
.btn-outline-warning { --bs-btn-color: var(--warn); --bs-btn-border-color: var(--border-2); --bs-btn-hover-bg: var(--warn-bg); --bs-btn-hover-color: var(--warn); --bs-btn-hover-border-color: var(--warn-bd); --bs-btn-active-bg: #D97706; --bs-btn-active-border-color: #D97706; --bs-btn-active-color: #fff; }
.btn-info { --bs-btn-bg: #0284C7; --bs-btn-border-color: #0284C7; --bs-btn-color: #fff; --bs-btn-hover-bg: #0369A1; --bs-btn-hover-border-color: #0369A1; --bs-btn-hover-color: #fff; --bs-btn-active-bg: #075985; --bs-btn-active-border-color: #075985; --bs-btn-active-color: #fff; }
.btn-outline-info { --bs-btn-color: var(--info); --bs-btn-border-color: var(--border-2); --bs-btn-hover-bg: var(--info-bg); --bs-btn-hover-color: var(--info); --bs-btn-hover-border-color: var(--info-bd); --bs-btn-active-bg: #0284C7; --bs-btn-active-border-color: #0284C7; --bs-btn-active-color: #fff; }
.btn-dark { --bs-btn-bg: var(--ink); --bs-btn-border-color: var(--ink); --bs-btn-hover-bg: #000; --bs-btn-hover-border-color: #000; }

.form-control:focus, .form-select:focus, .form-check-input:focus { border-color: var(--brand); box-shadow: var(--ring); }
.form-check-input:checked { background-color: var(--brand); border-color: var(--brand); }
.form-check-input { border-color: var(--border-2); }
.form-switch .form-check-input:checked { background-color: #16A34A; border-color: #16A34A; }
.page-link { color: var(--text); border-color: var(--border); }
.page-link:hover { color: var(--brand); background: var(--hover); border-color: var(--border); }
.page-item.active .page-link { background: var(--brand); border-color: var(--brand); color: #fff; }
.nav-pills .nav-link.active, .nav-pills .show > .nav-link { background: var(--brand); }
.nav-tabs .nav-link { color: var(--muted); border: 0; border-bottom: 2px solid transparent; font-weight: 500; }
.nav-tabs .nav-link:hover { color: var(--ink); border-bottom-color: var(--border-2); }
.nav-tabs .nav-link.active { color: var(--brand); border-bottom-color: var(--brand); background: transparent; }
.progress { background: var(--border); border-radius: var(--r-pill); }
.progress-bar { background-color: var(--brand); }
.list-group-item.active { background: var(--brand-tint); border-color: var(--border); color: var(--ink); }
.dropdown-menu { border: 1px solid var(--border); border-radius: var(--r); box-shadow: var(--shadow-2); padding: .375rem; }
.dropdown-item { border-radius: var(--r-sm); padding: .5rem .75rem; }
.dropdown-item:hover, .dropdown-item:focus { background: var(--hover); color: var(--ink); }
.dropdown-item.active, .dropdown-item:active { background: var(--brand-tint); color: var(--brand); }
.btn-check:checked + .btn, .btn-check:active + .btn { box-shadow: none; }
.text-primary { color: var(--brand) !important; }
.bg-primary { background-color: var(--brand) !important; }
.border-primary { border-color: var(--brand) !important; }
.border-danger { border-color: var(--border) !important; }
.text-muted { color: var(--muted) !important; }
.bg-purple { background-color: var(--vio) !important; }

/* ---------- 3. Base ------------------------------------------------------- */
html { overflow-x: hidden; max-width: 100vw; -webkit-text-size-adjust: 100%; }
body { max-width: 100vw; background: var(--bg); color: var(--text); font-family: var(--bs-body-font-family); -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 { color: var(--ink); font-weight: 600; letter-spacing: -.01em; }
a { text-decoration: none; }
a:hover { text-decoration: none; }
strong, b { font-weight: 600; }
small, .small { color: inherit; }
hr { border-color: var(--border); opacity: 1; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.btn:focus-visible { outline: 0; box-shadow: var(--ring); }
a, button, .btn, .nav-link, .mobile-case-card { -webkit-tap-highlight-color: transparent; }
.container-fluid { overflow-x: hidden; }
.col-md-10, .col-lg-10 { overflow-x: hidden; min-width: 0; }
.sidebar-col { min-width: 0; flex-shrink: 0; }
kbd { background: var(--hover); color: var(--text); border: 1px solid var(--border-2); border-radius: 4px; font-size: .75em; padding: .1em .4em; box-shadow: none; }

/* ---------- 4. Components ------------------------------------------------- */
/* Buttons */
.btn { font-weight: 500; border-radius: var(--r-sm); padding: .5rem .875rem; transition: background-color .15s, border-color .15s, color .15s, box-shadow .15s; }
.btn-sm { padding: .375rem .625rem; font-size: .8125rem; }
.btn-lg { padding: .75rem 1.25rem; font-size: 1.0625rem; border-radius: var(--r); }
.btn i { line-height: 1; }
.btn-icon { width: 36px; height: 36px; padding: 0; display: inline-flex; align-items: center; justify-content: center; }

/* Forms */
.form-control, .form-select { border-color: var(--border-2); border-radius: var(--r-sm); min-height: 40px; color: var(--ink); background-color: var(--surface); }
.form-control::placeholder { color: var(--faint); }
.form-control-sm, .form-select-sm { min-height: 34px; }
.form-control-lg, .form-select-lg { min-height: 48px; border-radius: var(--r); }
.form-label { font-weight: 500; color: var(--text); margin-bottom: .375rem; }
.form-text { color: var(--muted); }
.input-group-text { background: var(--subtle); border-color: var(--border-2); color: var(--muted); }
.form-floating > .form-control:focus ~ label, .form-floating > .form-control:not(:placeholder-shown) ~ label { color: var(--muted); }
.required-dot, .text-danger.required { color: var(--brand); }
textarea.form-control { min-height: 84px; }

/* Cards */
.card { border: 1px solid var(--border); border-radius: var(--r); box-shadow: var(--shadow-1); background: var(--surface); transition: none; }
.card:hover { transform: none; box-shadow: var(--shadow-1); }
.card-header { background: var(--surface); border-bottom: 1px solid var(--border); font-weight: 600; padding: .875rem 1.25rem; border-radius: var(--r) var(--r) 0 0 !important; }
.card-header h4, .card-header h5, .card-header h6 { font-size: 1rem; font-weight: 600; margin: 0; }
.card-header .badge { vertical-align: middle; }
/* Coloured card headers become neutral; the colour moves to the icon */
.card-header.bg-primary, .card-header.bg-success, .card-header.bg-info, .card-header.bg-secondary,
.card-header.bg-dark, .card-header.bg-warning, .card-header.bg-danger, .card-header.bg-light,
.card-header.bg-white, .card-header.bg-purple { background: var(--surface) !important; color: var(--ink) !important; }
.card-header.text-white, .card-header .text-white { color: var(--ink) !important; }
.card-header.bg-primary > * i:first-child, .card-header.bg-danger > * i:first-child { color: var(--brand); }
.card-header.bg-success > * i:first-child { color: var(--ok); }
.card-header.bg-info > * i:first-child { color: var(--info); }
.card-header.bg-warning > * i:first-child { color: var(--warn); }
.card-header.bg-secondary > * i:first-child, .card-header.bg-dark > * i:first-child { color: var(--muted); }
.card-header .btn-light, .card-header .btn-outline-light { background: var(--surface); color: var(--text); border-color: var(--border-2); }
.card-header .btn-light:hover, .card-header .btn-outline-light:hover { background: var(--hover); color: var(--ink); }
.card-header .text-white-50, .card-header .opacity-75 { color: var(--muted) !important; opacity: 1 !important; }
.card-footer { background: var(--subtle); border-top: 1px solid var(--border); }
.card.shadow, .card.shadow-sm { box-shadow: var(--shadow-1) !important; }
.table-card { border-radius: var(--r); border: 1px solid var(--border); box-shadow: var(--shadow-1); overflow: hidden; }
.chart-card { background: var(--surface); border-radius: var(--r); padding: 1.25rem; border: 1px solid var(--border); box-shadow: var(--shadow-1); }
.filter-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 1rem 1.25rem; margin-bottom: 1.25rem; box-shadow: var(--shadow-1); }
.filter-card h6 { font-size: .8125rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }

/* Tables */
.table { --bs-table-bg: transparent; --bs-table-hover-bg: var(--subtle); --bs-table-striped-bg: var(--subtle); color: var(--text); margin-bottom: 0; }
.table thead th, .table > thead > tr > th { background: var(--subtle); color: var(--muted); font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; border-bottom: 1px solid var(--border); border-top: 0; padding: .75rem 1rem; white-space: nowrap; }
.table > :not(caption) > * > * { padding: .75rem 1rem; border-bottom-color: var(--border); vertical-align: middle; }
.table tbody tr:last-child > * { border-bottom: 0; }
.table-hover tbody tr:hover { background: var(--subtle); }
.table .btn-sm { padding: .3rem .5rem; }
.table-light { --bs-table-bg: var(--subtle); }
.table .fw-bold, .table strong { color: var(--ink); }
.table-responsive { border-radius: var(--r); }

/* Badges: soft tinted pills */
.badge { font-weight: 600; padding: .3em .65em; border-radius: var(--r-pill); font-size: .75rem; letter-spacing: 0; line-height: 1.3; }
.badge.bg-primary  { background: var(--brand-tint) !important; color: var(--brand) !important; }
.badge.bg-secondary { background: var(--neu-bg) !important; color: var(--neu) !important; }
.badge.bg-success  { background: var(--ok-bg) !important; color: var(--ok) !important; }
.badge.bg-info     { background: var(--info-bg) !important; color: var(--info) !important; }
.badge.bg-warning  { background: var(--warn-bg) !important; color: var(--warn) !important; }
.badge.bg-danger   { background: var(--bad-bg) !important; color: var(--bad) !important; }
.badge.bg-dark     { background: var(--ink) !important; color: #fff !important; }
.badge.bg-light    { background: var(--neu-bg) !important; color: var(--neu) !important; border: 1px solid var(--border); }
.badge.bg-purple   { background: var(--vio-bg) !important; color: var(--vio) !important; }
.badge.text-dark   { color: inherit !important; }
.badge.bg-warning.text-dark { color: var(--warn) !important; }
.badge.bg-light.text-dark { color: var(--neu) !important; }
.priority-badge { font-size: .7rem; }
.priority-badge.bg-danger, .priority-badge.bg-dark { background: var(--bad-bg) !important; color: var(--bad) !important; }
.badge.bg-secondary.rounded-pill, .badge.rounded-pill { border-radius: var(--r-pill); }

/* Alerts */
.alert { border: 1px solid transparent; border-left-width: 4px; border-radius: var(--r); padding: .75rem 1rem; }
.alert-primary { background: var(--brand-tint); border-color: var(--brand); color: var(--brand-hover); }
.alert-success { background: var(--ok-bg); border-color: var(--ok); color: var(--ok); }
.alert-warning { background: var(--warn-bg); border-color: var(--warn); color: var(--warn); }
.alert-danger  { background: var(--bad-bg); border-color: var(--bad); color: var(--bad); }
.alert-info    { background: var(--info-bg); border-color: var(--info); color: var(--info); }
.alert-secondary, .alert-light { background: var(--neu-bg); border-color: var(--neu-bd); color: var(--neu); }
.alert .btn-close { filter: none; }

/* Modals */
.modal-content { border: 0; border-radius: var(--r-lg); box-shadow: 0 20px 50px rgba(16, 24, 40, .25); }
.modal-header { background: var(--surface); color: var(--ink); border-bottom: 1px solid var(--border); padding: 1rem 1.25rem; }
.modal-header.bg-primary, .modal-header.bg-danger, .modal-header.bg-warning, .modal-header.bg-success, .modal-header.bg-info, .modal-header.bg-dark, .modal-header.bg-secondary { background: var(--surface) !important; color: var(--ink) !important; }
.modal-header .text-white, .modal-title.text-white { color: var(--ink) !important; }
.modal-title { font-size: 1.0625rem; font-weight: 600; }
.modal-header .btn-close { filter: none; opacity: .6; }
.modal-body { padding: 1.25rem; }
.modal-footer { border-top: 1px solid var(--border); padding: .875rem 1.25rem; }
.modal-header.bg-dark { background: var(--ink) !important; color: #fff !important; }   /* photo viewer stays dark */
.modal-header.bg-dark .modal-title { color: #fff !important; }
.modal-header.bg-dark .btn-close { filter: invert(1); }

/* Misc */
.timeline-icon { background: var(--brand) !important; }
.media-thumbnail { border: 1px solid var(--border); border-radius: var(--r-sm); }
.media-thumbnail:hover { border-color: var(--brand); }
.footer { background: var(--surface); color: var(--muted); border-top: 1px solid var(--border); padding: 1rem; text-align: center; }
.text-purple { color: var(--vio) !important; }
.empty-state { text-align: center; padding: 2.5rem 1rem; color: var(--muted); }
.empty-state i { font-size: 2.5rem; color: var(--faint); display: block; margin-bottom: .75rem; }
.empty-state p { margin: 0; }
.section-title { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 1.25rem 0 .625rem; }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--brand-tint); color: var(--brand); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; }

/* ---------- 5. Office layout --------------------------------------------- */
/* Sidebar (markup + JS unchanged) */
.sidebar { background: var(--sidebar-bg); border-right: 1px solid var(--sidebar-line); position: fixed; top: 0; left: 0; width: 16.6667%; height: 100vh; height: 100dvh; overflow-y: auto; display: flex; flex-direction: column; z-index: 100; }
.sidebar > nav { flex: 1; }
.sidebar-brand { border-bottom: 1px solid var(--sidebar-line) !important; padding: 14px 16px !important; }
.sidebar-brand a:hover { opacity: .9; }
.sidebar-brand .company-logo { height: 34px; width: auto; margin-right: 0; }
.sidebar-brand .fw-bold { font-size: .95rem; letter-spacing: -.01em; }
.sidebar-collapse-btn { display: flex; align-items: center; justify-content: center; width: 28px; height: 28px; padding: 0; border-radius: 6px; opacity: .6; border-color: rgba(255,255,255,.25); color: #fff; }
.sidebar-collapse-btn:hover { opacity: 1; background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.35); color: #fff; }
.sidebar-expand-btn { display: none; width: 36px; height: 36px; border: 1px solid var(--border-2); border-radius: var(--r-sm); background: var(--surface); color: var(--text); font-size: 1.15rem; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0; margin-right: 12px; }
.sidebar-expand-btn:hover { background: var(--hover); color: var(--ink); }
.row.sidebar-collapsed > .sidebar-col { display: none !important; }
.row.sidebar-collapsed > [class*="col-md-10"] { max-width: 100% !important; flex: 0 0 100% !important; }
.sidebar-search { border-bottom: 1px solid var(--sidebar-line); padding: 10px 12px !important; }
.sidebar-search-wrap { position: relative; }
.sidebar-search-wrap i.bi-search { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: rgba(255,255,255,.45); font-size: .85rem; pointer-events: none; z-index: 1; }
.sidebar-search-wrap input { background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.1); color: #fff; padding-left: 32px; padding-right: 40px; font-size: .85rem; border-radius: var(--r-sm); min-height: 34px; }
.sidebar-search-wrap input::placeholder { color: rgba(255,255,255,.4); }
.sidebar-search-wrap input:focus { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.25); color: #fff; box-shadow: none; }
.sidebar-search-kbd { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); font-size: .65rem; background: rgba(255,255,255,.08); color: rgba(255,255,255,.5); padding: 2px 6px; border-radius: 4px; border: 1px solid rgba(255,255,255,.12); pointer-events: none; }
.sidebar-nav { padding: 8px 10px; flex: 1; overflow-y: auto; display: block !important; flex-wrap: nowrap; }
.sidebar-nav > * { display: block; width: 100%; }
.sidebar .nav-link { color: rgba(255,255,255,.8); }
.sidebar-item { display: flex !important; align-items: center; gap: 10px; padding: 9px 12px; color: #CBD5E1; text-decoration: none; border-radius: var(--r-sm); font-size: .875rem; transition: background-color .15s, color .15s; border-left: 3px solid transparent; margin: 1px 0; position: relative; font-weight: 500; }
.sidebar-item:hover { background: rgba(255,255,255,.06); color: #fff; border-left-color: transparent; }
.sidebar-item.active { background: rgba(207, 24, 32, .22); color: #fff; font-weight: 600; border-left-color: var(--brand-line); box-shadow: none; }
.sidebar-item i { font-size: 1rem; width: 20px; color: #94A3B8; flex-shrink: 0; }
.sidebar-item.active i { color: #fff; }
.sidebar-item span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-subitem { padding-left: 34px; font-size: .85rem; }
.sidebar-subitem i { font-size: .9rem; color: #64748B; }
.sidebar-group { margin: 4px 0; }
.sidebar-group-header { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; color: #94A3B8; background: transparent; border: none; border-radius: var(--r-sm); font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; text-align: left; cursor: pointer; transition: background-color .15s, color .15s; position: relative; }
.sidebar-group-header:hover { color: #fff; background: rgba(255,255,255,.05); }
.sidebar-group-header i:first-child { font-size: 1rem; color: #94A3B8; width: 20px; flex-shrink: 0; }
.sidebar-group-header span { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.sidebar-group-badge { font-size: .65rem; padding: 2px 6px; min-width: 20px; text-align: center; margin-right: 6px; }
.sidebar-chevron { font-size: .7rem !important; color: rgba(255,255,255,.35) !important; width: auto !important; transition: transform .25s ease; margin-left: auto; }
.sidebar-group.open .sidebar-chevron, .sidebar-group.search-expanded .sidebar-chevron { transform: rotate(180deg); color: #fff !important; }
.sidebar-group-items { overflow: hidden; max-height: 0; transition: max-height .3s ease; }
.sidebar-group.open > .sidebar-group-items, .sidebar-group.search-expanded > .sidebar-group-items { max-height: 800px; }
.sidebar-group:has(.sidebar-item.active) > .sidebar-group-header { color: #fff; }
.sidebar-group:has(.sidebar-item.active) > .sidebar-group-header::after { content: ''; position: absolute; right: 8px; width: 6px; height: 6px; border-radius: 50%; background: var(--brand-line); }
.sidebar-group.open:has(.sidebar-item.active) > .sidebar-group-header::after { display: none; }
.sidebar-empty-state { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 30px 10px; color: rgba(255,255,255,.45); font-size: .85rem; }
.sidebar-empty-state i { font-size: 1.5rem; opacity: .4; }
.sidebar-footer { margin-top: auto; border-top: 1px solid var(--sidebar-line); padding: 8px 10px; }
.sidebar-logout { color: #CBD5E1 !important; }
.sidebar-logout:hover { background: rgba(255,255,255,.06) !important; color: #fff !important; }
.sidebar-logout i { color: #94A3B8 !important; }
.sidebar-version { text-align: center; padding: 6px 0 4px; color: rgba(255,255,255,.3); font-size: .7rem; }

/* Topbar */
.topbar { background: var(--surface); border-bottom: 1px solid var(--border); padding: .875rem 1.5rem; min-height: 64px; }
.topbar h4, .topbar h5 { font-size: 1.25rem; font-weight: 700; letter-spacing: -.01em; }
.topbar small.text-muted { font-size: .8125rem; }
.topbar .btn-sm { padding: .45rem .75rem; font-size: .8125rem; }
.realtime-status { display: inline-flex; align-items: center; gap: .4rem; font-size: .75rem; color: var(--muted); background: var(--subtle); border: 1px solid var(--border); border-radius: var(--r-pill); padding: .15rem .6rem .15rem .5rem; }
.realtime-indicator { display: inline-block; width: 7px; height: 7px; background: #16A34A; border-radius: 50%; animation: pulse-animation 2s infinite; }
.realtime-indicator.offline { background: #DC2626; animation: none; }
#last-update-time { display: inline-block; padding: 0; background: transparent; color: var(--muted); font-size: .75rem; font-weight: 500; font-variant-numeric: tabular-nums; }
#last-update-time.pulse { animation: pulse-animation .6s ease-in-out; }

/* Mobile header (office, < 992px) */
.mobile-header { position: sticky; top: 0; z-index: 1030; background: var(--surface); padding: .5rem .75rem; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border); border-top: 3px solid var(--brand-line); box-shadow: var(--shadow-1); }
.mobile-header-brand { display: flex; align-items: center; gap: .5rem; }
.mobile-header-brand img { height: 26px; width: auto; filter: none; }
.mobile-header-brand span { font-weight: 700; font-size: .95rem; color: var(--ink); letter-spacing: -.01em; }
.mobile-header-spacer { width: 44px; }
.mobile-menu-btn { display: flex !important; align-items: center; justify-content: center; width: 44px; height: 44px; min-width: 44px; background: var(--surface); border: 1px solid var(--border-2); border-radius: var(--r-sm); color: var(--ink); font-size: 1.35rem; cursor: pointer; }
.mobile-menu-btn:active { background: var(--hover); }
@media (min-width: 992px) { .mobile-header, .mobile-menu-btn { display: none !important; } }
@supports (padding-top: env(safe-area-inset-top)) { .mobile-header { padding-top: calc(.5rem + env(safe-area-inset-top)); } }

/* Stat tiles: white card, coloured icon chip, big number */
.stat-cards-row { display: flex; flex-wrap: nowrap; gap: .75rem !important; }
.stat-card-wrapper { flex: 1 1 0; min-width: 0; }
.stat-card, .card.stat-card, .card.stat-card.stat-card-compact { background: var(--surface) !important; color: var(--ink) !important; border: 1px solid var(--border) !important; border-radius: var(--r) !important; box-shadow: var(--shadow-1) !important; transition: border-color .15s, box-shadow .15s; }
.stat-card.text-white, .stat-card .text-white { color: var(--ink) !important; }
.stat-card:hover { transform: none; box-shadow: var(--shadow-1); }
a.stat-card-link { display: block; color: inherit; text-decoration: none; }
a.stat-card-link:hover .stat-card, a.stat-card-link:focus-visible .stat-card { border-color: var(--border-2) !important; box-shadow: var(--shadow-2) !important; }
.stat-card-compact .card-body { padding: .875rem 1rem !important; }
.stat-card-compact h4, .stat-card h3, .stat-card h4 { font-size: 1.5rem; font-weight: 700; line-height: 1.1; color: var(--ink); font-variant-numeric: tabular-nums; }
.stat-card-compact small, .stat-card small { font-size: .75rem; color: var(--muted); opacity: 1; white-space: nowrap; font-weight: 500; }
.stat-icon, .stat-icon-sm { border-radius: 10px; display: flex; align-items: center; justify-content: center; }
.stat-icon-sm { width: 40px; height: 40px; min-width: 40px; font-size: 1.1rem; background: var(--neu-bg) !important; color: var(--neu); }
.stat-icon { width: 52px; height: 52px; font-size: 1.4rem; background: var(--neu-bg) !important; color: var(--neu); }
.stat-card.bg-primary .stat-icon-sm, .stat-card.bg-primary .stat-icon { background: var(--brand-tint) !important; color: var(--brand); }
.stat-card.bg-danger .stat-icon-sm,  .stat-card.bg-danger .stat-icon  { background: var(--bad-bg) !important; color: var(--bad); }
.stat-card.bg-warning .stat-icon-sm, .stat-card.bg-warning .stat-icon { background: var(--warn-bg) !important; color: var(--warn); }
.stat-card.bg-info .stat-icon-sm,    .stat-card.bg-info .stat-icon    { background: var(--info-bg) !important; color: var(--info); }
.stat-card.bg-success .stat-icon-sm, .stat-card.bg-success .stat-icon { background: var(--ok-bg) !important; color: var(--ok); }
.stat-card.bg-purple .stat-icon-sm,  .stat-card.bg-purple .stat-icon  { background: var(--vio-bg) !important; color: var(--vio); }
.stat-card.bg-secondary .stat-icon-sm, .stat-card.bg-dark .stat-icon-sm { background: var(--neu-bg) !important; color: var(--neu); }
@media (max-width: 767px) {
  .stat-cards-row { display: grid !important; grid-template-columns: repeat(2, 1fr); gap: .625rem !important; }
  .stat-card-wrapper { flex: none; width: 100%; }
  .stat-card-wrapper:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .stat-card-compact .card-body { padding: .75rem !important; }
  .stat-card-compact h4 { font-size: 1.35rem; }
}
@media (min-width: 768px) and (max-width: 991px) { .stat-cards-row { display: grid !important; grid-template-columns: repeat(3, 1fr); } .stat-card-wrapper { flex: none; } }

/* Office list pages: mobile card view of tables */
.mobile-case-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 1rem; margin-bottom: .75rem; box-shadow: var(--shadow-1); border-left: 4px solid var(--border-2); display: none; }
.mobile-case-card:active { background: var(--subtle); }
@media (max-width: 767px) { .mobile-case-card { display: block; } .desktop-table { display: none !important; } .mobile-cards-container { display: block; } }
@media (min-width: 768px) { .mobile-case-card { display: none !important; } .mobile-cards-container { display: none !important; } .desktop-table { display: block; } }
.mobile-case-card .card-header-row { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: .5rem; gap: .5rem; flex-wrap: wrap; }
.mobile-case-card .case-id { font-weight: 700; color: var(--ink); font-size: .9rem; display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; min-width: 0; word-break: break-word; }
.mobile-case-card .case-id .sr-badge { font-size: .7rem; font-weight: 500; color: var(--muted); background: var(--neu-bg); padding: .15rem .4rem; border-radius: 4px; }
.mobile-case-card .case-badges { display: flex; gap: .375rem; flex-wrap: wrap; justify-content: flex-end; max-width: 50%; }
.mobile-case-card .customer-name { font-weight: 600; font-size: 1.05rem; margin-bottom: .25rem; color: var(--ink); line-height: 1.3; word-break: break-word; }
.mobile-case-card .customer-info { color: var(--muted); font-size: .875rem; margin-bottom: .625rem; display: flex; align-items: center; gap: .35rem; word-break: break-word; }
.mobile-case-card .customer-info i { color: var(--faint); font-size: .8rem; }
.mobile-case-card .card-meta { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: .75rem; }
.mobile-case-card .meta-item { display: inline-flex; align-items: center; gap: .3rem; font-size: .8rem; color: var(--text); background: var(--subtle); border: 1px solid var(--border); padding: .25rem .5rem; border-radius: var(--r-sm); }
.mobile-case-card .meta-item i { color: var(--muted); font-size: .75rem; }
.mobile-case-card .card-footer-row { display: flex; justify-content: space-between; align-items: center; padding-top: .75rem; border-top: 1px solid var(--border); gap: .5rem; }
.mobile-case-card .case-date { font-size: .75rem; color: var(--muted); display: flex; align-items: center; gap: .25rem; }
.mobile-case-card .card-actions { display: flex; gap: .5rem; }
.mobile-case-card .card-actions .btn { padding: .5rem .875rem; font-size: .85rem; min-height: 40px; display: flex; align-items: center; gap: .35rem; }
.mobile-case-card.status-pending { border-left-color: var(--neu-bd); }
.mobile-case-card.status-assigned { border-left-color: var(--warn-bd); }
.mobile-case-card.status-in_progress { border-left-color: var(--info-bd); }
.mobile-case-card.status-completed { border-left-color: var(--ok-bd); }
.mobile-case-card.status-blocked { border-left-color: var(--bad-bd); }
.mobile-case-card a { padding: .25rem 0; display: inline-block; }

/* Responsive office chrome (< 992px): sidebar becomes a drawer */
@media (max-width: 991px) {
  html, body { overflow-x: hidden !important; max-width: 100vw; }
  .sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(16, 24, 40, .55); z-index: 1040; opacity: 0; transition: opacity .25s ease; }
  .sidebar-overlay.show { display: block; opacity: 1; }
  .sidebar-col.sidebar-mobile-visible { display: block !important; position: fixed !important; top: 0; left: 0; width: 280px; height: 100vh; height: 100dvh; z-index: 1050; padding: 0 !important; max-width: 280px !important; flex: none !important; }
  .sidebar { position: fixed; left: -300px; top: 0; width: 280px; height: 100vh; height: 100dvh; z-index: 1050; transition: left .25s cubic-bezier(.4, 0, .2, 1); overflow-y: auto; box-shadow: 4px 0 24px rgba(0, 0, 0, .3); }
  .sidebar.show { left: 0; }
  .sidebar-close-btn { width: 36px; height: 36px; padding: 0; display: flex !important; align-items: center; justify-content: center; border-radius: 50%; border-color: rgba(255,255,255,.25); color: #fff; }
  .col-md-10, .col-lg-10 { flex: 0 0 100%; max-width: 100%; width: 100%; overflow-x: hidden; }
  .card { max-width: 100%; overflow: hidden; }
  .card-body { overflow-x: hidden; }
  body.sidebar-open { overflow: hidden; position: fixed; width: 100%; overscroll-behavior: contain; }
  .topbar { padding: .75rem 1rem; flex-wrap: wrap; gap: .5rem; min-height: 0; }
  .topbar h4 { font-size: 1.1rem; } .topbar h5 { font-size: 1rem; } .topbar small { font-size: .75rem; }
  .mobile-cards-container { overflow-x: hidden; padding: .75rem !important; margin: 0 -.25rem; box-sizing: border-box; }
  .p-4 { padding: 1rem !important; } .p-3 { padding: .75rem !important; }
  .sidebar .nav-link { padding: .875rem 1rem; font-size: .95rem; min-height: 48px; display: flex; align-items: center; }
  .sidebar-group-header { padding: 14px 12px; min-height: 48px; font-size: .75rem; }
  .sidebar-item { padding: 12px; font-size: .95rem; min-height: 48px; }
  .sidebar-subitem { padding-left: 38px; }
  .sidebar-search-wrap input { font-size: 16px; }
  .sidebar-search-kbd { display: none; }
  input[type="text"], input[type="email"], input[type="password"], input[type="date"], input[type="number"], input[type="tel"], input[type="search"], select, textarea { font-size: 16px !important; }
  .badge { padding: .35em .6em; font-size: .75rem; }
  .pagination .page-link { min-width: 40px; min-height: 40px; display: flex; align-items: center; justify-content: center; }
  .dropdown-menu { min-width: 200px; } .dropdown-item { padding: .75rem 1rem; }
}
@media (max-width: 991px) and (min-width: 768px) { .filter-form .col-md-2 { flex: 0 0 33.333%; max-width: 33.333%; } }
@media (max-width: 767px) {
  .table-responsive.mobile-cards thead { display: none; }
  .table-responsive.mobile-cards tbody tr { display: block; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); margin-bottom: .75rem; padding: .875rem; box-shadow: var(--shadow-1); }
  .table-responsive.mobile-cards tbody td { display: flex; justify-content: space-between; align-items: center; padding: .4rem 0; border: none; border-bottom: 1px solid var(--border); }
  .table-responsive.mobile-cards tbody td:last-child { border-bottom: none; justify-content: flex-end; padding-top: .75rem; gap: .5rem; }
  .table-responsive.mobile-cards tbody td::before { content: attr(data-label); font-weight: 600; color: var(--muted); font-size: .75rem; text-transform: uppercase; flex-shrink: 0; margin-right: 1rem; }
  .table-responsive.mobile-cards tbody td:last-child::before { display: none; }
  .table .d-mobile-none, .table .mobile-hide { display: none !important; }
  .table { font-size: .8125rem; }
  .table thead th { font-size: .7rem; padding: .5rem .5rem; }
  .table tbody td { padding: .5rem .5rem; }
  .table .btn-sm .btn-text { display: none; }
  .pagination { flex-wrap: wrap; justify-content: center; gap: .25rem; }
  .modal-dialog { margin: .5rem; max-width: calc(100% - 1rem); }
  .modal-footer .btn { flex: 1; min-width: 120px; }
  .btn { min-height: 44px; }
  .btn-sm { min-height: 36px; }
  .mobile-btn-full { width: 100%; }
  .alert { font-size: .875rem; }
  .form-check-input { width: 1.25rem; height: 1.25rem; }
}
@supports (padding-bottom: env(safe-area-inset-bottom)) { .sidebar { padding-bottom: env(safe-area-inset-bottom); } .mobile-header { padding-left: calc(.75rem + env(safe-area-inset-left)); padding-right: calc(.75rem + env(safe-area-inset-right)); } }

/* ---------- 6. Live-update animations (keep class names) ------------------ */
@keyframes flash-update { 0% { background-color: rgba(217, 119, 6, .28); } 100% { background-color: transparent; } }
@keyframes pulse-animation { 0% { opacity: 1; } 50% { opacity: .55; } 100% { opacity: 1; } }
.flash-update { animation: flash-update 1.5s ease-out; }
@keyframes section-update-flash { 0% { border-color: #16A34A; box-shadow: 0 0 0 3px rgba(22, 163, 74, .25); } 100% { border-color: var(--border); box-shadow: var(--shadow-1); } }
.section-updated { animation: section-update-flash 2.5s ease-out; }
@keyframes new-item-slide { 0% { opacity: 0; transform: translateY(-8px); background-color: rgba(22, 163, 74, .15); } 30% { opacity: 1; transform: translateY(0); background-color: rgba(22, 163, 74, .12); } 100% { opacity: 1; transform: translateY(0); background-color: transparent; } }
.new-live-item { animation: new-item-slide 1.5s ease-out; }
.pulse { animation: pulse-animation .6s ease-in-out; }
.new-case-animate { animation: newCaseSlideIn .5s ease-out forwards; position: relative; }
.new-case-animate::before { content: 'ΝΕΑ'; position: absolute; top: 8px; right: 8px; background: var(--brand); color: #fff; padding: 3px 10px; border-radius: var(--r-pill); font-size: 10px; font-weight: 700; letter-spacing: .5px; z-index: 10; animation: newBadgePulse 1.5s ease-in-out 3; }
@keyframes newCaseSlideIn { 0% { opacity: 0; transform: translateY(-12px); } 100% { opacity: 1; transform: translateY(0); } }
@keyframes newBadgePulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.08); } }
.update-badge { display: none; position: absolute; top: 10px; right: 10px; background: var(--brand); color: #fff; padding: .5rem .75rem; border-radius: var(--r-pill); font-weight: 600; font-size: .875rem; box-shadow: var(--shadow-2); z-index: 1000; }
.update-badge.pulse { animation: pulse-animation .6s ease-in-out; }
tr.new-row { animation: new-row-slide .5s ease-out; }
@keyframes new-row-slide { 0% { opacity: 0; transform: translateY(-12px); } 100% { opacity: 1; transform: translateY(0); } }
.mobile-case-card.new-card { animation: new-card-slide .5s ease-out; }
@keyframes new-card-slide { 0% { opacity: 0; transform: translateY(-12px); } 100% { opacity: 1; transform: translateY(0); } }
.stat-flash { animation: flash-update 1.2s ease-out; }
@keyframes flash-highlight { 0% { background-color: rgba(217, 119, 6, .2); } 100% { background-color: transparent; } }
.case-card.new-case::before { content: 'ΝΕΑ'; position: absolute; top: -8px; right: 12px; background: var(--brand); color: #fff; font-size: .65rem; font-weight: 700; padding: 2px 8px; border-radius: var(--r-pill); }

/* ---------- 7. Field portal ----------------------------------------------- */
body.field-body {
  font-size: 1.0625rem;              /* 17px — legible outdoors, no iOS zoom-on-focus */
  line-height: 1.45;
  background: var(--bg);
  padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
  -webkit-text-size-adjust: 100%;
}
body.field-body.has-nav { padding-bottom: calc(var(--nav-h) + 12px + env(safe-area-inset-bottom, 0px)); }
body.field-body.has-actions { padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px)); }
body.field-body.has-nav.has-actions { padding-bottom: calc(var(--nav-h) + 96px + env(safe-area-inset-bottom, 0px)); }
.field-body .container-fluid { padding-left: 16px; padding-right: 16px; }
.field-body h1, .field-body h2, .field-body h3 { letter-spacing: -.015em; }
.field-body .text-muted { color: var(--muted) !important; }
.field-body small, .field-body .small { font-size: .875rem; }

/* Header */
.fh { position: sticky; top: 0; z-index: 1020; background: var(--surface); border-bottom: 1px solid var(--border); border-top: 3px solid var(--brand-line); display: flex; align-items: center; gap: 10px; min-height: 60px; padding: 8px 12px; padding-top: calc(8px + env(safe-area-inset-top, 0px)); box-shadow: var(--shadow-1); }
.fh-back, .fh-btn { flex: 0 0 auto; width: 46px; height: 46px; display: inline-flex; align-items: center; justify-content: center; border-radius: var(--r); border: 1px solid var(--border-2); background: var(--surface); color: var(--ink); font-size: 1.35rem; text-decoration: none; }
.fh-back:active, .fh-btn:active { background: var(--hover); }
.fh-logo { height: 30px; width: auto; flex: 0 0 auto; margin-left: 4px; }
.fh-text { flex: 1 1 auto; min-width: 0; }
.fh-title { font-size: 1.25rem; font-weight: 700; color: var(--ink); line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fh-sub { font-size: .8125rem; color: var(--muted); line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.fh-actions { flex: 0 0 auto; display: flex; align-items: center; gap: 6px; }
.fh-actions .btn { min-height: 46px; }

/* Bottom navigation */
.fnav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 1030; background: var(--surface); border-top: 1px solid var(--border); box-shadow: var(--shadow-up); display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; height: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px)); padding-bottom: env(safe-area-inset-bottom, 0px); }
.fnav-item { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--muted); text-decoration: none; font-size: .8125rem; font-weight: 600; line-height: 1; padding: 6px 4px; min-width: 0; }
.fnav-item i { font-size: 1.5rem; line-height: 1; padding: 4px 16px; border-radius: var(--r-pill); }
.fnav-item span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.fnav-item.active { color: var(--brand); }
.fnav-item.active i { background: var(--brand-tint); }
.fnav-item:active { color: var(--ink); }
.fnav-item.disabled { opacity: .4; pointer-events: none; }
.fnav-badge { position: absolute; top: 6px; right: calc(50% - 22px); background: var(--brand); color: #fff; font-size: .7rem; font-weight: 700; min-width: 18px; height: 18px; border-radius: 9px; display: flex; align-items: center; justify-content: center; padding: 0 5px; }
.fnav-item { position: relative; }

/* Cards & lists */
.fcard { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 16px; margin-bottom: 12px; box-shadow: var(--shadow-1); }
.fcard-title { font-size: .8125rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 0 0 12px; display: flex; align-items: center; gap: 8px; }
.fcard-title .count { margin-left: auto; background: var(--neu-bg); color: var(--neu); border-radius: var(--r-pill); padding: 2px 10px; font-size: .8125rem; text-transform: none; letter-spacing: 0; }
.fsection { font-size: .8125rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 20px 0 8px; display: flex; align-items: center; gap: 8px; }
.fsection .count { margin-left: auto; text-transform: none; letter-spacing: 0; color: var(--text); font-weight: 600; }

.fjob { display: block; position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 14px 44px 14px 16px; margin-bottom: 10px; box-shadow: var(--shadow-1); color: var(--text); text-decoration: none; border-left: 5px solid var(--border-2); }
.fjob:active { background: var(--subtle); }
.fjob::after { content: '\F285'; font-family: 'bootstrap-icons'; position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--faint); font-size: 1.15rem; }
.fjob-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; flex-wrap: wrap; }
.fjob-code { font-size: .8125rem; color: var(--muted); font-weight: 600; letter-spacing: .01em; }
.fjob-name { font-size: 1.1875rem; font-weight: 700; color: var(--ink); line-height: 1.25; margin-bottom: 4px; word-break: break-word; }
.fjob-addr { font-size: 1rem; color: var(--text); display: flex; align-items: flex-start; gap: 6px; line-height: 1.35; }
.fjob-addr i { color: var(--faint); margin-top: 2px; }
.fjob-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.fjob.st-assigned { border-left-color: var(--warn-bd); }
.fjob.st-in_progress { border-left-color: var(--info-bd); }
.fjob.st-completed { border-left-color: var(--ok-bd); }
.fjob.st-blocked { border-left-color: var(--bad-bd); }
.fjob.st-scheduled { border-left-color: var(--vio-bd); }
.fjob.pr-urgent { border-left-color: var(--bad); }
.fjob.pr-high { border-left-color: var(--warn); }
.fjob.completed { opacity: .85; }

/* Pills & chips */
.fpill { display: inline-flex; align-items: center; gap: 5px; font-size: .8125rem; font-weight: 600; padding: 4px 10px; border-radius: var(--r-pill); background: var(--neu-bg); color: var(--neu); line-height: 1.2; white-space: nowrap; }
.fpill i { font-size: .9em; }
.fpill-ok { background: var(--ok-bg); color: var(--ok); }
.fpill-warn { background: var(--warn-bg); color: var(--warn); }
.fpill-info { background: var(--info-bg); color: var(--info); }
.fpill-bad { background: var(--bad-bg); color: var(--bad); }
.fpill-vio { background: var(--vio-bg); color: var(--vio); }
.fpill-brand { background: var(--brand-tint); color: var(--brand); }
.fpill-lg { font-size: .9375rem; padding: 6px 12px; }
.fchips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 6px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.fchips::-webkit-scrollbar { display: none; }
.fchip { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 16px; border-radius: var(--r-pill); border: 1px solid var(--border-2); background: var(--surface); color: var(--text); font-size: .9375rem; font-weight: 600; text-decoration: none; white-space: nowrap; }
.fchip .n { background: var(--neu-bg); color: var(--neu); border-radius: var(--r-pill); padding: 1px 8px; font-size: .8125rem; }
.fchip.active { background: var(--ink); border-color: var(--ink); color: #fff; }
.fchip.active .n { background: rgba(255,255,255,.2); color: #fff; }

/* Big buttons & forms */
.field-body .btn { min-height: 48px; font-size: 1rem; font-weight: 600; border-radius: var(--r); padding: .5rem 1rem; }
.field-body .btn-sm { min-height: 40px; font-size: .9375rem; padding: .375rem .75rem; }
.field-body .btn-lg, .field-body .fbtn-lg { min-height: 56px; font-size: 1.125rem; border-radius: var(--r-lg); }
.field-body .btn-icon { min-height: 48px; width: 48px; padding: 0; }
.fgrid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.fgrid-2 .btn { width: 100%; }
.fstack { display: flex; flex-direction: column; gap: 10px; }
.fstack .btn { width: 100%; justify-content: flex-start; }
.fstack .btn i { width: 28px; text-align: center; font-size: 1.2rem; }
.field-body .form-control, .field-body .form-select { font-size: 1.0625rem; min-height: 52px; border-radius: var(--r); padding: .625rem .875rem; }
.field-body .form-control-sm, .field-body .form-select-sm { font-size: 1.0625rem; min-height: 52px; padding: .625rem .875rem; }
.field-body textarea.form-control { min-height: 96px; }
.field-body .form-label { font-size: .9375rem; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.field-body .form-check-input { width: 1.5rem; height: 1.5rem; margin-top: .1rem; }
.field-body .form-check-label { padding-left: .375rem; }
.field-body .input-group .btn { min-height: 52px; }
.fsearch { position: relative; }
.fsearch input { padding-left: 46px !important; border-radius: var(--r-pill) !important; }
.fsearch > i { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--faint); font-size: 1.1rem; pointer-events: none; }
.fsearch .clear-btn { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); background: none; border: 0; color: var(--faint); width: 40px; height: 40px; }
.fstepper { display: grid; grid-template-columns: 52px 1fr 52px; gap: 6px; }
.fstepper .btn { min-height: 52px; padding: 0; font-size: 1.4rem; }
.fstepper input { text-align: center; font-weight: 700; font-size: 1.25rem; }
.field-body .btn-check + .btn { min-height: 52px; display: inline-flex; align-items: center; justify-content: center; }
.field-body .btn-check:checked + .btn-outline-secondary, .field-body .btn-check:checked + .btn-outline-primary { background: var(--ink); color: #fff; border-color: var(--ink); }

/* Key-value blocks */
.fkv { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.fkv-item { min-width: 0; }
.fkv-item.full { grid-column: 1 / -1; }
.fkv-label { font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-bottom: 2px; }
.fkv-value { font-size: 1.0625rem; color: var(--ink); font-weight: 500; word-break: break-word; }
.fkv-value.big { font-size: 1.25rem; font-weight: 700; }

/* Hero (job detail top) */
.fhero { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 18px 16px; margin: 12px 0; box-shadow: var(--shadow-1); }
.fhero-name { font-size: 1.4375rem; font-weight: 800; color: var(--ink); line-height: 1.2; letter-spacing: -.01em; margin-bottom: 6px; word-break: break-word; }
.fhero-addr { font-size: 1.0625rem; color: var(--text); display: flex; gap: 8px; align-items: flex-start; line-height: 1.35; margin-bottom: 14px; }
.fhero-addr i { color: var(--faint); margin-top: 3px; }
.fhero-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.fhero-actions .btn { width: 100%; min-height: 54px; font-size: 1.0625rem; }
.fhero-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.fnote { background: var(--warn-bg); border: 1px solid var(--warn-bd); color: #78350F; border-radius: var(--r); padding: 12px 14px; font-size: 1rem; margin-top: 12px; display: flex; gap: 10px; }
.fnote i { color: var(--warn); font-size: 1.2rem; flex: 0 0 auto; }
.fhint { background: var(--info-bg); border: 1px solid var(--info-bd); color: #0C4A6E; border-radius: var(--r); padding: 12px 14px; font-size: 1rem; display: flex; gap: 10px; align-items: flex-start; margin: 12px 0; }
.fhint i { color: var(--info); font-size: 1.2rem; flex: 0 0 auto; }
.fhint-ok { background: var(--ok-bg); border-color: var(--ok-bd); color: #14532D; }
.fhint-ok i { color: var(--ok); }

/* Sticky action bar (one primary action per screen) */
.factions { position: fixed; left: 0; right: 0; bottom: 0; z-index: 1025; background: var(--surface); border-top: 1px solid var(--border); box-shadow: var(--shadow-up); padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px)); display: flex; gap: 10px; }
body.has-nav .factions { bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px)); padding-bottom: 10px; }
.factions .btn { min-height: 56px; font-size: 1.125rem; border-radius: var(--r-lg); }
.factions .btn-main { flex: 1 1 auto; }
.factions .btn-more { flex: 0 0 auto; min-width: 56px; padding: 0 16px; }
.factions-note { position: absolute; top: -28px; left: 0; right: 0; text-align: center; font-size: .8125rem; color: var(--muted); }

/* Photo grid */
.fphotos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.fphoto { position: relative; aspect-ratio: 1 / 1; border-radius: var(--r); overflow: hidden; background: var(--hover); border: 1px solid var(--border); }
.fphoto img { width: 100%; height: 100%; object-fit: cover; display: block; }
.fphoto-tag { position: absolute; left: 0; right: 0; bottom: 0; background: rgba(17, 24, 39, .72); color: #fff; font-size: .7rem; font-weight: 600; padding: 3px 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fphoto-add { aspect-ratio: 1 / 1; border-radius: var(--r); border: 2px dashed var(--border-2); background: var(--surface); color: var(--muted); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-size: .875rem; font-weight: 600; text-decoration: none; }
.fphoto-add i { font-size: 1.6rem; color: var(--brand); }

/* Simple rows (materials, comments, documents) */
.frow { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.frow:last-child { border-bottom: 0; padding-bottom: 0; }
.frow:first-child { padding-top: 0; }
.frow-icon { width: 40px; height: 40px; border-radius: var(--r); background: var(--neu-bg); color: var(--neu); display: flex; align-items: center; justify-content: center; font-size: 1.2rem; flex: 0 0 auto; }
.frow-body { flex: 1 1 auto; min-width: 0; }
.frow-title { font-weight: 600; color: var(--ink); word-break: break-word; }
.frow-meta { font-size: .8125rem; color: var(--muted); }
.frow-end { flex: 0 0 auto; }
.fcomment { padding: 12px 0; border-bottom: 1px solid var(--border); }
.fcomment:last-child { border-bottom: 0; }
.fcomment-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: .8125rem; color: var(--muted); margin-bottom: 4px; }
.fcomment-head strong { color: var(--ink); font-size: .9375rem; }
.fcomment-text { white-space: pre-wrap; word-break: break-word; }

/* Empty states */
.fempty { text-align: center; padding: 36px 16px; color: var(--muted); }
.fempty i { font-size: 3rem; color: var(--border-2); display: block; margin-bottom: 10px; }
.fempty p { font-size: 1.0625rem; margin: 0 0 12px; }

/* Collapsible details */
.field-body details.fdetails { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); margin-bottom: 12px; box-shadow: var(--shadow-1); }
.field-body details.fdetails > summary { list-style: none; cursor: pointer; padding: 14px 16px; font-weight: 600; color: var(--ink); display: flex; align-items: center; gap: 10px; min-height: 52px; }
.field-body details.fdetails > summary::-webkit-details-marker { display: none; }
.field-body details.fdetails > summary::after { content: '\F282'; font-family: 'bootstrap-icons'; margin-left: auto; color: var(--faint); transition: transform .2s; }
.field-body details.fdetails[open] > summary::after { transform: rotate(180deg); }
.field-body details.fdetails > .fdetails-body { padding: 0 16px 16px; }

/* Bottom sheet modal */
.modal.fsheet .modal-dialog { position: fixed; bottom: 0; left: 0; right: 0; margin: 0; max-width: none; width: 100%; transform: translateY(20px); transition: transform .2s ease-out; }
.modal.fsheet.show .modal-dialog { transform: none; }
.modal.fsheet .modal-content { border-radius: var(--r-lg) var(--r-lg) 0 0; padding-bottom: env(safe-area-inset-bottom, 0px); }
.modal.fsheet .modal-header { padding: 14px 16px; }
.modal.fsheet .modal-body { padding: 8px 16px 16px; }
.field-body .modal-dialog { margin: .5rem; max-width: calc(100% - 1rem); }
.field-body .modal-content { border-radius: var(--r-lg); }
.field-body .modal-title { font-size: 1.125rem; }
.field-body .modal-header .btn-close { width: 44px; height: 44px; padding: 0; margin: -8px -8px -8px auto; background-size: 1rem; }
.field-body .modal-footer .btn { flex: 1; }
.field-body .alert { font-size: 1rem; padding: 12px 14px; border-radius: var(--r); }
.field-body .list-group-item { padding: 14px 16px; }
.field-body .list-group-item-action { min-height: 56px; display: flex; align-items: center; gap: 12px; }
.field-body .badge { font-size: .8125rem; padding: .35em .7em; }
.fmeta { font-size: .875rem; color: var(--muted); }
.fdivider { height: 1px; background: var(--border); margin: 12px 0; }
.fgreeting { font-size: .9375rem; color: var(--muted); margin: 14px 0 4px; }
.fgreeting strong { color: var(--ink); }
.fstats { display: flex; gap: 8px; margin: 10px 0 4px; }
.fstat { flex: 1; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 12px 14px; text-decoration: none; color: inherit; display: flex; align-items: center; gap: 12px; }
.fstat i { font-size: 1.4rem; width: 42px; height: 42px; border-radius: var(--r); background: var(--neu-bg); color: var(--neu); display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.fstat.ok i { background: var(--ok-bg); color: var(--ok); }
.fstat.brand i { background: var(--brand-tint); color: var(--brand); }
.fstat.warn i { background: var(--warn-bg); color: var(--warn); }
.fstat .n { font-size: 1.5rem; font-weight: 800; color: var(--ink); line-height: 1; font-variant-numeric: tabular-nums; }
.fstat .l { font-size: .8125rem; color: var(--muted); font-weight: 500; }
.ftile { display: flex; align-items: center; gap: 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 14px 16px; margin-bottom: 10px; color: inherit; text-decoration: none; min-height: 64px; box-shadow: var(--shadow-1); }
.ftile:active { background: var(--subtle); }
.ftile i.ftile-icon { font-size: 1.4rem; width: 44px; height: 44px; border-radius: var(--r); background: var(--neu-bg); color: var(--neu); display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.ftile.brand i.ftile-icon { background: var(--brand-tint); color: var(--brand); }
.ftile.warn i.ftile-icon { background: var(--warn-bg); color: var(--warn); }
.ftile.ok i.ftile-icon { background: var(--ok-bg); color: var(--ok); }
.ftile.info i.ftile-icon { background: var(--info-bg); color: var(--info); }
.ftile-body { flex: 1 1 auto; min-width: 0; }
.ftile-title { font-weight: 700; color: var(--ink); font-size: 1.0625rem; }
.ftile-sub { font-size: .875rem; color: var(--muted); }
.ftile > i.bi-chevron-right { color: var(--faint); }
.ftile.danger { border-color: var(--bad-bd); }
.ftile.danger .ftile-title { color: var(--bad); }
.fsync { text-align: center; font-size: .8125rem; color: var(--faint); margin: 8px 0; }
.fsync i { margin-right: 4px; }

/* ---------- 8. Field card compatibility -------------------------------------
   Pages that still ship their own <style> for .header/.bottom-nav/.case-card
   inherit the new look through these higher-specificity rules. */
body .stats-card, body .info-card, body .task-card, body .case-card, body .history-card, body .log-card, body .project-card, body .material-card, body .generator-card { background: var(--surface) !important; border-radius: var(--r-lg) !important; box-shadow: var(--shadow-1) !important; border: 1px solid var(--border); transition: none !important; }
body .case-card, body .task-card { border-left: 5px solid var(--border-2) !important; }
body .case-card:hover, body .task-card:hover, body .case-card:active, body .task-card:active { transform: none !important; box-shadow: var(--shadow-1) !important; }
body .case-card.urgent, body .task-card.urgent, body .case-card.overdue, body .task-card.overdue { border-left-color: var(--bad) !important; background: var(--surface) !important; }
body .case-card.high, body .task-card.high { border-left-color: var(--warn) !important; background: var(--surface) !important; }
body .case-card.medium, body .task-card.medium { border-left-color: var(--border-2) !important; }
body .case-card.low, body .task-card.low { border-left-color: var(--border) !important; }
body .case-card.completed { border-left-color: var(--ok-bd) !important; }
body .case-card .case-card-header { border-left: 0 !important; }
body .info-card h6, body .stats-card h6, body .task-card h6 { font-size: .8125rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
body .action-btn { min-height: 52px; font-size: 1.0625rem; font-weight: 600; border-radius: var(--r); width: 100%; margin-bottom: 8px; display: flex; align-items: center; justify-content: center; }
body .stat-chip { min-height: 44px; border-radius: var(--r-pill); border: 1px solid var(--border-2); background: var(--surface); color: var(--text); font-weight: 600; font-size: .9375rem; }
body .stat-chip.active { background: var(--ink); border-color: var(--ink); color: #fff; }
body .stat-chip .count { background: rgba(0,0,0,.06); }
body .stat-chip.active .count { background: rgba(255,255,255,.2); color: #fff; }
body .filter-chip, body .filter-btn, body .filter-tab { min-height: 44px; border-radius: var(--r-pill); font-weight: 600; font-size: .9375rem; }
body .filter-btn.active, body .filter-tab.active { background: var(--ink) !important; color: #fff !important; border-color: var(--ink) !important; }
body .priority-header { border-radius: var(--r) !important; box-shadow: none !important; border: 1px solid var(--border); }
body .priority-header .priority-icon { background: var(--neu-bg) !important; color: var(--neu) !important; }
body .search-box input { min-height: 52px; font-size: 1.0625rem; }
body .bottom-actions { background: var(--surface); border-top: 1px solid var(--border); box-shadow: var(--shadow-up); }
body .bottom-actions .btn { min-height: 52px; font-size: 1.0625rem; }
body .status-indicator { font-weight: 600; }
body .go-btn, body .expand-btn { width: 44px; height: 44px; }
body .go-btn { background: var(--brand) !important; }

/* ---------- 9. TV mode (office/dashboard.php?tv=1) ------------------------ */
html.tv-mode .sidebar { display: none !important; }
html.tv-mode .col-md-10 { flex: 0 0 100%; max-width: 100%; width: 100%; }
html.tv-mode .stat-cards-row { gap: 1rem; }
html.tv-mode .stat-card, html.tv-mode .stat-card-compact { min-height: 100px; }
html.tv-mode .stat-card .card-body, html.tv-mode .stat-card-compact .card-body { padding: 1.25rem !important; }
html.tv-mode .stat-card h3, html.tv-mode .stat-card h4, html.tv-mode .stat-card-compact h4 { font-size: 2.5rem; }
html.tv-mode .stat-card small, html.tv-mode .stat-card-compact small { font-size: 1rem; }
html.tv-mode .stat-icon, html.tv-mode .stat-icon-sm { width: 60px; height: 60px; min-width: 60px; font-size: 1.5rem; }
html.tv-mode .table { font-size: 1.1rem; }
html.tv-mode .table thead th { font-size: .9rem; padding: 1rem; }
html.tv-mode .table tbody td { padding: .875rem; }
html.tv-mode .table .badge { font-size: .95rem; padding: .5em 1em; }
html.tv-mode .table td:last-child, html.tv-mode .table th:last-child { display: none; }
html.tv-mode .topbar { padding: 1.5rem 2rem; }
html.tv-mode .topbar h4 { font-size: 1.75rem; }
html.tv-mode .realtime-status { font-size: 1.1rem; }
html.tv-mode .btn-primary:not(.btn-sm), html.tv-mode .card-header .btn { display: none; }
html.tv-mode .p-4 { padding: 2rem !important; }
html.tv-mode .flash-update { animation: tv-flash-update 2s ease-out; }
@keyframes tv-flash-update { 0% { background-color: rgba(217, 119, 6, .5); } 100% { background-color: transparent; } }
html.tv-mode tr.new-row { animation: tv-new-row 2s ease-out; }
@keyframes tv-new-row { 0% { background-color: rgba(22, 163, 74, .3); } 100% { background-color: transparent; } }

/* ---------- 10. Print ------------------------------------------------------ */
@media print {
  .mobile-menu-btn, .sidebar-overlay, .mobile-case-card, .mobile-cards-container, .mobile-header, .sidebar, .sidebar-col, .fnav, .bottom-nav, .factions, .fh-back { display: none !important; }
  .desktop-table { display: block !important; }
  .col-md-10, .col-lg-10 { flex: 0 0 100%; max-width: 100%; }
  body { background: #fff !important; }
}

/* ---------- 10b. Print — A4 case view (unchanged from v2) ---------------- */
/* =====================================================
   PRINT STYLES - A4 Case View
   ===================================================== */

@media print {
    /* A4 page setup */
    @page {
        size: A4 portrait;
        margin: 12mm 12mm 18mm 12mm;
    }

    /* ---- Base reset ---- */
    * {
        box-shadow: none !important;
        text-shadow: none !important;
    }

    body {
        background: white !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        font-size: 10pt !important;
        line-height: 1.45 !important;
        color: #222 !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    /* ---- Hide non-printable elements ---- */
    .navbar,
    .no-print,
    .btn,
    .modal,
    .modal-backdrop,
    .alert-dismissible .btn-close,
    form[method="POST"],
    .timeline-icon,
    .card-body .d-flex.gap-1,
    .card-header .btn,
    .card .d-flex.gap-1,
    #uploadModal,
    #imagePreviewModal,
    #deleteCaseModal,
    .progress,
    video {
        display: none !important;
    }

    /* ---- Print header ---- */
    .print-header {
        display: flex !important;
        align-items: center;
        justify-content: space-between;
        border-bottom: 2.5pt solid #c0392b;
        padding-bottom: 10pt;
        margin-bottom: 14pt;
    }

    .print-header-logo {
        height: 44px;
        width: auto;
    }

    .print-header-title {
        text-align: center;
        flex: 1;
        padding: 0 16pt;
    }

    .print-header-title h1 {
        font-size: 15pt !important;
        font-weight: 700;
        margin: 0;
        color: #1a1a1a;
    }

    .print-header-title p {
        font-size: 9pt;
        color: #666;
        margin: 2pt 0 0;
    }

    .print-header-meta {
        text-align: right;
        font-size: 8.5pt;
        color: #666;
        white-space: nowrap;
    }

    .print-header-meta strong {
        display: block;
        font-size: 10.5pt;
        color: #1a1a1a;
    }

    /* ---- Container & grid: single column ---- */
    .container,
    .container-fluid {
        max-width: 100% !important;
        width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    .my-4 {
        margin-top: 0 !important;
        margin-bottom: 0 !important;
    }

    .row {
        display: flex !important;
        flex-wrap: wrap !important;
        margin: 0 !important;
    }

    .col-md-8,
    .col-md-4,
    .col-md-6,
    .col-md-12 {
        float: none !important;
        flex: 0 0 100% !important;
        max-width: 100% !important;
        width: 100% !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    /* Inner detail rows: 2-column grid */
    .card-body > .row > .col-md-6 {
        flex: 0 0 50% !important;
        max-width: 50% !important;
    }

    .card-body > .row > .col-md-4 {
        flex: 0 0 33.333% !important;
        max-width: 33.333% !important;
    }

    .card-body > .row > .col-md-12 {
        flex: 0 0 100% !important;
        max-width: 100% !important;
    }

    /* ---- Card styling ---- */
    .card {
        border: 1pt solid #bbb !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        margin-bottom: 10pt !important;
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .card-header {
        background: #f0f0f0 !important;
        color: #1a1a1a !important;
        padding: 6pt 10pt !important;
        border-bottom: 1.5pt solid #c0392b !important;
        border-radius: 0 !important;
    }

    .card-header h4,
    .card-header h5 {
        font-size: 11pt !important;
        font-weight: 700 !important;
        color: #1a1a1a !important;
        margin: 0 !important;
    }

    .card-header .d-flex {
        gap: 6pt !important;
    }

    .card-body {
        padding: 8pt 10pt !important;
    }

    /* ---- Info labels and values ---- */
    .info-label {
        font-size: 7.5pt !important;
        text-transform: uppercase;
        letter-spacing: 0.4pt;
        color: #777 !important;
        margin-bottom: 1pt !important;
        font-weight: 600 !important;
    }

    .info-value {
        font-size: 9.5pt !important;
        margin-bottom: 6pt !important;
        color: #222 !important;
    }

    /* ---- Badges ---- */
    .badge {
        border: 0.5pt solid #999 !important;
        color: #333 !important;
        background: #e8e8e8 !important;
        font-size: 8pt !important;
        padding: 1.5pt 5pt !important;
        border-radius: 2pt !important;
    }

    .card-header .badge,
    .card-header [data-status-badge] {
        font-size: 8pt !important;
        padding: 2pt 6pt !important;
    }

    /* ---- Tables (materials) ---- */
    .table-responsive {
        overflow: visible !important;
    }

    .table {
        font-size: 8.5pt !important;
        width: 100% !important;
        border-collapse: collapse !important;
    }

    .table th {
        background: #f0f0f0 !important;
        color: #1a1a1a !important;
        font-weight: 700;
        padding: 4pt 6pt !important;
        border: 0.5pt solid #bbb !important;
        font-size: 8pt !important;
    }

    .table td {
        padding: 3pt 6pt !important;
        border: 0.5pt solid #bbb !important;
    }

    /* ---- Media gallery: compact grid ---- */
    .media-thumbnail {
        width: 70px !important;
        height: 70px !important;
        border-radius: 3pt !important;
        object-fit: cover !important;
    }

    /* Media gallery columns */
    .card-body .row.g-3 {
        display: flex !important;
        flex-wrap: wrap !important;
    }

    .card-body .row.g-3 > .col-md-3 {
        flex: 0 0 25% !important;
        max-width: 25% !important;
        padding: 3pt !important;
    }

    .card-body .row.g-3 .col-md-3 .card {
        border: 0.5pt solid #ddd !important;
        margin-bottom: 3pt !important;
    }

    .card-body .row.g-3 .col-md-3 .card .card-body {
        padding: 2pt 4pt !important;
    }

    .card-body .row.g-3 .col-md-3 .card .card-body small {
        font-size: 6.5pt !important;
        line-height: 1.3 !important;
    }

    /* ---- Comments section ---- */
    #comments form.mb-4 {
        display: none !important;
    }

    .timeline {
        padding: 0 !important;
    }

    .timeline-item {
        padding-left: 0 !important;
        margin-bottom: 6pt !important;
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .timeline-item .card {
        margin-bottom: 0 !important;
        border: 0.5pt solid #ccc !important;
    }

    .timeline-item .card-body {
        padding: 5pt 8pt !important;
    }

    .timeline-item .card-body strong {
        font-size: 8.5pt !important;
    }

    .timeline-item .card-body p {
        font-size: 8.5pt !important;
        margin-bottom: 0 !important;
    }

    .timeline-item .card-body .text-muted {
        font-size: 7.5pt !important;
    }

    .timeline-item .card-body .badge {
        font-size: 6.5pt !important;
    }

    /* ---- Sidebar info card (appears after main content) ---- */
    .col-md-4 > .card {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .col-md-4 .card-header {
        background: #f0f0f0 !important;
    }

    .col-md-4 .card-body .mb-3 {
        margin-bottom: 5pt !important;
    }

    .col-md-4 .card-body strong {
        font-size: 8pt !important;
        color: #555 !important;
    }

    .col-md-4 .card-body br + * {
        font-size: 9.5pt !important;
    }

    /* ---- Links ---- */
    a {
        color: #222 !important;
        text-decoration: none !important;
    }

    /* ---- Horizontal rules ---- */
    hr {
        border-color: #ccc !important;
        margin: 6pt 0 !important;
    }

    /* ---- Section headings inside cards ---- */
    .card-body h5 {
        font-size: 10pt !important;
        font-weight: 700 !important;
        margin-bottom: 6pt !important;
    }

    /* ---- Alerts ---- */
    .alert {
        border: 0.5pt solid #ccc !important;
        background: #fafafa !important;
        color: #222 !important;
        padding: 5pt 8pt !important;
        font-size: 8.5pt !important;
        border-radius: 0 !important;
    }

    /* ---- Print-only info summary table ---- */
    .print-info-summary {
        display: block !important;
        margin-bottom: 10pt;
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .print-info-summary .table {
        font-size: 8.5pt !important;
        margin-bottom: 0 !important;
    }

    .print-info-summary .table th {
        background: #f0f0f0 !important;
        font-size: 7.5pt !important;
        text-transform: uppercase;
        letter-spacing: 0.3pt;
        color: #555 !important;
        width: 20% !important;
        white-space: nowrap;
    }

    .print-info-summary .table td {
        font-size: 9pt !important;
    }

    /* ---- Hide sidebar info card in print (duplicate of print-info-summary) ---- */
    .col-md-4 > .card.shadow {
        display: none !important;
    }

    /* ---- Print footer ---- */
    .print-footer {
        display: block !important;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        text-align: center;
        font-size: 7.5pt;
        color: #aaa;
        border-top: 0.5pt solid #ddd;
        padding-top: 3pt;
    }
}

/* ---------- 11. Office pages with a top navbar instead of the sidebar ------- */
.navbar, .navbar.bg-primary, .navbar.bg-dark { background: var(--surface) !important; border-bottom: 1px solid var(--border); border-top: 3px solid var(--brand-line); padding: .625rem 1rem; box-shadow: var(--shadow-1); }
.navbar-dark .navbar-brand, .navbar-dark .navbar-text, .navbar-dark .navbar-nav .nav-link, .navbar .text-white { color: var(--ink) !important; }
.navbar-brand { font-weight: 600; font-size: 1rem; gap: 8px; }
.navbar-brand img { height: 32px; }
.navbar .btn-light { background: var(--surface); border-color: var(--border-2); color: var(--text); }
.navbar .btn-outline-light { color: var(--text); border-color: var(--border-2); }
.navbar .btn-outline-light:hover, .navbar .btn-light:hover { background: var(--hover); color: var(--ink); }

/* ---------- 12. Field job page (case_work) ---------------------------------- */
.field-body .photo-card { position: relative; border-radius: var(--r); overflow: hidden; border: 1px solid var(--border); background: var(--hover); }
.field-body .photo-wrapper { position: relative; aspect-ratio: 1 / 1; cursor: pointer; background: var(--hover); }
.field-body .photo-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.field-body .photo-overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 1.5rem; opacity: 0; background: rgba(17, 24, 39, .25); transition: opacity .15s; }
.field-body .photo-wrapper:active .photo-overlay { opacity: 1; }
.field-body .photo-info { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 6px 8px; background: var(--surface); font-size: .75rem; font-weight: 600; color: var(--muted); min-height: 38px; }
.field-body .photo-stage { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.field-body .btn-delete-photo { width: 32px; height: 32px; border-radius: 50%; border: 0; background: var(--bad-bg); color: var(--bad); display: inline-flex; align-items: center; justify-content: center; padding: 0; flex: 0 0 auto; font-size: .9rem; }
.field-body .material-item { display: flex; flex-direction: column; gap: 2px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.field-body .material-item:last-child { border-bottom: 0; }
.field-body .material-item strong { font-size: 1.0625rem; color: var(--ink); }
.field-body .fsheet-list .btn { justify-content: flex-start; text-align: left; min-height: 56px; font-size: 1.0625rem; }
.field-body .fsheet-list .btn i { width: 34px; font-size: 1.3rem; text-align: center; }
.field-body .fstage .btn { min-height: 44px; font-size: .9375rem; padding: .375rem .875rem; }
.field-body details.fdetails > summary .ms-auto { margin-left: auto; }
.spin-icon { display: inline-block; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.fhero-actions.single { grid-template-columns: 1fr; }

/* ---------- 13. Field portal — senior overrides (2026-09-26 accessibility pass)
   Users are 60+ technicians outdoors. Floors: helper text ≥ 16px, status ≥ 15px,
   targets ≥ 44px, AA contrast on every tint. Scoped to body.field-body only. */
body.field-body { --muted: #4B5563; --faint: #6B7280; }
.field-body .text-muted   { color: var(--muted) !important; }
.field-body .text-success { color: var(--ok) !important; }
.field-body .text-warning { color: var(--warn) !important; }
.field-body .text-info    { color: var(--info) !important; }
.field-body .form-control::placeholder { color: var(--faint); }
.field-body .fnote .fmeta, .field-body .fhint .fmeta { color: inherit; opacity: .9; }
.fsync, .tap-hint { color: var(--muted); }

/* Helper text: 16px */
.field-body small, .field-body .small, .fmeta, .ftile-sub, .frow-meta, .fcomment-head,
.fphoto-add, .fsync, .fstat .l, .factions-note, .fgreeting, .tap-hint,
.task-card small, .totals-strip, .remove-btn, .status-badge { font-size: 1rem; }
/* Labels, chips and buttons: 17px like the body */
.field-body .btn, .field-body .form-label, .fchip, .fpill-lg, .fcomment-head strong, .field-body .fstage .btn { font-size: 1.0625rem; }
/* Status vocabulary: 15px, darker */
.field-body .badge, .fpill, .fjob-code, .fh-sub, .fchip .n, .fchip .badge { font-size: .9375rem; }
.field-body .badge { padding: .4em .8em; }
.fjob-code { color: var(--text); }
.fkv-label { font-size: .9375rem; text-transform: none; letter-spacing: 0; font-weight: 600; }
/* Section titles in sentence case: uppercase Greek drops its accents and word shape */
.fcard-title, .fsection { font-size: 1.0625rem; text-transform: none; letter-spacing: 0; color: var(--ink); }
.fcard-title .count, .fsection .count { font-size: .9375rem; }
.field-body .photo-info { font-size: .9375rem; min-height: 48px; }
.fphoto-tag { font-size: .875rem; padding: 4px 8px; }
.fnav-badge { font-size: .8125rem; min-width: 20px; height: 20px; }
.fnav-item { font-size: .875rem; padding: 6px 2px; }

/* Targets: 44px minimum */
.field-body .btn-sm { min-height: 44px; min-width: 44px; padding: .5rem .875rem; font-size: 1rem; }
.field-body .btn-delete-photo { width: 44px; height: 44px; font-size: 1.1rem; }
.fsearch .clear-btn { width: 48px; height: 48px; right: 4px; font-size: 1.25rem; color: var(--muted); }
.field-body .form-check { min-height: 48px; display: flex; align-items: center; }
.field-body .form-check-label { flex: 1 1 auto; padding: 10px 0 10px .5rem; }
.field-body .progress-widget details > summary, .field-body details.small > summary { min-height: 44px; display: flex; align-items: center; font-size: 1rem; }
.field-body .toast .btn-close { width: 44px; height: 44px; padding: 0; }

/* Narrow phones (360/320px) */
.factions .btn-more { padding: 0 12px; font-size: 1rem; }
.fhero-actions .btn { padding-left: .5rem; padding-right: .5rem; }
@media (max-width: 339px) { .fhero-actions .btn i { display: none; } }
.field-body .btn-check + .btn { white-space: normal; line-height: 1.2; }

/* Status vs priority: priority is a square tag, status a pill */
.priority-badge { border-radius: 4px !important; }
.badge.bg-light { border: 1px solid var(--border-2); }

