/* Material Exchange Styles */

/* Override blueprint variables to remove borders */
:root {
    --bp-border-color: transparent;
    --me-quick-bg: linear-gradient(145deg, rgba(255, 237, 213, 0.5), rgba(232, 253, 245, 0.55));
    --me-card-bg: #f8fafc;
    --me-card-border: rgba(15, 23, 42, 0.08);
    --me-card-text: #0f172a;
    --me-card-muted: #475569;
    --me-success: var(--bs-success, #198754);
    --me-success-soft: rgba(25, 135, 84, 0.15);
    --me-primary: var(--bs-primary, #0d6efd);
    --me-primary-soft: rgba(13, 110, 253, 0.15);
    --me-info: var(--bs-info, #0dcaf0);
    --me-info-soft: rgba(var(--bs-info-rgb), 0.16);
    --me-buy-accent: var(--me-info);
}

html[data-theme="darkly"] {
    --me-quick-bg: linear-gradient(145deg, rgba(51, 65, 85, 0.6), rgba(15, 23, 42, 0.85));
    --me-card-bg: rgba(15, 23, 42, 0.85);
    --me-card-border: rgba(148, 163, 184, 0.18);
    --me-card-text: #f8fafc;
    --me-card-muted: #cbd5f5;
    --me-success-soft: rgba(25, 135, 84, 0.25);
    --me-primary-soft: rgba(13, 110, 253, 0.25);
    --me-info: var(--bs-info, #22d3ee);
    --me-info-soft: rgba(var(--bs-info-rgb), 0.24);
    --me-buy-accent: var(--me-info);
}

.me-hub-banner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 0.85rem 1.25rem;
    border-radius: 14px;
    margin: 0 0 1.5rem;
    background: linear-gradient(90deg, rgba(13, 110, 253, 0.18), rgba(25, 135, 84, 0.18));
    border: 1px solid rgba(13, 110, 253, 0.35);
    color: var(--bs-body-color, #0f172a);
    font-weight: 600;
    letter-spacing: 0.02em;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.1);
    text-align: center;
}

.me-hub-banner i {
    font-size: 1.1rem;
    color: var(--me-primary, #0d6efd);
}

.me-hub-banner-label {
    text-transform: none;
    font-size: 1rem;
    letter-spacing: 0.02em;
    color: inherit;
    font-weight: 600;
}

.me-hub-banner-value {
    font-size: 1rem;
    color: var(--me-card-text, #0f172a);
    font-weight: 600;
}

.me-superuser-warning {
    position: relative;
    overflow: hidden;
    isolation: isolate;
}

.me-superuser-warning::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: -60%;
    width: 50%;
    pointer-events: none;
    background: linear-gradient(
        110deg,
        rgba(255, 255, 255, 0),
        rgba(255, 255, 255, 0.62),
        rgba(255, 255, 255, 0)
    );
    z-index: 1;
    animation: meSuperuserWarningShine 1s ease-in-out 2;
}

@keyframes meSuperuserWarningShine {
    from {
        transform: translateX(0) skewX(-16deg);
    }
    to {
        transform: translateX(320%) skewX(-16deg);
    }
}

@media (prefers-reduced-motion: reduce) {
    .me-superuser-warning {
        animation: none;
    }

    .me-superuser-warning::after {
        animation: none;
    }
}

html[data-theme="darkly"] .me-hub-banner {
    background: linear-gradient(90deg, rgba(13, 110, 253, 0.22), rgba(25, 135, 84, 0.22));
    border-color: rgba(148, 163, 184, 0.35);
    color: var(--me-card-text, #f8fafc);
}

html[data-theme="darkly"] .me-hub-banner-label {
    color: rgba(248, 250, 252, 0.7);
}

.me-hub-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.me-hub-action-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 18px 16px;
    border-radius: 12px;
    background: var(--me-card-bg);
    border: 1px solid var(--me-card-border);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
}

.me-hub-action-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    font-size: 1.1rem;
    background: rgba(15, 23, 42, 0.06);
    color: var(--me-card-text);
    margin-bottom: 10px;
}

.me-hub-action-card[data-accent="success"] .me-hub-action-icon {
    background: var(--me-success-soft);
    color: var(--me-success);
}

.me-hub-action-card[data-accent="info"] .me-hub-action-icon {
    background: var(--me-info-soft);
    color: var(--me-info);
}

.me-hub-action-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--me-card-text);
    line-height: 1.2;
    margin-bottom: 6px;
}

.me-hub-action-badge {
    display: inline-block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--me-card-text);
    padding: 4px 12px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.1);
    margin-bottom: 8px;
    text-transform: lowercase;
}

.me-hub-action-card[data-accent="success"] .me-hub-action-badge {
    background: var(--me-success-soft);
    color: var(--me-success);
}

.me-hub-action-card[data-accent="info"] .me-hub-action-badge {
    background: var(--me-info-soft);
    color: var(--me-info);
}

.me-hub-action-desc {
    font-size: 0.82rem;
    color: var(--me-card-muted);
    line-height: 1.3;
    margin-bottom: 12px;
}

.me-hub-action-btn {
    font-size: 0.875rem;
    padding: 0.375rem 1rem;
    font-weight: 600;
}

@media (max-width: 992px) {
    .me-hub-actions {
        grid-template-columns: 1fr;
    }
}

.me-quick-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
    padding: 18px;
    margin-bottom: 24px;
    border-radius: 18px;
    background: transparent;
    border: none;
    position: relative;
    overflow: hidden;
}

.me-quick-stats::before {
    content: none;
}

.me-stat-card {
    position: relative;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 18px;
    border-radius: 16px;
    background: var(--me-card-bg);
    border: 1px solid var(--me-card-border);
    color: var(--me-card-text);
    box-shadow: 0 14px 30px rgba(15, 23, 42, 0.08);
    overflow: hidden;
    font-family: Sora, "Space Grotesk", "DM Sans", sans-serif;
    animation: meStatIn 0.55s ease both;
}

.me-stat-card:nth-child(2) {
    animation-delay: 0.08s;
}

.me-stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    font-size: 20px;
    color: var(--me-card-text);
    background: rgba(15, 23, 42, 0.06);
}

.me-stat-content {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.me-stat-label {
    font-size: 0.8rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--me-card-muted);
    font-weight: 600;
}

.me-stat-value {
    font-size: 1.6rem;
    font-weight: 700;
    line-height: 1;
}

.me-stat-glow {
    position: absolute;
    inset: auto -20% -40% auto;
    width: 180px;
    height: 180px;
    border-radius: 50%;
    opacity: 0.35;
    pointer-events: none;
}

.me-stat-card[data-accent="success"] .me-stat-icon {
    background: var(--me-success-soft);
    color: var(--me-success);
}

.me-stat-card[data-accent="success"] .me-stat-glow {
    background: radial-gradient(circle, var(--me-success), transparent 70%);
}

.me-stat-card[data-accent="primary"] .me-stat-icon {
    background: var(--me-primary-soft);
    color: var(--me-primary);
}

.me-stat-card[data-accent="primary"] .me-stat-glow {
    background: radial-gradient(circle, var(--me-primary), transparent 70%);
}

@keyframes meStatIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Unified status pills (used on lists, admin, detail) */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    background: #ffffff;
    color: #0f172a;
    font-weight: 700;
    font-size: 12px;
    letter-spacing: 0.2px;
    text-transform: none;
}

.status-badge .status-icon {
    color: inherit;
    font-size: 0.9rem;
}

/* New workflow statuses */
.status-badge.status-awaiting_validation {
    background: #fef3c7;
    border-color: #f59e0b;
    color: #b45309;
}

.status-badge.status-validated {
    background: #e0f2fe;
    border-color: #38bdf8;
    color: #075985;
}

.status-badge.status-accepted {
    background: #e0f2fe;
    border-color: #60a5fa;
    color: #1d4ed8;
}

.status-badge.status-completed {
    background: #dcfce7;
    border-color: #22c55e;
    color: #166534;
}

.status-badge.status-draft {
    background: #e2e8f0;
    border-color: #cbd5e1;
    color: #475569;
}

.status-badge.status-rejected {
    background: #fee2e2;
    border-color: #ef4444;
    color: #991b1b;
}

.status-badge.status-anomaly,
.status-badge.status-anomaly_rejected {
    background: #fef3c7;
    border-color: #f59e0b;
    color: #92400e;
}

.status-badge.status-cancelled {
    background: #e5e7eb;
    border-color: #9ca3af;
    color: #475569;
}

/* Legacy statuses kept for compatibility */
.status-pending {
    background-color: #ffc107;
    color: var(--indy-text-primary, #000);
}

html[data-theme="darkly"] .status-pending {
    color: #222;
}

.status-approved {
    background-color: #17a2b8;
    color: #fff;
}

/* Stock table styles for buy.html and sell.html */
.stock-table th {
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stock-table tbody tr {
    transition: all 0.2s ease;
}

.stock-table tbody tr:hover {
    border-left: 3px solid;
}

.item-icon {
    width: 48px;
    height: 48px;
    border-radius: 6px;
    padding: 4px;
}

.qty-input {
    max-width: 120px;
    width: 100%;
}

.qty-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.qty-input-row {
    display: grid;
    grid-template-columns: minmax(120px, 1fr) auto;
    align-items: center;
    column-gap: 8px;
    justify-content: center;
}

.qty-btns {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.qty-btns .btn {
    padding: 0.2rem 0.5rem;
    font-size: 0.75rem;
    line-height: 1.2;
    min-width: 46px;
}

.qty-btns .btn .fas {
    font-size: 0.75rem;
}

.me-info-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0.65rem 1rem;
    margin-bottom: 0.85rem;
    border-radius: 12px;
    border: 1px solid rgba(13, 110, 253, 0.2);
    background: rgba(13, 110, 253, 0.06);
    color: var(--me-card-text, #0f172a);
    font-size: 0.92rem;
}

.me-info-bar i {
    color: var(--me-primary, #0d6efd);
}

.me-info-bar-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.me-info-bar-title {
    font-weight: 700;
}

.me-info-bar-sub {
    color: var(--me-card-muted, #475569);
    font-size: 0.85rem;
}

.me-instruction-chip {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    border-radius: 12px;
    border: 1px solid rgba(25, 135, 84, 0.25);
    background: rgba(25, 135, 84, 0.1);
    color: var(--me-card-text, #0f172a);
}

.me-instruction-chip i {
    color: var(--me-success, #198754);
}

.me-instruction-title {
    font-weight: 700;
}

.me-instruction-sub {
    color: var(--me-card-muted, #475569);
    font-size: 0.85rem;
}

.me-character-tabs .nav-link {
    font-weight: 600;
    border: 1px solid rgba(var(--bs-secondary-rgb), 0.25);
    background: rgba(var(--bs-secondary-rgb), 0.06);
    color: var(--bs-body-color);
    padding: 0.35rem 0.7rem;
}

.me-character-tabs .nav-link:hover {
    background: rgba(var(--bs-secondary-rgb), 0.12);
}

.me-character-tabs .nav-link.active {
    background: rgba(var(--bs-success-rgb), 0.16);
    border-color: rgba(var(--bs-success-rgb), 0.45);
    color: var(--bs-success);
}

.me-character-tabs .nav-link .badge {
    font-size: 0.72rem;
}

html[data-theme="darkly"] .me-info-bar {
    border-color: rgba(148, 163, 184, 0.3);
    background: rgba(148, 163, 184, 0.12);
}

html[data-theme="darkly"] .me-instruction-chip {
    border-color: rgba(34, 197, 94, 0.3);
    background: rgba(34, 197, 94, 0.12);
}

.qty-input.is-invalid {
    border-color: var(--bs-danger);
}

.qty-error {
    color: var(--bs-danger);
    font-size: 0.85rem;
    margin-top: 0.25rem;
    display: none;
}

.invoice-panel {
    position: sticky;
    top: 20px;
}

.invoice-item {
    padding: 0.75rem 0;
    border-bottom: 1px solid rgba(var(--bs-border-color-rgb), 0.5);
}

.invoice-item:last-child {
    border-bottom: none;
}

/* Buy.html specific */
html[data-theme="darkly"] .stock-table th {
    background: rgba(var(--bs-primary-rgb), 0.1);
}

html[data-theme="darkly"] .stock-table tbody tr:hover {
    background: rgba(var(--bs-primary-rgb), 0.03);
}

html[data-theme="darkly"] .stock-table tbody tr.selected {
    background: rgba(var(--bs-primary-rgb), 0.08);
    border-left-color: var(--bs-primary);
}

html[data-theme="darkly"] .item-icon {
    background: rgba(var(--bs-primary-rgb), 0.05);
}

/* Sell.html specific */
html[data-theme="darkly"] .material-exchange.sell .stock-table th {
    background: rgba(var(--bs-success-rgb), 0.1);
}

html[data-theme="darkly"] .material-exchange.sell .stock-table tbody tr:hover {
    background: rgba(var(--bs-success-rgb), 0.03);
}

html[data-theme="darkly"] .material-exchange.sell .stock-table tbody tr.selected {
    background: rgba(var(--bs-success-rgb), 0.08);
    border-left-color: var(--bs-success);
}

html[data-theme="darkly"] .material-exchange.sell .item-icon {
    background: rgba(var(--bs-success-rgb), 0.05);
}

/* Detail card styles - used in sell.html line 294 */
.detail-card {
    padding: 1rem;
    border-radius: 0.375rem;
    border-left: 3px solid var(--bs-info);
}

.detail-value {
    font-size: 1.1rem;
    margin-top: 0.5rem;
    color: var(--bs-body-color);
}

.items-list .item-row {
    padding: 0.75rem;
    border-bottom: 1px solid rgba(var(--bs-border-color-rgb), 0.2);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.items-list .item-row:last-child {
    border-bottom: none;
}

.items-list .item-name {
    font-weight: 500;
}

.items-list .item-qty {
    color: var(--bs-info);
    font-weight: 500;
}

html[data-theme="darkly"] .detail-card {
    background: rgba(var(--bs-info-rgb), 0.08);
}

/* Invoice styles for buy.html and sell.html */
.invoice-total {
    padding: 1rem;
    border-radius: 8px;
    margin-top: 1rem;
}

.empty-invoice {
    text-align: center;
    padding: 2rem;
    color: var(--bs-secondary);
}

.invoice-total {
    background: linear-gradient(135deg, rgba(var(--bs-success-rgb), 0.1), rgba(var(--bs-info-rgb), 0.1));
    padding: 1rem;
    border-radius: 8px;
    margin-top: 1rem;
}

html[data-theme="darkly"] .invoice-total {
    background: linear-gradient(135deg, rgba(var(--bs-success-rgb), 0.08), rgba(var(--bs-info-rgb), 0.08));
}

.empty-invoice {
    text-align: center;
    padding: 2rem;
    color: var(--bs-secondary);
}

html[data-theme="darkly"] .empty-invoice {
    color: var(--bs-secondary);
}

/* Admin ledger layout */
.admin-ledger {
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 12px;
    background: linear-gradient(120deg, #f8fafc, #eef2ff);
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.08);
    overflow: hidden;
}

html[data-theme="darkly"] .admin-ledger {
    border-color: rgba(148, 163, 184, 0.25);
    background: linear-gradient(120deg, rgba(30, 41, 59, 0.95), rgba(15, 23, 42, 0.98));
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
}

.admin-ledger .ledger-head {
    padding: 12px 16px;
    background: rgba(15, 23, 42, 0.04);
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
}

html[data-theme="darkly"] .admin-ledger .ledger-head {
    background: rgba(148, 163, 184, 0.12);
}

.ledger-head .title {
    font-weight: 700;
    letter-spacing: 0.3px;
    color: #0f172a;
}

html[data-theme="darkly"] .ledger-head .title {
    color: #f8fafc;
}

.ledger-list {
    padding: 6px 0;
}

.ledger-row {
    display: grid;
    grid-template-columns: 260px 1fr 260px;
    gap: 16px;
    align-items: center;
    padding: 14px 18px;
    border-top: 1px solid rgba(15, 23, 42, 0.08);
    transition: background 0.2s ease, transform 0.2s ease;
}

html[data-theme="darkly"] .ledger-row {
    border-top-color: rgba(148, 163, 184, 0.18);
}

.ledger-row:first-of-type {
    border-top: 0;
}

.ledger-row:hover {
    background: rgba(79, 70, 229, 0.06);
    transform: translateY(-1px);
}

html[data-theme="darkly"] .ledger-row:hover {
    background: rgba(99, 102, 241, 0.18);
}

.ledger-row .ref {
    font-weight: 800;
    color: #0f172a;
}

html[data-theme="darkly"] .ledger-row .ref {
    color: #e2e8f0;
}

.ledger-row .identity {
    color: #334155;
    font-size: 13px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

html[data-theme="darkly"] .ledger-row .identity {
    color: rgba(226, 232, 240, 0.82);
}

.ledger-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 8px;
}

.stat-chip {
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    background: rgba(255, 255, 255, 0.65);
}

html[data-theme="darkly"] .stat-chip {
    border-color: rgba(148, 163, 184, 0.25);
    background: rgba(30, 41, 59, 0.75);
}

.stat-chip .label {
    color: #475569;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

html[data-theme="darkly"] .stat-chip .label {
    color: rgba(226, 232, 240, 0.7);
}

.stat-chip .value {
    color: #0f172a;
    font-weight: 700;
}

html[data-theme="darkly"] .stat-chip .value {
    color: #f8fafc;
}

.preview {
    color: #1f2937;
    font-size: 13px;
}

html[data-theme="darkly"] .preview {
    color: rgba(226, 232, 240, 0.82);
}

.ledger-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.status-rail {
    width: 6px;
    height: 100%;
    border-radius: 10px;
    background: #cbd5e1;
}

html[data-theme="darkly"] .status-rail {
    background: rgba(148, 163, 184, 0.6);
}

.ledger-row.status-draft .status-rail {
    background: #cbd5e1;
}

.ledger-row.status-awaiting_validation .status-rail {
    background: #f59e0b;
}

.ledger-row.status-validated .status-rail {
    background: #38bdf8;
}

.ledger-row.status-completed .status-rail {
    background: #22c55e;
}

.ledger-row.status-rejected .status-rail {
    background: #ef4444;
}

.ledger-row.status-anomaly .status-rail,
.ledger-row.status-anomaly_rejected .status-rail {
    background: #f59e0b;
}

.ledger-row.status-cancelled .status-rail {
    background: #94a3b8;
}

@media (max-width: 992px) {
    .ledger-row {
        grid-template-columns: 1fr;
        align-items: flex-start;
    }
    .ledger-actions {
        justify-content: flex-start;
    }
}

/* User recent orders cards */
.me-user-orders {
    display: grid;
    gap: 6px;
}

.me-user-order-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    grid-template-rows: auto auto auto;
    align-items: stretch;
    gap: 8px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.65);
    padding: 6px 8px;
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.05);
}

.me-user-order-row[data-order-kind="sell"] {
    border-left: 4px solid rgba(var(--bs-success-rgb), 0.8);
}

.me-user-order-row[data-order-kind="buy"] {
    border-left: 4px solid var(--me-buy-accent);
}

.me-user-order-row.status-anomaly,
.me-user-order-row.status-anomaly_rejected {
    border-left-color: rgba(var(--bs-warning-rgb), 1);
    border-top-color: rgba(var(--bs-warning-rgb), 0.42);
    border-right-color: rgba(var(--bs-warning-rgb), 0.42);
    border-bottom-color: rgba(var(--bs-warning-rgb), 0.42);
    background: rgba(var(--bs-warning-rgb), 0.14);
    box-shadow: 0 0 0 1px rgba(var(--bs-warning-rgb), 0.2);
}

.me-user-order-row.me-admin-order-row {
    grid-template-columns: minmax(0, 1fr) 320px;
}

html[data-theme="darkly"] .me-user-order-row {
    border-color: rgba(148, 163, 184, 0.28);
    background: rgba(30, 41, 59, 0.7);
}

html[data-theme="darkly"] .me-user-order-row[data-order-kind="sell"] {
    border-left-color: rgba(var(--bs-success-rgb), 0.95);
}

html[data-theme="darkly"] .me-user-order-row[data-order-kind="buy"] {
    border-left-color: var(--me-buy-accent);
}

html[data-theme="darkly"] .me-user-order-row.status-anomaly,
html[data-theme="darkly"] .me-user-order-row.status-anomaly_rejected {
    border-left-color: rgba(var(--bs-warning-rgb), 1);
    border-top-color: rgba(var(--bs-warning-rgb), 0.48);
    border-right-color: rgba(var(--bs-warning-rgb), 0.48);
    border-bottom-color: rgba(var(--bs-warning-rgb), 0.48);
    background: rgba(var(--bs-warning-rgb), 0.2);
    box-shadow: 0 0 0 1px rgba(var(--bs-warning-rgb), 0.28);
}

.me-user-order-main {
    grid-column: 1;
    grid-row: 1 / span 3;
    min-width: 0;
}

.me-user-layout-grid,
.me-admin-layout-grid {
    display: grid;
    grid-template-columns: minmax(220px, 320px) minmax(260px, 1fr);
    grid-template-rows: auto auto auto;
    column-gap: 12px;
    row-gap: 2px;
    align-items: center;
    min-width: 0;
}

.me-user-order-ref {
    grid-column: 1;
    grid-row: 1;
    font-weight: 700;
    color: #0f172a;
    font-size: 0.95rem;
    line-height: 1.2;
    min-width: 0;
}

.me-order-ref-title {
    display: block;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}

.me-order-kind-label {
    font-weight: 800;
}

.me-order-kind-sell {
    color: var(--bs-success);
}

.me-order-kind-buy {
    color: var(--me-buy-accent);
}

.me-order-flow-inline {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    width: 100%;
    min-width: 0;
    max-width: none;
}

.me-user-layout-grid .me-order-flow-inline,
.me-admin-layout-grid .me-order-flow-inline {
    grid-column: 2;
    grid-row: 1 / span 3;
}

.me-order-progress-inline-bar {
    position: relative;
    width: 100%;
    height: 12px;
    border-radius: 999px;
    background: rgba(var(--bs-secondary-rgb), 0.25);
    overflow: hidden;
    flex: 0 0 auto;
}

.me-order-progress-inline-bar .me-order-progress-fill {
    position: absolute;
    top: 0;
    left: 0;
}

.me-order-progress-inline-bar .me-order-progress-active-segment {
    top: 0;
    bottom: 0;
}

.me-order-progress-inline-bar .me-order-progress-point {
    width: 10px;
    height: 10px;
}

.me-order-progress-inline-bar .me-order-progress-point.current {
    width: 12px;
    height: 12px;
}

.me-order-breadcrumb-inline {
    position: relative;
    min-width: 0;
    min-height: 2.2em;
}

.me-order-crumb-inline {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 500;
    color: #64748b;
    line-height: 1.1;
    white-space: normal;
    max-width: 62%;
    max-height: 2.2em;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
}

.me-order-crumb-inline.start {
    left: 0 !important;
    transform: translate(0, -50%);
    text-align: left;
}

.me-order-crumb-inline.end {
    left: 100% !important;
    transform: translate(-100%, -50%);
    text-align: right;
}

.me-order-crumb-inline.done {
    color: var(--bs-success);
}

.me-order-crumb-inline.current {
    font-weight: 700;
    color: #0f172a;
}

html[data-theme="darkly"] .me-order-crumb-inline.current {
    color: #f8fafc;
}

html[data-theme="darkly"] .me-user-order-ref {
    color: #f8fafc;
}

.me-user-order-meta {
    display: block;
    font-size: 0.78rem;
    color: #64748b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.25;
}

.me-user-order-main .me-user-order-meta {
    margin-top: 1px;
}

.me-user-layout-grid .me-user-order-items {
    grid-column: 1;
    grid-row: 3;
}

html[data-theme="darkly"] .me-user-order-meta {
    color: rgba(226, 232, 240, 0.7);
}

.me-user-order-side {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: flex-end;
    gap: 6px;
    grid-column: 2;
    grid-row: 2;
    align-self: center;
    min-width: 0;
}

.me-user-order-total {
    display: inline-block;
    font-size: 0.92rem;
    white-space: nowrap;
    min-width: 150px;
    text-align: right;
}

.me-user-order-detail-btn {
    min-width: 34px;
    padding-inline: 0.5rem;
}

.me-order-progress-compact {
    position: relative;
    margin-top: 6px;
    padding: 0.25rem 0.2rem 0;
}

.me-order-progress-compact .progress-track {
    position: absolute;
    top: 13px;
    left: 2%;
    right: 2%;
    height: 4px;
    background: rgba(var(--bs-secondary-rgb), 0.25);
    border-radius: 999px;
}

.me-order-progress-compact .progress-fill {
    position: absolute;
    top: 13px;
    left: 2%;
    height: 4px;
    border-radius: 999px;
    background: linear-gradient(90deg, rgba(var(--bs-info-rgb), 0.8) 0%, rgba(var(--bs-success-rgb), 0.9) 100%);
}

.me-order-progress-compact .steps {
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.me-order-progress-compact .step {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--bs-body-bg);
    border: 1px solid rgba(var(--bs-secondary-rgb), 0.35);
    color: var(--bs-secondary-color);
    font-size: 0.62rem;
    z-index: 1;
}

.me-order-progress-compact .step.done {
    background: rgba(var(--bs-success-rgb), 0.14);
    color: var(--bs-success);
    border-color: rgba(var(--bs-success-rgb), 0.45);
}

.me-user-orders .status-badge {
    min-width: 0;
    justify-content: flex-start;
}

.me-admin-order-row {
    margin: 4px 8px;
}

.me-admin-order-side {
    display: grid;
    grid-template-columns: 150px auto;
    align-items: center;
    justify-content: stretch;
    gap: 8px;
    width: 100%;
}

.me-admin-order-actions {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.me-admin-order-side .status-badge {
    min-width: 240px;
    justify-content: center;
}

.me-admin-order-user {
    display: block;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.2;
    margin-bottom: 0;
}

.me-admin-order-items {
    display: block;
    color: #64748b;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.me-admin-layout-grid .me-order-ref-title {
    grid-column: 1;
    grid-row: 1;
    font-weight: 700;
}

.me-admin-layout-grid .me-admin-order-user {
    grid-column: 1;
    grid-row: 2;
}

.me-admin-layout-grid .me-admin-order-items {
    grid-column: 1;
    grid-row: 3;
}

html[data-theme="darkly"] .me-admin-order-user {
    color: #f8fafc;
}

html[data-theme="darkly"] .me-admin-order-items {
    color: rgba(226, 232, 240, 0.75);
}

html[data-theme="darkly"] .me-order-progress-compact .step {
    background: rgba(20, 20, 20, 0.75);
}

.me-order-progress-fill {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, rgba(var(--bs-info-rgb), 0.85) 0%, rgba(var(--bs-success-rgb), 0.95) 100%);
}

.me-order-progress-active-segment {
    position: absolute;
    top: 0;
    bottom: 0;
    border-radius: 999px;
    background:
        repeating-linear-gradient(
            -45deg,
            rgba(var(--bs-info-rgb), 0.14) 0,
            rgba(var(--bs-info-rgb), 0.14) 6px,
            rgba(var(--bs-success-rgb), 0.28) 6px,
            rgba(var(--bs-success-rgb), 0.28) 12px
        );
    border: 1px solid rgba(var(--bs-success-rgb), 0.38);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2);
    animation: meProgressActiveStripe 1.1s linear infinite;
}

.me-order-progress-points {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.me-order-progress-point {
    position: absolute;
    top: 50%;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    border: 1px solid rgba(148, 163, 184, 0.9);
    background: #f8fafc;
    transform: translate(-50%, -50%);
}

.me-order-progress-point.start {
    transform: translate(0, -50%);
}

.me-order-progress-point.end {
    transform: translate(-100%, -50%);
}

.me-order-progress-point.done {
    border-color: rgba(var(--bs-success-rgb), 0.95);
    background: var(--bs-success);
}

.me-order-progress-point.current {
    width: 10px;
    height: 10px;
    border-color: rgba(var(--bs-danger-rgb), 0.95);
    background: var(--bs-danger);
    box-shadow: 0 0 0 2px rgba(var(--bs-danger-rgb), 0.25);
}

.me-order-progress-point.current.anomaly-current {
    width: 0;
    height: 0;
    border-radius: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-bottom: 10px solid var(--bs-warning);
    border-top: none;
    background: transparent;
    box-shadow: none;
    transform: translate(-50%, -58%);
}

.me-order-anomaly-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    margin-left: 0.45rem;
    padding: 0.1rem 0.45rem;
    border-radius: 999px;
    border: 1px solid rgba(var(--bs-warning-rgb), 0.65);
    background: rgba(var(--bs-warning-rgb), 0.2);
    color: #b45309;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.01em;
    vertical-align: middle;
    line-height: 1.1;
}

@keyframes meProgressActiveStripe {
    from {
        background-position: 0 0;
    }
    to {
        background-position: 20px 0;
    }
}

html[data-theme="darkly"] .me-order-progress-point {
    border-color: rgba(148, 163, 184, 0.95);
    background: #1e293b;
}

html[data-theme="darkly"] .me-order-progress-point.current {
    border-color: rgba(248, 113, 113, 0.95);
    background: #ef4444;
    box-shadow: 0 0 0 2px rgba(248, 113, 113, 0.3);
}

html[data-theme="darkly"] .me-order-progress-point.current.anomaly-current {
    border-left-color: transparent;
    border-right-color: transparent;
    border-bottom-color: #fbbf24;
    background: transparent;
    box-shadow: none;
}

html[data-theme="darkly"] .me-order-anomaly-badge {
    border-color: rgba(var(--bs-warning-rgb), 0.72);
    background: rgba(var(--bs-warning-rgb), 0.24);
    color: #fbbf24;
}

html[data-theme="darkly"] .me-order-progress-active-segment {
    background:
        repeating-linear-gradient(
            -45deg,
            rgba(56, 189, 248, 0.16) 0,
            rgba(56, 189, 248, 0.16) 6px,
            rgba(34, 197, 94, 0.3) 6px,
            rgba(34, 197, 94, 0.3) 12px
        );
    border-color: rgba(34, 197, 94, 0.5);
    box-shadow: inset 0 0 0 1px rgba(134, 239, 172, 0.2);
}

html[data-theme="darkly"] .me-order-crumb-inline {
    color: rgba(226, 232, 240, 0.75);
}

html[data-theme="darkly"] .me-order-crumb-inline.done {
    color: #86efac;
}

@media (max-width: 1200px) {
    .me-user-order-row {
        grid-template-columns: minmax(0, 1fr) 270px;
    }
    .me-user-order-row.me-admin-order-row {
        grid-template-columns: minmax(0, 1fr) 300px;
    }
    .me-user-layout-grid,
    .me-admin-layout-grid {
        grid-template-columns: minmax(180px, 280px) minmax(220px, 1fr);
    }
    .me-order-crumb-inline {
        max-width: 68%;
    }
}

@media (max-width: 768px) {
    .me-user-order-row {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto;
    }
    .me-user-order-row.me-admin-order-row {
        grid-template-columns: 1fr;
    }
    .me-user-order-main {
        grid-row: 1;
    }
    .me-user-order-side {
        grid-column: 1;
        grid-row: 2;
        align-items: flex-start;
        justify-content: flex-start;
    }
    .me-user-layout-grid,
    .me-admin-layout-grid {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto auto;
        row-gap: 4px;
    }
    .me-user-layout-grid .me-order-flow-inline,
    .me-admin-layout-grid .me-order-flow-inline {
        grid-column: 1;
        grid-row: 4;
        width: 100%;
        max-width: none;
        min-width: 0;
    }
    .me-user-layout-grid .me-user-order-items,
    .me-admin-layout-grid .me-order-ref-title,
    .me-admin-layout-grid .me-admin-order-user,
    .me-admin-layout-grid .me-admin-order-items {
        grid-column: 1;
    }
    .me-admin-layout-grid .me-order-ref-title { grid-row: 1; }
    .me-admin-layout-grid .me-admin-order-user { grid-row: 2; }
    .me-admin-layout-grid .me-admin-order-items { grid-row: 3; }
    .me-order-flow-inline {
        width: 100%;
        max-width: none;
        min-width: 0;
    }
    .me-user-orders .status-badge {
        min-width: 0;
        justify-content: flex-start;
    }
    .me-admin-order-side {
        grid-template-columns: 1fr;
        justify-content: stretch;
        align-items: flex-start;
    }
    .me-admin-order-side .status-badge {
        min-width: 0;
        justify-content: flex-start;
    }
}

/* Remove glass-panel borders for cleaner look - override blueprints.css */
.glass-panel {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
}

.col-md-3 .glass-panel,
.row .glass-panel {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

/* Page header divider chip on admin section */
.admin-divider-line {
    border-color: rgba(15, 23, 42, 0.12) !important;
}

html[data-theme="darkly"] .admin-divider-line {
    border-color: rgba(148, 163, 184, 0.35) !important;
}

.admin-divider-chip {
    background: rgba(15, 23, 42, 0.05);
    border: 1px solid rgba(15, 23, 42, 0.12);
}

.admin-panel-toggle {
    appearance: none;
    cursor: pointer;
}

.admin-panel-toggle .fa-chevron-down {
    transition: transform 0.2s ease;
}

.admin-panel-toggle[aria-expanded="true"] .fa-chevron-down {
    transform: rotate(180deg);
}

.admin-panel-toggle-count {
    color: var(--me-card-muted);
    font-weight: 600;
}

.admin-panel-toggle:focus-visible {
    outline: 2px solid rgba(13, 110, 253, 0.45);
    outline-offset: 2px;
}

.me-panel-action-btn {
    border: 1px solid rgba(13, 110, 253, 0.45);
    background: rgba(13, 110, 253, 0.12);
    color: #0d6efd;
    font-weight: 600;
}

.me-panel-action-btn:hover,
.me-panel-action-btn:focus {
    border-color: #0d6efd;
    background: rgba(13, 110, 253, 0.2);
    color: #0a58ca;
}

html[data-theme="darkly"] .me-panel-action-btn {
    border-color: rgba(96, 165, 250, 0.55);
    background: rgba(37, 99, 235, 0.28);
    color: #bfdbfe;
}

html[data-theme="darkly"] .me-panel-action-btn:hover,
html[data-theme="darkly"] .me-panel-action-btn:focus {
    border-color: rgba(147, 197, 253, 0.75);
    background: rgba(37, 99, 235, 0.4);
    color: #dbeafe;
}

html[data-theme="darkly"] .admin-divider-chip {
    background: rgba(148, 163, 184, 0.14);
    border-color: rgba(148, 163, 184, 0.35);
    color: #f8fafc;
}

html[data-theme="darkly"] .admin-panel-toggle-count {
    color: #cbd5e1;
}

/* Info panels icon + body flex handling */
.info-icon-fixed {
    flex-shrink: 0;
}

.info-body-flex {
    flex: 1;
}

/* Stock table fixed column widths */
.stock-col-icon {
    width: 60px;
}

.stock-col-qty {
    width: 140px;
}

/* Modal lists and reference tag styling */
.modal-items-list {
    max-height: 200px;
    overflow-y: auto;
}

.contract-ref-tag {
    word-break: break-all;
    background: rgba(var(--bs-warning-rgb), 0.1);
    padding: 0.75rem;
    border-radius: 0.375rem;
}

/* Config refresh progress visuals */
.refresh-status {
    display: none;
}

.refresh-progress {
    height: 25px;
    display: none;
}

.refresh-progress-bar {
    width: 0%;
}

/* Bootstrap utility classes overrides */
html[data-theme="darkly"] .bg-body-tertiary,
html[data-theme="darkly"] .bg-body-secondary,
html[data-theme="darkly"] .bg-light,
html[data-theme="darkly"] .bg-white {
    background-color: #303030 !important;
}

html[data-theme="darkly"] [class*="subtle"] {
    background-color: #303030 !important;
}

/* Transactions page */
.me-transactions-filter {
    border: 1px solid var(--me-card-border);
    background: var(--me-card-bg);
}

.me-transactions-filter .form-label {
    font-weight: 600;
    color: var(--me-card-muted);
}

.me-transactions-table {
    border-collapse: separate;
    border-spacing: 0;
}

.me-transactions-table thead th {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--me-card-muted);
    border-bottom: 1px solid var(--me-card-border);
    white-space: nowrap;
}

.me-transactions-table tbody td {
    border-bottom: 1px solid var(--me-card-border);
    vertical-align: middle;
}

.me-transactions-table tbody tr:hover {
    background: rgba(13, 110, 253, 0.06);
}

.me-transactions-table .me-order-row {
    border-top: 2px solid rgba(15, 23, 42, 0.12);
}

.me-transactions-table .me-order-item-row td {
    background: rgba(15, 23, 42, 0.03);
}

.me-transactions-table .me-order-item-row:hover td {
    background: rgba(13, 110, 253, 0.09);
}

.me-order-items-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.me-order-items-list li {
    line-height: 1.25;
}

.me-order-items-list--numeric li {
    font-variant-numeric: tabular-nums;
}

html[data-theme="darkly"] .me-transactions-table tbody tr:hover {
    background: rgba(148, 163, 184, 0.12);
}

html[data-theme="darkly"] .me-transactions-table .me-order-row {
    border-top-color: rgba(148, 163, 184, 0.3);
}

html[data-theme="darkly"] .me-transactions-table .me-order-item-row td {
    background: rgba(148, 163, 184, 0.08);
}

.me-chart-card {
    background: var(--me-card-bg);
    border: 1px solid var(--me-card-border);
}

.me-chart-wrap {
    position: relative;
    min-height: 320px;
}
