/* --- VARIABLES & BASICS --- */
:root {
    --swm-bg-app: #f4f6f8;
    --swm-bg-sidebar: #1a1f24;
    --swm-bg-sidebar-hover: #262c33;
    --swm-bg-white: #ffffff;
    --swm-text-main: #2c3338;
    --swm-text-light: #646970;
    --swm-primary: #2271b1;
    --swm-primary-hover: #135e96;
    --swm-border: #dcdcde;
    --swm-shadow-card: 0 2px 4px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.02);
    --swm-shadow-hover: 0 8px 16px rgba(0,0,0,0.08), 0 4px 8px rgba(0,0,0,0.04);
    --swm-shadow-modal: 0 20px 40px rgba(0,0,0,0.2);
    --swm-shadow-btn-primary: 0 2px 5px rgba(34, 113, 177, 0.3);
    --swm-shadow-btn-primary-hover: 0 5px 15px rgba(34, 113, 177, 0.4);
    --swm-radius: 8px;
    --swm-font-header: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    --swm-transition-fast: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* --- ANIMATIONS --- */
@keyframes swmFadeInUp {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes swmModalPop {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

/* --- MOBILE OPTIMIZATION: REMOVE TAP DELAY --- */
button, 
.swm-btn-primary, 
.swm-view-btn, 
.swm-trip-card, 
.swm-task-card, 
.swm-detail-row,
input[type="checkbox"],
select {
    touch-action: manipulation;
}

/* --- FULL SCREEN OVERRIDE --- */
.swm-app-wrap.swm-layout-split {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh; /* Fallback */
    height: 100dvh; /* Mobile Modern: Fixes the jumping URL bar issue */
    z-index: 99990;
    background: var(--swm-bg-app);
    margin: 0 !important;
    padding: 0 !important;
    border: none;
    border-radius: 0;
    display: flex;
    flex-direction: row;
    box-sizing: border-box;
    overflow: hidden;
    font-family: var(--swm-font-header);
}

/* Admin Bar Adjustments - HIGH SPECIFICITY */
/* Desktop (default WP breakpoint > 782px) */
body.admin-bar .swm-app-wrap.swm-layout-split { 
    top: 32px !important; 
    height: calc(100vh - 32px) !important; 
    height: calc(100dvh - 32px) !important; 
}

/* Mobile (WP breakpoint <= 782px) */
@media screen and (max-width: 782px) {
    body.admin-bar .swm-app-wrap.swm-layout-split { 
        top: 46px !important; 
        height: calc(100vh - 46px) !important; 
        height: calc(100dvh - 46px) !important; 
    }
}

/* --- SIDEBAR --- */
.swm-sidebar {
    width: 260px;
    background: var(--swm-bg-sidebar);
    color: #e0e0e0;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    height: 100%;
    border-right: 1px solid #000;
    z-index: 20;
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.swm-sidebar-header {
    padding: 0 20px;
    height: 60px;
    background: rgba(0,0,0,0.2);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    flex-shrink: 0;
}
.swm-sidebar-header h3 { 
    margin: 0; 
    color: #fff; 
    font-size: 15px; 
    font-weight: 700; 
    text-transform: uppercase; 
    letter-spacing: 0.5px; 
}

/* --- ADDED: Sidebar Footer for Logout --- */
.swm-sidebar-footer {
    padding: 20px;
    border-top: 1px solid rgba(255,255,255,0.05);
    background: rgba(0,0,0,0.1);
    flex-shrink: 0;
}

.swm-logout-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #ccc;
    text-decoration: none;
    font-size: 13px;
    padding: 10px 12px;
    border-radius: 6px;
    transition: background 0.2s, color 0.2s;
}

.swm-logout-btn:hover {
    background: rgba(255,255,255,0.1);
    color: #fff;
}

.swm-logout-btn .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
}

.swm-btn-icon { 
    background: rgba(255,255,255,0.1); border: none; color: #fff; cursor: pointer; 
    font-size: 16px; width: 28px; height: 28px; border-radius: 4px; 
    display: flex; align-items: center; justify-content: center; 
    transition: var(--swm-transition-fast); 
}
.swm-btn-icon:hover { 
    background: var(--swm-primary); 
    opacity: 1; 
    transform: scale(1.1); 
    box-shadow: 0 0 10px rgba(34, 113, 177, 0.6);
}

.swm-trip-sections-container {
    padding: 20px 15px;
    overflow-y: auto;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 25px;
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
}

/* Custom Scrollbar for Sidebar */
.swm-sidebar ::-webkit-scrollbar { width: 6px; }
.swm-sidebar ::-webkit-scrollbar-track { background: transparent; }
.swm-sidebar ::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 3px; }
.swm-sidebar ::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.3); }

.swm-trip-section { display: flex; flex-direction: column; gap: 10px; }
.swm-trip-section-header { 
    font-size: 11px; 
    text-transform: uppercase; 
    color: #888; 
    font-weight: 800; 
    letter-spacing: 1px;
    padding-left: 5px; 
    opacity: 0.7;
}
.swm-trip-list { min-height: 10px; display: flex; flex-direction: column; gap: 6px; }
.swm-trip-placeholder { background: rgba(255,255,255,0.05); height: 50px; border-radius: 6px; border: 1px dashed #555; }

/* Trip Card */
.swm-trip-card {
    background: transparent;
    padding: 10px 12px;
    border-radius: 6px;
    cursor: pointer;
    border-left: 3px solid transparent;
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
    transition: var(--swm-transition-fast);
    color: #ccc;
}
.swm-trip-card:hover { 
    background: var(--swm-bg-sidebar-hover); 
    color: #fff; 
    transform: translateX(4px); 
}
.swm-trip-card.active { 
    background: rgba(255,255,255,0.1); 
    color: #fff; 
    box-shadow: 0 2px 8px rgba(0,0,0,0.2); 
}
.swm-trip-card.active .swm-trip-title { font-weight: 600; }

.swm-trip-icon { font-size: 18px; width: 18px; height: 18px; display: flex; align-items: center; justify-content: center; opacity: 0.7; transition: opacity 0.2s; }
.swm-trip-card:hover .swm-trip-icon, .swm-trip-card.active .swm-trip-icon { opacity: 1; }

.swm-trip-title { font-size: 13px; line-height: 1.4; flex-grow: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Trip Menu */
.swm-trip-menu-trigger {
    visibility: hidden;
    color: #999;
    padding: 4px;
    border-radius: 4px;
    display: flex; 
    align-items: center;
    opacity: 0;
    transition: var(--swm-transition-fast);
}
.swm-trip-card:hover .swm-trip-menu-trigger { visibility: visible; opacity: 1; }
.swm-trip-menu-trigger:hover { background: rgba(255,255,255,0.2); color: #fff; transform: scale(1.1); }

.swm-trip-menu-dropdown {
    position: fixed;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 6px;
    box-shadow: var(--swm-shadow-modal);
    z-index: 999999;
    display: none;
    min-width: 150px;
    overflow: hidden;
    padding: 5px 0;
}
.swm-trip-menu-dropdown.show { display: block; animation: swmModalPop 0.1s ease-out; }
.swm-trip-menu-item {
    padding: 8px 15px;
    font-size: 13px;
    color: #333;
    cursor: pointer;
    background: #fff;
    transition: background 0.1s;
}
.swm-trip-menu-item:hover { background: #f0f6fc; color: var(--swm-primary); }

/* --- MAIN CONTENT --- */
.swm-main-content {
    flex-grow: 1;
    background: var(--swm-bg-app);
    padding: 0;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    position: relative;
    width: 100%; /* Fix flex child width issues */
}

/* Controls Bar */
.swm-controls { 
    height: 64px;
    flex-shrink: 0;
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    padding: 0 25px; 
    border-bottom: 1px solid #e2e4e7; 
    background: var(--swm-bg-white);
    box-sizing: border-box;
    z-index: 10;
    box-shadow: 0 1px 3px rgba(0,0,0,0.02);
}

.swm-control-group { display: flex; gap: 12px; align-items: center; }

/* --- ENHANCED BUTTONS --- */
/* NEW SIDEBAR NAV STYLES */
.swm-sidebar-nav {
    padding: 10px 15px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex-shrink: 0;
}

/* OVERRIDE View Buttons for Sidebar context */
.swm-sidebar-nav .swm-view-btn {
    width: 100%;
    color: #aaa;
    justify-content: flex-start;
    padding: 8px 12px;
    height: auto;
    border-radius: 6px;
    background: transparent;
    border: none;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: var(--swm-transition-fast);
}

.swm-sidebar-nav .swm-view-btn:hover {
    background: rgba(255,255,255,0.05);
    color: #fff;
    transform: none;
    box-shadow: none;
}

.swm-sidebar-nav .swm-view-btn.active {
    background: rgba(34, 113, 177, 0.2); /* swm-primary with opacity */
    color: #61a6e7; /* lighter primary */
    font-weight: 600;
}
.swm-sidebar-nav .swm-view-btn .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
    opacity: 0.8;
}

.swm-btn-primary { 
    background: var(--swm-primary); color: #fff; border: none; padding: 0 18px; border-radius: 6px; cursor: pointer; height: 36px; 
    display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; 
    box-shadow: var(--swm-shadow-btn-primary);
    transition: var(--swm-transition-fast);
}
.swm-btn-primary:hover { 
    background: var(--swm-primary-hover); 
    transform: translateY(-2px); 
    box-shadow: var(--swm-shadow-btn-primary-hover); 
    filter: brightness(1.05);
}
.swm-btn-primary:active { transform: translateY(0); box-shadow: var(--swm-shadow-btn-primary); }

.swm-btn-secondary { 
    text-decoration:none; font-size: 13px; padding: 0 14px; height: 36px; border: 1px solid var(--swm-border); border-radius: 6px; 
    color: var(--swm-text-main); background: #fff; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; 
    transition: var(--swm-transition-fast); 
}
.swm-btn-secondary:hover { 
    background: #f6f7f7; 
    border-color: #999; 
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

/* Modal Buttons (Standardized) */
.swm-modal-btn {
    padding: 0 12px;
    height: 32px;
    border-radius: 4px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
    line-height: normal;
    box-sizing: border-box;
}
.swm-modal-btn-default {
    background: #fff;
    color: #50575e;
    border: 1px solid #c3c4c7;
}
.swm-modal-btn-default:hover {
    background: #f6f7f7;
    border-color: #a7aaad;
    color: #1d2327;
}
.swm-modal-btn-primary {
    background: #f0f6fc;
    border: 1px solid #2271b1;
    color: #2271b1;
    font-weight: 600;
}
.swm-modal-btn-primary:hover {
    background-color: #e5f5fa;
    border-color: #2271b1;
    color: #2271b1;
}


#swm-task-search { 
    border: 1px solid #dcdcde; border-radius: 20px; padding: 0 15px; height: 34px; font-size: 13px; width: 220px; background: #f9f9f9; 
    transition: var(--swm-transition-fast); 
}
#swm-task-search:focus { 
    background: #fff; border-color: var(--swm-primary); outline: none; 
    box-shadow: 0 0 0 3px rgba(34,113,177,0.15); 
    width: 240px;
}

/* --- VIEW SECTIONS --- */
.swm-view-section {
    flex: 1;
    overflow: hidden; 
    position: relative;
    background: transparent;
    display: none; 
    flex-direction: column;
}
#swm-view-board[style*="display: block"], #swm-view-board[style*="display: inline"] { display: flex !important; }

/* --- BOARD VIEW --- */
#swm-trip-board-area {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow-y: auto; 
    padding: 25px 30px;
    box-sizing: border-box;
    /* Smooth Load Animation */
    animation: swmFadeInUp 0.4s ease-out;
    -webkit-overflow-scrolling: touch; /* Critical for iOS scroll */
}
#swm-trip-board-area[style*="display: block"] { display: flex !important; }

#swm-no-trip-selected {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #646970;
    background: url('data:image/svg+xml;utf8,<svg width="40" height="40" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M22 12C22 17.5228 17.5228 22 12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12Z" stroke="%23e0e0e0" stroke-width="2"/></svg>') no-repeat center center;
    background-size: 200px;
}

.swm-board-header {
    padding: 0 0 25px 0;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    border-bottom: none;
}
.swm-board-header h2 {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.5px;
    text-shadow: 0 1px 0 rgba(255,255,255,0.5);
}
.swm-board-meta { font-size: 13px; color: #666; display: flex; align-items: center; gap: 12px; margin-top: 6px; font-weight: 500; }
.swm-board-meta .dashicons { opacity: 0.6; }

.swm-board {
    display: flex;
    flex-direction: column; 
    gap: 35px; /* Spacing between columns in list view */
    padding-bottom: 60px;
}

/* --- COLUMNS & HEADERS --- */
.swm-column {
    width: 100%;
    min-width: 0;
    background: transparent;
    border-radius: 0;
    border: none;
    display: flex;
    flex-direction: column;
    max-height: none;
    transition: background 0.2s;
}

.swm-col-header {
    padding: 12px 0;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #555;
    border-bottom: 1px solid rgba(0,0,0,0.08);
    background: transparent;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}
.swm-col-header .count {
    background: #e0e0e0;
    color: #555;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
}

.swm-task-list {
    padding: 5px;
    margin: -5px; /* Offset padding for hover effects */
    overflow: visible;
    display: flex;
    flex-direction: column; 
    gap: 12px; 
    min-height: 50px; /* Drop zone */
}

/* --- TASK CARDS & ANIMATION --- */
.swm-card {
    width: 100%; 
    box-sizing: border-box;
    background: var(--swm-bg-white); 
    padding: 12px 16px; 
    border-radius: var(--swm-radius); 
    box-shadow: var(--swm-shadow-card); 
    cursor: grab;
    border: 1px solid transparent; 
    border-left-width: 4px; 
    border-left-style: solid; 
    display: flex; 
    flex-direction: column; 
    gap: 6px;
    margin-bottom: 0;
    min-height: 40px; 
    transition: var(--swm-transition-fast);
    position: relative;
    touch-action: pan-y; /* ALLOW vertical scrolling on card body */
}

/* Hover Lift Effect */
.swm-card:hover { 
    transform: translateY(-3px); 
    box-shadow: var(--swm-shadow-hover); 
    z-index: 5;
    border-color: rgba(0,0,0,0.05);
}
.swm-card:active { cursor: grabbing; transform: scale(0.99); }

/* Status Styles */
.swm-status-urgent { border-left-color: #d63638 !important; background: #fffbfb; }
.swm-status-priority { border-left-color: #f6c000 !important; }
.swm-status-normal { border-left-color: #e0e0e0 !important; }

.swm-card-main-row {
    display: flex;
    align-items: center;
    width: 100%;
    gap: 15px;
    white-space: nowrap; 
}

.swm-card-title { 
    font-weight: 600; 
    font-size: 14px; 
    color: var(--swm-text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 0;
    flex-grow: 1; 
}

.swm-card-details {
    display: flex; 
    flex-wrap: nowrap; 
    gap: 8px; 
    font-size: 12px; 
    color: var(--swm-text-light);
    align-items: center;
    flex-shrink: 0; 
}

.swm-status-pill { 
    font-size: 10px; 
    padding: 2px 6px; 
    border-radius: 4px; 
    color: #fff; 
    text-transform: uppercase; 
    margin-left: 5px;
    font-weight: 700;
    letter-spacing: 0.5px;
    flex-shrink: 0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.swm-detail-row {
    display: inline-flex;
    align-items: center;
    background: #f4f6f8;
    padding: 3px 8px; 
    border-radius: 4px;
    color: #50575e;
    height: 20px; 
    transition: var(--swm-transition-fast);
    cursor: pointer;
}
.swm-detail-row:hover { 
    background: #e1e4e8; 
    color: #1d2327;
    transform: translateY(-1px);
}
.swm-detail-row .dashicons { 
    font-size: 14px; 
    width: 14px; 
    height: 14px; 
    margin-right: 5px; 
    color: #8c8f94;
    transition: color 0.2s;
}
.swm-detail-row:hover .dashicons { color: #555; }
.swm-detail-row.overdue { background: #fbeaea; color: #d63638; border: 1px solid rgba(214, 54, 56, 0.1); }
.swm-detail-row.overdue:hover { background: #fcdbdb; }
.swm-detail-row.overdue .dashicons { color: #d63638; }

/* RESTORED: Utility Classes for Hiding Inputs */
.swm-date-wrap, .swm-inline-assignee-wrap { position: relative; }
.swm-date-input-hidden, .swm-inline-assignee-select { 
    position: absolute; 
    top: 0; left: 0; width: 100%; height: 100%; 
    opacity: 0; cursor: pointer; 
    z-index: 10;
}
.swm-names-truncate { 
    max-width: 80px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; 
    display: inline-block; vertical-align: bottom; 
}

/* Subtasks */
.swm-card-subtasks {
    margin-top: 4px;
    padding-left: 12px; 
    border-left: 2px solid #f0f0f0;
    width: 100%;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.swm-card-subtask-item {
    font-size: 12px;
    color: #777;
    padding: 2px 0;
    display: flex;
    align-items: center;
    gap: 6px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Done Task Styling */
.swm-task-done {
    opacity: 0.6;
    background-color: #f9f9f9;
    box-shadow: none;
    border-color: #eee;
}
.swm-task-done:hover { transform: none; box-shadow: none; }
.swm-task-done .swm-card-title {
    text-decoration: line-through;
    color: #999;
}

/* --- OTHER VIEWS --- */
#swm-view-calendar, #swm-view-mytasks, #swm-view-team {
    overflow-y: auto !important;
    padding: 30px;
    animation: swmFadeInUp 0.3s ease-out;
    -webkit-overflow-scrolling: touch;
}
#swm-view-calendar[style*="display: block"], 
#swm-view-mytasks[style*="display: block"],
#swm-view-team[style*="display: block"] {
    display: block !important; 
}

#swm-view-mytasks .swm-card-subtasks { display: none !important; }
#swm-view-mytasks .swm-column, #swm-trip-board-area .swm-column { width: 100% !important; margin-bottom: 25px; }
#swm-view-mytasks .swm-task-list, #swm-trip-board-area .swm-task-list { flex-direction: column; }

/* --- TEAM VIEW --- */
.swm-team-container {
    max-width: 900px;
    margin: 0 auto;
    background: #fff;
    border-radius: 8px;
    border: 1px solid #eee;
    box-shadow: var(--swm-shadow-card);
    overflow: hidden;
}
.swm-team-header {
    padding: 25px;
    border-bottom: 1px solid #f0f0f0;
    background: #fcfcfc;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.swm-team-header h3 { margin: 0; font-size: 18px; color: #333; }

.swm-team-member {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 25px;
    border-bottom: 1px solid #f9f9f9;
    transition: background 0.2s;
}
.swm-team-member:hover { background: #fbfbfb; }
.swm-member-info { display: flex; align-items: center; gap: 15px; }
.swm-member-avatar img { border-radius: 50%; width: 42px; height: 42px; border: 2px solid #fff; box-shadow: 0 2px 5px rgba(0,0,0,0.1); }
.swm-member-details h4 { margin: 0; font-size: 15px; font-weight: 600; color: #2c3338; }
.swm-member-details span { font-size: 12px; color: #888; }

.swm-add-member-form {
    padding: 25px;
    background: #fafafa;
    border-top: 1px solid #eee;
    display: flex;
    gap: 12px;
    align-items: center;
}

/* Match Team Buttons to UI */
.swm-team-remove {
    background: #fff;
    color: #d63638; /* Red text */
    border: 1px solid #d63638; /* Red border */
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--swm-transition-fast);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.swm-team-remove:hover {
    background: #d63638;
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(214, 54, 56, 0.2);
}

.swm-team-invite {
    background: var(--swm-primary);
    color: #fff;
    border: none;
    padding: 0 16px;
    height: 36px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: var(--swm-transition-fast);
    box-shadow: var(--swm-shadow-btn-primary);
}
.swm-team-invite:hover {
    background: var(--swm-primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--swm-shadow-btn-primary-hover);
}

#swm-new-member-email {
    height: 36px;
    border: 1px solid #dcdcde;
    border-radius: 4px;
    padding: 0 10px;
    flex-grow: 1;
}

/* --- MODALS --- */
.swm-modal[style*="display: block"], .swm-modal[style*="display:block"] { display: flex !important; }
.swm-modal { 
    display: none; 
    position: fixed; 
    z-index: 100000;
    left: 0; top: 0; right: 0; bottom: 0;
    background-color: rgba(26, 31, 36, 0.75) !important;
    backdrop-filter: blur(4px); 
    -webkit-backdrop-filter: blur(4px);
    align-items: center; justify-content: center; 
}

.swm-modal-content { 
    background-color: #fff; margin: 0; padding: 0; border-radius: 12px; 
    box-shadow: var(--swm-shadow-modal); 
    width: 700px; 
    max-width: 95%; max-height: 90vh; 
    overflow: hidden; 
    position:relative; 
    display:flex; 
    flex-direction:column; 
    height: auto; 
    animation: swmModalPop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.swm-close, .swm-close-modal { position: absolute; right: 20px; top: 20px; font-size: 24px; cursor: pointer; color: #aaa; z-index: 100; transition: color 0.2s; }
.swm-close:hover, .swm-close-modal:hover { color: #333; }

.swm-modal-inner { display: flex; flex-direction: column; height: 100%; overflow: hidden; }
.swm-modal-header { flex: 0 0 auto; padding: 25px 30px 15px; background: #fff; border-bottom: 1px solid #f0f0f0; z-index: 10; }
.swm-task-meta-bar { flex: 0 0 auto; display: flex; gap: 20px; padding: 20px 30px; background: #fcfcfc; border-bottom: 1px solid #eee; flex-wrap: wrap; }
.swm-modal-scroll-area { flex: 1 1 auto; overflow-y: auto; padding: 30px; -webkit-overflow-scrolling: touch; }
.swm-modal-footer { flex: 0 0 auto; padding: 20px 30px; background: #fafafa; border-top: 1px solid #eee; display: flex; justify-content: space-between; align-items: center; }

/* Modal Inputs */
.swm-task-title-input,
#swm-task-title-input,
#swm-edit-task-title,
.swm-modal-header input[type="text"] { 
    font-size: 24px !important; 
    font-weight: 700 !important; 
    width: 100% !important; 
    max-width: 100% !important;
    padding: 10px 15px !important; 
    border: 1px solid #dcdcde !important; 
    background: #fff !important; 
    border-radius: 6px !important; 
    color: #333 !important; 
    transition: all 0.2s; 
    line-height: normal !important;
    height: 54px !important; 
    box-sizing: border-box !important;
    margin: 0 0 10px 0 !important;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.03);
}
.swm-task-title-input:hover, 
.swm-task-title-input:focus,
.swm-modal-header input[type="text"]:focus { 
    border-color: var(--swm-primary) !important; 
    background: #fff !important; 
    outline: none !important; 
    box-shadow: 0 0 0 3px rgba(34,113,177,0.15) !important; 
}

.swm-meta-label { font-size: 11px; font-weight: 700; color: #888; text-transform: uppercase; margin-bottom: 6px; display: block; letter-spacing: 0.5px; }
.swm-meta-control { width: 100%; padding: 8px 10px; border: 1px solid #dcdcde; border-radius: 6px; background: #fff; font-size: 13px; color: #444; }
.swm-section-title { margin-top: 25px; font-weight: 700; color: #2c3338; display: flex; align-items: center; gap: 8px; border-bottom: 1px solid #eee; padding-bottom: 8px; margin-bottom: 15px; font-size: 15px; }
.swm-desc-textarea { width: 100%; padding: 15px; border: 1px solid #eee; background: #fdfdfd; border-radius: 6px; resize: vertical; min-height: 120px; font-size: 14px; line-height: 1.5; transition: border 0.2s; }
.swm-desc-textarea:focus { border-color: var(--swm-primary); background: #fff; outline: none; }

/* Comment Textarea */
.swm-comment-textarea { 
    width: 100% !important; 
    padding: 15px !important; 
    border: 1px solid #eee !important; 
    background: #fdfdfd; 
    border-radius: 6px !important; 
    resize: vertical; 
    font-size: 14px !important; 
    line-height: 1.5 !important; 
    transition: border 0.2s; 
    font-family: inherit;
    box-sizing: border-box !important;
}
.swm-comment-textarea:focus { 
    border-color: var(--swm-primary); 
    background: #fff; 
    outline: none; 
}

/* Subtasks Modal */
.swm-subtask-row { display: flex; align-items: center; padding: 8px 0; border-bottom: 1px solid #f5f5f5; gap: 12px; transition: background 0.1s; }
.swm-subtask-row:hover { background: #fafafa; }
.swm-st-toggle { width: 16px; height: 16px; border-radius: 50%; cursor: pointer; }

.swm-new-subtask-row { display: flex; gap: 10px; margin-top: 15px; align-items: center; }
#swm-new-subtask-title { 
    height: 42px; 
    font-size: 14px; 
    box-sizing: border-box; 
    border: 1px solid #dcdcde; 
    border-radius: 6px; 
    padding: 0 12px; 
    background: #f9f9f9; 
    transition: all 0.2s; 
    flex-grow: 1;
}
#swm-new-subtask-title:focus { background: #fff; border-color: var(--swm-primary); outline: none; }
#swm-add-subtask-btn { 
    height: 42px !important; 
    line-height: 40px !important; 
    padding: 0 20px !important; 
    min-height: 0 !important; 
    box-sizing: border-box; 
    font-size: 14px !important;
}

/* Toast */
.swm-toast { 
    visibility: hidden; min-width: 280px; background-color: #333; color: #fff; text-align: center; border-radius: 50px; padding: 12px 24px; 
    position: fixed; z-index: 100001; left: 50%; bottom: 40px; transform: translateX(-50%); font-size: 14px; box-shadow: 0 5px 15px rgba(0,0,0,0.2); 
    display: flex; align-items: center; justify-content: center; gap: 10px;
}
.swm-toast.show { visibility: visible; animation: swmFadeInUp 0.3s ease-out; }

/* Icon Picker */
.swm-icon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(36px, 1fr)); gap: 8px; margin-top: 10px; max-height: 180px; overflow-y: auto; border: 1px solid #eee; padding: 15px; border-radius: 8px; background: #fafafa; }
.swm-icon-option { width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; border: 1px solid #eee; background: #fff; cursor: pointer; border-radius: 6px; font-size: 20px; color: #666; transition: all 0.2s; }
.swm-icon-option:hover { border-color: var(--swm-primary); color: var(--swm-primary); transform: scale(1.1); }
.swm-icon-option.selected { background: var(--swm-primary); color: #fff; border-color: var(--swm-primary); }

/* --- TRIP & NEW TASK MODAL INPUTS --- */
#swm-new-trip-title, 
#swm-new-trip-daterange,
#swm-trip-template-category,
#swm-new-trip-budget,
#swm-new-task-title,
#swm-new-task-section,
#swm-new-task-assignee,
#swm-new-task-date {
    height: 44px !important;
    font-size: 15px !important;
    padding: 0 12px !important;
    border: 1px solid #dcdcde !important;
    border-radius: 6px !important;
    background-color: #fff !important;
    box-shadow: 0 1px 2px rgba(0,0,0,0.03);
    transition: all 0.2s;
    box-sizing: border-box !important;
}

#swm-new-trip-title:focus, 
#swm-new-trip-daterange:focus,
#swm-trip-template-category:focus,
#swm-new-trip-budget:focus,
#swm-new-task-title:focus,
#swm-new-task-section:focus {
    border-color: var(--swm-primary) !important;
    box-shadow: 0 0 0 3px rgba(34,113,177,0.15) !important;
    outline: none;
}

.swm-new-task-content {
    max-width: 550px !important;
}

/* --- TEAM VIEW: NEW TABBED INTERFACE --- */
.swm-team-header-tabs {
    display: flex;
    gap: 25px;
    border-bottom: 1px solid #eee;
    margin-bottom: 25px;
    padding: 0 25px;
}
.swm-team-nav-tab {
    padding: 15px 5px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    color: #555;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}
.swm-team-nav-tab:hover { color: var(--swm-primary); }
.swm-team-nav-tab.active { color: var(--swm-primary); border-bottom-color: var(--swm-primary); }

.swm-files-grid {
    display: flex;
    gap: 25px;
    padding: 0 25px 25px;
    flex-wrap: wrap;
}
.swm-files-grid > div {
    flex: 1;
    min-width: 300px;
    background: #fafafa;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #eee;
    display: flex;
    flex-direction: column;
    box-shadow: 0 1px 3px rgba(0,0,0,0.02);
    transition: box-shadow 0.2s;
}
.swm-files-grid > div:hover { box-shadow: 0 4px 10px rgba(0,0,0,0.05); }

.swm-files-grid h4 {
    margin: 0 0 15px 0;
    padding-bottom: 10px;
    border-bottom: 1px solid #e0e0e0;
    font-size: 14px;
    color: #333;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.swm-file-card {
    background: #fff;
    padding: 10px;
    border: 1px solid #eee;
    border-radius: 4px;
    margin-bottom: 10px;
    display: flex;
    gap: 12px;
    align-items: center;
    transition: all 0.2s;
}
.swm-file-card:hover {
    box-shadow: 0 3px 8px rgba(0,0,0,0.05);
    transform: translateY(-1px);
    border-color: #ddd;
}

.swm-file-thumb {
    width: 40px; 
    height: 40px; 
    background: #f0f0f0; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    border-radius: 4px; 
    overflow: hidden;
    flex-shrink: 0;
    background-size: cover;
    background-position: center;
    position: relative;
}
.swm-file-thumb.has-thumb .dashicons { display: none; }

#swm-files-filter {
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 2px 5px;
    font-size: 11px;
    background: #fff;
    cursor: pointer;
}
#swm-files-filter:hover { border-color: #bbb; }

/* -----------------------------------------------------------
   MOBILE RESPONSIVENESS (Refactored)
   ----------------------------------------------------------- */

/* Helper classes for JS toggles */
.swm-mobile-only { display: none; } /* Hidden by default (desktop) */
.swm-desktop-only { display: inline; }

/* Match WP Admin Bar Breakpoint (782px) */
@media (max-width: 782px) {
    /* Layout Reset */
    .swm-app-wrap.swm-layout-split { 
        flex-direction: column; 
    }

    /* Helper Overrides */
    .swm-mobile-only { display: inline-flex !important; }
    .swm-desktop-only { display: none !important; }

    /* COLLAPSIBLE SIDEBAR */
    /* Changed to absolute to respect parent wrapper top offset (admin bar) */
    .swm-sidebar { 
        width: 280px; 
        height: 100%; 
        position: absolute; 
        top: 0;
        left: 0;
        /* BLUR FIX: Use transform WITHOUT will-change or 3D accel */
        transform: translateX(-100%); 
        border-right: 1px solid #000; 
        z-index: 100000;
        box-shadow: 2px 0 20px rgba(0,0,0,0.5);
        /* Critical for Crisp Text: No will-change, No backface-visibility on mobile */
        will-change: auto;
        -webkit-font-smoothing: antialiased;
        background-color: var(--swm-bg-sidebar) !important; /* Ensure opacity */
        transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    }
    
    /* Active class toggled via JS to show sidebar */
    .swm-sidebar.open {
        transform: translateX(0);
    }

    /* Mobile Overlay (Backdrop) - added via JS usually, or if exists */
    .swm-mobile-overlay {
        display: none;
        position: fixed;
        top: 0; left: 0; right: 0; bottom: 0;
        background: rgba(0,0,0,0.5);
        z-index: 99999;
        backdrop-filter: blur(2px);
    }
    .swm-mobile-overlay.show { display: block; }

    /* Main Content Adjustments */
    .swm-main-content {
        width: 100%;
        flex: 1;
        overflow-y: auto; /* Ensure whole page scrolls if needed */
        -webkit-overflow-scrolling: touch;
    }

    /* CONTROLS BAR: WRAPPING & SPACING */
    .swm-controls { 
        flex-wrap: wrap; 
        height: auto; 
        padding: 10px 15px; 
        gap: 10px; 
        justify-content: flex-start;
    }
    .swm-control-group {
        flex-wrap: wrap;
        width: 100%;
        gap: 8px;
    }
    /* Make view buttons full width or flexible on mobile */
    .swm-view-btn {
        flex-grow: 1;
        justify-content: center;
        padding: 0 10px;
        font-size: 12px;
    }

    /* --- NEW MOBILE FIXES --- */

    /* 1. Remove Subtask Checkbox (in modal) & Search Bar */
    #swm-task-search { display: none !important; }

    /* Hide the checkbox itself, but keep the row visible */
    .swm-subtask-row .swm-st-toggle,
    .swm-subtask-row input[type="checkbox"] { 
        /* Use opacity/width instead of display:none to maintain layout if needed, 
           or ensure the row text isn't a child of the toggle */
        display: none !important;
    }
    
    /* Ensure subtask row is visible and text aligns correctly without the checkbox */
    .swm-subtask-row {
        padding-left: 0 !important;
        display: flex !important;
        align-items: center !important; 
        color: #333 !important; /* Force color visibility */
        min-height: 30px;
    }
    /* If the text is wrapped in a span, ensure it's visible */
    .swm-subtask-row span, .swm-subtask-row div {
        opacity: 1 !important;
        visibility: visible !important;
    }

    /* 2. Fix Task Name & Card Layout */
    .swm-card-main-row {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 8px !important;
        white-space: normal !important; /* Allow wrapping */
    }
    .swm-card-title {
        white-space: normal !important;
        overflow: visible !important;
        line-height: 1.4 !important;
        margin-bottom: 0 !important;
        width: 100%;
    }
    .swm-card-details {
        width: 100%;
        justify-content: flex-start; /* Align pills to left */
        flex-wrap: wrap; /* Allow pills to wrap */
    }

    /* 3. Calendar Clean-up */
    .fc-header-toolbar {
        display: flex !important;
        flex-wrap: wrap !important;
        flex-direction: row !important; /* Reset from column */
        align-items: center !important;
        justify-content: space-between !important;
        gap: 10px !important;
    }
    
    /* Title: Top, Centered */
    .fc-toolbar-chunk:nth-child(2) {
        width: 100% !important;
        order: 1;
        justify-content: center !important;
        margin-bottom: 5px !important;
    }
    /* Nav Buttons: Bottom Left */
    .fc-toolbar-chunk:nth-child(1) {
        width: auto !important;
        order: 2;
    }
    /* Sync Button: Bottom Right */
    .fc-toolbar-chunk:nth-child(3) {
        width: auto !important;
        order: 3;
    }

    .fc-button {
        padding: 4px 8px !important; /* Smaller buttons */
        font-size: 11px !important;
    }
    .fc-toolbar-title {
        font-size: 1.2em !important;
        text-align: center;
    }
    
    /* Fit Calendar */
    .fc-view-harness {
        overflow-x: hidden !important; /* Hide scroll if possible, let it shrink */
    }
    .fc-scrollgrid {
        min-width: 0 !important; /* Remove fixed width */
        width: 100% !important;
    }
    .fc-col-header-cell-cushion, .fc-daygrid-day-number {
        font-size: 10px !important; /* Smaller text */
        padding: 2px !important;
    }

    /* 4. Team Members Spacing & Table Layout */
    /* Fix for Team Table (List View) */
    .swm-team-table {
        min-width: 800px; /* Force wider total table so it triggers scroll */
        table-layout: auto !important; /* Let cells expand */
        width: auto !important;
    }
    .swm-team-list-wrap {
        overflow-x: auto !important;
        margin-bottom: 20px;
        border: 1px solid #eee;
        border-radius: 6px;
        width: 100%;
    }
    /* INCREASED WIDTH FOR COLUMNS */
    .swm-team-table th, .swm-team-table td {
        min-width: 200px !important; /* SIGNIFICANTLY WIDER */
        white-space: normal;
        padding: 15px !important;
        box-sizing: border-box;
    }
    /* Sticky Name Column */
    .swm-team-table th:first-child,
    .swm-team-table td:first-child {
        position: sticky;
        left: 0;
        background: #fff;
        z-index: 2;
        border-right: 1px solid #eee;
        min-width: 180px; 
    }
    .swm-team-table th:first-child {
        z-index: 3; /* Header sticky on top of sticky column */
    }
    
    /* Card view fallback styles (if used elsewhere) */
    .swm-team-member {
        flex-direction: column !important;
        align-items: stretch !important; /* Ensure children fill width */
        gap: 15px !important;
        padding: 20px !important;
        background: #f9f9f9; /* Card look */
        border-radius: 8px;
        margin-bottom: 15px;
        border: 1px solid #eee;
    }
    .swm-member-info {
        width: 100%;
    }
    /* Ensure inputs in team view are wide enough */
    .swm-team-member input[type="text"],
    .swm-team-member input[type="email"],
    .swm-team-member select {
        width: 100% !important;
        max-width: 100% !important;
    }
    .swm-team-remove {
        align-self: stretch !important; /* Full width button */
        text-align: center;
        margin-top: 5px;
    }

    /* 5. Team Files Fixes */
    .swm-files-grid {
        padding: 10px !important; /* Reduce container padding */
        display: flex !important;
        flex-direction: column !important;
    }
    .swm-files-grid > div {
        min-width: 100% !important;
        width: 100% !important;
        margin: 0 0 15px 0 !important;
        box-sizing: border-box !important; /* Critical */
    }
    .swm-file-card {
        display: flex;
        align-items: center;
        width: 100%;
        box-sizing: border-box; /* Critical */
        overflow: hidden; /* Contain inner floats/widths */
        padding-right: 10px !important; /* Ensure space for delete icon */
    }
    .swm-file-card a {
        flex: 1; /* Take remaining space */
        min-width: 0; /* Allow flex child to shrink below content size */
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        display: block;
        max-width: 60vw !important; /* Responsive truncation */
        margin-right: 10px; /* Space from delete icon if present */
    }

    /* BOARD COLUMNS: FULL WIDTH */
    .swm-board {
        padding-bottom: 80px; /* Space for fab or bottom scroll */
    }
    .swm-column { 
        min-width: 100%; 
        width: 100%; 
        margin-bottom: 25px; 
    }
    .swm-board-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    .swm-board-header h2 { font-size: 20px; }

    /* CARD TOUCH OPTIMIZATIONS */
    .swm-card {
        padding: 15px; /* Larger padding for tap targets */
        min-height: 50px;
    }
    .swm-detail-row {
        height: 24px; /* Taller chips */
        font-size: 12px;
    }
    /* Prevent dragging when trying to scroll text */
    .swm-card {
        touch-action: pan-y; /* Explicitly allow vertical scroll */
    }
    /* Specifically target sortable handles if implemented, 
       otherwise rely on touch-action and long-press (default jquery ui behavior with touch-punch) */

    /* MODAL MOBILE FIXES */
    .swm-modal-content {
        width: 95% !important;
        max-height: 85vh !important;
        margin: 10px auto !important;
        border-radius: 8px;
    }
    .swm-modal-header {
        padding: 15px 20px;
    }
    .swm-task-title-input {
        font-size: 18px !important;
        height: 44px !important;
    }
    .swm-task-meta-bar {
        flex-direction: column;
        gap: 10px;
        padding: 15px 20px;
    }
    .swm-meta-group {
        width: 100%;
    }
    .swm-meta-label { margin-bottom: 4px; }
    
    /* Trip Form Modal Mobile */
    #swm-new-trip-modal .swm-modal-content {
        overflow-y: auto; /* Ensure scrolling if form is long */
    }
    .swm-modal-body {
        padding: 15px !important;
    }
    /* Stack horizontal flex groups */
    #swm-new-trip-modal .swm-modal-body > div[style*="display:flex"] {
        flex-direction: column;
        gap: 15px !important;
    }
    #swm-new-trip-modal .swm-modal-body > div > div[style*="flex:1"],
    #swm-new-trip-modal .swm-modal-body > div > div[style*="flex:2"] {
        width: 100% !important;
    }

    /* Team View Mobile */
    .swm-team-header-tabs {
        padding: 0 15px;
        gap: 15px;
        overflow-x: auto; /* Allow tab scrolling if many */
    }
    /* Overriding previous definition */
    .swm-files-grid > div {
        min-width: 100% !important;
    }
    .swm-add-member-form {
        flex-direction: column;
        align-items: stretch;
    }
}