/* ==========================================================================
   DLG (Dieline Genius) — Portal-specific styles
   Extends shared/static/css/common.css
   ========================================================================== */

/* ---------- Hero ---------- */

.hero {
    text-align: center;
    padding: 3rem 1rem;
    background: linear-gradient(135deg, var(--gray-900) 0%, #1e293b 100%);
    color: var(--white);
    border-radius: var(--radius-lg);
    margin-bottom: 2rem;
}

.hero h1 {
    color: var(--white);
    font-size: 2.4rem;
    margin-bottom: 0.5rem;
}

.hero-sub {
    font-size: 1.1rem;
    color: var(--gray-300);
    max-width: 700px;
    margin: 0 auto 1.5rem;
}

.hero-cta {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* ---------- Landing sections ---------- */

.landing-section {
    margin-bottom: 3rem;
}

.landing-section h2 {
    text-align: center;
    margin-bottom: 1.5rem;
}

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

.step-card {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    text-align: center;
}

.step-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--brand);
    color: var(--white);
    font-weight: 700;
    font-size: 1.2rem;
    margin-bottom: 0.75rem;
}

/* ---------- Group grid ---------- */

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

.group-card {
    display: block;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    overflow: hidden;
    text-decoration: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.group-thumb {
    width: 100%;
    height: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    overflow: hidden;
}

.group-thumb img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.group-card:hover {
    border-color: var(--brand);
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.group-card h2,
.group-card h3 {
    margin: 0 0 0.25rem;
    font-size: 1rem;
    color: var(--gray-900);
}

.group-card > h3 {
    padding: 0.75rem 1rem 0;
}

.group-code {
    display: inline-block;
    background: var(--gray-100);
    color: var(--gray-500);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
    margin-bottom: 0.25rem;
}

.group-count {
    font-size: 0.85rem;
    color: var(--gray-500);
    padding: 0 1rem 0.75rem;
    display: block;
}

/* ---------- Item grid ---------- */

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

.item-card {
    display: block;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    overflow: hidden;
    text-decoration: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.item-card:hover {
    border-color: var(--brand);
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.item-image {
    width: 100%;
    height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gray-100);
    overflow: hidden;
}

.item-image img {
    max-height: 100%;
    object-fit: contain;
}

.item-no-image {
    color: var(--gray-500);
    font-size: 0.85rem;
}

.item-info {
    padding: 0.75rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.item-info h3 {
    margin: 0;
    font-size: 0.9rem;
}

.item-price {
    font-weight: 600;
    color: var(--brand);
    white-space: nowrap;
}

/* ---------- Design detail ---------- */

.design-detail {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    align-items: start;
}

@media (max-width: 768px) {
    .design-detail { grid-template-columns: 1fr; }
}

.design-images {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.design-img-main,
.design-img-alt {
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    background: var(--white);
}

.design-form-area > h1:first-child {
    /* Browser-default h1 margin-top creates an unwanted gap above the
       title (above the design-images grid sibling's top edge looks
       flush; the title should match that). */
    margin-top: 0;
}

.design-price {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--brand);
    margin: 0.5rem 0 1rem;
}

.design-form {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 0.25rem;
    color: var(--gray-700);
}

.form-control {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 0.9rem;
}

.form-control:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 2px rgba(150, 28, 31, 0.15);
}

.unit-toggle {
    display: flex;
    gap: 1.5rem;
}

.unit-option {
    font-weight: normal;
    cursor: pointer;
}

/* S122 — fraction-syntax hint shown once below the unit toggle when
   inch mode is selected. Replaces per-row repetition. */
.design-form .inch-helper-bar {
    display: block;
    margin: 0.35rem 0 0;
    font-size: 0.8rem;
    font-style: italic;
    color: var(--gray-500);
}

/* S122 — compact single-row layout for /generate parameter fields.
   Layout: [label] [narrow input] [unit] [range hint] all on one line.
   Replaces the prior tall stacked layout where each param was
   3 lines (label / input-full-width / range hint). */
.design-form .param-group {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    margin-bottom: 0.4rem;
}

.design-form .param-group label {
    display: inline-block;
    margin-bottom: 0;
    /* Width fits the longest catalog field names like "HandHoleSpacing"
       (~15 chars) plus 5px right-padding for visual breathing room.
       Same width applies in both mm + inch modes — CSS is mode-agnostic;
       the JS at design.html:133 only toggles input.type + values + unit
       label visibility, never re-styles. */
    width: 160px;
    padding-right: 5px;
    text-align: left;
    flex-shrink: 0;
    font-size: 0.85rem;
}

/* Let inner wrapper's children participate in the param-group flex
   without restructuring the template. */
.design-form .param-input-row {
    display: contents;
}

.param-input-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Specificity 0,3,1 beats common.css `.form-group input[type="text"]`
   at 0,2,1. Without this, the JS unit-toggle that flips input.type=text
   for inch mode lets common.css inflate the input to width:100% +
   9px/12px padding, which breaks the compact one-row layout. */
.design-form .param-group input.param-input,
.design-form .param-group input.param-input[type="text"],
.design-form .param-group input.param-input[type="number"] {
    width: 80px;
    flex: 0 0 auto;
    padding: 0.3rem 0.5rem;
    font-size: 0.85rem;
}

.param-input {
    width: auto;
    flex: 1;
}

.param-unit {
    font-size: 0.85rem;
    color: var(--gray-500);
    min-width: 2em;
}

.design-form .param-unit {
    min-width: 0;
}

.param-range,
.param-hint {
    color: var(--gray-500);
    font-size: 0.8rem;
}

.design-form .param-range,
.design-form .param-hint {
    margin: 0;
    font-size: 0.75rem;
    white-space: nowrap;
}

.param-hint {
    font-style: italic;
}

.form-actions {
    margin-top: 1.5rem;
}

.design-output-info {
    margin-top: 2rem;
    padding: 1rem 1.5rem;
    background: var(--gray-100);
    border-radius: var(--radius);
}

.design-output-info h3 { margin-top: 0; }
.design-output-info ul { padding-left: 1.2rem; }

/* ---------- Breadcrumb ---------- */

.breadcrumb {
    font-size: 0.85rem;
    margin-bottom: 1rem;
    color: var(--gray-500);
}

.breadcrumb a {
    color: var(--gray-500);
    text-decoration: none;
}

.breadcrumb a:hover { color: var(--brand); }

/* ---------- Cart ---------- */

.cart-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.cart-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
}

.cart-item-info { flex: 1; }
.cart-item-info h3 { margin: 0 0 0.25rem; font-size: 1rem; }

.cart-item-design,
.cart-item-units {
    font-size: 0.85rem;
    color: var(--gray-500);
    margin: 0;
}

.cart-item-params {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 0.5rem;
}

.param-badge {
    display: inline-block;
    background: var(--gray-100);
    color: var(--gray-700);
    font-size: 0.75rem;
    padding: 0.15rem 0.5rem;
    border-radius: 3px;
}

.cart-item-price {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--brand);
    white-space: nowrap;
}

.cart-summary {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1.25rem;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
}

.cart-total {
    font-size: 1.2rem;
    font-weight: 600;
}

.cart-total-amount {
    color: var(--brand);
    margin-left: 0.5rem;
}

/* S97.E — AC equivalent shown alongside USD in the summary line. */
.cart-total-ac {
    color: var(--gray-600, #666);
    font-size: 0.95rem;
    font-weight: 500;
    margin-left: 0.25rem;
}

/* S97.E — wallet status line (balance + shortfall hint, or admin-free notice). */
.cart-wallet-line {
    font-size: 0.95rem;
    color: var(--gray-700, #444);
}

.cart-wallet-line a {
    margin-left: 0.25rem;
}

.cart-wallet-free {
    color: var(--brand);
}

.cart-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* Disabled wallet button when balance < required. Browser default is
   workable but we want the cursor + opacity hint to be obvious. */
.cart-actions button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

/* S97.E.1 — submit-progress affordance on the checkout buttons. Mirrors
   the S96.B.1 admin-health-form pattern (CSS-only spinner + elapsed-
   seconds counter). Triggered by the inline JS at the end of cart.html
   when a form fires submit; absorbs duplicate clicks while the resolver
   round-trip is in flight. Distinct cursor state vs the always-disabled
   case above (progress vs not-allowed).
   S124 — gate on .is-submitting set by the cart.html JS handler on
   submit; without this, the server-rendered disabled attr (insufficient
   funds) ALSO matched button[disabled] and showed a spinning-progress
   cursor on hover even with no submit in flight, mimicking a hung
   request. The .cart-actions button:disabled rule above (cursor:
   not-allowed) now wins for the pre-click state by source order. */
.cart-progress-form.is-submitting button[disabled] {
    opacity: 0.6;
    cursor: progress;
}
.cart-progress {
    display: none;
    margin-left: 10px;
    font-size: 12px;
    color: var(--gray-700, #5f6368);
    vertical-align: middle;
    white-space: nowrap;
}
.cart-progress.is-running {
    display: inline-flex;
    align-items: center;
}
.cart-progress-spinner {
    display: inline-block;
    width: 11px;
    height: 11px;
    border: 2px solid #c8c8c8;
    border-top-color: var(--brand);
    border-radius: 50%;
    animation: cart-spin 0.8s linear infinite;
    vertical-align: -2px;
    margin-right: 6px;
}
@keyframes cart-spin { to { transform: rotate(360deg); } }

/* ---------- Orders ---------- */

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

.order-card {
    display: block;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    text-decoration: none;
    transition: border-color 0.15s;
}

.order-card:hover { border-color: var(--brand); }

.order-card-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.order-id {
    font-weight: 600;
    color: var(--gray-900);
}

.order-date {
    font-size: 0.85rem;
    color: var(--gray-500);
}

.order-card-design {
    margin: 4px 0 6px;
    font-size: 0.95rem;
    color: var(--gray-800);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.order-card-body {
    display: flex;
    gap: 1rem;
    align-items: center;
    font-size: 0.9rem;
    color: var(--gray-700);
}

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

/* ---------- Order detail ---------- */

.order-header {
    margin-bottom: 1.5rem;
}

.order-meta {
    display: flex;
    gap: 1rem;
    align-items: center;
    font-size: 0.9rem;
}

.order-items {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.order-item-card {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 1.25rem;
}

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

.order-item-header h3 { margin: 0; }
.order-item-price { font-weight: 600; color: var(--brand); }

.order-item-design {
    font-size: 0.85rem;
    color: var(--gray-500);
    margin: 0.25rem 0;
}

.order-item-params {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin: 0.5rem 0;
}

.order-item-downloads {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--gray-200);
}

.order-item-downloads h4 { margin: 0 0 0.5rem; font-size: 0.9rem; }

.download-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.download-btn {
    font-size: 0.8rem;
}

.order-item-pending {
    margin-top: 0.75rem;
}

.order-item-staff-note {
    margin-top: 0.75rem;
    padding: 0.75rem 1rem;
    background: #eff6ff;
    border-left: 3px solid #3b82f6;
    border-radius: var(--radius);
}

.order-item-staff-note p { margin: 0 0 0.25rem; }
.order-item-staff-note p:last-child { margin: 0; }

.staff-note-sub {
    font-size: 0.85rem;
    color: var(--gray-500);
}

.staff-note-text {
    white-space: pre-wrap;
    font-size: 0.9rem;
    line-height: 1.5;
}

/* ---------- Badges ---------- */

.badge {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.2rem 0.6rem;
    border-radius: 3px;
}

.badge-success {
    background: var(--success-bg);
    color: var(--success);
}

.badge-pending {
    background: #fef3c7;
    color: #92400e;
}

/* ---------- Formats grid ---------- */

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

.format-item {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 0.75rem;
    text-align: center;
    font-size: 0.85rem;
}

/* ---------- Empty state ---------- */

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--gray-500);
}

.empty-state p { margin-bottom: 1rem; }

/* ---------- Disclaimer ---------- */

.disclaimer {
    font-size: 0.75rem;
    color: var(--gray-500);
    text-align: center;
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--gray-200);
}

/* ---------- Catalog intro ---------- */

.catalog-intro {
    color: var(--gray-500);
    margin-bottom: 1.5rem;
}

.catalog-grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}

.group-card-header {
    margin-bottom: 0.5rem;
    padding: 0.75rem 1rem 0;
}

/* ==========================================================================
   Admin
   ========================================================================== */

/* ---------- Stats cards ---------- */

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

.admin-stat-card {
    display: block;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    text-align: center;
    text-decoration: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.admin-stat-card:hover {
    border-color: var(--brand);
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.admin-stat-card.stat-alert {
    border-color: var(--danger);
    background: var(--danger-bg);
}

.stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--gray-900);
    line-height: 1.2;
}

.stat-alert .stat-number { color: var(--danger); }

.stat-label {
    font-size: 0.85rem;
    color: var(--gray-500);
    margin-top: 0.25rem;
}

/* ---------- Resolver panel ---------- */

.admin-section {
    margin-bottom: 2rem;
}

.resolver-panel {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
}

.resolver-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.resolver-indicator { font-size: 1.2rem; }
.status-ok { color: var(--success); }
.status-down { color: var(--danger); }
.status-checking { color: var(--warning); }

.resolver-vm-info {
    font-size: 0.85rem;
    color: var(--gray-500);
    margin-bottom: 0.75rem;
}

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

.admin-quick-links {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.btn-danger {
    background: var(--danger);
    color: var(--white);
    border-color: var(--danger);
}

.btn-danger:hover {
    background: #b91c1c;
    border-color: #b91c1c;
    color: var(--white);
}

.btn-danger:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-warning {
    background: #f59e0b;
    color: var(--white);
    border-color: #f59e0b;
}

.btn-warning:hover {
    background: #d97706;
    border-color: #d97706;
    color: var(--white);
}

.reboot-status {
    margin-top: 0.75rem;
    padding: 0.75rem;
    background: #fef3c7;
    border-radius: var(--radius);
    font-size: 0.9rem;
    color: #92400e;
}

/* ---------- Filters ---------- */

.admin-filters {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

/* ---------- Toolbar (search, sort, page size) ---------- */

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

.admin-search-form {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex: 1;
    min-width: 250px;
}

.admin-search-input {
    max-width: 300px;
}

.admin-toolbar-right {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.admin-toolbar-label {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.85rem;
    color: var(--gray-500);
    white-space: nowrap;
}

.admin-toolbar-select {
    width: auto;
    padding: 0.3rem 0.5rem;
    font-size: 0.85rem;
}

.admin-results-info {
    font-size: 0.85rem;
    color: var(--gray-500);
    margin-bottom: 0.75rem;
}

/* ---------- Admin table ---------- */

.admin-table-wrap {
    overflow-x: auto;
}

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

.admin-table th {
    text-align: left;
    font-weight: 600;
    color: var(--gray-500);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 0.6rem 0.75rem;
    border-bottom: 2px solid var(--gray-200);
    white-space: nowrap;
}

.admin-table td {
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid var(--gray-100);
    vertical-align: top;
}

.admin-table tbody tr:hover {
    background: var(--gray-50);
}

.admin-customer-link {
    text-decoration: none;
    display: block;
}

.admin-customer-link:hover strong { color: var(--brand); }

.admin-customer-email {
    display: block;
    font-size: 0.8rem;
    color: var(--gray-500);
}

/* ---------- Pagination ---------- */

.admin-pagination {
    display: flex;
    gap: 0.35rem;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--gray-200);
}

.admin-page-info {
    font-size: 0.85rem;
    color: var(--gray-500);
    margin-left: 0.5rem;
}

/* ---------- Jobs list ---------- */

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

.admin-item-card {
    display: block;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    text-decoration: none;
    transition: border-color 0.15s;
}

.admin-item-card:hover { border-color: var(--brand); }

.admin-item-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.admin-item-id {
    font-weight: 600;
    color: var(--gray-900);
}

.admin-item-date {
    font-size: 0.85rem;
    color: var(--gray-500);
}

.admin-item-body {
    margin-bottom: 0.5rem;
}

.admin-item-design {
    font-size: 0.95rem;
    color: var(--gray-900);
    margin-bottom: 0.25rem;
}

.admin-item-group {
    font-size: 0.85rem;
    color: var(--gray-500);
    margin-left: 0.5rem;
}

.admin-item-customer {
    font-size: 0.85rem;
    color: var(--gray-500);
    margin-bottom: 0.35rem;
}

.admin-item-email { font-size: 0.8rem; }

.admin-item-order {
    font-weight: normal;
    color: var(--gray-500);
    font-size: 0.85rem;
}

.admin-item-price {
    font-weight: 600;
    color: var(--brand);
    margin-left: 0.5rem;
}

.admin-item-params {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 0.35rem;
}

.admin-item-footer {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    margin-top: 0.5rem;
}

.admin-item-meta {
    font-size: 0.8rem;
    color: var(--gray-500);
}

/* ---------- Badge variants ---------- */

.badge-suspended {
    background: #e0e7ff;
    color: #3730a3;
}

.badge-info {
    background: #dbeafe;
    color: #1e40af;
}

.badge-error {
    background: var(--danger-bg);
    color: var(--danger);
}

/* ---------- Job detail ---------- */

.admin-item-detail-header {
    margin-bottom: 1.5rem;
}

.admin-item-detail-header h1 { margin-bottom: 0.5rem; }

.admin-item-badges {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.admin-detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

@media (max-width: 768px) {
    .admin-detail-grid { grid-template-columns: 1fr; }
}

.admin-detail-section {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 1rem;
}

.admin-detail-section h2 {
    font-size: 1rem;
    margin: 0 0 0.75rem;
}

.admin-detail-section h3 {
    font-size: 0.9rem;
    margin: 1rem 0 0.5rem;
}

.admin-info-table {
    width: 100%;
    font-size: 0.9rem;
}

.admin-info-table td {
    padding: 0.3rem 0;
    vertical-align: top;
}

.admin-info-table td:first-child {
    font-weight: 600;
    color: var(--gray-500);
    width: 160px;
    padding-right: 1rem;
}

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

.param-original {
    background: #fef3c7;
    color: #92400e;
}

/* ---------- Staff note ---------- */

.admin-staff-note {
    border-left: 3px solid #3b82f6;
}

.staff-note-text {
    white-space: pre-wrap;
    font-size: 0.9rem;
    line-height: 1.5;
}

.staff-upload-meta {
    display: block;
    font-size: 0.75rem;
    color: var(--gray-500);
    margin-top: 0.15rem;
}

/* ---------- Action sections ---------- */

.admin-divider {
    border: none;
    border-top: 2px solid var(--gray-200);
    margin: 2rem 0;
}

.admin-action-section {
    border-left: 3px solid var(--gray-300);
}

.admin-help-text {
    font-size: 0.85rem;
    color: var(--gray-500);
    margin: 0 0 0.75rem;
}

.admin-param-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.admin-quick-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--gray-200);
}

.inline-form { display: inline; }

.flash {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 14px;
    border-radius: 4px;
    margin-bottom: 16px;
    font-size: 0.95rem;
    border: 1px solid transparent;
}
.flash-ok   { background: #e6f4ea; border-color: #34a853; color: #145a32; }
.flash-fail { background: #fbe9e9; border-color: #d93025; color: #6e1b1b; }
.flash-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 22px; height: 22px;
    border-radius: 50%;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}
.flash-ok .flash-icon   { background: #34a853; }
.flash-fail .flash-icon { background: #d93025; }
.flash-text { flex: 1; }
.flash-close {
    background: transparent; border: none;
    font-size: 20px; line-height: 1;
    cursor: pointer; color: inherit; opacity: 0.6;
    padding: 0 4px;
}
.flash-close:hover { opacity: 1; }

.resolution-panel {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--gray-200);
}

.admin-refunded {
    border-left: 3px solid var(--success);
}

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

/* ---------- Order summary ---------- */

.admin-order-summary {
    border-left: 3px solid var(--gray-300);
}

.order-summary-stats {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    font-size: 0.9rem;
    color: var(--gray-500);
    margin-bottom: 0.75rem;
}

.admin-siblings-table {
    width: 100%;
    font-size: 0.85rem;
    border-collapse: collapse;
}

.admin-siblings-table th {
    text-align: left;
    font-weight: 600;
    color: var(--gray-500);
    padding: 0.4rem 0.5rem;
    border-bottom: 1px solid var(--gray-200);
}

.admin-siblings-table td {
    padding: 0.4rem 0.5rem;
    border-bottom: 1px solid var(--gray-100);
}

.sibling-current {
    background: var(--gray-50);
    font-weight: 600;
}

.admin-param-row label {
    display: block;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--gray-700);
    margin-bottom: 0.2rem;
}

.admin-param-row .param-input {
    width: 100%;
}

/* ---------- Drop zone (staff upload) ---------- */

.drop-zone {
    border: 2px dashed var(--gray-300);
    border-radius: var(--radius);
    padding: 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    position: relative;
}

.drop-zone:hover,
.drop-zone.is-hot {
    border-color: var(--brand);
    background: var(--brand-bg);
}

.drop-zone-input {
    position: absolute;
    left: 0; top: 0;
    width: 100%; height: 100%;
    opacity: 0;
    cursor: pointer;
}

.drop-zone-prompt {
    color: var(--gray-500);
    font-size: 0.9rem;
    margin: 0;
    pointer-events: none;
}

.drop-zone-list {
    list-style: none;
    padding: 0;
    margin: 0.5rem 0 0;
    text-align: left;
}

.drop-zone-file {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    font-size: 0.85rem;
    padding: 0.25rem 0;
}

.file-name {
    font-weight: 600;
    color: var(--gray-900);
}

.file-size {
    color: var(--gray-500);
    font-size: 0.8rem;
}

/* ---------- Sub-nav ----------
   Secondary horizontal navigation strip rendered by _dispatcher_base.html
   when wearing packops chrome — surfaces Catalog / Cart / My Orders /
   Admin under the packops top nav so /generate/* pages don't require
   bouncing to dieline-genius.com to reach the DLG sub-pages.
*/
.subnav {
    background: var(--gray-100);
    border-bottom: 1px solid var(--gray-200);
}
.subnav-inner {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 8px 24px;
    display: flex;
    gap: 18px;
    align-items: center;
    font-size: 0.92em;
}
.subnav-label {
    color: var(--gray-500);
    font-weight: 600;
    font-size: 0.85em;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-right: 6px;
}
.subnav-inner a {
    color: var(--gray-700);
    text-decoration: none;
    padding: 4px 10px;
    border-radius: 4px;
    transition: background 0.12s;
}
.subnav-inner a:hover {
    background: var(--gray-200);
    color: var(--gray-900);
}
.subnav-inner a.active {
    background: var(--white);
    color: var(--brand);
    font-weight: 600;
    border: 1px solid var(--gray-200);
}

/* ---------- DLG order/job preview thumb ----------
   Medium-size dieline preview rendered on demand by /generated/<id>/preview.png
   (lazy pdftoppm of the resolver PDF page 1). Surfaced on order_detail.html
   and admin_job_detail.html alongside the download links + View button so
   users can see what they're getting before clicking through.
*/
.dlg-preview-thumb {
    display: block;
    max-width: 360px;
    max-height: 280px;
    width: auto;
    height: auto;
    margin: 14px 0;
    border: 1px solid var(--gray-200);
    border-radius: 4px;
    background: var(--white);
    padding: 6px;
    box-sizing: border-box;
}

/* Inline spinner for busy admin buttons (resubmit, substitute, etc.) — the
   resolver round-trip can be 30s+ and a quiet button feels like a hang. */
.spinner-inline {
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: dlg-spin 0.8s linear infinite;
    vertical-align: -2px;
    margin-right: 4px;
}
@keyframes dlg-spin {
    to { transform: rotate(360deg); }
}

/* Smaller variant for the orders list — same source PNG, sized down via CSS. */
.dlg-preview-thumb-sm {
    display: block;
    max-width: 140px;
    max-height: 100px;
    width: auto;
    height: auto;
    border: 1px solid var(--gray-200);
    border-radius: 3px;
    background: var(--white);
    padding: 3px;
    box-sizing: border-box;
}

/* ---------- DLG order .tab summary ----------
   Two-column key/value table parsed from <order_no>.tab and rendered
   beside the preview thumb on order_detail / admin_job_detail. The
   .dlg-tab-flex wrapper puts the thumb left and the table right; wraps
   on narrow viewports. .order-dims is the tiny dims line on the orders
   list cards next to the existing badges.
*/
.dlg-tab-flex {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 16px;
    margin: 14px 0;
}
.dlg-tab-flex .dlg-preview-thumb { margin: 0; }

.dlg-tab-table {
    border-collapse: collapse;
    font-size: 13px;
    line-height: 1.5;
}
.dlg-tab-table th,
.dlg-tab-table td {
    text-align: left;
    padding: 3px 10px 3px 0;
    vertical-align: top;
    white-space: nowrap;
}
.dlg-tab-table th {
    color: #555;
    font-weight: 500;
    padding-right: 14px;
}
.dlg-tab-table td {
    color: #222;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}

.order-dims {
    color: #666;
    font-variant-numeric: tabular-nums;
}

/* ---------- Folded indicator (Arc B.3) ----------
   When a fold-3d Job exists for a DLG OrderItem, render a small green
   checkmark badge in the top-right of the dieline preview thumb so users
   see at a glance which orders/items have been folded in 3D. The wrap div
   anchors absolute-positioning of the badge over the existing thumb image.
*/
.dlg-preview-wrap {
    position: relative;
    display: inline-block;
    line-height: 0;  /* drop the inline-image baseline gap */
}
.dlg-preview-wrap .dlg-preview-thumb,
.dlg-preview-wrap .dlg-preview-thumb-sm { margin: 0; }

/* S64 — pair the dieline thumb with the folded thumb side-by-side. */
.dlg-preview-pair {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: flex-start;
    gap: 6px;
    line-height: 0;
}
.dlg-preview-pair > img {
    flex: 0 0 auto;
}
.dlg-preview-pair .dlg-preview-thumb-folded {
    border: 1px solid #16a34a;
    border-radius: 3px;
}

.folded-flag {
    position: absolute;
    top: 4px;
    right: 4px;
    background: #16a34a;
    color: #fff;
    font-size: 14px;
    line-height: 1;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 2px rgba(0,0,0,0.2);
    pointer-events: none;
}
.dlg-preview-thumb-sm + .folded-flag,
.dlg-preview-wrap .dlg-preview-thumb-sm ~ .folded-flag {
    width: 18px;
    height: 18px;
    font-size: 11px;
    top: 3px;
    right: 3px;
}

/* Action row beneath the thumb — currently used by order_detail and
   admin_job_detail for the fold-3d link(s). Replaces inline margin-top
   styles that previously lived on the wrapping div. */
.dlg-action-row {
    margin-top: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
