/* KK Company System — Clean Corporate Theme */
:root {
    --bg: #f5f6fa;
    --card: #ffffff;
    --text: #1a1a2e;
    --text-muted: #6b7280;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --success: #059669;
    --danger: #dc2626;
    --info: #0891b2;
    --border: #e5e7eb;
    --input-bg: #f9fafb;
    --nav-bg: #1e293b;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.08);
}

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

body {
    font-family: 'Noto Sans Thai', 'Inter', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    font-size: 14px;
}

/* ---- Navbar ---- */
.navbar {
    background: var(--nav-bg);
    color: #fff;
    padding: 0 1.5rem;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}
.nav-brand {
    color: #fff;
    font-weight: 700;
    font-size: 1.1rem;
    text-decoration: none;
    letter-spacing: 0.5px;
}
.nav-right { display: flex; align-items: center; gap: 1rem; }
.nav-link {
    color: #94a3b8;
    text-decoration: none;
    font-size: 0.85rem;
    transition: color 0.2s;
}
.nav-link:hover { color: #fff; }
.nav-user { color: #94a3b8; font-size: 0.85rem; }
.nav-logout { color: #f87171 !important; }

/* ---- Container ---- */
.container { max-width: 1200px; margin: 0 auto; padding: 1.5rem; }

/* ---- Login ---- */
.login-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
}
.login-card {
    background: var(--card);
    border-radius: 12px;
    padding: 2.5rem;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}
.login-header { text-align: center; margin-bottom: 2rem; }
.login-header h1 { font-size: 1.5rem; margin-bottom: 0.25rem; }
.login-header p { color: var(--text-muted); font-size: 0.9rem; }

/* ---- Portal ---- */
.portal { text-align: center; }
.portal-header { margin-bottom: 2rem; }
.portal-header h1 { font-size: 1.5rem; }
.portal-header p { color: var(--text-muted); }

.module-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1rem;
    text-align: left;
}
.module-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    text-decoration: none;
    color: var(--text);
    transition: all 0.2s;
    box-shadow: var(--shadow);
}
.module-card:hover {
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.15);
    transform: translateY(-2px);
}
.module-icon { font-size: 2rem; }
.module-info h3 { font-size: 1rem; margin-bottom: 0.25rem; }
.module-info p { font-size: 0.8rem; color: var(--text-muted); }

.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
}

/* ---- Page Header ---- */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.page-header h1 { font-size: 1.3rem; }
.page-actions { display: flex; gap: 0.5rem; }

/* ---- Forms ---- */
.form-group { margin-bottom: 1rem; }
.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.3rem;
    font-size: 0.85rem;
}
.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-family: inherit;
    background: var(--input-bg);
    transition: border-color 0.2s;
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
}
.form-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

/* ---- Search ---- */
.search-bar { display: flex; gap: 0.5rem; margin-bottom: 1rem; }
.input-search {
    flex: 1;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-family: inherit;
    background: var(--card);
}
.input-search:focus { outline: none; border-color: var(--primary); }

/* ---- Table ---- */
.table-wrapper {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow-x: auto;
    box-shadow: var(--shadow);
}
.table { width: 100%; border-collapse: collapse; }
.table th {
    background: var(--input-bg);
    padding: 0.6rem 0.75rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    border-bottom: 2px solid var(--border);
}
.table td {
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
    vertical-align: middle;
}
.table tbody tr:hover { background: #f8fafc; }

/* ---- Card ---- */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
}
.card h3 { margin-bottom: 1rem; font-size: 1rem; }

/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: var(--radius);
    font-size: 0.85rem;
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
    white-space: nowrap;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: var(--input-bg); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { opacity: 0.9; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { opacity: 0.9; }
.btn-info { background: var(--info); color: #fff; }
.btn-info:hover { opacity: 0.9; }
.btn-sm { padding: 0.3rem 0.6rem; font-size: 0.8rem; }
.btn-full { width: 100%; justify-content: center; padding: 0.7rem; }

/* ---- Badges ---- */
.badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 500;
}
.badge-success { background: #d1fae5; color: #065f46; }
.badge-muted { background: #f3f4f6; color: #6b7280; }
.badge-info { background: #cffafe; color: #0e7490; }

/* ---- Alert ---- */
.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-size: 0.9rem;
}
.alert-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }

/* ---- Utilities ---- */
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
code {
    background: var(--input-bg);
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    font-size: 0.85em;
}
small { font-size: 0.8rem; }
.actions { white-space: nowrap; }
.actions .btn { margin-right: 0.25rem; }

/* ---- Planning ---- */
.plan-info {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.5rem;
    margin-bottom: 1rem;
}
.info-grid {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
}
.info-item { display: flex; flex-direction: column; }
.info-label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); }
.info-value { font-size: 1.1rem; font-weight: 600; }

.calc-legend {
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: var(--radius);
    padding: 0.6rem 1rem;
    font-size: 0.8rem;
    margin-bottom: 1rem;
    color: #92400e;
}

.table-compact td, .table-compact th { padding: 0.35rem 0.5rem; font-size: 0.82rem; }
.text-right { text-align: right; }
.text-danger { color: var(--danger) !important; font-weight: 600; }
.text-success { color: var(--success) !important; }

.group-header td {
    background: #f1f5f9 !important;
    padding: 0.4rem 0.5rem;
    border-bottom: 2px solid var(--border);
}

.row-need { background: #fef2f2; }
.row-ok { }
.row-has-data { background: #f0fdf4; }
.row-inactive { background: #f9fafb; opacity: 0.55; }
.row-inactive td { color: var(--text-muted); }

.input-mini {
    width: 70px;
    padding: 0.25rem 0.4rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.82rem;
    text-align: right;
    font-family: inherit;
}
.input-mini:focus { outline: none; border-color: var(--primary); }

.input-mini-wide {
    width: 150px;
    padding: 0.25rem 0.4rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.82rem;
    font-family: inherit;
}

.sp-col { min-width: 50px; }
.has-fc { background: #ecfdf5; font-weight: 600; }

/* Forecast cards */
.fc-group-header {
    background: var(--nav-bg);
    color: #fff;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    font-weight: 600;
    margin: 1.5rem 0 0.5rem;
}
.fc-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 0.75rem;
    overflow: hidden;
}
.fc-has-data { border-left: 3px solid var(--primary); }
.fc-product {
    padding: 0.6rem 1rem;
    background: var(--input-bg);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}
.fc-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1px;
    background: var(--border);
}
.fc-section {
    padding: 0.75rem 1rem;
    background: var(--card);
}
.fc-section-title {
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}
.fc-cust-table { margin-bottom: 0.75rem; }
.fc-cust-table td, .fc-cust-table th { padding: 0.2rem 0.4rem; font-size: 0.8rem; }
.fc-total-row td { border-top: 2px solid var(--border); }
.fc-input-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.4rem;
}
.fc-input-row label { font-size: 0.82rem; min-width: 80px; white-space: nowrap; }
.input-note {
    flex: 1;
    padding: 0.25rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.82rem;
    font-family: inherit;
}
@media (max-width: 768px) {
    .fc-body { grid-template-columns: 1fr; }
}

/* Filter bar */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    padding: 0.5rem 1rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    flex-wrap: wrap;
}
.filter-label { font-weight: 600; font-size: 0.85rem; color: var(--text-muted); }
.filter-btn {
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    font-size: 0.82rem;
    text-decoration: none;
    color: var(--text);
    background: var(--input-bg);
    border: 1px solid var(--border);
    transition: all 0.15s;
}
.filter-btn:hover { background: var(--border); }
.filter-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.filter-count {
    display: inline-block;
    background: rgba(0,0,0,0.1);
    padding: 0 0.4rem;
    border-radius: 999px;
    font-size: 0.75rem;
    margin-left: 0.2rem;
}
.filter-btn.active .filter-count { background: rgba(255,255,255,0.25); }
.filter-info { font-size: 0.8rem; color: var(--text-muted); }

/* Status badge & menu */
.status-cell { position: relative; display: flex; align-items: center; gap: 2px; }
.status-badge {
    display: inline-block;
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 500;
    white-space: nowrap;
}
.status-active { background: #d1fae5; color: #065f46; }
.status-discontinued { background: #fee2e2; color: #991b1b; }
.status-out_of_stock { background: #fef3c7; color: #92400e; }
.status-suspended { background: #e0e7ff; color: #3730a3; }

.status-toggle-btn {
    background: none;
    border: 1px solid var(--border);
    border-radius: 3px;
    cursor: pointer;
    font-size: 0.7rem;
    padding: 0 3px;
    color: var(--text-muted);
    line-height: 1;
}
.status-toggle-btn:hover { background: var(--input-bg); }

.status-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 100;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    min-width: 130px;
    padding: 0.25rem 0;
}
.status-menu.show { display: block; }
.status-option {
    display: block;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    padding: 0.35rem 0.75rem;
    font-size: 0.82rem;
    font-family: inherit;
    cursor: pointer;
    color: var(--text);
}
.status-option:hover { background: var(--input-bg); }
.status-option.current { font-weight: 700; color: var(--primary); }

/* Upload cards */
.upload-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow);
}
.upload-header {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 0.75rem;
}
.upload-header h3 { margin: 0; font-size: 1rem; }
.upload-header p { margin: 0.2rem 0 0; }
.upload-num {
    background: var(--primary);
    color: #fff;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    flex-shrink: 0;
}
.upload-columns {
    background: var(--input-bg);
    border-radius: 4px;
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
    margin-bottom: 0.75rem;
}
.upload-columns code { margin: 0 0.15rem; font-size: 0.75rem; }
.upload-form {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}
.upload-form input[type="file"] { font-size: 0.85rem; }
.upload-form input[type="date"],
.upload-form input[type="month"] {
    padding: 0.4rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.85rem;
    font-family: inherit;
}

/* ---- Primary Vendor ---- */
.pv-card { margin-bottom: 1rem; padding: 0; overflow: hidden; }
.pv-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 0.6rem 1rem; background: var(--input-bg); border-bottom: 1px solid var(--border);
}
.pv-table { margin: 0; }
.pv-table td, .pv-table th { padding: 0.4rem 0.75rem; }
.pv-primary { background: #eff6ff; }
.pv-star { color: #f59e0b; font-size: 1.2rem; }
.pv-star-empty { color: var(--border); font-size: 1.2rem; }
.pv-note { width: 100%; max-width: 300px; font-size: 0.82rem; padding: 0.2rem 0.4rem; }
.pv-form { display: inline; }

/* ---- Dashboard ---- */
.dash-filter {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}
.dash-filter select {
    padding: 0.4rem 0.6rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 0.85rem;
    background: var(--card);
}
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.kpi-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow);
}
.kpi-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 0.3rem;
}
.kpi-value {
    font-size: 1.8rem;
    font-weight: 700;
    line-height: 1.2;
}
.kpi-sub { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.2rem; }
.kpi-up { color: var(--success) !important; }
.kpi-down { color: var(--danger) !important; }

.dash-section { margin-bottom: 1.5rem; }
.dash-section h3 { margin-bottom: 1rem; font-size: 1rem; }

.dash-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

/* ---- Period Tabs ---- */
.period-tabs { display: flex; gap: 2px; background: var(--border); border-radius: var(--radius); overflow: hidden; }
.period-tab {
    padding: 0.4rem 0.75rem;
    font-size: 0.82rem;
    font-weight: 600;
    text-decoration: none;
    color: var(--text-muted);
    background: var(--card);
    transition: all 0.15s;
}
.period-tab:hover { background: var(--input-bg); color: var(--text); }
.period-tab.active { background: var(--primary); color: #fff; }

/* ---- Month Picker ---- */
.month-picker { display: flex; flex-direction: column; gap: 0.75rem; }
.mp-year-group { display: flex; flex-direction: column; gap: 0.35rem; }
.mp-year-row { display: flex; gap: 0.35rem; align-items: center; }
.mp-month-row { display: flex; gap: 0.3rem; flex-wrap: wrap; padding-left: 0.5rem; }
.mp-btn {
    display: inline-block; padding: 0.3rem 0.6rem; font-size: 0.8rem; font-weight: 500;
    text-decoration: none; border-radius: 6px; border: 1px solid var(--border);
    color: var(--text-muted); background: var(--card); transition: all 0.15s; cursor: pointer;
}
.mp-btn:hover { background: #e8eaf1; color: var(--text); border-color: var(--primary); }
.mp-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.mp-year { font-weight: 700; font-size: 0.85rem; min-width: 50px; text-align: center; }
.mp-quarter { font-weight: 600; min-width: 36px; text-align: center; }
.mp-month { min-width: 42px; text-align: center; font-size: 0.78rem; }
.mp-selected { font-size: 0.85rem; color: var(--text-muted); }

/* ---- SP Layout (Polar + Ranking) ---- */
.sp-layout {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 1.5rem;
    align-items: start;
    margin-top: 0.5rem;
}
.sp-chart-wrap {
    position: sticky;
    top: 1rem;
}
.sp-ranking {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}
.sp-rank-card {
    display: grid;
    grid-template-columns: 36px 1fr auto;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.85rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-left: 4px solid var(--rank-color, var(--primary));
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--text);
    transition: all 0.2s;
}
.sp-rank-card:hover {
    border-color: var(--rank-color, var(--primary));
    background: #f8faff;
    transform: translateX(4px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.sp-rank-pos {
    width: 32px; height: 32px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%;
    background: var(--rank-color, var(--primary));
    color: #fff;
    font-weight: 700;
    font-size: 0.85rem;
}
.sp-rank-info { min-width: 0; }
.sp-rank-name { font-weight: 600; font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sp-rank-detail { font-size: 0.75rem; color: var(--text-muted); }
.sp-rank-amt { text-align: right; min-width: 140px; }
.sp-rank-value { font-weight: 700; font-size: 0.95rem; color: var(--text); }
.sp-rank-bar {
    height: 4px;
    background: var(--rank-color, var(--primary));
    border-radius: 2px;
    margin-top: 3px;
    transition: width 0.4s ease;
    opacity: 0.6;
}

/* Legacy SP cards (keep for other pages) */
.sp-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 0.75rem;
    margin-top: 1rem;
}
.sp-card {
    display: block;
    padding: 0.75rem 1rem;
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--text);
    transition: all 0.15s;
}
.sp-card:hover { border-color: var(--primary); background: #eff6ff; }
.sp-card-name { font-weight: 600; font-size: 0.95rem; }
.sp-card-qty { font-size: 1.3rem; font-weight: 700; color: var(--primary); }
.sp-card-sub { font-size: 0.75rem; color: var(--text-muted); }

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .form-row { grid-template-columns: 1fr; }
    .page-header { flex-direction: column; align-items: flex-start; }
    .navbar { padding: 0 1rem; }
    .nav-right { gap: 0.5rem; font-size: 0.8rem; }
    .module-grid { grid-template-columns: 1fr; }
    .container { padding: 1rem; }
    .dash-grid-2 { grid-template-columns: 1fr; }
    .kpi-grid { grid-template-columns: repeat(2, 1fr); }
    .sp-layout { grid-template-columns: 1fr; }
    .sp-chart-wrap { max-width: 260px; margin: 0 auto; }
    .sp-rank-amt { min-width: 100px; }
}


/* ============================================
   BD PROGRESS TRACKER
   ============================================ */

.bd-page { padding: 1.5rem 0; }

.bd-page .page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.bd-page .page-header h1 { font-size: 1.5rem; font-weight: 700; }
.bd-page .subtitle { color: var(--text-muted); font-size: 0.9rem; }
.header-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* KPI Grid */
.bd-page .kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}
.bd-page .kpi-card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 1.2rem;
    box-shadow: var(--shadow);
    text-align: center;
    border-left: 4px solid var(--primary);
}
.bd-page .kpi-card.kpi-money { border-left-color: #f59e0b; }
.bd-page .kpi-card.kpi-weighted { border-left-color: #8b5cf6; }
.bd-page .kpi-card.kpi-won { border-left-color: var(--success); }
.bd-page .kpi-card.kpi-lost { border-left-color: var(--danger); }
.bd-page .kpi-card.kpi-project { border-left-color: var(--info); }
.bd-page .kpi-icon { font-size: 1.5rem; margin-bottom: 0.3rem; }
.bd-page .kpi-value { font-size: 1.4rem; font-weight: 700; }
.bd-page .kpi-label { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.2rem; }

/* Section Row */
.section-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}
.section-card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
}
.section-card h2 { font-size: 1.1rem; font-weight: 600; margin-bottom: 1rem; }
.view-all {
    display: block;
    text-align: center;
    color: var(--primary);
    text-decoration: none;
    font-size: 0.85rem;
    margin-top: 1rem;
    padding-top: 0.8rem;
    border-top: 1px solid var(--border);
}

/* Pipeline Funnel */
.funnel { display: flex; flex-direction: column; gap: 0.4rem; }
.funnel-row {
    display: flex;
    justify-content: center;
}
.funnel-bar {
    width: var(--width, 100%);
    background: linear-gradient(135deg, #e0e7ff, #c7d2fe);
    border-radius: 6px;
    padding: 0.6rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s;
    font-size: 0.85rem;
}
.funnel-bar:hover { transform: scale(1.02); box-shadow: 0 2px 8px rgba(0,0,0,0.1); }
.funnel-icon { font-size: 1.1rem; }
.funnel-label { font-weight: 500; }
.funnel-count { margin-left: auto; color: var(--text-muted); font-size: 0.8rem; }
.funnel-value { font-weight: 600; color: var(--primary); font-size: 0.8rem; }

/* Project List (dashboard) */
.bd-page .project-list { display: flex; flex-direction: column; gap: 0.5rem; }
.bd-page .project-item {
    display: flex;
    gap: 1rem;
    align-items: center;
    padding: 0.7rem;
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--text);
    transition: background 0.15s;
}
.bd-page .project-item:hover { background: var(--input-bg); }
.project-date {
    min-width: 50px;
    text-align: center;
    background: var(--primary);
    color: #fff;
    border-radius: 6px;
    padding: 0.4rem;
}
.date-day { display: block; font-size: 1.2rem; font-weight: 700; line-height: 1; }
.date-month { display: block; font-size: 0.7rem; text-transform: uppercase; }
.project-info { flex: 1; }
.project-title { font-weight: 600; font-size: 0.9rem; }
.project-customer { font-size: 0.8rem; color: var(--text-muted); }
.project-status { font-size: 0.78rem; }

/* Activity List */
.activity-list { display: flex; flex-direction: column; gap: 0.5rem; }
.activity-item {
    display: flex;
    gap: 1rem;
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.85rem;
}
.activity-time { min-width: 75px; color: var(--text-muted); font-size: 0.78rem; }
.activity-ref { color: var(--primary); text-decoration: none; font-weight: 500; font-size: 0.8rem; }
.activity-text { margin-top: 0.2rem; }
.activity-by { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.2rem; }

/* Filters */
.filter-bar { margin-bottom: 1rem; }
.filter-form { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.input-search, .input-select {
    padding: 0.5rem 0.8rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.85rem;
    font-family: inherit;
    background: var(--card);
}
.input-search { flex: 1; min-width: 200px; }

/* Stage Pills */
.stage-pills { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-bottom: 1.2rem; }
.pill {
    padding: 0.35rem 0.8rem;
    border-radius: 20px;
    font-size: 0.78rem;
    text-decoration: none;
    color: var(--text-muted);
    background: var(--card);
    border: 1px solid var(--border);
    transition: all 0.15s;
    white-space: nowrap;
}
.pill:hover, .pill.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* Deal Grid */
.deal-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}
.deal-card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 1.2rem;
    box-shadow: var(--shadow);
    text-decoration: none;
    color: var(--text);
    border-left: 4px solid var(--primary);
    transition: transform 0.15s, box-shadow 0.15s;
    display: block;
}
.deal-card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.12); }
.deal-card.stage-research { border-left-color: #6b7280; }
.deal-card.stage-contact { border-left-color: #3b82f6; }
.deal-card.stage-pitching { border-left-color: #8b5cf6; }
.deal-card.stage-negotiation { border-left-color: #f59e0b; }
.deal-card.stage-contract { border-left-color: #10b981; }
.deal-card.stage-launch { border-left-color: #06b6d4; }
.deal-card.stage-closed_won { border-left-color: #22c55e; }
.deal-card.stage-closed_lost { border-left-color: #ef4444; }

.deal-header { display: flex; justify-content: space-between; margin-bottom: 0.5rem; font-size: 0.78rem; }
.deal-stage { font-weight: 500; }
.deal-prob { color: var(--text-muted); }
.deal-title { font-size: 1rem; font-weight: 600; margin-bottom: 0.3rem; }
.deal-company { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 0.4rem; }
.deal-value { font-size: 1.1rem; font-weight: 700; color: var(--primary); margin-bottom: 0.4rem; }
.deal-meta { display: flex; gap: 1rem; font-size: 0.78rem; color: var(--text-muted); }

/* Project Grid */
.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
}
.project-card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 1.2rem;
    box-shadow: var(--shadow);
    text-decoration: none;
    color: var(--text);
    border-left: 4px solid var(--info);
    transition: transform 0.15s, box-shadow 0.15s;
    display: block;
}
.project-card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.12); }
.project-card.status-planning { border-left-color: #3b82f6; }
.project-card.status-scheduled { border-left-color: #f59e0b; }
.project-card.status-presented { border-left-color: #10b981; }
.project-card.status-follow_up { border-left-color: #8b5cf6; }
.project-card.status-won { border-left-color: #22c55e; }
.project-card.status-lost { border-left-color: #ef4444; }

.project-card-header { display: flex; justify-content: space-between; margin-bottom: 0.5rem; font-size: 0.78rem; }
.project-status-badge { font-weight: 500; }
.project-date-badge { color: var(--text-muted); }
.project-card h3 { font-size: 1rem; font-weight: 600; margin-bottom: 0.3rem; }
.project-customer-name { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 0.3rem; }
.project-products { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 0.3rem; }
.project-value { font-size: 1rem; font-weight: 700; color: var(--primary); margin-bottom: 0.3rem; }
.project-card-meta { display: flex; gap: 1rem; font-size: 0.78rem; color: var(--text-muted); }
.next-action { color: var(--primary); font-weight: 500; }

/* Detail Grid */
.detail-grid {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 1.5rem;
}
.detail-main, .detail-side { min-width: 0; }

/* Info Card */
.info-card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
}
.info-row {
    display: flex;
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--border);
    gap: 1rem;
    align-items: flex-start;
}
.info-row:last-child { border-bottom: none; }
.info-row.full { flex-direction: column; gap: 0.3rem; }
.info-label { min-width: 140px; font-weight: 500; color: var(--text-muted); font-size: 0.85rem; }
.info-value { flex: 1; font-size: 0.9rem; }
.info-value.desc { white-space: pre-wrap; line-height: 1.7; }

.highlight-outcome { background: #f0fdf4; border-radius: 6px; padding: 0.8rem !important; }
.highlight-action { background: #eff6ff; border-radius: 6px; padding: 0.8rem !important; }

/* Stage Badge */
.stage-badge {
    display: inline-block;
    padding: 0.25rem 0.6rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
    background: #e0e7ff;
    color: #3730a3;
}

/* Probability Bar */
.prob-bar {
    position: relative;
    height: 24px;
    background: #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
    max-width: 200px;
}
.prob-fill {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6, #8b5cf6);
    border-radius: 12px;
    transition: width 0.3s;
}
.prob-bar span {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.75rem;
    font-weight: 600;
}

/* Stage Progress */
.stage-progress {
    background: var(--card);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
}
.stage-progress h3 { font-size: 1rem; font-weight: 600; margin-bottom: 1rem; }
.progress-track { display: flex; gap: 0.5rem; overflow-x: auto; padding-bottom: 0.5rem; }
.progress-step {
    text-align: center;
    flex: 1;
    min-width: 70px;
}
.step-dot {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 0.3rem;
    font-size: 1.1rem;
    position: relative;
}
.progress-step.done .step-dot { background: #d1fae5; }
.progress-step.current .step-dot { background: #bfdbfe; box-shadow: 0 0 0 3px #93c5fd; }
.step-label { font-size: 0.7rem; color: var(--text-muted); }

/* Updates / Timeline */
.updates-section {
    background: var(--card);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
}
.updates-section h3 { font-size: 1rem; font-weight: 600; margin-bottom: 1rem; }
.update-form { margin-bottom: 1.2rem; }
.update-form .textarea { width: 100%; margin-bottom: 0.5rem; }

.timeline { position: relative; padding-left: 20px; }
.timeline::before {
    content: '';
    position: absolute;
    left: 6px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border);
}
.timeline-item { position: relative; padding-bottom: 1rem; }
.timeline-dot {
    position: absolute;
    left: -17px;
    top: 4px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--primary);
    border: 2px solid var(--card);
}
.timeline-text { font-size: 0.85rem; line-height: 1.5; }
.timeline-meta { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.2rem; }

/* Forms (BD-specific) */
.form-card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow);
}
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}
.form-group { display: flex; flex-direction: column; gap: 0.3rem; }
.form-group.full { grid-column: 1 / -1; }
.form-group label { font-size: 0.85rem; font-weight: 500; color: var(--text-muted); }
.form-actions { margin-top: 1.5rem; display: flex; gap: 0.5rem; }

/* Empty state */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
}
.empty-text { color: var(--text-muted); font-size: 0.85rem; text-align: center; padding: 1rem; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    border: none;
    font-family: inherit;
    transition: all 0.15s;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { opacity: 0.9; }
.btn-outline { background: transparent; color: var(--primary); border: 1px solid var(--primary); }
.btn-outline:hover { background: var(--primary); color: #fff; }
.btn-sm { padding: 0.35rem 0.7rem; font-size: 0.8rem; }

/* ============================================
   PORTFOLIO SHOWCASE
   ============================================ */

.portfolio-page { padding-bottom: 3rem; }

/* Hero */
.pf-hero {
    background: linear-gradient(135deg, #1e293b 0%, #334155 50%, #475569 100%);
    color: #fff;
    padding: 2.5rem 2rem;
    border-radius: 12px;
    margin-bottom: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    position: relative;
    overflow: hidden;
}
.pf-hero::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -10%;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(99,102,241,0.15) 0%, transparent 70%);
    border-radius: 50%;
}
.pf-hero h1 { font-size: 1.8rem; font-weight: 700; margin-bottom: 0.3rem; }
.pf-hero-sub { opacity: 0.8; font-size: 0.95rem; }
.pf-hero-actions { display: flex; gap: 0.5rem; z-index: 1; }
.btn-outline-light { background: transparent; color: #fff; border: 1px solid rgba(255,255,255,0.4); padding: 0.5rem 1rem; border-radius: var(--radius); text-decoration: none; font-size: 0.85rem; transition: all 0.15s; }
.btn-outline-light:hover { background: rgba(255,255,255,0.1); border-color: #fff; }
.btn-light { background: #fff; color: #1e293b; padding: 0.5rem 1rem; border-radius: var(--radius); text-decoration: none; font-size: 0.85rem; font-weight: 600; transition: all 0.15s; }
.btn-light:hover { background: #e2e8f0; }

/* Value Proposition Banner */
.pf-value-banner {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}
.pf-value-item {
    background: var(--card);
    border-radius: 12px;
    padding: 1.2rem;
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    border-left: 4px solid transparent;
    transition: all 0.2s;
}
.pf-value-item:nth-child(1) { border-left-color: #f59e0b; background: linear-gradient(135deg, #fffbeb 0%, #fff 100%); }
.pf-value-item:nth-child(2) { border-left-color: #ef4444; background: linear-gradient(135deg, #fef2f2 0%, #fff 100%); }
.pf-value-item:nth-child(3) { border-left-color: #8b5cf6; background: linear-gradient(135deg, #f5f3ff 0%, #fff 100%); }
.pf-value-icon { font-size: 1.8rem; flex-shrink: 0; }
.pf-value-title { font-weight: 700; font-size: 0.95rem; margin-bottom: 0.2rem; }
.pf-value-desc { font-size: 0.8rem; color: var(--text-muted); line-height: 1.5; }

/* Badges */
.pf-badges { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-top: 0.5rem; }
.pf-badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.3px;
}
.pf-badge-solo { background: #fef3c7; color: #92400e; }
.pf-badge-live { background: #d1fae5; color: #065f46; }
.pf-badge-complex { background: #fee2e2; color: #991b1b; }
.pf-badge-users { background: #dbeafe; color: #1e40af; }

/* Cost & Time Comparison */
.pf-comparison {
    background: var(--card);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    margin-bottom: 2rem;
    border: 1px solid var(--border);
}
.pf-comp-header { text-align: center; margin-bottom: 2rem; }
.pf-comp-header h2 { font-size: 1.3rem; font-weight: 700; margin-bottom: 0.3rem; }
.pf-comp-sub { color: var(--text-muted); font-size: 0.9rem; }

.pf-comp-grid {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 1.5rem;
    align-items: stretch;
    margin-bottom: 2rem;
}
.pf-comp-card {
    border-radius: 12px;
    overflow: hidden;
}
.pf-comp-card-head {
    padding: 1.2rem;
    text-align: center;
}
.pf-comp-us .pf-comp-card-head { background: linear-gradient(135deg, #059669, #10b981); color: #fff; }
.pf-comp-them .pf-comp-card-head { background: linear-gradient(135deg, #6b7280, #9ca3af); color: #fff; }
.pf-comp-icon { font-size: 2rem; display: block; margin-bottom: 0.3rem; }
.pf-comp-card-head h3 { font-size: 1rem; font-weight: 700; margin-bottom: 0.3rem; }
.pf-comp-highlight {
    display: inline-block;
    background: rgba(255,255,255,0.25);
    padding: 0.15rem 0.6rem;
    border-radius: 12px;
    font-size: 0.72rem;
    font-weight: 600;
}
.pf-comp-items { padding: 1rem; background: #f9fafb; }
.pf-comp-them .pf-comp-items { background: #f3f4f6; }
.pf-comp-row {
    display: flex;
    justify-content: space-between;
    padding: 0.6rem 0.5rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.85rem;
}
.pf-comp-row:last-child { border-bottom: none; }
.pf-green { color: #059669; }
.pf-red { color: #dc2626; }

.pf-comp-vs {
    display: flex;
    align-items: center;
    justify-content: center;
}
.pf-comp-vs-circle {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1e293b, #475569);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.9rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* Comparison Table */
.pf-comp-table-wrap {
    margin-bottom: 2rem;
}
.pf-comp-table-wrap h3 { font-size: 1rem; font-weight: 600; margin-bottom: 0.8rem; }
.pf-comp-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}
.pf-comp-table th {
    background: #1e293b;
    color: #fff;
    padding: 0.7rem 0.8rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.8rem;
}
.pf-comp-table th:first-child { border-radius: 8px 0 0 0; }
.pf-comp-table th:last-child { border-radius: 0 8px 0 0; text-align: center; }
.pf-comp-table td {
    padding: 0.65rem 0.8rem;
    border-bottom: 1px solid var(--border);
}
.pf-comp-table tbody tr:hover { background: #f8fafc; }
.pf-td-fast { color: #059669; font-weight: 600; }
.pf-td-x {
    text-align: center;
    font-weight: 800;
    color: #fff;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border-radius: 6px;
    padding: 0.3rem 0.5rem;
    font-size: 0.8rem;
    white-space: nowrap;
}
.pf-comp-total {
    background: #f0fdf4 !important;
}
.pf-comp-total td { border-top: 2px solid #059669; font-size: 0.9rem; }

/* Bottom savings */
.pf-comp-bottom {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}
.pf-comp-bottom-item {
    display: flex;
    gap: 1rem;
    align-items: center;
    padding: 1.2rem;
    border-radius: 12px;
    background: linear-gradient(135deg, #f0fdf4, #ecfdf5);
    border: 1px solid #bbf7d0;
}
.pf-comp-bottom-item:nth-child(2) { background: linear-gradient(135deg, #eff6ff, #dbeafe); border-color: #93c5fd; }
.pf-comp-bottom-item:nth-child(3) { background: linear-gradient(135deg, #f5f3ff, #ede9fe); border-color: #c4b5fd; }
.pf-comp-bottom-icon { font-size: 2rem; flex-shrink: 0; }
.pf-comp-bottom-title { font-size: 0.78rem; color: var(--text-muted); }
.pf-comp-bottom-value { font-size: 1.1rem; font-weight: 800; color: var(--text); }

/* ============================================
   "เร็ว ≠ ง่าย" Complexity Section
   ============================================ */
.pf-complexity {
    background: var(--card);
    border-radius: 16px;
    padding: 2.5rem;
    box-shadow: 0 4px 24px rgba(0,0,0,0.07);
    margin-bottom: 2rem;
    border: 1px solid var(--border);
    position: relative;
    overflow: hidden;
}
.pf-complexity::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: linear-gradient(90deg, #ef4444, #f59e0b, #10b981, #3b82f6, #8b5cf6);
}
.pf-cx-header { text-align: center; margin-bottom: 2rem; }
.pf-cx-header h2 { font-size: 1.4rem; font-weight: 800; margin-bottom: 0.4rem; }
.pf-cx-header p { color: var(--text-muted); font-size: 0.95rem; max-width: 600px; margin: 0 auto; }

/* Myth vs Truth */
.pf-cx-reality {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: 2.5rem;
    flex-wrap: wrap;
}
.pf-cx-myth, .pf-cx-truth {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 1rem 1.5rem;
    border-radius: 12px;
    max-width: 380px;
}
.pf-cx-myth {
    background: linear-gradient(135deg, #fef2f2, #fee2e2);
    border: 1px solid #fecaca;
}
.pf-cx-truth {
    background: linear-gradient(135deg, #f0fdf4, #dcfce7);
    border: 1px solid #bbf7d0;
}
.pf-cx-myth-icon, .pf-cx-truth-icon { font-size: 2rem; flex-shrink: 0; }
.pf-cx-myth-title { font-size: 0.72rem; color: #991b1b; font-weight: 600; text-transform: uppercase; letter-spacing: 1px; }
.pf-cx-truth-title { font-size: 0.72rem; color: #166534; font-weight: 600; text-transform: uppercase; letter-spacing: 1px; }
.pf-cx-myth-text { font-size: 1rem; font-weight: 700; color: #991b1b; margin-top: 0.2rem; }
.pf-cx-truth-text { font-size: 1rem; font-weight: 700; color: #166534; margin-top: 0.2rem; }
.pf-cx-arrow { font-size: 1.5rem; color: var(--text-muted); font-weight: 700; }

/* 3-Column Complexity Grid */
.pf-cx-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}
.pf-cx-card {
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid var(--border);
    transition: transform 0.2s, box-shadow 0.2s;
}
.pf-cx-card:hover { transform: translateY(-3px); box-shadow: 0 8px 24px rgba(0,0,0,0.08); }
.pf-cx-card:nth-child(1) { background: linear-gradient(180deg, #eff6ff 0%, #fff 40%); border-top: 3px solid #3b82f6; }
.pf-cx-card:nth-child(2) { background: linear-gradient(180deg, #fef2f2 0%, #fff 40%); border-top: 3px solid #ef4444; }
.pf-cx-card:nth-child(3) { background: linear-gradient(180deg, #f5f3ff 0%, #fff 40%); border-top: 3px solid #8b5cf6; }
.pf-cx-card-icon { font-size: 2rem; margin-bottom: 0.5rem; }
.pf-cx-card h4 { font-size: 1rem; font-weight: 700; margin-bottom: 0.4rem; }
.pf-cx-card > p { font-size: 0.82rem; color: var(--text-muted); margin-bottom: 0.8rem; line-height: 1.5; }

.pf-cx-list { list-style: none; padding: 0; }
.pf-cx-list li {
    padding: 0.4rem 0;
    padding-left: 1.2rem;
    position: relative;
    font-size: 0.82rem;
    line-height: 1.5;
    border-bottom: 1px solid rgba(0,0,0,0.04);
}
.pf-cx-list li:last-child { border-bottom: none; }
.pf-cx-list li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: #10b981;
    font-weight: 700;
}
.pf-cx-list-problems li::before {
    content: '✗';
    color: #ef4444;
}

.pf-cx-note {
    margin-top: 0.8rem;
    padding: 0.6rem 0.8rem;
    background: rgba(0,0,0,0.03);
    border-radius: 6px;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-style: italic;
    text-align: center;
}

/* Key Insight Quote */
.pf-cx-insight {
    margin: 2rem 0;
    text-align: center;
}
.pf-cx-insight-quote {
    display: inline-block;
    max-width: 700px;
    padding: 2rem 2.5rem;
    background: linear-gradient(135deg, #1e293b, #334155);
    color: #e2e8f0;
    border-radius: 16px;
    font-size: 0.95rem;
    line-height: 1.9;
    position: relative;
}
.pf-cx-insight-quote::before {
    content: '"';
    position: absolute;
    top: -10px;
    left: 20px;
    font-size: 5rem;
    color: rgba(99,102,241,0.3);
    font-family: Georgia, serif;
    line-height: 1;
}
.pf-cx-highlight {
    display: inline-block;
    background: linear-gradient(90deg, #6366f1, #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 800;
    font-size: 1.05rem;
}

/* Time Distribution Bars */
.pf-cx-time { margin-top: 2rem; }
.pf-cx-time h4 { font-size: 1rem; font-weight: 700; margin-bottom: 1.2rem; text-align: center; }
.pf-cx-time-compare { display: flex; flex-direction: column; gap: 1rem; margin-bottom: 1rem; }
.pf-cx-time-bar {}
.pf-cx-time-label { font-size: 0.82rem; font-weight: 600; margin-bottom: 0.4rem; color: var(--text-muted); }
.pf-cx-time-label.pf-cx-time-us { color: #059669; }
.pf-cx-bar-track {
    display: flex;
    height: 36px;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
}
.pf-cx-bar-seg {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 0.68rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0 4px;
    transition: width 0.5s ease;
}
.pf-cx-waste { background: #ef4444; }
.pf-cx-waste2 { background: #f97316; }
.pf-cx-rework { background: #eab308; color: #1a1a2e; }
.pf-cx-actual { background: #10b981; }
.pf-cx-deploy { background: #3b82f6; }
.pf-cx-train { background: #8b5cf6; }

.pf-cx-time-insight {
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.7;
    margin-top: 0.8rem;
    padding: 1rem;
    background: #f8fafc;
    border-radius: 8px;
}

@media (max-width: 600px) {
    .pf-complexity { padding: 1.5rem; }
    .pf-cx-reality { flex-direction: column; }
    .pf-cx-arrow { transform: rotate(90deg); }
    .pf-cx-grid { grid-template-columns: 1fr; }
    .pf-cx-insight-quote { padding: 1.5rem; font-size: 0.88rem; }
    .pf-cx-bar-seg span { font-size: 0.6rem; }
}

/* AI Safety & Trust */
.pf-ai-safety {
    background: var(--card);
    border-radius: 16px;
    padding: 2.5rem;
    box-shadow: 0 4px 24px rgba(0,0,0,0.07);
    margin-bottom: 2rem;
    border: 1px solid var(--border);
    position: relative;
}
.pf-ai-safety::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: linear-gradient(90deg, #10b981, #3b82f6, #6366f1);
    border-radius: 16px 16px 0 0;
}
.pf-ai-header { text-align: center; margin-bottom: 2rem; }
.pf-ai-header h2 { font-size: 1.3rem; font-weight: 800; margin-bottom: 0.4rem; }
.pf-ai-header p { color: var(--text-muted); font-size: 0.9rem; }

.pf-ai-grid { display: flex; flex-direction: column; gap: 1.2rem; margin-bottom: 1.5rem; }
.pf-ai-card {
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    transition: transform 0.2s;
}
.pf-ai-card:hover { transform: translateY(-2px); box-shadow: 0 4px 16px rgba(0,0,0,0.06); }
.pf-ai-q {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 1rem 1.5rem;
    background: #f8fafc;
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text);
    border-bottom: 1px solid var(--border);
}
.pf-ai-q-icon { font-size: 1.2rem; flex-shrink: 0; }
.pf-ai-a {
    display: flex;
    gap: 1rem;
    padding: 1.2rem 1.5rem;
    align-items: flex-start;
}
.pf-ai-a-icon { font-size: 1.5rem; flex-shrink: 0; margin-top: 2px; }
.pf-ai-a strong { display: block; font-size: 0.95rem; margin-bottom: 0.5rem; color: #065f46; }
.pf-ai-a ul { list-style: none; padding: 0; margin: 0; }
.pf-ai-a li {
    padding: 0.35rem 0;
    padding-left: 1.2rem;
    position: relative;
    font-size: 0.84rem;
    line-height: 1.5;
    color: var(--text);
}
.pf-ai-a li::before {
    content: '•';
    position: absolute;
    left: 0;
    color: #10b981;
    font-weight: 700;
}

.pf-ai-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    justify-content: center;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}
.pf-ai-sum-item {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, #f0fdf4, #ecfdf5);
    border: 1px solid #bbf7d0;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 600;
    color: #065f46;
}

@media (max-width: 600px) {
    .pf-ai-safety { padding: 1.5rem; }
    .pf-ai-a { flex-direction: column; gap: 0.5rem; }
    .pf-ai-summary { flex-direction: column; }
}

/* Winspeed Section */
.pf-cx-winspeed {
    background: linear-gradient(135deg, #fef2f2 0%, #fff5f5 50%, #fff 100%);
    border: 1px solid #fecaca;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
}
.pf-cx-ws-header {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin-bottom: 0.8rem;
}
.pf-cx-ws-icon { font-size: 1.5rem; }
.pf-cx-ws-header h4 { font-size: 1.05rem; font-weight: 700; color: #991b1b; }
.pf-cx-ws-intro { font-size: 0.88rem; color: var(--text); margin-bottom: 1rem; line-height: 1.6; }
.pf-cx-ws-problems { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 0.8rem; margin-bottom: 1.2rem; }
.pf-cx-ws-item {
    display: flex;
    gap: 0.6rem;
    padding: 0.8rem;
    background: rgba(255,255,255,0.8);
    border-radius: 8px;
    border: 1px solid #fde8e8;
}
.pf-cx-ws-item-icon { font-size: 1rem; flex-shrink: 0; margin-top: 2px; }
.pf-cx-ws-item strong { font-size: 0.85rem; display: block; margin-bottom: 0.15rem; }
.pf-cx-ws-item p { font-size: 0.78rem; color: var(--text-muted); line-height: 1.4; margin: 0; }

.pf-cx-ws-result {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}
.pf-cx-ws-before, .pf-cx-ws-after {
    padding: 1rem 1.5rem;
    border-radius: 10px;
    text-align: center;
    min-width: 260px;
}
.pf-cx-ws-before { background: #fee2e2; border: 1px solid #fca5a5; }
.pf-cx-ws-after { background: #d1fae5; border: 1px solid #6ee7b7; }
.pf-cx-ws-label { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 0.3rem; }
.pf-cx-ws-before .pf-cx-ws-label { color: #991b1b; }
.pf-cx-ws-after .pf-cx-ws-label { color: #065f46; }
.pf-cx-ws-desc { font-size: 0.82rem; line-height: 1.5; }
.pf-cx-ws-arrow { font-size: 1.5rem; color: var(--text-muted); font-weight: 700; }
.pf-cx-ws-bottom {
    text-align: center;
    font-size: 0.82rem;
    color: #991b1b;
    padding: 0.8rem;
    background: #fff;
    border-radius: 8px;
    border: 1px dashed #fca5a5;
    line-height: 1.7;
}

/* Market comparison */
.pf-market-comp {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 2px solid var(--border);
}
.pf-market-comp h3 { font-size: 1.05rem; font-weight: 700; margin-bottom: 0.3rem; }
.pf-market-comp .pf-comp-sub { margin-bottom: 1.2rem; }
.pf-market-table td { vertical-align: top; }
.pf-td-market { color: #dc2626; font-weight: 600; font-size: 0.9rem; }
.pf-td-note { font-size: 0.72rem; color: var(--text-muted); font-weight: 400; }
.pf-td-market-total { color: #dc2626; font-size: 1rem; font-weight: 800; background: #fef2f2 !important; }
.pf-comp-save td { background: #f0fdf4 !important; }
.pf-comp-save .pf-td-fast { font-size: 1.1rem; }
.pf-market-note {
    margin-top: 1rem;
    padding: 1rem;
    background: #fffbeb;
    border-left: 3px solid #f59e0b;
    border-radius: 6px;
    font-size: 0.8rem;
    color: #92400e;
    line-height: 1.7;
}

/* Stats Bar */
.pf-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}
.pf-stat {
    background: var(--card);
    border-radius: 12px;
    padding: 1.3rem;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    border-top: 3px solid var(--primary);
}
.pf-stat:nth-child(2) { border-top-color: #10b981; }
.pf-stat:nth-child(3) { border-top-color: #f59e0b; }
.pf-stat:nth-child(4) { border-top-color: #8b5cf6; }
.pf-stat-number { font-size: 2rem; font-weight: 800; color: var(--text); line-height: 1; }
.pf-stat-label { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.3rem; }
.pf-stat-bar { height: 4px; background: #e5e7eb; border-radius: 2px; margin-top: 0.5rem; }
.pf-stat-fill { height: 100%; background: linear-gradient(90deg, #8b5cf6, #a78bfa); border-radius: 2px; transition: width 0.5s; }

/* Filter */
.pf-filter { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 2rem; }
.pf-pill {
    padding: 0.4rem 1rem;
    border-radius: 20px;
    text-decoration: none;
    font-size: 0.82rem;
    color: var(--text-muted);
    background: var(--card);
    border: 1px solid var(--border);
    transition: all 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}
.pf-pill:hover { border-color: var(--primary); color: var(--primary); }
.pf-pill.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.pf-pill-count { font-size: 0.7rem; background: rgba(0,0,0,0.1); padding: 0.1rem 0.4rem; border-radius: 10px; }
.pf-pill.active .pf-pill-count { background: rgba(255,255,255,0.25); }

/* Portfolio Grid */
.pf-grid { display: flex; flex-direction: column; gap: 2rem; }
.pf-card {
    background: var(--card);
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    overflow: hidden;
    display: grid;
    grid-template-columns: 320px 1fr;
    transition: transform 0.2s, box-shadow 0.2s;
}
.pf-card:hover { transform: translateY(-2px); box-shadow: 0 6px 24px rgba(0,0,0,0.1); }

/* Card Visual */
.pf-card-visual {
    position: relative;
    background: linear-gradient(135deg, #f1f5f9, #e2e8f0);
    min-height: 240px;
    overflow: hidden;
}
.pf-card-visual img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.pf-card-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    font-size: 4rem;
    opacity: 0.3;
}
.pf-card-category {
    position: absolute;
    top: 12px;
    left: 12px;
    background: rgba(0,0,0,0.7);
    color: #fff;
    padding: 0.25rem 0.7rem;
    border-radius: 6px;
    font-size: 0.75rem;
    backdrop-filter: blur(4px);
}
.pf-card-live-link {
    position: absolute;
    bottom: 12px;
    right: 12px;
    background: var(--primary);
    color: #fff;
    padding: 0.35rem 0.8rem;
    border-radius: 6px;
    font-size: 0.78rem;
    text-decoration: none;
    font-weight: 500;
    transition: background 0.15s;
}
.pf-card-live-link:hover { background: var(--primary-hover); }

/* Card Body */
.pf-card-body { padding: 1.5rem; }
.pf-card-header h3 { font-size: 1.2rem; font-weight: 700; margin-bottom: 0.2rem; }
.pf-subtitle { color: var(--text-muted); font-size: 0.88rem; margin-bottom: 0.8rem; }

/* Progress */
.pf-progress-section { margin-bottom: 1rem; }
.pf-progress-header { display: flex; justify-content: space-between; margin-bottom: 0.3rem; }
.pf-progress-label { font-size: 0.78rem; color: var(--text-muted); }
.pf-progress-pct { font-size: 0.85rem; font-weight: 700; }
.pf-progress-bar {
    height: 8px;
    background: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
}
.pf-progress-fill {
    height: 100%;
    border-radius: 4px;
    background: linear-gradient(90deg, #3b82f6, #60a5fa);
    transition: width 0.5s ease;
}
.pf-progress-fill.complete { background: linear-gradient(90deg, #10b981, #34d399); }
.pf-progress-fill.high { background: linear-gradient(90deg, #8b5cf6, #a78bfa); }
.pf-progress-fill.mid { background: linear-gradient(90deg, #f59e0b, #fbbf24); }

.pf-status-row { display: flex; align-items: center; gap: 0.8rem; margin-top: 0.5rem; }
.pf-status-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}
.pf-status-planning { background: #dbeafe; color: #1d4ed8; }
.pf-status-developing { background: #fef3c7; color: #92400e; }
.pf-status-testing { background: #e0e7ff; color: #3730a3; }
.pf-status-live { background: #d1fae5; color: #065f46; }
.pf-status-maintaining { background: #cffafe; color: #155e75; }
.pf-time { font-size: 0.78rem; color: var(--text-muted); }

/* Metrics */
.pf-metrics { display: flex; gap: 1.5rem; margin-bottom: 0.8rem; flex-wrap: wrap; }
.pf-metric { display: flex; gap: 0.5rem; align-items: flex-start; }
.pf-metric-icon { font-size: 1.2rem; }
.pf-metric-value { font-size: 0.85rem; font-weight: 600; }
.pf-metric-label { font-size: 0.72rem; color: var(--text-muted); }

.pf-desc { font-size: 0.88rem; color: var(--text); line-height: 1.7; margin-bottom: 0.8rem; }

/* Sections */
.pf-section { margin-bottom: 0.7rem; padding: 0.8rem; border-radius: 8px; }
.pf-challenges { background: #fef2f2; border-left: 3px solid #ef4444; }
.pf-achievements { background: #f0fdf4; border-left: 3px solid #22c55e; }
.pf-impact { background: #eff6ff; border-left: 3px solid #3b82f6; }
.pf-resp { background: #f5f3ff; border-left: 3px solid #8b5cf6; }
.pf-section-title { font-size: 0.82rem; font-weight: 600; margin-bottom: 0.3rem; }
.pf-section-text { font-size: 0.82rem; line-height: 1.6; white-space: pre-wrap; }

/* Feedback */
.pf-feedback-box {
    background: #fafafa;
    border-radius: 8px;
    padding: 0.8rem;
    margin-bottom: 0.7rem;
}
.pf-feedback { font-size: 0.82rem; margin-top: 0.4rem; display: flex; gap: 0.4rem; }
.pf-fb-good { color: #15803d; }
.pf-fb-improve { color: #b45309; }
.pf-fb-icon { flex-shrink: 0; }

/* Dates */
.pf-dates { display: flex; gap: 1rem; font-size: 0.75rem; color: var(--text-muted); margin-bottom: 0.8rem; }

/* Card Actions */
.pf-card-actions { display: flex; gap: 0.5rem; padding-top: 0.5rem; border-top: 1px solid var(--border); }

/* Empty */
.pf-empty { text-align: center; padding: 4rem 2rem; }
.pf-empty-icon { font-size: 4rem; margin-bottom: 1rem; }
.pf-empty h3 { font-size: 1.2rem; margin-bottom: 0.5rem; }
.pf-empty p { color: var(--text-muted); margin-bottom: 1.5rem; }

/* Form section titles */
.form-section-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    margin-top: 2rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--primary);
}
.form-section-title:first-of-type { margin-top: 0; }

/* Progress range input */
.progress-input-wrap { display: flex; align-items: center; gap: 0.8rem; }
.input-range { flex: 1; height: 6px; -webkit-appearance: none; background: #e5e7eb; border-radius: 3px; outline: none; }
.input-range::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; border-radius: 50%; background: var(--primary); cursor: pointer; }
.progress-val { font-weight: 700; font-size: 1rem; min-width: 45px; }
.current-screenshot { margin-top: 0.5rem; }
.text-sm { font-size: 0.75rem; color: var(--text-muted); display: block; margin-top: 0.3rem; }

/* BD Dashboard link to portfolio */
.bd-page .portfolio-link {
    display: block;
    text-align: center;
    padding: 1rem;
    background: linear-gradient(135deg, #1e293b, #334155);
    color: #fff;
    border-radius: var(--radius);
    text-decoration: none;
    font-weight: 600;
    margin-top: 1.5rem;
    transition: opacity 0.15s;
}
.bd-page .portfolio-link:hover { opacity: 0.9; }

/* Responsive */
@media (max-width: 900px) {
    .section-row { grid-template-columns: 1fr; }
    .detail-grid { grid-template-columns: 1fr; }
    .pf-card { grid-template-columns: 1fr; }
    .pf-card-visual { min-height: 180px; }
    .pf-hero { padding: 1.5rem; }
    .pf-comp-grid { grid-template-columns: 1fr; }
    .pf-comp-vs { padding: 0.5rem 0; }
    .pf-comp-vs-circle { width: 40px; height: 40px; font-size: 0.8rem; }
    .pf-comp-table { font-size: 0.78rem; }
}
@media (max-width: 600px) {
    .form-grid { grid-template-columns: 1fr; }
    .bd-page .kpi-grid { grid-template-columns: repeat(2, 1fr); }
    .deal-grid { grid-template-columns: 1fr; }
    .project-grid { grid-template-columns: 1fr; }
    .pf-hero h1 { font-size: 1.3rem; }
    .pf-stats { grid-template-columns: repeat(2, 1fr); }
}
