:root {
    --primary: #C8243B;
    --primary-hover: #D93A50;
    --primary-dark: #541B2E;
    --primary-light: #E0566A;
    --primary-soft: rgba(200, 36, 59, 0.16);
    --brand: #541B2E;
    --accent: #F4A58A;
    --accent-soft: rgba(244, 165, 138, 0.14);
    --accent-glow: rgba(244, 165, 138, 0.18);
    --bg-base: #0E0F13;
    --bg-card: #17181E;
    --bg-surface: #17181E;
    --bg-elevated: #1F2027;
    --border: rgba(255, 255, 255, 0.08);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.16);
    --text-primary: #F4F1EC;
    --text-secondary: #A9A6A0;
    --text-muted: #8A8680;
    --secondary: #F4A58A;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-base);
    color: var(--text-primary);
    height: 100%;
    margin: 0;
    padding: 0;
}

#app {
    height: 100vh;
}

::-webkit-scrollbar {
    width: 5px;
}

::-webkit-scrollbar-track {
    background: var(--bg-surface);
}

::-webkit-scrollbar-thumb {
    background: var(--primary-dark);
    border-radius: 3px;
}

.app-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
    background: var(--bg-base);
    gap: 1.5rem;
}

.loading-logo {
    padding: 0 1rem;
    text-align: center;
    font-size: clamp(1.8rem, 7vw, 2.8rem);
    font-weight: 800;
    color: var(--primary-dark);
    letter-spacing: -0.02em;
}

.loading-logo .accent {
    color: var(--accent);
}

.loading-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(255, 255, 255, 0.08);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.loading-text {
    font-size: 0.78rem;
    color: var(--text-muted);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    text-decoration: none !important;
    color: var(--text-primary) !important;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background-color: var(--brand);
    font-size: 1.05rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.brand-name {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    white-space: nowrap;
}

.brand-accent {
    color: var(--accent);
    font-weight: 600;
}

h1:focus {
    outline: none;
}

.site-appbar {
    background-color: rgba(14, 15, 19, 0.82) !important;
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(12px);
}

.site-appbar .mud-toolbar {
    padding: 0;
}

.nav-inner {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    max-width: 1200px;
    height: 64px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.nav-inner .nav-brand {
    margin-right: 0.5rem;
}

.nav-links,
.nav-actions {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    height: 100%;
}

.nav-actions {
    gap: 0.5rem;
}

.nav-link {
    position: relative;
    display: inline-flex;
    align-items: center;
    height: 40px;
    padding: 0 0.85rem;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
    color: var(--text-secondary);
    transition: color 0.15s ease, background-color 0.15s ease;
}

.nav-link:hover {
    color: var(--text-primary);
    background-color: rgba(255, 255, 255, 0.05);
}

.nav-link:focus-visible,
.nav-menu-toggle:focus-visible,
.nav-drawer-link:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.nav-link-active {
    color: var(--text-primary);
}

.nav-link-active::after {
    content: "";
    position: absolute;
    right: 0.85rem;
    bottom: -12px;
    left: 0.85rem;
    height: 2px;
    border-radius: 2px;
    background-color: var(--primary);
}

.nav-cta.mud-button-root {
    height: 40px;
    padding: 0 1.1rem;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    text-transform: none;
    white-space: nowrap;
}

.nav-menu-toggle {
    display: none;
    place-items: center;
    width: 40px;
    height: 40px;
    padding: 0;
    background-color: transparent;
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    color: var(--text-primary);
    cursor: pointer;
}

.nav-menu-toggle:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.account-menu {
    margin-left: 0.25rem;
}

.account-chip {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    height: 40px;
    padding: 0 0.5rem 0 0.25rem;
    background-color: transparent;
    border: 1px solid var(--border-strong);
    border-radius: 100px;
    color: var(--text-primary);
    font-family: inherit;
    cursor: pointer;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}

.account-chip:hover {
    border-color: rgba(255, 255, 255, 0.3);
    background-color: rgba(255, 255, 255, 0.04);
}

.account-chip:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.account-chip .mud-avatar {
    width: 30px;
    height: 30px;
}

.account-chip-name {
    max-width: 140px;
    overflow: hidden;
    font-size: 0.95rem;
    font-weight: 500;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.account-chip-arrow {
    color: var(--text-secondary);
}

.account-avatar {
    background-color: var(--brand);
    color: var(--text-primary);
    font-size: 0.8rem;
    font-weight: 700;
}

.account-menu-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 260px;
    padding: 1rem;
}

.account-menu-details {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.account-menu-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
}

.account-menu-email {
    overflow: hidden;
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.account-menu-role {
    margin-top: 0.2rem;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--accent);
}

.nav-drawer.mud-drawer {
    background-color: var(--bg-card);
    border-left: 1px solid var(--border);
}

.nav-drawer .mud-drawer-content {
    display: flex;
    flex-direction: column;
}

.nav-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
    padding: 0 1rem 0 1.25rem;
    border-bottom: 1px solid var(--border);
}

.nav-drawer-title {
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.nav-drawer .nav-drawer-close {
    display: grid;
}

.nav-drawer-account {
    min-width: 0;
    padding: 1.25rem;
    border-bottom: 1px solid var(--border);
}

.nav-drawer-links {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.75rem;
}

.nav-drawer-link {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    min-height: 48px;
    padding: 0 0.85rem;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 500;
    text-decoration: none;
    color: var(--text-secondary);
}

.nav-drawer-link:hover {
    color: var(--text-primary);
    background-color: rgba(255, 255, 255, 0.05);
}

.nav-drawer-link-active {
    color: var(--text-primary);
    background-color: var(--primary-soft);
}

.nav-drawer-footer {
    margin-top: auto;
    padding: 1rem;
    border-top: 1px solid var(--border);
}

.nav-drawer-logout.mud-button-root {
    height: 44px;
    border-color: var(--border-strong);
    border-radius: 10px;
    text-transform: none;
    font-weight: 600;
}

@media (max-width: 860px) {
    .nav-inner {
        padding: 0 1rem;
    }

    .nav-links {
        display: none;
    }

    .nav-desktop-only {
        display: none !important;
    }

    .nav-menu-toggle {
        display: grid;
    }

    .nav-new-order-label {
        display: none;
    }

    .nav-new-order.mud-button-root {
        width: 40px;
        min-width: 40px;
        padding: 0;
    }

    .nav-new-order .mud-button-icon-start {
        margin: 0;
    }
}

.main-content {
    padding: 64px 0 0;
}

.dash-stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1.5rem 1.75rem;
    transition: border-color 0.2s, transform 0.2s;
}

.dash-stat-card:hover {
    transform: translateY(-3px);
    border-color: rgba(200, 36, 59, 0.35);
}

.dash-stat-icon {
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
    opacity: 0.85;
}

.dash-stat-value {
    font-size: 2rem;
    font-weight: 900;
    letter-spacing: -0.02em;
}

.dash-stat-label {
    font-size: 0.78rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
    margin-top: 0.2rem;
}


.designer-layout {
    display: grid;
    grid-template-columns: 1fr 420px;
    gap: 1rem;
    height: calc(100vh - 64px);
    padding: 1rem;
    overflow: hidden;
}

.designer-canvas-area {
    position: relative;
    height: 100%;
    min-height: 0;
}

.designer-tools-area {
    height: 100%;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    padding-right: 4px;
}

.three-canvas-container {
    width: 100%;
    height: 100%;
    position: relative;
    border-radius: 20px;
    overflow: hidden;
    background: var(--bg-base);
    border: 1px solid var(--border);
    box-shadow: inset 0 0 60px rgba(0, 0, 0, 0.4);
}

.three-canvas-container canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
}

.canvas-loading {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* -- Tool Sections ----------------------------------- */
.tool-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 1.2rem;
}

.export-section {
    background: var(--bg-card);
    border: 1px solid var(--border-strong);
    border-radius: 14px;
    padding: 1.2rem;
}

.tool-section-title {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 0.9rem;
}

.tool-section-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.tool-section-head .tool-section-title {
    margin: 0;
}

.tool-btn.mud-button-root {
    text-transform: none;
    font-weight: 600;
    border-radius: 10px;
}

.tool-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.tool-hint {
    display: block;
    margin-top: 0.5rem;
    color: var(--text-muted);
}

.tool-hint-success {
    color: #5fd39a;
}

.segmented {
    display: flex;
    padding: 2px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
}

.segmented-option {
    padding: 4px 12px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.segmented-option:hover {
    color: var(--text-primary);
}

.segmented-option.active {
    background: var(--primary);
    color: #fff;
}

.segmented-option:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.piece-picker {
    margin-bottom: 1rem;
}

.piece-picker-label {
    margin: 0 0 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.piece-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.piece-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 36px;
    padding: 0 0.875rem;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 999px;
    background: transparent;
    color: var(--text-secondary);
    font: inherit;
    font-size: 0.85rem;
    cursor: pointer;
}

.piece-chip:hover {
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.3);
}

.piece-chip.active {
    color: var(--text-primary);
    border-color: var(--primary);
    background: rgba(200, 36, 59, 0.18);
}

.piece-chip:focus-visible,
.piece-toggle:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.piece-dot {
    flex: none;
    width: 14px;
    height: 14px;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 50%;
}

.piece-dot.mixed {
    border: 2px dashed var(--text-muted);
    background: transparent;
}

.piece-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    margin: 0.75rem 0 0.5rem;
    padding: 0.25rem 0;
    border: none;
    background: none;
    color: var(--accent);
    font: inherit;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
}

/* -- Color Swatches ---------------------------------- */
.color-swatches {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    gap: 5px;
}

.color-swatch {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.18s ease;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.color-swatch:hover {
    transform: scale(1.22);
    border-color: rgba(255, 255, 255, 0.4);
}

.color-swatch.active {
    border-color: white;
    box-shadow: 0 0 12px rgba(255, 255, 255, 0.3);
    transform: scale(1.12);
}

/* ============================================================
   UTILITIES
   ============================================================ */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0.25rem 0.75rem;
    border-radius: 100px;
    font-size: 0.78rem;
    font-weight: 600;
}

.status-pending {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.status-progress {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.status-completed {
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.status-cancelled {
    background: rgba(239, 68, 68, 0.12);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

/* ============================================================
   ADMIN PAGES
   ============================================================ */
.admin-page {
    min-height: calc(100vh - 64px);
    padding: 2rem 1.5rem 4rem;
    max-width: 1200px;
    margin: 0 auto;
}

.admin-header {
    margin-bottom: 1.25rem;
}

.admin-title {
    margin: 0;
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.admin-subtitle {
    margin: 0.35rem 0 0;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.admin-note.mud-alert {
    margin-bottom: 1.5rem;
    background: transparent;
    border-color: var(--border-strong);
    color: var(--text-secondary);
}

.admin-tabs .mud-tabs-toolbar {
    background: transparent;
    border-bottom: 1px solid var(--border);
}

.admin-tabs .mud-tab {
    text-transform: none;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-secondary);
}

.admin-tabs .mud-tab.mud-tab-active {
    color: var(--text-primary);
}

.admin-page .mud-button-root {
    text-transform: none;
    font-weight: 600;
}

.admin-page .mud-button-text.mud-button-text-primary {
    color: var(--accent);
}

.admin-tab-panel {
    padding-top: 1.25rem;
}

.admin-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.admin-hint {
    color: var(--text-muted);
}

.toolbar-filters {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    flex: 1 1 auto;
    min-width: 0;
}

.toolbar-search {
    flex: 0 1 320px;
    min-width: 200px;
}

.toolbar-search.mud-input-control {
    margin-top: 0;
}

.toolbar-status .mud-toggle-item {
    text-transform: none;
    font-weight: 600;
    min-width: 76px;
}

.toolbar-result {
    display: block;
    margin: -0.5rem 0 0.75rem;
    color: var(--text-muted);
}

@media (max-width: 600px) {
    .toolbar-search {
        flex: 1 1 100%;
    }
}

.admin-panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
}

.admin-panel .mud-table {
    background: transparent;
}

.admin-panel .mud-table-head .mud-table-cell {
    background: var(--bg-elevated);
    color: var(--text-secondary);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.admin-panel .mud-table-body .mud-table-cell {
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
}

.admin-name {
    font-weight: 600;
}

.admin-num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.admin-actions {
    text-align: right;
    white-space: nowrap;
}

@keyframes row-moved-flash {
    from {
        background-color: rgba(253, 164, 129, 0.4);
    }

    to {
        background-color: transparent;
    }
}

.row-moved td {
    animation: row-moved-flash 2.2s ease-out;
}

.admin-empty {
    padding: 2.5rem 1rem;
    text-align: center;
    color: var(--text-secondary);
}

.state-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0.2rem 0.7rem;
    border-radius: 100px;
    font-size: 0.75rem;
    font-weight: 700;
}

.state-badge::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.state-active {
    color: #5fd39a;
    background: rgba(95, 211, 154, 0.14);
}

.state-inactive {
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.06);
}

.state-pending {
    color: #f5c26b;
    background: rgba(245, 194, 107, 0.14);
}

.state-rejected {
    color: #f28b82;
    background: rgba(242, 139, 130, 0.14);
}

.collection-thumb {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--border);
    display: block;
}

.collection-thumb-empty {
    display: grid;
    place-items: center;
    background: var(--bg-elevated);
    color: var(--text-muted);
}

.collection-image-field {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.collection-image-preview,
.collection-image-empty {
    width: 96px;
    height: 96px;
    flex-shrink: 0;
    border-radius: 12px;
    border: 1px solid var(--border-strong);
    object-fit: cover;
    background: var(--bg-elevated);
}

.collection-image-empty {
    display: grid;
    place-items: center;
    color: var(--text-muted);
    font-size: 0.8rem;
}

.collection-image-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
}

.collection-image-hint {
    color: var(--text-muted);
}

.collection-color-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1.25rem;
}

.collection-color-field {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.88rem;
    color: var(--text-secondary);
}

.collection-color-field input[type="color"] {
    width: 44px;
    height: 40px;
    padding: 0;
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    background: transparent;
    cursor: pointer;
}

.collection-text-row {
    display: grid;
    grid-template-columns: 1fr 120px auto;
    gap: 0.75rem;
    align-items: center;
}

@media (max-width: 600px) {
    .collection-text-row {
        grid-template-columns: 1fr 1fr;
    }
}

.dialog-btn {
    border-radius: 100px;
    font-weight: 600;
    text-transform: none;
    padding: 0.4rem 1.4rem;
}

.access-denied {
    min-height: calc(100vh - 64px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem;
    gap: 0.75rem;
}

.access-denied-icon.mud-icon-root {
    font-size: 3.5rem;
    color: var(--text-muted);
}

.access-denied-title {
    margin: 0;
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text-primary);
}

.access-denied-text {
    margin: 0 0 1rem;
    color: var(--text-secondary);
}

.access-denied-btn {
    border-radius: 100px;
    font-weight: 700;
    text-transform: none;
    padding: 0.5rem 1.75rem;
}

/* ============================================================
   CUSTOMER PAGES
   ============================================================ */
.customer-page {
    min-height: calc(100vh - 64px);
    padding: 2rem 1.5rem 4rem;
    max-width: 1200px;
    margin: 0 auto;
}

.customer-header {
    margin-bottom: 1.75rem;
}

.customer-title {
    margin: 0;
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.customer-subtitle {
    margin: 0.35rem 0 0;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.customer-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-secondary);
}

.customer-empty h2 {
    margin: 0 0 0.5rem;
    color: var(--text-primary);
    font-size: 1.25rem;
}

.customer-empty p {
    margin: 0 0 1.25rem;
}

.order-choices {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.25rem;
}

.order-choice {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1.75rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    color: inherit;
    text-decoration: none;
    transition: transform 0.25s ease, border-color 0.25s ease;
}

.order-choice:hover,
.order-choice:focus-visible {
    transform: translateY(-6px);
    border-color: var(--accent);
    outline: none;
}

.order-choice-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: grid;
    place-items: center;
}

.order-choice-primary {
    background: var(--primary-soft);
    color: #ff8a9a;
}

.order-choice-accent {
    background: var(--accent-soft);
    color: var(--accent);
}

.order-choice-info {
    background: rgba(109, 182, 255, 0.14);
    color: #6db6ff;
}

.order-choice-title {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--text-primary);
}

.order-choice-text {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
}

.order-choice-go {
    margin-top: auto;
    color: var(--accent);
    font-weight: 700;
    font-size: 0.85rem;
}

.collection-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1.25rem;
}

.collection-card {
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
}

.collection-card-image {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    display: block;
    background: var(--bg-elevated);
}

.collection-card-image-empty {
    display: grid;
    place-items: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.collection-card-body {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 1rem 1.1rem 1.25rem;
}

.collection-card-name {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
}

.collection-card-price {
    margin: 0;
    font-weight: 600;
    color: var(--accent);
}

.collection-card-note {
    margin: 0 0 0.75rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.collection-order-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.collection-order-image {
    width: 72px;
    height: 72px;
    border-radius: 12px;
    object-fit: cover;
    border: 1px solid var(--border);
}

.collection-order-name {
    margin: 0;
    font-weight: 700;
    color: var(--text-primary);
}

.collection-order-price {
    margin: 0.15rem 0 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.collection-order-3d {
    height: 320px;
    margin-bottom: 0.75rem;
    border-radius: 12px;
    background: var(--bg-base);
    overflow: hidden;
}

.collection-order-3d .three-canvas-container {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

.collection-order-3d-hint {
    margin: -0.25rem 0 1rem;
    text-align: center;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.design-preview-3d {
    height: min(60vh, 520px);
    margin-bottom: 0.75rem;
    border-radius: 12px;
    background: var(--bg-base);
    overflow: hidden;
}

.design-preview-3d .three-canvas-container {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

.design-preview-failed {
    padding: 3rem 1rem;
    text-align: center;
    color: var(--text-secondary);
}

.order-form-title {
    margin: 1.25rem 0 0.6rem;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.order-form-title:first-child {
    margin-top: 0;
}

.order-empty-hint {
    margin: 0.75rem 0 0;
    color: var(--text-muted);
    font-size: 0.88rem;
}

.order-lines {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin-top: 0.85rem;
}

.order-line {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas: "info total" "stepper remove";
    gap: 0.4rem 0.75rem;
    align-items: center;
    padding: 0.7rem 0.85rem;
    background: var(--bg-base);
    border: 1px solid var(--border);
    border-radius: 12px;
}

.order-line-info {
    grid-area: info;
    display: flex;
    align-items: baseline;
    gap: 0.6rem;
}

.order-line-name {
    font-weight: 800;
    font-size: 1.05rem;
    color: var(--text-primary);
}

.order-line-detail {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

.order-line-stepper {
    grid-area: stepper;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.order-line-qty {
    width: 76px;
}

.order-line-qty input {
    text-align: center;
}

.order-line-total {
    grid-area: total;
    text-align: right;
    font-weight: 700;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}

.order-line>.mud-button-root {
    grid-area: remove;
    justify-self: end;
    text-transform: none;
}

.back-btn.mud-button-root {
    text-transform: none;
    font-weight: 600;
    color: var(--text-secondary);
    margin-left: -0.5rem;
}

.back-btn.mud-button-root:hover {
    color: var(--text-primary);
    background-color: rgba(255, 255, 255, 0.05);
}

.page-back {
    margin-bottom: 0.75rem;
}

.designer-back {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 5;
}

.designer-back .back-btn.mud-button-root {
    margin-left: 0;
    background: rgba(16, 18, 31, 0.75);
    border: 1px solid var(--border-strong);
    color: var(--text-primary);
    border-radius: 100px;
}

.receipt-3d {
    height: 420px;
    margin-bottom: 1rem;
    border-radius: 12px;
    background: var(--bg-base);
    overflow: hidden;
}

.receipt-3d .three-canvas-container {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

.receipt-3d-hint {
    margin: -0.5rem 0 1rem;
    text-align: center;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.auth-page {
    min-height: calc(100vh - 64px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    background: var(--bg-base);
}

.auth-card {
    width: 100%;
    padding: 2rem;
    background: var(--bg-card) !important;
    border: 1px solid var(--border);
    border-radius: 16px !important;
}

.auth-card-narrow {
    max-width: 420px;
}

.auth-card-wide {
    max-width: 620px;
}

.auth-brand {
    display: block;
    margin-bottom: 1.5rem;
    text-align: center;
    font-size: 1.3rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.auth-back {
    width: 100%;
    margin-bottom: 0.75rem;
}

.auth-back-narrow {
    max-width: 420px;
}

.auth-back-wide {
    max-width: 620px;
}

.order-summary {
    margin-top: 1.25rem;
    padding: 1rem;
    background: var(--bg-base);
    border: 1px solid var(--border);
    border-radius: 12px;
}

.order-summary .order-form-title {
    margin-top: 0;
}

.order-summary-row {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.2rem 0;
    font-size: 0.88rem;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}

.order-summary-total {
    margin-top: 0.4rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border-strong);
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--text-primary);
}

.order-summary-hint {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.88rem;
}

.order-summary-error {
    margin: 0;
    color: #ff6b7d;
    font-size: 0.88rem;
}

.order-actions {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin-top: 1.25rem;
}

.export-section .mud-button-root,
.customer-page .mud-button-root,
.upload-form-panel .mud-button-root {
    text-transform: none;
    font-weight: 600;
}

.view-switcher .mud-button-root {
    background: var(--bg-card);
    color: var(--text-primary);
    text-transform: none;
    font-weight: 600;
    border-color: var(--border-strong);
}

.view-switcher .mud-button-root:hover {
    background: var(--bg-elevated);
}

.order-tip {
    display: block;
    margin-top: 0.75rem;
    text-align: center;
    color: var(--text-muted);
}

.submit-design-note {
    color: var(--text-muted);
}

.submit-design-preview {
    display: block;
    width: 100%;
    max-width: 360px;
    aspect-ratio: 1 / 1;
    margin: 0 auto;
    border-radius: 12px;
    border: 1px solid var(--border-strong);
}

.submit-design-hint {
    display: block;
    text-align: center;
    color: var(--text-muted);
}

.upload-layout {
    display: grid;
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    gap: 1.5rem;
    align-items: start;
}

/* -- Profile ------------------------------------------------ */
.profile-page {
    max-width: 1040px;
}

.profile-layout {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 1.25rem;
    align-items: start;
}

.profile-summary,
.profile-form {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1.5rem;
}

.profile-summary {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.profile-avatar.mud-avatar {
    width: 88px;
    height: 88px;
    background-color: var(--brand);
    color: var(--text-primary);
    font-size: 1.75rem;
    font-weight: 700;
}

.profile-summary-name {
    margin: 1rem 0 0;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.profile-summary-email {
    margin: 0.2rem 0 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
    overflow-wrap: anywhere;
}

.profile-role {
    margin-top: 0.75rem;
    padding: 0.2rem 0.7rem;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.profile-facts {
    width: 100%;
    margin: 1.5rem 0 0;
    padding: 1.25rem 0 0;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
    text-align: left;
}

.profile-facts dt {
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.profile-facts dd {
    margin: 0.15rem 0 0;
    font-size: 0.92rem;
    color: var(--text-primary);
    white-space: pre-line;
    overflow-wrap: anywhere;
}

.profile-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.profile-field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.profile-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 0.75rem;
}

.profile-actions .mud-button-root {
    min-height: 44px;
    border-radius: 10px;
    text-transform: none;
    font-weight: 600;
}

@media (max-width: 860px) {
    .profile-layout {
        grid-template-columns: 1fr;
    }

    .profile-field-row {
        grid-template-columns: 1fr;
    }

    .profile-actions {
        flex-direction: column-reverse;
    }
}

.upload-image-panel,
.upload-form-panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1.25rem;
}

.upload-preview {
    width: 100%;
    max-height: 360px;
    object-fit: contain;
    border-radius: 12px;
    background: var(--bg-base);
    margin-bottom: 0.5rem;
    display: block;
}

.upload-empty {
    display: grid;
    place-items: center;
    height: 220px;
    margin-bottom: 0.75rem;
    border: 1px dashed var(--border-strong);
    border-radius: 12px;
    color: var(--text-muted);
}

.upload-file-name {
    margin: 0 0 0.75rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
    word-break: break-all;
}

.upload-hint {
    display: block;
    margin-top: 0.5rem;
    color: var(--text-muted);
}

.receipt-panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1.5rem;
    height: 100%;
}

.receipt-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.receipt-title {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--text-primary);
}

.receipt-id {
    margin: 0.2rem 0 0;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.receipt-image-frame {
    display: flex;
    justify-content: center;
    padding: 1rem;
    margin-bottom: 1rem;
    background: var(--bg-base);
    border-radius: 12px;
}

.receipt-image {
    max-width: 100%;
    max-height: 360px;
    object-fit: contain;
}

.receipt-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.receipt-label {
    display: block;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.receipt-value {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.15rem;
    font-weight: 600;
    color: var(--text-primary);
}

.receipt-swatch {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 1px solid var(--border-strong);
}

.receipt-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.receipt-table th {
    padding: 0.6rem 0.5rem;
    text-align: left;
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-strong);
}

.receipt-table td {
    padding: 0.6rem 0.5rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
}

.receipt-num {
    text-align: right !important;
    font-variant-numeric: tabular-nums;
}

.receipt-totals {
    margin-top: 1rem;
}

.receipt-total-row {
    display: flex;
    justify-content: space-between;
    padding: 0.25rem 0;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}

.receipt-grand-total {
    margin-top: 0.4rem;
    padding-top: 0.6rem;
    border-top: 1px solid var(--border-strong);
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--text-primary);
}

.receipt-chat {
    display: flex;
    flex-direction: column;
    min-height: 500px;
}

.receipt-chat .receipt-chat-divider {
    flex-grow: 0;
}

.receipt-chat-messages {
    flex: 1 1 0;
    min-height: 0;
    overflow-y: auto;
    background-color: var(--bg-base);
    border-radius: 8px;
    padding: 16px;
}

@media (max-width: 959.98px) {
    .receipt-chat {
        height: 70vh;
    }
}

.receipt-chat-title {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
}

.receipt-chat-subtitle {
    margin: 0.2rem 0 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.statement-sheet {
    background: #FFFFFF;
    color: #1A1A1A;
    border-radius: 12px;
    padding: 2.5rem;
}

.statement-sheet p {
    margin: 0;
}

.statement-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 1.5rem;
    padding-bottom: 1.25rem;
    border-bottom: 2px solid #1A1A1A;
    font-size: 0.85rem;
    color: #4A4A4A;
}

.statement-shop-name {
    font-size: 1.25rem;
    font-weight: 800;
    color: #541B2E;
}

.statement-heading {
    text-align: right;
}

.statement-title {
    margin: 0 0 0.25rem;
    font-size: 1.5rem;
    font-weight: 800;
    color: #1A1A1A;
}

.statement-notice {
    margin-top: 1.25rem !important;
    padding: 0.75rem 1rem;
    border: 1px solid #C8243B;
    border-radius: 8px;
    color: #C8243B;
    font-weight: 600;
}

.statement-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin: 1.5rem 0;
}

.statement-block-title {
    margin: 0 0 0.6rem;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #6A6A6A;
}

.statement-facts {
    margin: 0;
    display: grid;
    gap: 0.4rem;
    font-size: 0.9rem;
}

.statement-facts div {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 0.5rem;
}

.statement-facts dt {
    color: #6A6A6A;
}

.statement-facts dd {
    margin: 0;
    font-weight: 600;
    overflow-wrap: anywhere;
}

.statement-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.statement-table th {
    padding: 0.6rem 0.5rem;
    text-align: left;
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #4A4A4A;
    background: #F2F2F2;
    border-bottom: 1px solid #CCCCCC;
}

.statement-table td {
    padding: 0.6rem 0.5rem;
    border-bottom: 1px solid #E2E2E2;
}

.statement-totals {
    margin: 1rem 0 0 auto;
    max-width: 340px;
}

.statement-total-row {
    display: flex;
    justify-content: space-between;
    padding: 0.25rem 0;
    color: #4A4A4A;
    font-variant-numeric: tabular-nums;
}

.statement-grand-total {
    margin-top: 0.4rem;
    padding-top: 0.6rem;
    border-top: 2px solid #1A1A1A;
    font-size: 1.15rem;
    font-weight: 800;
    color: #1A1A1A;
}

.statement-footer {
    margin-top: 2.5rem;
    padding-top: 1rem;
    border-top: 1px solid #E2E2E2;
    text-align: center;
    font-size: 0.85rem;
    color: #6A6A6A;
}

@media (max-width: 600px) {
    .statement-sheet {
        padding: 1.25rem;
    }

    .statement-heading {
        text-align: left;
    }

    .statement-facts div {
        grid-template-columns: 1fr;
        gap: 0;
    }
}

@media print {
    @page {
        margin: 0;
    }

    html:has(.statement-dialog),
    body:has(.statement-dialog),
    body:has(.statement-dialog) #app {
        height: auto !important;
        overflow: visible !important;
        background: #FFFFFF !important;
    }

    body:has(.statement-dialog) .mud-layout,
    body:has(.statement-dialog) .mud-snackbar-provider,
    body:has(.statement-dialog) #blazor-error-ui,
    .mud-dialog-container:has(.statement-dialog) .mud-overlay,
    .statement-dialog .mud-dialog-title,
    .statement-dialog .mud-dialog-actions {
        display: none !important;
    }

    .mud-dialog-container:has(.statement-dialog) {
        position: static !important;
        display: block !important;
    }

    .statement-dialog {
        position: static !important;
        width: 100% !important;
        max-width: none !important;
        max-height: none !important;
        margin: 0 !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        background: #FFFFFF !important;
    }

    .statement-dialog .mud-dialog-content {
        padding: 0 !important;
        max-height: none !important;
        overflow: visible !important;
    }

    .statement-sheet {
        border-radius: 0;
        padding: 12mm;
        print-color-adjust: exact;
        -webkit-print-color-adjust: exact;
    }

    .statement-facts div {
        grid-template-columns: 140px 1fr;
        gap: 0.5rem;
    }
}


@media (max-width: 860px) {
    .upload-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 900px) {
    .designer-layout {
        grid-template-columns: 1fr;
        grid-template-rows: 55vh auto;
        overflow-y: auto;
        height: auto;
    }

    .designer-canvas-area {
        height: 55vh;
    }

    .designer-tools-area {
        height: auto;
        overflow: visible;
    }
}