﻿/*
 * WCMERNS Eco Compliance Framework — Theme CSS
 * Companion to Tailwind CDN. Provides:
 *   - CSS custom properties (design tokens)
 *   - ASP.NET WebForms control resets (DataGrid, etc.)
 *   - Sidebar layout helpers
 *   - Component overrides not easily expressed in Tailwind utility classes
 */

/* =========================================================
   1. DESIGN TOKENS
   ========================================================= */
:root {
    /* Brand / Primary */
    --color-primary:            #003527;
    --color-primary-container:  #064E3B;
    --color-on-primary:         #ffffff;
    --color-primary-fixed:      #b0f0d6;
    --color-primary-fixed-dim:  #95d3ba;
    --color-on-primary-fixed:   #002117;

    /* Secondary */
    --color-secondary:          #2f6388;
    --color-secondary-container:#a3d4ff;
    --color-on-secondary:       #ffffff;

    /* Tertiary */
    --color-tertiary:           #00314f;
    --color-tertiary-container: #004871;
    --color-on-tertiary:        #ffffff;

    /* Error */
    --color-error:              #ba1a1a;
    --color-error-container:    #ffdad6;
    --color-on-error:           #ffffff;

    /* Surfaces */
    --color-background:                 #f8f9ff;
    --color-surface:                    #f8f9ff;
    --color-surface-container-lowest:   #ffffff;
    --color-surface-container-low:      #eff4ff;
    --color-surface-container:          #e6eeff;
    --color-surface-container-high:     #dce9ff;
    --color-surface-container-highest:  #d5e3fc;
    --color-surface-dim:                #ccdbf3;
    --color-surface-bright:             #f8f9ff;
    --color-surface-variant:            #d5e3fc;

    /* On-surface */
    --color-on-background:      #0d1c2e;
    --color-on-surface:         #0d1c2e;
    --color-on-surface-variant: #404944;
    --color-inverse-surface:    #233144;
    --color-inverse-on-surface: #eaf1ff;

    /* Outline */
    --color-outline:            #707974;
    --color-outline-variant:    #bfc9c3;

    /* Typography */
    --font-heading:             'Public Sans', sans-serif;
    --font-body:                'Inter', sans-serif;

    /* Spacing base unit = 8px */
    --space-1: 0.5rem;   /* 8px  */
    --space-2: 1rem;     /* 16px */
    --space-3: 1.5rem;   /* 24px */
    --space-4: 2rem;     /* 32px */
    --space-6: 3rem;     /* 48px */

    /* Layout */
    --sidebar-width: 16rem;   /* 256px / w-64 */
    --header-height: 4rem;    /* 64px  / h-16 */
    --banner-height: 2.5rem;  /* env warning banner — 40px */
    --content-max:   1440px;
}

/* =========================================================
   /* =========================================================
   2. BASE RESET / BODY
   ========================================================= */
html {
    font-size: 16px; /* Override Bootstrap's 14px so 1rem = 16px sitewide */
}

body {
    background-color: var(--color-background);
    color: var(--color-on-background);
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.5;
    margin: 0;
    padding: 0;
}

/* When dev banner is showing, shift everything down by banner height */
body.has-env-banner .wcm-header {
    top: var(--banner-height, 2.5rem);
}
body.has-env-banner .wcm-sidebar {
    top: var(--banner-height, 2.5rem);
    padding-top: calc(var(--header-height) + var(--banner-height, 2.5rem));
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
}

/* =========================================================
   3. LAYOUT SHELL
   ========================================================= */

/* Fixed top header */
.wcm-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background-color: var(--color-surface-container-lowest);
    border-bottom: 1px solid var(--color-surface-container-high);
    z-index: 50;
    display: flex;
    align-items: center;
    padding: 0 var(--space-3);
    gap: var(--space-2);
}

.wcm-header-brand {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    width: var(--sidebar-width);
    flex-shrink: 0;
}

.wcm-header-brand-logo {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.5rem;
    background-color: var(--color-primary-container);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-family: var(--font-heading);
    font-size: 0.75rem;
}

.wcm-header-facility {
    flex: 1;
    display: flex;
    align-items: center;
    gap: var(--space-1);
}

.wcm-header-actions {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    margin-left: auto;
}

.wcm-header-icon-btn {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 50%;
    border: none;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-on-surface-variant);
    transition: background-color 0.15s;
}

.wcm-header-icon-btn:hover {
    background-color: var(--color-surface-container-low);
}

/* Facility selector in header */
.wcm-facility-select {
    height: 2.25rem;
    border: 1px solid var(--color-outline-variant);
    border-radius: 0.375rem;
    padding: 0 0.75rem;
    font-family: var(--font-body);
    font-size: 0.875rem;
    color: var(--color-on-surface);
    background-color: var(--color-surface-container-lowest);
    cursor: pointer;
    min-width: 200px;
    max-width: 320px;
}

.wcm-facility-select:focus {
    outline: 2px solid #0369A1;
    outline-offset: 1px;
}

/* Fixed left sidebar */
.wcm-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background-color: var(--color-surface-container-low);
    border-right: 1px solid var(--color-surface-container-high);
    z-index: 40;
    display: flex;
    flex-direction: column;
    padding-top: var(--header-height);
    overflow-y: auto;
}

.wcm-sidebar-nav {
    flex: 1;
    padding: var(--space-2) 0.75rem;
}

.wcm-sidebar-footer {
    padding: var(--space-1) 0.75rem;
    border-top: 1px solid var(--color-surface-container-high);
}

/* Nav link base */
.wcm-nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-on-surface-variant);
    text-decoration: none;
    transition: background-color 0.15s, color 0.15s;
    white-space: nowrap;
}

.wcm-nav-link:hover {
    background-color: var(--color-surface-container);
    color: var(--color-primary);
    text-decoration: none;
}

/* Active / current page nav link */
.wcm-nav-link.active,
.wcm-nav-link-active {
    background-color: #ecfdf5;
    color: var(--color-primary);
    border-right: 3px solid var(--color-primary);
    font-weight: 600;
}

/* Expandable nav group */
.wcm-nav-group-children {
    margin-top: 0.25rem;
    margin-left: 2.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.wcm-nav-child-link {
    display: block;
    padding: 0.5rem 0.5rem;
    font-size: 0.8125rem;
    color: var(--color-on-surface-variant);
    text-decoration: none;
    border-radius: 0.25rem;
    transition: color 0.15s, background-color 0.15s;
}

.wcm-nav-child-link:hover {
    color: var(--color-primary);
    background-color: var(--color-surface-container);
    text-decoration: none;
}

.wcm-nav-child-link.active {
    color: var(--color-primary);
    font-weight: 600;
}

/* Logout nav link */
.wcm-nav-link-logout {
    color: var(--color-error) !important;
}

.wcm-nav-link-logout:hover {
    background-color: #fff1f1 !important;
    color: var(--color-error) !important;
}

/* Main content area — offset for sidebar + header */
.wcm-main {
    margin-left: var(--sidebar-width);
    padding-top: calc(var(--header-height) + 2rem);
    padding-left: 2rem;
    padding-right: 2rem;
    padding-bottom: 3rem;
    min-height: 100vh;
    max-width: calc(var(--content-max) + var(--sidebar-width));
    box-sizing: border-box;
}

body.has-env-banner .wcm-main {
    padding-top: calc(var(--header-height) + var(--banner-height) + 2rem);
}

/* Page title area */
.wcm-page-header {
    margin-bottom: 2rem;
}

.wcm-page-title {
    font-family: var(--font-heading);
    font-size: 2rem;
    font-weight: 700;
    color: var(--color-primary);
    margin: 0 0 0.25rem 0;
    line-height: 1.2;
}

.wcm-page-subtitle {
    font-size: 1rem;
    color: var(--color-on-surface-variant);
    margin: 0;
}

/* =========================================================
   4. CARDS
   ========================================================= */
.wcm-card {
    background-color: var(--color-surface-container-lowest);
    border: 1px solid var(--color-surface-container-high);
    border-radius: 0.5rem;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.wcm-card-flush {
    padding: 0;
    overflow: hidden;
}

/* Card header inside a flush card needs its own padding */
.wcm-card-header-padded {
    padding: 1.25rem 1.5rem;
    margin-bottom: 0;
}

/* Narrow form group — limits width on wide screens */
.wcm-form-group-narrow {
    max-width: 400px;
}

/* Section label — bold heading above a sub-form area */
.wcm-section-label {
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--color-primary);
    margin-bottom: 1rem;
}

/* Padded add-row inside a flush card */
.wcm-card-add-row {
    padding: 1rem 1.5rem;
}

/* Narrow input-group */
.wcm-input-group-narrow {
    max-width: 500px;
}

/* Icon primary color */
.wcm-icon-primary {
    color: var(--color-primary);
}

/* Datepicker wrapper */
.wcm-datepicker-wrap {
    max-width: 260px;
    display: flex;
    width: 100%;
}

.wcm-datepicker-wrap input {
    flex: 1;
    min-width: 0;
}

/* Bootstrap input-group styling for datepicker */
.input-group {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    width: 100%;
    position: relative;
}

.input-group .wcm-form-control {
    flex: 1;
    min-width: 0;
    height: auto;
    display: flex;
    align-items: center;
}

.input-group .input-group-addon {
    padding: 0.75rem 1rem;
    margin-bottom: 0;
    font-size: 1rem;
    font-weight: normal;
    line-height: 1.5;
    color: #333;
    text-align: center;
    background-color: #eee;
    border: 1px solid #ccc;
    border-radius: 0;
    white-space: nowrap;
}

.input-group > .wcm-form-control:first-child {
    border-radius: 0.375rem 0 0 0.375rem;
}

.input-group .input-group-addon {
    border-radius: 0 0.375rem 0.375rem 0;
    border-left: 0;
}

/* Inline input add-on */
.wcm-input-add-on {
    cursor: pointer;
    background: #f1f5f9;
    border: 1px solid #bfc9c3;
    padding: 0.5rem 0.625rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-left: none;
    border-radius: 0 0.375rem 0.375rem 0;
    height: 100%;
    min-width: 2.5rem;
}

/* List item row inside a flush card */
.wcm-list-row {
    padding: 0.75rem 1.5rem;
    border-bottom: 1px solid #E5E7EB;
}

.wcm-list-row-inner {
    padding: 0 1.5rem;
}

.wcm-list-row-pad {
    padding: 1rem 1.5rem;
}

/* Responsible-individual card item */
.wcm-resp-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #E5E7EB;
}

.wcm-resp-meta {
    width: 100%;
    gap: 0.25rem;
}

.wcm-resp-actions {
    margin-top: 0.5rem;
}

.wcm-detail-row {
    margin-top: 0.25rem;
}

.wcm-flex-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.wcm-flex-actions-sm {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

/* Hint text under a label */
.wcm-hint-text {
    font-size: 0.8125rem;
    color: #707974;
}

.wcm-inline {
    display: inline-block;
    margin: 0 0.5rem;
    width: auto !important;
}

.wcm-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}

.wcm-radio-list {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-top: 0.25rem;
}

.wcm-radio-list table {
    border-collapse: collapse;
}

.wcm-radio-list tr {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.wcm-radio-list td {
    display: flex;
    align-items: center;
    white-space: nowrap;
    padding: 0;
}

.wcm-radio-list input[type="radio"] {
    margin: 0 0.4rem 0 0;
}

.wcm-radio-list td label {
    display: inline;
    max-width: none;
    margin-bottom: 0;
    font-weight: 400;
    font-size: 0.9375rem;
    color: var(--color-on-background);
    white-space: nowrap;
    margin-right: 0;
}

.wcm-card-title {
    font-family: var(--font-heading);
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--color-on-background);
    margin: 0;
}

/* =========================================================
   5. BUTTONS
   ========================================================= */
.wcm-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 1.25rem;
    border-radius: 0.375rem;
    font-family: var(--font-body);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    text-decoration: none;
    transition: background-color 0.15s, color 0.15s, border-color 0.15s, box-shadow 0.15s;
    line-height: 1.25;
    white-space: nowrap;
    vertical-align: middle;
    user-select: none;
}
.wcm-btn:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

/* — Primary — */
.wcm-btn-primary {
    background-color: var(--color-primary-container);
    color: #ffffff;
    border-color: var(--color-primary-container);
}
.wcm-btn-primary:hover, .wcm-btn-primary:focus {
    background-color: var(--color-primary);
    border-color: var(--color-primary);
    color: #ffffff;
    text-decoration: none;
}

/* — Secondary — */
.wcm-btn-secondary {
    background-color: transparent;
    color: var(--color-on-surface-variant);
    border-color: var(--color-outline-variant);
}
.wcm-btn-secondary:hover, .wcm-btn-secondary:focus {
    background-color: var(--color-surface-container-low);
    color: var(--color-on-surface-variant);
    text-decoration: none;
}

/* — Success — */
.wcm-btn-success {
    background-color: #059669;
    color: #ffffff;
    border-color: #059669;
}
.wcm-btn-success:hover, .wcm-btn-success:focus {
    background-color: #047857;
    border-color: #047857;
    color: #ffffff;
    text-decoration: none;
}

/* — Danger — */
.wcm-btn-danger {
    background-color: transparent;
    color: var(--color-error);
    border-color: var(--color-error);
}
.wcm-btn-danger:hover, .wcm-btn-danger:focus {
    background-color: var(--color-error-container);
    color: var(--color-error);
    text-decoration: none;
}

/* — Danger filled (for destructive confirm actions) — */
.wcm-btn-danger-fill {
    background-color: var(--color-error);
    color: #ffffff;
    border-color: var(--color-error);
}
.wcm-btn-danger-fill:hover, .wcm-btn-danger-fill:focus {
    background-color: #9b1313;
    border-color: #9b1313;
    color: #ffffff;
    text-decoration: none;
}

/* — Link style — */
.wcm-btn-link {
    background: none;
    border-color: transparent;
    color: var(--color-secondary);
    padding-left: 0;
    padding-right: 0;
    font-weight: 500;
}
.wcm-btn-link:hover, .wcm-btn-link:focus {
    color: var(--color-primary);
    text-decoration: underline;
    background: none;
}

/* — Sizes — */
.wcm-btn-sm {
    padding: 0.25rem 0.75rem;
    font-size: 0.8125rem;
}
.wcm-btn-xs {
    padding: 0.125rem 0.5rem;
    font-size: 0.75rem;
    border-radius: 0.25rem;
}
.wcm-btn-lg {
    padding: 0.75rem 1.75rem;
    font-size: 1rem;
}

/* — Button toolbar (row of buttons) — */
.wcm-btn-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 1.25rem;
}

/* — DataGrid edit/update/cancel link buttons — */
.wcm-table a, .wcm-table .wcm-link {
    color: var(--color-secondary);
    text-decoration: none;
    font-weight: 500;
}
.wcm-table a:hover, .wcm-table .wcm-link:hover {
    color: var(--color-primary);
    text-decoration: underline;
}

/* =========================================================
   6. FORMS
   ========================================================= */
.wcm-form-group {
    margin-bottom: 1.25rem;
}

.wcm-form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-on-surface-variant);
    margin-bottom: 0.375rem;
    letter-spacing: 0.015em;
}

.wcm-form-label-nowrap {
    white-space: nowrap;
}

.wcm-form-control,
.wcm-form-control.form-control {
    display: block;
    width: 100%;
    box-sizing: border-box;
    height: 2.5rem;
    padding: 0 0.75rem;
    font-family: var(--font-body);
    font-size: 0.875rem;
    color: var(--color-on-surface);
    background-color: var(--color-surface-container-lowest);
    border: 1px solid var(--color-outline-variant);
    border-radius: 0.375rem;
    transition: border-color 0.15s;
    -webkit-appearance: none;
    appearance: none;
}

.wcm-form-control:focus {
    outline: 2px solid #0369A1;
    outline-offset: 0;
    border-color: #0369A1;
}

textarea.wcm-form-control {
    height: auto;
    padding: 0.5rem 0.75rem;
    resize: vertical;
}

select.wcm-form-control {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23707974' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.6rem center;
    padding-right: 2rem;
}

/* RadioButtonList styling */
.wcm-radio-group {
    font-size: 0.875rem;
    font-weight: 400;
    display: flex;
    flex-wrap: wrap;
}

.wcm-radio-group input[type="radio"] {
    margin-right: 0.4rem;
    vertical-align: middle;
}

.wcm-radio-group label {
    font-size: 0.875rem;
    font-weight: 400;
    margin-right: 1.5rem;
    margin-bottom: 0;
    white-space: nowrap;
    vertical-align: middle;
}

/* =========================================================
   7. DATA TABLES (maps to ASP DataGrid / GridView)
   ========================================================= */
.wcm-table-wrapper {
    overflow: hidden;
    border: 1px solid var(--color-surface-container-high);
}

.wcm-table,
.wcm-table.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
    color: var(--color-on-surface);
    background-color: var(--color-surface-container-lowest);
    margin-bottom: 0;
}

.wcm-table thead th,
.wcm-table.table thead th {
    background-color: var(--color-surface-container-low);
    color: var(--color-on-surface-variant);
    font-weight: 600;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--color-surface-container-high);
    white-space: nowrap;
    position: sticky;
    top: 0;
}

.wcm-table tbody tr:hover {
    background-color: var(--color-surface-container-low);
}

.wcm-table tbody tr:nth-child(even) {
    background-color: var(--color-surface-container-lowest);
}

.wcm-table tbody td,
.wcm-table.table tbody td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--color-surface-container);
    vertical-align: middle;
}

.wcm-table tbody tr:last-child td {
    border-bottom: none;
}

/* Pager row produced by ASP DataGrid */
.wcm-table tr.gridview-pager td,
.wcm-table .gridview-pager td {
    padding: 0.625rem 1rem;
    background-color: var(--color-surface-container-low);
    text-align: center;
    border-bottom: none;
}

/* =========================================================
   8. STATUS CHIPS / BADGES
   ========================================================= */
.wcm-chip {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.625rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

.wcm-chip-green  { background-color: #d1fae5; color: #065f46; }
.wcm-chip-amber  { background-color: #fef3c7; color: #92400e; }
.wcm-chip-red    { background-color: var(--color-error-container); color: #7f1d1d; }
.wcm-chip-blue   { background-color: #dbeafe; color: #1e3a5f; }
.wcm-chip-slate  { background-color: var(--color-surface-container); color: var(--color-on-surface-variant); }

.wcm-report-message {
    display: block;
    margin: 0.5rem 0 1rem;
}

/* =========================================================
   9. ALERTS / MESSAGES
   ========================================================= */
.wcm-alert {
    display: block;
    padding: 0.875rem 1.25rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    margin-bottom: 1rem;
    border-left: 4px solid transparent;
}

/* Hide alert when it has no text content (e.g. empty ASP Label) */
.wcm-alert:empty {
    display: none;
}

.wcm-alert-info    { background-color: #eff6ff; border-color: #3b82f6; color: #1e3a5f; }
.wcm-alert-success { background-color: #f0fdf4; border-color: var(--color-primary-container); color: #065f46; }
.wcm-alert-warning { background-color: #fffbeb; border-color: #f59e0b; color: #78350f; }
.wcm-alert-danger  { background-color: #fff1f2; border-color: var(--color-error); color: #7f1d1d; }

/* =========================================================
   10. ENV-WARNING BANNER (keep existing class, restyle)
   ========================================================= */
.env-warning-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    background-color: var(--color-error);
    color: #fff;
    text-align: center;
    font-weight: 600;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    height: var(--banner-height, 2.5rem);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* =========================================================
   11. FOOTER
   ========================================================= */
.wcm-footer {
    margin-left: var(--sidebar-width);
    padding: 1.5rem 2rem;
    border-top: 1px solid var(--color-surface-container-high);
    font-size: 0.75rem;
    color: var(--color-on-surface-variant);
    text-align: center;
}

/* =========================================================
   12. HEADER — brand text classes (replacing inline styles)
   ========================================================= */
.wcm-header-brand-text { display: flex; flex-direction: column; justify-content: center; }
.wcm-brand-name  { font-family: 'Public Sans', sans-serif; font-weight: 700; font-size: 0.875rem; color: var(--color-primary); line-height: 1.1; }
.wcm-brand-sub   { font-size: 0.625rem; color: #707974; text-transform: uppercase; letter-spacing: 0.07em; }

/* =========================================================
   13. USER DROPDOWN (CSS-driven, no inline styles)
   ========================================================= */
.wcm-user-menu-wrap { position: relative; }

.wcm-user-dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    min-width: 160px;
    z-index: 400;
    display: none;
    overflow: hidden;
}

.wcm-user-dropdown.wcm-user-dd-open { display: block; }

.wcm-user-dd-name {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #e2e8f0;
    font-size: 0.875rem;
    font-weight: 600;
    color: #003527;
}

.wcm-user-dd-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    font-size: 0.875rem;
    color: #404944;
    text-decoration: none;
}
.wcm-user-dd-link:hover { background: #f1f5f9; }
.wcm-user-dd-link-danger { color: #ba1a1a; }
.wcm-user-dd-link-danger:hover { background: #fff1f1; }

/* =========================================================
   14. FOOTER classes (replacing inline styles)
   ========================================================= */
.wcm-footer-link       { color: var(--color-primary); }
.wcm-footer-disclaimer { font-size: 0.7rem; color: #9ca3af; display: block; margin-top: 0.5rem; }

/* =========================================================
   15. HAMBURGER BUTTON (hidden on desktop)
   ========================================================= */
.wcm-hamburger {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.375rem;
    color: var(--color-primary);
    border-radius: 0.375rem;
    margin-right: 0.5rem;
    align-items: center;
    justify-content: center;
}
.wcm-hamburger:hover { background: var(--color-surface-container); }
.wcm-hamburger .material-symbols-outlined { font-size: 1.5rem; }

/* =========================================================
   16. SIDEBAR OVERLAY (mobile tap-to-close)
   ========================================================= */
.wcm-sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.35);
    z-index: 149;
}
.wcm-sidebar-overlay.active { display: block; }

/* =========================================================
   17. MOBILE BOTTOM NAV
   ========================================================= */
/* Hide mobile nav icons until Material Symbols font loads to prevent text flash */
.wcm-mobile-nav {
    display: none; /* shown only on mobile via media query */
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3.75rem;
    background: #fff;
    border-top: 1px solid var(--color-surface-container-high);
    z-index: 300;
    flex-direction: row;
    align-items: stretch;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.06);
}

.wcm-mobile-nav .material-symbols-outlined {
    visibility: hidden;
}
.fonts-loaded .wcm-mobile-nav .material-symbols-outlined {
    visibility: visible;
}

.wcm-mobile-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.125rem;
    color: #707974;
    text-decoration: none;
    font-size: 0.625rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    padding: 0.375rem 0;
    transition: color 0.15s;
    -webkit-tap-highlight-color: transparent;
}
.wcm-mobile-nav-item:last-child {
    padding-right: env(safe-area-inset-right, 0.5rem);
}
.wcm-mobile-nav-item .material-symbols-outlined { font-size: 1.375rem; }
.wcm-mobile-nav-item:hover,
.wcm-mobile-nav-item.active { color: var(--color-primary); }
.wcm-mobile-nav-item.active .material-symbols-outlined {
    font-variation-settings: 'FILL' 1;
}

/* Centre FAB-style "New" button */
.wcm-mobile-nav-fab {
    position: relative;
    flex: 1.2;
}
.wcm-mobile-nav-fab .material-symbols-outlined {
    background: var(--color-primary);
    color: #fff;
    border-radius: 50%;
    width: 2.25rem;
    height: 2.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-top: -0.625rem;
    box-shadow: 0 2px 8px rgba(6,78,59,0.35);
}
.wcm-mobile-nav-fab.active .material-symbols-outlined,
.wcm-mobile-nav-fab:hover .material-symbols-outlined {
    background: var(--color-primary-container);
}

/* =========================================================
   18. RESPONSIVE — Mobile breakpoint (≤ 768px)
   ========================================================= */
@media (max-width: 768px) {

    /* Show hamburger */
    .wcm-hamburger { display: flex; }

    /* Show bottom nav */
    .wcm-mobile-nav { display: flex; }

    /* Sidebar slides in from left as overlay */
    .wcm-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100%;
        padding-top: 3.25rem; /* match mobile header height */
        padding-bottom: 4rem; /* keep logout above bottom nav */
        transform: translateX(-100%);
        transition: transform 0.22s cubic-bezier(.4,0,.2,1);
        z-index: 150;
        box-shadow: 4px 0 24px rgba(0,0,0,0.12);
    }
    .wcm-sidebar.open { transform: translateX(0); }

    /* Main content: full width, bottom padding for nav bar */
    .wcm-main {
        margin-left: 0;
        padding: 1rem 0.875rem 5rem;
    }

    /* Footer: full width, hidden on mobile (bottom nav replaces it) */
    .wcm-footer {
        display: none;
    }

    /* Header: tighten up */
    .wcm-header {
        padding: 0 0.75rem;
        height: 3.25rem;
    }
    .wcm-header-brand-logo {
        width: 2rem;
        height: 2rem;
        font-size: 0.75rem;
    }
    .wcm-brand-name  { font-size: 0.8rem; }
    .wcm-brand-sub   { display: none; }

    /* Cards: reduce padding */
    .wcm-card { padding: 1rem; margin-bottom: 1rem; }
    .wcm-card-header { margin-bottom: 0.875rem; }
    .wcm-card-header-padded { padding: 0.875rem 1rem; }
    .wcm-card-add-row { padding: 0.75rem 1rem; }
    .wcm-list-row { padding: 0.625rem 1rem; }
    .wcm-list-row-inner { padding: 0 1rem; }
    .wcm-list-row-pad { padding: 0.75rem 1rem; }

    /* Tables: on mobile rows become individual cards, so remove the wrapper border/radius */
    .wcm-table-wrapper {
        overflow-x: visible;
        overflow-y: visible;
        border: none;
        border-radius: 0;
        background: transparent;
    }

    /* Hide the outer card border on mobile — row cards are the visual units */
    .wcm-card-flush {
        border: none;
        box-shadow: none;
    }

    /* ── Card-flip: each row becomes a card, each cell a labeled row ── */
    .wcm-table,
    .wcm-table.table {
        min-width: 0;
        width: 100%;
        font-size: 0.875rem;
        table-layout: fixed;
    }
    .wcm-table, .wcm-table.table { border: none; }

    .wcm-table thead,
    .wcm-table.table thead {
        /* visually hidden but still readable by screen readers */
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0,0,0,0);
        white-space: nowrap;
        border: 0;
    }

    .wcm-table tbody tr,
    .wcm-table.table tbody tr {
        display: block;
        width: 100%;
        box-sizing: border-box;
        background: #ffffff;
        border: 1px solid var(--color-outline-variant);
        border-radius: 0.5rem;
        margin-bottom: 1rem;
        box-shadow: 0 2px 8px rgba(0,0,0,0.13);
        overflow: hidden;
    }

    .wcm-table tbody tr:hover,
    .wcm-table.table tbody tr:hover {
        background: var(--color-surface-container-low);
    }

    .wcm-table tbody tr:nth-child(even),
    .wcm-table.table tbody tr:nth-child(even) {
        background: var(--color-surface-container-lowest);
    }

    /* Pager row: restore normal block */
    .wcm-table tr.gridview-pager,
    .wcm-table .gridview-pager {
        display: block;
        border-radius: 0.375rem;
        margin-bottom: 0;
    }

    .wcm-table tbody td,
    .wcm-table.table tbody td {
        display: flex;
        align-items: flex-start;
        gap: 0.5rem;
        padding: 0.5rem 0.875rem;
        border-bottom: none;
        font-size: 0.875rem;
        text-align: left;
        white-space: normal;
        word-break: break-word;
        overflow-wrap: break-word;
        max-width: 100%;
        min-width: 0;
    }

    /* First cell in each card = task name — green header band */
    .wcm-table tbody tr td:first-child,
    .wcm-table.table tbody tr td:first-child {
        background-color: #064e3b;
        border-bottom: none;
        border-radius: 0.5rem 0.5rem 0 0;
        font-weight: 600;
        color: #ffffff;
        padding-top: 0.625rem;
        padding-bottom: 0.625rem;
    }
    .wcm-table tbody tr td:first-child a,
    .wcm-table.table tbody tr td:first-child a {
        color: #ffffff;
    }

    .wcm-table tbody tr td:last-child {
        border-bottom: none;
        padding-bottom: 0.625rem;
    }

    /* The injected label (set by wcmInitCardFlip JS) */
    .wcm-table tbody td::before {
        content: attr(data-label);
        font-size: 0.6875rem;
        font-weight: 700;
        color: var(--color-on-surface-variant);
        text-transform: uppercase;
        letter-spacing: 0.05em;
        white-space: nowrap;
        min-width: 7rem;
        flex-shrink: 0;
        padding-top: 0.125rem;
    }

    /* Cells with no label (action columns, edit buttons) */
    .wcm-table tbody td[data-label=""],
    .wcm-table tbody td:not([data-label]) {
        justify-content: flex-start;
        border-bottom: none;
        padding-top: 0.375rem;
        padding-bottom: 0.625rem;
    }
    .wcm-table tbody td[data-label=""]::before,
    .wcm-table tbody td:not([data-label])::before {
        display: none;
    }

    /* Forms: full width inputs */
    .wcm-form-group-narrow { max-width: 100%; }
    .wcm-form-control { font-size: 1rem; } /* prevent iOS zoom on focus */

    /* Page header */
    .wcm-page-header { margin-bottom: 1rem; }
    .wcm-page-title  { font-size: 1.25rem; }

    /* Grid: single column */
    .wcm-grid-2, .wcm-grid-3 { grid-template-columns: 1fr; gap: 0; }

    /* Env warning banner: add top offset for header */
    .env-warning-banner { font-size: 0.75rem; padding: 0.375rem 1rem; height: auto; min-height: var(--banner-height); }
    body.has-env-banner .wcm-header { top: var(--banner-height); }
    body.has-env-banner .wcm-sidebar { padding-top: calc(3.25rem + var(--banner-height)); }

    /* Buttons: full-width stacked on mobile forms */
    .wcm-btn-toolbar { flex-wrap: wrap; gap: 0.5rem; }
}

/* =========================================================
   19. UTILITY HELPERS
   ========================================================= */
.wcm-grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

.wcm-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

@media (max-width: 900px) {
    .wcm-grid-2, .wcm-grid-3 { grid-template-columns: 1fr; }
}

.wcm-divider {
    border: none;
    border-top: 1px solid var(--color-surface-container-high);
    margin: 1.5rem 0;
}

/* Material Symbols sizing helper */
.wcm-icon    { font-size: 1.25rem; vertical-align: middle; line-height: 1; }
.wcm-icon-sm { font-size: 1rem;    vertical-align: middle; line-height: 1; display: flex; }

