:root {
    --bg-gradient: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    --panel-bg: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(15, 23, 42, 0.08);
    --glass-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.03);
    --primary-color: #2563eb; /* Royal Indigo Blue */
    --primary-hover: #1d4ed8;
    --success-color: #15803d; /* Rich Forest Green */
    --warning-color: #b45309; /* Deep Warm Amber */
    --error-color: #b91c1c; /* High Contrast Crimson Red */
    --text-main: #0f172a; /* Slate 900 for absolute contrast */
    --text-muted: #475569; /* Slate 600 for subtext */
    --sidebar-width: 260px;
    --transition-speed: 0.25s;
    --font-base: 0.875rem;
    --font-large: 1rem;
    --font-header: 1.125rem;
    --font-page: 1.125rem;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Plus Jakarta Sans', 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-gradient);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
    font-size: var(--font-base);
    line-height: 1.5;
}

/* Glassmorphism Light Utility */
.glass {
    background: var(--panel-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
    border-radius: 16px;
}

/* Scrollbars */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}
::-webkit-scrollbar-track {
    background: #f1f5f9;
}
::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 6px;
}
::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Login Screen */
.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(241, 245, 249, 0.95);
    backdrop-filter: blur(16px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-speed) ease;
}
.login-overlay.active {
    opacity: 1;
    pointer-events: auto;
}
.login-box {
    width: 100%;
    max-width: 460px;
    padding: 40px;
    text-align: center;
    border-radius: 24px;
    background: #ffffff;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    border: 1px solid var(--glass-border);
    transform: scale(0.95);
    transition: transform var(--transition-speed) cubic-bezier(0.34, 1.56, 0.64, 1);
}
.login-overlay.active .login-box {
    transform: scale(1);
}
.login-header {
    margin-bottom: 35px;
}
.logo-icon {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 15px;
    animation: rotateLogo 12s linear infinite;
}
@keyframes rotateLogo {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}
.login-header h2 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 8px;
    letter-spacing: -0.75px;
}
.login-header p {
    color: var(--text-muted);
}

/* Forms & Large Inputs */
.input-group {
    margin-bottom: 24px;
    text-align: left;
}
.input-group label {
    display: block;
    font-size: var(--font-base);
    color: var(--text-muted);
    margin-bottom: 10px;
    font-weight: 600;
}
.input-group label i {
    margin-right: 6px;
    color: var(--primary-color);
}
.input-group input, .input-group select, .input-group textarea {
    width: 100%;
    padding: 10px 14px;
    background: #ffffff;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    color: var(--text-main);
    font-family: inherit;
    font-size: var(--font-base);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.input-group input:focus, .input-group select:focus, .input-group textarea:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.15);
}
.input-row {
    display: flex;
    gap: 20px;
}
.input-row .input-group {
    flex: 1;
}
.input-row .input-group label {
    min-height: auto;
}

.input-group .password-field-wrap {
    position: relative;
    display: block;
    width: 100%;
}
.input-group .password-field-wrap input {
    width: 100%;
    box-sizing: border-box;
    padding-right: 48px;
}
.password-toggle-btn {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    margin: 0;
    padding: 0;
    border: none;
    background: transparent;
    color: #64748b;
    cursor: pointer;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    z-index: 2;
}
.password-toggle-btn:hover {
    color: var(--primary-color);
    background: rgba(37, 99, 235, 0.08);
}
.password-toggle-btn:focus {
    outline: 2px solid rgba(37, 99, 235, 0.35);
    outline-offset: 1px;
}

/* Larger Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 18px;
    border-radius: 12px;
    border: none;
    font-family: inherit;
    font-size: var(--font-base);
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    gap: 10px;
}
.btn-primary {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.3);
}
.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1.5px);
}
.btn-secondary {
    background: #f1f5f9;
    color: var(--text-main);
    border: 2px solid #e2e8f0;
}
.btn-secondary:hover {
    background: #e2e8f0;
}
.btn-success {
    background: var(--success-color);
    color: white;
    box-shadow: 0 4px 14px rgba(21, 128, 61, 0.3);
}
.btn-success:hover {
    background: #166534;
    transform: translateY(-1.5px);
}
.btn-logout {
    background: #fee2e2;
    color: var(--error-color);
    border: 2px solid #fecaca;
    width: 100%;
}
.btn-logout:hover {
    background: var(--error-color);
    color: white;
}
.btn-sm {
    padding: 6px 12px;
    font-size: 0.8125rem;
    border-radius: var(--radius-sm);
    gap: 6px;
}
.btn-xs {
    padding: 4px 10px;
    font-size: 0.75rem;
    border-radius: 6px;
    gap: 4px;
    font-weight: 600;
}
.btn-danger {
    background: #fef2f2;
    color: var(--error-color);
    border: 1px solid #fecaca;
    box-shadow: none;
}
.btn-danger:hover {
    background: var(--error-color);
    color: white;
    transform: none;
}
.btn-block {
    width: 100%;
}

.text-right { text-align: right; }
.col-actions {
    text-align: right;
    width: 1%;
    white-space: nowrap;
}
.table-actions {
    display: flex;
    gap: 6px;
    justify-content: flex-end;
    flex-wrap: wrap;
    align-items: center;
}
.badge-stock-low {
    background: #fee2e2;
    color: var(--error-color);
}
.filter-actions {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.error-msg {
    color: var(--error-color);
    font-size: 0.8125rem;
    margin-bottom: 16px;
    text-align: left;
    font-weight: 600;
}

.form-error-msg {
    display: none;
    color: var(--error-color);
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    margin-bottom: 14px;
    font-size: 0.8125rem;
    font-weight: 600;
    line-height: 1.45;
    white-space: pre-line;
}
.form-error-msg.visible {
    display: block;
}

.bom-warning-msg {
    color: var(--warning-color);
    margin-bottom: 10px;
}

/* Dashboard Container */
.dashboard-container {
    display: flex;
    min-height: 100vh;
}

/* Mobile Header / Top Bar */
.mobile-nav-bar {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 70px;
    background: #ffffff;
    border-bottom: 1px solid var(--glass-border);
    z-index: 200;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
}
.mobile-nav-toggle {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-main);
    cursor: pointer;
}
.mobile-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 1.25rem;
}

/* Sidebar styling */
.sidebar {
    width: var(--sidebar-width);
    position: fixed;
    top: 12px;
    left: 12px;
    bottom: 12px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    padding: 20px 16px;
    border-radius: var(--radius-lg);
    background: #ffffff;
    box-shadow: var(--glass-shadow);
}
.sidebar-header {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1rem;
    font-weight: 800;
    margin-bottom: 20px;
    letter-spacing: -0.5px;
}
.sidebar-header .logo-icon {
    font-size: 1.8rem;
    margin-bottom: 0;
}
.user-profile-summary {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: #f8fafc;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
}
.avatar {
    width: 36px;
    height: 36px;
    background: rgba(37, 99, 235, 0.1);
    border: 2px solid rgba(37, 99, 235, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    color: var(--primary-color);
    flex-shrink: 0;
}
.user-details h4 {
    font-size: 0.8125rem;
    font-weight: 700;
    line-height: 1.3;
}
.badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
}
.badge-admin {
    background: rgba(37, 99, 235, 0.12);
    color: var(--primary-color);
}
.sidebar-nav {
    flex-grow: 1;
    overflow-y: auto;
}
.sidebar-nav ul {
    list-style: none;
}
.sidebar-nav li {
    margin-bottom: 4px;
}
.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.8125rem;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
}
.sidebar-nav a i {
    font-size: 0.95rem;
    width: 18px;
    text-align: center;
}

.sidebar-nav li.active a, .sidebar-nav a:hover {
    color: var(--primary-color);
    background: rgba(37, 99, 235, 0.08);
}

/* Main Content area */
.main-content {
    margin-left: calc(var(--sidebar-width) + 24px);
    flex-grow: 1;
    padding: 12px 24px 32px 12px;
    width: calc(100% - var(--sidebar-width));
}

/* Compact top toolbar */
.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 8px 14px;
    margin-bottom: 16px;
    border-radius: var(--radius-md);
    background: #ffffff;
    border: 1px solid var(--glass-border);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    min-height: 48px;
}
.main-header h1 {
    font-size: var(--font-page);
    font-weight: 700;
    letter-spacing: -0.3px;
    white-space: nowrap;
    flex-shrink: 0;
}
.header-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    justify-content: flex-end;
    min-width: 0;
}
.connection-status {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    border-radius: 20px;
    background: #f8fafc;
    border: 1px solid var(--glass-border);
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
}
.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}
.status-dot.online {
    background: var(--success-color);
    box-shadow: 0 0 10px rgba(21, 128, 61, 0.4);
}
.status-dot.offline {
    background: var(--error-color);
    box-shadow: 0 0 10px rgba(185, 28, 28, 0.4);
}

/* Filter Section */
.insights-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px 14px;
    background: #ffffff;
    border-radius: var(--radius-md);
    margin-bottom: 16px;
    align-items: flex-end;
    border: 1px solid var(--glass-border);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.insights-filters .filter-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.insights-filters .filter-group label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
}
.logs-filters input[type="text"],
.print-filters input[type="text"],
.logs-filters input[type="number"],
.print-filters input[type="number"] {
    min-width: 120px;
}
.filter-group-wide {
    flex: 1 1 220px;
    min-width: 200px;
}
.filter-group-wide input {
    width: 100%;
}
.insights-filters select, .insights-filters input {
    padding: 6px 10px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 0.8125rem;
    background: white;
    min-width: 130px;
}

/* Panels */
.content-panel {
    display: none;
    animation: fadeIn 0.3s ease;
}
.content-panel.active {
    display: block;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.panel-header-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-bottom: 12px;
    gap: 8px;
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}
.stat-card {
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    background: #ffffff;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    transition: transform var(--transition-speed) ease;
}
.stat-card:hover {
    transform: translateY(-2px);
}
.stat-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}
.icon-blue { background: rgba(37, 99, 235, 0.1); color: var(--primary-color); }
.icon-green { background: rgba(21, 128, 61, 0.1); color: var(--success-color); }
.icon-yellow { background: rgba(180, 83, 9, 0.1); color: var(--warning-color); }
.icon-red { background: rgba(185, 28, 28, 0.1); color: var(--error-color); }
.stat-info .stat-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 2px;
    font-weight: 600;
}
.stat-info h3 {
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.2;
}

/* Section headings inside panels */
.content-panel > h3 {
    font-size: var(--font-large);
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--text-main);
}

/* Dashboard layout — feed full width, chart below */
.dashboard-stack {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 16px;
}
.dashboard-row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}
.dashboard-col {
    padding: 16px;
    background: #ffffff;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.dashboard-feed-panel .feed-container {
    height: min(520px, 55vh);
    min-height: 320px;
}
.chart-container--tall {
    height: 300px;
}
.col-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    border-bottom: 1px solid #f1f5f9;
    padding-bottom: 8px;
}
.col-header h3 {
    font-size: 0.9375rem;
    font-weight: 700;
}
.pulse-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    font-weight: 800;
    color: var(--success-color);
}
.pulse-indicator .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--success-color);
    animation: pulse 1.5s infinite;
}
@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.85); }
}
@keyframes slideIn {
    from { opacity: 0; transform: translateX(8px); }
    to { opacity: 1; transform: translateX(0); }
}

/* Chart */
.chart-container {
    position: relative;
    height: 260px;
    width: 100%;
}

/* Live Feed */
.feed-container {
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-right: 6px;
}
.feed-empty {
    text-align: center;
    color: var(--text-muted);
    font-size: var(--font-base);
    margin-top: 80px;
}
.feed-load-more {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    padding: 8px 0 4px;
    flex-shrink: 0;
}
.feed-card-new {
    animation: feedPulse 0.6s ease;
}
@keyframes feedPulse {
    0% { background: #dbeafe; border-color: #93c5fd; }
    100% { background: #f8fafc; border-color: #e2e8f0; }
}
.feed-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 14px 18px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    font-size: var(--font-base);
    animation: slideIn 0.3s ease;
    width: 100%;
}
.feed-card-grid {
    display: grid;
    grid-template-columns: minmax(180px, 2.2fr) minmax(130px, 1.2fr) minmax(110px, 1fr) auto;
    gap: 16px 20px;
    align-items: center;
    width: 100%;
}
.feed-card-product h5 {
    font-size: 1rem;
    font-weight: 700;
    margin: 0 0 4px;
    color: #0f172a;
}
.feed-card-sub {
    display: block;
    color: #64748b;
    font-size: 0.78rem;
    font-weight: 500;
}
.feed-card-cell {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}
.feed-cell-label {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #64748b;
}
.feed-cell-value {
    font-size: 0.92rem;
    font-weight: 700;
    color: #334155;
}
.feed-card-cell--weight .feed-card-weight {
    font-size: 1.35rem;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.1;
}
.feed-card-cell--status {
    align-items: flex-end;
    text-align: right;
}
.feed-card-details {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 20px;
    padding-top: 8px;
    border-top: 1px dashed #e2e8f0;
    font-size: 0.8rem;
    color: #475569;
}
.feed-card-details span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.feed-card-details i {
    color: #94a3b8;
    font-size: 0.75rem;
}
.feed-card-left h5 {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 4px;
}
.feed-card-left span {
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 500;
}
.feed-card-right {
    text-align: right;
}
.feed-card-weight {
    font-size: 1.2rem;
    font-weight: 800;
}
.feed-status {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 800;
    margin-top: 6px;
    text-transform: uppercase;
}
.status-success { background: #dcfce7; color: #15803d; border: 1px solid #86efac; }
.status-underweight { background: #fee2e2; color: #b91c1c; border: 1px solid #fca5a5; }
.status-overweight { background: #ffedd5; color: #c2410c; border: 1px solid #fdba74; }
.status-mismatch { background: #fee2e2; color: var(--error-color); border: 1px solid #fca5a5; }
.feed-card-underweight {
    border-color: #fca5a5;
    background: #fff1f2;
}
.feed-card-overweight {
    border-color: #fdba74;
    background: #fff7ed;
}
.feed-card-alert .feed-card-weight {
    color: #0f172a;
}

/* Beautiful Responsive Tables */
.data-table-shell {
    overflow: hidden;
    margin-bottom: 16px;
    background: #ffffff;
    border-radius: var(--radius-md);
    border: 1px solid #f1f5f9;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.table-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-bottom: 1px solid #e2e8f0;
    background: #f8fafc;
}
.table-toolbar-hint {
    margin: 0;
    flex: 1 1 180px;
    font-size: 0.8125rem;
    color: var(--text-muted);
}
.table-toolbar-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    flex: 1 1 360px;
    min-width: 0;
}
.table-search-wrap {
    position: relative;
    flex: 1 1 200px;
    min-width: 160px;
    max-width: 320px;
}
.table-search-wrap i {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.75rem;
    pointer-events: none;
}
.table-search-wrap input {
    width: 100%;
    padding: 6px 10px 6px 30px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 0.8125rem;
    background: #fff;
}
.table-toolbar-filters select,
.table-toolbar-advanced select,
.table-toolbar-advanced .toolbar-input,
.table-toolbar-filters .toolbar-input {
    padding: 6px 10px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 0.8125rem;
    background: #fff;
    min-width: 0;
}
.table-toolbar-filters select {
    max-width: 148px;
}
.toolbar-input-wide {
    flex: 1 1 160px;
    min-width: 140px;
}
.toolbar-input-num {
    width: 88px;
}
.table-toolbar-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    margin-left: auto;
}
.table-toolbar-divider {
    width: 1px;
    height: 24px;
    background: #e2e8f0;
    margin: 0 2px;
}
.table-toolbar-advanced {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
}
.table-toolbar-advanced[hidden] {
    display: none !important;
}
.data-table-shell .table-scroll {
    overflow-x: auto;
}
.table-container {
    overflow-x: auto;
    margin-bottom: 16px;
    background: #ffffff;
    border-radius: var(--radius-md);
    border: 1px solid #f1f5f9;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.8125rem;
}
th {
    padding: 10px 14px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.6875rem;
    letter-spacing: 0.5px;
}
td {
    padding: 10px 14px;
    border-bottom: 1px solid #f1f5f9;
    color: var(--text-main);
    vertical-align: middle;
}
tr:last-child td {
    border-bottom: none;
}
tr:hover td {
    background: #f8fafc;
}

/* Active Batch Banner */
.active-batch-banner {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 16px 18px;
    margin-bottom: 16px;
    background: #ffffff;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.active-batch-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    flex-wrap: wrap;
}
.active-batch-details {
    flex: 1;
    min-width: 260px;
}
.active-batch-details h2 {
    font-size: 1.25rem;
    margin: 10px 0 8px;
    font-weight: 800;
}
.active-batch-meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 2px 20px;
    margin-bottom: 10px;
}
.active-batch-meta p {
    color: var(--text-muted);
    font-size: 0.88rem;
    margin-bottom: 4px;
}
.badge-active {
    background: rgba(21, 128, 61, 0.1);
    color: var(--success-color);
}
.materials-panel-header h4 {
    font-size: 1rem;
    margin: 0;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}
.active-batch-materials {
    border-top: 1px solid #e2e8f0;
    padding-top: 12px;
}
.materials-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    gap: 12px;
}
.material-count-badge {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 999px;
    padding: 4px 10px;
    white-space: nowrap;
}
.materials-table-wrap {
    max-height: 220px;
    overflow-y: auto;
    overflow-x: auto;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #fafbfc;
}
.materials-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}
.materials-table thead {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #f1f5f9;
}
.materials-table th {
    text-align: left;
    padding: 8px 10px;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    font-weight: 700;
    border-bottom: 1px solid #e2e8f0;
    white-space: nowrap;
}
.materials-table th.col-num,
.materials-table td.col-num {
    text-align: right;
    white-space: nowrap;
}
.materials-table th.col-level {
    width: 120px;
}
.materials-table th.col-adjust {
    width: 130px;
    text-align: center;
}
.materials-table td {
    padding: 8px 10px;
    border-bottom: 1px solid #eef2f7;
    vertical-align: middle;
    background: #fff;
}
.materials-table tbody tr:last-child td {
    border-bottom: none;
}
.materials-table tbody tr:hover td {
    background: #f8fafc;
}
.material-name-cell {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 600;
    color: var(--text-primary);
}
.material-level-cell {
    min-width: 100px;
}
.material-mini-bar {
    height: 6px;
    background: #e2e8f0;
    border-radius: 999px;
    overflow: hidden;
    margin-top: 3px;
}
.material-mini-bar-fill {
    height: 100%;
    border-radius: 999px;
    background: var(--primary-color);
    transition: width 0.3s ease;
}
.material-mini-bar-fill.warning { background: var(--warning-color); }
.material-mini-bar-fill.danger { background: var(--error-color); }
.material-level-pct {
    font-size: 0.72rem;
    color: var(--text-muted);
}
.material-adjust-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}
.material-adjust-cell input {
    width: 56px;
    padding: 4px 6px;
    font-size: 0.82rem;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    text-align: center;
}
.material-adjust-cell .btn-xs {
    min-width: 28px;
    padding: 4px 6px;
}
.materials-empty-row td {
    text-align: center;
    color: var(--text-muted);
    padding: 20px;
    font-style: italic;
}
.active-batch-actions {
    display: flex;
    align-items: flex-start;
    justify-content: flex-end;
    flex-shrink: 0;
}
.active-batch-metrics {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}
.metric-pill {
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 6px 10px;
    min-width: 88px;
}
.metric-pill .metric-label {
    display: block;
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.metric-pill strong {
    font-size: 1rem;
    color: var(--text-primary);
}
.panel-hint {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin: 0 0 12px;
}
.devices-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 14px;
}
.devices-toolbar {
    margin: 16px 0;
    align-items: center;
    gap: 12px;
}
.devices-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: var(--text-muted);
    cursor: pointer;
}
.device-card-badges {
    display: flex;
    align-items: center;
    gap: 8px;
}
.device-id-line {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
    word-break: break-all;
}
.device-session-tag {
    display: inline-block;
    margin-left: 6px;
    padding: 2px 6px;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
    background: #fef3c7;
    color: #92400e;
}
.device-delete-btn {
    padding: 4px 8px;
    min-width: 0;
}
.device-card {
    background: #fff;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.device-card.online {
    border-left: 4px solid var(--success-color);
}
.device-card.offline {
    border-left: 4px solid #94a3b8;
}
.device-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}
.device-peripheral-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    padding: 4px 0;
    border-bottom: 1px solid #f1f5f9;
}
.device-peripheral-row:last-child {
    border-bottom: none;
}
.peripheral-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 6px;
}
.peripheral-dot.on { background: var(--success-color); }
.peripheral-dot.off { background: #cbd5e1; }
.batch-yield-preview {
    margin-top: 14px;
    padding: 14px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 10px;
}
.batch-yield-preview h4 {
    margin: 0 0 10px;
    font-size: 0.9rem;
    color: #166534;
}
.batch-scorecard-warn {
    background: #fff7ed;
    border: 1px solid #fed7aa;
    border-radius: 8px;
    padding: 10px 12px;
    color: #9a3412;
}

/* Batch scorecard — input / output / quality / yield story */
.batch-scorecard {
    display: grid;
    gap: 14px;
    margin: 12px 0 16px;
}
.batch-scorecard--compact {
    margin: 10px 0 14px;
}
.batch-scorecard-section {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 12px 14px;
}
.batch-scorecard-section h4 {
    margin: 0 0 10px;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #64748b;
}
.batch-scorecard-section h4 i {
    margin-right: 6px;
    color: #6366f1;
}
.batch-flow-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
}
.batch-flow-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 72px;
}
.batch-flow-item .label {
    font-size: 0.7rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.batch-flow-item strong {
    font-size: 1.05rem;
    color: #0f172a;
}
.batch-flow-arrow {
    color: #94a3b8;
    font-size: 1rem;
    font-weight: 700;
}
.batch-compare-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
@media (max-width: 720px) {
    .batch-compare-grid { grid-template-columns: 1fr; }
}
.batch-compare-col {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 10px 12px;
}
.batch-compare-col h5 {
    margin: 0 0 8px;
    font-size: 0.75rem;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.batch-compare-col ul {
    margin: 0;
    padding: 0;
    list-style: none;
}
.batch-compare-col li {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    font-size: 0.85rem;
    padding: 4px 0;
    border-bottom: 1px dashed #e2e8f0;
}
.batch-compare-col li:last-child { border-bottom: none; }
.batch-quality-split {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}
@media (max-width: 640px) {
    .batch-quality-split { grid-template-columns: 1fr; }
}
.batch-quality-chip {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 8px 10px;
    text-align: center;
}
.batch-quality-chip.success { border-color: #bbf7d0; background: #f0fdf4; }
.batch-quality-chip.underweight { border-color: #fecaca; background: #fef2f2; }
.batch-quality-chip.overweight { border-color: #fed7aa; background: #fff7ed; }
.batch-quality-chip .chip-label {
    font-size: 0.68rem;
    text-transform: uppercase;
    color: #64748b;
    font-weight: 700;
}
.batch-quality-chip strong {
    display: block;
    font-size: 1.1rem;
    margin: 2px 0;
}
.batch-quality-chip span {
    font-size: 0.75rem;
    color: #475569;
}
.batch-scorecard-footer {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.batch-score-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 999px;
    background: #eef2ff;
    border: 1px solid #c7d2fe;
    font-size: 0.78rem;
    color: #312e81;
}
.batch-score-pill.warn {
    background: #fff7ed;
    border-color: #fed7aa;
    color: #9a3412;
}
.batch-scorecard-note {
    margin: 8px 0 0;
    font-size: 0.82rem;
    color: #475569;
    line-height: 1.45;
}
.batch-scorecard-note strong { color: #0f172a; }

/* Simplified factory-friendly batch card */
.batch-simple-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.batch-simple-card--compact .batch-simple-block {
    padding: 10px 12px;
}
.batch-simple-block {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 12px 14px;
}
.batch-simple-block h4 {
    margin: 0 0 10px;
    font-size: 0.85rem;
    font-weight: 700;
    color: #0f172a;
}
.batch-simple-block h4 small {
    font-weight: 500;
    color: #64748b;
    font-size: 0.75rem;
}
.batch-simple-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 16px 24px;
}
.batch-simple-stats span {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.batch-simple-stats em {
    font-style: normal;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #64748b;
}
.batch-simple-stats strong {
    font-size: 1.15rem;
    color: #0f172a;
}
.batch-simple-stats small {
    font-size: 0.75rem;
    color: #475569;
    font-weight: 600;
}
.batch-compare-col.highlight {
    border-color: #c7d2fe;
    background: #eef2ff;
}
.batch-bar-row {
    margin-bottom: 10px;
}
.batch-bar-row:last-child { margin-bottom: 0; }
.batch-bar-head {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    margin-bottom: 4px;
    color: #334155;
}
.batch-bar-track {
    height: 8px;
    background: #e2e8f0;
    border-radius: 999px;
    overflow: hidden;
}
.batch-bar-fill {
    height: 100%;
    border-radius: 999px;
    background: #6366f1;
}
.batch-bar-row.success .batch-bar-fill { background: #22c55e; }
.batch-bar-row.underweight .batch-bar-fill { background: #ef4444; }
.batch-bar-row.overweight .batch-bar-fill { background: #f97316; }
.batch-bar-sub {
    font-size: 0.72rem;
    color: #64748b;
    margin-top: 3px;
}
.batch-scrap-list {
    margin: 8px 0 0;
    padding-left: 18px;
    font-size: 0.85rem;
    color: #334155;
}
.batch-scrap-list li { margin-bottom: 4px; }
.batch-simple-summary {
    background: #fff;
}

.product-meta-inline {
    color: var(--text-muted);
    font-weight: normal;
    font-size: 0.9em;
}
.material-meta {
    color: var(--text-muted);
    font-size: 0.85em;
    font-weight: normal;
}
.products-filters {
    margin-bottom: 16px;
}
.logs-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 12px;
}
.logs-stats-grid .stat-card h3 {
    font-size: 1.15rem;
}
.logs-stats-grid .stat-sub {
    display: block;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-top: 2px;
}
.logs-filter-toggle[aria-expanded="true"] {
    background: #eef2ff;
    border-color: #c7d2fe;
    color: var(--primary-color);
}
.logs-filter-toggle.has-active-filters:not([aria-expanded="true"]) {
    box-shadow: inset 0 0 0 2px #c7d2fe;
}
.table-toolbar-logs {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: start;
    gap: 8px 12px;
}
.table-toolbar-logs .table-toolbar-filters {
    grid-column: 1;
    min-width: 0;
}
.table-toolbar-logs .table-toolbar-actions {
    grid-column: 2;
    grid-row: 1;
    margin-left: 0;
    align-self: center;
}
.table-toolbar-logs .table-toolbar-advanced {
    grid-column: 1 / -1;
}
.logs-toolbar-filters {
    display: grid;
    grid-template-columns: minmax(200px, 1.6fr) repeat(4, minmax(108px, 1fr));
    gap: 8px;
    align-items: center;
    flex: 1 1 100%;
    min-width: 0;
}
.logs-toolbar-filters .table-search-wrap {
    max-width: none;
}
.logs-toolbar-filters select,
.logs-toolbar-filters .toolbar-input {
    width: 100%;
    max-width: none;
}
.table-toolbar-advanced.logs-toolbar-advanced {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 8px;
    align-items: center;
}
@media (max-width: 1100px) {
    .logs-toolbar-filters {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
    .logs-toolbar-filters .table-search-wrap {
        grid-column: 1 / -1;
    }
    .table-toolbar-advanced.logs-toolbar-advanced {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}
@media (max-width: 640px) {
    .logs-toolbar-filters,
    .table-toolbar-advanced.logs-toolbar-advanced {
        grid-template-columns: 1fr 1fr;
    }
}
.logs-summary-panel h4 {
    margin: 0 0 12px;
    font-size: 0.95rem;
    color: var(--text-primary);
}
.logs-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
}
.logs-summary-item {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 10px 12px;
}
.logs-summary-item span {
    display: block;
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 4px;
}
.logs-summary-item strong {
    font-size: 1.05rem;
    color: var(--text-primary);
}
.logs-summary-item.success strong { color: #059669; }
.logs-summary-item.underweight strong { color: #b91c1c; }
.logs-summary-item.overweight strong { color: #92400e; }
#logs-table tfoot td {
    background: #f1f5f9;
    border-top: 2px solid #cbd5e1;
    font-weight: 700;
    color: var(--text-primary);
    padding: 14px 12px;
}
.batch-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
    margin: 0 0 12px;
}
.batch-summary-stats {
    margin-bottom: 12px;
}
.batch-summary-stats .stat-card h3 {
    font-size: 1rem;
    word-break: break-word;
}
.modal-box--wide {
    max-width: 760px;
}
.modal-box--scrollable .modal-footer.modal-actions-row {
    justify-content: flex-end;
    gap: 10px;
}
.bom-section-hint {
    margin: -4px 0 12px;
    font-size: 0.82rem;
}
.batch-summary-item {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 10px 12px;
}
.batch-summary-item span {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
}
.batch-summary-item strong {
    font-size: 1.1rem;
}
.batch-summary-materials-wrap {
    margin: 16px 0;
    padding-top: 12px;
    border-top: 1px solid #e2e8f0;
}
.batch-summary-materials-wrap h4 {
    margin: 0 0 10px;
    font-size: 0.95rem;
}
.modal-actions-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 16px;
}
.batch-remaining-table input[type="number"] {
    width: 100%;
    max-width: 120px;
    padding: 6px 8px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
}
.empty-state-msg {
    color: var(--text-muted);
    padding: 24px;
    text-align: center;
}
tr.batch-row-clickable {
    cursor: pointer;
}
tr.batch-row-clickable:hover td {
    background: #eef2ff;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 24px 16px;
    box-sizing: border-box;
    overflow-y: auto;
    z-index: 500;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}
.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}
.modal-box {
    width: 90%;
    max-width: 600px;
    padding: 35px;
    border-radius: 24px;
    background: #ffffff;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.15);
    transform: scale(0.97);
    transition: transform 0.2s ease;
    max-height: calc(100dvh - 48px);
    overflow-y: auto;
    flex-shrink: 0;
}
.modal-overlay.active .modal-box {
    transform: scale(1);
}
.label-preview-modal-box {
    max-width: min(920px, 96vw);
}
.label-preview-stage {
    min-height: 420px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: #f8fafc;
    border: 1px solid var(--glass-border);
    border-radius: 16px;
}
.label-preview-stage-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}
.label-preview-canvas {
    position: relative;
    background: #fff;
    border: 2px solid #64748b;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.12);
    overflow: hidden;
}
.label-preview-element {
    pointer-events: none;
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    cursor: default;
}

.global-loader {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.72);
    backdrop-filter: blur(2px);
    z-index: 100000;
}
.global-loader.is-visible {
    display: flex;
}
.global-loader-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
    border: 1px solid #e2e8f0;
}
.global-loader-spinner {
    width: 28px;
    height: 28px;
    border: 3px solid #dbeafe;
    border-top-color: #2563eb;
    border-radius: 50%;
    animation: global-loader-spin 0.8s linear infinite;
}
.global-loader-text {
    font-weight: 600;
    color: #0f172a;
    font-size: 0.95rem;
}
@keyframes global-loader-spin {
    to { transform: rotate(360deg); }
}

#batch-summary-modal.active {
    align-items: flex-start;
    padding: 24px 16px;
    overflow-y: auto;
}
#product-modal.active,
#batch-modal.active {
    align-items: flex-start;
    padding: 24px 16px;
    overflow-y: auto;
}
.modal-box--scrollable {
    max-height: min(90vh, 880px);
    max-width: 640px;
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
}
.modal-box--scrollable.modal-box--wide {
    max-width: 760px;
}
.modal-box--scrollable > .modal-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 8px 28px 20px;
    -webkit-overflow-scrolling: touch;
}
.modal-box--scrollable .modal-header {
    flex-shrink: 0;
    margin-bottom: 0;
    padding: 24px 28px 14px;
}
.modal-box--scrollable form {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}
.modal-box--scrollable .modal-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 8px 28px 20px;
    -webkit-overflow-scrolling: touch;
}
.modal-box--scrollable .modal-footer {
    flex-shrink: 0;
    padding: 16px 28px 24px;
    border-top: 1px solid #f1f5f9;
    background: #fff;
}
.modal-box--scrollable .modal-footer .form-error-msg {
    margin-bottom: 12px;
}
.bom-section--compact {
    padding: 16px;
    margin-bottom: 0;
}
.bom-section--compact h4 {
    margin-bottom: 10px;
}
.batch-issues-scroll .issue-row {
    padding: 10px 0;
}
.batch-issues-scroll .issue-row:first-child {
    padding-top: 0;
}
.batch-issues-scroll .issue-qty-input {
    width: 120px;
    padding: 8px 12px;
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    border-bottom: 2px solid #f1f5f9;
    padding-bottom: 15px;
}
.modal-header h3 {
    font-size: 1.4rem;
    font-weight: 700;
}
.close-modal {
    font-size: 1.8rem;
    cursor: pointer;
    color: var(--text-muted);
}
.close-modal:hover {
    color: var(--text-main);
}
.bom-section {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 24px;
}
.bom-section h4 {
    font-size: 1.05rem;
    margin-bottom: 15px;
    font-weight: 700;
}
.bom-row {
    display: flex;
    gap: 15px;
    margin-bottom: 12px;
    align-items: center;
}
.bom-row select { flex: 2; }
.bom-row input { flex: 1; }
.btn-remove-row {
    background: none;
    border: none;
    color: var(--error-color);
    cursor: pointer;
    font-size: 1.35rem;
    padding: 5px;
}
.issue-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 0;
    border-bottom: 1px solid #f1f5f9;
}
.issue-row label {
    font-size: 0.95rem;
    font-weight: 700;
}
.issue-row .qty-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
}
.issue-qty-input {
    width: 160px;
    padding: 12px 18px;
    border: 2px solid #cbd5e1;
    border-radius: 10px;
    font-size: var(--font-base);
    font-family: inherit;
    color: var(--text-main);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.issue-qty-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.15);
}
.issue-row span {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-muted);
}

/* Designer Workspace */
.designer-workspace {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 30px;
    padding: 25px;
    min-height: 480px;
    background: #ffffff;
    box-shadow: var(--glass-shadow);
    border-radius: 16px;
}
.designer-workspace-3col {
    grid-template-columns: 220px minmax(280px, 1fr) minmax(320px, 420px);
    align-items: start;
}

.label-designer-panel {
    max-width: 100%;
}
.label-designer-grid {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 20px;
    margin-bottom: 20px;
}
.label-preview-column {
    min-width: 0;
}
.compact-board-settings {
    margin-bottom: 12px;
    padding: 10px 14px;
    font-size: 0.85rem;
}
.compact-board-settings input[type="text"],
.compact-board-settings input[type="number"] {
    width: 140px;
    padding: 4px 8px;
}
.label-preview-wrap {
    background: #fff;
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 16px;
    box-shadow: var(--glass-shadow);
}
.label-preview-wrap h4 {
    margin: 0 0 12px;
    font-size: 0.95rem;
    color: var(--text-main);
}
.label-print-preview {
    width: 100%;
    max-width: 420px;
    margin: 0 auto;
    aspect-ratio: 100 / 150;
    background: #fff;
    border: 2px solid #cbd5e1;
    border-radius: 8px;
    padding: 10px 12px;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 7px;
    line-height: 1.35;
    color: #000;
    position: relative;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}
.label-print-preview .lp-header {
    text-align: center;
    font-size: 6.5px;
    font-weight: 700;
    border-bottom: 1px solid #000;
    padding-bottom: 4px;
    margin-bottom: 4px;
}
.label-print-preview .lp-product {
    font-size: 11px;
    font-weight: 800;
    line-height: 1.2;
    max-width: 58%;
}
.label-print-preview .lp-sub {
    font-size: 6px;
    max-width: 58%;
    margin-bottom: 3px;
}
.label-print-preview .lp-specs {
    max-width: 58%;
    font-size: 6.5px;
}
.label-print-preview .lp-specs div { margin-bottom: 1px; }
.label-print-preview .lp-right {
    position: absolute;
    right: 8px;
    top: 72px;
    width: 38%;
    text-align: center;
}
.label-print-preview .lp-mii-logo {
    width: 100%;
    max-height: 42px;
    object-fit: contain;
    margin-bottom: 4px;
}
.label-print-preview .lp-qr {
    width: 54px;
    height: 54px;
    margin: 0 auto;
    background: repeating-linear-gradient(45deg, #111 0 2px, #fff 2px 4px);
    border: 1px solid #111;
}
.label-print-preview .lp-footer {
    position: absolute;
    left: 10px;
    right: 42%;
    bottom: 52px;
    font-size: 5.8px;
    line-height: 1.45;
    word-wrap: break-word;
    overflow-wrap: anywhere;
}
.label-print-preview .lp-made {
    position: absolute;
    left: 10px;
    bottom: 38px;
    font-weight: 800;
    font-size: 7px;
}
.label-print-preview .lp-barcode {
    position: absolute;
    left: 10px;
    right: 10px;
    bottom: 6px;
    height: 28px;
    background: linear-gradient(90deg, #000 0 2px, #fff 2px 4px);
    background-size: 4px 100%;
    border-top: 1px solid #ccc;
    padding-top: 2px;
}
.label-print-preview .lp-barcode-text {
    text-align: center;
    font-size: 6px;
    letter-spacing: 0.5px;
    margin-top: 18px;
}
.label-zpl-section {
    background: #fff;
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 16px 20px 20px;
    box-shadow: var(--glass-shadow);
}
.label-zpl-section h3 {
    margin: 0 0 10px;
    font-size: 1rem;
}
.label-zpl-section textarea,
#zpl-output-textarea {
    width: 100%;
    height: 260px;
    min-height: 200px;
}
.tweak-fields label {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 10px;
}
.tweak-fields input[type="number"] {
    width: 100%;
    margin-top: 4px;
    padding: 6px 8px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
}
.tweak-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    margin-top: 4px;
}
.designer-template-status {
    background: #ecfdf5;
    border: 1px solid #86efac;
    color: #166534;
    padding: 12px 18px;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 14px;
}
.designer-template-status.loading {
    background: #f8fafc;
    border-color: #e2e8f0;
    color: #64748b;
}
.designer-template-status.warning {
    background: #fffbeb;
    border-color: #fde68a;
    color: #92400e;
}
.designer-zpl-panel {
    border-left: 2px solid #f1f5f9;
    padding-left: 20px;
    min-height: 420px;
}
.designer-zpl-panel h3 {
    font-size: 1rem;
    margin-bottom: 8px;
    color: var(--text-main);
}
.designer-zpl-panel textarea,
#zpl-output-textarea {
    width: 100%;
    height: 420px;
    min-height: 320px;
    background: #fafafa;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    color: #1e3a8a;
    padding: 14px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.78rem;
    line-height: 1.45;
    outline: none;
    resize: vertical;
    box-sizing: border-box;
}
.designer-canvas-hint {
    margin-top: 10px;
    text-align: center;
    max-width: 100%;
}
.snap-grid-label {
    margin-left: 10px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 700;
    color: var(--text-muted);
}
.snap-grid-label input {
    width: auto;
    margin: 0;
}
.scrap-table-wrap {
    max-height: none;
    box-shadow: none;
    border: none;
    margin-bottom: 0;
}

/* Pagination */
.pagination-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    margin-top: 10px;
    background: #ffffff;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
}
.pagination-info {
    font-size: 0.8125rem;
    color: var(--text-muted);
}
.pagination-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}
.pagination-size-label {
    font-size: 0.8125rem;
    color: var(--text-muted);
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.pagination-size-select,
.pagination-page-input {
    padding: 4px 8px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 0.8125rem;
    background: white;
}
.pagination-page-input {
    width: 56px;
    text-align: center;
}
.pagination-page-wrap {
    font-size: 0.8125rem;
    color: var(--text-muted);
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.pagination-bar .btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.main-content {
    overflow-y: auto;
    max-height: 100vh;
}
.designer-toolbar {
    border-right: 2px solid #f1f5f9;
    padding-right: 20px;
}
.designer-toolbar h4 {
    font-size: 0.95rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.75px;
    margin-bottom: 20px;
    font-weight: 700;
}
.designer-board-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 25px;
    width: 100%;
}
.board-settings {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: center;
    font-size: var(--font-base);
    background: #f8fafc;
    padding: 12px 24px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}
.board-settings label {
    font-weight: 700;
    color: var(--text-muted);
}
.board-settings input {
    padding: 6px 12px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    width: 90px;
}
.designer-canvas-container {
    position: relative;
    background: #ffffff;
    border: 3px dashed var(--primary-color);
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.03);
    overflow: hidden;
}
/* Assistive Visual Grid */
.designer-canvas {
    position: relative;
    width: 100%;
    height: 100%;
    background-color: #fafafa;
    background-image: 
        linear-gradient(rgba(0, 0, 0, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 0, 0, 0.04) 1px, transparent 1px);
    background-size: 15px 15px;
}
.designer-element {
    position: absolute;
    padding: 8px 16px;
    background: #eff6ff;
    border: 2px solid var(--primary-color);
    border-radius: 8px;
    color: var(--primary-color);
    font-size: 0.9rem;
    font-weight: 700;
    cursor: move;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
}
.designer-element.barcode-type {
    background: #f0fdf4;
    border-color: var(--success-color);
    color: var(--success-color);
}
.designer-element .del-btn {
    cursor: pointer;
    color: #94a3b8;
    font-size: 1.05rem;
}
.designer-element .del-btn:hover {
    color: var(--error-color);
}

/* Canvas Snapping/Help Banner */
.designer-assists {
    background: #f0f9ff;
    color: #0369a1;
    border: 1px solid #bae6fd;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    width: 100%;
}

.zpl-output-box {
    background: #ffffff;
    box-shadow: var(--glass-shadow);
    border-radius: 16px;
    margin-top: 30px;
    padding: 25px;
}

/* User Management Grid */
.users-management-row {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 30px;
}

/* Search bar in header */
.barcode-search-box {
    margin: 0;
    display: flex;
    gap: 6px;
    align-items: center;
    flex: 1;
    max-width: 340px;
    min-width: 0;
    position: relative;
}
.barcode-search-box .search-icon {
    position: absolute;
    left: 10px;
    color: var(--text-muted);
    font-size: 0.75rem;
    pointer-events: none;
}
.barcode-search-box input {
    flex: 1;
    min-width: 0;
    padding: 6px 10px 6px 28px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 0.8125rem;
    height: 32px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
}
.barcode-search-box input:focus {
    border-color: var(--primary-color);
}
.barcode-search-box .btn {
    height: 32px;
    width: 32px;
    padding: 0;
    flex-shrink: 0;
}
.barcode-details-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.3);
    backdrop-filter: blur(6px);
    z-index: 600;
    display: none;
    align-items: center;
    justify-content: center;
}
.barcode-details-overlay.active {
    display: flex;
}
.barcode-card {
    background: white;
    width: 90%;
    max-width: 550px;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
}
.barcode-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #f1f5f9;
    padding-bottom: 12px;
    margin-bottom: 20px;
}
.barcode-card-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}
.barcode-card-item label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 700;
    margin-bottom: 5px;
}
.barcode-card-item span {
    font-size: 1.1rem;
    font-weight: 600;
}

/* RESPONSIVE LAYOUT MEDIA QUERIES (MOBILE FRIENDLY) */
@media (max-width: 992px) {
    .dashboard-row {
        grid-template-columns: 1fr;
    }
    .feed-card-grid {
        grid-template-columns: 1fr 1fr;
    }
    .feed-card-cell--status {
        grid-column: 1 / -1;
        align-items: flex-start;
        text-align: left;
    }
    .users-management-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    body {
        padding-top: 56px;
    }
    .mobile-nav-bar {
        display: flex;
        height: 56px;
    }
    .main-header {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
        padding: 10px 12px;
    }
    .main-header h1 {
        font-size: 1rem;
    }
    .header-toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    .barcode-search-box {
        max-width: none;
    }
    .connection-status {
        align-self: flex-end;
    }
    .sidebar {
        position: fixed;
        top: 70px;
        left: -100%;
        bottom: 0;
        width: 100%;
        max-width: 320px;
        border-radius: 0;
        transition: left 0.3s ease;
        margin: 0;
        box-shadow: 10px 0 30px rgba(0,0,0,0.05);
    }
    .sidebar.active {
        left: 0;
    }
    .main-content {
        margin-left: 0;
        width: 100%;
        padding: 20px;
    }
    .main-header {
        display: none; /* Mobile header takes its place */
    }
    .insights-filters {
        flex-direction: column;
        align-items: stretch;
    }
    .table-toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    .table-toolbar-actions {
        margin-left: 0;
        justify-content: flex-end;
        flex-wrap: wrap;
    }
    .table-toolbar-filters select {
        max-width: none;
        flex: 1 1 140px;
    }
    .table-search-wrap {
        max-width: none;
        flex: 1 1 100%;
    }
    .label-designer-grid {
        grid-template-columns: 1fr;
    }
    .designer-workspace,
    .designer-workspace-3col {
        grid-template-columns: 1fr;
    }
    .designer-zpl-panel {
        border-left: none;
        border-top: 2px solid #f1f5f9;
        padding-left: 0;
        padding-top: 16px;
    }
    .designer-toolbar {
        border-right: none;
        border-bottom: 2px solid #f1f5f9;
        padding-right: 0;
        padding-bottom: 20px;
    }
    .board-settings {
        flex-direction: column;
        align-items: stretch;
    }
    .active-batch-banner {
        gap: 12px;
    }
    .active-batch-top {
        flex-direction: column;
    }
    .active-batch-meta {
        grid-template-columns: 1fr;
    }
    .active-batch-actions {
        justify-content: stretch;
        width: 100%;
    }
    .active-batch-actions .btn {
        width: 100%;
    }
}

/* Toast Notification Styles */
.toast {
    position: fixed;
    top: 25px;
    right: 25px;
    background: white;
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 12px 18px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: flex-start;
    gap: 10px;
    z-index: 1100;
    transform: translateX(120%);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    font-weight: 600;
    font-size: 0.8125rem;
    max-width: min(420px, calc(100vw - 40px));
}
.toast span {
    line-height: 1.4;
}
.toast.active {
    transform: translateX(0);
}
.toast-success i { color: var(--success-color); }
.toast-error i { color: var(--error-color); }
.toast-success { border-left: 5px solid var(--success-color); }
.toast-error { border-left: 5px solid var(--error-color); }

.header-button-group {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

@media print {
    .sidebar, .top-header, .panel-header-actions .btn, .btn, .active-batch-banner, .toast, .modal-overlay, #confirm-modal {
        display: none !important;
    }
    .main-content {
        margin-left: 0 !important;
        padding: 0 !important;
        width: 100% !important;
    }
    .table-container, table {
        width: 100% !important;
        border-collapse: collapse !important;
        box-shadow: none !important;
    }
    .content-panel {
        display: none !important;
    }
    .content-panel.active {
        display: block !important;
    }
    body {
        background: white !important;
        color: black !important;
    }
}

.bom-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}
.bom-badge {
    display: inline-block;
    background-color: #eef2f6;
    color: #334155;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.6875rem;
    margin: 1px;
    border: 1px solid #e2e8f0;
    white-space: nowrap;
}

/* ---- Label Designer v3 ---- */
.label-designer-panel {
    max-width: 100%;
}
.ld-topbar {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 12px;
}
.ld-topbar-title h2 {
    margin: 0 0 4px;
    font-size: 1.25rem;
}
.ld-topbar-sub {
    margin: 0;
    font-size: 0.85rem;
    color: var(--text-muted);
}
.ld-topbar-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}
.ld-dirty-badge {
    font-size: 0.75rem;
    color: #b45309;
    background: #fffbeb;
    border: 1px solid #fcd34d;
    padding: 4px 10px;
    border-radius: 999px;
    font-weight: 600;
}
.ld-workspace-v3 {
    display: grid;
    grid-template-columns: 260px minmax(400px, 1fr) 300px;
    gap: 16px;
    align-items: start;
    min-height: 560px;
}
.ld-col-left,
.ld-col-right {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.ld-card {
    background: #fff;
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 14px;
    box-shadow: var(--glass-shadow);
}
.ld-card-flush {
    border: none;
    box-shadow: none;
    padding: 0;
    background: transparent;
}
.ld-card h4 {
    margin: 0 0 10px;
    font-size: 0.88rem;
}
.ld-guide {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 10px 14px;
    font-size: 0.82rem;
}
.ld-guide summary {
    cursor: pointer;
    font-weight: 700;
    color: var(--text-main);
}
.ld-guide-steps,
.ld-feature-list {
    margin: 10px 0 0;
    padding-left: 1.2rem;
    color: var(--text-muted);
    line-height: 1.55;
}
.ld-feature-list {
    list-style: disc;
}
.ld-template-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 240px;
    overflow-y: auto;
}
.ld-tpl-card {
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 10px 12px;
    cursor: pointer;
    background: #fff;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.ld-tpl-card:hover,
.ld-tpl-card.active {
    border-color: #6366f1;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.12);
}
.ld-tpl-card.is-live {
    border-left: 3px solid #10b981;
}
.ld-tpl-card-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}
.ld-tpl-name {
    font-size: 0.85rem;
}
.ld-tpl-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin: 4px 0 8px;
}
.ld-tpl-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}
.ld-live-badge {
    font-size: 0.68rem;
    font-weight: 700;
    color: #059669;
    text-transform: uppercase;
    white-space: nowrap;
}
.ld-live-badge i {
    font-size: 0.5rem;
    vertical-align: middle;
    margin-right: 3px;
}
.ld-tpl-empty {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin: 0;
}
.ld-meta-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 16px;
    align-items: flex-end;
    padding: 12px 14px;
    background: #fff;
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    margin-bottom: 10px;
}
.ld-meta-bar label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
}
.ld-meta-bar input {
    width: 140px;
    padding: 6px 10px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.85rem;
}
.ld-size-readout {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-left: auto;
    align-self: center;
}
.ld-canvas-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 14px;
    padding: 8px 12px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 10px 10px 0 0;
    font-size: 0.8rem;
}
.ld-toolbar-label {
    font-weight: 700;
    color: var(--text-main);
}
.ld-zoom-group {
    display: flex;
    align-items: center;
    gap: 4px;
}
.ld-zoom-group select {
    padding: 4px 8px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 0.8rem;
}
.ld-toggle-grid {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    cursor: pointer;
}
.ld-hint {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-left: auto;
}
.ld-stage-wrap {
    background: #fff;
    border: 1px solid var(--glass-border);
    border-top: none;
    border-radius: 0 0 12px 12px;
    box-shadow: var(--glass-shadow);
    overflow: hidden;
}
.ld-stage-scroll {
    overflow: auto;
    min-height: 480px;
    max-height: calc(100vh - 280px);
    padding: 24px;
    background:
        repeating-conic-gradient(#eef2f7 0 25%, #f8fafc 0 50%) 50% / 20px 20px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}
.ld-stage {
    flex-shrink: 0;
}
.ld-canvas {
    position: relative;
    background: #fff;
    border: 2px solid #64748b;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.12);
}
.ld-canvas.ld-grid-on {
    background-image:
        linear-gradient(rgba(99, 102, 241, 0.08) 1px, transparent 1px),
        linear-gradient(90deg, rgba(99, 102, 241, 0.08) 1px, transparent 1px);
    background-size: 8px 8px;
    background-color: #fff;
}
.ld-element {
    position: absolute;
    border: 1px dashed transparent;
    padding: 1px 2px;
    cursor: move;
    min-width: 16px;
    min-height: 12px;
    user-select: none;
}
.ld-element:hover {
    border-color: rgba(99, 102, 241, 0.45);
    background: rgba(99, 102, 241, 0.04);
}
.ld-element.selected {
    border: 2px solid #6366f1;
    background: rgba(99, 102, 241, 0.08);
    z-index: 5;
    box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.2);
}
.ld-el-text {
    display: block;
    color: #0f172a;
    font-family: Arial, Helvetica, sans-serif;
    line-height: 1.2;
    pointer-events: none;
    white-space: pre-wrap;
}
.ld-el-barcode .ld-barcode-mock,
.ld-barcode-mock {
    background: repeating-linear-gradient(90deg, #000 0 2px, #fff 2px 4px);
    margin-bottom: 2px;
}
.ld-qr-mock {
    background: repeating-linear-gradient(45deg, #111 0 2px, #fff 2px 4px);
    border: 1px solid #111;
}
.ld-tabs {
    display: flex;
    gap: 4px;
    background: #f1f5f9;
    padding: 4px;
    border-radius: 10px;
}
.ld-tab {
    flex: 1;
    border: none;
    background: transparent;
    padding: 8px 6px;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
}
.ld-tab.active {
    background: #fff;
    color: var(--text-main);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}
.ld-tab-panel {
    margin-top: 10px;
}
.ld-panel-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin: 0 0 10px;
}
.ld-layers-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 420px;
    overflow-y: auto;
}
.ld-layer-row {
    display: flex;
    align-items: center;
    gap: 4px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #fff;
    overflow: hidden;
}
.ld-layer-row.selected {
    border-color: #6366f1;
    background: #eef2ff;
}
.ld-layer-select {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    border: none;
    background: transparent;
    padding: 8px 10px;
    text-align: left;
    font-size: 0.78rem;
    cursor: pointer;
    min-width: 0;
}
.ld-layer-select span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.ld-layer-actions {
    display: flex;
    flex-shrink: 0;
}
.ld-layer-btn {
    border: none;
    background: transparent;
    padding: 6px 7px;
    color: #64748b;
    cursor: pointer;
    font-size: 0.72rem;
}
.ld-layer-btn:hover:not(:disabled) {
    color: #6366f1;
    background: #f1f5f9;
}
.ld-layer-btn:disabled {
    opacity: 0.35;
    cursor: default;
}
.ld-layer-del:hover:not(:disabled) {
    color: #ef4444;
}
.ld-empty-msg {
    font-size: 0.82rem;
    color: var(--text-muted);
    text-align: center;
    padding: 20px 8px;
}
.ld-add-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 16px;
}
.ld-add-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 8px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #fff;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-main);
    transition: border-color 0.15s, background 0.15s;
}
.ld-add-btn:hover {
    border-color: #6366f1;
    background: #eef2ff;
}
.ld-add-btn i {
    font-size: 1.1rem;
    color: #6366f1;
}
.ld-field-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.ld-chip {
    border: 1px solid #e2e8f0;
    background: #fff;
    border-radius: 999px;
    padding: 5px 10px;
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    color: var(--text-main);
}
.ld-chip:hover {
    border-color: #6366f1;
    background: #eef2ff;
    color: #4338ca;
}
.ld-properties {
    background: #fff;
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 14px;
}
.ld-properties h4 {
    margin: 0 0 8px;
    font-size: 0.88rem;
}
.ld-properties label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 10px;
}
.ld-prop-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
.ld-properties input,
.ld-properties select,
.ld-properties textarea {
    width: 100%;
    margin-top: 4px;
    padding: 6px 8px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 0.85rem;
}
.ld-prop-empty,
.ld-prop-type {
    font-size: 0.85rem;
    color: var(--text-muted);
}
.ld-prop-type {
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 12px;
}
.ld-prop-delete {
    margin-top: 8px;
}
.ld-zpl-details summary {
    cursor: pointer;
    font-weight: 700;
    margin-bottom: 8px;
}
@media (max-width: 1280px) {
    .ld-workspace-v3 {
        grid-template-columns: 1fr;
    }
    .ld-hint {
        margin-left: 0;
        width: 100%;
    }
    .ld-stage-scroll {
        max-height: 520px;
    }
}

/* ---- WhatsApp Alerts admin ---- */
.wa-alert-banner {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    margin-bottom: 16px;
    font-size: 0.875rem;
    line-height: 1.5;
    border: 1px solid transparent;
}
.wa-alert-banner i {
    margin-top: 2px;
    flex-shrink: 0;
}
.wa-alert-banner code {
    font-size: 0.8em;
    padding: 1px 5px;
    border-radius: 4px;
    background: rgba(15, 23, 42, 0.06);
}
.wa-alert-banner.warning {
    background: #fffbeb;
    border-color: #fcd34d;
    color: #92400e;
}
.wa-alert-banner.info {
    background: #eff6ff;
    border-color: #93c5fd;
    color: #1e40af;
}
.wa-alert-banner.success {
    background: #ecfdf5;
    border-color: #6ee7b7;
    color: #065f46;
}
.wa-status-grid {
    margin-bottom: 16px;
}
.wa-settings-row {
    grid-template-columns: 1fr 1fr;
    margin-bottom: 16px;
}
.wa-table-section {
    margin-bottom: 16px;
}
.wa-settings-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
}
.wa-setting-option {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-sm);
    background: #f8fafc;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
}
.wa-setting-option:hover {
    border-color: #cbd5e1;
    background: #fff;
}
.wa-setting-option input {
    margin-top: 3px;
    flex-shrink: 0;
    accent-color: var(--primary-color);
}
.wa-setting-copy {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.wa-setting-copy strong {
    font-size: 0.875rem;
    color: var(--text-main);
}
.wa-setting-copy small {
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.4;
}
.wa-template-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
.wa-template-grid .metric-pill strong {
    display: block;
    font-size: 0.82rem;
    word-break: break-all;
    font-weight: 700;
}
.wa-recipient-hint {
    margin-top: -4px;
    margin-bottom: 14px;
}
.wa-alert-type-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}
.wa-alert-type-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-right: 4px;
}
.wa-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 999px;
    background: #fff;
    font-size: 0.8125rem;
    cursor: pointer;
}
.wa-chip input {
    accent-color: var(--primary-color);
}
.wa-otp-block {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px dashed #e2e8f0;
}
.wa-inline-label {
    width: 100%;
    border: 1px solid transparent;
    background: transparent;
    padding: 4px 6px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-family: inherit;
}
.wa-inline-label:focus {
    border-color: var(--primary-color);
    background: #fff;
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
.wa-actions {
    white-space: nowrap;
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.wa-details {
    font-size: 0.78rem;
    color: var(--text-muted);
    max-width: 260px;
    word-break: break-word;
}
@media (max-width: 960px) {
    .wa-settings-row,
    .wa-template-grid {
        grid-template-columns: 1fr;
    }
}

/* ---- Label Designer v4 (platform layout) ---- */
.label-designer-panel .ld-dirty-badge {
    padding: 6px 12px;
    align-self: center;
}
.label-designer-panel .ld-workspace-v3 {
    grid-template-columns: 240px minmax(420px, 1fr) 280px;
    min-height: 0;
    margin-bottom: 16px;
}
.label-designer-panel .ld-sidebar .ld-template-grid {
    max-height: calc(100vh - 320px);
    overflow-y: auto;
    padding: 0 2px 2px;
}
.label-designer-panel .ld-canvas-panel {
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
}
.label-designer-panel .ld-canvas-panel > .col-header {
    padding: 14px 16px 10px;
    margin-bottom: 0;
}
.label-designer-panel .ld-canvas-panel .ld-size-readout {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 600;
}
.label-designer-panel .ld-meta-toolbar {
    margin: 0;
    border-radius: 0;
    border-left: none;
    border-right: none;
    border-top: none;
    box-shadow: none;
}
.label-designer-panel .ld-meta-toolbar input[type="text"],
.label-designer-panel .ld-meta-toolbar input[type="number"] {
    min-width: 100px;
}
.label-designer-panel .ld-canvas-toolbar {
    padding: 10px 16px;
    background: #f8fafc;
    border-top: 1px solid #f1f5f9;
    border-bottom: 1px solid #e2e8f0;
    border-radius: 0;
}
.label-designer-panel .ld-stage-wrap {
    flex: 1;
    border: none;
    border-radius: 0;
    box-shadow: none;
}
.label-designer-panel .ld-stage-scroll {
    min-height: 520px;
    max-height: calc(100vh - 340px);
    padding: 28px;
}
.label-designer-panel .ld-canvas {
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.14);
}
.label-designer-panel .ld-canvas.ld-grid-on {
    background-image:
        linear-gradient(rgba(37, 99, 235, 0.07) 1px, transparent 1px),
        linear-gradient(90deg, rgba(37, 99, 235, 0.07) 1px, transparent 1px);
}
.label-designer-panel .ld-tpl-card {
    border-radius: var(--radius-sm);
    background: #f8fafc;
}
.label-designer-panel .ld-tpl-card:hover {
    background: #fff;
    border-color: #cbd5e1;
}
.label-designer-panel .ld-tpl-card.active {
    border-color: var(--primary-color);
    background: #eff6ff;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.12);
}
.label-designer-panel .ld-tpl-card.is-live {
    border-left-color: var(--success-color);
}
.label-designer-panel .ld-tpl-name {
    font-weight: 700;
}
.label-designer-panel .ld-live-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(21, 128, 61, 0.1);
    padding: 2px 8px;
    border-radius: 999px;
    color: var(--success-color);
}
.label-designer-panel .ld-tools-panel {
    display: flex;
    flex-direction: column;
    min-height: 520px;
}
.label-designer-panel .ld-tabs {
    border-radius: var(--radius-sm);
    margin-bottom: 12px;
}
.label-designer-panel .ld-tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    font-size: 0.78rem;
    font-weight: 700;
}
.label-designer-panel .ld-tab.active {
    color: var(--primary-color);
}
.label-designer-panel .ld-tab-panel {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    margin-top: 0;
}
.label-designer-panel .ld-section-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    margin: 0 0 8px;
}
.label-designer-panel .ld-layers-list {
    gap: 6px;
    max-height: calc(100vh - 420px);
}
.label-designer-panel .ld-layer-row.selected {
    border-color: var(--primary-color);
    background: #eff6ff;
}
.label-designer-panel .ld-element.selected {
    border-color: var(--primary-color);
    background: rgba(37, 99, 235, 0.08);
}
.label-designer-panel .ld-element:hover {
    border-color: rgba(37, 99, 235, 0.45);
    background: rgba(37, 99, 235, 0.04);
}
.label-designer-panel .ld-add-btn {
    border-radius: var(--radius-sm);
    background: #f8fafc;
}
.label-designer-panel .ld-add-btn:hover {
    border-color: var(--primary-color);
    background: #eff6ff;
    color: var(--primary-color);
}
.label-designer-panel .ld-add-btn i {
    color: inherit;
}
.label-designer-panel .ld-chip:hover {
    border-color: var(--primary-color);
    background: #eff6ff;
    color: var(--primary-color);
}
.label-designer-panel .ld-properties {
    background: transparent;
    border: none;
    padding: 0;
    border-radius: 0;
}
.label-designer-panel .ld-properties label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 0;
}
.label-designer-panel .ld-zpl-details {
    margin-top: 0;
    padding: 14px 16px;
}
.label-designer-panel .ld-zpl-details textarea,
.label-designer-panel #zpl-output-textarea {
    height: 220px;
    min-height: 160px;
    background: #0f172a;
    border: 1px solid #334155;
    color: #e2e8f0;
}
@media (max-width: 1280px) {
    .label-designer-panel .ld-workspace-v3 {
        grid-template-columns: 220px 1fr;
    }
    .label-designer-panel .ld-tools-panel {
        grid-column: 1 / -1;
        min-height: auto;
    }
}
@media (max-width: 900px) {
    .label-designer-panel .ld-workspace-v3 {
        grid-template-columns: 1fr;
    }
    .label-designer-panel .ld-stage-scroll {
        min-height: 420px;
        max-height: 520px;
    }
}

/* ═══════════════════ BATCH QUEUE PAGE ═══════════════════ */

.bq-section-heading {
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin: 24px 0 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.bq-section-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.bq-status-dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}
.bq-dot-active  { background: #10b981; box-shadow: 0 0 0 3px rgba(16,185,129,.2); }
.bq-dot-paused  { background: #f59e0b; box-shadow: 0 0 0 3px rgba(245,158,11,.2); }
.bq-dot-pending { background: #94a3b8; }
.bq-active-card {
    background: #fff;
    border: 2px solid #10b981;
    border-radius: 20px;
    padding: 24px;
    box-shadow: 0 4px 24px rgba(16,185,129,.10);
    margin-bottom: 8px;
}
.bq-card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    flex-wrap: wrap;
}
.bq-card-info h2 { font-size: 1.35rem; font-weight: 700; margin: 6px 0 8px; }
.bq-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 20px;
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-bottom: 12px;
}
.bq-card-meta span strong { color: var(--text-primary); }
.bq-card-actions { display: flex; flex-direction: column; gap: 8px; min-width: 130px; }
.bq-scorecard-wrap { margin-top: 12px; }
.bq-card-list { display: flex; flex-direction: column; gap: 10px; }
.bq-batch-card {
    background: #fff;
    border: 1.5px solid var(--glass-border);
    border-radius: 16px;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    transition: box-shadow 0.15s;
}
.bq-batch-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,.07); }
.bq-batch-card.bq-card-paused  { border-color: #f59e0b; }
.bq-batch-card.bq-card-pending { border-color: #cbd5e1; }
.bq-batch-card-drag { cursor: grab; color: #94a3b8; padding: 0 8px; font-size: 1rem; flex-shrink: 0; }
.bq-batch-card-drag:active { cursor: grabbing; }
.bq-batch-card-body { flex: 1; min-width: 0; }
.bq-batch-card-body h4 { font-size: 0.95rem; font-weight: 700; margin: 0 0 4px; }
.bq-batch-card-body .bq-card-sub { font-size: 0.78rem; color: var(--text-muted); display: flex; gap: 12px; flex-wrap: wrap; }
.bq-batch-card-actions { display: flex; gap: 8px; flex-shrink: 0; flex-wrap: wrap; }
.bq-queue-pos {
    width: 28px; height: 28px; border-radius: 50%;
    background: #f1f5f9; color: #64748b;
    font-size: 0.75rem; font-weight: 700;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.bq-empty-state { text-align: center; padding: 60px 24px; color: var(--text-muted); }
.bq-empty-state i { font-size: 3rem; margin-bottom: 16px; opacity: 0.3; display: block; }
.bq-empty-state p { font-size: 0.9rem; }
.bq-sortable .bq-batch-card.drag-over { border-style: dashed; background: #f8fafc; }
.radio-group { display: flex; gap: 20px; flex-wrap: wrap; margin-top: 6px; }
.radio-option { display: flex; align-items: center; gap: 6px; font-size: 0.88rem; cursor: pointer; font-weight: 500; }
.badge-defective  { background: #fee2e2; color: #dc2626; }
.badge-incomplete { background: #fef3c7; color: #d97706; }
.badge-pending    { background: #e0e7ff; color: #4338ca; }
.badge-paused     { background: #fef3c7; color: #92400e; }
.badge-cancelled  { background: #f1f5f9; color: #64748b; }


/* ═══════════════════════════════════════════════════════════════════════════
   SaaS control plane — matches Trace production theme tokens
   ═══════════════════════════════════════════════════════════════════════════ */

.nav-section-label {
    list-style: none;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #94a3b8;
    padding: 16px 12px 6px;
    pointer-events: none;
    cursor: default;
    margin-top: 4px;
}
.nav-section-label:first-child { margin-top: 0; padding-top: 4px; }

.user-details {
    min-width: 0;
    flex: 1;
}
.user-details h4 {
    font-size: 0.8125rem;
    font-weight: 700;
    line-height: 1.25;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 150px;
}
.user-details .badge {
    margin-top: 4px;
    font-size: 0.625rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: none;
    padding: 2px 7px;
    border-radius: 999px;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.badge-platform {
    background: rgba(37, 99, 235, 0.12);
    color: var(--primary-color);
}
.badge-owner {
    background: rgba(15, 23, 42, 0.08);
    color: #334155;
}
.tenant-chip {
    display: block;
    margin-top: 6px;
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 550;
    line-height: 1.3;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Impersonation banner */
.impersonation-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    background: linear-gradient(90deg, #fff7ed 0%, #ffedd5 100%);
    border: 1px solid #fdba74;
    border-radius: var(--radius-md);
    color: #9a3412;
    padding: 10px 16px;
    margin-bottom: 14px;
    font-size: 0.8125rem;
    font-weight: 500;
    box-shadow: 0 1px 2px rgba(154, 52, 18, 0.06);
}
.impersonation-banner[hidden] { display: none !important; }
.impersonation-banner > span {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}
.impersonation-banner > span i {
    color: #c2410c;
    flex-shrink: 0;
}
.impersonation-banner strong {
    font-weight: 700;
    color: #7c2d12;
}
.impersonation-banner .btn-exit-tenant {
    flex-shrink: 0;
    background: #fff;
    border: 1px solid #ea580c;
    color: #9a3412;
    font-weight: 700;
    border-radius: 8px;
    padding: 7px 14px;
    font-size: 0.75rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 1px 2px rgba(154, 52, 18, 0.08);
    transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.impersonation-banner .btn-exit-tenant:hover {
    background: #fff7ed;
    border-color: #c2410c;
    box-shadow: 0 2px 6px rgba(154, 52, 18, 0.12);
}

.nav-hidden { display: none !important; }

/* Marketplace / plan cards */
.saas-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}
.saas-card {
    background: var(--panel-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--glass-shadow);
    display: flex;
    flex-direction: column;
    min-height: 200px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.saas-card:hover {
    border-color: rgba(37, 99, 235, 0.25);
    box-shadow: 0 12px 28px -8px rgba(15, 23, 42, 0.1);
}
.saas-card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 8px;
}
.saas-card h4 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-main);
}
.saas-card .panel-hint {
    flex: 1;
    margin: 0 0 10px;
    font-size: 0.8125rem;
    line-height: 1.45;
    color: var(--text-muted);
}
.saas-card-price {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--text-main);
    margin: 4px 0 10px;
}
.saas-card-price small {
    font-size: 0.75rem;
    font-weight: 550;
    color: var(--text-muted);
    margin-left: 2px;
}
.saas-card-meta {
    list-style: none;
    padding: 0;
    margin: 0 0 14px;
    font-size: 0.8rem;
    color: var(--text-muted);
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
}
.saas-card-meta li::before {
    content: "";
    display: inline-block;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #cbd5e1;
    margin-right: 6px;
    vertical-align: middle;
}
.saas-card-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: auto;
    padding-top: 4px;
}
.saas-status {
    font-size: 0.65rem;
    font-weight: 750;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 3px 8px;
    border-radius: 999px;
    background: #f1f5f9;
    color: #64748b;
    white-space: nowrap;
}
.saas-status.is-ok,
.saas-status.is-enabled,
.saas-status.is-configured {
    background: rgba(21, 128, 61, 0.12);
    color: var(--success-color);
}
.saas-status.is-unconfigured {
    background: #f1f5f9;
    color: #64748b;
}
.saas-status.is-error {
    background: rgba(185, 28, 28, 0.1);
    color: var(--error-color);
}

/* Platform tenants console */
.platform-console-hero {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}
.platform-console-hero h2 {
    font-size: 1.25rem;
    font-weight: 750;
    letter-spacing: -0.03em;
    margin: 0 0 4px;
}
.platform-console-hero p {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.875rem;
}
.platform-tenants-wrap {
    background: #fff;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--glass-shadow);
    overflow: hidden;
}
.platform-tenants-wrap .table-container {
    box-shadow: none;
    border: none;
    margin: 0;
    border-radius: 0;
}
#platform-tenants-table {
    width: 100%;
    border-collapse: collapse;
}
#platform-tenants-table thead th {
    background: #f8fafc;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #64748b;
    padding: 12px 16px;
    border-bottom: 1px solid var(--glass-border);
    text-align: left;
    white-space: nowrap;
}
#platform-tenants-table tbody td {
    padding: 14px 16px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
    font-size: 0.875rem;
}
#platform-tenants-table tbody tr:last-child td { border-bottom: none; }
#platform-tenants-table tbody tr:hover { background: #f8fafc; }
.tenant-name-cell {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.tenant-name-cell strong {
    font-weight: 650;
    color: var(--text-main);
}
.tenant-name-cell code {
    font-size: 0.72rem;
    color: #94a3b8;
    background: transparent;
    padding: 0;
}
.plan-pill {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    background: rgba(37, 99, 235, 0.1);
    color: var(--primary-color);
    text-transform: capitalize;
}
.plan-pill.is-free {
    background: #f1f5f9;
    color: #64748b;
}
.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
}
.status-pill::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}
.status-pill.is-active {
    background: rgba(21, 128, 61, 0.1);
    color: var(--success-color);
}
.status-pill.is-suspended {
    background: rgba(185, 28, 28, 0.1);
    color: var(--error-color);
}
.tenant-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}
.tenant-actions .btn {
    font-size: 0.75rem;
    font-weight: 650;
    padding: 7px 12px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.muted-date {
    color: var(--text-muted);
    font-size: 0.8rem;
    white-space: nowrap;
}

.login-signup-link {
    text-align: center;
    margin-top: 18px;
    font-size: 0.875rem;
    color: var(--text-muted);
}
.login-signup-link a {
    color: var(--primary-color);
    font-weight: 650;
    text-decoration: none;
}
.login-signup-link a:hover { text-decoration: underline; }

/* Integration modal field spacing */
#integration-modal .modal-box {
    max-width: 520px;
}
#integration-fields .input-group { margin-bottom: 14px; text-align: left; }
#integration-fields .input-group label {
    display: block;
    text-align: left;
    margin-bottom: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
}
#integration-fields input {
    width: 100%;
}

.billing-gateway-banner {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    border-radius: var(--radius-md);
    margin-bottom: 16px;
    font-size: 0.8125rem;
    line-height: 1.45;
}
.billing-gateway-banner[hidden] { display: none !important; }
.billing-gateway-banner.is-info {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1e3a8a;
}
.billing-gateway-banner i { margin-top: 2px; color: var(--primary-color); }

.saas-card.is-current-plan {
    border-color: rgba(37, 99, 235, 0.35);
    box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.12), var(--glass-shadow);
}

.integration-card .saas-card-top {
    align-items: flex-start;
}
.integration-identity {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    min-width: 0;
    flex: 1;
}
.integration-identity h4 {
    margin: 0 0 2px;
}
.integration-logo {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1.25rem;
    background: #f1f5f9;
    color: #334155;
}
.integration-logo.brand-whatsapp { background: #ecfdf5; color: #16a34a; }
.integration-logo.brand-zoho { background: #fff7ed; color: #ea580c; }
.integration-logo.brand-tally { background: #eff6ff; color: #2563eb; }
.integration-logo.brand-email { background: #fef2f2; color: #dc2626; }
.integration-logo.brand-sms { background: #f5f3ff; color: #7c3aed; }
.integration-logo.brand-telegram { background: #eff6ff; color: #0284c7; }
.integration-logo.brand-delhivery { background: #ecfeff; color: #0e7490; }
.integration-logo.brand-shiprocket { background: #fff1f2; color: #e11d48; }
.integration-logo.brand-razorpay { background: #eef2ff; color: #4338ca; }
.integration-logo.brand-labels { background: rgba(37, 99, 235, 0.1); color: var(--primary-color); }
.integration-logo.brand-apikeys { background: #fef3c7; color: #b45309; }
.integration-logo.brand-webhooks { background: #ecfeff; color: #0e7490; }
.integration-card.is-builtin {
    border-style: dashed;
}
.integration-field-group {
    margin: 12px 0 8px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #94a3b8;
}
#integration-fields .panel-hint {
    display: block;
    margin-top: 4px;
    font-size: 0.72rem;
}

@media (max-width: 900px) {
    .platform-console-hero { flex-direction: column; }
    .saas-card-grid { grid-template-columns: 1fr; }
}
