body {
    font-family: Arial, sans-serif;
    background: #f5f6f8;
    color: #333;
    margin: 0;
    padding: 30px;
}

.container {
    max-width: 800px;
    margin: auto;
}

h1 {
    text-align: center;
    margin-bottom: 25px;
}

h2 {
    margin: 0;
}

h3 {
    margin-top: 0;
}

.card {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .1);
}

.actions {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
}

button,
.btn {
    display: inline-block;
    padding: 9px 18px;
    border: none;
    border-radius: 5px;
    font-size: 14px;
    cursor: pointer;
    text-decoration: none;
    box-sizing: border-box;
}

button:hover,
.btn:hover {
    opacity: .85;
}

button:disabled,
.btn:disabled {
    cursor: wait;
    opacity: .65;
}

.btn-primary,
button[type="submit"] {
    background: #0d6efd;
    color: #fff;
}

.btn-success {
    background: #198754;
    color: #fff;
}

.btn-danger {
    background: #dc3545;
    color: #fff;
}

.order-header-card {
    padding-bottom: 15px;
}

.order-header-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 15px;
}

.order-label {
    color: #777;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .05em;
    margin-bottom: 4px;
}

.order-date {
    color: #777;
    font-size: 13px;
    margin-top: 8px;
}

.status-badge {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 13px;
    white-space: nowrap;
}

.status-default {
    color: #475569;
    background: #e9ecef;
}

.status-billed {
    color: #075985;
    background: #e0f2fe;
}

.status-manufacturing {
    color: #6d28d9;
    background: #ede9fe;
}

.status-processing {
    color: #92400e;
    background: #fef3c7;
}

.status-ready {
    color: #9a3412;
    background: #ffedd5;
}

.status-shipped {
    color: #0369a1;
    background: #e0f2fe;
}

.status-completed {
    color: #166534;
    background: #dcfce7;
}

.status-cancelled {
    color: #991b1b;
    background: #fee2e2;
}

.status-timeline {
    display: flex;
    align-items: flex-start;
    margin: 25px 0 8px;
    overflow-x: auto;
    padding: 4px 2px 8px;
}

.status-step {
    flex: 1 0 105px;
    min-width: 105px;
    position: relative;
    text-align: center;
}

.status-step:not(:last-child)::after {
    content: '';
    position: absolute;
    top: 14px;
    left: calc(50% + 15px);
    right: calc(-50% + 15px);
    height: 2px;
    background: #e5e7eb;
    z-index: 0;
}

.status-step.active:not(:last-child)::after {
    background: #198754;
}

.status-step-dot {
    width: 28px;
    height: 28px;
    margin: 0 auto 7px;
    border-radius: 50%;
    background: #e9ecef;
    color: #6b7280;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    position: relative;
    z-index: 1;
    box-sizing: border-box;
}

.status-step.active .status-step-dot {
    background: #198754;
    color: #fff;
}

.status-step.current .status-step-dot {
    box-shadow: 0 0 0 4px rgba(25, 135, 84, .12);
}

.status-step-label {
    color: #777;
    font-size: 11px;
    line-height: 1.3;
}

.status-step.active .status-step-label {
    color: #333;
    font-weight: 600;
}

.status-message {
    padding: 12px 14px;
    border-radius: 6px;
    margin-top: 18px;
}

.cancelled-message {
    color: #991b1b;
    background: #fee2e2;
}

.info-table,
.items-table,
.summary-table {
    width: 100%;
    border-collapse: collapse;
}

.info-table th,
.info-table td,
.items-table th,
.items-table td,
.summary-table th,
.summary-table td {
    padding: 10px;
    border-bottom: 1px solid #eee;
    text-align: left;
    vertical-align: top;
}

.info-table tr:last-child th,
.info-table tr:last-child td,
.items-table tbody tr:last-child td {
    border-bottom: none;
}

.info-table th {
    width: 30%;
    font-weight: 600;
}

.address-block {
    line-height: 1.55;
}

.tracking-number {
    font-family: monospace;
    font-size: 15px;
}

.tracking-card {
    position: relative;
}

.tracking-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 15px;
}

.tracking-header h3 {
    margin-bottom: 3px;
}

.tracking-subtitle {
    color: #777;
    font-size: 12px;
}

.tracking-result {
    margin-top: 16px;
}

.tracking-result .table-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.tracking-result table.alt {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    background: #fff;
}

.tracking-result table.alt th {
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    color: #334155;
    background: #f8fafc;
    border-bottom: 2px solid #e2e8f0;
    white-space: nowrap;
}

.tracking-result table.alt td {
    padding: 11px 12px;
    color: #475569;
    border-bottom: 1px solid #e2e8f0;
    vertical-align: top;
    line-height: 1.5;
}

.tracking-result table.alt tbody tr:last-child td {
    border-bottom: none;
}

.tracking-result table.alt tbody tr:hover {
    background: #f8fafc;
}

.tracking-result table.alt td:first-child {
    white-space: nowrap;
    color: #64748b;
}

.tracking-result table.alt th:first-child,
.tracking-result table.alt td:first-child {
    min-width: 130px;
}

.tracking-result h2 {
    margin: 0 0 8px;
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.4;
    text-align: left !important;
}

.tracking-result h2::before {
    content: "🎟️ Tracking Number:";
    margin-right: 7px;
}

.tracking-result:not(.expanded) table.alt tbody tr:nth-child(n+5) {
    display: none !important;
}

.tracking-more {
    margin-top: 10px;
    padding: 7px 13px;
    border: 1px solid #d9dee5;
    border-radius: 5px;
    background: #fff;
    color: #475569;
    cursor: pointer;
    font-size: 14px;
}

.tracking-more:hover {
    background: #f8fafc;
}

.tracking-status {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 10px;
    padding: 7px 11px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.3;
    border: 1px solid;
}

.tracking-status-icon::before {
    font-size: 13px;
}

.tracking-status-unknown {
    color: #64748b;
    background: #f8fafc;
    border-color: #cbd5e1;
}

.tracking-status-unknown .tracking-status-icon::before {
    content: "●";
}

.tracking-status-shipped {
    color: #0369a1;
    background: #f0f9ff;
    border-color: #bae6fd;
}

.tracking-status-shipped .tracking-status-icon::before {
    content: "📦";
}

.tracking-status-in_transit {
    color: #7c3aed;
    background: #f5f3ff;
    border-color: #ddd6fe;
}

.tracking-status-in_transit .tracking-status-icon::before {
    content: "🚚";
}

.tracking-status-out_for_delivery {
    color: #b45309;
    background: #fffbeb;
    border-color: #fde68a;
}

.tracking-status-out_for_delivery .tracking-status-icon::before {
    content: "🚚";
}

.tracking-status-delivered {
    color: #15803d;
    background: #f0fdf4;
    border-color: #bbf7d0;
}

.tracking-status-delivered .tracking-status-icon::before {
    content: "✓";
}

.tracking-loading,
.tracking-error,
.muted {
    color: #777;
}

.tracking-error {
    background: #fff7ed;
    color: #9a3412;
    border: 1px solid #fed7aa;
    padding: 12px 14px;
    border-radius: 6px;
}

.table-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.items-table th {
    background: #f8fafc;
    font-weight: 600;
    color: #334155;
}

.qty-column {
    width: 10%;
    text-align: right !important;
    white-space: nowrap;
}

.money-column {
    width: 25%;
    text-align: right !important;
    white-space: nowrap;
}

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

.item-options {
    margin-top: 5px;
    color: #777;
    font-size: 12px;
    line-height: 1.5;
}

.items-count {
    color: #777;
    font-size: 12px;
    margin-top: 10px;
}

.summary-table th {
    font-weight: 600;
}

.summary-table td {
    text-align: right;
}

.summary-total th,
.summary-total td {
    border-bottom: none;
    padding-top: 14px;
    font-size: 16px;
}

.summary-total td {
    font-weight: bold;
}

.text-content {
    line-height: 1.6;
    white-space: normal;
}

.error-card {
    text-align: center;
    padding: 35px 20px;
}

.error-icon {
    font-size: 35px;
    margin-bottom: 10px;
}

.footer-note {
    color: #888;
    font-size: 11px;
    text-align: center;
    margin: 25px 0 10px;
}

/* ==========================
   Media
   ========================== */
.order-media {
    margin-top: 24px;
}

.order-media-header {
    margin-bottom: 12px;
}

.order-media-header h3 {
    margin: 0;
    font-size: 18px;
}

.order-media-subtitle {
    margin-top: 3px;
    color: #777;
    font-size: 12px;
}

.order-media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
}

.order-media-item {
    overflow: hidden;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .06);
    transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}

.order-media-item:hover {
    transform: translateY(-2px);
    border-color: #ccc;
    box-shadow: 0 5px 14px rgba(0, 0, 0, .10);
}

.order-media-photo {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 10;
    object-fit: cover;
    background: #111;
    cursor: pointer;
}

.order-media-title {
    padding: 8px 10px;
    font-size: 12px;
    font-weight: 600;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.order-media-video {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 10;
    background: #111;
    overflow: hidden;
    cursor: pointer;
}

.order-media-video video {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.order-media-play {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 48px;
    height: 48px;
    margin-left: -24px;
    margin-top: -24px;
    border-radius: 50%;
    background: rgba(0, 0, 0, .65);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    padding-left: 2px;
    box-sizing: border-box;
    transition: transform .15s ease, background .15s ease;
}

.order-media-video:hover .order-media-play {
    transform: scale(1.08);
    background: rgba(0, 0, 0, .8);
}

.photo-lightbox {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99999;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, .90);
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
    overflow: hidden;
}

.photo-lightbox.open {
    display: flex;
}

.photo-lightbox-content {
    position: relative;
    width: auto;
    max-width: 95vw;
    max-height: 95vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.photo-lightbox-image {
    display: block;
    max-width: 95vw;
    max-height: 88vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 6px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, .5);
}

.photo-lightbox-video {
    display: none;
    max-width: 95vw;
    max-height: 88vh;
    width: auto;
    height: auto;
    border-radius: 6px;
    background: #000;
    box-shadow: 0 10px 40px rgba(0, 0, 0, .5);
}

.photo-lightbox-title {
    margin-top: 8px;
    max-width: 90vw;
    color: #fff;
    font-size: 13px;
    font-weight: 500;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.photo-lightbox-close {
    position: fixed;
    top: 15px;
    right: 15px;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, .95);
    color: #222;
    font-size: 28px;
    line-height: 40px;
    text-align: center;
    cursor: pointer;
    z-index: 100000;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .25);
}

.photo-lightbox-close:hover {
    background: #fff;
}

@media (max-width: 600px) {
    body {
        padding: 15px;
    }

    .card {
        padding: 15px;
    }

    .order-header-top,
    .tracking-header {
        flex-direction: column;
    }

    .tracking-header .btn {
        width: 100%;
    }

    .status-timeline {
        padding-bottom: 4px;
    }

    .status-step {
        flex-basis: 90px;
        min-width: 90px;
    }

    .status-step-label {
        font-size: 10px;
    }

    .info-table th {
        width: 35%;
    }

    .order-media-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

    .order-media-item {
        border-radius: 6px;
    }

    .order-media-title {
        padding: 6px 8px;
        font-size: 11px;
    }

    .photo-lightbox {
        padding: 10px;
    }

    .photo-lightbox-image,
    .photo-lightbox-video {
        max-width: 96vw;
        max-height: 86vh;
    }

    .photo-lightbox-close {
        top: 10px;
        right: 10px;
        width: 36px;
        height: 36px;
        font-size: 25px;
        line-height: 36px;
    }

    .photo-lightbox-title {
        font-size: 12px;
    }

    .tracking-result table.alt {
        font-size: 13px;
    }

    .tracking-result table.alt th {
        display: none !important;
    }

    .tracking-result table.alt td {
        padding: 0 4px !important;
        display: block !important;
        width: auto !important;
        border: none !important;
        text-align: left !important;
        font-size: 12px !important;
    }

    .tracking-result table.alt td:first-child {
        font-weight: 600 !important;
        padding-top: 4px !important;
        font-size: 13px !important;
    }

    .tracking-result table.alt td:last-child {
        padding-bottom: 4px !important;
    }

    .tracking-result table.alt tr:nth-child(even) {
        background-color: #f8fafc;
    }

    .tracking-result table.alt tr {
        display: block !important;
        border-top: 2px solid #f5f7f9 !important;
    }
}

@media print {
    body {
        font-size: 12px;
        background-color: #fff !important;
    }

    .noprint {
        display: none !important;
    }

    .card {
        background: #fff !important;
        border: none;
        border-top: 1px solid #aaa;
        border-radius: 0;
        box-shadow: none !important;
        margin: 0 0 10px 0;
    }

    .tracking-result:not(.expanded) table.alt tbody tr:nth-child(n+5) {
        display: table-row !important;
    }

    .photo-lightbox {
        display: none !important;
    }
}


/* ==========================
   Public landing page
   ========================== */
.public-links {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 620px;
    margin: 24px auto 0;
    text-align: left;
}

.public-link {
    display: flex;
    align-items: center;
    gap: 13px;
    width: 100%;
    padding: 14px 16px;
    color: #202124;
    text-decoration: none;
    background: #f8fafc;
    border: 1px solid #e1e5e9;
    border-radius: 12px;
    transition: background .15s ease, border-color .15s ease, transform .15s ease;
}

.public-link:hover {
    background: #fff;
    border-color: #c8ced5;
    transform: translateY(-1px);
}

.public-link-icon {
    width: 34px;
    flex: 0 0 34px;
    text-align: center;
    font-size: 21px;
}

.public-link > span:nth-child(2) {
    min-width: 0;
    flex: 1;
}

.public-link strong {
    display: block;
    font-size: 14px;
}

.public-link small {
    display: block;
    margin-top: 2px;
    color: #777;
    font-size: 11px;
}

.public-link-arrow {
    flex: 0 0 auto;
    color: #8a929a;
    font-size: 18px;
}

/* ==========================
   Tracking controls
   ========================== */
.tracking-number-row {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 9px;
}

.tracking-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 7px;
}

.tracking-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 32px;
    padding: 7px 11px;
    border: 1px solid #d7dce1;
    border-radius: 7px;
    background: #fff;
    color: #3f464d;
    font: inherit;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
    transition: background .15s ease, border-color .15s ease, transform .15s ease;
}

.tracking-action-btn:hover {
    transform: translateY(-1px);
}

.tracking-copy-btn {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: #334155;
}

.tracking-copy-btn:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
}

.tracking-courier-btn {
    background: #198754;
    border-color: #198754;
    color: #fff;
}

.tracking-courier-btn:hover {
    background: #157347;
    border-color: #157347;
    color: #fff;
}

.tracking-live {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 3px 8px;
    border-radius: 999px;
    background: #f4f4f4;
    color: #666;
    font-size: 10px;
    font-weight: 600;
    white-space: nowrap;
}

@media (max-width: 600px) {
    .error-card {
        padding: 28px 16px;
    }

    .public-links {
        margin-top: 20px;
    }

    .public-link {
        padding: 13px 12px;
    }

    .tracking-number-row {
        align-items: flex-start;
        flex-direction: column;
        gap: 8px;
    }

    .tracking-actions {
        width: 100%;
    }
}
