/* ==========================================================================
   IT INFINITY Service Portal — "Tide" theme
   Brings the portal in line with itinfinity.co.uk: mist & sea teal palette,
   Bricolage Grotesque / Hanken Grotesk / Geist Mono, pill buttons, soft
   oversized radii, petrol feature panels and the infinity loop motif.

   Loaded AFTER styles.css on every page. It re-maps the existing design
   tokens (so every component that already uses var(--…) picks the theme up
   automatically) and then reshapes components. Dark mode keeps working via
   [data-theme="dark"] with a "Tide at night" palette.
   ========================================================================== */

/* ---------- Tokens (light) ---------- */
:root {
  /* Tide raw palette */
  --t-mist: #EAF1F0;
  --t-mist-2: #E3EEEC;
  --t-surface: #F7FAF9;
  --t-white: #FFFFFF;
  --t-sea: #D6E7E4;
  --t-sea-2: #C9DEDB;
  --t-sea-3: #DCE9E7;
  --t-sea-4: #D9EEEA;
  --t-ink: #16343A;
  --t-muted: #4A666B;
  --t-accent: #0B6E73;
  --t-accent-hover: #085A5E;
  --t-aqua: #5BD1C1;
  --t-aqua-soft: #8FE3D6;
  --t-petrol: #1E5157;
  --t-petrol-2: #2D6F72;
  --t-petrol-3: #3F8A86;
  --t-on-petrol: #CFE3E1;
  --t-sand: #F2E6D7;
  --t-sand-ink: #7A4B12;
  --t-ink-rgb: 22, 52, 58;
  --t-glow-rgb: 91, 209, 193;
  --t-surface-rgb: 247, 250, 249;

  --f-display: 'Bricolage Grotesque', 'Hanken Grotesk', system-ui, sans-serif;
  --f-body: 'Hanken Grotesk', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --f-mono: 'Geist Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
  --ease: cubic-bezier(.22, 1, .36, 1);

  --r-sm: 14px;
  --r-md: 22px;
  --r-lg: 28px;

  /* Portal tokens re-mapped onto Tide */
  --primary: var(--t-accent);
  --primary-dark: var(--t-accent-hover);
  --on-primary: #FFFFFF;
  --secondary: var(--t-muted);
  --accent: var(--t-aqua);
  --success: #0D6B52;
  --success-hover: #0A5843;
  --danger: #B4412F;
  --danger-hover: #93321F;
  --warning: #C08417;
  --warning-hover: #8A5A00;
  --background: var(--t-mist);
  --surface: var(--t-surface);
  --surface-hover: #EEF5F4;
  --surface-muted: #F0F6F5;
  --surface-muted-alt: #F3F8F7;
  --surface-subtle: #EFF5F4;
  --surface-selected: var(--t-sea-3);
  --text-primary: var(--t-ink);
  --text-secondary: var(--t-muted);
  --text-muted: #7C9599;
  --border: rgba(22, 52, 58, .12);
  --border-light: rgba(22, 52, 58, .07);
  --calendar-google: #2F6FB0;

  --badge-green-bg: #D9F1EA;  --badge-green-text: #0D6B52;
  --badge-blue-bg: #D9EEEA;   --badge-blue-text: #0B5F63;  --badge-blue-border: #B4D9D3;
  --badge-amber-bg: #F2E6D7;  --badge-amber-text: #7A4B12; --badge-amber-border: #E6CFB2;
  --badge-red-bg: #FBE9E6;    --badge-red-text: #8A2A1B;   --badge-red-border: #F0C2B9;
  --badge-indigo-bg: #D3DFEE; --badge-indigo-text: #2F4A6B;
  --badge-pink-bg: #F2DFC9;   --badge-pink-text: #7A4B12;

  --shadow-sm: 0 14px 34px -22px rgba(22, 52, 58, .40);
  --shadow-md: 0 30px 60px -30px rgba(22, 52, 58, .38);
  --shadow-lg: 0 30px 60px -28px rgba(22, 52, 58, .45);
  --shadow-xl: 0 40px 80px -32px rgba(22, 52, 58, .50);

  --nav-glass: rgba(247, 250, 249, .80);
  --input-bg: #FFFFFF;
  --input-border: #CFDEDB;
  --input-border-hover: #9FBDB8;
  --loop-stroke: rgba(22, 52, 58, .10);
}

/* ---------- Tokens (dark — "Tide at night") ---------- */
[data-theme="dark"] {
  --primary: #5BD1C1;
  --primary-dark: #8FE3D6;
  --on-primary: #06272A;
  --secondary: #9DB7B4;
  --accent: #5BD1C1;
  --success: #5FD3AE;
  --success-hover: #7FE0C2;
  --danger: #F08C7C;
  --danger-hover: #F5A99C;
  --warning: #E9B85C;
  --warning-hover: #F2D19A;
  --background: #0B1D20;
  --surface: #12292D;
  --surface-hover: #183236;
  --surface-muted: #10252A;
  --surface-muted-alt: #0F2327;
  --surface-subtle: #10262A;
  --surface-selected: #173A3B;
  --text-primary: #E6F0EE;
  --text-secondary: #9DB7B4;
  --text-muted: #6F8C89;
  --border: rgba(207, 227, 225, .12);
  --border-light: rgba(207, 227, 225, .07);
  --calendar-google: #7FB2E5;

  --badge-green-bg: #0F3A2F;  --badge-green-text: #7FE0C2;
  --badge-blue-bg: #133B3D;   --badge-blue-text: #8FE3D6;  --badge-blue-border: #1F5254;
  --badge-amber-bg: #3A2B16;  --badge-amber-text: #F2D19A; --badge-amber-border: #5A4120;
  --badge-red-bg: #40201B;    --badge-red-text: #F5A99C;   --badge-red-border: #6A3027;
  --badge-indigo-bg: #1C2B3D; --badge-indigo-text: #B3C7E6;
  --badge-pink-bg: #3A2B16;   --badge-pink-text: #F2D19A;

  --shadow-sm: 0 14px 34px -22px rgba(0, 0, 0, .7);
  --shadow-md: 0 30px 60px -30px rgba(0, 0, 0, .7);
  --shadow-lg: 0 30px 60px -28px rgba(0, 0, 0, .75);
  --shadow-xl: 0 40px 80px -32px rgba(0, 0, 0, .8);

  --nav-glass: rgba(18, 41, 45, .82);
  --input-bg: #0F2327;
  --input-border: rgba(207, 227, 225, .16);
  --input-border-hover: rgba(207, 227, 225, .28);
  --loop-stroke: rgba(207, 227, 225, .07);
}

/* ---------- Base ---------- */
html { scroll-padding-top: 110px; }
body {
  font-family: var(--f-body);
  font-size: 16px;
  color: var(--text-primary);
  background: var(--background);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button, input, select, textarea { font-family: inherit; }
h1, h2, h3, h4, .page-header h2, .card-header h3, .welcome-card h2, .cp-practice,
.cp-panel-head h2, .cp-dialog-head h3, .service-due-modal-header h3, .modal-header h3,
.practice-map-header h3, .quick-actions h3, .login-content h2, .logo-section h1 {
  font-family: var(--f-display);
  font-weight: 600;
  letter-spacing: -.025em;
}
:focus-visible { outline: 3px solid var(--t-aqua); outline-offset: 3px; border-radius: 8px; }
::selection { background: var(--t-aqua-soft); color: var(--t-ink); }
code, kbd, .cp-req-ref, .cp-label, .sb-date small { font-family: var(--f-mono); }

/* Mono "eyebrow" labels, as on the website */
.cp-hello, .cp-label, .cp-choice-label, .cp-tile-label, .stat-label, .role-badge,
.users-table th, .devices-table th, .zoho-runs th, .cp-cal .dow, .sb-date small,
.info-card h4, .divider span {
  font-family: var(--f-mono);
  font-weight: 500;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.cp-tile-label, .stat-label { letter-spacing: .08em; font-size: 12px; }

/* ---------- Brand ---------- */
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  color: var(--text-primary); text-decoration: none; flex: none;
}
.brand__mark { width: 40px; height: 20px; overflow: visible; }
.brand__mark .base { stroke: currentColor; }
.brand__mark .prog { stroke: var(--t-aqua); stroke-dasharray: 14 86; animation: tide-dash 5s linear infinite; }
.brand__name { font-family: var(--f-display); font-weight: 700; font-size: 17px; letter-spacing: -.01em; white-space: nowrap; }
.logo-section .brand { margin-bottom: 26px; }
.logo-section .brand__mark { width: 56px; height: 28px; }
.logo-section .brand__name { font-size: 22px; }
@keyframes tide-dash { to { stroke-dashoffset: -100; } }

/* ---------- Navigation: floating glass pill ---------- */
.navbar {
  position: sticky; top: 14px; z-index: 1000;
  margin: 14px 16px 0; padding: 10px 10px 10px 22px;
  border-radius: 999px;
  background: var(--nav-glass);
  backdrop-filter: blur(18px) saturate(150%); -webkit-backdrop-filter: blur(18px) saturate(150%);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.navbar .navbar-brand { gap: 14px; }
.role-badge {
  font-size: 11px; padding: 6px 12px; border-radius: 999px;
  background: var(--t-sea-4); color: var(--primary); border: 0;
}
[data-theme="dark"] .role-badge { background: #133B3D; color: #8FE3D6; }
.role-badge-staff { background: var(--t-petrol); color: #CFE3E1; }
[data-theme="dark"] .role-badge-staff { background: #1E5157; color: #CFE3E1; }
.user-info { gap: 10px; }
.user-details { border-right-color: var(--border) !important; }
.user-name { font-weight: 600; }
.logout-btn {
  border-radius: 999px; padding: 11px 18px;
  background: var(--primary); color: var(--on-primary); border: 0;
  font-weight: 600; box-shadow: none;
}
.logout-btn:hover { background: var(--primary-dark); color: var(--on-primary); transform: none; box-shadow: 0 18px 34px -16px rgba(11, 110, 115, .65); }
.theme-toggle {
  width: 42px; height: 42px; border-radius: 50%;
  background: var(--surface-selected); border: 0; color: var(--text-primary);
}
.theme-toggle:hover { background: var(--t-sea-2); }
[data-theme="dark"] .theme-toggle:hover { background: #1F4A4B; }
@media (max-width: 980px) {
  .navbar { border-radius: 26px; padding: 14px 16px; }
}

/* ---------- Layout ---------- */
.dashboard-content { padding-top: 32px; }
.page-header h2 { font-size: clamp(28px, 3.4vw, 40px); letter-spacing: -.03em; }

/* ---------- Buttons: pills ---------- */
.btn-primary, .btn-secondary, .btn, .cp-btn, .login-btn, .sso-login-btn,
.practice-map-popup button, .btn-resend {
  border-radius: 999px !important;
  font-weight: 600;
  transition: transform .5s var(--ease), background-color .3s, color .3s, box-shadow .4s, border-color .3s;
}
.btn-primary, .cp-btn-primary, .login-btn, .btn.btn-primary {
  background: var(--primary); color: var(--on-primary); border-color: transparent;
}
.btn-primary:hover, .cp-btn-primary:hover:not(:disabled), .login-btn:hover, .btn.btn-primary:hover {
  background: var(--primary-dark) !important; color: var(--on-primary);
  box-shadow: 0 18px 34px -16px rgba(11, 110, 115, .7); transform: none;
}
.btn-primary:active, .cp-btn:active, .login-btn:active { scale: .97; }
.btn-secondary, .cp-btn-ghost, .btn.btn-secondary {
  background: rgba(var(--t-surface-rgb), .85); color: var(--text-primary); border: 1px solid var(--border);
}
[data-theme="dark"] .btn-secondary, [data-theme="dark"] .cp-btn-ghost, [data-theme="dark"] .btn.btn-secondary { background: var(--surface); }
.btn-secondary:hover, .cp-btn-ghost:hover:not(:disabled), .btn.btn-secondary:hover {
  background: var(--surface-selected); color: var(--text-primary); border-color: var(--border);
}
.cp-btn-primary { box-shadow: none; }
.cp-btn { padding: 12px 20px; }
.cp-btn-sm { padding: 8px 14px; }
.login-btn { padding: 15px; font-size: 16px; margin-top: 14px; }
.sso-login-btn { padding: 14px 24px; background: var(--surface); border: 1px solid var(--border); }
.sso-login-btn:hover { background: var(--surface-selected); border-color: var(--border); transform: none; box-shadow: none; }
.btn-icon { border-radius: 12px; }

/* ---------- Cards & panels ---------- */
.card, .cp-panel, .practice-map-card, .welcome-card, .stat-card, .cp-tile, .action-card,
.service-due-modal-content, .modal-content, .practice-modal-content, .device-modal-content,
.cp-dialog, #srActModalBox, .info-card, .stat-box {
  border-radius: var(--r-lg) !important;
  border: 1px solid var(--border-light);
  background: var(--surface);
  box-shadow: none;
}
.card, .cp-panel, .practice-map-card { overflow: hidden; }
.card-header, .cp-panel-head { border-bottom: 1px solid var(--border-light); background: transparent; }
.card-header h3, .cp-panel-head h2 { font-size: 20px; }
.cp-panel-head h2 i, .card-header h3 i { color: var(--primary); }

/* Stat cards: big display numbers, lift on hover */
.stat-card, .cp-tile { transition: transform .6s var(--ease), box-shadow .6s; }
.stat-card:hover, .clickable-stat-card:hover { transform: translateY(-6px) !important; box-shadow: var(--shadow-md) !important; }
.stat-value, .cp-tile-value, .stat-box .stat-value {
  font-family: var(--f-display); font-weight: 600; letter-spacing: -.04em;
  font-variant-numeric: tabular-nums;
}
.stat-value { font-size: 40px; }
.cp-tile-value { font-size: 40px; }
.stat-icon { border-radius: 16px; }

/* Quick actions = website "fcard" tiles */
.action-card { padding: 28px; transition: transform .6s var(--ease), box-shadow .6s; }
.action-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-md); border-color: var(--border-light); }
.action-card i {
  width: 54px; height: 54px; border-radius: 16px; display: grid !important; place-items: center;
  background: var(--t-sea-4); color: var(--primary); font-size: 22px;
  transition: transform .6s var(--ease), background .4s, color .4s;
}
[data-theme="dark"] .action-card i { background: #133B3D; }
.action-card:hover i { transform: rotate(-8deg) scale(1.08); background: var(--primary); color: var(--on-primary); }
.action-card h4 { font-family: var(--f-display); font-size: 20px; letter-spacing: -.02em; }

/* ---------- Petrol feature panels (hero areas) ---------- */
.cp-hero, .welcome-card {
  position: relative; overflow: hidden; isolation: isolate;
  border: 0 !important;
  background: linear-gradient(140deg, var(--t-petrol) 0%, var(--t-petrol-2) 58%, var(--t-petrol-3) 100%) !important;
  color: #fff;
  padding: clamp(28px, 4vw, 44px) clamp(24px, 4vw, 44px);
}
.cp-hero::after, .welcome-card::after {
  content: ''; position: absolute; z-index: -1; pointer-events: none;
  right: -140px; bottom: -150px; width: 620px; height: 310px; opacity: .9;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 100'%3E%3Cpath d='M100 50C125 15 185 15 185 50C185 85 125 85 100 50C75 15 15 15 15 50C15 85 75 85 100 50Z' fill='none' stroke='rgba(255,255,255,.12)' stroke-width='3'/%3E%3Cpath d='M100 50C125 15 185 15 185 50C185 85 125 85 100 50C75 15 15 15 15 50C15 85 75 85 100 50Z' fill='none' stroke='%238FE3D6' stroke-width='3' stroke-linecap='round' pathLength='100' stroke-dasharray='12 88'%3E%3Canimate attributeName='stroke-dashoffset' from='0' to='-100' dur='6s' repeatCount='indefinite'/%3E%3C/path%3E%3C/svg%3E") center / contain no-repeat;
}
.cp-hero::before, .welcome-card::before {
  content: ''; position: absolute; z-index: -1; pointer-events: none; inset: 0;
  background: radial-gradient(520px circle at 85% 0%, rgba(var(--t-glow-rgb), .28), transparent 60%);
}
.cp-hello, .welcome-card .info-badge { color: var(--t-aqua-soft) !important; }
.cp-practice, .welcome-card h2 { color: #fff; font-size: clamp(30px, 4vw, 48px); line-height: 1.02; letter-spacing: -.035em; }
.cp-practice-meta, .welcome-card p { color: var(--t-on-petrol) !important; }
.welcome-card h2 { margin-bottom: 10px; }
.welcome-card .info-badge {
  background: rgba(255, 255, 255, .12) !important; border: 1px solid rgba(255, 255, 255, .2);
  border-radius: 999px; font-family: var(--f-mono); font-size: 12px; letter-spacing: .1em; text-transform: uppercase;
}
.cp-hero .cp-btn-primary {
  background: var(--t-surface) !important; color: var(--t-ink) !important;
}
.cp-hero .cp-btn-primary:hover:not(:disabled) { background: #fff !important; box-shadow: 0 18px 34px -16px rgba(0, 0, 0, .45); }

/* ---------- Pills & badges ---------- */
.pill, .badge, .service-badge, .days-badge, .sync-pill, .invite-badge, .flag-chip {
  border-radius: 999px !important;
  font-weight: 600;
}
.pill { font-size: 12px; padding: 5px 11px; }
.badge { font-size: 12px; }

/* ---------- Forms ---------- */
.form-group input, .form-group select, .form-group textarea,
.login-form input, .cp-input, .cp-textarea, .cp-select,
.practice-filters input, .practice-filters select, #srFilter,
.modal input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
.modal select, .modal textarea {
  border-radius: var(--r-sm) !important;
  border: 1.5px solid var(--input-border) !important;
  background: var(--input-bg) !important;
  color: var(--text-primary);
  font-size: 15px;
  transition: border-color .3s, box-shadow .3s;
}
.login-form input, .form-group input, .form-group select, .cp-input, .cp-select { padding: 13px 15px; }
.form-group input:hover, .login-form input:hover, .cp-input:hover, .cp-textarea:hover, .cp-select:hover { border-color: var(--input-border-hover) !important; }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus,
.login-form input:focus, .cp-input:focus, .cp-textarea:focus, .cp-select:focus,
.modal input:focus, .modal select:focus, .modal textarea:focus {
  outline: none; border-color: var(--primary) !important;
  box-shadow: 0 0 0 4px rgba(var(--t-glow-rgb), .3) !important;
}
.form-group label, .login-form label { font-weight: 600; font-size: 14px; }
.alert { border-radius: var(--r-sm); }

/* ---------- Tables ---------- */
.users-table, .devices-table, .data-table { border-collapse: separate; border-spacing: 0; }
.users-table thead, .devices-table thead, .data-table thead { background: transparent; }
.users-table th, .devices-table th, .data-table th {
  font-size: 11px; color: var(--text-secondary); background: var(--surface-subtle);
  border-bottom: 1px solid var(--border) !important;
}
.users-table th:first-child, .devices-table th:first-child { border-top-left-radius: 12px; }
.users-table th:last-child, .devices-table th:last-child { border-top-right-radius: 12px; }
.users-table td, .devices-table td { border-bottom: 1px solid var(--border-light) !important; }
.users-table tbody tr:hover, .devices-table tbody tr:hover { background: var(--surface-hover) !important; }

/* ---------- Modals ---------- */
.cp-modal, .service-due-modal, .modal, #srActOverlay { backdrop-filter: blur(4px); }
.cp-modal { background: rgba(var(--t-ink-rgb), .45); }
.cp-dialog { box-shadow: var(--shadow-xl); }
.cp-dialog-head h3 { font-size: 22px; }

/* ---------- Customer portal details ---------- */
.cp-wrap { max-width: 1240px; }
.cp-alert { border-radius: var(--r-md); }
.cp-tile { padding: 20px 22px; }
.cp-unit-name, .cp-req-title, .cp-pick-name { font-family: var(--f-display); font-weight: 600; letter-spacing: -.01em; font-size: 16px; }
.cp-pick, .cp-choice, .sb-date, .sb-opt { border-radius: 18px; }
.cp-day { border-radius: 12px; font-family: var(--f-display); }
.cp-day.avail { background: var(--surface); }
.cp-day .dots i { background: #1FA38F; }
[data-theme="dark"] .cp-day .dots i { background: var(--t-aqua); }
.cp-day.sel-pref { background: var(--primary); color: var(--on-primary); }
.cp-callout { border-radius: 16px; }
.cp-req-filter { border-radius: 999px; padding: 4px; }
.cp-req-filter button { border-radius: 999px; padding: 6px 12px; }
.cp-step.active::before { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.cp-step.done::before, .cp-step.done::after { border-color: #1FA38F; color: #1FA38F; }
.cp-step.done::after { background: #1FA38F; }
.cp-toast { border-radius: 999px; background: var(--t-petrol); color: #fff; }
.cp-link, .sb-hint a { color: var(--primary); }

/* ---------- Staff panels ---------- */
.sb-count { background: var(--danger); }
.sb-card { padding: 22px 26px; }
.sb-practice { font-family: var(--f-display); font-size: 18px; letter-spacing: -.02em; }
.practice-map-card #practiceMap { border-radius: 0 0 var(--r-lg) var(--r-lg); }
.zoho-stats div { border-radius: 999px; padding: 8px 16px; }
.zoho-stats span { font-family: var(--f-display); }

/* ---------- Login / password pages ---------- */
.login-wrapper {
  position: relative; overflow: hidden; isolation: isolate;
  background:
    radial-gradient(640px circle at 72% 30%, rgba(var(--t-glow-rgb), .30), rgba(var(--t-glow-rgb), 0) 62%),
    linear-gradient(180deg, var(--t-mist-2) 0%, var(--t-mist) 100%);
}
[data-theme="dark"] .login-wrapper {
  background:
    radial-gradient(640px circle at 72% 30%, rgba(var(--t-glow-rgb), .14), rgba(var(--t-glow-rgb), 0) 62%),
    linear-gradient(180deg, #0E2326 0%, #0B1D20 100%);
}
.login-wrapper::before {
  content: ''; position: absolute; z-index: -1; pointer-events: none;
  left: 50%; top: 52%; width: min(1400px, 150vw); aspect-ratio: 2 / 1; transform: translate(-50%, -50%);
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 100'%3E%3Cpath d='M100 50C125 15 185 15 185 50C185 85 125 85 100 50C75 15 15 15 15 50C15 85 75 85 100 50Z' fill='none' stroke='%23CBDEDB' stroke-width='1.2'/%3E%3Cpath d='M100 50C125 15 185 15 185 50C185 85 125 85 100 50C75 15 15 15 15 50C15 85 75 85 100 50Z' fill='none' stroke='%235BD1C1' stroke-width='1.2' stroke-linecap='round' pathLength='100' stroke-dasharray='10 90'%3E%3Canimate attributeName='stroke-dashoffset' from='0' to='-100' dur='7s' repeatCount='indefinite'/%3E%3C/path%3E%3C/svg%3E") center / contain no-repeat;
  opacity: .7;
}
[data-theme="dark"] .login-wrapper::before { opacity: .25; }
.login-box {
  border-radius: var(--r-lg); border: 1px solid var(--border-light);
  background: rgba(var(--t-surface-rgb), .92);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  box-shadow: var(--shadow-md);
}
[data-theme="dark"] .login-box { background: rgba(18, 41, 45, .92); }
.logo-section { background: transparent; border-bottom: 1px solid var(--border-light); padding: 40px 32px 28px; }
.logo-section h1 { font-size: 34px; letter-spacing: -.035em; }
.logo-section p { font-family: var(--f-mono); font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--primary); }
.login-content { padding: 34px 32px 36px; }
.login-content h2 { font-size: 24px; }
.login-footer { background: transparent; border-top: 1px solid var(--border-light); }
.login-error { border-radius: var(--r-sm); }
.divider::before, .divider::after { border-color: var(--border); }

/* ---------- Leaflet ---------- */
.leaflet-popup-content-wrapper { border-radius: 18px !important; }

/* ---------- Motion safety ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

/* ---------- Late adjustments ---------- */
.stats-grid { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)) !important; gap: 16px; }
[data-theme="dark"] .cp-hero, [data-theme="dark"] .welcome-card {
  background: linear-gradient(140deg, #133A3F 0%, #1E5157 58%, #2D6F72 100%) !important;
}
[hidden] { display: none !important; }
.users-table td.actions { display: table-cell !important; white-space: nowrap; }
.users-table td.actions form + form, .users-table td.actions form + span { margin-left: 6px; }

/* ---------- Phone header: logo, tag and menu on one line, search underneath ---------- */
.nav-burger { display: none; width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--surface-selected); color: var(--text-primary); place-items: center; font-size: 17px; cursor: pointer; flex: none; }
.nav-sheet { position: fixed; inset: 0; z-index: 2000; background: rgba(10, 30, 32, .38); }
.nav-sheet[hidden] { display: none; }
.nav-sheet-panel { position: absolute; top: 10px; left: 10px; right: 10px; max-width: 420px; margin-left: auto; background: var(--surface); border-radius: 22px; padding: 18px; box-shadow: 0 24px 60px rgba(0, 0, 0, .25); }
.nav-sheet-x { position: absolute; top: 14px; right: 14px; width: 38px; height: 38px; border-radius: 50%; border: 0; background: var(--surface-selected); color: var(--text-primary); cursor: pointer; }
.nav-sheet-who { display: flex; gap: 12px; align-items: center; padding: 2px 46px 14px 0; border-bottom: 1px solid var(--border-light); }
.nav-sheet-who b { display: block; color: var(--text-primary); } .nav-sheet-who small { display: block; color: var(--text-secondary); font-size: 13px; overflow-wrap: anywhere; }
.nav-sheet-av { width: 44px; height: 44px; border-radius: 50%; background: var(--surface-selected); display: grid; place-items: center; font-weight: 700; color: var(--primary); flex: none; }
.nav-sheet-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 14px 6px; border: 0; border-bottom: 1px solid var(--border-light); background: none; font: inherit; font-size: 15px; font-weight: 600; color: var(--text-primary); text-decoration: none; cursor: pointer; text-align: left; }
.nav-sheet-row i { width: 20px; color: var(--primary); text-align: center; }
.nav-sheet-sw { margin-left: auto; width: 44px; height: 26px; border-radius: 99px; background: var(--surface-selected); position: relative; }
.nav-sheet-sw::after { content: ""; position: absolute; left: 3px; top: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--text-secondary); transition: transform .2s; }
[data-theme="dark"] .nav-sheet-sw { background: var(--primary); } [data-theme="dark"] .nav-sheet-sw::after { transform: translateX(18px); background: #fff; }
.nav-sheet-out { display: flex; justify-content: center; align-items: center; gap: 10px; margin-top: 16px; padding: 13px; border-radius: 999px; background: var(--primary); color: var(--on-primary) !important; font-weight: 600; text-decoration: none; }
html.nav-open { overflow: hidden; }

@media (max-width: 760px) {
  .navbar { display: grid !important; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; flex-direction: row !important;
            border-radius: 22px !important; padding: 10px 10px 10px 16px !important; margin: 10px 10px 0 !important; top: 8px !important; }
  .navbar .navbar-brand { width: auto !important; justify-content: flex-start !important; gap: 10px; min-width: 0; }
  .navbar .navbar-brand .brand__name { font-size: 15px; }
  .navbar .role-badge { font-size: 10px; padding: 5px 9px; white-space: nowrap; }
  .navbar .user-info { display: none !important; }
  .nav-burger { display: grid; grid-column: 2; grid-row: 1; }
  .navbar .global-search-container { grid-column: 1 / -1; grid-row: 2; width: 100% !important; max-width: none !important; margin: 0 !important; }
  /* Section tabs: one line that scrolls sideways */
  .sx-bar { padding: 0 10px !important; margin-top: 12px !important; flex-wrap: nowrap !important; }
  .sx-tabs { flex-wrap: nowrap !important; overflow-x: auto; max-width: 100%; scrollbar-width: none; flex: 1 1 auto; min-width: 0; }
  .sx-tabs::-webkit-scrollbar { display: none; }
  .sx-tab { white-space: nowrap; }
  .sx-right .sx-settings[href="settings.php"] { display: none; }
}

/* Wide tables and boards scroll inside their card instead of widening the page */
.tk-wrap > *, .tk-main, .tk-split > *, .sl-main > *, .sl-aside > *, .sl-sec, .tk-card, .jb-wrap > *, .pr-wrap > * { min-width: 0; max-width: 100%; }
.tk-wrap { max-width: 100%; box-sizing: border-box; }
@media (max-width: 760px) {

  .tk-wrap, .jb-wrap { padding-left: 12px !important; padding-right: 12px !important; }
}
/* Hidden screen-reader labels inside scrolling tables stay inside them (otherwise phones zoom out) */
.tk-table-wrap, .sl-table-wrap, .sl-lines-wrap, .sl-board-wrap, .rp-table-wrap, .pr-card { position: relative; }
