/* Global reset – remove whitespace around app */
html, body {
    margin: 0;
    padding: 0;
    min-height: 100%;
}
body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

h1:focus {
    outline: none;
}

/* Blazor error UI – hidden until an error occurs (framework adds .show) */
#blazor-error-ui {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 0.75rem 1.5rem;
    background: #b91c1c;
    color: #fff;
    font-size: 0.9rem;
    z-index: 9999;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.2);
}
#blazor-error-ui.show {
    display: flex;
    align-items: center;
    gap: 1rem;
}
#blazor-error-ui .reload, #blazor-error-ui .dismiss {
    color: #fff;
    text-decoration: underline;
    cursor: pointer;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid #e50000;
}

.validation-message {
    color: #e50000;
}
.validation-success {
    color: #065f46;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

.darker-border-checkbox.form-check-input {
    border-color: #929292;
}

/* Login page – full-bleed background, card, reordered form */
.login-wrap {
    min-height: 100vh;
    background: linear-gradient(135deg, #1e3a5f 0%, #2d5a87 50%, #1e3a5f 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}
.login-page {
    width: 100%;
    max-width: 400px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25);
    padding: 2.5rem;
    text-align: center;
}
.login-page h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 0.25rem 0;
    letter-spacing: -0.02em;
}
.login-page .lead {
    margin-bottom: 1.5rem;
    color: #64748b;
    font-size: 0.95rem;
}
.login-form { text-align: left; margin-bottom: 1.5rem; }
.login-form .form-group { margin-bottom: 1rem; }
.login-form label {
    display: block;
    margin-bottom: 0.35rem;
    font-weight: 600;
    font-size: 0.875rem;
    color: #374151;
}
.login-form .form-control {
    width: 100%;
    padding: 0.65rem 0.9rem;
    font-size: 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #f8fafc;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.login-form .form-control:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}
.login-form .btn-primary {
    width: 100%;
    margin-top: 0.25rem;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    background: linear-gradient(180deg, #2563eb 0%, #1d4ed8 100%);
    color: #fff;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.35);
}
.login-form .btn-primary:hover {
    background: linear-gradient(180deg, #1d4ed8 0%, #1e40af 100%);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
}

.login-divider {
    font-size: 0.8rem;
    color: #94a3b8;
    margin: 1.25rem 0;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.database-options { display: flex; flex-direction: column; gap: 0.75rem; }
.db-option {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.9rem 1.25rem;
    font-size: 1rem;
    text-align: left;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    background: #f8fafc;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    transition: border-color 0.2s, background 0.2s;
}
.db-option:hover {
    border-color: #2563eb;
    background: #eff6ff;
}
.db-option.selected {
    border-color: #2563eb;
    background: #dbeafe;
    font-weight: 500;
}
.db-icon { font-size: 1.5rem; }
.db-name { font-weight: 600; flex: 1; color: #1e293b; }
.db-desc { font-size: 0.8rem; color: #64748b; }
.db-current { margin-top: 0.75rem; font-size: 0.85rem; color: #64748b; }
.db-current strong { color: #1e293b; }
.login-form .validation-message { margin-bottom: 0.75rem; }

/* Layout nav */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.5rem;
    border-bottom: 1px solid #dee2e6;
    background: #f8f9fa;
}
.app-nav {
    display: flex;
    gap: 1rem;
    align-items: center;
}
.app-nav a {
    color: #0d6efd;
    text-decoration: none;
}
.app-nav a:hover { text-decoration: underline; }
.db-badge {
    font-size: 0.875rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    background: #e9ecef;
    color: #495057;
}
.app-body { padding: 1.5rem; }

/* Tables */
.table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}
.table th, .table td {
    padding: 0.5rem 0.75rem;
    border: 1px solid #dee2e6;
    text-align: left;
}
.table th { background: #f8f9fa; font-weight: 600; }
.table tbody tr:hover { background: #f8f9fa; }

/* App shell – full bleed, no margin */
.app-shell {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    margin: 0;
    padding: 0;
}
.topbar {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0 1.25rem;
    height: 56px;
    background: linear-gradient(90deg, #1e3a5f 0%, #2563eb 100%);
    color: #fff;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.topbar-menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    color: #fff;
    cursor: pointer;
    border-radius: 6px;
}
.topbar-menu-btn:hover { background: rgba(255,255,255,0.15); }
.topbar-menu-icon {
    width: 20px;
    height: 2px;
    background: currentColor;
    box-shadow: 0 -6px 0 currentColor, 0 6px 0 currentColor;
}
.topbar-brand { display: flex; align-items: center; gap: 0.75rem; flex: 1; }
.topbar-title { font-weight: 700; font-size: 1.2rem; letter-spacing: -0.02em; }
.topbar-db {
    font-size: 0.75rem;
    padding: 0.2rem 0.5rem;
    background: rgba(255,255,255,0.2);
    border-radius: 6px;
    font-weight: 500;
}
.topbar-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.topbar-user-wrap {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    line-height: 1.25;
}
.topbar-user { font-weight: 600; font-size: 0.95rem; }
.topbar-role { font-size: 0.75rem; opacity: 0.9; }
.topbar-logout {
    color: #fff;
    text-decoration: none;
    padding: 0.4rem 0.9rem;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    border: 1px solid rgba(255,255,255,0.4);
    transition: background 0.2s;
}
.topbar-logout:hover { background: rgba(255,255,255,0.2); }

.sidebar {
    position: fixed;
    left: 0;
    top: 56px;
    bottom: 0;
    width: 260px;
    background: #fff;
    border-right: 1px solid #e2e8f0;
    overflow-y: auto;
    transition: transform 0.2s ease, width 0.2s ease;
    z-index: 100;
    box-shadow: 2px 0 12px rgba(0,0,0,0.04);
}
.sidebar.collapsed {
    transform: translateX(-260px);
}
.sidebar-nav { padding: 0.75rem 0; }
.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 1rem;
    color: #475569;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: background 0.15s, color 0.15s;
}
.sidebar-link:hover { background: #f1f5f9; color: #1e3a5f; }
.sidebar-link.active { background: #dbeafe; color: #1d4ed8; }
.sidebar-link .sidebar-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    opacity: 0.85;
}
.sidebar-section {
    padding: 0.75rem 1rem 0.25rem;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6b7280;
}
.main-content {
    flex: 1;
    margin-left: 260px;
    margin-top: 56px;
    padding: 1.75rem;
    min-height: calc(100vh - 56px);
    background: #f1f5f9;
    transition: margin-left 0.2s ease;
}
.sidebar.collapsed ~ .main-content { margin-left: 0; }

@media (max-width: 768px) {
    .sidebar { transform: translateX(-240px); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
}

/* Dashboard (staff home) – MIS-style widgets */
.dashboard { max-width: min(100%, 1680px); }
.dashboard-title {
    font-size: 1.875rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 0.35rem;
    letter-spacing: -0.02em;
}
.dashboard-welcome {
    color: #64748b;
    font-size: 1rem;
    margin-bottom: 1.75rem;
}
/* Dashboard: top row = Orders | Customers | Recent (Recent is 2× width of each neighbour: 1fr 1fr 2fr) */
.dashboard-stack {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}
.dashboard-row-top-three {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 2fr);
    gap: 1.25rem;
    align-items: stretch;
}
@media (max-width: 1200px) {
    .dashboard-row-top-three {
        grid-template-columns: 1fr;
    }
}
.dashboard-widget-recent-wide .widget-body {
    padding-left: 1.25rem;
    padding-right: 1.25rem;
}
.dashboard-grid-wide { width: 100%; }
.widget {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    border: 1px solid #e2e8f0;
    overflow: hidden;
}
.widget-title {
    font-size: 1rem;
    font-weight: 600;
    color: #374151;
    margin: 0;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.widget-body { padding: 1.25rem; }
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 0.75rem;
}
/* Dashboard: orders this month — stacked summary lines */
.kpi-rows {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.kpi-row {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.75rem 1.5rem;
}
.kpi-row-primary .kpi-big-value {
    font-size: 2rem;
    font-weight: 800;
    color: #1e293b;
    line-height: 1.1;
}
.kpi-row-primary .kpi-big-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.kpi-inline-group {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem 2rem;
}
.kpi-inline-item .kpi-value { font-size: 1.25rem; }
.kpi-inline-item.highlight .kpi-value { color: #1d4ed8; }
.kpi-inline-item.warning .kpi-value { color: #b45309; }
.kpi-card {
    background: #f8fafc;
    border-radius: 10px;
    padding: 0.75rem 1rem;
    border: 1px solid #e2e8f0;
    text-align: center;
}
.kpi-value {
    font-size: 1.35rem;
    font-weight: 700;
    color: #1e293b;
    line-height: 1.2;
}
.kpi-label {
    font-size: 0.75rem;
    color: #64748b;
    margin-top: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}
.kpi-card.highlight .kpi-value { color: #1d4ed8; }
.kpi-card.warning .kpi-value { color: #b45309; }
.chart-30d-with-axis {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    gap: 0.5rem;
    width: 100%;
}
.chart-y-axis {
    flex: 0 0 3.75rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    font-size: 0.65rem;
    color: #64748b;
    text-align: right;
    line-height: 1.2;
    padding-top: 0.35rem;
    padding-bottom: 1.35rem;
}
.chart-y-axis span { white-space: nowrap; }
.chart-30d {
    display: flex;
    align-items: stretch;
    gap: 4px;
    flex: 1;
    min-width: 0;
    height: 220px;
    padding: 0.5rem 0;
}
.chart-bar-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
}
.chart-bar-area {
    flex: 1;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    min-height: 0;
}
.chart-bar {
    width: 100%;
    max-width: 24px;
    min-height: 0;
    flex-shrink: 0;
    box-sizing: border-box;
    background: linear-gradient(180deg, #3b82f6 0%, #2563eb 100%);
    border-radius: 4px 4px 0 0;
    transition: opacity 0.2s;
}
.chart-bar-wrap:hover .chart-bar { opacity: 0.85; }
.chart-bar-label {
    font-size: 0.65rem;
    color: #64748b;
    margin-top: 0.35rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}
.dashboard-pie-wrap {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}
.dashboard-pie-circle {
    width: 160px;
    height: 160px;
    border-radius: 50%;
    flex-shrink: 0;
}
.dashboard-pie-legend {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
    min-width: 140px;
}
.dashboard-pie-legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}
.dashboard-pie-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}
.recent-orders-list { list-style: none; margin: 0; padding: 0; }
.recent-orders-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid #f1f5f9;
    font-size: 0.9rem;
}
.recent-orders-list li:last-child { border-bottom: none; }
.recent-orders-list a { color: #2563eb; text-decoration: none; font-weight: 500; }
.recent-orders-list a:hover { text-decoration: underline; }
.recent-orders-list .recent-order-price { color: #475569; font-weight: 600; }
.recent-orders-list .recent-order-date { color: #94a3b8; font-size: 0.8rem; }
.recent-orders-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    table-layout: fixed;
}
.recent-orders-table thead th {
    text-align: left;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #64748b;
    padding: 0.35rem 0.75rem 0.5rem 0;
    border-bottom: 1px solid #e2e8f0;
}
.recent-orders-table thead th.col-price,
.recent-orders-table thead th.col-date,
.recent-orders-table thead th.col-released { text-align: right; }
.recent-orders-table thead th.col-date { text-align: center; }
.recent-orders-table tbody td {
    padding: 0.5rem 0.75rem 0.5rem 0;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}
.recent-orders-table thead th.col-customer { padding-right: 1rem; }
.recent-orders-table tbody tr:last-child td { border-bottom: none; }
.recent-orders-table .col-customer {
    width: auto;
    min-width: 0;
    overflow: hidden;
    padding-right: 1rem;
}
.recent-orders-table .col-customer a {
    display: block;
    color: #2563eb;
    text-decoration: none;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.recent-orders-table .col-customer a:hover { text-decoration: underline; }
.recent-orders-table .col-price {
    width: 9rem;
    text-align: right;
    font-weight: 600;
    color: #475569;
    white-space: nowrap;
}
.recent-orders-table .col-date {
    width: 6.5rem;
    text-align: center;
    color: #64748b;
    white-space: nowrap;
}
.recent-orders-table .col-released {
    width: 5.5rem;
    text-align: right;
    font-size: 0.85rem;
    color: #475569;
    white-space: nowrap;
}
.dashboard-widget-recent-wide .data-wrap {
    min-width: 0;
}
.dashboard-widget-recent-wide .data-wrap .recent-orders-table {
    min-width: 0;
}
.widget-footer {
    padding: 0.75rem 1.25rem;
    border-top: 1px solid #e2e8f0;
    background: #f8fafc;
}
.widget-footer a { color: #2563eb; font-size: 0.9rem; font-weight: 500; text-decoration: none; }
.widget-footer a:hover { text-decoration: underline; }
.dashboard-cards { display: flex; flex-wrap: wrap; gap: 1rem; margin-top: 1.5rem; }
.dashboard-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    text-decoration: none;
    color: #334155;
    min-width: 160px;
    border: 1px solid #e2e8f0;
    transition: box-shadow 0.2s, border-color 0.2s, transform 0.15s;
}
.dashboard-card:hover {
    box-shadow: 0 8px 24px rgba(0,0,0,0.1);
    border-color: #c7d2fe;
    color: #1e40af;
    transform: translateY(-2px);
}
.dashboard-card-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #eff6ff;
    border-radius: 10px;
    font-size: 1.25rem;
}
.dashboard-card-label { font-weight: 600; font-size: 1rem; }

/* Customer home (placeholder) */
.customer-home { max-width: 800px; }
.customer-home-title { font-size: 1.75rem; color: #1e293b; margin-bottom: 0.5rem; }
.customer-home-intro { color: #64748b; margin-bottom: 2rem; }
.customer-home-section {
    background: #fff;
    border-radius: 10px;
    padding: 1.25rem 1.5rem;
    margin-bottom: 1rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.customer-home-section h2 { font-size: 1.1rem; color: #374151; margin-bottom: 0.5rem; }
.placeholder-text { color: #6b7280; font-size: 0.95rem; }

.placeholder-page { max-width: 600px; }
.placeholder-page h1 { font-size: 1.5rem; color: #1e293b; margin-bottom: 0.5rem; }
.placeholder-page-text { color: #64748b; }

/* ----- Responsive page layout (forms/screens, iPad & mobile friendly) ----- */
.page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}
.page-title { font-size: 1.5rem; font-weight: 700; color: #1e293b; margin: 0; }
.page-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }

/* Form grid: 2 cols desktop, 1 col tablet/mobile */
.form-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    border: 1px solid #e2e8f0;
    padding: 1.25rem;
    margin-bottom: 1.25rem;
}
.form-card h2 { font-size: 1.1rem; color: #374151; margin: 0 0 1rem 0; padding-bottom: 0.5rem; border-bottom: 1px solid #e2e8f0; }
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem 1.5rem;
}
.form-grid.one {
    grid-template-columns: 1fr;
}
@media (max-width: 768px) {
    .form-grid { grid-template-columns: 1fr; }
}
.form-group { margin-bottom: 0; }
.form-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: #475569;
    margin-bottom: 0.25rem;
}
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-size: 0.95rem;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #fff;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}
.form-group textarea { min-height: 80px; resize: vertical; }
.stat-value { font-size: 1.1rem; font-weight: 700; color: #111827; }
.form-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.5rem 1rem; font-size: 0.9rem; font-weight: 500; border-radius: 8px; cursor: pointer; text-decoration: none; border: none; transition: background 0.15s, color 0.15s; }
.btn-primary { background: #2563eb; color: #fff; }
.btn-primary:hover { background: #1d4ed8; }
.btn-secondary { background: #e2e8f0; color: #475569; }
.btn-secondary:hover { background: #cbd5e1; }
.btn-success { background: #059669; color: #fff; }
.btn-success:hover { background: #047857; }
.btn-danger { background: #dc2626; color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-outline { background: transparent; border: 1px solid #cbd5e1; color: #475569; }
.btn-outline:hover { background: #f1f5f9; }
.btn-sm { padding: 0.25rem 0.5rem; font-size: 0.8rem; }

/* Data table responsive: horizontal scroll on small screens */
.data-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.data-wrap .table { margin-bottom: 0; min-width: 600px; }
@media (max-width: 640px) {
    .data-wrap .table { font-size: 0.875rem; }
    .data-wrap .table th, .data-wrap .table td { padding: 0.4rem 0.5rem; }
}
.table-row-link { text-decoration: none; color: inherit; }
.table-row-link:hover { background: #dbeafe !important; }
.table-row-link td { cursor: pointer; }
.table-row-link.selected,
.table tbody tr.selected { background: #bae6fd !important; }

/* Inventory tabs (Box1–Box5) */
.inventory-tabs { display: flex; flex-wrap: wrap; gap: 0.25rem; margin-bottom: 1rem; border-bottom: 1px solid #e2e8f0; }
.inventory-tab { padding: 0.5rem 0.75rem; border: 1px solid #e2e8f0; border-bottom: none; background: #f8fafc; border-radius: 8px 8px 0 0; cursor: pointer; font-size: 0.9rem; }
.inventory-tab:hover { background: #f1f5f9; }
.inventory-tab.active { background: #fff; font-weight: 600; margin-bottom: -1px; padding-bottom: calc(0.5rem + 1px); border-color: #cbd5e1; }
.customer-tabs { display: flex; flex-wrap: wrap; gap: 0.25rem; margin-bottom: 1rem; border-bottom: 1px solid #e2e8f0; }
.customer-tab { padding: 0.5rem 0.75rem; border: 1px solid #e2e8f0; border-bottom: none; background: #f8fafc; border-radius: 8px 8px 0 0; cursor: pointer; font-size: 0.9rem; }
.customer-tab:hover { background: #f1f5f9; }
.customer-tab.active { background: #fff; font-weight: 600; margin-bottom: -1px; padding-bottom: calc(0.5rem + 1px); border-color: #cbd5e1; }

/* Customer pricing tab: boxes of checkboxes (min column width +50% vs original 200px) */
.pricing-boxes { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.pricing-box { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 8px; padding: 0.75rem; min-width: 0; overflow: hidden; }
.pricing-box-title { margin: 0 0 0.5rem 0; font-size: 0.95rem; color: #475569; }
.pricing-box-checkboxes { display: flex; flex-direction: column; gap: 0.25rem; flex-wrap: wrap; max-height: 280px; min-width: 0; }
.pricing-checkbox-label { display: flex; align-items: flex-start; gap: 0.35rem; font-size: 0.875rem; cursor: pointer; line-height: 1.35; min-width: 0; overflow-wrap: anywhere; word-break: break-word; }
.pricing-checkbox-label input { flex-shrink: 0; margin-top: 0.2rem; }
.copy-pricing-section .search-wrap { max-width: 400px; }

/* Sortable column headers */
.sort-header { background: none; border: none; padding: 0.25rem 0.5rem; cursor: pointer; font-weight: inherit; font-size: inherit; color: inherit; display: inline-flex; align-items: center; gap: 0.25rem; }
.sort-header:hover { text-decoration: underline; }
.sort-header.active { font-weight: 600; }

/* Modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.4); display: flex; align-items: center; justify-content: center; z-index: 1000; padding: 1rem; }
.modal-dialog { background: #fff; border-radius: 12px; max-width: 560px; width: 100%; max-height: 90vh; display: flex; flex-direction: column; box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25); }
.modal-dialog-sm { max-width: 360px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.25rem; border-bottom: 1px solid #e2e8f0; }
.modal-header h3 { margin: 0; font-size: 1.25rem; }
.modal-close { background: none; border: none; font-size: 1.5rem; cursor: pointer; line-height: 1; color: #64748b; padding: 0 0.25rem; }
.modal-close:hover { color: #1e293b; }
.modal-body { padding: 1.25rem; overflow-y: auto; flex: 1; }
.modal-footer { display: flex; gap: 0.5rem; padding: 1rem 1.25rem; border-top: 1px solid #e2e8f0; }
.modal-image-wrap { margin-top: 1rem; }
.modal-order-image { max-width: 200px; max-height: 200px; border-radius: 8px; border: 1px solid #e2e8f0; }

.orders-actions-cell { white-space: nowrap; }
.orders-actions-cell .btn { margin: 0 0.1rem; }

.input-with-button { display: flex; gap: 0.5rem; align-items: center; }
.input-with-button .form-control { flex: 1; min-width: 0; }
.text-muted { color: #64748b; font-size: 0.9rem; }
.mb-2 { margin-bottom: 0.5rem; }

/* List toolbar (search + page size) */
.list-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.search-wrap { display: flex; gap: 0.5rem; flex: 1; min-width: 200px; }
.search-wrap .search-input { max-width: 320px; }
.page-size-wrap { display: flex; align-items: center; gap: 0.5rem; }
.page-size-wrap .page-size-select { width: auto; }
.pagination-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem; margin-top: 1rem; padding-top: 0.75rem; border-top: 1px solid #e2e8f0; }
.pagination-info { color: #64748b; font-size: 0.9rem; }
.pagination-buttons { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.pagination-page { font-size: 0.9rem; margin: 0 0.25rem; }

/* Detail view: label-value rows */
.detail-list { background: #fff; border-radius: 12px; border: 1px solid #e2e8f0; overflow: hidden; }
.detail-row { display: grid; grid-template-columns: 140px 1fr; gap: 0.5rem; padding: 0.6rem 1rem; border-bottom: 1px solid #f1f5f9; }
.detail-row:last-child { border-bottom: none; }
.detail-label { font-weight: 600; color: #64748b; font-size: 0.85rem; }
.detail-value { color: #1e293b; }
@media (max-width: 480px) {
    .detail-row { grid-template-columns: 1fr; }
}
.mt-2 { margin-top: 0.5rem; }

/* ----- Order edit (POS ticket) ----- */
.order-edit-wrap.order-edit-new .page-title { color: #047857; }
.order-edit-wrap.order-edit-edit .page-title { color: #1e40af; }
.order-edit-layout {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 1.25rem;
    align-items: start;
}
@media (max-width: 1100px) {
    .order-edit-layout { grid-template-columns: 1fr; }
}
.order-customer-card .order-customer-summary {
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    font-size: 0.9rem;
}
.invoice-type-badge {
    font-size: 0.75rem;
    padding: 0.1rem 0.4rem;
    background: #e0e7ff;
    border-radius: 4px;
}
.order-service-tabs { margin-bottom: 0.5rem; }
.order-service-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.35rem 0.75rem;
    align-items: start;
}
.order-service-item {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.9rem;
    cursor: pointer;
}
.order-service-item .order-qty { width: 4rem; padding: 0.2rem 0.4rem; font-size: 0.85rem; }
.form-control.price-auto { background: #ecfdf5; border-color: #6ee7b7; }
.barcode-row { display: flex; gap: 0.5rem; align-items: center; }
.barcode-row .form-control { flex: 1; }
.barcode-visual { margin: 0.75rem 0; overflow: auto; }
.barcode-svg { max-width: 100%; height: auto; }
.order-video {
    width: 100%;
    max-height: 200px;
    background: #0f172a;
    border-radius: 8px;
    margin: 0.5rem 0;
}
.order-drop-zone {
    min-height: 160px;
    border: 2px dashed #cbd5e1;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    background: #fafafa;
}
.order-preview-img {
    max-width: 100%;
    max-height: 200px;
    object-fit: contain;
    border-radius: 6px;
}
.camera-toolbar { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-bottom: 0.25rem; }

.ring-size-panel { margin-bottom: 1rem; }
.ring-size-select {
    max-height: 140px;
    font-size: 0.85rem;
}

.ticket-print {
    display: none;
}
/* WinForms frmOrders: ticket frame DrawRectangle(..., 98mm x 145mm) in millimetres — match thermal ticket size. */
@media print {
    @page {
        size: 98mm 145mm;
        margin: 0;
    }
    html, body {
        height: auto !important;
        margin: 0 !important;
        padding: 0 !important;
        background: #fff !important;
    }
    /* Do NOT use visibility:hidden on body* — hidden blocks still consume height and print many blank pages. */
    .topbar,
    .sidebar,
    .order-edit-wrap > .no-print,
    .order-edit-wrap > .order-edit-layout,
    #blazor-error-ui {
        display: none !important;
    }
    .app-shell {
        display: block !important;
        min-height: 0 !important;
    }
    .main-content {
        display: block !important;
        min-height: 0 !important;
        padding: 0 !important;
        margin: 0 !important;
    }
    .order-edit-wrap {
        padding: 0 !important;
        margin: 0 !important;
    }
    .ticket-print {
        display: block !important;
        position: static !important;
        box-sizing: border-box;
        width: 98mm;
        max-width: 98mm;
        margin: 0 auto;
        padding: 2mm;
        font-family: 'Courier New', Consolas, monospace;
        font-size: 10pt;
        line-height: 1.2;
        color: #000;
        background: #fff;
    }
    .ticket-inner {
        box-sizing: border-box;
        border: 0.3mm solid #000;
        padding: 2mm;
        min-height: 0;
        width: 100%;
        position: relative;
        overflow: hidden;
    }
    .ticket-invoice .ticket-logo {
        display: block;
        float: right;
        width: 20mm;
        height: auto;
        margin: 0 0 1.5mm 2mm;
    }
    .ticket-cash .ticket-logo { display: none !important; }
    .ticket-date { font-size: 9pt; font-weight: bold; margin-bottom: 1.5mm; clear: left; }
    .ticket-comments { font-size: 9pt; margin-bottom: 1.5mm; }
    .ticket-customer { font-size: 11pt; font-weight: bold; margin-bottom: 1.5mm; }
    .ticket-desc {
        border: 0.25mm solid #000;
        padding: 1.5mm;
        min-height: 32mm;
        margin: 1.5mm 0;
        font-weight: bold;
        white-space: pre-wrap;
        font-size: 9pt;
    }
    .ticket-photo {
        display: block;
        max-width: 52mm;
        max-height: 46mm;
        margin: 1.5mm auto;
        object-fit: contain;
    }
    .ticket-total { font-weight: bold; margin-top: 1.5mm; text-align: right; font-size: 9pt; }
    .ticket-footer { font-weight: bold; margin-top: 1mm; font-size: 10pt; }
    .ticket-footer.small { font-size: 8pt; }
    .ticket-print .barcode-svg {
        display: block;
        max-width: 100%;
        height: auto;
    }
}

/* ----- View/Print invoices ----- */
.view-invoice-card .invoice-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: end;
}
.view-invoice-card .invoice-toolbar-inline { align-items: center; }
.invoice-inline-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #475569;
}
.invoice-inline-input { min-width: 230px; width: auto; }
.invoice-inline-input-sm { min-width: 120px; max-width: 140px; }
.view-invoice-card .invoice-toolbar .form-group {
    margin: 0;
    min-width: 180px;
}
.invoice-or {
    font-weight: 700;
    color: #334155;
    padding: 0 0.15rem 0.55rem;
}
.view-invoice-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-top: 1rem;
}
.view-invoice-grid-single { grid-template-columns: 1fr; }
.view-invoice-grid h3 { margin: 0 0 0.5rem; }
.selected-row {
    background: #eff6ff;
}
.invoice-actions {
    margin-top: 0.9rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: end;
}
.invoice-actions .invoice-selected {
    min-width: 130px;
}
.invoice-actions .invoice-selected label {
    display: block;
    font-size: 0.82rem;
    color: #475569;
    margin-bottom: 0.2rem;
}
@media (max-width: 1000px) {
    .view-invoice-grid { grid-template-columns: 1fr; }
    .invoice-inline-input { min-width: 160px; }
}

/* ----- Cash invoices ----- */
.cash-invoice-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    align-items: center;
}
.cash-invoice-toolbar label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #475569;
}
.cash-invoice-toolbar .form-control {
    width: auto;
    min-width: 150px;
}
.cash-invoice-report-wrap { margin-top: 1rem; }
.cash-invoice-report-wrap h3 {
    margin: 0 0 0.5rem;
    text-align: center;
}
.cash-inv-summary {
    margin-bottom: 0.8rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.5rem 1rem;
    padding: 0.6rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
}
.expense-employee-modal {
    max-width: 920px;
}
.expense-employee-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.8rem 1rem;
}
.expense-employee-form-grid .form-group {
    margin: 0;
}
