* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

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

/* COPEC 背景水印 */
body::before {
    content: "";
    position: fixed;
    top: 50%;
    left: 50%;
    width: min(900px, 75vw);
    height: 350px;
    background: url("/static/logo.png") no-repeat center;
    background-size: contain;
    opacity: 0.035;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 0;
}

.page {
    position: relative;
    z-index: 1;
    max-width: 1600px;
    margin: 0 auto;
}

/* 顶部区域 */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 30px;
    margin-bottom: 32px;
}

.logo-box {
    display: flex;
    align-items: center;
    gap: 20px;
    min-width: 0;
}

.logo-box img {
    width: 275px;
    max-width: 30vw;
    height: 75px;
    object-fit: contain;
}

.logo-box h1 {
    margin: 0;
    font-size: 34px;
    color: #333;
}

.header-right {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 24px;
    text-align: right;
}

.company-information {
    min-width: max-content;
}

.company-name {
    font-size: 17px;
    font-weight: 700;
}

.company-subtitle {
    margin-top: 3px;
    color: #4b5563;
}

.header-account-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

.user-panel {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 48px;
    padding: 7px 12px 7px 8px;
    border: 1px solid #dbe2ea;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 3px 12px rgba(15, 23, 42, 0.06);
    text-align: left;
}

.user-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 34px;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #1d4ed8;
    color: #ffffff;
    font-size: 15px;
    font-weight: 800;
    text-transform: uppercase;
}

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

.user-name {
    max-width: 160px;
    overflow: hidden;
    color: #172033;
    font-size: 14px;
    font-weight: 800;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-role {
    margin-top: 2px;
    color: #667085;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

/* 通用按钮 */
button {
    border: none;
    padding: 11px 18px;
    border-radius: 9px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
}

button:hover {
    transform: translateY(-1px);
    filter: brightness(0.96);
}

button:disabled {
    cursor: not-allowed;
    opacity: 0.62;
    transform: none;
}

.create-btn,
.primary-btn,
.blue {
    background: #2563eb;
    color: white;
}

.manage-users-btn {
    background: #344054;
    color: #ffffff;
}

.manage-users-btn:hover {
    background: #1f2937;
}

.logout-btn {
    border: 1px solid #cfd7e3;
    background: #ffffff;
    color: #344054;
}

.logout-btn:hover {
    border-color: #98a2b3;
    background: #f8fafc;
}

.green {
    background: #16a34a;
    color: white;
}

.red {
    background: #dc2626;
    color: white;
}

.gray,
.secondary-btn,
.back-button {
    background: #e5e7eb;
    color: #374151;
}

.delete-btn {
    background: #dc2626;
    color: white;
    padding: 9px 16px;
}

.delete-btn:hover {
    background: #b91c1c;
}

/* 通用卡片 */
.card,
.form-card,
.order-card {
    background: rgba(255, 255, 255, 0.97);
    border-radius: 18px;
    padding: 26px;
    margin-bottom: 24px;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.08);
}

.card h2,
.form-card h2 {
    margin: 0 0 22px;
    color: #1f2937;
}

.card h3 {
    margin-top: 0;
}

.card-subtitle {
    margin-top: -12px;
    margin-bottom: 26px;
    color: #6b7280;
}

/* Dashboard */
.order-card {
    transition: 0.2s;
}

.order-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.12);
}

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

.order-no {
    font-size: 21px;
    font-weight: bold;
    cursor: pointer;
}

.status {
    padding: 7px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: bold;
}

.status-order {
    background: #e5e7eb;
    color: #374151;
}

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

.status-self {
    background: #dbeafe;
    color: #1d4ed8;
}

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

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

.info {
    margin-top: 15px;
    line-height: 1.85;
    font-size: 15px;
    cursor: pointer;
}

.progress-box {
    margin-top: 19px;
    cursor: pointer;
}

.progress-line {
    height: 9px;
    overflow: hidden;
    background: #e5e7eb;
    border-radius: 10px;
}

.progress-fill {
    height: 100%;
    background: #2563eb;
}

.steps {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-top: 9px;
    color: #6b7280;
    font-size: 12px;
}

.action-row {
    display: flex;
    justify-content: flex-end;
    margin-top: 18px;
}

/* 创建订单表单 */
.form-wrapper {
    max-width: 760px;
    margin: 20px auto 50px;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 20px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

label {
    display: block;
    margin-bottom: 8px;
    color: #374151;
    font-weight: 700;
}

input,
textarea {
    width: 100%;
    padding: 13px 14px;
    border: 1px solid #d1d5db;
    border-radius: 9px;
    background: white;
    color: #111827;
    font-family: Arial, sans-serif;
    font-size: 15px;
    outline: none;
    transition: 0.2s;
}

input:focus,
textarea:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

textarea {
    min-height: 110px;
    resize: vertical;
}

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 8px;
}

/* Order Detail */
.detail-container {
    max-width: 1250px;
    margin: 0 auto;
}

.order-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px 28px;
    line-height: 1.6;
}

.summary-item {
    min-width: 0;
}

.summary-label {
    display: block;
    margin-bottom: 3px;
    color: #6b7280;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
}

.summary-value {
    color: #1f2937;
    font-size: 16px;
    overflow-wrap: anywhere;
}

.summary-item.full-width {
    grid-column: 1 / -1;
}

.status-text {
    display: inline-block;
    margin: 4px 0 12px;
    padding: 7px 13px;
    border-radius: 20px;
    background: #dbeafe;
    color: #1d4ed8;
    font-weight: 700;
}

.stage-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    margin-right: 8px;
    border-radius: 50%;
    background: #1f2937;
    color: white;
    font-size: 15px;
}

.grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 22px;
}

.sub-card {
    padding: 22px;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    background: #f9fafb;
}

.button-row {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
}

.reason-box {
    display: none;
    margin: 6px 0 14px;
    padding: 12px 14px;
    border-left: 4px solid #dc2626;
    border-radius: 6px;
    background: #fef2f2;
    color: #991b1b;
}

.back-btn {
    display: inline-block;
    margin: 4px 0 30px;
    color: #2563eb;
    font-weight: 700;
    text-decoration: none;
}

.back-btn:hover {
    text-decoration: underline;
}

/* 小屏适配 */
@media (max-width: 1100px) {
    .header {
        align-items: flex-start;
    }

    .header-right {
        align-items: flex-end;
        flex-direction: column;
        gap: 12px;
    }
}

@media (max-width: 900px) {
    body {
        padding: 20px;
    }

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

    .header-right {
        width: 100%;
        align-items: flex-start;
        justify-content: space-between;
        text-align: left;
    }

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

    .logo-box img {
        width: 210px;
        max-width: 45vw;
        height: 60px;
    }

    .logo-box h1 {
        font-size: 27px;
    }

    .grid,
    .form-grid,
    .order-summary {
        grid-template-columns: 1fr;
    }

    .summary-item.full-width,
    .form-group.full-width {
        grid-column: auto;
    }
}

@media (max-width: 560px) {
    body {
        padding: 16px;
    }

    .logo-box {
        align-items: flex-start;
        flex-direction: column;
        gap: 10px;
    }

    .logo-box img {
        width: 185px;
        max-width: 70vw;
    }

    .logo-box h1 {
        font-size: 24px;
    }

    .header-account-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .user-panel {
        width: 100%;
    }

    .user-name {
        max-width: none;
    }

    .manage-users-btn,
    .create-btn,
    .logout-btn {
        width: 100%;
    }
}
