* { box-sizing: border-box; }
body { margin: 0; font-family: Arial, "Microsoft YaHei", sans-serif; background: #f5f7fb; color: #1f2937; }
.layout { display: flex; min-height: 100vh; }
.sidebar { width: 230px; background: #111827; color: #fff; padding: 24px 16px; }
.sidebar .brand { font-size: 22px; font-weight: 700; margin-bottom: 8px; }
.sidebar .muted { color: #c7d2fe; font-size: 12px; margin-bottom: 20px; }
.sidebar nav { display: flex; flex-direction: column; gap: 10px; }
.sidebar nav a { color: #fff; text-decoration: none; padding: 10px 12px; border-radius: 8px; background: rgba(255,255,255,0.06); }
.sidebar nav a:hover { background: rgba(255,255,255,0.14); }
.content { flex: 1; padding: 24px; }
.content.full { max-width: 460px; margin: 60px auto; }
.card { background: #fff; border-radius: 14px; padding: 18px; box-shadow: 0 8px 24px rgba(15,23,42,0.08); margin-bottom: 20px; }
.card.narrow { max-width: 420px; }
h1, h2 { margin-top: 0; }
input, select, textarea, button { width: 100%; padding: 10px 12px; margin-top: 6px; margin-bottom: 12px; border: 1px solid #d1d5db; border-radius: 8px; font-size: 14px; }
button { background: #111827; color: #fff; border: none; cursor: pointer; }
button:hover { opacity: 0.92; }
button.danger { background: #b91c1c; }
label { font-size: 13px; color: #4b5563; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat-card { background: #fff; border-radius: 14px; padding: 16px; box-shadow: 0 8px 24px rgba(15,23,42,0.08); }
.stat-label { color: #6b7280; font-size: 13px; }
.stat-value { margin-top: 8px; font-size: 28px; font-weight: 700; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { border-bottom: 1px solid #e5e7eb; padding: 10px 8px; text-align: left; vertical-align: top; }
.inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline-form input, .inline-form button, .inline-form select { width: auto; margin: 0; }
.top-gap { margin-top: 10px; }
.alert.error { background: #fee2e2; color: #991b1b; padding: 10px 12px; border-radius: 8px; margin-bottom: 12px; }
.result-box { white-space: pre-wrap; background: #0f172a; color: #f8fafc; padding: 14px; border-radius: 12px; min-height: 260px; overflow: auto; }
@media (max-width: 980px) { .grid-2 { grid-template-columns: 1fr; } .sidebar { width: 190px; } }
.quote-workbench {
    display: grid;
    grid-template-columns: 520px 1fr;
    gap: 20px;
    align-items: start;
}

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

.result-panel {
    min-height: 720px;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}

.result-header h2 {
    margin: 0;
}

.copy-all-btn {
    width: auto;
    margin: 0;
    padding: 10px 16px;
}

.result-empty {
    min-height: 620px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6b7280;
    background: #f8fafc;
    border: 1px dashed #d1d5db;
    border-radius: 12px;
    font-size: 15px;
}

.simple-result-list {
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
}

.simple-result-head,
.simple-result-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 100px;
    gap: 0;
    align-items: center;
}

.simple-result-head {
    background: #111827;
    color: #fff;
    font-weight: 700;
}

.simple-result-head > div,
.simple-result-row > div {
    padding: 14px 12px;
    border-bottom: 1px solid #e5e7eb;
}

.simple-result-row:last-child > div {
    border-bottom: none;
}

.simple-result-row {
    background: #fff;
}

.simple-result-row:nth-child(even) {
    background: #f9fafb;
}

.simple-result-row.not-found {
    background: #fff7ed;
}

.simple-result-row .oe {
    font-weight: 700;
    color: #111827;
}

.simple-result-row .price {
    font-weight: 700;
    color: #b91c1c;
}

.simple-result-row .quality {
    color: #374151;
}

.simple-result-row .action {
    display: flex;
    align-items: center;
}

.mini-btn {
    width: auto;
    margin: 0;
    padding: 8px 12px;
    font-size: 13px;
    border-radius: 8px;
}

@media (max-width: 1200px) {
    .quote-workbench {
        grid-template-columns: 1fr;
    }

    .query-panel {
        position: static;
    }

    .result-panel {
        min-height: auto;
    }
}

.quote-layout-3col {
    display: grid;
    grid-template-columns: 320px 1fr 1.2fr;
    gap: 18px;
    align-items: start;
}

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

.middle-panel,
.right-panel {
    min-height: 760px;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.panel-header h2 {
    margin: 0;
    font-size: 22px;
}

.copy-all-btn {
    width: auto;
    margin: 0;
    padding: 10px 16px;
    font-size: 14px;
}

.panel-empty {
    min-height: 680px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6b7280;
    background: #f8fafc;
    border: 1px dashed #d1d5db;
    border-radius: 12px;
    font-size: 14px;
    text-align: center;
    padding: 24px;
}

.result-table {
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
}

.result-head,
.result-row {
    display: grid;
    grid-template-columns: 1.6fr 1fr 1fr 90px;
    align-items: center;
}

.result-head {
    background: #0f172a;
    color: #fff;
    font-weight: 700;
}

.result-head > div,
.result-row > div {
    padding: 14px 12px;
    border-bottom: 1px solid #e5e7eb;
}

.result-row:last-child > div {
    border-bottom: none;
}

.result-row:nth-child(even) {
    background: #f9fafb;
}

.result-row.not-found {
    background: #fff7ed;
}

.result-row .oe {
    font-weight: 700;
    color: #111827;
}

.result-row .price {
    font-weight: 700;
    color: #b91c1c;
}

.result-row .quality {
    color: #374151;
}

.result-row .action {
    display: flex;
    align-items: center;
}

.detail-head,
.detail-row {
    display: grid;
    grid-template-columns: 1.2fr 1.4fr 1fr 1fr 0.8fr 0.8fr;
    align-items: center;
}

.detail-head {
    background: #111827;
    color: #fff;
    font-weight: 700;
}

.detail-head > div,
.detail-row > div {
    padding: 12px 10px;
    border-bottom: 1px solid #e5e7eb;
    word-break: break-word;
}

.detail-row:last-child > div {
    border-bottom: none;
}

.detail-row:nth-child(even) {
    background: #f9fafb;
}

.detail-row.not-found {
    background: #fff7ed;
}

.detail-row .price {
    font-weight: 700;
    color: #b91c1c;
}

.mini-btn {
    width: auto;
    margin: 0;
    padding: 8px 12px;
    font-size: 13px;
    border-radius: 8px;
}

@media (max-width: 1600px) {
    .quote-layout-3col {
        grid-template-columns: 300px 1fr;
    }

    .right-panel {
        grid-column: 1 / -1;
    }
}

@media (max-width: 1100px) {
    .quote-layout-3col {
        grid-template-columns: 1fr;
    }

    .left-panel {
        position: static;
    }

    .middle-panel,
    .right-panel {
        min-height: auto;
    }

    .panel-empty {
        min-height: 260px;
    }
}

.stock-v2-layout {
    display: grid;
    grid-template-columns: 360px 1fr 1fr;
    gap: 18px;
    align-items: start;
}

.stock-left {
    position: sticky;
    top: 20px;
}

.stock-middle,
.stock-right {
    min-height: 720px;
}

.stack-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.stock-tip {
    margin-bottom: 16px;
    padding: 14px;
    border-radius: 10px;
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    color: #374151;
    line-height: 1.7;
    font-size: 14px;
}

.stock-template-box {
    margin-top: 16px;
    padding: 14px;
    border-radius: 10px;
    background: #0f172a;
    color: #fff;
}

.stock-template-box .template-title {
    font-weight: 700;
    margin-bottom: 8px;
}

.stock-template-box pre {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 13px;
    line-height: 1.6;
}

.soft-line {
    border: none;
    border-top: 1px solid #e5e7eb;
    margin: 18px 0;
}

.stock-search-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 14px;
}

.stock-search-bar input {
    flex: 1;
}

.stock-search-bar button {
    width: auto;
    margin: 0;
    padding: 10px 16px;
}

.stock-simple-table,
.stock-log-table {
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
}

.stock-simple-head,
.stock-simple-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1.2fr 100px;
    align-items: center;
}

.stock-log-head,
.stock-log-row {
    display: grid;
    grid-template-columns: 1.4fr 1.4fr 0.8fr 0.8fr 1fr;
    align-items: center;
}

.stock-simple-head,
.stock-log-head {
    background: #0f172a;
    color: #fff;
    font-weight: 700;
}

.stock-simple-head > div,
.stock-simple-row > div,
.stock-log-head > div,
.stock-log-row > div {
    padding: 12px 10px;
    border-bottom: 1px solid #e5e7eb;
    word-break: break-word;
}

.stock-simple-row:last-child > div,
.stock-log-row:last-child > div {
    border-bottom: none;
}

.stock-simple-row:nth-child(even),
.stock-log-row:nth-child(even) {
    background: #f9fafb;
}

.stock-simple-row .sku {
    font-weight: 700;
    color: #111827;
}

.status-badge {
    display: inline-block;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}

.in-stock {
    background: #dcfce7;
    color: #166534;
}

.out-stock {
    background: #fee2e2;
    color: #991b1b;
}

.danger-btn {
    background: #dc2626;
}

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

.alert {
    margin-bottom: 14px;
    padding: 12px 14px;
    border-radius: 10px;
    font-size: 14px;
}

.alert.success {
    background: #dcfce7;
    color: #166534;
}

.alert.error {
    background: #fee2e2;
    color: #991b1b;
}

@media (max-width: 1600px) {
    .stock-v2-layout {
        grid-template-columns: 360px 1fr;
    }

    .stock-right {
        grid-column: 1 / -1;
    }
}

@media (max-width: 1100px) {
    .stock-v2-layout {
        grid-template-columns: 1fr;
    }

    .stock-left {
        position: static;
    }

    .stock-middle,
    .stock-right {
        min-height: auto;
    }
}

/* Pagination */
.pagination-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 16px 0;
    margin-top: 12px;
}

.page-link {
    display: inline-block;
    padding: 8px 16px;
    background: #111827;
    color: #fff;
    border-radius: 8px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
}

.page-link:hover {
    opacity: 0.85;
}

.page-link.disabled {
    background: #d1d5db;
    color: #6b7280;
    cursor: default;
}

.page-info {
    font-size: 14px;
    color: #6b7280;
}

/* Export button */
.export-btn {
    display: inline-block;
    padding: 8px 16px;
    background: #059669;
    color: #fff;
    border-radius: 8px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
}

.export-btn:hover {
    background: #047857;
}

/* Sidebar nav divider */
.nav-divider {
    color: #6b7280;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 12px 12px 4px;
    margin-top: 4px;
}

/* Filter form */
.filter-form {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.filter-form input,
.filter-form select {
    width: auto;
    margin: 0;
    padding: 8px 12px;
}

.filter-form button {
    width: auto;
    margin: 0;
    padding: 8px 16px;
}

/* Page description */
.page-desc {
    color: #6b7280;
    font-size: 14px;
    margin-bottom: 16px;
    line-height: 1.6;
}

/* API docs */
.api-docs h3 {
    margin-top: 20px;
    margin-bottom: 8px;
    font-size: 16px;
}

.api-docs code {
    background: #f1f5f9;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 13px;
}

.api-docs pre code {
    background: none;
    padding: 0;
}

.api-docs table {
    font-size: 13px;
}

/* Search bar */
.search-bar {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 14px;
}

.search-bar input {
    flex: 1;
    margin: 0;
}

.search-bar button {
    width: auto;
    margin: 0;
    padding: 8px 16px;
}

/* Form grid layout */
.add-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    align-items: end;
}

.form-group label {
    display: block;
    font-size: 13px;
    color: #4b5563;
    margin-bottom: 4px;
    font-weight: 600;
}

.form-group input,
.form-group select {
    width: 100%;
    margin: 0;
}

/* h2 inside cards */
.card h2 {
    font-size: 16px;
    color: #374151;
    margin-bottom: 12px;
}

/* Toggle row */
.toggle-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 8px;
    margin-bottom: 12px;
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 600;
    color: #166534;
    cursor: pointer;
    margin: 0;
}

.toggle-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 0;
}

.toggle-hint {
    font-size: 12px;
    color: #6b7280;
}

/* Plan info bar */
.plan-info-bar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 10px 16px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 14px;
    color: #1e40af;
}

.plan-info-bar strong {
    font-weight: 700;
}

.upgrade-link {
    margin-left: auto;
    padding: 4px 12px;
    background: #2563eb;
    color: #fff;
    border-radius: 6px;
    text-decoration: none;
    font-size: 13px;
}

.upgrade-link:hover {
    background: #1d4ed8;
}

/* Registration form */
.register-form {
    max-width: 400px;
    margin: 40px auto;
}

.register-form label {
    font-weight: 600;
}

.register-form button {
    margin-top: 8px;
}

.login-link {
    text-align: center;
    margin-top: 16px;
    font-size: 14px;
    color: #6b7280;
}

.login-link a {
    color: #2563eb;
}

/* Feedback page */
.feedback-form textarea {
    min-height: 120px;
    resize: vertical;
}

.feedback-list .feedback-item {
    padding: 14px;
    border-bottom: 1px solid #e5e7eb;
}

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

.feedback-meta {
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 6px;
}

.feedback-reply {
    margin-top: 8px;
    padding: 10px;
    background: #f0fdf4;
    border-left: 3px solid #22c55e;
    border-radius: 4px;
    font-size: 13px;
}

.status-tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

.status-open { background: #fef3c7; color: #92400e; }
.status-replied { background: #dcfce7; color: #166534; }
.status-closed { background: #f3f4f6; color: #6b7280; }

/* Admin market quote */
.table-scroll {
    width: 100%;
    overflow-x: auto;
}

.market-table {
    min-width: 1380px;
}

.market-table th,
.market-table td {
    white-space: normal;
}

.nowrap {
    white-space: nowrap;
}

.price-cell {
    font-weight: 700;
    color: #991b1b;
    white-space: nowrap;
}

.unknown-stock {
    background: #f3f4f6;
    color: #4b5563;
}
