/* ==========================================================================
   EPC Malta – Main Stylesheet
   Design tokens, typography, layout, utilities
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Google Fonts Import
   -------------------------------------------------------------------------- */
@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700&display=swap');

/* --------------------------------------------------------------------------
   2. CSS Custom Properties (Design Tokens)
   -------------------------------------------------------------------------- */
:root {
  /* Brand colours */
  --color-primary:            #1e3a5f;
  --color-primary-light:      #2d5a8f;
  --color-primary-dark:       #152a45;
  --color-primary-fg:         #ffffff;

  --color-secondary:          #8fbc3f;
  --color-secondary-light:    #a3d44d;
  --color-secondary-dark:     #6e9430;
  --color-secondary-fg:       #0f1a04;

  --color-destructive:        #d4183d;
  --color-destructive-fg:     #ffffff;

  /* Neutrals */
  --color-bg:                 #ffffff;
  --color-fg:                 #1e293b;
  --color-muted:              #f1f5f9;
  --color-muted-fg:           #475569;
  --color-border:             rgba(30, 58, 95, 0.15);
  --color-input-bg:           #f8fafc;

  /* State colours */
  --color-success:            #166534;
  --color-warning:            #d97706;
  --color-info:               #0284c7;

  /* Typography */
  --font-family:              'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-size-base:           1rem;       /* 16px */
  --font-size-sm:             0.875rem;  /* 14px */
  --font-size-xs:             0.75rem;   /* 12px */
  --font-size-lg:             1.125rem;
  --font-size-xl:             1.25rem;
  --line-height-base:         1.7;
  --line-height-tight:        1.2;
  --line-height-snug:         1.4;

  /* Spacing */
  --space-1:  0.25rem;
  --space-2:  0.5rem;
  --space-3:  0.75rem;
  --space-4:  1rem;
  --space-5:  1.25rem;
  --space-6:  1.5rem;
  --space-8:  2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;

  /* Border radius */
  --radius-sm:   0.375rem;
  --radius-md:   0.5rem;
  --radius-base: 0.75rem;
  --radius-lg:   1rem;
  --radius-xl:   1.25rem;
  --radius-2xl:  1.5rem;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm:   0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md:   0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg:   0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl:   0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  --shadow-2xl:  0 25px 50px -12px rgba(0, 0, 0, 0.25);

  /* Transitions */
  --transition-fast:   150ms ease;
  --transition-base:   250ms ease;
  --transition-slow:   400ms ease;

  /* Z-index layers */
  --z-header:  1000;
  --z-overlay: 1040;
  --z-modal:   1050;
  --z-toast:   1060;

  /* Bootstrap override tokens */
  --bs-primary:        #1e3a5f;
  --bs-secondary:      #8fbc3f;
  --bs-body-font-family: var(--font-family);
  --bs-body-color:       var(--color-fg);
  --bs-body-bg:          var(--color-bg);
  --bs-border-color:     var(--color-border);
  --bs-border-radius:    var(--radius-base);
  --bs-border-radius-sm: var(--radius-sm);
  --bs-border-radius-lg: var(--radius-lg);
}

/* --------------------------------------------------------------------------
   3. Reset & Base
   -------------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: var(--font-size-base);
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

body {
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  line-height: var(--line-height-base);
  color: var(--color-fg);
  background-color: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img,
svg {
  display: block;
  max-width: 100%;
  height: auto;
}

/* --------------------------------------------------------------------------
   4. Skip Link (Accessibility)
   -------------------------------------------------------------------------- */
.skip-link {
  position: absolute;
  top: -100px;
  left: 0;
  z-index: var(--z-toast);
  padding: 0.75rem 1.5rem;
  background-color: var(--color-primary);
  color: var(--color-primary-fg);
  font-weight: 600;
  text-decoration: none;
  border-radius: 0 0 var(--radius-md) 0;
  transition: top var(--transition-fast);
}

.skip-link:focus {
  top: 0;
}

/* --------------------------------------------------------------------------
   5. Focus States (WCAG AAA)
   -------------------------------------------------------------------------- */
:focus-visible {
  outline: 3px solid var(--color-primary);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

/* Remove default outline when :focus-visible is supported */
:focus:not(:focus-visible) {
  outline: none;
}

/* --------------------------------------------------------------------------
   6. Typography
   -------------------------------------------------------------------------- */
h1, .h1 {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 700;
  line-height: var(--line-height-tight);
  letter-spacing: -0.02em;
  color: var(--color-primary);
}

h2, .h2 {
  font-size: clamp(1.5rem, 3.5vw, 2.5rem);
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.01em;
  color: var(--color-primary);
}

h3, .h3 {
  font-size: clamp(1.25rem, 2.5vw, 1.75rem);
  font-weight: 600;
  line-height: var(--line-height-snug);
  color: var(--color-primary);
}

h4, .h4 {
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.5;
  color: var(--color-fg);
}

h5, .h5 {
  font-size: 1.125rem;
  font-weight: 600;
  line-height: 1.5;
  color: var(--color-fg);
}

h6, .h6 {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.5;
  color: var(--color-fg);
}

p {
  margin-bottom: 1rem;
  line-height: var(--line-height-base);
}

p:last-child {
  margin-bottom: 0;
}

a {
  color: var(--color-primary);
  text-decoration: underline;
  text-decoration-color: rgba(30, 58, 95, 0.3);
  text-underline-offset: 2px;
  transition: text-decoration-color var(--transition-fast);
}

a:hover {
  text-decoration-color: var(--color-primary);
}

strong, b {
  font-weight: 700;
}

/* --------------------------------------------------------------------------
   7. Layout Utilities
   -------------------------------------------------------------------------- */
.section-py {
  padding-top: var(--space-20);
  padding-bottom: var(--space-20);
}

.section-py-sm {
  padding-top: var(--space-12);
  padding-bottom: var(--space-12);
}

.section-py-lg {
  padding-top: var(--space-24);
  padding-bottom: var(--space-24);
}

.bg-gradient-page {
  background: linear-gradient(180deg, #ffffff 0%, #f1f5f9 100%);
}

@media (max-width: 991.98px) {
  .section-py {
    padding-top: var(--space-12);
    padding-bottom: var(--space-12);
  }

  .section-py-lg {
    padding-top: var(--space-16);
    padding-bottom: var(--space-16);
  }
}

.bg-gradient-hero {
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-light) 100%);
}

.min-h-screen {
  min-height: 100vh;
}

/* --------------------------------------------------------------------------
   8. Colour Utilities
   -------------------------------------------------------------------------- */
.text-primary    { color: var(--color-primary) !important; }
.text-secondary  { color: #4d6919 !important; } /* WCAG AA: 6.27:1 on white */
.text-muted      { color: var(--color-muted-fg) !important; }
.text-success    { color: var(--color-success) !important; }
.text-danger     { color: var(--color-destructive) !important; }

.bg-primary      { background-color: var(--color-primary) !important; }
.bg-secondary    { background-color: var(--color-secondary) !important; }
.bg-muted        { background-color: var(--color-muted) !important; }

/* --------------------------------------------------------------------------
   9. Page Banner
   -------------------------------------------------------------------------- */
.page-banner {
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-light) 100%);
  padding: var(--space-12) 0;
  position: relative;
  overflow: hidden;
}

.page-banner::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 20% 80%, rgba(143, 188, 63, 0.15) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(255, 255, 255, 0.05) 0%, transparent 40%);
  pointer-events: none;
}

.page-banner__title {
  font-size: clamp(1.75rem, 4vw, 2.75rem);
  font-weight: 700;
  color: #ffffff;
  margin-bottom: var(--space-3);
  line-height: 1.2;
}

.page-banner__subtitle {
  font-size: 1.0625rem;
  color: rgba(255, 255, 255, 0.85);
  max-width: 680px;
  line-height: 1.6;
  margin-bottom: 0;
}

/* --------------------------------------------------------------------------
   10. Breadcrumb
   -------------------------------------------------------------------------- */
.breadcrumb-bar {
  background-color: var(--color-muted);
  border-bottom: 1px solid var(--color-border);
  padding: 0.75rem 0;
}

.breadcrumb {
  margin-bottom: 0;
  padding: 0;
  background: transparent;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
}

.breadcrumb-item {
  display: flex;
  align-items: center;
  line-height: 1.5;
}

.breadcrumb-item a {
  color: var(--color-primary);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-size: var(--font-size-sm);
  font-weight: 500;
  line-height: 1.5;
  transition: color var(--transition-fast);
}

.breadcrumb-item a:hover {
  color: var(--color-secondary);
  text-decoration: underline;
}

.breadcrumb-item.active {
  color: var(--color-fg);
  font-size: var(--font-size-sm);
  line-height: 1.5;
}

/* Override Bootstrap's float-based separator with an inline flex approach
   so it stays vertically centred regardless of how many items are present */
.breadcrumb-item + .breadcrumb-item::before {
  float: none;
  display: inline-flex;
  align-self: center;
  color: var(--color-muted-fg);
  content: '/';
  padding: 0 0.5rem;
}

/* --------------------------------------------------------------------------
   11. Buttons
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: var(--font-family);
  font-weight: 600;
  font-size: 0.9375rem;
  line-height: 1.5;
  padding: 0.625rem 1.25rem;
  border-radius: var(--radius-base);
  transition:
    background-color var(--transition-fast),
    color var(--transition-fast),
    border-color var(--transition-fast),
    box-shadow var(--transition-fast),
    transform var(--transition-fast);
  min-height: 44px; /* WCAG touch target */
  min-width: 44px;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn-primary {
  background-color: var(--color-primary);
  border-color: var(--color-primary);
  color: #ffffff;
}

.btn-primary:hover,
.btn-primary:focus {
  background-color: var(--color-primary-dark);
  border-color: var(--color-primary-dark);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(30, 58, 95, 0.35);
}

.btn-secondary {
  background-color: var(--color-secondary);
  border-color: var(--color-secondary);
  color: #0f1a04; /* WCAG AA: 8.06:1 on #8fbc3f */
}

.btn-secondary:hover,
.btn-secondary:focus {
  background-color: var(--color-secondary-dark);
  border-color: var(--color-secondary-dark);
  color: #0f1a04; /* WCAG AA: 5.08:1 on #6e9430 */
  box-shadow: 0 4px 12px rgba(143, 188, 63, 0.35);
}

.btn-outline-primary {
  background-color: transparent;
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.btn-outline-primary:hover,
.btn-outline-primary:focus {
  background-color: var(--color-primary);
  color: #ffffff;
}

.btn-outline-secondary {
  background-color: transparent;
  border-color: var(--color-secondary);
  color: #4d6919; /* WCAG AA: 6.27:1 on white */
}

.btn-outline-secondary:hover,
.btn-outline-secondary:focus {
  background-color: var(--color-secondary);
  color: #0f1a04; /* WCAG AA: 8.06:1 on #8fbc3f */
}

.btn-ghost {
  background-color: transparent;
  border-color: transparent;
  color: var(--color-fg);
}

.btn-ghost:hover,
.btn-ghost:focus {
  background-color: var(--color-muted);
  color: var(--color-primary);
}

.btn-danger {
  background-color: var(--color-destructive);
  border-color: var(--color-destructive);
  color: #ffffff;
}

.btn-danger:hover,
.btn-danger:focus {
  background-color: #b01230;
  color: #ffffff;
}

.btn-lg {
  padding: 0.875rem 1.75rem;
  font-size: 1rem;
  border-radius: var(--radius-lg);
  min-height: 52px;
}

.btn-sm {
  padding: 0.375rem 0.875rem;
  font-size: var(--font-size-sm);
  border-radius: var(--radius-md);
  min-height: 36px;
}

.btn-icon {
  padding: 0.625rem;
  border-radius: var(--radius-base);
  width: 44px;
  height: 44px;
}

/* Disabled action icon — used on table row action buttons when an action is
   not available. Apply .is-disabled alongside aria-disabled="true" and
   tabindex="-1" on the <a> element. pointer-events:none blocks mouse
   interaction; tabindex removes it from keyboard navigation. */
.btn-icon.is-disabled {
  opacity: 0.3;
  cursor: not-allowed;
  pointer-events: none;
  color: var(--color-fg-muted);
}

.btn-icon.is-disabled:hover,
.btn-icon.is-disabled:focus {
  background-color: transparent;
  color: var(--color-fg-muted);
  box-shadow: none;
}

.btn-full {
  width: 100%;
}

/* --------------------------------------------------------------------------
   12. Cards
   -------------------------------------------------------------------------- */
.card {
  background-color: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-base);
  transition: box-shadow var(--transition-base), border-color var(--transition-base);
}

.card-hover:hover {
  box-shadow: var(--shadow-lg);
  border-color: rgba(30, 58, 95, 0.3);
}

.card-body {
  padding: var(--space-6);
}

.card-body-lg {
  padding: var(--space-8);
}

.card-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-xl);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: linear-gradient(135deg, rgba(30, 58, 95, 0.1), rgba(30, 58, 95, 0.05));
  border: 1px solid rgba(30, 58, 95, 0.2);
  transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.card:hover .card-icon {
  transform: scale(1.1);
  box-shadow: 0 8px 20px rgba(30, 58, 95, 0.15);
}

.card-icon-sm {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-lg);
}

.card-icon-secondary {
  background: linear-gradient(135deg, rgba(143, 188, 63, 0.1), rgba(143, 188, 63, 0.05));
  border-color: rgba(143, 188, 63, 0.2);
}

/* --------------------------------------------------------------------------
   13. Badge
   -------------------------------------------------------------------------- */
.badge-primary {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  font-size: var(--font-size-xs);
  font-weight: 700;
  border-radius: var(--radius-full);
  background-color: rgba(30, 58, 95, 0.1);
  color: var(--color-primary);
  border: 1px solid rgba(30, 58, 95, 0.2);
}

.badge-secondary {
  background-color: rgba(143, 188, 63, 0.1);
  color: #3d5314; /* WCAG AA: 7.55:1 on near-white bg */
  border: 1px solid rgba(143, 188, 63, 0.2);
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  font-size: var(--font-size-xs);
  font-weight: 700;
  border-radius: var(--radius-full);
}

.badge-outline {
  background-color: transparent;
  border: 1px solid var(--color-border);
  color: var(--color-muted-fg);
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  font-size: var(--font-size-xs);
  font-weight: 600;
  border-radius: var(--radius-full);
}

/* --------------------------------------------------------------------------
   14. Forms
   -------------------------------------------------------------------------- */
.form-label {
  display: block;
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--color-fg);
  margin-bottom: 0.375rem;
}

.form-label .required {
  color: var(--color-destructive);
  margin-left: 0.25rem;
}

.form-control {
  display: block;
  width: 100%;
  padding: 0.6875rem 1rem;
  font-family: var(--font-family);
  font-size: 0.9375rem;
  line-height: 1.5;
  color: var(--color-fg);
  background-color: var(--color-input-bg);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-base);
  transition:
    border-color var(--transition-fast),
    box-shadow var(--transition-fast),
    background-color var(--transition-fast);
  appearance: none;
  min-height: 44px;
}

.form-control:focus {
  border-color: var(--color-primary);
  background-color: #ffffff;
  box-shadow: 0 0 0 3px rgba(30, 58, 95, 0.12);
  outline: none;
}

.form-control::placeholder {
  color: var(--color-muted-fg);
  opacity: 1;
}

.form-control.is-invalid {
  border-color: var(--color-destructive);
}

.form-control.is-invalid:focus {
  box-shadow: 0 0 0 3px rgba(212, 24, 61, 0.12);
}

.form-control.is-valid {
  border-color: var(--color-success);
}

.form-select {
  display: block;
  width: 100%;
  padding: 0.6875rem 2.5rem 0.6875rem 1rem;
  font-family: var(--font-family);
  font-size: 0.9375rem;
  color: var(--color-fg);
  background-color: var(--color-input-bg);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-base);
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%231e3a5f' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 0.875rem center;
  background-size: 16px 12px;
  appearance: none;
  min-height: 44px;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  cursor: pointer;
}

.form-select:focus {
  border-color: var(--color-primary);
  background-color: #ffffff;
  box-shadow: 0 0 0 3px rgba(30, 58, 95, 0.12);
  outline: none;
}

.form-check-input {
  width: 1.125rem;
  height: 1.125rem;
  border: 2px solid var(--color-border);
  border-radius: var(--radius-sm);
  vertical-align: middle;
  cursor: pointer;
  accent-color: var(--color-primary);
  transition: border-color var(--transition-fast);
}

.form-check-input:focus {
  box-shadow: 0 0 0 3px rgba(30, 58, 95, 0.12);
}

.form-check-input:checked {
  background-color: var(--color-primary);
  border-color: var(--color-primary);
}

.form-check-label {
  cursor: pointer;
  font-size: var(--font-size-sm);
  padding-left: 0.375rem;
}

.form-text {
  font-size: var(--font-size-xs);
  color: var(--color-muted-fg);
  margin-top: 0.375rem;
}

.invalid-feedback {
  display: none;
  font-size: var(--font-size-xs);
  color: var(--color-destructive);
  margin-top: 0.375rem;
}

.form-control.is-invalid ~ .invalid-feedback,
.form-select.is-invalid ~ .invalid-feedback,
.was-validated .form-control:invalid ~ .invalid-feedback,
.was-validated .form-select:invalid ~ .invalid-feedback {
  display: block;
}

textarea.form-control {
  resize: vertical;
  min-height: 120px;
}

.input-group-icon {
  position: relative;
}

.input-group-icon .form-control {
  padding-left: 2.75rem;
}

.input-group-icon .input-icon {
  position: absolute;
  left: 0.875rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-muted-fg);
  pointer-events: none;
  transition: color var(--transition-fast);
}

.input-group-icon:focus-within .input-icon {
  color: var(--color-primary);
}

/* Right-side icon group – used for password show/hide toggles */
.input-icon-group {
  position: relative;
}

.input-icon-group .form-control {
  padding-right: 3rem;
}

.input-icon-group__btn {
  position: absolute;
  right: 0;
  top: 0;
  height: 100%;
  width: 2.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--color-muted-fg);
  cursor: pointer;
  padding: 0;
  transition: color var(--transition-fast);
}

.input-icon-group__btn:hover,
.input-icon-group__btn:focus-visible {
  color: var(--color-primary);
  outline: 2px solid var(--color-focus-ring);
  outline-offset: -2px;
  border-radius: var(--radius-sm);
}

/* --------------------------------------------------------------------------
   15. Alerts / Info Boxes
   -------------------------------------------------------------------------- */
.alert {
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius-base);
  border: 1px solid transparent;
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  font-size: var(--font-size-sm);
}

.alert-icon {
  flex-shrink: 0;
  margin-top: 0.125rem;
}

.alert-primary {
  background-color: rgba(30, 58, 95, 0.06);
  border-color: rgba(30, 58, 95, 0.2);
  color: var(--color-primary);
}

.alert-secondary {
  background-color: rgba(143, 188, 63, 0.08);
  border-color: rgba(143, 188, 63, 0.25);
  color: #4d6919; /* WCAG AA: 5.83:1 on near-white bg */
}

.alert-success {
  background-color: #f0fdf4;
  border-color: #bbf7d0;
  color: #15803d;
}

.alert-warning {
  background-color: #fffbeb;
  border-color: #fde68a;
  color: #92400e;
}

.alert-danger {
  background-color: #fff1f2;
  border-color: #fecdd3;
  color: #be123c;
}

/* --------------------------------------------------------------------------
   16. Tables
   -------------------------------------------------------------------------- */
.table-epc {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--font-size-sm);
}

.table-epc thead th {
  background-color: var(--color-primary);
  color: #ffffff;
  padding: 0.75rem 1rem;
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
}

.table-epc tbody td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
  color: var(--color-fg);
}

.table-epc tbody tr:last-child td {
  border-bottom: none;
}

.table-epc tbody tr:hover td {
  background-color: rgba(30, 58, 95, 0.03);
}

.table-epc tbody tr:nth-child(even) td {
  background-color: rgba(241, 245, 249, 0.5);
}

.table-responsive-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-base);
}

/* ── Mobile card layout for .table-epc ─────────────────────────────────────
   Below 768 px every <tr> becomes a 2-column grid card.
   Certificate ID spans the full width as a card header.
   Actions are anchored to the top-right of that header.
   Middle columns arrange as: Issue Date | Building Type
                               Rating Type | Paid
   Certificate Type is hidden on mobile.
   Each cell shows its column label (via data-label / ::before) above the
   value — populated automatically by initTableLabels() in main.js.
   -------------------------------------------------------------------------- */
@media (max-width: 767.98px) {

  /* Let cards fill the container naturally */
  .table-responsive {
    overflow: visible;
  }

  /* Hide column headers — labels are injected via ::before */
  .table-epc thead {
    display: none;
  }

  /* Reset outer table elements to block */
  .table-epc,
  .table-epc tbody {
    display: block;
    width: 100%;
  }

  /* Each row → 2-column grid card */
  .table-epc tbody tr {
    display: grid;
    grid-template-columns: 1fr 1fr;
    position: relative;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    margin-bottom: 1rem;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
  }

  /* ── Certificate ID: full-width card header ── */
  .table-epc tbody td:first-child {
    grid-column: 1 / -1;
    order: -1;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 0.875rem 8.75rem 0.875rem 1rem;
    border-bottom: 1px solid var(--color-border);
    font-weight: 700;
    color: var(--color-primary);
    font-family: monospace;
    font-size: var(--font-size-sm);
    background: transparent;
  }

  .table-epc tbody td:first-child::before {
    content: attr(data-label);
    font-family: var(--font-family);
    font-size: 0.625rem;
    font-weight: 600;
    color: var(--color-muted-fg);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.2rem;
  }

  /* ── Actions: anchored top-right of the card header ── */
  .table-epc tbody td:last-child {
    position: absolute;
    top: 0;
    right: 0;
    display: flex;
    align-items: center;
    gap: 0.125rem;
    padding: 0.5rem 0.375rem;
    border: none;
    background: transparent;
    z-index: 1;
  }

  /* Compact icon buttons in the action column on mobile.
     32×32px keeps them visually tight while still exceeding the
     WCAG 2.5.8 AA minimum of 24×24px. Gap is removed — WCAG 2.5.8
     does not require space between adjacent targets, only a minimum
     target size. */
  .table-epc tbody td:last-child > div {
    gap: 0;
  }

  .table-epc tbody td:last-child .btn-icon {
    width: 32px;
    height: 32px;
    min-height: 32px;
    padding: 0.25rem;
    border-radius: var(--radius-sm);
  }

  .table-epc tbody td:last-child::before {
    display: none;
  }

  /* ── Certificate Type: hidden on mobile ── */
  .table-epc tbody td:nth-child(3) {
    display: none;
  }

  /* ── Middle cells: label stacked above value ── */
  .table-epc tbody td:not(:first-child):not(:last-child):not(:nth-child(3)) {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 0.75rem 0.875rem;
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--color-fg);
    border-bottom: 1px solid rgba(30, 58, 95, 0.07);
  }

  .table-epc tbody td:not(:first-child):not(:last-child):not(:nth-child(3))::before {
    content: attr(data-label);
    font-family: var(--font-family);
    font-size: 0.625rem;
    font-weight: 600;
    color: var(--color-muted-fg);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.2rem;
    white-space: nowrap;
  }

  /* ── Column order: Issue Date | Building Type / Rating Type | Paid ── */
  .table-epc tbody td:nth-child(2) { order: 1; } /* Issue Date     → top-left  */
  .table-epc tbody td:nth-child(5) { order: 2; } /* Building Type  → top-right */
  .table-epc tbody td:nth-child(4) { order: 3; } /* Rating Type    → btm-left  */
  .table-epc tbody td:nth-child(6) { order: 4; } /* Paid           → btm-right */

  /* No bottom border on the bottom row of grid cells */
  .table-epc tbody td:nth-child(4),
  .table-epc tbody td:nth-child(6) {
    border-bottom: none;
  }

  /* Suppress desktop alternating-row and hover tints */
  .table-epc tbody tr:nth-child(even) td,
  .table-epc tbody tr:hover td {
    background-color: transparent;
  }
}

/* --------------------------------------------------------------------------
   16b. table-epc--delegate modifier
   Overrides the absolute-positioned last column so the Toggle Status button
   sits in the grid flow with its label, rather than floating unlabelled.
   Column order on mobile: Name | Email / Status | Toggle Status
   -------------------------------------------------------------------------- */
@media (max-width: 767.98px) {

  .table-epc.table-epc--delegate tbody td:last-child {
    position: static;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 0.75rem 0.875rem;
    border-bottom: none;
    background: transparent;
    z-index: auto;
    order: 4;
  }

  .table-epc.table-epc--delegate tbody td:last-child::before {
    display: block;
    content: attr(data-label);
    font-family: var(--font-family);
    font-size: 0.625rem;
    font-weight: 600;
    color: var(--color-muted-fg);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.2rem;
    white-space: nowrap;
  }

  /* Reorder: Name | Email on row 1, Status | Toggle Status on row 2 */
  .table-epc.table-epc--delegate tbody td:nth-child(2) { order: 1; }
  .table-epc.table-epc--delegate tbody td:nth-child(4) { order: 2; border-bottom: 1px solid rgba(30,58,95,0.07); }
  .table-epc.table-epc--delegate tbody td:nth-child(5) { order: 3; border-bottom: none; }
  .table-epc.table-epc--delegate tbody td:last-child    { order: 4; }

}

/* --------------------------------------------------------------------------
   17. Pagination
   -------------------------------------------------------------------------- */
.pagination .page-link {
  color: var(--color-primary);
  border-color: var(--color-border);
  font-weight: 500;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-base) !important;
  margin: 0 0.25rem;
  transition: background-color var(--transition-fast), color var(--transition-fast);
}

.pagination .page-link:hover {
  background-color: var(--color-muted);
  color: var(--color-primary);
  border-color: var(--color-border);
}

.pagination .page-item.active .page-link {
  background-color: var(--color-primary);
  border-color: var(--color-primary);
  color: #ffffff;
}

.pagination .page-item.disabled .page-link {
  color: var(--color-muted-fg);
  pointer-events: none;
}

/* --------------------------------------------------------------------------
   18. Animations
   -------------------------------------------------------------------------- */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.92);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.5; }
}

@keyframes ping {
  75%, 100% {
    transform: scale(2);
    opacity: 0;
  }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes floatY {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-12px); }
}

.animate-fade-in-up {
  animation: fadeInUp 0.5s ease both;
}

.animate-fade-in {
  animation: fadeIn 0.4s ease both;
}

.animate-scale-in {
  animation: scaleIn 0.4s ease both;
}

.animate-float {
  animation: floatY 4s ease-in-out infinite;
}

.animate-spin {
  animation: spin 1s linear infinite;
}

.animate-pulse {
  animation: pulse 2s ease-in-out infinite;
}

/* Scroll-triggered animation base state */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal.revealed {
  opacity: 1;
  transform: translateY(0);
}

.reveal-delay-1 { transition-delay: 0.1s; }
.reveal-delay-2 { transition-delay: 0.2s; }
.reveal-delay-3 { transition-delay: 0.3s; }
.reveal-delay-4 { transition-delay: 0.4s; }
.reveal-delay-5 { transition-delay: 0.5s; }

/* --------------------------------------------------------------------------
   19. Utility Helpers
   -------------------------------------------------------------------------- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.line-clamp-2 {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

.line-clamp-3 {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
}

.rounded-xl  { border-radius: var(--radius-xl); }
.rounded-2xl { border-radius: var(--radius-2xl); }

.shadow-card { box-shadow: var(--shadow-md); }
.shadow-card-hover { box-shadow: var(--shadow-xl); }

/* --------------------------------------------------------------------------
   20. Print Styles
   -------------------------------------------------------------------------- */
@media print {
  .site-header,
  .site-footer,
  .breadcrumb-bar,
  .btn,
  .cookie-banner {
    display: none !important;
  }

  body {
    font-size: 12pt;
    color: #000;
  }

  a {
    color: #000;
    text-decoration: underline;
  }

  h1, h2, h3, h4, h5, h6 {
    color: #000;
  }
}

/* ==========================================================================
   EPC Malta – Components Stylesheet
   Header, Footer, Hero, Services, Login, Cookie Consent, Search, Account UI
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Site Header
   -------------------------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: var(--z-header);
  background-color: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-base);
}

.site-header.scrolled {
  box-shadow: var(--shadow-md);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 80px;
  gap: var(--space-6);
}

/* Logo */
.header-logo {
  display: flex;
  align-items: center;
  text-decoration: none;
  flex-shrink: 0;
}

.header-logo img {
  height: 56px;
  width: auto;
}

/* Desktop nav */
.header-nav {
  display: flex;
  align-items: center;
  gap: var(--space-8);
  list-style: none;
  margin: 0;
  padding: 0;
}

.header-nav__link {
  display: inline-flex;
  align-items: center;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--color-fg);
  text-decoration: none;
  padding-bottom: 4px;
  border-bottom: 2px solid transparent;
  transition: color var(--transition-fast), border-color var(--transition-fast);
  white-space: nowrap;
}

.header-nav__link:hover,
.header-nav__link[aria-current="page"] {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
}

/* Header actions */
.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-shrink: 0;
}

/* Mobile toggle */
.header-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: transparent;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-base);
  cursor: pointer;
  color: var(--color-fg);
  transition: background-color var(--transition-fast), color var(--transition-fast);
}

.header-toggle:hover {
  background-color: var(--color-muted);
  color: var(--color-primary);
}

/* Mobile nav drawer */
.mobile-nav {
  display: none;
  flex-direction: column;
  padding: var(--space-4) 0 var(--space-6);
  border-top: 1px solid var(--color-border);
  animation: fadeInUp 0.25s ease;
}

.mobile-nav.is-open {
  display: flex;
}

.mobile-nav__link {
  display: flex;
  align-items: center;
  padding: 0.75rem 1rem;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--color-fg);
  text-decoration: none;
  border-radius: var(--radius-base);
  min-height: 44px;
  transition: background-color var(--transition-fast), color var(--transition-fast);
}

.mobile-nav__link:hover,
.mobile-nav__link[aria-current="page"] {
  background-color: rgba(30, 58, 95, 0.08);
  color: var(--color-primary);
}

.mobile-nav__actions {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-4) 0 0;
}

.mobile-nav__actions .btn {
  flex: 1;
}

/* --------------------------------------------------------------------------
   2. Search Modal
   -------------------------------------------------------------------------- */
.search-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: var(--z-overlay);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-base);
}

.search-backdrop.is-open {
  opacity: 1;
  pointer-events: all;
}

.search-modal {
  position: fixed;
  top: 96px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  width: min(680px, calc(100vw - 2rem));
  z-index: var(--z-modal);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-base), transform var(--transition-base);
}

.search-modal.is-open {
  opacity: 1;
  pointer-events: all;
  transform: translateX(-50%) translateY(0);
}

.search-modal__inner {
  background-color: #ffffff;
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-2xl);
  border: 1px solid rgba(30, 58, 95, 0.1);
  overflow: hidden;
}

.search-modal__field {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-5) var(--space-6);
}

.search-modal__icon {
  flex-shrink: 0;
  color: var(--color-primary);
}

.search-modal__input {
  flex: 1;
  border: none;
  background: transparent;
  font-family: var(--font-family);
  font-size: 1.0625rem;
  color: var(--color-fg);
  outline: none;
}

.search-modal__input::placeholder {
  color: var(--color-muted-fg);
}

.search-modal__close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-base);
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--color-muted-fg);
  transition: background-color var(--transition-fast);
}

.search-modal__close:hover {
  background-color: var(--color-muted);
  color: var(--color-fg);
}

.search-modal__popular {
  padding: var(--space-4) var(--space-6) var(--space-5);
  border-top: 1px solid var(--color-border);
}

.search-modal__popular-label {
  font-size: var(--font-size-xs);
  color: var(--color-muted-fg);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-3);
}

.search-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.search-chip {
  padding: 0.375rem 0.875rem;
  background-color: var(--color-muted);
  border-radius: var(--radius-full);
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--color-fg);
  border: none;
  cursor: pointer;
  transition: background-color var(--transition-fast), color var(--transition-fast);
}

.search-chip:hover {
  background-color: rgba(30, 58, 95, 0.1);
  color: var(--color-primary);
}

/* --------------------------------------------------------------------------
   2b. Centred Dialog (e.g. "Changes saved" confirmation)
   Generic in-page confirmation dialog. Follows the same role="dialog" /
   aria-modal / focus management / Escape-to-close pattern as the search
   modal above — reuse this for any future "are you sure" or "saved"
   style overlay rather than introducing a new pattern.
   -------------------------------------------------------------------------- */
.dialog-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: var(--z-overlay);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-base);
}

.dialog-backdrop.is-open {
  opacity: 1;
  pointer-events: all;
}

.dialog {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -45%);
  width: min(440px, calc(100vw - 2rem));
  z-index: var(--z-modal);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-base), transform var(--transition-base);
}

.dialog.is-open {
  opacity: 1;
  pointer-events: all;
  transform: translate(-50%, -50%);
}

.dialog__inner {
  position: relative;
  background-color: #ffffff;
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-2xl);
  border: 1px solid rgba(30, 58, 95, 0.1);
}

.dialog__close {
  position: absolute;
  top: var(--space-4);
  right: var(--space-4);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-base);
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--color-muted-fg);
  transition: background-color var(--transition-fast);
}

.dialog__close:hover {
  background-color: var(--color-muted);
  color: var(--color-fg);
}

/* --------------------------------------------------------------------------
   3. Site Footer
   -------------------------------------------------------------------------- */
.site-footer {
  background-color: var(--color-primary);
  color: rgba(255, 255, 255, 0.85);
}

.footer-body {
  padding: var(--space-16) 0 var(--space-12);
}

.footer-logo img {
  height: 64px;
  width: auto;
  margin-bottom: var(--space-5);
}

.footer-gov-logo img {
  height: 48px;
  width: auto;
  margin-bottom: var(--space-4);
}

.footer-social {
  display: flex;
  gap: var(--space-3);
  margin-top: var(--space-4);
}

.footer-social__link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-base);
  color: #ffffff;
  text-decoration: none;
  transition: color var(--transition-fast), transform var(--transition-fast);
}

.footer-social__link:hover {
  color: var(--color-secondary-light);
  transform: translateY(-2px);
}

.footer-heading {
  font-size: 0.9375rem;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: var(--space-4);
}

.footer-links {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.footer-links a {
  font-size: var(--font-size-sm);
  color: rgba(255, 255, 255, 0.75);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.footer-links a:hover {
  color: #ffffff;
}

.footer-contact-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  font-size: var(--font-size-sm);
  color: rgba(255, 255, 255, 0.75);
  margin-bottom: var(--space-3);
}

.footer-contact-item a {
  color: rgba(255, 255, 255, 0.75);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.footer-contact-item a:hover {
  color: #ffffff;
}

.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding: var(--space-6) 0;
}

.footer-bottom__text {
  font-size: var(--font-size-sm);
  color: rgba(255, 255, 255, 0.85);
}

.footer-bottom__links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-5);
}

.footer-bottom__links a {
  font-size: var(--font-size-sm);
  color: rgba(255, 255, 255, 0.85);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.footer-bottom__links a:hover {
  color: #ffffff;
}

/* --------------------------------------------------------------------------
   4. Hero Section
   -------------------------------------------------------------------------- */
.hero {
  position: relative;
  overflow: hidden;
  min-height: 560px;
  display: flex;
  align-items: center;
}

.hero__bg {
  position: absolute;
  inset: 0;
}

.hero__bg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero__overlay {
  position: absolute;
  inset: 0;
  background-color: var(--color-primary);
  opacity: 0.87;
}

.hero__content {
  position: relative;
  z-index: 1;
  padding-top: var(--space-24);
  padding-bottom: var(--space-24);
}

.hero__badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 0.375rem 1rem;
  background-color: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-full);
  color: rgba(255, 255, 255, 0.95);
  font-size: var(--font-size-sm);
  font-weight: 500;
  margin-bottom: var(--space-6);
}

.hero__badge-icon {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--color-secondary), rgba(143, 188, 63, 0.8));
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.hero__title {
  font-size: clamp(2.25rem, 5.5vw, 4.25rem);
  font-weight: 700;
  color: #ffffff;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin-bottom: var(--space-6);
}

.hero__lead {
  font-size: 1.0625rem;
  color: rgba(255, 255, 255, 0.88);
  max-width: 520px;
  line-height: 1.7;
  margin-bottom: var(--space-8);
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
}

/* Hero certificate check card */
.hero-card {
  background-color: #ffffff;
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-2xl);
  padding: var(--space-8);
  animation: scaleIn 0.6s ease 0.2s both;
}

.hero-card__icon-wrap {
  position: relative;
  display: inline-flex;
  margin-right: var(--space-3);
}

.hero-card__icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-xl);
  background: linear-gradient(135deg, rgba(143, 188, 63, 0.2), rgba(143, 188, 63, 0.08));
  border: 1px solid rgba(143, 188, 63, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* --------------------------------------------------------------------------
   5. Services Section
   -------------------------------------------------------------------------- */
.services-section {
  padding: var(--space-20) 0;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}

.section-label {
  display: inline-block;
  padding: 0.375rem 1rem;
  background-color: rgba(143, 188, 63, 0.1);
  color: var(--color-secondary-dark);
  border-radius: var(--radius-full);
  font-size: var(--font-size-sm);
  font-weight: 700;
  margin-bottom: var(--space-4);
}

.service-card {
  background-color: #ffffff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  height: 100%;
  transition: box-shadow var(--transition-base), border-color var(--transition-base);
  text-decoration: none;
  display: flex;
  flex-direction: column;
}

.service-card:hover {
  box-shadow: var(--shadow-lg);
  border-color: rgba(30, 58, 95, 0.25);
}

.service-card__icon {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-xl);
  background: linear-gradient(135deg, rgba(30, 58, 95, 0.1), rgba(30, 58, 95, 0.04));
  border: 1px solid rgba(30, 58, 95, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-bottom: var(--space-4);
  transition: transform var(--transition-base), box-shadow var(--transition-base);
  color: var(--color-primary);
}

.service-card:hover .service-card__icon {
  transform: scale(1.08);
  box-shadow: 0 8px 24px rgba(30, 58, 95, 0.15);
}

.service-card__title {
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--color-primary);
  margin-bottom: var(--space-2);
}

.service-card__desc {
  font-size: var(--font-size-sm);
  color: var(--color-muted-fg);
  line-height: 1.6;
  flex: 1;
}

/* --------------------------------------------------------------------------
   6. Login Section (Homepage)
   -------------------------------------------------------------------------- */
.login-section {
  padding: var(--space-20) 0;
  background-color: rgba(241, 245, 249, 0.5);
  position: relative;
  overflow: hidden;
}

.login-section::before {
  content: '';
  position: absolute;
  top: 40px;
  left: -80px;
  width: 360px;
  height: 360px;
  background: radial-gradient(circle, rgba(30, 58, 95, 0.05) 0%, transparent 70%);
  pointer-events: none;
}

.login-section::after {
  content: '';
  position: absolute;
  bottom: 40px;
  right: -80px;
  width: 480px;
  height: 480px;
  background: radial-gradient(circle, rgba(143, 188, 63, 0.05) 0%, transparent 70%);
  pointer-events: none;
}

.login-card {
  border-radius: var(--radius-2xl);
  border: 2px solid var(--color-border);
  box-shadow: var(--shadow-xl);
  overflow: hidden;
  height: 100%;
  display: flex;
  flex-direction: column;
  transition: box-shadow var(--transition-base), border-color var(--transition-base);
}

.login-card:hover {
  box-shadow: var(--shadow-2xl);
}

.login-card--primary:hover {
  border-color: rgba(30, 58, 95, 0.4);
}

.login-card--secondary:hover {
  border-color: rgba(143, 188, 63, 0.4);
}

.login-card__header {
  padding: var(--space-8) var(--space-6);
  text-align: center;
  position: relative;
  overflow: hidden;
}

.login-card__header--primary {
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-light) 100%);
}

.login-card__header--secondary {
  background: linear-gradient(135deg, var(--color-secondary-dark) 0%, var(--color-secondary) 100%);
}

.login-card__header-icon {
  display: inline-flex;
  padding: 1rem;
  background-color: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(4px);
  border-radius: var(--radius-xl);
  margin-bottom: 0.75rem;
  transition: transform var(--transition-base);
}

.login-card:hover .login-card__header-icon {
  transform: scale(1.1);
}

.login-card__header-title {
  color: #ffffff;
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0;
}

.login-card__body {
  padding: var(--space-6);
  flex: 1;
  display: flex;
  flex-direction: column;
  background-color: #ffffff;
}

.login-card__desc {
  font-size: var(--font-size-sm);
  color: var(--color-muted-fg);
  text-align: center;
  margin-bottom: var(--space-5);
}

/* Push bottom CTA to the foot of every login card */
.login-card__body > a.btn {
  margin-top: auto;
}

/* Card 1 – make the form stretch and keep its submit at the bottom */
.login-card__body > form {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.login-card__body > form > button[type="submit"] {
  margin-top: auto;
}

.login-indicator {
  padding: var(--space-4) var(--space-5);
  border: 2px solid;
  border-radius: var(--radius-xl);
  text-align: center;
  margin-bottom: var(--space-4);
}

.login-indicator--primary {
  background: linear-gradient(135deg, rgba(30, 58, 95, 0.06), rgba(30, 58, 95, 0.03));
  border-color: rgba(30, 58, 95, 0.15);
}

.login-indicator--secondary {
  background: linear-gradient(135deg, rgba(143, 188, 63, 0.08), rgba(143, 188, 63, 0.04));
  border-color: rgba(143, 188, 63, 0.2);
}

.pulse-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
}

.pulse-dot--primary { background-color: var(--color-primary); }
.pulse-dot--secondary { background-color: var(--color-secondary); }

/* --------------------------------------------------------------------------
   7. EPC Rating Bar
   -------------------------------------------------------------------------- */
.epc-rating {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.epc-rating__band {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  position: relative;
}

.epc-rating__bar {
  height: 36px;
  border-radius: 0 6px 6px 0;
  display: flex;
  align-items: center;
  padding: 0 var(--space-3);
  font-weight: 700;
  font-size: var(--font-size-sm);
  color: #ffffff;
  min-width: 48px;
  transition: width 1s ease;
}

.epc-rating__bar--A { background-color: #008000; width: 55%; }
.epc-rating__bar--B { background-color: #33cc00; width: 62%; }
.epc-rating__bar--C { background-color: #99cc00; width: 69%; }
.epc-rating__bar--D { background-color: #ffcc00; width: 76%; color: #333; }
.epc-rating__bar--E { background-color: #ff9900; width: 83%; }
.epc-rating__bar--F { background-color: #ff6600; width: 90%; }
.epc-rating__bar--G { background-color: #ff0000; width: 97%; }

.epc-rating__label {
  position: absolute;
  right: -48px;
  font-size: var(--font-size-xs);
  color: var(--color-muted-fg);
  white-space: nowrap;
}

.epc-rating__current {
  position: absolute;
  right: -72px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* --------------------------------------------------------------------------
   8. Cookie Consent Banner
   -------------------------------------------------------------------------- */
.cookie-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: var(--z-toast);
  background-color: var(--color-primary);
  color: rgba(255, 255, 255, 0.9);
  padding: var(--space-5) 0;
  transform: translateY(100%);
  transition: transform var(--transition-slow);
}

.cookie-banner.is-visible {
  transform: translateY(0);
}

.cookie-banner__text {
  font-size: var(--font-size-sm);
  margin-bottom: 0;
}

.cookie-banner__text a {
  color: var(--color-secondary-light);
}

.cookie-banner__actions {
  display: flex;
  gap: var(--space-3);
  flex-shrink: 0;
  align-items: center;
}

/* --------------------------------------------------------------------------
   9. Account Dashboard
   -------------------------------------------------------------------------- */
.account-nav-card {
  background-color: #ffffff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.account-nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: 1rem var(--space-5);
  color: var(--color-fg);
  text-decoration: none;
  border-bottom: 1px solid var(--color-border);
  font-weight: 500;
  transition: background-color var(--transition-fast), color var(--transition-fast);
  min-height: 56px;
}

.account-nav-item:last-child {
  border-bottom: none;
}

.account-nav-item:hover {
  background-color: rgba(30, 58, 95, 0.04);
  color: var(--color-primary);
}

.account-nav-item.active {
  background-color: rgba(30, 58, 95, 0.06);
  color: var(--color-primary);
}

.account-nav-item__icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-lg);
  background-color: rgba(30, 58, 95, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--color-primary);
  transition: background-color var(--transition-fast);
}

.account-nav-item:hover .account-nav-item__icon {
  background-color: rgba(30, 58, 95, 0.12);
}

.account-nav-item__chevron {
  margin-left: auto;
  color: var(--color-muted-fg);
}

.account-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  padding: var(--space-6);
  background-color: var(--color-primary);
  color: #ffffff;
  border-radius: var(--radius-xl);
  font-weight: 600;
  font-size: 0.9375rem;
  border: none;
  cursor: pointer;
  text-decoration: none;
  width: 100%;
  min-height: 64px;
  transition: background-color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
  box-shadow: var(--shadow-md);
}

.account-action-btn:hover {
  background-color: var(--color-primary-dark);
  box-shadow: var(--shadow-lg);
  transform: translateY(-1px);
  color: #ffffff;
}

.account-action-btn--danger {
  background-color: var(--color-destructive);
}

.account-action-btn--danger:hover {
  background-color: #b01230;
}

.account-action-btn--muted {
  background-color: var(--color-muted-fg);
}

.account-action-btn--muted:hover {
  background-color: var(--color-fg);
}

/* --------------------------------------------------------------------------
   10. Certificate Card (My Certificates list)
   -------------------------------------------------------------------------- */
.cert-card {
  background-color: #ffffff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: var(--space-5) var(--space-6);
  transition: box-shadow var(--transition-base), border-color var(--transition-base);
  display: flex;
  gap: var(--space-4);
  align-items: flex-start;
}

.cert-card:hover {
  box-shadow: var(--shadow-lg);
  border-color: rgba(30, 58, 95, 0.25);
}

.cert-card__rating {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  font-weight: 700;
  color: #ffffff;
  flex-shrink: 0;
}

.cert-card__rating--A { background-color: #008000; }
.cert-card__rating--B { background-color: #33cc00; }
.cert-card__rating--C { background-color: #99cc00; color: #333; }
.cert-card__rating--D { background-color: #ffcc00; color: #333; }
.cert-card__rating--E { background-color: #ff9900; }
.cert-card__rating--F { background-color: #ff6600; }
.cert-card__rating--G { background-color: #ff0000; }

.cert-card__number {
  font-size: var(--font-size-xs);
  color: var(--color-muted-fg);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.25rem;
}

.cert-card__address {
  font-weight: 600;
  color: var(--color-fg);
  margin-bottom: 0.25rem;
}

.cert-card__meta {
  font-size: var(--font-size-xs);
  color: var(--color-muted-fg);
}

/* --------------------------------------------------------------------------
   11. Form Sections (Registration / Account)
   -------------------------------------------------------------------------- */
.form-section {
  background-color: #ffffff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  margin-bottom: var(--space-6);
}

.form-section__header {
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--color-border);
  background-color: rgba(241, 245, 249, 0.5);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.form-section__header h2,
.form-section__header h3 {
  margin: 0;
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--color-primary);
}

.form-section__body {
  padding: var(--space-6);
}

.form-section__number {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background-color: var(--color-primary);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-sm);
  font-weight: 700;
  flex-shrink: 0;
}

/* --------------------------------------------------------------------------
   12. Sitemap
   -------------------------------------------------------------------------- */
/* Sitemap – tree list */
.sitemap-tree-wrapper {
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  overflow: hidden;
}

.sitemap-tree {
  list-style: none;
  padding: 0;
  margin: 0;
}

/* Divider between top-level sections */
.sitemap-tree > li + li {
  border-top: 2px solid var(--color-border);
}

/* L1 – section header */
.sitemap-tree__l1 {
  display: block;
  padding: 0.875rem 1.5rem;
  background: #f8fafc;
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--color-primary);
  text-decoration: none;
}

a.sitemap-tree__l1:hover {
  background: #eef2f7;
}

.sitemap-tree__l1-icon {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-base);
  background: rgba(30, 58, 95, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--color-primary);
}

/* L2 – second level */
.sitemap-tree__l2-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sitemap-tree__l2-list > li {
  border-top: 1px solid var(--color-border);
}

.sitemap-tree__l2 {
  display: flex;
  align-items: center;
  padding: 0.55rem 1.5rem 0.55rem 3.5rem;
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--color-fg);
  text-decoration: none;
  transition: background var(--transition-fast), color var(--transition-fast);
  position: relative;
}

.sitemap-tree__l2::before {
  content: '';
  position: absolute;
  left: 2.375rem;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--color-secondary);
}

a.sitemap-tree__l2:hover {
  background: var(--color-muted);
  color: var(--color-primary);
}

.sitemap-tree__l2--plain {
  color: var(--color-muted-fg);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.sitemap-tree__l2--plain::before {
  background: transparent;
}

/* L3 – third level */
.sitemap-tree__l3-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sitemap-tree__l3-list > li {
  border-top: 1px solid var(--color-border);
}

.sitemap-tree__l3 {
  display: flex;
  align-items: center;
  padding: 0.5rem 1.5rem 0.5rem 5rem;
  font-size: var(--font-size-sm);
  color: var(--color-fg);
  text-decoration: none;
  transition: background var(--transition-fast), color var(--transition-fast);
  position: relative;
}

.sitemap-tree__l3::before {
  content: '–';
  position: absolute;
  left: 4rem;
  color: var(--color-muted-fg);
  font-size: 0.75rem;
  line-height: 1;
}

a.sitemap-tree__l3:hover {
  background: var(--color-muted);
  color: var(--color-primary);
}

.sitemap-tree__l3--plain {
  color: var(--color-muted-fg);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.sitemap-tree__l3--plain::before {
  content: '';
}

/* L4 – fourth level */
.sitemap-tree__l4-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sitemap-tree__l4-list > li {
  border-top: 1px solid var(--color-border);
}

.sitemap-tree__l4 {
  display: flex;
  align-items: center;
  padding: 0.5rem 1.5rem 0.5rem 6.5rem;
  font-size: var(--font-size-sm);
  color: var(--color-muted-fg);
  text-decoration: none;
  transition: background var(--transition-fast), color var(--transition-fast);
  position: relative;
}

.sitemap-tree__l4::before {
  content: '·';
  position: absolute;
  left: 5.75rem;
  color: var(--color-muted-fg);
  font-size: 1.25rem;
  line-height: 1;
}

a.sitemap-tree__l4:hover {
  background: var(--color-muted);
  color: var(--color-primary);
}

/* Sitemap – page intro subtitle */
.sitemap-page-intro {
  max-width: 560px;
  margin-left: auto;
  margin-right: auto;
}

/* Form card – single bordered card containing multiple account-section__header sections */
.form-card {
  background-color: #ffffff;
  border: 1px solid #c8d2dc;
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08), 0 8px 24px rgba(0, 0, 0, 0.06);
}

/* Inside a form card, headers span edge-to-edge with no extra radius or margin */
.form-card .account-section__header {
  border-radius: 0;
  margin-bottom: 0;
}


/* Remove fieldset bottom margin inside form cards */
.form-card .fieldset-reset {
  margin: 0;
}

/* Padded content area inside a form card section */
.form-card-body {
  padding: var(--space-5) var(--space-6);
}

/* --------------------------------------------------------------------------
   Account nav – missing helpers
   -------------------------------------------------------------------------- */

/* Account nav card heading */
.account-nav-card__title {
  font-size: var(--font-size-sm);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-muted-fg);
  padding: var(--space-4) var(--space-5) var(--space-2);
  margin: 0;
}

/* Active state – used in JS as is-active (CSS has .active, add is-active alias) */
.account-nav-item.is-active {
  color: var(--color-primary);
  background: var(--color-primary-50, rgba(30, 58, 95, 0.06));
  font-weight: 600;
  border-left-color: var(--color-primary);
}

/* --------------------------------------------------------------------------
   Form inline error messages
   -------------------------------------------------------------------------- */
.form-error {
  display: none;
  font-size: var(--font-size-sm);
  color: var(--color-danger);
  margin-top: 0.25rem;
}

.form-control.is-invalid ~ .form-error,
.form-select.is-invalid ~ .form-error {
  display: block;
}

/* --------------------------------------------------------------------------
   EPC rating badge (small inline pill for tables)
   -------------------------------------------------------------------------- */
.epc-rating__badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: var(--font-size-sm);
  color: #fff;
}

.epc-rating__badge--A { background-color: #008000; }
.epc-rating__badge--B { background-color: #33cc00; }
.epc-rating__badge--C { background-color: #99cc00; color: #333; }
.epc-rating__badge--D { background-color: #ffcc00; color: #333; }
.epc-rating__badge--E { background-color: #ff9900; }
.epc-rating__badge--F { background-color: #ff6600; }
.epc-rating__badge--G { background-color: #ff0000; }

/* --------------------------------------------------------------------------
   13. Info Page Template
   -------------------------------------------------------------------------- */
.info-page-intro {
  max-width: 800px;
  margin: 0 auto var(--space-12);
  text-align: center;
}

.info-page-intro__title {
  font-size: clamp(1.5rem, 3vw, 2.25rem);
  font-weight: 700;
  color: var(--color-primary);
  margin-bottom: var(--space-4);
}

.info-section {
  margin-bottom: var(--space-16);
}

.info-section__icon-wrap {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-xl);
  background-color: rgba(30, 58, 95, 0.08);
  border: 1px solid rgba(30, 58, 95, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.info-card {
  background-color: #ffffff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: var(--space-8);
}

.info-card--primary-border {
  border: 2px solid rgba(30, 58, 95, 0.2);
}

.info-card--secondary-border {
  border: 2px solid rgba(143, 188, 63, 0.25);
}

.info-highlight {
  background-color: rgba(143, 188, 63, 0.06);
  border: 1px solid rgba(143, 188, 63, 0.2);
  border-radius: var(--radius-base);
  padding: var(--space-5);
}

.info-warning {
  background-color: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: var(--radius-base);
  padding: var(--space-5);
}

/* --------------------------------------------------------------------------
   14. Responsive Overrides
   -------------------------------------------------------------------------- */
@media (max-width: 991.98px) {
  .services-section,
  .login-section {
    padding-top: var(--space-12);
    padding-bottom: var(--space-12);
  }

  .header-nav,
  .header-actions {
    display: none;
  }

  .header-toggle {
    display: flex;
  }

  .footer-body .row > div {
    text-align: center;
  }

  .footer-logo,
  .footer-gov-logo {
    display: flex;
    justify-content: center;
  }

  .footer-social {
    justify-content: center;
  }

  .footer-contact-item {
    justify-content: center;
  }

  .footer-bottom {
    text-align: center;
  }

  .footer-bottom__links {
    justify-content: center;
  }

  .hero__lead {
    max-width: 100%;
  }
}

@media (max-width: 575.98px) {
  .hero__content {
    padding-top: var(--space-16);
    padding-bottom: var(--space-16);
  }

  .hero__actions {
    flex-direction: column;
  }

  .hero__actions .btn {
    width: 100%;
    justify-content: center;
  }

  .mobile-nav__actions {
    flex-direction: column;
  }

  .cookie-banner .d-flex {
    flex-direction: column;
    gap: var(--space-4);
  }

  .footer-bottom__links {
    gap: var(--space-3);
  }
}

/* ── Filter Tabs (legislation.html) ─────────────────────────────────────── */
.filter-tab {
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  color: var(--color-fg);
  border-radius: var(--radius-full);
  padding: 0.375rem 0.875rem;
  font-size: var(--font-size-sm);
  font-weight: 500;
  line-height: 1.4;
  transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.filter-tab:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background: rgba(30, 58, 95, 0.04);
}
.filter-tab.active {
  background: var(--color-primary);
  color: #ffffff;
  border-color: var(--color-primary);
  box-shadow: var(--shadow-sm);
}
.filter-tab .badge {
  font-size: var(--font-size-xs);
  font-weight: 600;
  background: rgba(30, 58, 95, 0.12) !important;
  color: var(--color-primary);
  border-radius: var(--radius-full);
  padding: 0.15em 0.5em;
}
.filter-tab.active .badge {
  background: rgba(255, 255, 255, 0.25) !important;
  color: #ffffff;
}

/* ==========================================================================
   Utility Classes  –  replaces all inline style="" attributes
   ========================================================================== */

/* --- Colour --- */
.text-color-primary   { color: var(--color-primary); }
.text-color-secondary { color: var(--color-secondary); }
.text-color-muted     { color: var(--color-muted-fg); }
.text-white-70        { color: rgba(255, 255, 255, 0.7); }
.text-amber           { color: #92400e; }
.text-destructive     { color: #d4183d; }
.text-success-dark    { color: #166534; }
.text-red-dark        { color: #c0392b; }

/* --- Font size --- */
.text-xs  { font-size: var(--font-size-xs); }
.text-sm  { font-size: var(--font-size-sm); }
.text-xxs { font-size: 0.75rem; }
.text-07  { font-size: 0.7rem; }
.text-09  { font-size: 0.9rem; }

/* --- Font combos --- */
.ls-wide          { letter-spacing: 0.08em; }
.text-muted-sm    { font-size: var(--font-size-sm);  color: var(--color-muted-fg); }
.text-muted-xs    { font-size: var(--font-size-xs);  color: var(--color-muted-fg); }
.text-muted-xs-gap{ font-size: var(--font-size-xs);  color: var(--color-muted-fg); margin: 4px 0 0; }
.text-primary-sm  { font-size: var(--font-size-sm);  color: var(--color-primary); font-weight: 600; }
.text-primary-link{ font-size: var(--font-size-sm);  color: var(--color-primary); }
.text-amber-sm    { font-size: var(--font-size-sm);  color: #92400e; }
.text-xs-muted    { font-size: var(--font-size-xs);  opacity: 0.7; }
.text-xs-label    { font-size: var(--font-size-xs);  opacity: 0.7; text-transform: uppercase; letter-spacing: 0.08em; }
.text-ref-mono    { font-size: var(--font-size-lg);  color: var(--color-primary); font-family: monospace; }
.progress-label   { font-size: 0.85rem; flex: 1; }

/* --- Layout --- */
.z-1            { z-index: 1; }
.pos-rel-z1     { position: relative; z-index: 1; }
.min-vh-70      { min-height: 70vh; }
.center-vh-70   { min-height: 70vh; display: flex; align-items: center; }
.mw-480         { max-width: 480px; }
.mw-520         { max-width: 520px; }
.mw-560         { max-width: 560px; }
.mw-700         { max-width: 700px; }
.mw-720         { max-width: 720px; }
.mw-900         { max-width: 900px; }
.w-fit          { width: fit-content; }
.cursor-pointer { cursor: pointer; }

/* --- Icon helpers --- */
.icon-flex   { flex-shrink: 0; margin-top: 2px; }
.icon-flex-3 { flex-shrink: 0; margin-top: 3px; }
.icon-sm-box { flex-shrink: 0; width: 1.1em; height: 1.1em; }

/* --- Borders --- */
.border-subtle         { border: 1px solid var(--color-border); }
.border-2-subtle       { border: 2px solid var(--color-border); }
.border-top-subtle     { border-top: 1px solid var(--color-border); }
.border-top-pt         { border-top: 1px solid var(--color-border); padding-top: 1.25rem; }
.border-top-pt-lg      { border-top: 1px solid var(--color-border); padding-top: 1.5rem; }
.border-top-center-sm  { border-top: 1px solid var(--color-border); text-align: center; font-size: var(--font-size-sm); color: var(--color-muted-fg); }
.border-bottom-subtle  { border-bottom: 1px solid var(--color-border); }
.ls-wide-border-top    { letter-spacing: 0.08em; border-top: 1px solid var(--color-border); padding-top: 1.5rem; }
.btn-hero-outline      { border-color: rgba(255, 255, 255, 0.5) !important; color: #fff !important; }

/* --- Backgrounds --- */
.bg-surface-bordered  { background: var(--color-surface); border: 1px solid var(--color-border); }
.bg-gradient-soft     { background: linear-gradient(135deg, rgba(30,58,95,0.04), rgba(143,188,63,0.04)); }
.highlight-primary    { background: rgba(30,58,95,0.05); border-left: 4px solid var(--color-primary); }
.highlight-primary-2  { background: rgba(30,58,95,0.04); border: 1px solid rgba(30,58,95,0.12); }
.highlight-primary-3  { background: rgba(30,58,95,0.05); border: 1px solid rgba(30,58,95,0.15); }
.highlight-green      { background: rgba(22,101,52,0.04);  border-left: 4px solid #166534; }
.highlight-secondary  { background: rgba(143,188,63,0.10); border-left: 4px solid var(--color-primary); }
.bg-danger-light      { background: rgba(212,24,61,0.04);  border-color: rgba(212,24,61,0.2); }
.bg-success-light     { background: rgba(22,101,52,0.04);  border-color: rgba(22,101,52,0.2); }
.bg-warning-soft      { background: rgba(217,119,6,0.06);  border: 2px solid rgba(217,119,6,0.25); }
.bg-amber-soft        { background: #fffbeb; border: 2px solid #fde68a; }
.badge-danger-xs      { background: var(--color-destructive); font-size: 0.7rem; }
.badge-secondary-xs   { background: var(--color-secondary); font-size: 0.7rem; }
.shadow-epc-lg        { box-shadow: var(--shadow-lg); }
.shadow-epc-xl        { box-shadow: var(--shadow-xl); }
.card-success-border  { border: 2px solid rgba(22,101,52,0.2);  box-shadow: var(--shadow-lg); }
.card-danger-border   { border: 2px solid rgba(212,24,61,0.2);  box-shadow: var(--shadow-lg); }
.card-warning-border  { border: 2px solid rgba(194,65,12,0.2);  box-shadow: var(--shadow-lg); }

/* --- Positioned components --- */
.pulse-ring-red    { position: absolute; inset: 0; background: rgba(212,24,61,0.15);  border-radius: 50%; animation: pulse 2s infinite; }
.pulse-ring-green  { position: absolute; inset: 0; background: rgba(22,101,52,0.1);   border-radius: 50%; }
.pulse-ring-orange { position: absolute; inset: 0; background: rgba(194,65,12,0.12);  border-radius: 50%; animation: pulse 2.4s infinite; }
.icon-badge-orange{ position: absolute; top: -12px; right: -24px; width: 48px; height: 48px; background: #e67e22; border-radius: 50%; display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 12px rgba(0,0,0,0.15); }
.icon-badge-green { position: absolute; top: -12px; right: -24px; width: 48px; height: 48px; background: var(--color-secondary); border-radius: 50%; display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 12px rgba(0,0,0,0.15); }
.icon-circle-red   { position: relative; background: #fff; border: 4px solid rgba(212,24,61,0.2);  border-radius: 50%; padding: 1.5rem; }
.icon-circle-green { position: relative; background: #fff; border: 4px solid rgba(22,101,52,0.2);  border-radius: 50%; padding: 1.5rem; }
.icon-circle-orange{ position: relative; background: #fff; border: 4px solid rgba(194,65,12,0.25); border-radius: 50%; padding: 1.5rem; }
.text-warning-dark  { color: #92400e; }
.highlight-orange   { background: rgba(194,65,12,0.04); border-left: 4px solid #c2410c; }
.bg-warning-light   { background: rgba(194,65,12,0.04); border-color: rgba(194,65,12,0.2); }
.icon-box         { width: 40px; height: 40px; border-radius: 12px; background: rgba(30,58,95,0.08); border: 1px solid rgba(30,58,95,0.15); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.icon-box-lg      { width: 64px; height: 64px; background: var(--color-primary); border-radius: 12px; display: flex; align-items: center; justify-content: center; margin: 0 auto 1.5rem; }
.card-header-primary { background: var(--color-primary); color: #fff; padding: 1.5rem 2rem; border-radius: var(--radius-lg) var(--radius-lg) 0 0; }

/* --- List styles --- */
.ps-list    { padding-left: 1.2rem; }
.ps-list-sm { padding-left: 1.25rem; font-size: var(--font-size-sm); line-height: 1.9; }
.ps-list-md { padding-left: 1.25rem; line-height: 1.8; }

/* --- Error page --- */
.error-code      { font-size: 9rem; font-weight: 800; line-height: 1; margin: 0; letter-spacing: -4px; }
.error-code-red  { color: #c0392b; }
.error-code-blue { color: var(--color-primary); }

/* --- Image/media --- */
.cert-aspect { aspect-ratio: 16 / 5; background: var(--color-muted); }

/* --- Animation delays --- */
.anim-delay-1 { animation-delay: 0.1s; }
.anim-delay-2 { animation-delay: 0.2s; }
.anim-delay-3 { animation-delay: 0.3s; }

/* Toast z-index */
.z-toast { z-index: 1100; }

/* JS toggle helper (replaces style="display:none" on icon-close) */
.is-hidden { display: none; }

/* ── Field info tooltip ────────────────────────────────────────────────────
   Used on fields with an info icon inside the right of the input.
   Trigger is .input-icon-group__btn.field-tooltip-trigger.
   Tooltip is .field-tooltip, positioned relative to .input-icon-group.
   ─────────────────────────────────────────────────────────────────────── */
.field-tooltip-trigger {
  color: var(--color-muted-fg);
}

.field-tooltip-trigger:hover,
.field-tooltip-trigger:focus-visible {
  color: var(--color-primary);
  outline: none;
}

.field-tooltip {
  position: absolute;
  right: 0;
  bottom: calc(100% + 10px);
  background: var(--color-primary);
  color: #fff;
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  min-width: 230px;
  font-size: var(--font-size-sm);
  line-height: 1.7;
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity var(--transition-fast), transform var(--transition-fast);
  z-index: 10;
  box-shadow: var(--shadow-lg);
}

.field-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  right: 0.875rem;
  border: 6px solid transparent;
  border-top-color: var(--color-primary);
}

.field-tooltip__list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.field-tooltip__list li { margin: 0; padding: 0; }

/* Show on hover or keyboard focus of the trigger */
.input-icon-group:has(.field-tooltip-trigger:hover) .field-tooltip,
.input-icon-group:has(.field-tooltip-trigger:focus-visible) .field-tooltip {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* ── Certificate document cards ───────────────────────────────────────────── */
.doc-card {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-base);
  padding: 1.25rem;
  background: var(--color-bg);
  height: 100%;
  display: flex;
  flex-direction: column;
}

.doc-preview {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 0.875rem;
  background: var(--color-muted);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  flex: 1;
}

.doc-preview__file-icon {
  width: 40px;
  height: 40px;
  min-width: 40px;
  border-radius: var(--radius-sm);
  background: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
}

.doc-preview__info { flex: 1; min-width: 0; }

.doc-preview__name {
  font-weight: 600;
  font-size: var(--font-size-sm);
  color: var(--color-fg);
  margin: 0 0 0.125rem;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.doc-preview__meta {
  font-size: var(--font-size-xs);
  color: var(--color-muted-fg);
  margin: 0;
}

.doc-preview--empty .doc-preview__file-icon { background: var(--color-muted-fg); }
.doc-preview--empty .doc-preview__name      { color: var(--color-muted-fg); font-weight: 400; font-style: italic; }

.doc-upload-area {
  margin-top: 0.75rem;
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-md);
  padding: 1rem;
  background: rgba(30,58,95,0.02);
}

/* Help / Assistance card (error pages) */
.help-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 1rem;
  padding: 2rem;
}

.help-icon-box {
  width: 48px;
  height: 48px;
  min-width: 48px;
  border-radius: 12px;
  background: linear-gradient(135deg, #1e3a5f, #2d5a8f);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #fff;
}

/* Issue Certificate type selection cards */
.cert-type-icon {
  width: 56px;
  height: 56px;
  min-width: 56px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(30,58,95,0.10), rgba(143,188,63,0.10));
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--color-primary);
}

.cert-type-card {
  border: 2px solid var(--color-border) !important;
  transition: border-color var(--transition-base), box-shadow var(--transition-base), transform var(--transition-base);
}

.cert-type-card:hover,
.cert-type-card:focus-visible {
  border-color: var(--color-primary) !important;
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

/* --------------------------------------------------------------------------
   Account section header – left-border green style (View & Edit account)
   Matches: bg-secondary/10, border-l-4 border-secondary, rounded-r-lg
   -------------------------------------------------------------------------- */
.account-section__header {
  background-color: rgba(143, 188, 63, 0.10);
  border-left: 4px solid var(--color-secondary);
  padding: 1rem 1.5rem;
  border-radius: 0 0.5rem 0.5rem 0;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.625rem;
}

/* Fieldset reset — removes default border/padding for account sections */
.fieldset-reset {
  border: none;
  padding: 0;
  margin: 0 0 2rem 0;
}

.account-section__header h2 {
  margin: 0;
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--color-primary);
  line-height: 1.3;
}

/* --------------------------------------------------------------------------
   Pagination – ghost style for Prev/Next, outline-only for active page
   -------------------------------------------------------------------------- */
.pagination .page-link {
  border: none;
  background: transparent;
  color: var(--color-fg);
  border-radius: var(--radius-base);
  padding: 0.4rem 0.75rem;
  font-size: var(--font-size-sm);
  transition: background-color var(--transition-fast), color var(--transition-fast);
  display: flex;
  align-items: center;
  gap: 0.375rem;
  box-shadow: none;
}

.pagination .page-link:hover {
  background-color: var(--color-muted);
  color: var(--color-primary);
  border: none;
}

.pagination .page-item.active .page-link {
  background-color: transparent;
  border: 1px solid var(--color-border);
  color: var(--color-fg);
  font-weight: 600;
}

.pagination .page-item.disabled .page-link {
  opacity: 0.4;
  pointer-events: none;
  color: var(--color-muted-fg);
}

/* Submission Failed – need immediate assistance card */
.card-danger-assist {
  background-color: rgba(212, 24, 61, 0.05);
  border: 1px solid rgba(212, 24, 61, 0.20);
}

/* Read-only textarea-style field (certificate detail, etc.) */
.form-control--multiline {
  min-height: 4.5rem;
  height: auto;
  white-space: pre-wrap;
}

/* ── Paid status badge (certificates table) ── */
.paid-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.625rem;
  border-radius: var(--radius-full);
  font-size: var(--font-size-xs);
  font-weight: 600;
  line-height: 1.4;
}

.paid-badge--false {
  background-color: rgba(217, 119, 6, 0.12);
  color: #b45309;
}

.paid-badge--true {
  background-color: rgba(22, 163, 74, 0.12);
  color: #16a34a;
}

/* --------------------------------------------------------------------------
   Responsive Google Maps embed
   -------------------------------------------------------------------------- */
.map-responsive {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
  width: 100%;
  min-height: 350px;
  border-radius: 8px;
  border: 1px solid #ddd;
}

.map-responsive iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* --------------------------------------------------------------------------
   Certificate document thumbnails (summary page)
   -------------------------------------------------------------------------- */
.thumb-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.thumb-item {
  position: relative;
  width: 120px;
  height: 90px;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--color-border);
  background: var(--color-muted);
  flex-shrink: 0;
  display: block;
  text-decoration: none;
}

.thumb-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.thumb-item__num {
  position: absolute;
  top: 0.375rem;
  left: 0.375rem;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--color-primary);
  color: #fff;
  font-size: 0.6875rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  z-index: 1;
}

.thumb-item__overlay {
  position: absolute;
  inset: 0;
  background: rgba(30, 58, 95, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.15s ease;
  color: #fff;
}

.thumb-item:hover .thumb-item__overlay,
.thumb-item:focus-visible .thumb-item__overlay {
  opacity: 1;
}

.thumb-item:focus-visible {
  outline: 2px solid var(--color-secondary);
  outline-offset: 2px;
}

/* --------------------------------------------------------------------------
   Delegate toggle icon button (delegate-certificate page)
   -------------------------------------------------------------------------- */
.delegate-toggle--active {
  color: #16a34a;
}

.delegate-toggle--active:hover,
.delegate-toggle--active:focus-visible {
  color: #15803d;
  background-color: rgba(22, 163, 74, 0.08);
}

.delegate-toggle--inactive {
  color: var(--color-fg-muted);
}

.delegate-toggle--inactive:hover,
.delegate-toggle--inactive:focus-visible {
  color: var(--color-primary);
  background-color: var(--color-muted);
}

/* --------------------------------------------------------------------------
   Certificate status box (summary-checkout page)
   -------------------------------------------------------------------------- */
.cert-status {
  margin-bottom: 2rem;
}

.cert-status__state {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  border: 1px solid transparent;
}

.cert-status__icon {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cert-status__body {
  flex: 1;
  min-width: 0;
}

.cert-status__text {
  font-size: var(--font-size-sm);
  font-weight: 500;
  margin: 0;
  line-height: var(--line-height-snug);
}

.cert-status__cta {
  margin-top: 0.875rem;
}

/* Spinner animation */
.cert-status__spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(2, 132, 199, 0.2);
  border-top-color: var(--color-info);
  border-radius: 50%;
  animation: cert-status-spin 0.75s linear infinite;
}

@keyframes cert-status-spin {
  to { transform: rotate(360deg); }
}

/* Loading — blue */
.cert-status--loading {
  background-color: rgba(2, 132, 199, 0.06);
  border-color: rgba(2, 132, 199, 0.25);
  color: #0c4a6e;
}

/* Success — green */
.cert-status--success {
  background-color: rgba(22, 101, 52, 0.06);
  border-color: rgba(22, 101, 52, 0.2);
  color: var(--color-success);
}

/* Error / partial success — amber */
.cert-status--error {
  background-color: rgba(217, 119, 6, 0.07);
  border-color: rgba(217, 119, 6, 0.3);
  color: #92400e;
}

/* --------------------------------------------------------------------------
   Search empty state (search.html — no results)
   -------------------------------------------------------------------------- */
.search-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 4rem 1.5rem;
  border-top: 1px solid var(--color-border);
  margin-top: 3rem;
}

.search-empty__icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background-color: var(--color-muted);
  color: var(--color-muted-fg);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-bottom: 1.5rem;
}

.search-empty__title {
  font-size: var(--font-size-xl);
  font-weight: 700;
  color: var(--color-fg);
  margin-bottom: 0.625rem;
}

.search-empty__text {
  font-size: var(--font-size-sm);
  color: var(--color-muted-fg);
  max-width: 400px;
  margin-bottom: 1.75rem;
  line-height: var(--line-height-base);
}

.search-empty__suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin-bottom: 1.75rem;
}

