:root {
    --accent: #0f6cbd;
    --accent-strong: #0c58a0;
    --surface: #ffffff;
    --surface-muted: #f7f8fa;
    --text: #1f1f1f;
    --text-muted: #4a4a4a;
    --border: #d6d6d6;
    --shadow: 0 6px 18px rgba(15, 23, 42, 0.08);
    --radius: 8px;
    --radius-sm: 6px;
    --gap: 8px;
    --font: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

.order-card--custom {
    position: relative;
    overflow: hidden;
    border-left: 4px solid var(--accent);
    background: linear-gradient(135deg, #f7fbff 0%, #ffffff 60%);
}

.order-card__eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.75rem;
    color: var(--accent-strong);
    font-weight: 700;
    margin-bottom: 0.15rem;
}

/* Open order summary columns */
.summary-col {
    min-width: 200px;
    word-break: normal;
}

.pill--muted {
    background: #eef2f7;
    color: #4a5568;
    border: 1px solid #d9e2ec;
}

.pill--soft {
    background: #e8f3ff;
    color: #0f6cbd;
    border: 1px solid #c6ddff;
}

.file-list {
    list-style: none;
    padding: 0;
    margin: 0.35rem 0 0;
    display: grid;
    gap: 0.5rem;
}

.file-list--compact li,
.file-list--notes li,
.file-list li {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.55rem;
    align-items: center;
    padding: 0.55rem 0.65rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: 0 2px 6px rgba(0,0,0,0.02);
}

.file-list__icon {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    background: var(--surface-muted);
    border: 1px solid var(--border);
    border-radius: 50%;
    color: #6b7280;
}

.file-list__name {
    color: var(--text);
    font-weight: 600;
    line-height: 1.25;
}

.file-link--signed {
    color: red;
}

.file-link--customer-details {
    color: green;
}

.file-list__meta {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.file-list--notes li {
    border-style: dashed;
    background: var(--surface-muted);
}

.summary-email {
    white-space: normal;
    overflow-wrap: break-word;
    word-break: normal;
    display: block;
}

.summary-email-col {
    min-width: 260px;
    flex: 1 1 320px;
}

html, body {
    font-family: var(--font);
    background: var(--surface-muted);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}

a, .btn-link {
    color: var(--accent);
}

a:hover, .btn-link:hover {
    color: var(--accent-strong);
}

.btn-primary {
    color: #fff;
    background-color: var(--accent);
    border-color: var(--accent-strong);
    border-radius: var(--radius-sm);
    box-shadow: 0 4px 10px rgba(15, 108, 189, 0.18);
}

.btn-primary:hover {
    background-color: var(--accent-strong);
    border-color: var(--accent-strong);
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.2rem var(--accent);
}

.content {
    padding-top: 1.1rem;
    max-width: 1200px;
    margin: 0 auto;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    color: var(--text);
}

p, li, label, input, button, select, textarea {
    font-size: 15px;
    color: var(--text-muted);
}

.card-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.25rem;
    margin-bottom: 1.25rem;
}

.form-control, .form-select {
    border-radius: var(--radius-sm);
    border-color: #cfd4dc;
}

.table {
    background: var(--surface);
    border-radius: var(--radius);
    overflow: hidden;
}

.navbar.bg-dark {
    background-color: #111827 !important;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.navbar .nav-link {
    font-weight: 500;
    padding: 0.65rem 0.75rem;
}

.navbar .nav-link:hover {
    color: #e5f1fb !important;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZ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ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) 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;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
    text-align: start;
}

/* Order cards */
.order-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.25rem 1.35rem;
    margin-bottom: 1.25rem;
}

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

.order-card__title {
    font-weight: 700;
    color: var(--text);
}

.order-card__title .order-card__total {
    margin-left: 0.5rem;
    padding: 0.2rem 0.5rem;
    background: #fde8e8;
    color: #9b1c1c;
    border-radius: var(--radius-sm);
    font-weight: 700;
    box-shadow: inset 0 0 0 1px #f5c2c2;
}

.status-dots {
    margin-top: 0.35rem;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.55rem;
    background: #2b2f38;
    border: 1px solid #424752;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.status-dots__label {
    font-size: 0.85rem;
    color: #e4e7ec;
}

.status-dots__cancelled {
    font-size: 0.85rem;
    color: #d9534f;
    font-weight: 700;
}

/* Tablet & narrow desktop adjustments */
@media (max-width: 900px) {
    .status-dots svg {
        transform: scale(0.9);
        transform-origin: left center;
    }

    .order-card__row {
        flex-direction: column;
        align-items: flex-start;
    }

    .order-card__row label {
        min-width: 0;
    }

    .order-card__row .status-dots {
        margin-top: 0.15rem;
    }

    .order-card__title {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
    }

    .order-card__title .order-card__total {
        display: inline-block;
        margin-left: 0;
        margin-top: 0.2rem;
    }
}

/* Mobile tightening */
@media (max-width: 600px) {
    .status-dots {
        padding: 0.25rem 0.45rem;
        gap: 0.25rem;
    }

    .status-dots__label {
        font-size: 0.8rem;
    }

    .status-dots svg {
        transform: scale(0.8);
    }
}

.dot-inactive {
    fill: #d6d6d6;
}

.dot-active {
    fill: var(--accent-strong);
}


.dot-lit {
    animation: dot-wave 1.4s ease-in-out infinite;
    transform-box: fill-box;
    transform-origin: center;
    filter: none;
}

.dot-base {
    /* no-op, keeps existing fill */
}

.dot-cancelled {
    /* keeps red fill */
}

@keyframes dot-wave {
    0% {
        transform: translateY(0);
        filter: none;
    }
    50% {
        transform: translateY(-3px);
        filter: none;
    }
    100% {
        transform: translateY(0);
        filter: none;
    }
}

.order-card__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    align-items: center;
    margin-bottom: 0.75rem;
}

.order-card__file-actions {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 0.75rem 1rem;
    align-items: flex-start;
}

.order-card__file-actions--stack {
    /* Force vertical stacking when explicitly requested */
    display: flex;
    flex-direction: column;
    grid-template-columns: 1fr;
}

.order-card__file-block {
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm);
    padding: 0.85rem;
    background: var(--surface-muted);
}

.upload-tag .strong {
    color: var(--text);
    font-weight: 600;
}

.order-card__row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 0.75rem 0;
}

.order-card__row label {
    font-weight: 600;
    color: var(--text);
    min-width: 100px;
    margin: 0;
}

.order-card__controls {
    display: inline-flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.order-card__grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.75rem 1rem;
    margin: 0.75rem 0 1rem;
}

.open-order-page {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.75rem 1rem;
}

.summary-grid--wide {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.summary-item {
    padding: 0.25rem 0;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.message-editor {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 0.9rem;
}

.section-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.message-list {
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
}

.message-card {
    border: 1px solid var(--border);
    background: var(--surface-muted);
    border-radius: var(--radius-sm);
    padding: 0.75rem;
}

.message-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-bottom: 0.35rem;
}

.message-body {
    margin-top: 0.35rem;
    white-space: pre-wrap;
}

.order-card__notes {
    padding: 0.75rem;
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 0.75rem;
    background: var(--surface-muted);
}

.order-card__actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
}

.order-card__actions--secondary {
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
}

/* Let the secondary action area (files + notes) span full width so the Bootstrap row inside
   can lay out its columns without overlapping. */
.order-card__actions.order-card__actions--secondary {
    display: block;
    width: 100%;
}

.order-card__actions--secondary .row {
    width: 100%;
    margin-left: 0;
    margin-right: 0;
}

.details-toggle {
    padding: 0;
    margin-left: auto;
    font-weight: 600;
    color: var(--accent);
}

.details-panel {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.25s ease, opacity 0.2s ease;
}

.details-panel.open {
    max-height: 5000px;
    opacity: 1;
}

.order-card__grid--compact {
    gap: 0.5rem 1rem;
}

.order-card__footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.bom-panel {
    margin-top: 0.75rem;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface-muted);
}

.bom-panel__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.badge-soft-info {
    background: #e8f2fb;
    color: var(--accent-strong);
    padding: 0.3rem 0.55rem;
    border-radius: 999px;
    font-weight: 600;
    border: 1px solid #d4e6fb;
}

.pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.7rem;
    border-radius: 999px;
    background: var(--surface-muted);
    border: 1px solid var(--border);
    font-weight: 600;
    color: var(--text);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.pill--status {
    background: #e8f2fb;
    border-color: #d4e6fb;
    color: var(--accent-strong);
}

.pill--sign-doc {
    background: #fff1f1;
    border-color: #f4c2c2;
    color: #8f1d1d;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.pill--sign-doc:hover {
    background: #ffe5e5;
    border-color: #eeaaaa;
    color: #7f1515;
}

.pill--sign-doc:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(143, 29, 29, 0.2);
}

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

.strong {
    color: var(--text);
    font-weight: 600;
}

.eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--accent-strong);
    margin-bottom: 0.15rem;
}

.eng-home {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.page-header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: flex-start;
    flex-wrap: wrap;
}

.page-header__titles {
    max-width: 680px;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.header-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.header-meta {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 140px;
    text-align: right;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.75rem;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 0.9rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.stat-value {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text);
}

.loading-state,
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.55rem;
    text-align: center;
}

@media (max-width: 640px) {
    .page-header {
        flex-direction: column;
    }

    .header-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .header-meta {
        text-align: left;
    }
}

/* Control panel (staff hub) */
.control-header {
    margin: 0 0 1rem 0;
}

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

.control-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.control-card__title {
    font-weight: 700;
    color: var(--text);
}

.control-card__body {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

/* Pagination (Office-like) */
.pager {
    display: flex;
    justify-content: center;
    margin: 1rem 0 1.5rem;
}

.pager-list {
    list-style: none;
    display: inline-flex;
    gap: 6px;
    padding: 0;
    margin: 0;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.pager-item {
    display: inline-flex;
}

.pager-link {
    border: none;
    background: transparent;
    padding: 0.5rem 0.85rem;
    min-width: 40px;
    border-radius: 999px;
    font-weight: 600;
    color: var(--text);
    transition: background-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

@media (max-width: 600px) {
    .pager-list {
        gap: 2px;
    }

    .pager-link {
        padding: 0.25rem 0.4rem;
        min-width: 28px;
        font-size: 0.82rem;
    }

    .company-admin-link {
        text-align: center;
    }

    .company-admin-link__anchor {
        float: none !important;
        display: inline-block;
    }

    .order-card__footer {
        justify-content: center;
    }
}

.pager-link:hover {
    background: #e8f2fb;
    color: var(--accent-strong);
}

.pager-item.active .pager-link,
.pager-link:focus-visible {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 0 0 3px rgba(15, 108, 189, 0.2);
    outline: none;
}

/* Open order page */
.open-order-page {
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

#flashMessage {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(15, 108, 189, 0.95);
    color: white;
    padding: 14px 18px;
    border-radius: var(--radius);
    text-align: center;
    display: none;
    z-index: 1000;
    box-shadow: var(--shadow);
}

.open-order__summary .summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.4rem 1rem;
}

.summary-grid--wide .summary-item {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.open-order__addresses textarea {
    font-family: var(--font);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.04);
}

.open-order__notes .form-control,
.open-order__messages .form-control {
    border-radius: var(--radius-sm);
}

.open-order__messages .message-editor {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.section-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.message-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.message-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.75rem;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.message-meta {
    display: flex;
    gap: 0.35rem;
    align-items: baseline;
    margin-bottom: 0.25rem;
}

.message-body {
    background: var(--surface-muted);
    border-radius: var(--radius-sm);
    padding: 0.5rem 0.6rem;
    white-space: pre-wrap;
}

.hub-title {
    text-align: center;
}

.role-pill {
    margin: 2rem auto;
    border-radius: 3rem;
    background-color: lightgray;
    padding: 1rem;
    display: flex;
    justify-content: center;
    align-items: center;
    max-width: 340px;
}

.company-admin-link {
    text-align: center;
}

.company-admin-link__anchor {
    float: none !important;
    display: inline-block;
}
