@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
    --primary: #d97706;
    /* warm amber/wood tone */
    --primary-hover: #b45309;
    --primary-light: #fef3c7;
    --primary-dark: #78350f;
    --bg-app: #f9fafb;
    --bg-sidebar: #111827;
    --bg-sidebar-hover: #1f2937;
    --bg-card: #ffffff;
    --text-main: #0f172a;
    --text-muted: #475569;
    --text-light: #94a3b8;
    --text-on-dark: #f8fafc;
    --border: #e2e8f0;
    --border-focus: #cbd5e1;
    --success: #15803d;
    --success-bg: #dcfce7;
    --warning: #b45309;
    --warning-bg: #fef3c7;
    --danger: #b91c1c;
    --danger-bg: #fee2e2;
    --info: #0369a1;
    --info-bg: #e0f2fe;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --radius: 8px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    /* Belt-and-braces alongside the viewport meta tag: blocks pinch-zoom and
       double-tap-zoom on browsers that ignore user-scalable=no. */
    touch-action: manipulation;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-app);
    color: var(--text-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    touch-action: manipulation;
}

/* Base Layout */
.app-container {
    display: flex;
    min-height: 100vh;
    position: relative;
}

/* Sidebar Styling */
.sidebar {
    width: 260px;
    background-color: var(--bg-sidebar);
    color: var(--text-on-dark);
    display: flex;
    flex-direction: column;
    padding: 1.5rem 1rem;
    flex-shrink: 0;
    transition: transform 0.3s ease;
    z-index: 100;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 2rem;
    padding: 0 0.5rem;
}

.sidebar-logo-icon {
    background-color: var(--primary);
    width: 36px;
    height: 36px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.25rem;
    color: #ffffff;
}

.sidebar-title {
    font-size: 1.15rem;
    font-weight: 600;
    letter-spacing: -0.025em;
    white-space: nowrap;
}

.sidebar-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.menu-item a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--text-light);
    text-decoration: none;
    border-radius: var(--radius);
    font-weight: 500;
    transition: all 0.2s ease;
    cursor: pointer;
}

.menu-item a:hover {
    background-color: var(--bg-sidebar-hover);
    color: var(--text-on-dark);
}

.menu-item.active a {
    background-color: var(--primary);
    color: #ffffff;
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 1.5rem;
    border-top: 1px solid #1f2937;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.user-profile-summary {
    display: flex;
    flex-direction: column;
    padding: 0 0.5rem;
}

.user-name {
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--text-on-dark);
}

.user-role {
    font-size: 0.75rem;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.logout-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background-color: transparent;
    border: 1px solid #374151;
    color: var(--text-on-dark);
    padding: 0.5rem;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.85rem;
    font-family: inherit;
    font-weight: 500;
    transition: all 0.2s ease;
}

.logout-btn:hover {
    background-color: #ef4444;
    border-color: #ef4444;
}

/* Main Content Area */
.main-wrapper {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    /* fixes flexbox overflow issues */
}

.top-bar {
    height: 64px;
    background-color: var(--bg-card);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    z-index: 10;
}

.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-main);
}

.view-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-main);
}

.content-container {
    padding: 2rem;
    flex-grow: 1;
    overflow-y: auto;
}

/* Auth Screens */
.auth-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background-color: var(--bg-app);
    padding: 1rem;
}

.auth-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    padding: 2.5rem;
    width: 100%;
    max-width: 440px;
}

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-logo {
    background-color: var(--primary);
    width: 48px;
    height: 48px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.5rem;
    color: #ffffff;
    margin: 0 auto 1rem;
}

.auth-title {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.025em;
}

.auth-subtitle {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.auth-toggle {
    display: flex;
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.auth-toggle-btn {
    flex: 1;
    background: none;
    border: none;
    padding: 0.5rem;
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    color: var(--text-muted);
    transition: all 0.2s ease;
}

.auth-toggle-btn.active {
    background-color: var(--primary-light);
    color: var(--primary-dark);
}

/* Password field show/hide toggle */
.password-input-wrapper {
    position: relative;
    display: flex;
}

.password-input-wrapper .form-control {
    padding-right: 2.5rem;
}

.password-toggle-btn {
    position: absolute;
    top: 50%;
    right: 0.5rem;
    transform: translateY(-50%);
    border: none;
    background: transparent;
    font-size: 1rem;
    line-height: 1;
    padding: 0.25rem;
    cursor: pointer;
    color: var(--text-light);
    opacity: 0.6;
    transition: opacity 0.2s ease, color 0.2s ease;
}

.password-toggle-btn:hover {
    opacity: 1;
}

.password-toggle-btn.active {
    opacity: 1;
    color: var(--primary);
}

/* General UI Components */
/* Dashboard Summary Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    height: 4px;
    width: 100%;
}

.stat-card.not-started::before {
    background-color: var(--text-light);
}

.stat-card.in-progress::before {
    background-color: var(--primary);
}

.stat-card.completed::before {
    background-color: var(--success);
}

.stat-card.delivered::before {
    background-color: var(--info);
}

.stat-card.overdue::before {
    background-color: var(--danger);
}

.stat-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1;
}

/* Dashboard Sections */
.dashboard-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
}

@media (max-width: 1024px) {
    .dashboard-layout {
        grid-template-columns: 1fr;
    }
}

.panel {
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    margin-bottom: 2rem;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.75rem;
}

.panel-title {
    font-size: 1.1rem;
    font-weight: 600;
}

/* Table Style */
.table-wrapper {
    overflow-x: auto;
    margin-top: 0.5rem;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.9rem;
}

.data-table th {
    padding: 0.75rem 1rem;
    border-bottom: 1.5px solid var(--border);
    color: var(--text-muted);
    font-weight: 600;
    background-color: var(--bg-app);
}

.data-table td {
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.data-table tr:last-child td {
    border-bottom: none;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border-radius: 6px;
    font-family: inherit;
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.btn-primary {
    background-color: var(--primary);
    color: #ffffff;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
}

.btn-secondary {
    background-color: #ffffff;
    border-color: var(--border);
    color: var(--text-muted);
}

.btn-secondary:hover {
    background-color: var(--bg-app);
    border-color: var(--border-focus);
}

.btn-danger {
    background-color: var(--danger);
    color: #ffffff;
}

.btn-danger:hover {
    background-color: #991b1b;
}

.btn-sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
    border-radius: 4px;
}

.btn-link {
    background: none;
    border: none;
    color: var(--primary);
    cursor: pointer;
    padding: 0;
    font-size: 0.9rem;
    font-weight: 500;
}

.btn-link:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

/* Form Styles */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group.horizontal {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.375rem;
    color: var(--text-muted);
}

.form-control {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.9rem;
    color: var(--text-main);
    background-color: #ffffff;
    transition: border-color 0.2s, box-shadow 0.2s;
    min-height: 42px;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.15);
}

.form-control:disabled {
    background-color: var(--bg-app);
    color: var(--text-light);
    cursor: not-allowed;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.6rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 50px;
    white-space: nowrap;
}

.badge.not-started {
    background-color: var(--border);
    color: var(--text-muted);
}

.badge.in-progress {
    background-color: var(--warning-bg);
    color: var(--warning);
}

.badge.completed {
    background-color: var(--success-bg);
    color: var(--success);
}

.badge.delivered {
    background-color: var(--info-bg);
    color: var(--info);
}

.badge.overdue {
    background-color: var(--danger-bg);
    color: var(--danger);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }

    100% {
        opacity: 1;
    }
}

/* Production Order Cards */
.orders-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
}

.order-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    transition: box-shadow 0.2s;
}

.order-card:hover {
    box-shadow: var(--shadow-md);
}

.order-card-header {
    padding: 1.25rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    gap: 1rem;
}

.order-card-img {
    width: 70px;
    height: 70px;
    border-radius: 6px;
    object-fit: cover;
    background-color: var(--bg-app);
    flex-shrink: 0;
    border: 1px solid var(--border);
}

.order-card-info {
    flex-grow: 1;
    min-width: 0;
}

.order-title {
    font-weight: 600;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 0.125rem;
}

.order-customer {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.order-id-badge {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-light);
    background-color: var(--bg-app);
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    border: 1px solid var(--border);
}

.order-card-body {
    padding: 1.25rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    font-size: 0.85rem;
}

.order-detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.order-detail-label {
    color: var(--text-muted);
}

.order-detail-value {
    font-weight: 500;
}

.order-card-footer {
    padding: 1rem 1.25rem;
    background-color: var(--bg-app);
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

/* Wizard / Multistep forms */
.wizard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
}

.wizard-steps {
    display: flex;
    gap: 2rem;
    list-style: none;
}

.wizard-step {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-light);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.wizard-step.active {
    color: var(--primary);
    font-weight: 600;
}

.wizard-step-num {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background-color: var(--border);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
}

.wizard-step.active .wizard-step-num {
    background-color: var(--primary);
    color: #ffffff;
}

.woo-orders-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.woo-order-item {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background-color: #ffffff;
    padding: 1.25rem;
    transition: border-color 0.2s;
}

.woo-order-item:hover {
    border-color: var(--border-focus);
}

.woo-order-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    border-bottom: 1px dashed var(--border);
    padding-bottom: 0.5rem;
}

.woo-order-num {
    font-weight: 600;
}

.woo-order-cust {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.woo-order-products {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.woo-product-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.5rem;
    border-radius: 6px;
    background-color: var(--bg-app);
}

.woo-product-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.woo-product-img {
    width: 48px;
    height: 48px;
    border-radius: 4px;
    object-fit: cover;
    border: 1px solid var(--border);
}

.woo-product-name {
    font-size: 0.875rem;
    font-weight: 500;
}

.woo-product-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Badge shown instead of "Queue Item" once a product is already in production */
.woo-added-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--success);
    background: var(--success-bg);
    border: 1px solid #bbf7d0;
    padding: 0.35rem 0.85rem;
    border-radius: 999px;
    white-space: nowrap;
}

/* Modal styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
}

.modal-content {
    background-color: var(--bg-card);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    width: 90%;
    max-width: 600px;
    max-height: 85vh;
    overflow-y: auto;
    animation: modalSlide 0.25s ease-out;
}

@keyframes modalSlide {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1.25rem 1.5rem;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    background-color: var(--bg-app);
}

/* Stage config elements in order form */
.stage-section-card {
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 1rem;
    margin-bottom: 1rem;
    background-color: #ffffff;
}

.stage-section-card.active {
    border-left: 4px solid var(--primary);
}

.stage-section-title {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stage-remove-btn {
    color: var(--danger);
    cursor: pointer;
    background: none;
    border: none;
    font-size: 0.8rem;
}

.stage-grid-inputs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.75rem;
}

/* Alerts / Notifications */
.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.alert-error {
    background-color: var(--danger-bg);
    color: var(--danger);
    border: 1px solid #fecaca;
}

.alert-success {
    background-color: var(--success-bg);
    color: var(--success);
    border: 1px solid #bbf7d0;
}

/* Switch styling for status (Workers list) */
.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #cbd5e1;
    transition: .2s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .2s;
    border-radius: 50%;
}

input:checked+.slider {
    background-color: var(--primary);
}

input:checked+.slider:before {
    transform: translateX(20px);
}

/* Mobile Responsiveness Rules */
@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        position: fixed;
        top: 64px;
        left: 0;
        height: calc(100vh - 64px);
        transform: translateX(-100%);
        box-shadow: var(--shadow-lg);
    }

    .sidebar.mobile-open {
        transform: translateX(0);
    }

    .top-bar {
        padding: 0 1rem;
    }

    .mobile-menu-toggle {
        display: block;
    }

    .content-container {
        padding: 1.25rem;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    .stats-grid .stat-card:last-child {
        grid-column: span 2;
    }

    .data-table th,
    .data-table td {
        padding: 0.5rem;
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .stats-grid .stat-card:last-child {
        grid-column: span 1;
    }

    .auth-card {
        padding: 1.5rem;
    }
}

/* =========================================================
   V2.1 — ORDER DETAILS, IMAGE GALLERY, NOTES & LIGHTBOX
   ========================================================= */

/* "View Order" button on worker/shipping cards */
.view-order-btn {
    width: 100%;
    margin-bottom: 0.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
}

/* --- Order Details layout --- */
.order-details-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 1.75rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
}

/* --- Image gallery --- */
.od-gallery {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.od-main-image-wrapper {
    position: relative;
    border-radius: var(--radius);
    overflow: hidden;
    cursor: zoom-in;
    background: #f1f5f9;
    aspect-ratio: 4 / 3;
    border: 1px solid var(--border);
}

.od-main-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.35s ease;
}

.od-main-image-wrapper:hover .od-main-image {
    transform: scale(1.04);
}

.od-zoom-hint {
    position: absolute;
    bottom: 0.6rem;
    right: 0.6rem;
    background: rgba(15, 23, 42, 0.72);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 500;
    padding: 0.3rem 0.6rem;
    border-radius: 999px;
    opacity: 0;
    transition: opacity 0.25s ease;
    pointer-events: none;
}

.od-main-image-wrapper:hover .od-zoom-hint {
    opacity: 1;
}

.od-thumbnails {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.od-thumb {
    width: 64px;
    height: 64px;
    object-fit: cover;
    border-radius: 6px;
    border: 2px solid var(--border);
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s ease, border-color 0.2s ease;
}

.od-thumb:hover {
    opacity: 1;
}

.od-thumb.active {
    border-color: var(--primary);
    opacity: 1;
}

/* --- Order info panel --- */
.od-info {
    display: flex;
    flex-direction: column;
}

.od-product-name {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 1rem;
    line-height: 1.25;
}

.od-meta-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 0.55rem 0;
    border-bottom: 1px dashed var(--border);
}

.od-meta-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
    flex-shrink: 0;
}

.od-meta-value {
    font-size: 0.9rem;
    color: var(--text-main);
    font-weight: 500;
    text-align: right;
}

.od-section-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 0.6rem;
}

.od-description-section {
    margin-top: 1.1rem;
}

.od-description-text,
.description-preview {
    font-size: 0.88rem;
    color: var(--text-muted);
    line-height: 1.6;
    background: var(--bg-app);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.75rem 0.9rem;
}

.description-preview {
    margin-bottom: 0.6rem;
}

.od-description-text p,
.description-preview p {
    margin-bottom: 0.5rem;
}

.od-description-text p:last-child,
.description-preview p:last-child {
    margin-bottom: 0;
}

.od-description-text ul,
.od-description-text ol,
.description-preview ul,
.description-preview ol {
    padding-left: 1.25rem;
    margin-bottom: 0.5rem;
}

.od-description-text li,
.description-preview li {
    margin-bottom: 0.3rem;
}

.od-description-text ul ul,
.od-description-text ol ul,
.description-preview ul ul,
.description-preview ol ul {
    margin-top: 0.3rem;
}

/* --- Order Notes --- */
.od-notes-section {
    margin-top: 1.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.od-notes-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* Note cards — private = slate-grey, customer = blue-white */
.order-note-card {
    position: relative;
    border-radius: 8px;
    padding: 0.75rem 0.9rem;
    border: 1px solid var(--border);
    border-left-width: 4px;
}

.order-note-card.private {
    background: #f8fafc;
    border-left-color: #64748b;
}

.order-note-card.customer {
    background: #eff6ff;
    border-left-color: #2563eb;
}

.order-note-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.4rem;
}

.order-note-date {
    font-size: 0.72rem;
    color: var(--text-light);
    font-weight: 500;
}

.order-note-badge {
    font-size: 0.66rem;
    font-weight: 600;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.note-badge-private {
    background: #e2e8f0;
    color: #475569;
}

.note-badge-customer {
    background: #dbeafe;
    color: #1d4ed8;
}

.order-note-content {
    font-size: 0.87rem;
    color: var(--text-main);
    line-height: 1.5;
    word-break: break-word;
}

.order-note-content p {
    margin-bottom: 0.35rem;
}

.order-note-content p:last-child {
    margin-bottom: 0;
}

.order-note-footer {
    margin-top: 0.55rem;
    padding-top: 0.5rem;
    border-top: 1px dashed rgba(0, 0, 0, 0.08);
}

/* Hide/show toggle controlling whether a note is visible to workers */
.note-visibility-toggle {
    border: 1px solid var(--border);
    background: var(--bg-card);
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.25rem 0.6rem;
    border-radius: 999px;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.note-visibility-toggle.hidden {
    color: var(--text-muted);
}

.note-visibility-toggle.hidden:hover {
    background: var(--bg-app);
    border-color: var(--text-light);
}

.note-visibility-toggle.visible {
    color: var(--success);
    background: var(--success-bg);
    border-color: #bbf7d0;
}

.note-visibility-toggle.visible:hover {
    border-color: var(--success);
}

/* Delete button (admin modal only) */
.order-note-delete {
    position: absolute;
    top: 0.4rem;
    right: 0.4rem;
    width: 22px;
    height: 22px;
    border: none;
    background: transparent;
    color: var(--text-light);
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.2s ease, color 0.2s ease;
}

.order-note-delete:hover {
    background: var(--danger-bg);
    color: var(--danger);
}

/* --- Custom images (Admin Edit Order modal) --- */
.custom-images-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-top: 0.5rem;
}

.custom-image-thumb {
    position: relative;
    width: 76px;
    height: 76px;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid var(--border);
    background: var(--bg-app);
}

.custom-image-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.custom-image-delete {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 20px;
    height: 20px;
    border: none;
    border-radius: 50%;
    background: rgba(15, 23, 42, 0.75);
    color: #fff;
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.custom-image-delete:hover {
    background: var(--danger);
}

/* --- Admin card: show/hide shipping details --- */
.shipping-details-toggle {
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--info);
    font-size: 0.68rem;
    font-weight: 600;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.shipping-details-toggle:hover {
    background: var(--info-bg);
    border-color: var(--info);
}

.shipping-details-panel {
    margin-top: 0.5rem;
    padding: 0.5rem 0.65rem;
    background: var(--bg-app);
    border: 1px dashed var(--border);
    border-radius: 6px;
}

.shipping-details-panel .order-detail-row {
    padding: 0.2rem 0;
}

/* --- Shipping form: one-time save warning & locked notice --- */
.shipping-lock-warning {
    font-size: 0.72rem;
    line-height: 1.45;
    color: var(--warning);
    margin-top: 0.45rem;
    text-align: center;
}

.shipping-locked-notice {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--success);
    background: var(--success-bg);
    border: 1px solid #bbf7d0;
    border-radius: 6px;
    padding: 0.6rem 0.75rem;
    text-align: center;
    margin-top: 0.25rem;
}

/* --- Full-screen lightbox --- */
.lightbox-overlay {
    position: fixed;
    inset: 0;
    background: rgba(9, 12, 20, 0.94);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: lightbox-fade 0.2s ease;
}

@keyframes lightbox-fade {
    from { opacity: 0; }
    to { opacity: 1; }
}

.lightbox-img-wrapper {
    max-width: 92vw;
    max-height: 88vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-image {
    max-width: 92vw;
    max-height: 88vh;
    object-fit: contain;
    border-radius: 6px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    cursor: default;
}

.lightbox-close {
    position: absolute;
    top: 1rem;
    right: 1.25rem;
    width: 44px;
    height: 44px;
    border: none;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    font-size: 1.8rem;
    line-height: 1;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.2s ease;
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.25);
}

.lightbox-counter {
    position: absolute;
    top: 1.35rem;
    left: 50%;
    transform: translateX(-50%);
    color: #e2e8f0;
    font-size: 0.85rem;
    font-weight: 500;
    background: rgba(255, 255, 255, 0.1);
    padding: 0.3rem 0.85rem;
    border-radius: 999px;
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 52px;
    height: 52px;
    border: none;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    font-size: 1.5rem;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.lightbox-nav:hover {
    background: rgba(255, 255, 255, 0.28);
}

.lightbox-prev {
    left: 1.25rem;
}

.lightbox-next {
    right: 1.25rem;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .order-details-grid {
        grid-template-columns: 1fr;
        gap: 1.25rem;
        padding: 1rem;
    }

    .od-main-image-wrapper {
        aspect-ratio: 16 / 10;
    }

    .lightbox-nav {
        width: 44px;
        height: 44px;
        font-size: 1.25rem;
    }

    .lightbox-prev {
        left: 0.5rem;
    }

    .lightbox-next {
        right: 0.5rem;
    }
}