/**
 * MISS PYJAMA — DESIGN SYSTEM
 * Product-register design tokens. Tuned warm toward the brand pink.
 * (Originally Stripe-inspired; retuned for Miss Pyjama via impeccable.)
 */

/* ============================================
   COLOR PALETTE — OKLCH, warm-tinted neutrals
   ============================================ */
:root {
    /* Primary — brand pink (header.php overrides these from APP_COLOR with !important) */
    --color-primary: oklch(0.78 0.10 350);
    --color-primary-hover: oklch(0.72 0.12 350);
    --color-primary-light: oklch(0.96 0.025 350);
    --color-primary-soft: oklch(0.96 0.025 350);
    --color-primary-edge: oklch(0.88 0.06 350);

    /* Text — warm-tinted neutrals (chroma 0.006–0.012, never pure gray) */
    --color-text-primary: oklch(0.22 0.012 350);
    --color-text-secondary: oklch(0.38 0.010 350);
    --color-text-muted: oklch(0.58 0.008 350);
    --color-text-disabled: oklch(0.72 0.006 350);

    /* Surfaces — warm whites */
    --color-bg-primary: oklch(1.000 0.002 350);
    --color-bg-secondary: oklch(0.985 0.004 350);
    --color-bg-tertiary: oklch(0.970 0.005 350);
    --color-bg-panel: oklch(0.975 0.005 350);
    --color-bg-muted: oklch(0.960 0.006 350);

    /* Borders */
    --color-border-light: oklch(0.93 0.006 350);
    --color-border-medium: oklch(0.86 0.008 350);
    --color-border-dark: oklch(0.74 0.010 350);

    /* Status colors */
    --color-success: oklch(0.62 0.14 155);
    --color-success-light: oklch(0.95 0.04 155);
    --color-warning: oklch(0.78 0.13 70);
    --color-warning-light: oklch(0.96 0.05 70);
    --color-danger: oklch(0.58 0.18 25);
    --color-danger-light: oklch(0.95 0.04 25);
    --color-info: oklch(0.62 0.13 240);
    --color-info-light: oklch(0.95 0.04 240);

    /* Shadows — tinted with brand hue, not flat black */
    --shadow-sm: 0 1px 2px rgba(241, 145, 186, 0.06), 0 1px 1px rgba(20, 15, 18, 0.04);
    --shadow-md: 0 4px 12px rgba(241, 145, 186, 0.10), 0 2px 4px rgba(20, 15, 18, 0.05);
    --shadow-lg: 0 12px 28px rgba(241, 145, 186, 0.14), 0 4px 10px rgba(20, 15, 18, 0.06);
    --shadow-xl: 0 24px 48px rgba(241, 145, 186, 0.18), 0 8px 16px rgba(20, 15, 18, 0.08);

    /* Border radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 18px;
    --radius-full: 9999px;

    /* Spacing — 4px base */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;

    /* Typography */
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, "Helvetica Neue", Arial, sans-serif;
    --font-mono: "SF Mono", Monaco, "Cascadia Code", "Roboto Mono", Consolas, "Courier New", monospace;

    /* Font sizes — fixed rem-equivalent, ~1.2 ratio */
    --text-xs: 12px;
    --text-sm: 13px;
    --text-base: 14px;
    --text-lg: 16px;
    --text-xl: 18px;
    --text-2xl: 22px;
    --text-3xl: 28px;

    /* Line heights */
    --leading-tight: 1.25;
    --leading-normal: 1.5;
    --leading-loose: 1.75;

    /* Font weights */
    --weight-normal: 400;
    --weight-medium: 500;
    --weight-semibold: 600;
    --weight-bold: 700;

    /* Heights — paired with input/button vertical rhythm */
    --h-control-sm: 32px;
    --h-control-md: 40px;
    --h-control-lg: 48px;
}

/* ============================================
   BASE STYLES
   ============================================ */
body {
    font-family: var(--font-sans);
    font-size: var(--text-base);
    line-height: var(--leading-normal);
    color: var(--color-text-primary);
    background-color: var(--color-bg-secondary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================================
   BUTTON SYSTEM - Stripe-style
   ============================================ */

/* Base button */
.btn-modern {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: 10px 16px;
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
    line-height: 1;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
    white-space: nowrap;
}

.btn-modern:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Button sizes */
.btn-modern-sm {
    padding: 6px 12px;
    font-size: var(--text-xs);
}

.btn-modern-lg {
    padding: 12px 20px;
    font-size: var(--text-base);
}

/* Primary button */
.btn-modern-primary {
    background-color: var(--color-primary);
    color: white;
    box-shadow: 0 1px 2px rgba(80, 173, 123, 0.3);
}

.btn-modern-primary:hover:not(:disabled) {
    background-color: var(--color-primary-hover);
    box-shadow: 0 4px 8px rgba(80, 173, 123, 0.2);
    transform: translateY(-1px);
}

.btn-modern-primary:active:not(:disabled) {
    transform: translateY(0);
}

/* Secondary button */
.btn-modern-secondary {
    background-color: white;
    color: var(--color-text-primary);
    border-color: var(--color-border-medium);
    box-shadow: var(--shadow-sm);
}

.btn-modern-secondary:hover:not(:disabled) {
    border-color: var(--color-border-dark);
    box-shadow: var(--shadow-md);
}

/* Danger button */
.btn-modern-danger {
    background-color: var(--color-danger);
    color: white;
}

.btn-modern-danger:hover:not(:disabled) {
    background-color: #C91738;
    box-shadow: 0 4px 8px rgba(223, 28, 65, 0.2);
}

/* Ghost button */
.btn-modern-ghost {
    background-color: transparent;
    color: var(--color-text-secondary);
    border-color: transparent;
}

.btn-modern-ghost:hover:not(:disabled) {
    background-color: var(--color-bg-tertiary);
    color: var(--color-text-primary);
}

/* Button group - Stripe style */
.btn-group-modern {
    display: inline-flex;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    background: white;
    border: 1px solid var(--color-border-light);
}

.btn-group-modern .btn-modern {
    border-radius: 0;
    border: none;
    border-right: 1px solid var(--color-border-light);
    box-shadow: none;
}

.btn-group-modern .btn-modern:first-child {
    border-top-left-radius: var(--radius-md);
    border-bottom-left-radius: var(--radius-md);
}

.btn-group-modern .btn-modern:last-child {
    border-top-right-radius: var(--radius-md);
    border-bottom-right-radius: var(--radius-md);
    border-right: none;
}

.btn-group-modern .btn-modern.active {
    background-color: var(--color-primary-light);
    color: var(--color-primary);
    font-weight: var(--weight-semibold);
}

/* ============================================
   PAGE LAYOUT
   ============================================ */

/* Page header */
.page-header-modern {
    background: white;
    border-bottom: 1px solid var(--color-border-light);
    padding: var(--space-lg) 0;
    margin-bottom: var(--space-lg);
}

.page-header-modern .container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 var(--space-lg);
}

.page-header-modern h1 {
    font-size: var(--text-3xl);
    font-weight: var(--weight-semibold);
    color: var(--color-text-primary);
    margin: 0;
}

.page-header-modern .subtitle {
    font-size: var(--text-sm);
    color: var(--color-text-muted);
    margin-top: var(--space-xs);
}

/* Page wrapper */
.wrapper-modern {
    max-width: 100%;
    width: 100%;
    margin: 0 auto;
    padding: var(--space-lg);
}

.wrapper-modern.container {
    max-width: 100%;
    width: 100%;
}

/* Fix Bootstrap column issues */
.row {
    margin-left: 0;
    margin-right: 0;
}

.row > [class*="col-"] {
    padding-left: 12px;
    padding-right: 12px;
}

/* Ensure columns don't break layout */
@media (min-width: 768px) {
    .col-md-3 {
        flex: 0 0 25%;
        max-width: 25%;
    }
    .col-md-9 {
        flex: 0 0 75%;
        max-width: 75%;
    }
    .col-md-4 {
        flex: 0 0 33.333333%;
        max-width: 33.333333%;
    }
    .col-md-6 {
        flex: 0 0 50%;
        max-width: 50%;
    }
    .col-md-8 {
        flex: 0 0 66.666667%;
        max-width: 66.666667%;
    }
}

/* Fix nested rows */
.row .row {
    margin-left: -12px;
    margin-right: -12px;
}

/* ============================================
   CARDS
   ============================================ */
.card-modern {
    background: white;
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border-light);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.card-modern-header {
    padding: var(--space-lg);
    border-bottom: 1px solid var(--color-border-light);
}

.card-modern-header h3 {
    font-size: var(--text-lg);
    font-weight: var(--weight-semibold);
    color: var(--color-text-primary);
    margin: 0;
}

.card-modern-body {
    padding: var(--space-lg);
}

/* ============================================
   TABLES
   ============================================ */
.table-modern {
    width: 100%;
    background: white;
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--color-border-light);
}

.table-modern thead {
    background-color: var(--color-bg-secondary);
}

.table-modern th {
    padding: 12px 16px;
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-text-secondary);
    text-align: left;
    border-bottom: 1px solid var(--color-border-light);
}

.table-modern td {
    padding: 16px;
    font-size: var(--text-sm);
    color: var(--color-text-primary);
    border-bottom: 1px solid var(--color-border-light);
}

.table-modern tbody tr:last-child td {
    border-bottom: none;
}

.table-modern tbody tr:hover {
    background-color: var(--color-bg-secondary);
}

/* ============================================
   BADGES - Stripe style
   ============================================ */
.badge-modern {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    font-size: var(--text-xs);
    font-weight: var(--weight-medium);
    border-radius: var(--radius-full);
    line-height: 1;
}

.badge-modern-success {
    background-color: var(--color-success-light);
    color: #007A1A;
}

.badge-modern-warning {
    background-color: var(--color-warning-light);
    color: #8B5F00;
}

.badge-modern-danger {
    background-color: var(--color-danger-light);
    color: var(--color-danger);
}

.badge-modern-info {
    background-color: var(--color-info-light);
    color: #0055B3;
}

.badge-modern-neutral {
    background-color: var(--color-bg-tertiary);
    color: var(--color-text-secondary);
}

/* ============================================
   FORMS
   ============================================ */
.form-control-modern {
    display: block;
    width: 100%;
    padding: 10px 12px;
    font-size: var(--text-sm);
    font-family: var(--font-sans);
    line-height: var(--leading-normal);
    color: var(--color-text-primary);
    background-color: white;
    border: 1px solid var(--color-border-medium);
    border-radius: var(--radius-md);
    transition: all 0.15s ease;
}

.form-control-modern:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(80, 173, 123, 0.1);
}

.form-label-modern {
    display: block;
    margin-bottom: var(--space-sm);
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
    color: var(--color-text-primary);
}

/* ============================================
   NAVIGATION
   ============================================ */
.navbar-modern {
    background: white;
    border-bottom: 1px solid var(--color-border-light);
    box-shadow: var(--shadow-sm);
    padding: 0;
    width: 100%;
}

.navbar-modern .container {
    max-width: 100%;
    width: 100%;
    margin: 0 auto;
    padding: 0 var(--space-lg);
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 64px;
}

.navbar-modern .nav-brand {
    font-size: var(--text-lg);
    font-weight: var(--weight-semibold);
    color: var(--color-text-primary);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 12px;
}

.navbar-modern .nav-brand img {
    height: 40px;
    width: auto;
}

.navbar-modern .nav-items {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    flex-wrap: wrap;
}

div#menu-items li {
    list-style: none;
}

div#menu-items li a, div#menu-items li button {
    text-decoration: none;
    font-weight: 600;
    padding: 10px 16px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    border-radius: 8px;
    transition: all 0.2s;
    color: var(--color-text-primary);
    touch-action: manipulation;
    user-select: none;
}

div#menu-items li a:hover, div#menu-items li button:hover {
    background-color: var(--color-bg-secondary);
    color: var(--color-primary);
}

div#menu-items li a:active, div#menu-items li button:active {
    transform: scale(0.98);
}

/* Fix Bootstrap button borders in navbar */
.navbar-modern .btn,
.navbar-modern .dropdown-toggle,
.navbar-modern button.btn {
    border: none !important;
    box-shadow: none !important;
}

.navbar-modern .btn:focus,
.navbar-modern .dropdown-toggle:focus,
.navbar-modern button.btn:focus {
    outline: none !important;
    box-shadow: none !important;
}

/* Dropdown menu styling */
.navbar-modern .dropdown-menu {
    border: 1px solid var(--color-border-light);
    box-shadow: var(--shadow-lg);
    border-radius: var(--radius-lg);
    padding: var(--space-sm);
}

.navbar-modern .dropdown-item {
    border-radius: var(--radius-md);
    padding: 8px 12px;
    font-size: var(--text-sm);
}

.navbar-modern .dropdown-item:hover {
    background-color: var(--color-bg-secondary);
}

.navbar-modern .dropdownMenu {
    background: transparent;
    color: var(--color-text-primary);
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
    padding: 8px 12px;
    transition: background-color 0.15s ease;
}

.navbar-modern .dropdownMenu:hover {
    background-color: var(--color-bg-secondary);
}

/* User avatar */
.user-avatar-modern {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-hover));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
    cursor: pointer;
    transition: transform 0.15s ease;
}

.user-avatar-modern:hover {
    transform: scale(1.05);
}

/* ============================================
   DROPDOWN
   ============================================ */
.dropdown-modern {
    position: relative;
}

.dropdown-modern-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: var(--space-sm);
    min-width: 200px;
    background: white;
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: var(--space-sm);
    z-index: 1000;
}

/* RTL: Dropdown opens to the left */
[dir="rtl"] .dropdown-modern-menu,
body.rtl .dropdown-modern-menu {
    right: auto;
    left: 0;
}

.dropdown-modern-item {
    display: block;
    padding: 10px 12px;
    font-size: var(--text-sm);
    color: var(--color-text-primary);
    text-decoration: none;
    border-radius: var(--radius-md);
    transition: background-color 0.15s ease;
}

.dropdown-modern-item:hover {
    background-color: var(--color-bg-secondary);
}

.dropdown-modern-divider {
    height: 1px;
    background-color: var(--color-border-light);
    margin: var(--space-sm) 0;
}

/* ============================================
   STATS / METRICS
   ============================================ */
.stat-card-modern {
    background: white;
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
}

.stat-card-modern .label {
    font-size: var(--text-sm);
    color: var(--color-text-muted);
    margin-bottom: var(--space-xs);
}

.stat-card-modern .value {
    font-size: var(--text-3xl);
    font-weight: var(--weight-semibold);
    color: var(--color-text-primary);
}

.stat-card-modern .change {
    font-size: var(--text-sm);
    margin-top: var(--space-xs);
}

.stat-card-modern .change.positive {
    color: var(--color-success);
}

.stat-card-modern .change.negative {
    color: var(--color-danger);
}

/* ============================================
   UTILITY CLASSES
   ============================================ */
.text-muted-modern {
    color: var(--color-text-muted);
}

.text-secondary-modern {
    color: var(--color-text-secondary);
}

.bg-secondary-modern {
    background-color: var(--color-bg-secondary);
}

.border-modern {
    border: 1px solid var(--color-border-light);
}

.rounded-modern {
    border-radius: var(--radius-md);
}

.shadow-modern {
    box-shadow: var(--shadow-md);
}

.mb-modern-sm {
    margin-bottom: var(--space-sm);
}

.mb-modern-md {
    margin-bottom: var(--space-md);
}

.mb-modern-lg {
    margin-bottom: var(--space-lg);
}

.gap-modern {
    gap: var(--space-md);
}

/* ============================================
   MODAL - Stripe style
   ============================================ */
.modal-modern .modal-content {
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
}

.modal-modern .modal-header {
    background: white;
    border-bottom: 1px solid var(--color-border-light);
    padding: var(--space-lg);
}

.modal-modern .modal-title {
    font-size: var(--text-xl);
    font-weight: var(--weight-semibold);
    color: var(--color-text-primary);
}

.modal-modern .modal-body {
    padding: var(--space-lg);
}

.modal-modern .modal-footer {
    background: var(--color-bg-secondary);
    border-top: 1px solid var(--color-border-light);
    padding: var(--space-lg);
}

/* ============================================
   ALERTS - Stripe style
   ============================================ */
.alert-modern {
    padding: var(--space-md);
    border-radius: var(--radius-lg);
    border: 1px solid transparent;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.alert-modern-success {
    background-color: var(--color-success-light);
    color: #007A1A;
    border-color: #B7F0C3;
}

.alert-modern-warning {
    background-color: var(--color-warning-light);
    color: #8B5F00;
    border-color: #FFEAB3;
}

.alert-modern-danger {
    background-color: var(--color-danger-light);
    color: var(--color-danger);
    border-color: #FCC7D1;
}

.alert-modern-info {
    background-color: var(--color-info-light);
    color: #0055B3;
    border-color: #B3DAFF;
}

/* ============================================
   FOOTER
   ============================================ */
.footer-modern {
    background: white;
    border-top: 1px solid var(--color-border-light);
    margin-top: var(--space-2xl);
}

.footer-modern .container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 var(--space-lg);
}

/* ============================================
   MOBILE NAVIGATION
   ============================================ */

/* Mobile menu toggle button */
.mobile-menu-toggle {
    display: none; /* Hidden by default */
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    color: var(--color-text-primary);
    font-size: 24px;
    transition: color 0.2s ease;
    z-index: 1001;
}

.mobile-menu-toggle:hover {
    color: var(--color-primary);
}

.mobile-menu-toggle:focus {
    outline: none;
}

/* Mobile menu close button - hidden on desktop */
.mobile-menu-close {
    display: none !important;
}

/* Mobile menu overlay */
.mobile-menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mobile-menu-overlay.show {
    display: block;
    opacity: 1;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    .wrapper-modern {
        padding: 0 var(--space-md) var(--space-xl);
    }

    .page-header-modern .container {
        padding: 0 var(--space-md);
    }

    .navbar-modern .container {
        padding: 0 var(--space-md);
        position: relative;
    }

    .footer-modern .container {
        padding: 0 var(--space-md);
    }

    /* Show mobile menu toggle */
    .mobile-menu-toggle {
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
    }

    /* Hide desktop nav items by default on mobile */
    .navbar-modern .nav-items {
        display: none;
        position: fixed;
        top: 0;
        right: 0;
        width: 280px;
        max-width: 85vw;
        height: 100vh;
        background: white;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        padding: 80px 20px 20px;
        box-shadow: -4px 0 12px rgba(0, 0, 0, 0.15);
        overflow-y: auto;
        z-index: 1000;
        transition: transform 0.3s ease;
        transform: translateX(100%);
    }

    /* RTL: Menu slides from left */
    [dir="rtl"] .navbar-modern .nav-items,
    body.rtl .navbar-modern .nav-items {
        right: auto;
        left: 0;
        transform: translateX(-100%);
    }

    /* Show menu when active */
    .navbar-modern .nav-items.show {
        display: flex;
        transform: translateX(0);
    }

    /* Mobile menu items styling */
    div#menu-items li {
        width: 100%;
        border-bottom: 1px solid var(--color-border-light);
    }

    div#menu-items li a,
    div#menu-items li button {
        width: 100%;
        justify-content: flex-start;
        padding: 16px;
        border-radius: 0;
        font-size: 16px;
    }

    div#menu-items li:last-child {
        border-bottom: none;
    }

    /* Close button in mobile menu */
    .mobile-menu-close {
        display: block !important; /* Show on mobile */
        position: absolute;
        top: 16px;
        right: 16px;
        background: none;
        border: none;
        font-size: 28px;
        color: var(--color-text-secondary);
        cursor: pointer;
        padding: 8px;
        line-height: 1;
        z-index: 1001;
    }

    [dir="rtl"] .mobile-menu-close,
    body.rtl .mobile-menu-close {
        right: auto;
        left: 16px;
    }

    .mobile-menu-close:hover {
        color: var(--color-text-primary);
    }

    /* User dropdown in mobile */
    .dropdown-modern {
        width: 100%;
        margin-top: 16px;
        padding-top: 16px;
        border-top: 1px solid var(--color-border-light);
    }

    .dropdown-modern .user-avatar-modern {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }

    .dropdown-modern-menu {
        position: static;
        width: 100%;
        margin-top: 12px;
        box-shadow: none;
        border: 1px solid var(--color-border-light);
    }

    /* Ensure user menu is visible in mobile menu */
    .navbar-modern .nav-items.show .dropdown-modern-menu {
        display: block !important;
    }

    /* Modal adjustments for mobile */
    .modal-content.large {
        width: 95vw !important;
        max-width: 95vw !important;
        margin: 10px;
    }

    /* Table responsive */
    .table-modern {
        font-size: 12px;
    }

    .table-modern th,
    .table-modern td {
        padding: 8px;
    }

    /* Stat cards on mobile */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    /* Form controls on mobile */
    .form-control-modern {
        font-size: 16px; /* Prevents zoom on iOS */
    }

    /* Button groups stack on mobile */
    .btn-group-modern {
        flex-direction: column;
    }

    .btn-group-modern .btn-modern {
        border-radius: 0 !important;
        border-right: none !important;
        border-bottom: 1px solid var(--color-border-light);
    }

    .btn-group-modern .btn-modern:first-child {
        border-top-left-radius: var(--radius-md) !important;
        border-top-right-radius: var(--radius-md) !important;
    }

    .btn-group-modern .btn-modern:last-child {
        border-bottom-left-radius: var(--radius-md) !important;
        border-bottom-right-radius: var(--radius-md) !important;
        border-bottom: none !important;
    }
}

/* Tablet adjustments */
@media (min-width: 769px) and (max-width: 1024px) {
    .navbar-modern .nav-items {
        gap: 4px;
    }

    div#menu-items li a,
    div#menu-items li button {
        padding: 8px 12px;
        font-size: 13px;
    }
}

/* ============================================================
   IMPECCABLE LAYER — Miss Pyjama product register
   ============================================================
   Adds the shell pieces missing from the original Stripe layer:
   - page header pattern
   - refined buttons / inputs / tables / pills
   - focus rings, empty / skeleton states
   - retires absolute bans (side-stripe borders, bold side accents)
   Keep this block LAST so it wins specificity ties.
   ============================================================ */

/* --- Base smoothing --- */
html, body {
    background: var(--color-bg-secondary);
    color: var(--color-text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* --- Page header pattern (use anywhere) ---
   <div class="mp-page-header">
     <div class="mp-page-header-text">
       <h1 class="mp-page-title">Title</h1>
       <p class="mp-page-subtitle">Helper line</p>
     </div>
     <div class="mp-page-actions">…buttons…</div>
   </div>
*/
.mp-page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--space-lg);
    padding: var(--space-xl) var(--space-lg) var(--space-md);
    margin-bottom: var(--space-lg);
    border-bottom: 1px solid var(--color-border-light);
}
.mp-page-header-text { min-width: 0; }
.mp-page-title {
    font-size: var(--text-2xl);
    font-weight: var(--weight-bold);
    letter-spacing: -0.01em;
    color: var(--color-text-primary);
    line-height: 1.15;
    margin: 0;
}
.mp-page-subtitle {
    font-size: var(--text-sm);
    color: var(--color-text-muted);
    margin: 6px 0 0;
    line-height: 1.4;
}
.mp-page-actions {
    display: flex;
    gap: var(--space-sm);
    flex-shrink: 0;
    align-items: center;
}
@media (max-width: 640px) {
    .mp-page-header {
        flex-direction: column;
        align-items: stretch;
        padding: var(--space-lg) var(--space-md) var(--space-md);
    }
    .mp-page-actions { justify-content: flex-start; }
}

/* --- Section pattern (smaller, in-page) --- */
.mp-section-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--space-md);
    margin: var(--space-xl) 0 var(--space-md);
}
.mp-section-title {
    font-size: var(--text-lg);
    font-weight: var(--weight-semibold);
    color: var(--color-text-primary);
    margin: 0;
}
.mp-section-hint {
    font-size: var(--text-sm);
    color: var(--color-text-muted);
}

/* --- Button system v2 — one shape, three intensities --- */
.mp-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: var(--h-control-md);
    padding: 0 16px;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    font: var(--weight-semibold) var(--text-base)/1 var(--font-sans);
    cursor: pointer;
    transition: background-color 150ms ease-out, box-shadow 150ms ease-out, transform 80ms ease-out, border-color 150ms ease-out;
    user-select: none;
    text-decoration: none;
    white-space: nowrap;
}
.mp-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px var(--color-primary-edge);
}
.mp-btn:active:not(:disabled) { transform: translateY(1px); }
.mp-btn:disabled {
    cursor: not-allowed;
    color: var(--color-text-disabled);
    background: var(--color-bg-muted);
    border-color: var(--color-border-light);
    box-shadow: none;
}

.mp-btn-primary {
    background: var(--color-primary);
    color: white;
    box-shadow: 0 1px 2px rgba(241, 145, 186, 0.25);
}
.mp-btn-primary:hover:not(:disabled) {
    background: var(--color-primary-hover);
    box-shadow: 0 4px 12px rgba(241, 145, 186, 0.35);
}

.mp-btn-secondary {
    background: var(--color-bg-primary);
    color: var(--color-text-primary);
    border-color: var(--color-border-medium);
}
.mp-btn-secondary:hover:not(:disabled) {
    background: var(--color-bg-muted);
    border-color: var(--color-border-dark);
}

.mp-btn-ghost {
    background: transparent;
    color: var(--color-text-secondary);
}
.mp-btn-ghost:hover:not(:disabled) {
    background: var(--color-bg-muted);
    color: var(--color-text-primary);
}

.mp-btn-danger {
    background: var(--color-danger);
    color: white;
}
.mp-btn-danger:hover:not(:disabled) {
    background: oklch(0.52 0.20 25);
}

.mp-btn-sm { height: var(--h-control-sm); padding: 0 12px; font-size: var(--text-sm); }
.mp-btn-lg { height: var(--h-control-lg); padding: 0 20px; font-size: var(--text-lg); }
.mp-btn-icon { padding: 0; width: var(--h-control-md); }
.mp-btn-icon.mp-btn-sm { width: var(--h-control-sm); }
.mp-btn-icon.mp-btn-lg { width: var(--h-control-lg); }

/* --- Inputs v2 --- */
.mp-input,
.mp-select,
.mp-textarea {
    width: 100%;
    height: var(--h-control-md);
    padding: 0 12px;
    background: var(--color-bg-primary);
    border: 1px solid var(--color-border-medium);
    border-radius: var(--radius-md);
    font: var(--weight-normal) var(--text-base)/1 var(--font-sans);
    color: var(--color-text-primary);
    transition: border-color 150ms ease-out, box-shadow 150ms ease-out;
}
.mp-textarea { height: auto; padding: 10px 12px; min-height: 80px; line-height: 1.5; resize: vertical; }
.mp-input::placeholder,
.mp-textarea::placeholder { color: var(--color-text-disabled); }
.mp-input:hover,
.mp-select:hover,
.mp-textarea:hover { border-color: var(--color-border-dark); }
.mp-input:focus,
.mp-select:focus,
.mp-textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-edge);
}
.mp-input:disabled,
.mp-select:disabled,
.mp-textarea:disabled {
    background: var(--color-bg-muted);
    color: var(--color-text-disabled);
    cursor: not-allowed;
}
.mp-input.is-error,
.mp-select.is-error { border-color: var(--color-danger); }
.mp-input.is-error:focus { box-shadow: 0 0 0 3px oklch(0.92 0.06 25); }

.mp-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: var(--space-md); }
.mp-label { font-size: var(--text-sm); font-weight: var(--weight-semibold); color: var(--color-text-secondary); }
.mp-helper { font-size: var(--text-xs); color: var(--color-text-muted); }
.mp-helper.is-error { color: var(--color-danger); }

/* --- Card v2 — only used as a true container; never nested --- */
.mp-card {
    background: var(--color-bg-primary);
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}
.mp-card-padded { padding: var(--space-lg); }
.mp-card-header { padding: var(--space-md) var(--space-lg); border-bottom: 1px solid var(--color-border-light); display: flex; align-items: center; justify-content: space-between; gap: var(--space-md); }
.mp-card-body { padding: var(--space-lg); }
.mp-card-footer { padding: var(--space-md) var(--space-lg); border-top: 1px solid var(--color-border-light); display: flex; align-items: center; justify-content: flex-end; gap: var(--space-sm); }
.mp-card .mp-card { box-shadow: none; border: none; padding: 0; } /* enforce: no nested cards */

/* --- Table v2 — dense, no zebra, sticky header --- */
.mp-table-wrap {
    background: var(--color-bg-primary);
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-md);
    overflow: hidden;
}
.mp-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: var(--text-sm);
}
.mp-table thead th {
    position: sticky;
    top: 0;
    background: var(--color-bg-panel);
    color: var(--color-text-muted);
    font-weight: var(--weight-semibold);
    text-align: start;
    padding: 10px 14px;
    border-bottom: 1px solid var(--color-border-light);
    white-space: nowrap;
    z-index: 1;
}
.mp-table tbody td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--color-border-light);
    color: var(--color-text-primary);
    vertical-align: middle;
}
.mp-table tbody tr:last-child td { border-bottom: none; }
.mp-table tbody tr { transition: background-color 100ms ease-out; }
.mp-table tbody tr:hover { background: var(--color-bg-muted); }
.mp-table tbody tr.is-selected { background: var(--color-primary-soft); }
.mp-table .num { text-align: end; font-variant-numeric: tabular-nums; }
.mp-table .actions { text-align: end; white-space: nowrap; }

/* --- Status pills --- */
.mp-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    border-radius: var(--radius-full);
    line-height: 1.6;
    white-space: nowrap;
}
.mp-pill-success { background: var(--color-success-light); color: oklch(0.38 0.13 155); }
.mp-pill-warning { background: var(--color-warning-light); color: oklch(0.38 0.12 70); }
.mp-pill-danger  { background: var(--color-danger-light);  color: oklch(0.38 0.16 25); }
.mp-pill-info    { background: var(--color-info-light);    color: oklch(0.38 0.12 240); }
.mp-pill-neutral { background: var(--color-bg-muted);      color: var(--color-text-secondary); }
.mp-pill-brand   { background: var(--color-primary-soft);  color: oklch(0.38 0.10 350); }

/* --- Empty / skeleton states --- */
.mp-empty {
    text-align: center;
    padding: var(--space-2xl) var(--space-lg);
    color: var(--color-text-muted);
}
.mp-empty-icon { font-size: 40px; color: var(--color-text-disabled); margin-bottom: var(--space-md); display: block; }
.mp-empty-title { font-size: var(--text-lg); font-weight: var(--weight-semibold); color: var(--color-text-primary); margin: 0 0 6px; }
.mp-empty-text { font-size: var(--text-sm); color: var(--color-text-muted); margin: 0 0 var(--space-md); }

.mp-skeleton {
    display: block;
    background: linear-gradient(90deg,
        var(--color-bg-muted) 0%,
        oklch(0.97 0.006 350) 50%,
        var(--color-bg-muted) 100%);
    background-size: 200% 100%;
    border-radius: var(--radius-sm);
    animation: mp-skel 1.4s ease-in-out infinite;
}
@keyframes mp-skel {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
.mp-skel-line { height: 12px; }
.mp-skel-line + .mp-skel-line { margin-top: 8px; }

/* --- Focus visibility everywhere --- */
.mp-btn:focus-visible,
.mp-input:focus-visible,
.mp-select:focus-visible,
.mp-textarea:focus-visible,
button:focus-visible,
[role="button"]:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px var(--color-primary-edge);
}

/* --- Retire absolute bans on existing markup ---
   Side-stripe borders ≥3px on cards/list items become full borders.
   Only targets generic "alert / callout" patterns where the stripe was decorative. */
.alert,
.callout,
.notice {
    border-left-width: 1px !important;
    border-right-width: 1px !important;
}

/* Kill gradient text usages — fall back to brand color */
.gradient-text,
[class*="gradient-text"] {
    background: none !important;
    -webkit-background-clip: initial !important;
    -webkit-text-fill-color: initial !important;
    color: var(--color-primary) !important;
}

/* --- Modernize legacy .btn-success / .btn-danger that survive --- */
.btn.btn-success { background: var(--color-success) !important; color: white !important; }
.btn.btn-success:hover { background: oklch(0.55 0.14 155) !important; }
.btn.btn-danger  { background: var(--color-danger) !important;  color: white !important; }
.btn.btn-danger:hover  { background: oklch(0.52 0.20 25) !important; }

/* --- Header / nav refinement (works with header.php's existing classes) --- */
.navbar-modern {
    background: var(--color-bg-primary);
    border-bottom: 1px solid var(--color-border-light);
    box-shadow: var(--shadow-sm);
}
.nav-items-link {
    position: relative;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    color: var(--color-text-secondary);
    font-weight: var(--weight-medium);
    font-size: var(--text-sm);
    text-decoration: none;
    transition: background-color 120ms ease-out, color 120ms ease-out;
}
.nav-items-link:hover {
    background: var(--color-bg-muted);
    color: var(--color-text-primary);
}
.nav-items-link.active {
    background: var(--color-primary-soft);
    color: oklch(0.38 0.10 350);
}

/* --- RTL safety: never let logical-property absent rules misalign --- */
[dir="rtl"] .mp-page-header,
[dir="rtl"] .mp-section-header,
[dir="rtl"] .mp-card-footer,
[dir="rtl"] .mp-page-actions { direction: rtl; }
[dir="rtl"] .mp-table .num,
[dir="rtl"] .mp-table .actions { text-align: start; }
