/* ============================================================
   WOHLER CHEMICAL LLC — Global Design System
   Brand: Black + Green (#13AA21) on White
   Font: Poppins | Industrial, precise, high-contrast
   Reference: Nextcloud-style light UI with green accents
   ============================================================ */

/* ── Google Fonts: Poppins ─────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700;800&display=swap');

/* ── Reset & Base ──────────────────────────────────────────── */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

:root {
    /* ── Wohler Brand Colors ── */
    --wc-black:       #000000;
    --wc-green:       #13AA21;
    --wc-green-dark:  #0d8a1a;
    --wc-green-mid:   #71CC7A;
    --wc-green-light: #B8E6BC;
    --wc-green-pale:  #f0faf1;
    --wc-white:       #FFFFFF;

    /* ── Primary UI Tokens ── */
    --primary:        #13AA21;
    --primary-dark:   #0d8a1a;
    --primary-light:  #71CC7A;
    --primary-pale:   #B8E6BC;
    --primary-bg:     #f0faf1;

    /* ── Legacy compat aliases (keep old --secondary, --accent alive) ── */
    --secondary:      #0d8a1a;
    --accent:         #13AA21;

    /* ── Semantic colors ── */
    --success:        #13AA21;
    --danger:         #dc2626;
    --warning:        #d97706;
    --info:           #0284c7;

    /* ── Neutral scale ── */
    --gray-50:  #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e8edf2;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;

    /* ── Page background — clean white/light gray ── */
    --page-bg:   #f5f7f9;
    --page-bg2:  #eef1f4;

    /* ── Card / surface ── */
    --surface:        #ffffff;
    --surface-raised: #f8fafc;
    --surface-dark:   #1e293b;
    --border:         #e2e8f0;
    --border-dark:    rgba(0,0,0,0.1);

    /* ── Touch target ── */
    --touch-min: 48px;

    /* ── Typography ── */
    --font:      'Poppins', 'Segoe UI', system-ui, -apple-system, sans-serif;
    --font-mono: 'Courier New', monospace;

    /* ── Spacing (8px grid) ── */
    --space-xs:  4px;
    --space-sm:  8px;
    --space-md:  16px;
    --space-lg:  24px;
    --space-xl:  32px;
    --space-2xl: 48px;

    /* ── Radius — sharp/industrial ── */
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;
    --radius-xl: 12px;
    --radius-full: 9999px;

    /* ── Shadows — minimal ── */
    --shadow-sm:    0 1px 3px rgba(0,0,0,0.08);
    --shadow-md:    0 2px 8px rgba(0,0,0,0.08);
    --shadow-lg:    0 4px 16px rgba(0,0,0,0.10);
    --shadow-xl:    0 8px 32px rgba(0,0,0,0.12);
    --shadow-inset: inset 0 1px 3px rgba(0,0,0,0.06);

    /* ── Header ── */
    --header-bg: #000000;

    /* ── Transitions ── */
    --transition: 0.15s ease;
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
    font-family: var(--font);
    background: var(--page-bg);
    color: var(--gray-900);
    min-height: 100vh;
    line-height: 1.5;
}

/* ── Scrollbar ──────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--gray-100); }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--wc-green); }

/* ── Page Header / Branding Bar ─────────────────────────────── */
.header,
.top-nav,
header {
    background: var(--wc-black);
    color: white;
    padding: 0 var(--space-lg);
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 56px;
    position: sticky;
    top: 0;
    z-index: 200;
    border-bottom: 2px solid var(--wc-green);
    flex-wrap: wrap;
    gap: var(--space-sm);
}

.header h1,
.top-nav h1,
header h1 {
    font-size: 18px;
    font-weight: 700;
    color: white;
    letter-spacing: 0.2px;
    white-space: nowrap;
    margin: 0;
    padding: var(--space-sm) 0;
    font-family: var(--font);
}

/* ── Navigation ─────────────────────────────────────────────── */
nav,
.top-nav-right,
.header nav {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    flex-wrap: wrap;
}

nav a,
.top-nav a,
.header nav a {
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    padding: 8px 12px;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 500;
    transition: background var(--transition), color var(--transition);
    min-height: var(--touch-min);
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
    background: transparent;
    border: none;
    font-family: var(--font);
}

nav a:hover,
.top-nav a:hover,
.header nav a:hover {
    background: rgba(19,170,33,0.2);
    color: var(--wc-green-mid);
    transform: none;
}

nav a.active,
.top-nav a.active,
.header nav a.active {
    background: var(--wc-green);
    color: white;
    font-weight: 600;
}

/* Logout */
nav a[onclick*="logout"],
.header nav a[onclick*="logout"] {
    margin-left: auto;
    color: rgba(255,255,255,0.6);
}
nav a[onclick*="logout"]:hover { background: rgba(220,38,38,0.2); color: #fca5a5; }

/* ── Main Container ─────────────────────────────────────────── */
.container {
    max-width: 1400px;
    margin: 0 auto;
    background: var(--surface);
    min-height: calc(100vh - 56px);
}

.page-wrapper,
.assignment-container,
.dashboard-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: var(--space-xl) var(--space-lg);
}

/* ── Section / Card wrappers ────────────────────────────────── */
.input-section,
.admin-section {
    padding: var(--space-xl) var(--space-lg);
    background: var(--gray-50);
}

.section {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    margin-bottom: var(--space-lg);
}

.section-title,
.section h2 {
    font-size: 15px;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: var(--space-md);
    padding-bottom: var(--space-sm);
    border-bottom: 2px solid var(--wc-green);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-family: var(--font);
}

/* ── Form Controls ──────────────────────────────────────────── */
.form-group { margin-bottom: var(--space-md); }

.form-group label,
label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-family: var(--font);
}

input[type="text"],
input[type="email"],
input[type="number"],
input[type="password"],
input[type="date"],
input[type="time"],
input[type="search"],
input[type="tel"],
input[type="url"],
select,
textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--gray-300);
    border-radius: var(--radius-md);
    font-size: 14px;
    font-family: var(--font);
    font-weight: 400;
    color: var(--gray-900);
    background: var(--surface);
    transition: border-color var(--transition), box-shadow var(--transition);
    min-height: var(--touch-min);
    -webkit-appearance: none;
    appearance: none;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--wc-green);
    box-shadow: 0 0 0 3px rgba(19,170,33,0.12);
}

input:hover,
select:hover,
textarea:hover {
    border-color: var(--wc-green-mid);
}

select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2394a3b8' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

input[type="checkbox"],
input[type="radio"] {
    width: 18px;
    height: 18px;
    min-height: unset;
    accent-color: var(--wc-green);
}

textarea { resize: vertical; min-height: 100px; }

/* Input error state */
input.error, select.error, textarea.error {
    border-color: var(--danger);
    box-shadow: 0 0 0 3px rgba(220,38,38,0.1);
}

/* ── Buttons ────────────────────────────────────────────────── */
.btn,
button.btn,
.btn-primary,
.btn-success,
.btn-secondary,
.btn-danger,
.btn-warning,
.btn-info {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    transition: all var(--transition);
    min-height: var(--touch-min);
    min-width: 44px;
    text-decoration: none;
    white-space: nowrap;
    position: relative;
    letter-spacing: 0.2px;
}

/* Primary — Green */
.btn-primary {
    background: var(--wc-green);
    color: #fff;
    border: 2px solid var(--wc-green);
}
.btn-primary:hover {
    background: var(--wc-green-dark);
    border-color: var(--wc-green-dark);
    transform: none;
}
.btn-primary:active { transform: scale(0.98); }

/* Success = same as primary */
.btn-success {
    background: var(--wc-green);
    color: #fff;
    border: 2px solid var(--wc-green);
}
.btn-success:hover {
    background: var(--wc-green-dark);
    border-color: var(--wc-green-dark);
}

/* Secondary — Black outline */
.btn-secondary {
    background: transparent;
    color: var(--gray-900);
    border: 2px solid var(--gray-900);
}
.btn-secondary:hover {
    background: var(--gray-900);
    color: #fff;
    transform: none;
}

/* Danger */
.btn-danger {
    background: transparent;
    color: var(--danger);
    border: 2px solid var(--danger);
}
.btn-danger:hover {
    background: var(--danger);
    color: #fff;
    transform: none;
}

/* Warning */
.btn-warning {
    background: var(--warning);
    color: #fff;
    border: 2px solid var(--warning);
}
.btn-warning:hover { opacity: 0.9; transform: none; }

/* Info */
.btn-info {
    background: var(--info);
    color: #fff;
    border: 2px solid var(--info);
}
.btn-info:hover { opacity: 0.9; transform: none; }

/* Large / Small */
.btn-lg { padding: 16px 32px; font-size: 16px; min-height: 56px; }
.btn-sm,
.btn-small {
    padding: 7px 14px;
    font-size: 12px;
    min-height: 34px;
    border-radius: var(--radius-sm);
}

button:disabled,
.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none !important;
}

.button-group {
    margin-top: var(--space-lg);
    display: flex;
    gap: var(--space-md);
    flex-wrap: wrap;
    align-items: center;
}

/* ── Admin Hub Card Grid ─────────────────────────────────────── */
.admin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: var(--space-lg);
    max-width: 1200px;
    margin: var(--space-xl) auto;
    padding: var(--space-lg);
}

.admin-grid.tight { margin-top: var(--space-md); }

.admin-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: var(--space-xl) var(--space-lg);
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition), border-color var(--transition);
    text-align: center;
    border: 1.5px solid var(--border);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.admin-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--wc-green-mid);
    transform: none;
}

.admin-card-icon {
    font-size: 44px;
    margin-bottom: var(--space-md);
    display: block;
}

.admin-card h2 {
    color: var(--gray-900);
    margin-bottom: var(--space-sm);
    font-size: 17px;
    font-weight: 700;
    font-family: var(--font);
}

.admin-card p {
    color: var(--gray-500);
    margin-bottom: var(--space-lg);
    line-height: 1.6;
    font-size: 13px;
    flex: 1;
}

.admin-card a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--wc-green);
    color: white;
    padding: 12px 24px;
    border-radius: var(--radius-md);
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    transition: background var(--transition);
    width: 100%;
    min-height: var(--touch-min);
    font-family: var(--font);
}
.admin-card a:hover { background: var(--wc-green-dark); }

/* Section headers */
.page-header {
    text-align: center;
    padding: var(--space-xl) var(--space-lg) var(--space-md);
}

.page-header h1 {
    color: var(--gray-900);
    font-size: 28px;
    font-weight: 800;
    margin-bottom: var(--space-sm);
    font-family: var(--font);
}

.page-header p {
    color: var(--gray-500);
    font-size: 15px;
}

.section-header {
    max-width: 1200px;
    margin: var(--space-lg) auto 0 auto;
    padding: 0 var(--space-lg);
}

.section-header h2 {
    color: var(--gray-900);
    font-size: 15px;
    font-weight: 700;
    padding: 6px 16px;
    border-radius: var(--radius-full);
    display: inline-block;
    font-family: var(--font);
}

.section-header.smart-batch h2 {
    background: var(--wc-green-light);
    color: var(--wc-green-dark);
}

.section-header.admin-section h2 {
    background: var(--gray-900);
    color: white;
}

.section-header p {
    color: var(--gray-500);
    margin-top: var(--space-xs);
    font-size: 13px;
}

.admin-card.smart-batch-card a,
.admin-card.optimization-card a {
    background: var(--wc-green);
    color: white;
}
.admin-card.smart-batch-card a:hover,
.admin-card.optimization-card a:hover { background: var(--wc-green-dark); }

/* ── Batch Cards (batch-assignment) ──────────────────────────── */
.batch-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    border: 1.5px solid var(--border);
    padding: var(--space-lg);
    box-shadow: var(--shadow-sm);
    transition: border-color var(--transition), box-shadow var(--transition);
    cursor: pointer;
}
.batch-card:hover {
    border-color: var(--wc-green);
    box-shadow: var(--shadow-md);
}
.batch-card.active,
.batch-card.selected {
    border-color: var(--wc-green);
    background: var(--wc-green-pale);
}
.batch-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-sm);
}
.batch-number {
    font-size: 15px;
    font-weight: 700;
    color: var(--gray-900);
    font-family: var(--font);
}

/* ── Status Badges ──────────────────────────────────────────── */
.badge,
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 700;
    font-family: var(--font);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.badge-success, .status-active, .status-completed, .badge-active {
    background: var(--wc-green-pale);
    color: var(--wc-green-dark);
    border: 1px solid var(--wc-green-light);
}
.badge-danger, .status-error, .status-failed {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}
.badge-warning, .status-pending, .status-in_progress {
    background: #fffbeb;
    color: #d97706;
    border: 1px solid #fed7aa;
}
.badge-info, .status-info {
    background: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
}
.badge-neutral, .status-inactive, .status-draft {
    background: var(--gray-100);
    color: var(--gray-600);
    border: 1px solid var(--gray-200);
}
.badge-black {
    background: var(--wc-black);
    color: white;
    border: 1px solid var(--wc-black);
}

/* ── Filter Bar ─────────────────────────────────────────────── */
.filter-bar,
.filters-row {
    display: flex;
    gap: var(--space-md);
    padding: var(--space-md) var(--space-lg);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
    align-items: flex-end;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.filter-group label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--gray-500);
    margin-bottom: 0;
}

.filter-group select,
.filter-group input {
    background: var(--gray-50);
    border: 1.5px solid var(--gray-200);
    min-width: 150px;
    min-height: 38px;
    padding: 7px 10px;
    font-size: 13px;
}

/* ── Stats Grid ─────────────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
}

.stat-card {
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-lg) var(--space-md);
    text-align: center;
}

.stat-card:hover { border-color: var(--wc-green-mid); }

.stat-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--gray-500);
    margin-bottom: var(--space-sm);
    font-family: var(--font);
}

.stat-value {
    font-size: 32px;
    font-weight: 800;
    color: var(--gray-900);
    line-height: 1;
    font-family: var(--font);
}

.stat-value.green  { color: var(--wc-green); }
.stat-value.yellow { color: #d97706; }
.stat-value.red    { color: var(--danger); }
.stat-value.blue   { color: #2563eb; }

.stat-sub {
    font-size: 11px;
    color: var(--gray-400);
    margin-top: 4px;
}

/* ── Tables ─────────────────────────────────────────────────── */
.table-wrap,
.table-container {
    overflow-x: auto;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-family: var(--font);
    font-size: 13px;
}

thead { position: sticky; top: 0; z-index: 2; }

th {
    background: var(--gray-50);
    padding: 10px 14px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--gray-600);
    text-align: left;
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
    font-family: var(--font);
}

th:first-child { border-left: 3px solid var(--wc-green); }

td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--gray-100);
    color: var(--gray-800);
    vertical-align: middle;
}

tr:last-child td { border-bottom: none; }

tr:hover td {
    background: var(--wc-green-pale);
}

/* ── Procedure Table (batch sheet) ──────────────────────────── */
.procedure-table { border-collapse: collapse; width: 100%; font-family: var(--font); }

.procedure-table th {
    background: var(--wc-black);
    color: white;
    padding: 10px 14px;
    font-size: 12px;
    font-weight: 600;
    border-right: 1px solid rgba(255,255,255,0.1);
}

.procedure-table td {
    padding: 9px 14px;
    border: 1px solid var(--gray-200);
    vertical-align: top;
    font-size: 13px;
}

.procedure-table tr:nth-child(even) td { background: var(--gray-50); }
.procedure-table tr:hover td { background: var(--wc-green-pale); }

/* ── Batch Sheet Print Header ────────────────────────────────── */
.batch-sheet-header {
    background: var(--wc-black);
    color: white;
    padding: var(--space-lg) var(--space-xl);
    margin-bottom: var(--space-lg);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    display: flex;
    align-items: center;
    gap: var(--space-lg);
}

.batch-sheet-header h1 {
    font-size: 20px;
    font-weight: 800;
    color: white;
    font-family: var(--font);
}

.batch-sheet-logo {
    color: var(--wc-green);
    font-size: 28px;
}

/* ── Info / Formula Boxes ───────────────────────────────────── */
.info-box {
    background: var(--wc-green-pale);
    border: 1.5px solid var(--wc-green-light);
    border-left: 4px solid var(--wc-green);
    border-radius: var(--radius-md);
    padding: var(--space-md) var(--space-lg);
    margin-bottom: var(--space-md);
    font-size: 14px;
    color: var(--gray-800);
}

.warning-box {
    background: #fffbeb;
    border: 1.5px solid #fde68a;
    border-left: 4px solid #f59e0b;
    border-radius: var(--radius-md);
    padding: var(--space-md) var(--space-lg);
    margin-bottom: var(--space-md);
}

.error-box {
    background: #fef2f2;
    border: 1.5px solid #fecaca;
    border-left: 4px solid #dc2626;
    border-radius: var(--radius-md);
    padding: var(--space-md) var(--space-lg);
    margin-bottom: var(--space-md);
}

/* ── Search Section ─────────────────────────────────────────── */
.search-section {
    padding: var(--space-md) var(--space-lg);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.search-input-wrap {
    position: relative;
    max-width: 400px;
}

.search-input-wrap input {
    padding-left: 40px;
    background: var(--gray-50);
    border-color: var(--gray-200);
}

.search-input-wrap::before {
    content: "🔍";
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 14px;
    pointer-events: none;
}

/* ── Dropdown Nav (legacy compat) ────────────────────────────── */
.dropdown { position: relative; display: inline-block; }
.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    min-width: 200px;
    z-index: 1000;
    overflow: hidden;
}
.dropdown-item {
    display: block;
    padding: 10px 16px;
    color: var(--gray-800);
    text-decoration: none;
    font-size: 13px;
    transition: background var(--transition), color var(--transition);
    font-family: var(--font);
}
.dropdown-item:hover {
    background: var(--wc-green-pale);
    color: var(--wc-green-dark);
}

/* ── User Info / Logout ─────────────────────────────────────── */
.user-info {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: 13px;
    color: rgba(255,255,255,0.8);
    font-family: var(--font);
}

.user-avatar {
    width: 32px;
    height: 32px;
    background: var(--wc-green);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
}

.logout-btn {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.2);
    color: rgba(255,255,255,0.7);
    padding: 6px 12px;
    border-radius: var(--radius-md);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    font-family: var(--font);
    transition: all var(--transition);
}
.logout-btn:hover { border-color: #ef4444; color: #fca5a5; }

/* ── Status Badges (inventory) ──────────────────────────────── */
.in-stock    { color: var(--wc-green); font-weight: 700; }
.low-stock   { color: var(--warning); font-weight: 700; }
.out-of-stock { color: var(--danger);  font-weight: 700; }

/* ── Modals ─────────────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 9000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-lg);
    backdrop-filter: blur(2px);
}

.modal,
.modal-content {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    border: 1.5px solid var(--border);
}

.modal-header {
    padding: var(--space-lg) var(--space-xl);
    border-bottom: 1.5px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--wc-black);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.modal-title {
    font-size: 16px;
    font-weight: 700;
    color: white;
    font-family: var(--font);
}

.modal-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: rgba(255,255,255,0.6);
    padding: 4px;
    border-radius: var(--radius-sm);
    line-height: 1;
    transition: color var(--transition);
}
.modal-close:hover { color: white; }

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

.modal-footer {
    padding: var(--space-lg) var(--space-xl);
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: var(--space-md);
}

/* ── Misc utilities ─────────────────────────────────────────── */
.loading {
    text-align: center;
    padding: 48px;
    color: var(--gray-400);
    font-size: 15px;
    font-family: var(--font);
}

.empty-state {
    text-align: center;
    padding: 64px 24px;
    color: var(--gray-400);
}

.empty-state-icon  { font-size: 52px; margin-bottom: var(--space-md); }
.empty-state-title { font-size: 18px; font-weight: 700; color: var(--gray-700); margin-bottom: var(--space-sm); font-family: var(--font); }
.empty-state-sub   { font-size: 14px; }

.divider {
    height: 1px;
    background: var(--border);
    margin: var(--space-lg) 0;
}

.text-muted    { color: var(--gray-500); }
.text-success  { color: var(--wc-green); }
.text-danger   { color: var(--danger); }
.text-warning  { color: var(--warning); }
.text-bold     { font-weight: 700; }
.text-sm       { font-size: 12px; }
.text-xs       { font-size: 11px; }
.mono          { font-family: var(--font-mono); font-size: 12px; }

.flex          { display: flex; }
.flex-center   { display: flex; align-items: center; justify-content: center; }
.gap-sm        { gap: var(--space-sm); }
.gap-md        { gap: var(--space-md); }
.mt-sm         { margin-top: var(--space-sm); }
.mt-md         { margin-top: var(--space-md); }
.mt-lg         { margin-top: var(--space-lg); }
.mb-md         { margin-bottom: var(--space-md); }
.mb-lg         { margin-bottom: var(--space-lg); }
.p-md          { padding: var(--space-md); }

/* Alerts */
.alert {
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius-md);
    font-size: 14px;
    font-family: var(--font);
    border-left: 4px solid;
    margin-bottom: var(--space-md);
}
.alert-success { background: var(--wc-green-pale); border-color: var(--wc-green); color: var(--wc-green-dark); }
.alert-danger  { background: #fef2f2; border-color: var(--danger); color: var(--danger); }
.alert-warning { background: #fffbeb; border-color: var(--warning); color: #92400e; }
.alert-info    { background: #eff6ff; border-color: var(--info); color: #1e40af; }

/* ── Print Styles ───────────────────────────────────────────── */
@media print {
    body { background: white !important; color: black !important; font-size: 11pt; }
    * { font-family: Arial, sans-serif !important; }
    #wc-sidebar, #wc-sb-toggle, #wc-mobile-topbar { display: none !important; }
    #wc-page-wrap { margin-left: 0 !important; width: 100% !important; height: auto !important; overflow: visible !important; }
    .no-print { display: none !important; }
    .btn { display: none !important; }
    .page-header-bar, .filter-bar, .filters-row { display: none !important; }
    table { border-collapse: collapse; }
    th, td { border: 1px solid #ccc; padding: 6pt; }
    th { background: #f0f0f0 !important; color: black !important; }
    tr:nth-child(even) td { background: #f9f9f9 !important; }
    .batch-sheet-header { background: black !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    @page { size: A4; margin: 1.5cm 2cm; }
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 768px) {
    .admin-grid { grid-template-columns: 1fr; padding: var(--space-md); }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .filter-bar, .filters-row { flex-direction: column; }
    .filter-group select, .filter-group input { min-width: unset; width: 100%; }
    .modal { max-width: 100%; }
    table { font-size: 12px; }
    th, td { padding: 8px 10px; }
    .btn-lg { padding: 14px 24px; font-size: 15px; }
    .page-header h1 { font-size: 22px; }
}

@media (max-width: 480px) {
    :root { --space-lg: 16px; --space-xl: 24px; }
    .stats-grid { grid-template-columns: 1fr; }
    .button-group { flex-direction: column; }
    .button-group .btn { width: 100%; }
}

/* ── Touch device enhancements ──────────────────────────────── */
@media (hover: none) {
    .btn:hover { transform: none !important; }
    .admin-card:hover { transform: none !important; }
}

/* ── Unified Category Nav Bar (legacy hidden) ────────────────── */
.site-nav { display: none !important; }
#wohler-nav-placeholder { display: none !important; }

/* ── Tablet Scroll Padding ──────────────────────────────────── */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .container, .page-wrapper { padding-bottom: calc(var(--space-xl) + env(safe-area-inset-bottom)); }
}

/* ── Green highlight utility ────────────────────────────────── */
.highlight-green { background: var(--wc-green-pale); border-left: 3px solid var(--wc-green); }
.dot-green  { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--wc-green); margin-right: 5px; }
.dot-red    { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); margin-right: 5px; }
.dot-yellow { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--warning); margin-right: 5px; }

/* ── Page title bar (shared across pages) ────────────────────── */
.page-title-bar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 14px var(--space-lg);
    display: flex;
    align-items: center;
    gap: var(--space-md);
    position: sticky;
    top: 0;
    z-index: 100;
}
.page-title-bar h1 {
    font-size: 17px;
    font-weight: 700;
    color: var(--gray-900);
    font-family: var(--font);
    margin: 0;
}
.page-title-bar .sub {
    font-size: 12px;
    color: var(--gray-500);
    margin-top: 2px;
}
.page-title-bar .actions { margin-left: auto; display: flex; gap: var(--space-sm); align-items: center; }

/* ── Card ────────────────────────────────────────────────────── */
.card {
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}
.card-header {
    padding: var(--space-md) var(--space-lg);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    background: var(--gray-50);
}
.card-header h3 {
    font-size: 14px;
    font-weight: 700;
    color: var(--gray-900);
    font-family: var(--font);
    margin: 0;
}
.card-body { padding: var(--space-lg); }

/* ── Green accent bar (used on active items, key headers) ────── */
.accent-bar {
    height: 3px;
    background: var(--wc-green);
    border-radius: 2px;
}

/* ── Number/value display ─────────────────────────────────────── */
.kpi-value {
    font-size: 36px;
    font-weight: 800;
    line-height: 1;
    font-family: var(--font);
    color: var(--gray-900);
}
.kpi-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-500);
    font-family: var(--font);
}
</style>