* { margin: 0; padding: 0; box-sizing: border-box; }

body { 
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; 
    background: #f5f7fa; 
    padding: 20px; 
}

.container {
    /* max-width: 1800px; */
    margin: 0 auto;
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr);
    gap: 24px;
    align-items: start;
}

.workspace-main {
    min-width: 0;
}

.workspace-main > * {
    min-width: 0;
}

h1 { color: #333; margin-bottom: 15px; text-align: left; }

.workspace-hero {
    position: sticky;
    top: 20px;
    grid-column: 1;
    margin: 0;
    padding: 22px 24px;
    align-self: start;
    border-radius: 18px;
    background:
        radial-gradient(circle at top right, rgba(24, 144, 255, 0.16), transparent 28%),
        linear-gradient(135deg, #ffffff 0%, #eef6ff 100%);
    border: 1px solid rgba(24, 144, 255, 0.12);
    box-shadow: 0 14px 34px rgba(24, 144, 255, 0.08);
}

.workspace-copy { max-width: none; }

.workspace-eyebrow {
    margin-bottom: 10px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #1890ff;
}

.workspace-title {
    font-size: 28px;
    line-height: 1.12;
    font-weight: 700;
    color: #0f172a;
}

.workspace-subtitle {
    margin-top: 12px;
    font-size: 14px;
    line-height: 1.75;
    color: #475569;
}

.workspace-nav {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    margin-top: 20px;
}

.workspace-card {
    display: block;
    padding: 16px 18px;
    border-radius: 16px;
    text-decoration: none;
    background: rgba(255, 255, 255, 0.88);
    border: 1px solid rgba(148, 163, 184, 0.2);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.05);
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.workspace-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 30px rgba(15, 23, 42, 0.1);
    border-color: rgba(24, 144, 255, 0.28);
}

.workspace-card strong {
    display: block;
    font-size: 16px;
    color: #0f172a;
}

.workspace-card span {
    display: block;
    margin-top: 8px;
    font-size: 13px;
    line-height: 1.6;
    color: #64748b;
}

.workspace-card.active {
    background: linear-gradient(135deg, #1890ff 0%, #36a3ff 100%);
    border-color: transparent;
}

.workspace-card.active strong,
.workspace-card.active span {
    color: white;
}

.filter-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    align-items: center;
    flex-wrap: wrap;
}
.filter-bar select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    background: white;
}
.filter-bar select:focus { border-color: #1890ff; outline: none; }

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

.stat-card { 
    background: white; 
    padding: 15px 25px; 
    border-radius: 8px; 
    box-shadow: 0 2px 8px rgba(0,0,0,0.1); 
    flex: 1; 
    text-align: center; 
}

.stat-card .value { font-size: 24px; font-weight: bold; color: #1890ff; }
.stat-card .label { color: #666; margin-top: 5px; font-size: 14px; }

table { 
    width: 100%; 
    background: white; 
    border-radius: 8px; 
    overflow: hidden; 
    box-shadow: 0 2px 8px rgba(0,0,0,0.1); 
    border-collapse: collapse; 
}

th, td { padding: 12px 15px; text-align: left; border-bottom: 1px solid #eee; }
th { background: #1890ff; color: white; font-weight: 500; }
tr:hover { background: #f8f9fa; }
tr.row-won { background: #e6fffb; border-left: 3px solid #13c2c2; }
tr.row-won:hover { background: #b5f5ec; }
tr.row-diff-up { background: #f6ffed; }
tr.row-diff-down { background: #fff1f0; }
tr.row-order-time { background: #fff566; font-weight: bold; border-left: 3px solid #fa8c16 !important; }
td[title]:hover { cursor: help; color: #1890ff; }
tr:last-child td { border-bottom: none; }

.pagination { display: flex; justify-content: center; align-items: center; gap: 8px; margin-top: 20px; }
.pagination button { padding: 8px 16px; border: 1px solid #ddd; background: white; border-radius: 4px; cursor: pointer; }
.pagination button:hover { background: #1890ff; color: white; border-color: #1890ff; }
.pagination button:disabled { opacity: 0.5; cursor: not-allowed; }
.pagination .info { padding: 8px 16px; color: #666; }

.status-success { color: #52c41a; }
.status-failed { color: #ff4d4f; }
.status-live { color: #1890ff; }
.status-pending { color: #faad14; }
.side-up { color: #52c41a; font-weight: bold; }
.side-down { color: #ff4d4f; font-weight: bold; }

.loading { text-align: center; padding: 40px; color: #666; }
.error { text-align: center; padding: 40px; color: #ff4d4f; }

#content {
    overflow-x: auto;
}

#content > table {
    min-width: 1750px;
    table-layout: auto;
}

#content > table th,
#content > table td {
    white-space: nowrap;
    vertical-align: middle;
}

.refresh-btn { 
    padding: 10px 20px; 
    background: #1890ff; 
    color: white; 
    border: none; 
    border-radius: 4px; 
    cursor: pointer; 
    margin-bottom: 20px; 
}
.refresh-btn:hover { background: #40a9ff; }
.resolve-btn {
    padding: 10px 20px;
    background: #52c41a;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    margin-left: 10px;
}
.resolve-btn:hover { background: #73d13d; }
.resolve-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.page-link-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    background: white;
    color: #1890ff;
    border: 1px solid #91caff;
    border-radius: 4px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.page-link-btn:hover {
    background: #e6f4ff;
    border-color: #69b1ff;
}

.slug-link { color: #1890ff; text-decoration: none; }
.slug-link:hover { text-decoration: underline; }

.price-btn {
    padding: 4px 10px;
    background: #1890ff;
    color: white;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
}
.price-btn:hover { background: #40a9ff; }
.remark-btn {
    padding: 4px 10px;
    background: #fa8c16;
    color: white;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
}
.remark-btn:hover { background: #ffa940; }
.delete-btn {
    padding: 4px 10px;
    background: #ff4d4f;
    color: white;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
}
.delete-btn:hover { background: #ff7875; }

.modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}
.modal-content {
    background: white;
    border-radius: 8px;
    width: auto;
    min-width: 600px;
    max-width: 95vw;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}
#priceModal .modal-content {
    width: auto;
    min-width: 850px;
}
#priceChart {
    min-width: 800px;
    height: 380px !important;
}
.modal-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 15px 20px; border-bottom: 1px solid #eee;
}
.modal-header h3 { margin: 0; font-size: 16px; color: #333; }
.modal-close {
    font-size: 24px; cursor: pointer; color: #999; line-height: 1;
}
.modal-close:hover { color: #333; }
.modal-body { padding: 20px; max-height: 60vh; overflow-y: auto; overflow-x: auto; }
.modal-body::-webkit-scrollbar { width: 6px; }
.modal-body::-webkit-scrollbar-track { background: #f1f1f1; border-radius: 3px; }
.modal-body::-webkit-scrollbar-thumb { background: #c1c1c1; border-radius: 3px; }
.modal-body::-webkit-scrollbar-thumb:hover { background: #a8a8a8; }
.modal-controls {
    display: flex; align-items: center; gap: 8px; margin-bottom: 12px;
}
.modal-info {
    padding: 8px 12px; background: #f5f7fa; border-radius: 4px;
    font-size: 13px; color: #666; word-break: break-all;
}

.price-timeline {
    margin-top: 12px;
}

.timeline-summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 10px;
}

.timeline-summary > div {
    padding: 10px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    background: #ffffff;
}

.timeline-label {
    display: block;
    margin-bottom: 4px;
    font-size: 12px;
    color: #64748b;
}

.timeline-notes {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

.timeline-note {
    padding: 6px 10px;
    border-radius: 4px;
    background: #fff7e6;
    border: 1px solid #ffd591;
    color: #ad4e00;
    font-size: 13px;
}

.timeline-table-wrap {
    overflow-x: auto;
    margin-bottom: 12px;
}

.timeline-table {
    min-width: 1060px;
    box-shadow: none;
    border: 1px solid #e5e7eb;
}

.timeline-table th,
.timeline-table td {
    padding: 8px 10px;
    font-size: 12px;
    white-space: nowrap;
}

.timeline-row-order {
    background: #fff7e6 !important;
    border-left: 3px solid #fa8c16;
    font-weight: 600;
}

.timeline-row-final {
    background: #f0f5ff !important;
    border-left: 3px solid #2f54eb;
    font-weight: 600;
}

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

    .workspace-hero {
        position: static;
        margin-bottom: 0;
    }

    h1 {
        text-align: center;
    }

    .workspace-nav {
        grid-template-columns: 1fr;
    }
}
