/* BrandWisers Design System — Shared across all servers */
/* Per-server theme variables are set via [data-server] attributes in HTML */

/* === Reset & Base === */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); }
button, input, select, textarea { font-family: inherit; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }

/* === Layout === */
.app-layout {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    min-height: 100vh;
}
.main-area { display: flex; flex-direction: column; min-width: 0; }
.content { padding: 28px; flex: 1; }

/* === Sidebar === */
.sidebar {
    background: var(--bg-sidebar);
    color: var(--text-on-dark);
    padding: 20px 0;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 20px 20px;
    margin-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.sidebar-logo {
    width: 36px; height: 36px;
    background: linear-gradient(135deg, var(--primary), #7c3aed);
    border-radius: var(--radius-md);
    display: flex; align-items: center; justify-content: center;
    color: white; font-weight: 800; font-size: 16px;
    box-shadow: 0 4px 12px -2px rgba(79, 70, 229, 0.4);
}
.sidebar-brand-text { font-size: 17px; font-weight: 700; color: white; letter-spacing: -0.3px; }
.sidebar-brand-text small { display: block; font-size: 10px; color: var(--text-on-dark-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 1.2px; margin-top: 2px; }
.sidebar-nav { flex: 1; padding: 0 12px; }
.sidebar-section { margin-bottom: 18px; }
.sidebar-section-title {
    padding: 0 12px;
    font-size: 10px;
    font-weight: 700;
    color: var(--text-on-dark-muted);
    text-transform: uppercase;
    letter-spacing: 1.2px;
    margin-bottom: 8px;
}
.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 12px;
    border-radius: var(--radius-md);
    color: var(--text-on-dark);
    font-size: 14px;
    font-weight: 500;
    transition: all var(--transition);
    margin-bottom: 2px;
}
.nav-item:hover { background: var(--bg-sidebar-hover); color: white; }
.nav-item.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 12px -2px rgba(79, 70, 229, 0.4);
}
.nav-item-icon {
    width: 18px;
    text-align: center;
    font-size: 14px;
    flex-shrink: 0;
}
.sidebar-footer {
    padding: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    margin-top: 12px;
}
.user-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--radius-md);
    transition: background var(--transition);
}
.user-card:hover { background: var(--bg-sidebar-hover); }
.avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #7c3aed);
    display: flex; align-items: center; justify-content: center;
    color: white; font-weight: 700; font-size: 14px;
    flex-shrink: 0;
}
.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 13px; font-weight: 600; color: white; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 11px; color: var(--text-on-dark-muted); }

/* === Topbar === */
.topbar {
    background: var(--bg-topbar);
    border-bottom: 1px solid var(--border);
    height: var(--topbar-height);
    padding: 0 28px;
    display: flex;
    align-items: center;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 10;
}
.topbar-title-block { display: flex; flex-direction: column; }
.topbar-title { font-size: 17px; font-weight: 700; color: var(--text-primary); letter-spacing: -0.2px; }
.topbar-breadcrumb { font-size: 12px; color: var(--text-muted); margin-top: 1px; }
.topbar-spacer { flex: 1; }
.topbar-search {
    position: relative;
    max-width: 360px;
    flex: 1;
}
.topbar-search input {
    width: 100%;
    padding: 8px 14px 8px 36px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 13px;
    color: var(--text-primary);
    transition: all var(--transition);
}
.topbar-search input:focus {
    outline: none;
    background: var(--surface);
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}
.topbar-search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 13px;
}
.topbar-search-shortcut {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--bg);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    white-space: nowrap;
    pointer-events: none;
    opacity: 0.7;
    transition: opacity var(--transition);
}
.topbar-search input:focus + .topbar-search-shortcut {
    opacity: 1;
    color: var(--primary);
    border-color: var(--primary);
}
.icon-btn {
    width: 36px; height: 36px;
    border-radius: var(--radius-md);
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all var(--transition);
    position: relative;
    font-size: 16px;
}
.icon-btn:hover { background: var(--bg); color: var(--text-primary); }
.icon-btn .dot {
    position: absolute;
    top: 6px; right: 6px;
    width: 8px; height: 8px;
    background: var(--danger);
    border-radius: 50%;
    border: 2px solid var(--bg-topbar);
}

/* === Topbar User Dropdown === */
.topbar-user {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 8px 4px 4px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background var(--transition);
}
.topbar-user:hover {
    background: var(--bg);
}
.topbar-user .avatar-sm {
    width: 28px; height: 28px;
    font-size: 12px;
}
.topbar-user-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    max-width: 120px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.topbar-user svg:last-of-type {
    width: 14px; height: 14px;
    color: var(--text-muted);
    flex-shrink: 0;
    margin-left: 2px;
}
.topbar-user-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 220px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all var(--transition);
    z-index: 100;
    overflow: hidden;
}
.topbar-user.open .topbar-user-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.topbar-user-dropdown-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
}
.topbar-user-dropdown-header .avatar {
    width: 36px; height: 36px;
    font-size: 14px;
}
.topbar-user-dropdown-header .user-name {
    font-size: 14px; font-weight: 600; color: var(--text-primary);
}
.topbar-user-dropdown-header .user-role {
    font-size: 12px; color: var(--text-muted);
}
.topbar-user-dropdown-divider {
    height: 1px; background: var(--border); margin: 4px 0;
}
.topbar-user-dropdown-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 14px;
    font-size: 13px; font-weight: 500;
    color: var(--text-primary);
    text-decoration: none;
    transition: background var(--transition);
}
.topbar-user-dropdown-item:hover {
    background: var(--bg);
}
.topbar-user-dropdown-item svg {
    width: 16px; height: 16px;
    flex-shrink: 0;
    color: var(--text-secondary);
}
.topbar-user-dropdown-item--danger {
    color: var(--danger);
}
.topbar-user-dropdown-item--danger svg {
    color: var(--danger);
}
.topbar-user-dropdown-item--danger:hover {
    background: var(--danger-light);
}

/* === Page Header === */
.page-header { margin-bottom: 24px; }
.page-title { font-size: 24px; font-weight: 700; color: var(--text-primary); letter-spacing: -0.4px; }
.page-subtitle { color: var(--text-secondary); font-size: 14px; margin-top: 4px; }
.page-actions { display: flex; gap: 10px; align-items: center; margin-top: 16px; flex-wrap: wrap; }

/* === Buttons === */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 9px 16px;
    border: 1px solid transparent; border-radius: var(--radius-md);
    font-size: 14px; font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    line-height: 1.2;
    white-space: nowrap;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-hover); transform: translateY(-1px); box-shadow: 0 4px 12px -2px rgba(79, 70, 229, 0.35); }
.btn-secondary { background: var(--surface); color: var(--text-primary); border-color: var(--border); }
.btn-secondary:hover { background: var(--bg); border-color: var(--border-strong); }
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--bg); color: var(--text-primary); }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #e11d48; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }

/* === Cards === */
.card {
    background: var(--surface);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-xs);
    overflow: hidden;
}
.card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}
.card-title { font-size: 16px; font-weight: 700; color: var(--text-primary); }
.card-subtitle { font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.card-body { padding: 24px; }
.card-footer { padding: 16px 24px; border-top: 1px solid var(--border); background: var(--bg); }

/* === Stats Grid === */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 20px;
    transition: all var(--transition);
}
.stat-card:hover { border-color: var(--primary-border); box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.stat-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 12px; }
.stat-label { font-size: 13px; color: var(--text-secondary); font-weight: 500; }
.stat-icon {
    width: 36px; height: 36px;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: var(--radius-md);
    display: flex; align-items: center; justify-content: center;
    font-size: 16px;
    font-weight: 600;
}
.stat-icon.success { background: var(--success-light); color: var(--success); }
.stat-icon.warning { background: var(--warning-light); color: var(--warning); }
.stat-icon.danger { background: var(--danger-light); color: var(--danger); }
.stat-value { font-size: 28px; font-weight: 800; color: var(--text-primary); letter-spacing: -0.5px; }
.stat-change { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; margin-top: 6px; }
.stat-change.up { color: var(--success); }
.stat-change.down { color: var(--danger); }

/* === Data Tables === */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
    text-align: left;
    padding: 12px 16px;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.data-table td {
    padding: 14px 16px;
    font-size: 14px;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.data-table tr:hover td { background: var(--bg); }
.data-table tr:last-child td { border-bottom: none; }

/* === Badges === */
.badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.badge-primary { background: var(--primary-light); color: var(--primary); }
.badge-success { background: var(--success-light); color: #065f46; }
.badge-warning { background: var(--warning-light); color: #92400e; }
.badge-danger { background: var(--danger-light); color: #9f1239; }
.badge-info { background: var(--info-light); color: #1e40af; }
.badge-neutral { background: var(--bg); color: var(--text-secondary); }

/* === Alerts === */
.alert {
    padding: 14px 16px;
    border-radius: var(--radius-md);
    margin-bottom: 16px;
    font-size: 14px;
    border: 1px solid transparent;
}
.alert-error { background: var(--danger-light); color: #9f1239; border-color: #fecdd3; }
.alert-success { background: var(--success-light); color: #065f46; border-color: #a7f3d0; }
.alert-info { background: var(--info-light); color: #1e40af; border-color: #bfdbfe; }
.alert-warning { background: var(--warning-light); color: #92400e; border-color: #fde68a; }

/* === Forms === */
.form-group { margin-bottom: 16px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
label { display: block; font-size: 13px; font-weight: 600; color: var(--text-primary); margin-bottom: 6px; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="url"], input[type="search"], select, textarea {
    width: 100%;
    padding: 9px 12px;
    background: var(--surface);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 14px;
    transition: all var(--transition);
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}
input::placeholder, textarea::placeholder { color: var(--text-muted); }
textarea { resize: vertical; min-height: 80px; }
small.help { display: block; margin-top: 6px; font-size: 12px; color: var(--text-muted); }

/* === Widget Grid === */
.widget-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.widget {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    overflow: hidden;
    transition: all var(--transition);
}
.customize-mode .widget { cursor: grab; }
.customize-mode .widget:hover { box-shadow: var(--shadow-md); border-color: var(--primary-border); }
.widget.dragging { opacity: 0.5; }
.widget.drag-over { border-color: var(--primary); border-style: dashed; background: var(--primary-lighter); }
.widget-header {
    padding: 14px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
}
.widget-title { font-size: 14px; font-weight: 700; color: var(--text-primary); display: flex; align-items: center; gap: 8px; }
.widget-drag-handle { color: var(--text-muted); cursor: grab; font-size: 16px; }
.widget-body { padding: 18px; }
.widget-remove-btn {
    width: 24px; height: 24px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: none;
    align-items: center; justify-content: center;
}
.customize-mode .widget-remove-btn { display: flex; }
.customize-mode .widget-remove-btn:hover { background: var(--danger-light); color: var(--danger); }

/* === Customize Bar === */
.customize-bar {
    background: var(--primary);
    color: white;
    border-radius: var(--radius-lg);
    padding: 14px 20px;
    margin-bottom: 20px;
    display: none;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    box-shadow: var(--shadow-md);
}
.customize-bar.active { display: flex; }
.customize-bar .info { font-size: 14px; font-weight: 500; }
.customize-bar .btn { background: rgba(255,255,255,0.15); color: white; }
.customize-bar .btn:hover { background: rgba(255,255,255,0.25); }
.customize-bar .btn-primary { background: white; color: var(--primary); }

/* === Timeline === */
.timeline { position: relative; padding-left: 24px; }
.timeline::before { content: ''; position: absolute; left: 6px; top: 6px; bottom: 6px; width: 2px; background: var(--border); }
.timeline-item { position: relative; padding-bottom: 14px; }
.timeline-item::before { content: ''; position: absolute; left: -22px; top: 4px; width: 10px; height: 10px; background: var(--primary); border-radius: 50%; border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--primary); }
.timeline-time { font-size: 12px; color: var(--text-muted); font-weight: 500; }
.timeline-content { font-size: 14px; color: var(--text-primary); margin-top: 2px; }

/* === Empty State === */
.empty-state { text-align: center; padding: 60px 20px; }
.empty-state-icon { font-size: 48px; color: var(--text-muted); margin-bottom: 12px; }
.empty-state-title { font-size: 16px; font-weight: 600; color: var(--text-primary); margin-bottom: 4px; }
.empty-state-text { font-size: 14px; color: var(--text-muted); }

/* === Modal === */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.5);
    display: none; align-items: center; justify-content: center;
    z-index: 1000;
    padding: 20px;
}
.modal-overlay.active { display: flex; }
.modal {
    background: var(--surface);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    max-width: 600px; width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}
.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
}
.modal-title { font-size: 18px; font-weight: 700; }
.modal-close {
    width: 32px; height: 32px;
    border-radius: var(--radius-md);
    background: transparent; border: none;
    cursor: pointer; font-size: 18px;
    color: var(--text-muted);
    display: flex; align-items: center; justify-content: center;
}
.modal-close:hover { background: var(--bg); color: var(--text-primary); }
.modal-body { padding: 24px; }
.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    display: flex; justify-content: flex-end; gap: 8px;
}

/* === Toast === */
.toast-container {
    position: fixed; top: 20px; right: 20px;
    z-index: 2000;
    display: flex; flex-direction: column; gap: 8px;
}
.toast {
    padding: 12px 16px;
    border-radius: var(--radius-md);
    font-size: 14px; font-weight: 500;
    box-shadow: var(--shadow-lg);
    animation: toastIn 0.3s ease;
    display: flex; align-items: center; gap: 8px;
}
.toast-success { background: #065f46; color: white; }
.toast-error { background: #9f1239; color: white; }
.toast-info { background: #1e40af; color: white; }
@keyframes toastIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* === Responsive === */
.mobile-menu-btn { display: none; }
@media (max-width: 1024px) {
    .app-layout { grid-template-columns: 1fr; }
    .sidebar { position: fixed; left: -100%; z-index: 1000; transition: left 0.3s; }
    .sidebar.open { left: 0; }
    .mobile-menu-btn { display: inline-flex; }
}
@media (max-width: 640px) {
    .topbar { padding: 0 16px; }
    .content { padding: 16px; }
    .topbar-search { display: none; }
}

/* === Page Content & Container === */
.page-content { padding: 28px; }
.container { max-width: 1200px; margin: 0 auto; width: 100%; }
.subtitle { font-size: 14px; color: var(--text-secondary); margin-top: 4px; }
.text-muted { color: var(--text-muted); }

/* === Card Grid === */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.card-grid .card { padding: 24px; }

/* === Sub Navigation === */
.sub-nav { display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; }

/* === Filter Bar === */
.filter-bar { display: flex; gap: 12px; align-items: center; margin-bottom: 20px; flex-wrap: wrap; }
.filter-bar input, .filter-bar select { max-width: 280px; }

/* === Quick Links === */
.quick-links { display: flex; gap: 12px; margin-top: 20px; flex-wrap: wrap; }
.quick-links a {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 10px 16px; background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-md); font-size: 13px; font-weight: 600;
    color: var(--text-primary); text-decoration: none; transition: all var(--transition);
}
.quick-links a:hover { background: var(--bg); border-color: var(--primary-border); color: var(--primary); }

/* === Additional Button Variants === */
.btn-outline { background: transparent; color: var(--text-primary); border: 1px solid var(--border); }
.btn-outline:hover { background: var(--bg); border-color: var(--border-strong); }
.btn-outline-sm { background: transparent; color: var(--text-primary); border: 1px solid var(--border); padding: 5px 10px; font-size: 12px; border-radius: var(--radius-md); cursor: pointer; transition: all var(--transition); text-decoration: none; display: inline-flex; align-items: center; gap: 4px; }
.btn-outline-sm:hover { background: var(--bg); border-color: var(--primary-border); color: var(--primary); }
.btn-primary-sm { background: var(--primary); color: white; padding: 5px 10px; font-size: 12px; border: none; border-radius: var(--radius-md); cursor: pointer; transition: all var(--transition); text-decoration: none; display: inline-flex; align-items: center; gap: 4px; font-weight: 600; }
.btn-primary-sm:hover { background: var(--primary-hover); }

/* === Form Sections & Actions === */
.form-section { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-xl); padding: 24px; margin-bottom: 20px; }
.form-section h2 { font-size: 16px; font-weight: 700; color: var(--text-primary); margin-bottom: 16px; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); }
.inline-checkbox { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-secondary); }
.code-textarea { font-family: 'JetBrains Mono', 'Fira Code', monospace; font-size: 13px; line-height: 1.5; tab-size: 2; background: var(--bg); color: var(--text-primary); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 12px; width: 100%; min-height: 200px; resize: vertical; }
.inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 20px; }
.inline-form input, .inline-form select { max-width: 200px; }

/* === List Section === */
.list-section { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-xl); padding: 24px; margin-bottom: 20px; }
.list-section h2 { font-size: 16px; font-weight: 700; color: var(--text-primary); margin-bottom: 16px; }

/* === CRM Pipeline Board === */
.pipeline-board { display: flex; gap: 16px; overflow-x: auto; padding-bottom: 16px; min-height: 400px; }
.pipeline-column {
    flex: 0 0 280px; background: var(--bg); border: 1px solid var(--border);
    border-radius: var(--radius-xl); padding: 16px; min-height: 200px;
}
.pipeline-column h3 { font-size: 13px; font-weight: 700; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 12px; padding-bottom: 8px; border-bottom: 2px solid var(--border); }
.pipeline-column.drag-over { border-color: var(--primary); background: var(--primary-lighter); }
.lead-card, .deal-card {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md);
    padding: 12px; margin-bottom: 8px; cursor: grab; transition: all var(--transition);
}
.lead-card:hover, .deal-card:hover { border-color: var(--primary-border); box-shadow: var(--shadow-sm); }
.lead-card a, .deal-card a { font-size: 14px; font-weight: 600; color: var(--text-primary); text-decoration: none; display: block; margin-bottom: 4px; }
.lead-card small, .deal-card small { font-size: 12px; color: var(--text-muted); display: block; }
.deal-name { font-size: 14px; font-weight: 600; color: var(--text-primary); margin-bottom: 4px; }
.deal-amount { font-size: 16px; font-weight: 700; color: var(--success); }
.lead-score { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; background: var(--primary-light); color: var(--primary); margin-top: 6px; }
.stage-pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 600; background: var(--bg); color: var(--text-secondary); border: 1px solid var(--border); }
.empty-stage { text-align: center; padding: 20px; color: var(--text-muted); font-size: 13px; }

/* === Detail Page Layout === */
.detail-grid { display: grid; grid-template-columns: 1fr 320px; gap: 24px; }
.detail-main { min-width: 0; }
.detail-side { display: flex; flex-direction: column; gap: 16px; }
.detail-list { list-style: none; padding: 0; }
.detail-list li { padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 14px; display: flex; justify-content: space-between; }
.detail-list li:last-child { border-bottom: none; }
.detail-block { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-xl); padding: 20px; margin-bottom: 16px; }
.detail-block h3 { font-size: 14px; font-weight: 700; color: var(--text-primary); margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }

/* === Activity Feed === */
.activity-item { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.activity-item:last-child { border-bottom: none; }
.activity-type { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; background: var(--primary-light); color: var(--primary); flex-shrink: 0; }
.activity-type.email { background: var(--info-light); color: #1e40af; }
.activity-type.call { background: var(--success-light); color: #065f46; }
.activity-type.note { background: var(--warning-light); color: #92400e; }
.activity-body { font-size: 14px; color: var(--text-primary); flex: 1; }

/* === Tasks === */
.task-item { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.task-item:last-child { border-bottom: none; }
.task-item input[type="checkbox"] { flex-shrink: 0; }
.task-info { flex: 1; }
.task-info .title { font-size: 14px; font-weight: 500; color: var(--text-primary); }
.task-info .meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* === Notes === */
.note-item { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 12px; margin-bottom: 8px; }
.note-item.pinned { border-color: var(--warning); background: var(--warning-lighter); }
.note-item .note-text { font-size: 14px; color: var(--text-primary); }
.note-item .note-meta { font-size: 12px; color: var(--text-muted); margin-top: 6px; }

/* === Tags === */
.tag-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-chip {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 500;
    background: var(--bg); color: var(--text-secondary); border: 1px solid var(--border);
}
.tag-chip .remove { cursor: pointer; color: var(--text-muted); font-size: 14px; }
.tag-chip .remove:hover { color: var(--danger); }

/* === Reply Form === */
.reply-form { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-xl); padding: 16px; margin-top: 16px; }
.reply-form textarea { width: 100%; margin-bottom: 10px; }
.reply-form .btn { float: right; }

/* === Stage Row (Pipeline Form) === */
.stage-row { display: flex; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); }
.stage-row:last-child { border-bottom: none; }
.form-group-color { display: flex; align-items: center; gap: 8px; }
.form-group-color input[type="color"] { width: 40px; height: 32px; border: 1px solid var(--border); border-radius: var(--radius-md); cursor: pointer; padding: 2px; }
.form-group-grow { flex: 1; }
.form-group-narrow { max-width: 120px; }
.form-group-flag { display: flex; align-items: center; gap: 6px; }

/* === Helpdesk Conversation === */
.conversation { display: flex; flex-direction: column; gap: 12px; }
.reply { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-xl); padding: 16px; }
.reply-staff { border-left: 3px solid var(--primary); }
.reply-customer { border-left: 3px solid var(--success); }
.reply .reply-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.reply .reply-author { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.reply .reply-time { font-size: 12px; color: var(--text-muted); }
.reply .reply-body { font-size: 14px; color: var(--text-primary); line-height: 1.6; }

/* === Timeline Event (alias) === */
.timeline-event { position: relative; padding: 12px 0 12px 20px; border-bottom: 1px solid var(--border); }
.timeline-event:last-child { border-bottom: none; }
.timeline-event strong { font-size: 13px; color: var(--text-primary); display: block; margin-bottom: 4px; }
.timeline-event p { font-size: 14px; color: var(--text-secondary); margin: 0; }
.timeline-event small { font-size: 12px; color: var(--text-muted); }

/* === Module Card === */
.module-card {
    display: block;
    padding: 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    background: var(--surface);
    transition: all 0.15s;
}
.module-card:hover { border-color: var(--primary-border); box-shadow: var(--shadow-sm); }
.module-card-active { border-color: var(--primary) !important; background: var(--primary-light) !important; }

/* === Pricing Tier Card === */
.pricing-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    background: var(--surface);
    position: relative;
    transition: all var(--transition);
}
.pricing-card:hover { border-color: var(--primary-border); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.pricing-card .pricing-price { font-size: 28px; font-weight: 800; color: var(--text-primary); letter-spacing: -0.5px; }
.pricing-card .pricing-period { font-size: 13px; font-weight: 500; color: var(--text-muted); }
.pricing-card .pricing-badge { position: absolute; top: -12px; right: 16px; padding: 4px 12px; border-radius: 999px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; }

/* === Form Section Split === */
.form-split { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.form-split > .form-section { margin-bottom: 0; }

/* === SEO Meta Display === */
.seo-meta-row { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.seo-meta-row:last-child { border-bottom: none; }
.seo-meta-label { font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; min-width: 100px; }

/* === Tab Navigation === */
.tab-nav { display: flex; border-bottom: 2px solid var(--border); overflow-x: auto; margin-bottom: 20px; }
.tab-nav a {
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 2px solid transparent;
    text-decoration: none;
    white-space: nowrap;
    transition: all var(--transition);
    margin-bottom: -2px;
}
.tab-nav a:hover { color: var(--text-primary); }
.tab-nav a.active { color: var(--primary); border-bottom-color: var(--primary); }

/* === Progress Bar === */
.progress-bar { background: var(--bg); border-radius: 999px; height: 8px; overflow: hidden; }
.progress-bar-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--primary), #7c3aed); transition: width 0.3s; }

/* === Responsive === */
@media (max-width: 768px) {
    .detail-grid { grid-template-columns: 1fr; }
    .pipeline-board { flex-direction: column; }
    .pipeline-column { flex: none; width: 100%; }
    .card-grid { grid-template-columns: 1fr; }
    .inline-form { flex-direction: column; align-items: stretch; }
    .inline-form input, .inline-form select { max-width: 100%; }
    .form-split { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
}
