:root {
    --sidebar-width: 240px;
    --header-h: 60px;
    --brand-dark: #0f1117;
    --brand-accent: #3b82f6;
    --brand-accent-hover: #2563eb;
    --brand-border: rgba(255,255,255,0.07);
    --sidebar-text: #9ca3af;
    --sidebar-active-bg: rgba(59,130,246,0.12);
    --sidebar-active-text: #60a5fa;
    --content-bg: #f4f6fa;
    --card-bg: #ffffff;
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --radius: 10px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'DM Sans', sans-serif; background: var(--content-bg); color: var(--text-primary); display: flex; min-height: 100vh; }
#sidebar { width: var(--sidebar-width); background: var(--brand-dark); height: 100vh; position: fixed; top: 0; left: 0; display: flex; flex-direction: column; z-index: 100; border-right: 1px solid var(--brand-border); transition: transform .25s ease; }
.sidebar-logo { padding: 0 20px; height: var(--header-h); display: flex; align-items: center; border-bottom: 1px solid var(--brand-border); gap: 10px; text-decoration: none; }
.sidebar-logo-icon { width: 30px; height: 30px; background: var(--brand-accent); border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 14px; color: #fff; font-weight: 700; }
.sidebar-logo-text { font-size: 15px; font-weight: 700; color: #fff; }
.sidebar-logo-text span { color: var(--brand-accent); }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 16px 0; }
.nav-section-label { font-size: 10px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: #4b5563; padding: 14px 20px 6px; }
.sidebar-link { display: flex; align-items: center; gap: 10px; padding: 9px 20px; color: var(--sidebar-text); text-decoration: none; font-size: 13.5px; font-weight: 500; border-left: 3px solid transparent; transition: all .15s; }
.sidebar-link i { font-size: 15px; width: 18px; text-align: center; }
.sidebar-link:hover { color: #e5e7eb; background: rgba(255,255,255,.04); }
.sidebar-link.active { color: var(--sidebar-active-text); background: var(--sidebar-active-bg); border-left-color: var(--brand-accent); }
.disabled-link { pointer-events: none; opacity: .72; }
.badge-soon { margin-left: auto; font-size: 9px; font-weight: 600; background: rgba(99,102,241,.2); color: #818cf8; padding: 2px 6px; border-radius: 20px; }
.sidebar-footer { padding: 14px 20px; border-top: 1px solid var(--brand-border); }
.sidebar-user { display: flex; align-items: center; gap: 10px; }
.user-avatar { width: 32px; height: 32px; background: linear-gradient(135deg, #3b82f6, #8b5cf6); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; color: #fff; }
.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 12.5px; font-weight: 600; color: #e5e7eb; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 11px; color: #6b7280; }
#main-wrapper { margin-left: var(--sidebar-width); flex: 1; display: flex; flex-direction: column; min-height: 100vh; }
#topbar { height: var(--header-h); background: #fff; border-bottom: 1px solid #e5e7eb; display: flex; align-items: center; padding: 0 28px; gap: 16px; position: sticky; top: 0; z-index: 50; }
.topbar-breadcrumb { font-size: 13px; color: var(--text-secondary); display: flex; align-items: center; gap: 6px; }
.topbar-breadcrumb .page-title { color: var(--text-primary); font-weight: 600; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.topbar-btn { width: 36px; height: 36px; border: 1px solid #e5e7eb; border-radius: 8px; background: #fff; display: flex; align-items: center; justify-content: center; color: var(--text-secondary); cursor: pointer; }
#main-content { flex: 1; padding: 28px; min-width: 0; }
.page-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 22px; gap: 16px; }
.page-header h1 { font-size: 22px; font-weight: 700; color: var(--text-primary); line-height: 1.2; }
.page-header p { font-size: 13.5px; color: var(--text-secondary); margin-top: 3px; }
.erpro-card, .stat-card { background: var(--card-bg); border: 1px solid #e9ecf0; border-radius: var(--radius); box-shadow: 0 1px 3px rgba(0,0,0,.04); }
.erpro-card { padding: 22px 24px; }
.stat-card { padding: 20px 22px; }
.stat-label { font-size: 12px; color: var(--text-secondary); font-weight: 500; text-transform: uppercase; letter-spacing: .04em; margin-bottom: 6px; }
.stat-value { font-size: 30px; font-weight: 700; color: var(--text-primary); line-height: 1.1; font-family: 'DM Mono', monospace; }
.stat-icon { width: 38px; height: 38px; border-radius: 9px; display: flex; align-items: center; justify-content: center; font-size: 17px; margin-bottom: 10px; }
.btn-primary-erpro, .btn-outline-erpro { border-radius: 8px; padding: 8px 16px; font-size: 13.5px; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; cursor: pointer; text-decoration: none; transition: all .15s; white-space: nowrap; }
.btn-primary-erpro { background: var(--brand-accent); color: #fff; border: none; }
.btn-primary-erpro:hover { background: var(--brand-accent-hover); color: #fff; }
.btn-outline-erpro { background: transparent; color: var(--text-secondary); border: 1px solid #d1d5db; }
.btn-outline-erpro:hover { background: #f3f4f6; color: var(--text-primary); }
.form-label-erpro { font-size: 12.5px; font-weight: 600; color: var(--text-secondary); margin-bottom: 5px; display: block; }
.form-control-erpro, .form-select-erpro { width: 100%; border: 1px solid #d1d5db; border-radius: 8px; padding: 8px 12px; font-size: 13.5px; color: var(--text-primary); background: #fff; outline: none; font-family: 'DM Sans', sans-serif; }
.form-control-erpro:focus, .form-select-erpro:focus { border-color: var(--brand-accent); box-shadow: 0 0 0 3px rgba(59,130,246,.1); }
.erpro-table th { font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--text-secondary); padding: 11px 14px; border-bottom: 1px solid #e9ecf0; background: #f9fafb; }
.erpro-table td { padding: 12px 14px; font-size: 13.5px; border-bottom: 1px solid #f0f2f5; vertical-align: middle; }
.erpro-table tr:hover td { background: #fafbfc; }
.alert-erpro { border-radius: 8px; padding: 12px 16px; font-size: 13.5px; margin-bottom: 20px; display: flex; align-items: center; gap: 10px; }
.alert-success-erpro { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.alert-warning-erpro { background: #fffbeb; color: #92400e; border: 1px solid #fcd34d; }
.alert-error-erpro { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.badge-erpro { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; padding: 3px 9px; border-radius: 20px; }
.badge-blue { background: #eff6ff; color: #1d4ed8; }
.badge-green { background: #d1fae5; color: #065f46; }
.badge-yellow { background: #fef3c7; color: #92400e; }
.badge-red { background: #fee2e2; color: #991b1b; }
.badge-gray { background: #f3f4f6; color: #6b7280; }
.detail-row { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid #f0f2f5; font-size: 13px; }
.detail-row span:first-child { color: #6b7280; }
.detail-row span:last-child { color: #111827; font-weight: 600; text-align: right; }
.chat-shell { display: grid; grid-template-columns: 280px minmax(0, 1fr) 310px; gap: 16px; align-items: start; }
.conversation-mini-list { display: flex; flex-direction: column; gap: 8px; }
.conversation-mini-item { display: block; text-decoration: none; border: 1px solid #e9ecf0; border-radius: 9px; padding: 10px; color: inherit; background: #fff; }
.conversation-mini-item.active, .conversation-mini-item:hover { border-color: #bfdbfe; background: #eff6ff; }
.message-thread { min-height: 420px; max-height: 58vh; overflow-y: auto; padding: 18px; background: #f8fafc; border: 1px solid #e9ecf0; border-radius: 10px; }
.message-row { display: flex; margin-bottom: 12px; }
.message-row.inbound { justify-content: flex-start; }
.message-row.outbound { justify-content: flex-end; }
.message-bubble { max-width: min(76%, 620px); border-radius: 12px; padding: 10px 12px; font-size: 13.5px; line-height: 1.45; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.message-row.inbound .message-bubble { background: #fff; border: 1px solid #e5e7eb; color: #111827; }
.message-row.outbound .message-bubble { background: #dbeafe; border: 1px solid #bfdbfe; color: #1e3a8a; }
.message-meta { display: flex; gap: 8px; justify-content: flex-end; margin-top: 6px; font-size: 11px; color: #6b7280; }
.conversation-actions { display: flex; gap: 8px; flex-wrap: wrap; }
#sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 90; }
#sidebar-overlay.active { display: block; }
@media (max-width: 1199.98px) { .chat-shell { grid-template-columns: 1fr; } .message-thread { max-height: none; } }
@media (max-width: 768px) {
    #sidebar { transform: translateX(-100%); max-width: min(86vw, var(--sidebar-width)); }
    #sidebar.open { transform: translateX(0); }
    #main-wrapper { margin-left: 0; }
    #topbar { padding: 0 14px; }
    #main-content { padding: 16px 14px 20px; }
    .erpro-card, .stat-card { padding: 16px; }
    .page-header { flex-direction: column; align-items: stretch; }
    .message-bubble { max-width: 92%; }
}
