.sidebar-chip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border: 1px solid var(--ml-border);
    border-radius: 12px;
    margin-bottom: 8px;
    background: #fff;
    font-size: 0.85rem;
    font-weight: 600;
}
.sidebar-chip small { display: block; color: var(--ml-sec); font-weight: 500; }
@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600&family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

/* --- MLINKS HUB V10.0 STYLES --- */
:root {
    --ml-bg: #f5f7fb;
    --ml-card: #ffffff;
    --ml-border: #e3e8f5;
    --ml-shell: #eef2fb;
    --ml-text: #0f172a;
    --ml-sec: #64748b;
    --ml-brand: #5c6bff;
    --ml-brand-dark: #3f4ee3;
    --ml-danger: #ef4444;
    --ml-success: #10b981;
}

/* 1. RESET CONTAINER */
.mlinks-wrapper {
    all: initial;
    width: 100vw;
    display: block;
    box-sizing: border-box;
    position: relative;
    left: 50%;
    right: 50%;
    margin-left: -50vw;
    margin-right: -50vw;
    padding: 40px 0 60px 0;
    background: linear-gradient(145deg, #fefdff 0%, var(--ml-shell) 65%, #f1f4ff 100%);
    overflow: hidden;
}
.mlinks-wrapper * { box-sizing: border-box; }
.mlinks-wrapper,
.mlinks-wrapper span,
.mlinks-wrapper input,
.mlinks-wrapper button,
.mlinks-wrapper select,
.mlinks-wrapper textarea,
.mlinks-wrapper p,
.mlinks-wrapper li,
.mlinks-wrapper div {
    font-family: 'Plus Jakarta Sans', 'Segoe UI', sans-serif !important;
    color: var(--ml-text);
}
.mlinks-wrapper h1,
.mlinks-wrapper h2,
.mlinks-wrapper h3,
.mlinks-wrapper h4,
.mlinks-wrapper h5,
.mlinks-wrapper h6 {
    font-family: 'Space Grotesk', 'Plus Jakarta Sans', sans-serif !important;
    letter-spacing: -0.02em;
    color: var(--ml-text);
}

/* 2. MAIN LAYOUT GRID (Forces 3 Columns) */
.ml-container {
    display: grid !important;
    grid-template-columns: 250px 1fr 320px !important; 
    min-height: 90vh;
    background: var(--ml-card);
    border: 1px solid var(--ml-border);
    border-radius: 32px;
    max-width: 1600px;
    width: calc(100% - 40px);
    margin: 0 auto;
    overflow-x: hidden;
    box-shadow: 0 25px 70px -30px rgba(15, 23, 42, 0.35);
}

/* 3. SIDEBAR (Fixed Width) */
.ml-sidebar {
    background: #fbfcff;
    border-right: 1px solid var(--ml-border);
    padding: 28px 24px;
    display: flex; flex-direction: column; gap: 10px;
}
.brand { font-size: 1.25rem; font-weight: 700; color: var(--ml-text); margin-bottom: 32px; display: flex; align-items: center; gap: 12px; }
.nav-item {
    padding: 12px 14px; border-radius: 10px; color: var(--ml-sec);
    cursor: pointer; font-weight: 600; font-size: 0.95rem;
    display: flex; align-items: center; gap: 10px; transition: 0.2s;
}
.nav-item:hover { background: #f8fafc; color: var(--ml-text); }
.nav-item.active { background: var(--ml-brand); color: white; box-shadow: 0 10px 20px -10px rgba(92, 107, 255, 0.7); }

/* 4. MAIN CONTENT AREA */
.ml-main {
    padding: 36px 40px 40px;
    background: var(--ml-bg);
    overflow-y: auto;
    position: relative;
}
.header-area h2 { margin: 0 0 8px 0 !important; font-size: 2.1rem !important; color: var(--ml-text); line-height: 1.2; }
.search-bar {
    width: 100%; max-width: 100%; padding: 12px;
    border: 1px solid var(--ml-border); border-radius: 12px;
    margin-top: 8px; font-size: 1rem;
    background: white;
    box-shadow: inset 0 1px 3px rgba(15, 23, 42, 0.05);
}

/* 5. RIGHT PANEL (Fixed Width) */
.ml-panel {
    background: #fdfdff;
    border-left: 1px solid var(--ml-border);
    padding: 28px 24px;
    display: flex; flex-direction: column; gap: 22px;
}
.ml-panel h4 { margin: 0 0 10px 0 !important; font-size: 0.9rem !important; text-transform: uppercase; color: var(--ml-sec); }

/* Inputs & Buttons */
.input-group select, .input-group input, .input-group textarea {
    width: 100%; padding: 12px; border: 1px solid var(--ml-border);
    border-radius: 12px; margin-bottom: 10px; font-family: inherit; font-size: 0.95rem;
    display: block;
    background: #fff;
    box-shadow: inset 0 1px 3px rgba(15, 23, 42, 0.05);
}
.primary-btn {
    background: var(--ml-brand); color: white; border: none;
    padding: 12px 18px; border-radius: 12px; font-weight: 600; cursor: pointer; width: 100%;
    box-shadow: 0 14px 30px -15px rgba(92, 107, 255, 0.9);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.primary-btn:hover { background: var(--ml-brand-dark); transform: translateY(-1px); }

.card-action-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid var(--ml-border);
    background: #fff;
    color: var(--ml-sec);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, border 0.2s ease;
}
.card-action-btn.del { border-color: rgba(239, 68, 68, 0.2); color: var(--ml-danger); }
.card-action-btn:hover { background: #eff2ff; color: var(--ml-brand-dark); border-color: rgba(92, 107, 255, 0.4); }
.sec-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* 6. MODALS - CRITICAL FIX */
.modal-wrap {
    display: none !important; /* Force hidden by default */
    position: fixed !important;
    inset: 0; 
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5); 
    backdrop-filter: blur(4px);
    z-index: 99999 !important; /* Force on top */
    align-items: center; justify-content: center;
}
.modal-wrap.active {
    display: flex !important; /* Force show when active */
}
.modal-box {
    background: white; padding: 30px; border-radius: 12px; width: 400px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    position: relative;
}

/* 7. GRID SYSTEM */
.grid-area {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)) !important;
    gap: 20px !important;
    width: 100%;
}
.cards-stage { display: flex; flex-direction: column; gap: 24px; }
.pinned-tasks-area { display: grid; gap: 18px; }
.tasks-table-section {
    margin-top: 40px;
    background: #fff;
    border: 1px solid var(--ml-border);
    border-radius: 20px;
    padding: 24px;
    box-shadow: 0 18px 35px -25px rgba(15, 23, 42, 0.4);
}
.section-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
}
.section-heading h3 { margin: 0; font-size: 1.3rem; }
.section-heading p { margin: 4px 0 0 0; color: var(--ml-sec); font-size: 0.9rem; }
.ghost-btn {
    border: 1px dashed var(--ml-border);
    border-radius: 999px;
    background: transparent;
    padding: 10px 18px;
    font-weight: 600;
    color: var(--ml-brand);
    cursor: pointer;
    transition: border 0.2s ease, color 0.2s ease, background 0.2s ease;
}
.ghost-btn:hover { background: rgba(92, 107, 255, 0.08); border-color: var(--ml-brand); }
.table-wrapper { width: 100%; overflow-x: auto; }
.tasks-table { width: 100%; border-collapse: collapse; min-width: 640px; }
.tasks-table th { text-align: left; font-size: 0.72rem; text-transform: uppercase; color: var(--ml-sec); letter-spacing: 0.08em; padding: 0 12px 6px 0; }
.tasks-table td { padding: 12px 12px 12px 0; border-top: 1px solid var(--ml-border); font-size: 0.92rem; }
.tasks-table tbody tr:hover { background: #f8f9ff; }
.task-text-main { font-weight: 600; color: var(--ml-text); }
.task-meta { font-size: 0.78rem; color: var(--ml-sec); margin-top: 4px; }
.status-chip { padding: 4px 10px; border-radius: 20px; font-size: 0.78rem; font-weight: 600; }
.status-chip.pending { background: #fff4e6; color: #b45309; }
.status-chip.done { background: #ecfdf5; color: var(--ml-success); }
 .table-check {
     width: 22px;
     height: 22px;
     border-radius: 999px;
     border: 1px solid rgba(15, 23, 42, 0.25);
     background: #f8f9ff;
     display: inline-flex;
     align-items: center;
     justify-content: center;
     font-weight: 700;
     font-size: 0.75rem;
     color: var(--ml-brand);
     cursor: pointer;
     transition: all 0.2s ease;
     box-shadow: inset 0 1px 1px rgba(0,0,0,0.05);
 }
.table-check::after {
    content: '';
    width: 10px;
    height: 2px;
    border-radius: 2px;
    background: rgba(99, 102, 241, 0.4);
}
.table-check.checked {
    background: var(--ml-brand);
    color: #fff;
    border-color: var(--ml-brand);
}
.table-check.checked::after { background: #fff; height: 2px; }
.table-actions { display: flex; gap: 8px; justify-content: flex-end; }
.table-icon-btn {
    border: 1px solid var(--ml-border);
    border-radius: 10px;
    padding: 6px 14px;
    font-size: 0.85rem;
    font-weight: 600;
    background: #fff;
    color: var(--ml-text);
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, border 0.2s ease;
}
.table-icon-btn:hover { background: #eef2ff; border-color: rgba(92, 107, 255, 0.6); color: var(--ml-brand-dark); }
.table-icon-btn.danger { border-color: rgba(239, 68, 68, 0.35); color: var(--ml-danger); }
.table-icon-btn.danger:hover { background: #fff1f1; }
.task-tabs { display: flex; gap: 12px; margin-bottom: 20px; }
.task-tab-btn {
    flex: 0 0 auto;
    .table-check::after {
        content: '';
        width: 10px;
        height: 2px;
        border-radius: 2px;
        background: rgba(99, 102, 241, 0.4);
    }
    transition: background 0.2s ease, color 0.2s ease, border 0.2s ease;
}
.task-tab-btn.active { background: var(--ml-brand); color: #fff; border-color: var(--ml-brand); box-shadow: 0 12px 24px -15px rgba(92, 107, 255, 0.9); }
.task-tab-btn:not(.active):hover { border-color: var(--ml-brand); color: var(--ml-brand); }
.empty-row { text-align: center; padding: 20px 0; color: var(--ml-sec); font-size: 0.9rem; }
.empty-copy { opacity: 0.6; padding: 12px; font-size: 0.9rem; text-align: center; }
.section-card {
    background: white; border: 1px solid var(--ml-border);
    border-radius: 18px; padding: 20px;
    display: flex; flex-direction: column;
    gap: 12px;
    box-shadow: 0 12px 25px -18px rgba(15, 23, 42, 0.35);
}
.section-card.global { border-top: 4px solid var(--ml-brand); }

.sec-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: 1px solid var(--ml-border);
    padding-bottom: 10px;
    margin-bottom: 10px;
    gap: 12px;
    flex-wrap: wrap;
}
.sec-title {
    font-weight: 700;
    color: var(--ml-text);
    font-size: 1.1rem;
    flex: 1;
    min-width: 160px;
}

/* Links */
.link-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; text-decoration: none !important; color: var(--ml-text); border-radius: 10px; transition: 0.2s; border: 1px solid transparent; }
.link-item:hover { background: #f8f9ff; border-color: rgba(92, 107, 255, 0.15); }
.favicon { width: 26px; height: 26px; border-radius: 6px; }
.link-details span { font-weight: 600; font-size: 0.92rem; display: block; }
.link-details small { font-size: 0.78rem; color: var(--ml-sec); }
.link-cta { margin-left: auto; display: flex; gap: 6px; }
.icon-btn {
    border: none;
    background: transparent;
    color: var(--ml-sec);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: color 0.2s ease, transform 0.2s ease;
}
.icon-btn:hover { color: var(--ml-brand-dark); transform: translateY(-1px); }
.icon-btn.danger { color: var(--ml-danger); }
.icon-btn.danger:hover { color: #b91c1c; }

/* Tasks */
.task-widget { background: white; border: 1px solid var(--ml-border); border-radius: 18px; padding: 22px; margin-bottom: 30px; box-shadow: 0 12px 25px -18px rgba(15, 23, 42, 0.35); }
.pro-task-row {
    display: flex; align-items: center; gap: 12px; background: white;
    padding: 12px 14px; border: 1px solid var(--ml-border); border-radius: 12px; margin-bottom: 10px;
}
.pro-task-row.completed .task-desc { text-decoration: line-through; opacity: 0.5; }
.task-desc { flex: 1; font-weight: 500; font-size: 0.95rem; color: var(--ml-text); }
.task-check-btn { width: 26px; height: 26px; border: 2px solid var(--ml-border); border-radius: 50%; background: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; font-weight: 700; color: var(--ml-brand); }
.pro-task-row.completed .task-check-btn { background: var(--ml-success); border-color: var(--ml-success); color: white; }

@media(max-width:900px) {
    .section-heading { flex-direction: column; align-items: flex-start; }
    .tasks-table { min-width: 520px; }
}

/* Responsive */
@media(max-width:1100px) {
    .ml-container { grid-template-columns: 1fr !important; display: flex !important; flex-direction: column; width: calc(100% - 30px); margin: 0 auto; }
    .ml-sidebar, .ml-panel { width: 100%; border: none; border-bottom: 1px solid var(--ml-border); }
}