/* ========================================
   兑换码管理系统 - 全局样式
   ======================================== */

/* Reset */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
    background: #f5f7fa;
    color: #333;
    min-height: 100vh;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* ========================================
   Navbar
   ======================================== */
.navbar {
    background: linear-gradient(135deg, #1e293b, #334155);
    color: #fff;
    padding: 0 20px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 12px rgba(0,0,0,0.15);
}

.nav-container {
    max-width: 100%;
    margin: 0 auto;
    display: flex;
    align-items: center;
    height: 56px;
    flex-wrap: wrap;
    gap: 8px;
}

.nav-brand {
    color: #fff;
    font-size: 17px;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
    letter-spacing: 0.5px;
}

.nav-toggle {
    display: none;
    background: none;
    border: none;
    color: #fff;
    font-size: 22px;
    cursor: pointer;
    margin-left: auto;
    padding: 4px 8px;
    border-radius: 6px;
    transition: background 0.2s;
}
.nav-toggle:hover { background: rgba(255,255,255,0.1); }

.nav-menu {
    display: flex;
    align-items: center;
    gap: 2px;
    margin-left: auto;
}

.nav-link {
    color: rgba(255,255,255,0.75);
    text-decoration: none;
    padding: 7px 14px;
    border-radius: 8px;
    font-size: 13.5px;
    white-space: nowrap;
    transition: all 0.2s;
    font-weight: 500;
}
.nav-link:hover {
    background: rgba(255,255,255,0.12);
    color: #fff;
}

.nav-active, .nav-link.nav-active {
    background: rgba(99,102,241,0.4);
    color: #fff;
    font-weight: 600;
}

.nav-user {
    color: rgba(255,255,255,0.6);
    font-size: 13px;
    padding: 0 12px;
    white-space: nowrap;
}

.product-switcher {
    margin-left: 12px;
}
.product-switcher select {
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 12.5px;
    cursor: pointer;
    border: 1px solid rgba(255,255,255,0.2);
    background: rgba(255,255,255,0.1);
    color: #fff;
    transition: all 0.2s;
}
.product-switcher select:hover {
    background: rgba(255,255,255,0.18);
}
.product-switcher select option {
    color: #333;
    background: #fff;
}

.nav-logout {
    color: #fca5a5 !important;
}
.nav-logout:hover {
    color: #fee2e2 !important;
    background: rgba(239,68,68,0.2) !important;
}

/* ========================================
   Container
   ======================================== */
.container {
    max-width: 100%;
    margin: 0 auto;
    padding: 20px 16px;
}

/* ========================================
   Card
   ======================================== */
.card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 4px 16px rgba(0,0,0,0.06);
    padding: 24px;
    margin-bottom: 20px;
    border: 1px solid rgba(0,0,0,0.04);
}

.card h2 {
    font-size: 18px;
    margin-bottom: 16px;
    color: #1e293b;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

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

/* ========================================
   Tables
   ======================================== */
.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    position: relative;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 13.5px;
    min-width: 700px;
}

th, td {
    padding: 11px 14px;
    text-align: left;
    border-bottom: 1px solid #f0f0f0;
    white-space: nowrap;
}

th {
    background: #f8fafc;
    font-weight: 600;
    color: #475569;
    font-size: 13px;
    text-transform: none;
    letter-spacing: 0;
    position: sticky;
    top: 0;
    z-index: 1;
}

tr:hover td {
    background: #fafbfd;
}

tr:last-child td {
    border-bottom: none;
}

th:last-child,
td:last-child {
    position: sticky;
    right: 0;
    z-index: 2;
}

th:last-child {
    background: #f8fafc;
    box-shadow: -4px 0 10px rgba(0,0,0,0.04);
}

td:last-child {
    background: #fff;
}

tr:hover td:last-child {
    background: #fafbfd;
}

code {
    font-family: "SF Mono", "Fira Code", "Fira Mono", Menlo, Consolas, monospace;
    background: #f1f5f9;
    color: #6366f1;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12.5px;
    word-break: break-all;
}

/* 空数据状态 */
.empty-data td {
    text-align: center !important;
    color: #94a3b8 !important;
    padding: 32px 14px !important;
    font-size: 14px;
}

/* ========================================
   Forms
   ======================================== */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    font-size: 13.5px;
    color: #374151;
}

.form-group label .required {
    color: #ef4444;
    margin-left: 2px;
}

.form-control {
    width: 100%;
    max-width: 500px;
    padding: 8px 14px;
    border: 1.5px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s;
    color: #1e293b;
    background: #fff;
    line-height: 1;
    height: 35px;
}
.form-control::placeholder {
    color: #9ca3af;
}
.form-control:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99,102,241,0.12);
}

textarea.form-control {
    min-height: 100px;
    resize: vertical;
    font-family: inherit;
}

select.form-control {
    max-width: 300px;
    cursor: pointer;
}

.form-control-inline {
    display: inline-block;
    width: auto;
    max-width: 110px;
    padding: 5px 8px;
    font-size: 12.5px;
}

/* 文件上传输入 */
.form-control-file {
    max-width: 500px;
}
.form-control-file::file-selector-button {
    padding: 7px 14px;
    border: 1.5px solid #d1d5db;
    border-radius: 6px;
    background: #f9fafb;
    color: #374151;
    font-size: 13px;
    cursor: pointer;
    margin-right: 12px;
    transition: all 0.2s;
}
.form-control-file::file-selector-button:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}

/* 表单分组 */
.form-section {
    margin-bottom: 20px;
}
.form-section:last-of-type {
    margin-bottom: 4px;
}
.form-section-title {
    font-size: 13px;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding-bottom: 8px;
    margin-bottom: 12px;
    border-bottom: 1px solid #e2e8f0;
}
.form-row {
    display: flex;
    gap: 16px;
}
.form-row .form-col {
    flex: 1;
}
.form-row .form-group {
    margin-bottom: 12px;
}
@media (max-width: 600px) {
    .form-row {
        flex-direction: column;
        gap: 0;
    }
}

/* ========================================
   Buttons
   ======================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 8px 18px;
    border: none;
    border-radius: 8px;
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
    line-height: 1.4;
    white-space: nowrap;
}
.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}
.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: #6366f1;
    color: #fff;
}
.btn-primary:hover {
    background: #4f46e5;
}

.btn-success {
    background: #10b981;
    color: #fff;
}
.btn-success:hover {
    background: #059669;
}

.btn-danger {
    background: #ef4444;
    color: #fff;
}
.btn-danger:hover {
    background: #dc2626;
}

.btn-warning {
    background: #f59e0b;
    color: #fff;
}
.btn-warning:hover {
    background: #d97706;
}

.btn-default {
    background: #fff;
    color: #64748b;
    border: 1.5px solid #d1d5db;
}
.btn-default:hover {
    background: #f8fafc;
    border-color: #9ca3af;
}

.btn-info {
    background: #3b82f6;
    color: #fff;
}
.btn-info:hover {
    background: #2563eb;
}

.btn-purple {
    background: #8b5cf6;
    color: #fff;
}
.btn-purple:hover {
    background: #7c3aed;
}

.btn-cyan {
    background: #06b6d4;
    color: #fff;
}
.btn-cyan:hover {
    background: #0891b2;
}

.btn-amber {
    background: #f59e0b;
    color: #fff;
}
.btn-amber:hover {
    background: #d97706;
}

.btn-rose {
    background: #f43f5e;
    color: #fff;
}
.btn-rose:hover {
    background: #e11d48;
}

.btn-secondary {
    background: #64748b;
    color: #fff;
}
.btn-secondary:hover {
    background: #475569;
}

.btn-sm {
    padding: 8px 12px;
    font-size: 12.5px;
    border-radius: 6px;
}
.btn-sm:hover {
    transform: translateY(0);
    box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}

.btn-clear {
    background: #94a3b8;
    color: #fff;
}
.btn-clear:hover {
    background: #64748b;
}

/* ========================================
   Badges
   ======================================== */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.2px;
}

.badge-warning {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}

.badge-success {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.badge-danger {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.badge-info {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

.badge-secondary {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #e2e8f0;
}

/* ========================================
   Alert
   ======================================== */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 14px;
    line-height: 1.6;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.alert-success {
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.alert-danger {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.alert-warning {
    background: #fffbeb;
    color: #92400e;
    border: 1px solid #fde68a;
}

.alert-info {
    background: #eff6ff;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

/* ========================================
   Auth pages (登录/注册)
   ======================================== */
.auth-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 16px;
}

.auth-card {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
    padding: 36px;
    width: 100%;
    max-width: 400px;
}

.auth-card h1 {
    text-align: center;
    margin-bottom: 24px;
    font-size: 22px;
    color: #1e293b;
    font-weight: 700;
}

.auth-card .form-control {
    max-width: 100%;
}

.auth-card .btn {
    width: 100%;
    padding: 11px;
    font-size: 15px;
    font-weight: 600;
    border-radius: 10px;
    margin-top: 4px;
}

.auth-card .captcha-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

.auth-card .captcha-row .form-control {
    flex: 1;
}

.auth-card .captcha-row img {
    border-radius: 8px;
    cursor: pointer;
    height: 35px;
    border: 1px solid #e5e7eb;
}

.auth-footer {
    text-align: center;
    margin-top: 20px;
    font-size: 14px;
    color: #94a3b8;
}

.auth-footer a {
    color: #6366f1;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}
.auth-footer a:hover {
    color: #4f46e5;
}

/* ========================================
   Pagination
   ======================================== */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 4px;
    margin-top: 16px;
    flex-wrap: wrap;
}

.pagination a, .pagination span:not(.page-jump span) {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    padding: 0 10px;
    border-radius: 8px;
    font-size: 13px;
    text-decoration: none;
    color: #6366f1;
    background: #fff;
    border: 1px solid #e5e7eb;
    transition: all 0.2s;
}

.pagination .active {
    background: #6366f1;
    color: #fff;
    border-color: #6366f1;
    box-shadow: 0 2px 6px rgba(99,102,241,0.3);
}

.pagination a:hover {
    background: #eef2ff;
    border-color: #c7d2fe;
}

.pagination span.disabled {
    color: #c5c5c5;
    background: #fafafa;
    border-color: #eee;
    cursor: not-allowed;
}

.pagination span.ellipsis {
    border: none;
    color: #999;
    background: transparent;
    padding: 6px 4px;
}

.pagination .page-jump {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: 12px;
    font-size: 13px;
    color: #64748b;
}

.pagination .page-jump input[type="number"] {
    width: 56px;
    padding: 5px 6px;
    border: 1.5px solid #d1d5db;
    border-radius: 6px;
    font-size: 13px;
    text-align: center;
    transition: border-color 0.2s;
}
.pagination .page-jump input[type="number"]:focus {
    border-color: #6366f1;
    outline: none;
}

.pagination .page-jump button {
    padding: 5px 12px;
    border: none;
    border-radius: 6px;
    background: #6366f1;
    color: #fff;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.2s;
}
.pagination .page-jump button:hover {
    background: #4f46e5;
}

/* ========================================
   Stats grid
   ======================================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.stat-card {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 4px 16px rgba(0,0,0,0.06);
    text-align: center;
    border: 1px solid rgba(0,0,0,0.04);
    transition: all 0.25s;
}
.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

.stat-card .stat-value {
    font-size: 28px;
    font-weight: 800;
    color: #1e293b;
    line-height: 1.2;
}

.stat-card .stat-label {
    font-size: 13px;
    color: #64748b;
    margin-top: 6px;
    font-weight: 500;
}

.stat-card .stat-hint {
    font-size: 11px;
    color: #94a3b8;
    margin-left: 4px;
}

/* Stat card color variants */
.stat-card-accent-amber {
    border-left: 3px solid #f59e0b;
}
.stat-card-accent-amber .stat-value {
    color: #d97706;
}

.stat-card-accent-blue {
    border-left: 3px solid #3b82f6;
}
.stat-card-accent-blue .stat-value {
    color: #2563eb;
}

.stat-card-accent-green {
    border-left: 3px solid #10b981;
}
.stat-card-accent-green .stat-value {
    color: #059669;
}

.stat-card-accent-purple {
    border-left: 3px solid #8b5cf6;
}
.stat-card-accent-purple .stat-value {
    color: #7c3aed;
}

.stat-card-accent-rose {
    border-left: 3px solid #f43f5e;
}
.stat-card-accent-rose .stat-value {
    color: #e11d48;
}

/* ========================================
   Modal
   ======================================== */
.modal {
    display: none;
    position: fixed;
    z-index: 200;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(15,23,42,0.5);
    backdrop-filter: blur(2px);
    justify-content: center;
    align-items: center;
    padding: 16px;
}

.modal.active {
    display: flex;
    animation: modalFadeIn 0.2s ease;
}

@keyframes modalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: #fff;
    border-radius: 14px;
    padding: 28px;
    width: 90%;
    max-width: 500px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 25px 60px rgba(0,0,0,0.2);
    animation: modalSlideUp 0.25s ease;
}

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

.modal-content h3 {
    margin-bottom: 18px;
    font-size: 17px;
    color: #1e293b;
    font-weight: 700;
}

.modal-close {
    float: right;
    font-size: 22px;
    cursor: pointer;
    color: #94a3b8;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.2s;
    line-height: 1;
}
.modal-close:hover {
    color: #ef4444;
    background: #fef2f2;
}

/* ========================================
   Action buttons group
   ======================================== */
.action-group {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

/* ========================================
   Quick entry grid
   ======================================== */
.quick-entry-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.quick-entry-grid .btn {
    width: 100%;
    text-align: center;
    padding: 11px 12px;
    font-size: 14px;
    border-radius: 10px;
    font-weight: 600;
}

/* ========================================
   Search / Filter area
   ======================================== */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
    align-items: center;
}

.filter-bar-inline {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    align-items: center;
}

.filter-bar-inline label {
    font-size: 13.5px;
    color: #475569;
    font-weight: 500;
    white-space: nowrap;
}

.filter-bar-inline .form-control {
    max-width: 160px;
}

.filter-bar-right {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
}

/* ========================================
   Toolbar (按钮区 + 搜索区)
   ======================================== */
.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
    justify-content: space-between;
    align-items: center;
}

.toolbar-left {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.toolbar-right {
    display: flex;
    gap: 6px;
    flex-wrap: nowrap;
    align-items: center;
}

/* ========================================
   Info box / Summary box
   ======================================== */
.info-box {
    border-radius: 10px;
    padding: 14px 18px;
    margin-bottom: 16px;
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    font-size: 14px;
}

.info-box-blue {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1e40af;
}

.info-box-amber {
    background: #fffbeb;
    border: 1px solid #fde68a;
    color: #92400e;
}

.info-box-green {
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    color: #065f46;
}

.info-box-slate {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    color: #334155;
}

.info-box .info-value {
    font-weight: 700;
    font-size: 16px;
}

/* ========================================
   Value card grid
   ======================================== */
.value-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 12px;
}
.value-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px 12px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
    background: #fff;
}
.value-card input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}
.value-card:hover {
    border-color: #a5b4fc;
    background: #fafafe;
}
.value-card.selected {
    border-color: #6366f1;
    background: #eef2ff;
    box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
}
.value-card-value {
    font-size: 18px;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 6px;
}
.value-card-price {
    font-size: 13px;
    color: #6366f1;
    font-weight: 600;
    margin-bottom: 4px;
}
.value-card-stock {
    font-size: 12px;
    color: #9ca3af;
}
@media (max-width: 640px) {
    .value-card-grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
        gap: 8px;
    }
    .value-card {
        padding: 12px 8px;
    }
    .value-card-value {
        font-size: 16px;
    }
}

/* ========================================
   Price summary
   ======================================== */
.price-summary {
    background: #f8fafc;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    padding: 14px 18px;
    margin-bottom: 16px;
    display: none;
}

.price-summary.active {
    display: block;
}

.price-summary-inner {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 14px;
    color: #475569;
}

.price-summary .price-total {
    font-size: 16px;
    font-weight: 700;
}

/* ========================================
   Tab navigation (admin_settings)
   ======================================== */
.tab-nav {
    display: flex;
    gap: 0;
    margin-bottom: 20px;
    border-bottom: 2px solid #e5e7eb;
    /*overflow-x: auto;*/
}

.tab-nav a {
    padding: 10px 20px;
    text-decoration: none;
    color: #64748b;
    font-size: 14px;
    font-weight: 500;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
    white-space: nowrap;
}
.tab-nav a:hover {
    color: #334155;
}

.tab-nav a.active {
    color: #6366f1;
    border-bottom-color: #6366f1;
    font-weight: 600;
}

.tab-content {
    display: none;
}
.tab-content.active {
    display: block;
}

/* ========================================
   Form inline layout
   ======================================== */
.form-inline {
    display: flex;
    gap: 8px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.form-inline .form-group {
    margin-bottom: 0;
}

/* ========================================
   Checkbox list
   ======================================== */
.checkbox-list {
    max-height: 200px;
    overflow-y: auto;
    border: 1.5px solid #e5e7eb;
    border-radius: 8px;
    padding: 10px;
}
.checkbox-list label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 400;
    margin-bottom: 6px;
    font-size: 14px;
    cursor: pointer;
    color: #374151;
    padding: 2px 0;
}
.checkbox-list label:last-child {
    margin-bottom: 0;
}
.checkbox-list label:hover {
    color: #6366f1;
}
.checkbox-list .hint {
    font-size: 12px;
    color: #94a3b8;
    margin-top: 6px;
}

/* ========================================
   Modal footer actions
   ======================================== */
.modal-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 20px;
}

/* ========================================
   Balance display (admin)
   ======================================== */
.balance-display {
    background: #f8fafc;
    font-weight: 700;
    font-size: 18px;
    color: #333;
    text-align: center;
    padding: 12px;
    border-radius: 8px;
    border: 1.5px solid #e5e7eb;
}

/* ========================================
   Work order page styles
   ======================================== */
.wo-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 24px;
    padding-bottom: 18px;
    border-bottom: 1px solid #f0f0f0;
}

.wo-header-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.wo-header h2 {
    font-size: 20px;
    margin: 0;
    color: #1e293b;
    font-weight: 700;
}

.wo-header p {
    font-size: 13px;
    color: #94a3b8;
    margin: 3px 0 0;
}

.wo-section {
    margin-bottom: 24px;
}

.wo-section-title {
    font-size: 14.5px;
    font-weight: 600;
    color: #334155;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.wo-section-title .step {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #6366f1;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
}

.wo-section-title .hint {
    font-weight: 400;
    font-size: 12px;
    color: #94a3b8;
}

.wo-textarea {
    width: 100%;
    max-width: 100%;
    min-height: 120px;
    padding: 12px 14px;
    border: 1.5px solid #d1d5db;
    border-radius: 10px;
    font-size: 14px;
    line-height: 1.6;
    resize: vertical;
    transition: border-color 0.2s, box-shadow 0.2s;
    font-family: inherit;
    color: #1e293b;
}
.wo-textarea:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99,102,241,0.12);
}
.wo-textarea::placeholder {
    color: #9ca3af;
}

.wo-codes-container {
    border: 2px dashed #d1d5db;
    border-radius: 10px;
    padding: 12px;
    transition: border-color 0.2s;
}
.wo-codes-container:hover {
    border-color: #6366f1;
}

.wo-code-row {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
    align-items: center;
    animation: fadeIn 0.2s;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

.wo-code-input {
    flex: 1;
    padding: 10px 14px;
    border: 1.5px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
    color: #1e293b;
}
.wo-code-input:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99,102,241,0.1);
}
.wo-code-input::placeholder {
    color: #b0b0b0;
}

.wo-code-del {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    border: none;
    background: #fef2f2;
    color: #ef4444;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}
.wo-code-del:hover {
    background: #ef4444;
    color: #fff;
}

.wo-add-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 9px 16px;
    border: 2px dashed #6366f1;
    border-radius: 8px;
    background: transparent;
    color: #6366f1;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
    width: 100%;
    justify-content: center;
}
.wo-add-btn:hover {
    background: #eef2ff;
    border-style: solid;
}
.wo-add-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}
.wo-radio-group {
    display: flex;
    gap: 20px;
    padding: 4px 0;
}
.wo-radio {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 14px;
    color: #374151;
}
.wo-radio input[type="radio"] {
    width: 16px;
    height: 16px;
    accent-color: #6366f1;
}


.wo-upload-area {
    border: 2px dashed #d1d5db;
    border-radius: 10px;
    padding: 24px;
    text-align: center;
    transition: all 0.2s;
    cursor: pointer;
}
.wo-upload-area:hover {
    border-color: #6366f1;
    background: #fafafe;
}

.wo-upload-area input[type="file"] {
    display: none;
}

.wo-upload-icon {
    font-size: 28px;
    color: #9ca3af;
    margin-bottom: 4px;
}

.wo-upload-text {
    font-size: 13px;
    color: #64748b;
}

.wo-upload-hint {
    font-size: 12px;
    color: #94a3b8;
    margin-top: 4px;
}

.wo-upload-filename {
    font-size: 13px;
    color: #6366f1;
    margin-top: 8px;
    font-weight: 600;
}

.wo-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    padding-top: 8px;
}

.wo-actions .btn-submit {
    padding: 12px 32px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}
.wo-actions .btn-submit:hover {
    opacity: 0.9;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99,102,241,0.3);
}
.wo-actions .btn-submit:active {
    transform: translateY(0);
}

.wo-actions .btn-cancel {
    padding: 12px 24px;
    background: #f9fafb;
    color: #64748b;
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}
.wo-actions .btn-cancel:hover {
    background: #f3f4f6;
    border-color: #d1d5db;
}

.wo-codes-count {
    font-size: 12px;
    color: #94a3b8;
    text-align: right;
    margin-top: 6px;
}

/* ========================================
   Utility classes
   ======================================== */
.text-muted {
    color: #94a3b8;
}

.text-xs {
    font-size: 12px;
}

.text-sm {
    font-size: 13px;
}

.text-right {
    text-align: right;
}

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

.font-bold {
    font-weight: 700;
}

/* ========================================
   Responsive
   ======================================== */
@media (max-width: 768px) {
    .nav-toggle {
        display: flex;
    }

    .nav-menu {
        display: none;
        width: 100%;
        flex-direction: column;
        padding: 8px 0 12px;
        gap: 2px;
    }

    .nav-menu.active {
        display: flex;
        background: #1e293b;
    }

    .nav-link, .nav-user {
        width: 100%;
        padding: 10px 12px;
    }

    .product-switcher {
        margin-left: auto;
        flex-shrink: 0;
    }
    .product-switcher select {
        max-width: 120px;
        font-size: 12px;
    }

    .container {
        padding: 14px 10px;
    }

    .card {
        padding: 16px;
        border-radius: 10px;
    }

    th, td {
        padding: 8px 10px;
        font-size: 12.5px;
    }

    .auth-card {
        margin: 16px;
        padding: 24px;
        border-radius: 14px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .stat-card {
        padding: 14px;
    }
    .stat-card .stat-value {
        font-size: 22px;
    }

    .quick-entry-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }
    .quick-entry-grid .btn {
        padding: 10px 6px;
        font-size: 13px;
    }

    .toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .toolbar-left, .toolbar-right {
        width: 100%;
    }

    .filter-bar {
        flex-direction: column;
    }

    .filter-bar-inline {
        flex-direction: column;
        align-items: stretch;
    }
    .filter-bar-inline label {
        font-size: 13px;
    }
    .filter-bar-inline .form-control {
        max-width: 100%;
    }

    .modal-content {
        padding: 20px;
        width: 95%;
        max-height: 90vh;
    }

    .tab-nav {
        gap: 0;
    }
    .tab-nav a {
        padding: 9px 14px;
        font-size: 13px;
    }

    .wo-textarea {
        min-height: 100px;
        padding: 10px 12px;
    }

    .wo-code-input {
        padding: 8px 10px;
        font-size: 13px;
    }

    .wo-actions .btn-submit, .wo-actions .btn-cancel {
        flex: 1;
        text-align: center;
    }

    .btn {
        padding: 7px 14px;
        font-size: 13px;
    }
}

/* ========================================
   统计图
   ======================================== */
.chart-container {
    position: relative;
    width: 100%;
    height: 320px;
}