/* Scoped Style.css for PDM */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
    /* Color Palette - Premium & Simple Professional */
    --primary: #4f46e5;
    /* Indigo 600 */
    --primary-hover: #4338ca;
    --primary-light: #eef2ff;

    --accent: #0ea5e9;
    /* Sky 500 */

    --bg-app: #f8fafc;
    /* Slate 50 */
    --bg-card: #ffffff;
    --bg-sidebar: #ffffff;

    --text-main: #0f172a;
    /* Slate 900 */
    --text-muted: #64748b;
    /* Slate 500 */
    --text-on-primary: #ffffff;

    --border-color: #e2e8f0;
    /* Slate 200 */
    --glass-bg: rgba(255, 255, 255, 0.8);
    --glass-border: rgba(226, 232, 240, 0.8);
    --glass-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.025);

    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;

    /* Spacing & Misc */
    --header-height: 80px;
    --sidebar-width: 280px;
    --transition-speed: 0.3s;
    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;
}

/* Dark Theme Variables - Scoped to container */
#pdm-app-container.dark-theme {
    --bg-app: #0f172a;
    --bg-card: #1e293b;
    --bg-sidebar: #1e293b;

    --text-main: #f1f5f9;
    /* Brighter for better contrast (Slate 100) */
    --text-muted: #cbd5e1;
    /* Clearer for better contrast (Slate 300) */

    --border-color: #334155;
    --glass-bg: rgba(30, 41, 59, 0.8);
    --glass-border: rgba(51, 65, 85, 0.8);
    --glass-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3);

    --primary-light: rgba(79, 70, 229, 0.15);
}

.logo-shadow {
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.3));
}

.text-shadow-premium {
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
}

.stage-item {
    transition: all 0.3s ease;
}

.stage-item.active-stage {
    background: var(--primary-light) !important;
    transform: translateX(4px);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.1);
}


/* Base Styles Scoped */
#pdm-app-container * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

#pdm-app-container {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-app);
    color: var(--text-main);
    overflow: hidden;
    /* height is handled inline in template */
    display: flex;
    transition: background-color var(--transition-speed);
    width: 100%;
}

/* Star Rating Style */
.star-rating {
    display: flex;
    flex-direction: row-reverse;
    justify-content: center;
    gap: 8px;
    margin: 15px 0;
}

.star-rating input {
    display: none;
}

.star-rating label {
    cursor: pointer;
    width: 30px;
    height: 30px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23cbd5e1' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolygon points='12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2'%3E%3C/polygon%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    transition: all 0.2s;
}

.star-rating label:hover,
.star-rating label:hover~label,
.star-rating input:checked~label {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='%23f59e0b' stroke='%23f59e0b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolygon points='12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2'%3E%3C/polygon%3E%3C/svg%3E");
    transform: scale(1.1);
}

.rating-success-container {
    text-align: center;
    padding: 10px;
}

.rating-success-msg {
    color: var(--success);
    font-size: 0.9rem;
    font-weight: 600;
}

/* Base Mobile Responsive Fixes */


/* Scrollbar Styling - Scoped */
/* Scroll Limits for Dashboard/Project Detail */
#coordination-files-list {
    max-height: 210px;
    overflow-y: auto;
    padding-right: 4px;
}

#decisions-list {
    max-height: 210px;
    overflow-y: auto;
    padding-right: 4px;
}

#pdm-app-container ::-webkit-scrollbar {
    width: 6px;
}

#pdm-app-container ::-webkit-scrollbar-track {
    background: transparent;
}

#pdm-app-container ::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 10px;
}

#pdm-app-container ::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Custom Scrollbar Utility */
.custom-scrollbar::-webkit-scrollbar {
    width: 6px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: transparent;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 10px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* Typography Scoped */

#pdm-app-container h1,
#pdm-app-container h2,
#pdm-app-container h3,
#pdm-app-container h4 {
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-main);
}

#pdm-app-container p {
    color: var(--text-muted);
    line-height: 1.6;
}

/* Layout Structure */
#pdm-app-container #app {
    display: flex;
    width: 100%;
    height: 100%;
}

/* Sidebar Styling */
#pdm-app-container .sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 2rem 1.5rem;
    z-index: 50;
    transition: all var(--transition-speed);
}

#pdm-app-container .sidebar.collapsed {
    width: 80px;
    padding: 2rem 0.75rem;
}

#pdm-app-container .logo-area {
    margin-bottom: 4rem;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 0.5rem;
    position: relative;
    transition: all 0.3s;
}

#pdm-app-container .sidebar.collapsed .logo-area {
    justify-content: center;
    padding: 0;
}

#pdm-app-container .sidebar.collapsed .sidebar-logo-text {
    display: none;
}

#pdm-app-container #sidebar-toggle-btn:hover {
    background: var(--primary) !important;
    color: white !important;
    border-color: var(--primary) !important;
    transform: scale(1.1);
}

#pdm-app-container .sidebar.collapsed #sidebar-toggle-btn i,
#pdm-app-container .sidebar.collapsed #sidebar-toggle-btn svg {
    transform: rotate(180deg);
}

#pdm-app-container .logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    color: white;
    font-weight: 700;
    font-size: 1.2rem;
    box-shadow: 0 8px 15px -3px rgba(79, 70, 229, 0.3);
}

#pdm-app-container .logo-text {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: -0.5px;
}

#pdm-app-container .nav-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

#pdm-app-container .nav-item {
    padding: 12px 16px;
    border-radius: var(--radius-md);
    cursor: pointer;
    color: var(--text-muted);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 500;
}

#pdm-app-container .nav-item i {
    width: 20px;
    height: 20px;
}

#pdm-app-container .nav-item:hover {
    background: var(--primary-light);
    color: var(--primary);
}

#pdm-app-container .nav-item.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 12px -2px rgba(79, 70, 229, 0.2);
}

#pdm-app-container .nav-item.active i {
    color: white;
}

/* Collapsed Nav Item */
#pdm-app-container .sidebar.collapsed .nav-item {
    justify-content: center;
    padding: 12px 0;
    width: 48px;
    height: 48px;
    margin: 0 auto;
}

#pdm-app-container .sidebar.collapsed .nav-item span {
    display: none;
}

#pdm-app-container .sidebar.collapsed .nav-item i {
    margin: 0;
}

/* Main Content Area */
#pdm-app-container .main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    background: var(--bg-app);
}

/* Top Bar Styling */
#pdm-app-container .top-bar {
    height: var(--header-height);
    padding: 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
}

#pdm-app-container .breadcrumbs-area {
    display: flex;
    align-items: center;
}

#pdm-app-container .breadcrumbs {
    color: var(--text-muted);
    font-size: 0.95rem;
    font-weight: 500;
}

#pdm-app-container .breadcrumbs span {
    color: var(--text-main);
    font-weight: 600;
}

#pdm-app-container .user-profile {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 6px 12px;
    border-radius: var(--radius-lg);
    transition: background 0.2s;
    cursor: pointer;
}

#pdm-app-container .user-profile:hover {
    background: var(--primary-light);
}

#pdm-app-container .avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ddd, #bbb);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Avatar Picker Styles */
#pdm-app-container .avatar-picker-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
    margin-top: 1.5rem;
}

#pdm-app-container .avatar-option {
    cursor: pointer;
    border-radius: 50%;
    border: 2px solid transparent;
    padding: 2px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    aspect-ratio: 1/1;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.02);
}

#pdm-app-container .avatar-option:hover {
    transform: scale(1.08);
    border-color: var(--primary);
    background: var(--primary-light);
}

#pdm-app-container .avatar-option.selected {
    border-color: var(--primary) !important;
    background: var(--primary-light);
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.15);
}

#pdm-app-container .avatar-option.empty-custom {
    border: 2px dashed var(--primary);
    color: var(--primary);
    background: rgba(79, 70, 229, 0.03);
}

#pdm-app-container .avatar-option img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

#pdm-app-container .overlay-change {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    color: white;

}

#pdm-app-container .avatar-option:hover .overlay-change {
    opacity: 1;
}

#pdm-app-container .avatar-option .overlay-change i {
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

#pdm-app-container .avatar-initials {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    box-shadow: 0 4px 10px rgba(79, 70, 229, 0.2);
}

#pdm-app-container .view-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    width: 100%;
}

#pdm-app-container .view-section {
    padding: 3rem;
    flex: 1;
    overflow-y: auto;
    width: 100%;
    scroll-behavior: smooth;
}

#pdm-app-container .section-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 4rem;
}

#pdm-app-container .section-header h2 {
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
}

/* Cards & Containers */
#pdm-app-container .glass {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--glass-shadow);
    transition: transform 0.2s, box-shadow 0.2s;
}

/* Stats Cards */
#pdm-app-container .stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 4rem;
}

/* Dashboard New Layout */
.dashboard-main-row {
    display: grid;
    grid-template-columns: 1.8fr 1.2fr;
    gap: 2rem;
    margin-bottom: 4rem;
}

.settings-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    align-items: start;
}

/* SysAdmin Vertical Tabs */
.sa-layout {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 2rem;
    align-items: start;
}

.sa-sidebar {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem 1rem;
    position: sticky;
    top: 2rem;
    box-shadow: var(--glass-shadow);
}

.sa-sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 10px !important;
}

.sa-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px !important;
    border-radius: var(--radius-md);
    cursor: pointer;
    color: var(--text-muted);
    font-weight: 600;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid transparent;
    font-size: 0.9rem;
    white-space: nowrap;
    margin-bottom: 2px;
}

.sa-nav-item i {
    width: 18px;
    height: 18px;
    opacity: 0.7;
    flex-shrink: 0;
}

.sa-nav-item:hover {
    background: var(--primary-light);
    color: var(--primary);
}

.sa-nav-item.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 12px -2px rgba(79, 70, 229, 0.2);
}

.sa-nav-item.active i {
    opacity: 1;
}

.sa-mobile-selector {
    display: none;
    width: 100%;
    margin-bottom: 2rem;
}

.sa-mobile-selector select {
    width: 100%;
    padding: 1.25rem;
    border-radius: 16px;
    border: 1px solid var(--primary);
    background: var(--bg-card);
    color: var(--primary);
    font-weight: 700;
    font-size: 1rem;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%234f46e5' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1.25rem center;
    background-size: 1.25rem;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.1);
}

.stats-grid-mini {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    align-items: stretch;
}

.stat-card.mini {
    padding: 1rem !important;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    min-height: 120px;
    border-radius: 32px;
    position: relative;
    overflow: hidden;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 20px -5px rgba(0, 0, 0, 0.05);
}

#pdm-app-container.dark-theme .stat-card.mini {
    background: #1e293b;
    border-color: #334155;
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.4);
}

.stat-card.mini .stat-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-card.mini .stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    margin: 8px 0;
}

.calendar-glass {
    padding: 0.75rem !important;
    border-radius: 20px;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.25rem !important;
}

.calendar-nav {
    display: flex;
    gap: 8px;
}

.calendar-header h3 {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: -0.01em;
}

.calendar-nav button {
    background: transparent;
    border: 1px solid var(--border-color);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    color: var(--text-muted);
}

.calendar-nav button:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(var(--primary-rgb), 0.2);
}

.btn-today-mini {
    margin-right: 5px;
    background: var(--primary-light) !important;
    color: var(--primary) !important;
    border: none !important;
}

.btn-today-mini:hover {
    background: var(--primary) !important;
    color: white !important;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background: var(--border-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    margin-top: 0.75rem !important;
}

.calendar-day-name {
    background: transparent;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 800;
    padding: 12px 0;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    opacity: 0.7;
}

.calendar-day {
    min-height: 85px;
    background: var(--bg-card);
    display: flex;
    flex-direction: column;
    padding: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
}

.calendar-day.today {
    background: rgba(var(--primary-rgb), 0.02);
}

.calendar-day.today .day-number {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 10px rgba(var(--primary-rgb), 0.3);
}

.calendar-day.holiday {
    background: rgba(239, 68, 68, 0.12) !important;
    /* Light red background for holidays */
}

.calendar-day.holiday .day-number {
    color: #ef4444;
    font-weight: 800;
}

.calendar-day:not(.empty):hover {
    background: var(--bg-app);
    z-index: 5;
}

.calendar-day .day-number {
    font-weight: 600;
    margin-bottom: 2px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    color: var(--text-main);
}

/* Event Strips */
.calendar-events-container {
    display: flex;
    flex-direction: column;
    gap: 3px;
    position: absolute;
    bottom: 4px;
    left: 4px;
    right: 4px;
}

.event-strip {
    font-size: 0.75rem;
    padding: 2px 6px !important;
    border-radius: 2px !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: white;
    font-weight: 500;
    line-height: 1.3;
    opacity: 0.9;
    transition: opacity 0.2s;
}

.event-strip:hover {
    opacity: 1;
}

.event-strip.project_start {
    background: #10b981;
}

.event-strip.project_end {
    background: #ef4444;
}

.event-strip.stage_delivery {
    background: #0ea5e9;
}

.event-strip.kanban_task {
    background: #ec4899;
}

.event-strip.custom_note {
    background: #8b5cf6;
}

.event-strip.custom_note.public {
    background: #f59e0b;
}

.event-strip.holiday {
    background: #94b2c1;
    /* Slate gray-blue */
    opacity: 1;
}

.event-strip.more-count {
    background: var(--bg-app);
    color: var(--text-muted);
    border: 1px dashed var(--border-color);
    text-align: center;
    font-size: 0.7rem;
    font-weight: 700;
}

#pdm-app-container.dark-theme .event-strip.more-count {
    background: #334155;
    color: #cbd5e1;
    border-style: solid;
}

.calendar-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 1rem;
    font-size: 0.8rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-muted);
}

.legend-color {
    width: 10px;
    height: 10px;
    border-radius: 3px;
}

/* Modal for Day Details */
.calendar-day-modal {
    max-width: 520px;
    background: var(--bg-card) !important;
    border: 1px solid var(--border-color) !important;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4) !important;
}

#pdm-app-container.dark-theme .calendar-day-modal {
    background: #1e293b !important;
    border: 1px solid #334155 !important;
}

#pdm-app-container.dark-theme .calendar-day-modal .input-field {
    background: #0f172a !important;
    border-color: #334155 !important;
    color: #f1f5f9 !important;
}

#pdm-app-container.dark-theme .calendar-day-modal .event-list-item {
    background: rgba(255, 255, 255, 0.05);
}

#calendar-day-modal .modal-content {
    background: var(--bg-card) !important;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5) !important;
}

.event-list-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 14px;
    border-radius: 16px;
    background: rgba(0, 0, 0, 0.02);
    margin-bottom: 12px;
    border: 1px solid transparent;
    transition: all 0.2s ease;
}

.event-list-item:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--border-color);
}

.event-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

@media (max-width: 1200px) {
    .dashboard-main-row {
        grid-template-columns: 1fr;
    }
}

#pdm-app-container .stat-card {
    padding: 1.8rem;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

#pdm-app-container .stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

#pdm-app-container .stat-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

#pdm-app-container .stat-value {
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--text-main);
    display: flex;
    align-items: baseline;
    gap: 8px;
}

/* Buttons */
#pdm-app-container .btn {
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-weight: 600;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 0.95rem;
}

#pdm-app-container .btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 14px 0 rgba(79, 70, 229, 0.3);
}

#pdm-app-container .btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(79, 70, 229, 0.4);
}

#pdm-app-container .btn-secondary {
    background: var(--bg-card);
    color: var(--text-main);
    border: 1px solid var(--border-color);
}

#pdm-app-container .btn-secondary:hover {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary);
}

/* Icon Buttons */
#pdm-app-container .btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-main);
    padding: 8px;
    border-radius: 8px;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

#pdm-app-container .btn-icon:hover {
    background: var(--primary-light);
    color: var(--primary);
}

#pdm-app-container .btn-icon i,
#pdm-app-container .btn-icon svg {
    width: 16px;
    height: 16px;
    color: inherit;
    stroke: currentColor;
}

#pdm-app-container .btn-icon-danger {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--danger);
    padding: 8px;
    border-radius: 8px;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

#pdm-app-container .btn-icon-danger:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

#pdm-app-container .btn-icon-danger i,
#pdm-app-container .btn-icon-danger svg {
    width: 16px;
    height: 16px;
    color: inherit;
    stroke: currentColor;
}


/* Tables */
#pdm-app-container .projects-table-container {
    overflow-x: auto;
}

#pdm-app-container .projects-table {
    width: 100%;
    border-collapse: collapse;
}

#pdm-app-container .projects-table th {
    background: var(--bg-app);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 1.2rem 1.5rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

#pdm-app-container .projects-table td {
    padding: 1.2rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.95rem;
}

#pdm-app-container .projects-table tr:last-child td {
    border-bottom: none;
}

#pdm-app-container .projects-table tr:hover td {
    background: var(--primary-light);
}

/* File Cards */
#pdm-app-container .file-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem;
    transition: all 0.2s;
}

#pdm-app-container .file-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--glass-shadow);
    border-color: var(--primary);
}

#pdm-app-container .file-name {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-main);
    margin-bottom: 0.5rem;
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
    word-break: break-all;
}

#pdm-app-container .file-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
}


/* Badges & Status */
#pdm-app-container .status-badge {
    padding: 6px 14px;
    border-radius: 9999px;
    font-size: 0.8rem;
    font-weight: 700;
    display: inline-flex;
}

#pdm-app-container .status-active {
    background: #d1fae5;
    color: #065f46;
}

#pdm-app-container .status-pending {
    background: #fef3c7;
    color: #92400e;
}

#pdm-app-container .status-completed {
    background: #dbeafe;
    color: #1e40af;
}

/* Progress Bars */
#pdm-app-container .progress-container {
    width: 100%;
    height: 8px;
    background: var(--border-color);
    border-radius: 9999px;
    overflow: hidden;
}

/* Dark theme progress container - more visible background */
#pdm-app-container.dark-theme .progress-container {
    background: #475569;
    /* Slate 600 - clearly visible in dark mode */
}

#pdm-app-container .progress-bar {
    height: 100%;
    background: linear-gradient(to right, var(--primary), var(--accent));
    border-radius: 9999px;
    transition: width 0.6s ease;
}

/* Form Controls */
#pdm-app-container .input-group {
    margin-bottom: 1.25rem;
}

#pdm-app-container .input-label {
    display: block;
    margin-bottom: 0.6rem;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-main);
}

#pdm-app-container .input-field {
    width: 100%;
    padding: 0.8rem 1rem;
    background: var(--bg-card);
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-main);
    font-family: inherit;
    font-size: 1rem;
    transition: all 0.2s;
}

#pdm-app-container .input-field:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
}

/* Range Input (Slider) Styling */
#pdm-app-container input[type="range"].input-field {
    padding: 0;
    height: 36px;
    border: none;
    background: transparent;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
}

#pdm-app-container input[type="range"].input-field::-webkit-slider-runnable-track {
    width: 100%;
    height: 8px;
    background: var(--border-color);
    border-radius: 9999px;
}

#pdm-app-container input[type="range"].input-field::-webkit-slider-thumb {
    appearance: none;
    -webkit-appearance: none;
    height: 20px;
    width: 20px;
    border-radius: 50%;
    background: var(--primary);
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    margin-top: -6px;
    /* Centers thumb on track */
    cursor: grab;
}

#pdm-app-container input[type="range"].input-field:active::-webkit-slider-thumb {
    cursor: grabbing;
    transform: scale(1.1);
}

/* Authentication Views Styling (Login, Forgot, Reset) */
#pdm-app-container #view-login,
#pdm-app-container #view-forgot-password,
#pdm-app-container #view-reset-password {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - var(--header-height));
    background: radial-gradient(circle at top right, rgba(79, 70, 229, 0.05), transparent),
        radial-gradient(circle at bottom left, rgba(14, 165, 233, 0.05), transparent);
}

#pdm-app-container .login-card {
    padding: 3.5rem 3rem;
    width: 100%;
    max-width: 480px;
    text-align: center;
}

#pdm-app-container .login-card h2 {
    font-size: 2rem;
    margin-bottom: 0.8rem;
}

#pdm-app-container .login-card p {
    margin-bottom: 2rem;
}

/* Login Type Toggle */
#pdm-app-container .login-type-toggle {
    display: flex;
    background: rgba(0, 0, 0, 0.05);
    padding: 6px;
    border-radius: 12px;
    margin-bottom: 2rem;
    border: 1px solid var(--border-color);
}

#pdm-app-container.dark-theme .login-type-toggle {
    background: rgba(255, 255, 255, 0.05);
}

#pdm-app-container .login-type-btn {
    flex: 1;
    padding: 10px;
    border: none;
    background: none;
    cursor: pointer;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    transition: 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

#pdm-app-container .login-type-btn i {
    width: 16px;
    height: 16px;
}

#pdm-app-container .login-type-btn.active {
    background: white;
    color: var(--primary);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

#pdm-app-container.dark-theme .login-type-btn.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#pdm-app-container .view-section {
    animation: fadeIn 0.4s ease-out forwards;
}

/* Helper Classes */
#pdm-app-container .hidden {
    display: none !important;
}

#pdm-app-container .flex {
    display: flex;
}

#pdm-app-container .flex-col {
    flex-direction: column;
}

#pdm-app-container .items-center {
    align-items: center;
}

#pdm-app-container .justify-between {
    justify-content: space-between;
}

#pdm-app-container .gap-4 {
    gap: 1rem;
}

#pdm-app-container .w-full {
    width: 100%;
}

#pdm-app-container .grid {
    display: grid;
}

#pdm-app-container .grid-cols-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

#pdm-app-container .project-details-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    align-items: start;
    margin-bottom: 2rem;
}

/* Modal Customization */
#pdm-app-container .modal {
    background: rgba(15, 23, 42, 0.6) !important;

}

#pdm-app-container .modal-overlay {
    padding: 2rem;
}

#pdm-app-container .modal-content {
    background: var(--bg-card) !important;
    border-radius: var(--radius-lg) !important;
    padding: 2.5rem !important;
    border: 1px solid var(--border-color) !important;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25) !important;
    max-height: 90vh;
    overflow-y: auto;
}

/* Responsive & Scaling */


#pdm-app-container .detail-bars-container {
    display: inline-flex;
    flex-direction: column;
    vertical-align: middle;
    margin-left: 2rem;
    gap: 12px;
    max-width: 100%;
}

#pdm-app-container .detail-progress-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

#pdm-app-container .detail-progress-row .progress-container {
    width: 600px;
    max-width: 100%;
    margin: 0;
    height: 10px !important;
}

@media (max-width: 480px) {
    #pdm-app-container .top-bar .breadcrumbs {
        display: none;
    }

    #pdm-app-container .login-card {
        padding: 2.5rem 1.25rem !important;
    }

    #pdm-app-container .user-profile #profile-display-name {
        display: none !important;
    }

    #pdm-app-container .view-section {
        padding: 1rem !important;
    }
}

.logout-btn-header:hover {
    background: rgba(239, 68, 68, 0.2) !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.1);
}

.refresh-btn-floating {
    position: absolute;
    top: 100px;
    right: 3rem;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    z-index: 40;
}

#pdm-app-container.dark-theme .refresh-btn-floating {
    background: #1e293b;
    border-color: #334155;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
}

.refresh-btn-floating:hover {
    color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.08);
}

.refresh-btn-floating.rotating {
    color: var(--primary);
    border-color: var(--primary);
}

@keyframes spin-cw {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.rotating i {
    animation: spin-cw 1s linear infinite;
}

/* Project Detail Info Sections - Simplified */
.info-group-box-simple {
    padding: 2px 0;
}

.info-box-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
    letter-spacing: 0.05em;
    opacity: 0.7;
}

.info-box-label i {
    width: 12px;
    height: 12px;
}

.parcel-rows-simple {
    display: flex;
    flex-direction: column;
}

.parcel-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
}

.parcel-item {
    display: flex;
    flex-direction: column;
}

.parcel-item small {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.parcel-item span {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-main);
}

/* Chat Styles */
#project-messages-list::-webkit-scrollbar {
    width: 5px;
}

#project-messages-list::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 10px;
}

.chat-bubble {
    max-width: 85%;
    margin-bottom: 12px;
    position: relative;
    display: flex;
    gap: 10px;
}

.chat-message {
    padding: 12px 14px !important;
    border-radius: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    font-size: 0.95rem;
    line-height: 1.5;
    color: var(--text-main);
    position: relative;
    word-break: break-word;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.chat-message>div:not(.chat-sender-name):not(.chat-time) {
    margin-bottom: 3px;
}

.chat-container {
    background: #fefefe;
}

#project-messages-list {
    background: #f1f3f6;
}

.chat-input-area {
    background: white;
}

#chat-emoji-btn {
    background: #f0f2f5;
    color: #555;
}

.message-sent {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message-sent .chat-message {
    background: var(--chat-sent-bg, #dcf8c6);
    color: var(--chat-sent-text, inherit);
    border-top-right-radius: 2px;
}

.message-received {
    align-self: flex-start;
}

.message-received .chat-message {
    background: var(--chat-received-bg, #ffffff);
    color: var(--chat-received-text, inherit);
    border-top-left-radius: 2px;
}

.chat-sender-name {
    font-size: 0.9rem;
    font-weight: 700;
    margin-bottom: 4px;
    /* Gap handled by parent flex gap now */
    color: var(--primary);
    display: block;
    letter-spacing: 0.01em;
}

.chat-time {
    font-size: 0.75rem;
    color: #94a3b8;
    text-align: right;
    margin-top: 10px;
    font-weight: 500;
}

.chat-image-attachment {
    max-width: 100%;
    max-height: 250px;
    border-radius: 8px;
    margin-top: 5px;
    cursor: pointer;
    display: block;
    object-fit: contain;
}

.chat-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #ccc;
    flex-shrink: 0;
}

.message-sent .chat-avatar {
    margin-left: 8px;
}

.message-received .chat-avatar {
    margin-right: 8px;
}

#chat-emoji-picker {
    background: white;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    max-height: 200px;
    overflow-y: auto;
}

#chat-emoji-picker::-webkit-scrollbar {
    width: 4px;
}

#chat-emoji-picker::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 10px;
}

.chat-input-area .btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: 8px;
    border-radius: 50%;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-input-area .btn-icon:hover {
    background: var(--primary-light);
    color: var(--primary);
}

/* Dark Theme Overrides for Chat - High Contrast Midnight Style */
#pdm-app-container.dark-theme .chat-container {
    background: #0f172a;
}

#pdm-app-container.dark-theme #project-messages-list {
    background: #0f172a;
}

#pdm-app-container.dark-theme .chat-input-area {
    background: #1e293b;
    border-top: 1px solid #334155;
}

#pdm-app-container.dark-theme .message-sent .chat-message {
    background: var(--primary);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

#pdm-app-container.dark-theme .message-received .chat-message {
    background: #1e293b;
    border: 1px solid #334155;
    color: #f1f5f9;
}

#pdm-app-container.dark-theme .chat-time {
    color: #64748b;
}

#pdm-app-container.dark-theme .message-sent .chat-sender-name {
    color: #e0e7ff !important;
}

#pdm-app-container.dark-theme .message-received .chat-sender-name {
    color: #38bdf8 !important;
}

#pdm-app-container.dark-theme #chat-emoji-picker {
    background: #1e293b;
    border: 1px solid #334155;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

#pdm-app-container.dark-theme #chat-emoji-btn {
    background: #334155;
    color: #f1f5f9;
}

#pdm-app-container.dark-theme #chat-emoji-btn:hover {
    background: #475569;
}

.message-sent .chat-sender-name {
    color: #065f46;
}

.emoji-item {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.6rem;
    padding: 5px;
    border-radius: 8px;
    transition: all 0.2s;
    line-height: 1;
    display: inline-block;
}

.emoji-item:hover {
    background: rgba(0, 0, 0, 0.05);
    transform: scale(1.2);
}

#pdm-app-container.dark-theme .emoji-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Notifications */
#notifications-dropdown {
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

#notifications-dropdown::-webkit-scrollbar {
    width: 6px;
}

#notifications-dropdown::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 10px;
}

#pdm-app-container.dark-theme #notifications-dropdown::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
}

.notif-item {
    background: transparent;
    border: 1px solid transparent;
}

.notif-item:hover {
    background: var(--primary-light) !important;
    border-color: var(--primary) !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

#pdm-app-container.dark-theme .notif-item:hover {
    background: rgba(255, 255, 255, 0.05) !important;
}

#notification-dot {
    animation: pulse-red 2s infinite;
}

@keyframes pulse-red {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
    }

    70% {
        transform: scale(1.1);
        box-shadow: 0 0 0 10px rgba(239, 68, 68, 0);
    }

    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    }
}

/* Highlight & Animations */
@keyframes highlight-pulse-animation {
    0% {
        box-shadow: 0 0 0 0px rgba(79, 70, 229, 0.4);
        border-color: var(--primary);
    }

    50% {
        box-shadow: 0 0 0 10px rgba(79, 70, 229, 0);
        border-color: var(--primary);
    }

    100% {
        border-color: var(--border-color);
    }
}

.highlight-pulse {
    animation: highlight-pulse-animation 2s ease-out;
}

/* Glass Inputs */
.glass-input {
    width: 100%;
    padding: 0.8rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.95rem;
    transition: all 0.2s;
}

.glass-input:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
}

#pdm-app-container.dark-theme .glass-input {
    background: rgba(0, 0, 0, 0.2);
}

/* Compact Project Detail View (Approx 75% Scale) */
#view-project-detail .section-header h2 {
    font-size: 1.4rem !important;
}

#view-project-detail .section-header .breadcrumbs {
    font-size: 0.75rem !important;
}

#view-project-detail .info-box-label {
    font-size: 0.65rem !important;
    margin-bottom: 0.15rem !important;
}

#view-project-detail .parcel-item span {
    font-size: 0.85rem !important;
}

#view-project-detail .parcel-item small {
    font-size: 0.55rem !important;
}

#view-project-detail .chat-message {
    font-size: 0.95rem !important;
    padding: 10px 14px !important;
}

#view-project-detail .chat-input-area {
    padding: 0.6rem !important;
    /* was 1rem */
}

#view-project-detail #chat-message-input {
    font-size: 0.85rem !important;
    padding: 0.6rem 0.8rem !important;
    padding-right: 60px !important;
}

#view-project-detail .project-details-split {
    gap: 1.25rem !important;
    /* was 2rem */
}

#view-project-detail h3 {
    font-size: 1.1rem !important;
}

#view-project-detail .btn {
    padding: 0.5rem 1rem !important;
    font-size: 0.8rem !important;
}

#view-project-detail .btn i {
    width: 14px !important;
    height: 14px !important;
}

#view-project-detail .projects-table th,
#view-project-detail .projects-table td {
    padding: 0.8rem 1rem !important;
    /* Reduce table padding */
    font-size: 0.85rem !important;
}


/* Login Screen Scale Down (Approx 50% Reduction) */
#pdm-app-container .login-card {
    padding: 2rem 1.5rem !important;
    max-width: 340px !important;
}

#pdm-app-container .login-card h2 {
    font-size: 1.5rem !important;
    margin-bottom: 0.5rem !important;
}

#pdm-app-container .login-card p {
    font-size: 0.85rem !important;
    margin-bottom: 1.5rem !important;
}

#pdm-app-container .login-type-toggle {
    padding: 4px !important;
    margin-bottom: 1.5rem !important;
}

#pdm-app-container .login-type-btn {
    padding: 6px 10px !important;
    font-size: 0.8rem !important;
}

#pdm-app-container .login-card .input-group {
    margin-bottom: 1rem !important;
}

#pdm-app-container .login-card .input-label {
    font-size: 0.8rem !important;
    margin-bottom: 0.3rem !important;
}

#pdm-app-container .login-card .input-field {
    padding: 0.6rem 0.8rem !important;
    font-size: 0.9rem !important;
}

#pdm-app-container .login-card .btn {
    padding: 0.7rem !important;
    font-size: 0.9rem !important;
}

/* User Detail Modal Stats */
.stats-card {
    background: rgba(255, 255, 255, 0.05);

    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 1rem;
    text-align: center;
    border-radius: 12px;
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.stats-card:hover {
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

/* Stage Accordion Styling - Enhanced Premium Look */
.stage-accordion-item {
    margin-bottom: 0.75rem;
    border-radius: var(--radius-md);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
}

.stage-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    cursor: pointer;
    background: transparent;
    transition: all 0.3s ease;
    position: relative;
    user-select: none;
    z-index: 2;
}

.stage-item.expanded {
    box-shadow: 0 12px 24px -8px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
    border-color: var(--primary);
    background: var(--bg-card);
}

#pdm-app-container.dark-theme .stage-item.expanded {
    background: rgba(30, 41, 59, 0.7);
    border-color: var(--primary);
    box-shadow: 0 12px 30px -10px rgba(0, 0, 0, 0.4);
}

.stage-header-row:hover {
    background: var(--primary-light);
}

.stage-item.expanded .stage-header-row {
    background: var(--primary-light);
    border-bottom: 1px solid var(--border-color);
}

#pdm-app-container.dark-theme .stage-item.expanded .stage-header-row {
    background: rgba(79, 70, 229, 0.1);
}

/* Parent/Top-level Stage Specific */
.parent-stage-header {
    font-size: 1rem !important;
    font-weight: 700 !important;
    color: var(--text-main);
    letter-spacing: -0.01em;
}

.sub-stages-container {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
    margin-top: 0.25rem;
}

.stage-files-container {
    padding: 0.75rem 1rem;
    background: rgba(0, 0, 0, 0.02);
    border-radius: var(--radius-md);
    margin: 0.5rem 0;
    border: 1px solid var(--border-color);
}

#pdm-app-container.dark-theme .stage-files-container {
    background: rgba(255, 255, 255, 0.02);
}

/* Animations */
.stage-content {
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    display: block !important;
    max-height: 0;
    opacity: 0;
    overflow: hidden;
}

.stage-item.expanded>.stage-content {
    max-height: 5000px;
    opacity: 1;
}

.stage-content-padding {
    padding: 0.5rem 1rem !important;
}

.stage-chevron {
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.expanded>.stage-header-row .stage-chevron {
    transform: rotate(180deg);
}

/* Full Width Progress Bar in Header */
.stage-header-progress-wrap {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: rgba(0, 0, 0, 0.05);
    overflow: hidden;
    z-index: 1;
}

#pdm-app-container.dark-theme .stage-header-progress-wrap {
    background: rgba(255, 255, 255, 0.1);
}

.stage-header-progress-bar {
    height: 100%;
    transition: width 1s cubic-bezier(0.16, 1, 0.3, 1);
}

.stage-add-sub-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    font-size: 0.75rem;
    color: var(--primary);
    background: rgba(79, 70, 229, 0.1);
    border: 1px dashed var(--primary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    margin: 10px 0;
    transition: all 0.2s;
}

.stage-add-sub-btn:hover {
    background: var(--primary);
    color: white;
    border-style: solid;
}

.stage-header-bg-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    opacity: 0.07;
    z-index: 1;
    transition: width 1s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: none;
}

#pdm-app-container.dark-theme .stage-header-bg-fill {
    opacity: 0.08;
}

.btn-upload-tiny {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px !important;
    font-size: 0.75rem !important;
    font-weight: 600 !important;
    color: #0ea5e9 !important;
    /* Sky Blue */
    background: rgba(14, 165, 233, 0.1) !important;
    border: 1px dashed #0ea5e9 !important;
    border-radius: var(--radius-sm) !important;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-upload-tiny:hover {
    background: #0ea5e9 !important;
    color: white !important;
    border-style: solid !important;
    transform: translateY(-1px);
}

.btn-upload-tiny i,
.btn-upload-tiny svg {
    width: 12px;
    height: 12px;
}

.btn-upload-minimal {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 16px !important;
    font-size: 0.8rem !important;
    font-weight: 600 !important;
    color: var(--primary) !important;
    background: rgba(79, 70, 229, 0.05) !important;
    border: 1px dashed var(--primary) !important;
    border-radius: 999px !important;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-upload-minimal:hover {
    background: var(--primary) !important;
    color: white !important;
    border-style: solid !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.2);
}

.btn-upload-minimal i,
.btn-upload-minimal svg {
    width: 14px;
    height: 14px;
}



.stage-chevron {
    transition: transform 0.3s;
}

.expanded .stage-chevron {
    transform: rotate(180deg);
}

/* File Action Dropdown Styles */
.dropdown-container {
    position: relative;
    display: inline-block;
}

.action-dropdown {
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 8px;
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    min-width: 200px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.4);
    z-index: 100;
    overflow: hidden;

    animation: dropdownFadeIn 0.2s ease-out;
}

#pdm-app-container.dark-theme .action-dropdown {
    background: rgba(30, 41, 59, 0.95);
}

.action-dropdown button {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 12px 16px;
    border: none;
    background: transparent;
    color: var(--text-main);
    font-size: 0.85rem;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s;
}

.action-dropdown button:hover {
    background: rgba(var(--primary-rgb), 0.1);
    color: var(--primary);
}

.action-dropdown button i {
    opacity: 0.7;
}

@keyframes dropdownFadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Locked File Row Glow */
tr[style*='position:relative'] i[data-feather='lock'] {
    filter: drop-shadow(0 0 5px var(--accent));
}

/* Fix for dropdown clipping */
.stage-item.expanded>.stage-content {
    overflow: visible !important;
}

.stage-files-container {
    overflow: visible !important;
}

.projects-table-container {
    overflow: visible !important;
}

/* Enhanced Fix for dropdown clipping - Specificity increase */
#pdm-app-container .stage-item.expanded>.stage-content {
    overflow: visible !important;
}

#pdm-app-container .stage-files-container {
    overflow: visible !important;
}

#pdm-app-container .projects-table-container {
    overflow: visible !important;
}

#pdm-app-container .action-dropdown {
    z-index: 9999 !important;
}

#pdm-app-container .projects-table td {
    overflow: visible !important;
    position: relative;
}

#pdm-app-container .projects-table tr {
    overflow: visible !important;
}

/* Revision Request Indicator Animation */
@keyframes pulse {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.4;
        transform: scale(0.8);
    }
}

.revision-request-indicator {
    display: inline-block;
    box-shadow: 0 0 8px rgba(245, 158, 11, 0.6);
}

@media (max-width: 768px) {
    .stats-grid-mini {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

@media (max-width: 480px) {
    .stats-grid-mini {
        grid-template-columns: 1fr !important;
    }
}

/* Projects Table Container */
.projects-table-container {
    overflow-x: auto;
    width: 100%;
}

.projects-table-container table {
    width: 100%;
    border-collapse: collapse;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 99999;
}

.toast {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 16px 24px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    margin-top: 10px;
    display: flex;
    align-items: center;
    gap: 12px;
    animation: toastIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    color: var(--text-main);
    font-weight: 500;
}

.toast.success {
    border-left: 4px solid #10b981;
}

.toast.error {
    border-left: 4px solid #ef4444;
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(50px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Loader Ring */
.loader-ring {
    display: inline-block;
    width: 50px;
    height: 50px;
    border: 3px solid rgba(79, 70, 229, 0.1);
    border-radius: 50%;
    border-top-color: #4f46e5;
    animation: spin-loader 1s ease-in-out infinite;
}

@keyframes spin-loader {
    to {
        transform: rotate(360deg);
    }
}

/* To-do List Styles */
.todo-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}

.todo-header-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
    padding-bottom: 0.8rem;
    border-bottom: 1px solid var(--border-color);
}

.todo-tabs {
    display: flex;
    gap: 0.5rem;
}

.todo-tab {
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-muted);
    padding: 6px 12px;
    border-radius: 8px;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.todo-tab.active {
    color: var(--primary);
    background: var(--primary-light);
}

.todo-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 4px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    margin-bottom: 10px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

#pdm-app-container.dark-theme .todo-item {
    background: rgba(255, 255, 255, 0.03);
}

.todo-item:hover {
    border-color: var(--primary);
    transform: translateX(5px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.todo-item.done {
    opacity: 0.6;
}

.todo-item.done .todo-text {
    text-decoration: line-through;
    color: var(--text-muted);
}

.todo-checkbox {
    width: 15px;
    height: 15px;
    cursor: pointer;
    accent-color: var(--primary);
    border-radius: 6px;
}

.todo-content {
    flex: 1;
    min-width: 0;
}

.todo-text {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-main);
    display: block;
    margin-bottom: 2px;
}

.todo-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 10px;
}

.todo-delete {
    color: var(--danger);
    cursor: pointer;
    opacity: 0;
    transition: all 0.2s;
    padding: 6px;
    border-radius: 6px;
}

.todo-delete:hover {
    background: rgba(231, 76, 60, 0.1);
}

.todo-item:hover .todo-delete {
    opacity: 1;
}

.todo-recur-badge {
    background: var(--primary-light);
    color: var(--primary);
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 700;
    font-size: 0.65rem;
}

/* --- KANBAN BOARD STYLES --- */

/* Kanban Layout */
.kanban-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 20px;
    height: calc(100vh - 180px);
}

@media (max-width: 992px) {
    .kanban-layout {
        grid-template-columns: 240px 1fr;
    }
}

@media (max-width: 768px) {
    .kanban-layout {
        display: flex;
        flex-direction: column;
        height: auto;
        min-height: calc(100vh - 120px);
        gap: 1rem;
    }

    .kanban-layout>.glass:first-child {
        height: auto;
        max-height: 250px;
        flex-shrink: 0;
        padding: 1.25rem !important;
    }

    #kanban-board-container {
        height: auto;
        min-height: 500px;
        flex: 1;
    }

    .kanban-board-scroll {
        padding: 10px 5px;
        gap: 12px;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
    }

    .kanban-column {
        flex: 0 0 85vw;
        scroll-snap-align: center;
        max-width: 320px;
    }

    .kanban-column:not(:last-child)::after {
        display: none;
    }

    .kanban-col-header {
        font-size: 0.9rem;
        height: 46px;
        padding: 0 12px;
    }

    .kanban-card-desc {
        -webkit-line-clamp: 2;
        line-clamp: 2;
    }
}

/* --- KANBAN BOARD STYLES --- */

.kanban-column {
    display: flex;
    flex-direction: column;
    flex: 1 0 300px;
    /* Grow to fill, shrink to 300px then overflow */
    min-width: 300px;
    height: 100%;
    background: transparent;
    border-radius: 0;
    vertical-align: top;
    position: relative;
    padding: 0 15px;
    /* Side padding for cards to stay away from lines */
}

.kanban-column:not(:last-child)::after {
    content: "";
    position: absolute;
    right: 0;
    top: 5px;
    bottom: 20px;
    width: 1px;
    background: var(--border-color);
    opacity: 0.8;
}

.kanban-col-header {
    padding: 0 35px !important;
    /* Increased to 35px to ensure visible gap */
    margin-left: -15px;
    margin-right: -15px;
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-main);
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-left: none;
    border-right: none;
    border-top: 4px solid transparent;
    /* Colored via inline style */
    border-radius: 0;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    white-space: nowrap;
    overflow: hidden;
    height: 55px;
}

.kanban-col-body {
    flex: 1;
    overflow-y: auto;
    padding-bottom: 20px;
    min-height: 100px;
    /* Custom Scrollbar for column text */
}

.kanban-card {
    background: var(--bg-card);
    padding: 0;
    /* Padding handled by internal divs */
    border-radius: 12px;
    margin-bottom: 15px;
    cursor: grab;
    transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
    border: 1px solid var(--glass-border);
    position: relative;
    user-select: none;
    display: flex;
    overflow: visible;
    flex-shrink: 0;
    /* Prevent card from shrinking */
}

.kanban-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05);
}

.kanban-card.dragging {
    opacity: 0.5;
    cursor: grabbing;
    border: 1px dashed var(--primary);
}

.kanban-board-scroll {
    flex: 1;
    /* Occupy remaining vertical space */
    overflow-x: auto;
    overflow-y: hidden;
    height: 100%;
    display: flex;
    padding: 20px 0;
    gap: 0;
    white-space: nowrap;
    background: transparent;
}

/* Custom scrollbar for kanban board */
.kanban-board-scroll::-webkit-scrollbar {
    height: 8px;
}

.kanban-board-scroll::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 4px;
    opacity: 0.5;
}

/* Description Truncation */
.kanban-card-desc {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: pre-line;
    /* Respect new lines */
    font-size: 0.85rem;
    opacity: 0.85;
    font-weight: 500;
    cursor: pointer;
    position: relative;
    transition: all 0.3s ease;
    word-break: break-word;
    overflow-wrap: anywhere;
    max-width: 100%;
}

.kanban-card-desc.expanded {
    display: block;
    -webkit-line-clamp: unset;
    line-clamp: unset;
    overflow: visible;
}

.kanban-read-more {
    font-size: 0.75rem;
    color: var(--primary);
    font-weight: 600;
    cursor: pointer;
    margin-top: 4px;
    display: inline-block;
}

.kanban-read-more:hover {
    text-decoration: underline;
}


#pdm-app-container.dark-theme .kanban-col-header {
    background: var(--bg-card);
}

#pdm-app-container.dark-theme .count-badge {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
}

/* Kanban File Attachment Enhancements */
.kanban-file-upload-wrapper:hover {
    border-color: var(--primary) !important;
    background: rgba(var(--primary-rgb), 0.05) !important;
}

.kanban-progress-bar-fill {
    box-shadow: 0 0 8px rgba(var(--primary-rgb), 1);
}

@keyframes pulse-upload {
    0% {
        opacity: 1;
    }

    50% {
        opacity: 0.6;
    }

    100% {
        opacity: 1;
    }
}

.uploading-state {
    animation: pulse-upload 1.5s infinite ease-in-out;
}

/* Mobile Overrides - Main Responsive Block moved to end */
@media (max-width: 1024px) {

    html,
    body {
        overflow: hidden !important;
        position: fixed;
        width: 100%;
        height: 100%;
    }

    #wpwrap,
    #wpcontent,
    #wpbody,
    #wpbody-content {
        height: 100% !important;
        overflow: hidden !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    #pdm-app-container {
        height: 100vh !important;
        min-height: 100vh !important;
        overflow: hidden !important;
    }

    body.admin-bar #pdm-app-container {
        height: calc(100vh - 46px) !important;
        min-height: calc(100vh - 46px) !important;
    }

    #pdm-app-container #app {
        flex-direction: column;
        height: 100% !important;
        overflow: hidden !important;
    }

    #pdm-app-container .sidebar {
        position: fixed;
        left: -100%;
        top: 0;
        bottom: 0;
        width: 280px !important;
        z-index: 9999 !important;
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        padding: 2rem 1.5rem;
        background: var(--bg-sidebar) !important;
        box-shadow: 20px 0 50px rgba(0, 0, 0, 0.1);
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
    }

    #pdm-app-container .sidebar.mobile-active {
        left: 0 !important;
    }

    #pdm-app-container #mobile-sidebar-close {
        display: flex !important;
    }

    #pdm-app-container .top-bar {
        padding: 1rem !important;
        position: sticky;
        top: 0;
        z-index: 50 !important;
        height: auto;
        min-height: 70px;
    }

    #pdm-app-container #mobile-menu-toggle {
        display: flex !important;
    }

    #pdm-app-container .view-section {
        padding: 1.5rem !important;
        height: 100% !important;
        flex: 1 !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        -webkit-overflow-scrolling: touch !important;
    }

    #pdm-app-container .section-header {
        margin-bottom: 2rem !important;
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    #pdm-app-container .user-profile {
        padding: 4px 8px;
        gap: 8px;
    }

    #pdm-app-container .user-profile #profile-display-name,
    #pdm-app-container .user-profile #profile-display-role {
        display: none;
        /* Hide name on mobile header to save space */
    }

    #pdm-app-container .sidebar-logo-text {
        display: block !important;
    }

    #pdm-app-container #sidebar-toggle-btn {
        display: none !important;
        /* No collapse btn on mobile */
    }

    /* Table to Card Transformation */
    #pdm-app-container table:not(.flatpickr-calendar table) {
        display: block !important;
        width: 100% !important;
        border: none !important;
        background: transparent !important;
    }

    #pdm-app-container table:not(.flatpickr-calendar table) thead {
        display: none !important;
    }

    #pdm-app-container table:not(.flatpickr-calendar table) tbody,
    #pdm-app-container table:not(.flatpickr-calendar table) tr,
    #pdm-app-container table:not(.flatpickr-calendar table) td {
        display: block !important;
        width: 100% !important;
    }

    #pdm-app-container table:not(.flatpickr-calendar table) tr {
        background: var(--bg-card);
        border-radius: 16px;
        padding: 1.25rem;
        margin-bottom: 2rem;
        box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.05);
        border: 1px solid var(--border-color);
        position: relative;
    }

    #pdm-app-container table:not(.flatpickr-calendar table) td {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center;
        padding: 0.85rem 0 !important;
        border-bottom: 1px solid var(--border-color) !important;
        text-align: right;
        min-height: 50px;
        gap: 1rem;
    }

    #pdm-app-container table:not(.flatpickr-calendar table) td:last-child {
        border-bottom: none !important;
        justify-content: center !important;
        padding-top: 1.5rem !important;
        margin-bottom: -0.5rem;
    }

    #pdm-app-container table:not(.flatpickr-calendar table) td::before {
        content: attr(data-label);
        font-weight: 700;
        text-align: left;
        color: var(--text-muted);
        font-size: 0.75rem;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        flex-shrink: 0;
    }

    #pdm-app-container .projects-table-container,
    #pdm-app-container .table-responsive {
        overflow: visible !important;
    }

    /* Scaling Fixes */
    #pdm-app-container .settings-container {
        grid-template-columns: 1fr !important;
    }

    #pdm-app-container .detail-mhub-button-group {
        flex-direction: column !important;
        width: 100% !important;
        border-radius: 12px !important;
    }

    #pdm-app-container .detail-mhub-button-group .btn {
        width: 100% !important;
        border-right: none !important;
        border-bottom: 1px solid var(--border-color) !important;
        border-radius: 0 !important;
        padding: 14px 15px !important;
    }

    #pdm-app-container .detail-mhub-button-group .btn:last-child {
        border-bottom: none !important;
    }

    .sa-layout {
        display: block !important;
    }

    .sa-sidebar {
        display: none !important;
    }

    .sa-mobile-selector {
        display: block !important;
    }

    #pdm-app-container .modal-content {
        width: 100% !important;
        max-width: 100% !important;
        height: 100vh !important;
        max-height: 100vh !important;
        margin: 0 !important;
        border-radius: 0 !important;
        padding: 2rem 1.5rem !important;
    }

    #pdm-app-container .input-field,
    #pdm-app-container select,
    #pdm-app-container textarea {
        font-size: 16px !important;
        /* Prevent iOS auto-zoom */
        padding: 12px 16px !important;
    }

    /* Modal specific fixes to avoid global pollution */
    #pdm-app-container .modal-content .btn {
        width: 100%;
        justify-content: center;
        padding: 14px 20px !important;
        font-size: 1rem !important;
    }

    #pdm-app-container .modal-content .flex.justify-end,
    #pdm-app-container .modal-content .flex.gap-3,
    #pdm-app-container .modal-content .flex.gap-4 {
        flex-direction: column-reverse !important;
        gap: 12px !important;
    }

    #pdm-app-container .grid-cols-2,
    #pdm-app-container .project-details-split {
        grid-template-columns: 1fr !important;
        gap: 1.5rem !important;
    }

    #pdm-app-container .detail-progress-row {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 8px !important;
    }

    #pdm-app-container .detail-progress-row .progress-container {
        width: 100% !important;
        margin: 0 !important;
    }

    #pdm-app-container .detail-bars-container {
        margin-left: 0 !important;
        width: 100% !important;
        margin-top: 1rem;
    }

    #pdm-app-container .stage-accordion-header {
        padding: 1rem !important;
    }

    #pdm-app-container .project-stats-grid {
        grid-template-columns: 1fr !important;
    }

    /* Chat Area Mobile Fixes - Prevent Send button from expanding and fix overlap */
    #pdm-app-container .chat-input-area form {
        display: flex !important;
        flex-direction: row !important;
        align-items: flex-end !important;
        gap: 8px !important;
    }

    #pdm-app-container .chat-input-area .btn-icon,
    #pdm-app-container .chat-input-area button[type="submit"] {
        width: 50px !important;
        min-width: 50px !important;
        height: 48px !important;
        flex-shrink: 0 !important;
        padding: 0 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        border-radius: var(--radius-md) !important;
    }

    #pdm-app-container #chat-message-input {
        padding-right: 95px !important;
        /* Increased to fix text overlap with emoji btn */
        height: 48px !important;
        font-size: 15px !important;
    }

    #pdm-app-container #chat-emoji-btn {
        right: 8px !important;
        padding: 4px 8px !important;
        height: 32px !important;
        background: var(--bg-app) !important;
        border: 1px solid var(--border-color) !important;
        font-size: 13px !important;
    }
}

/* TREE CHART ALGORITHM */
#pdm-app-container div.tree {
    display: inline-block !important;
    padding: 20px !important;
    text-align: center !important;
    vertical-align: top !important;
}

#pdm-app-container div.tree ul {
    display: inline-flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    position: relative !important;
    padding-top: 80px !important;
    margin: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    list-style-type: none !important;
    transition: all 0.3s !important;
    align-items: flex-start !important;
}

#pdm-app-container div.tree>ul {
    margin: 0 auto !important;
    display: inline-flex !important;
}

#pdm-app-container div.tree li {
    display: inline-flex !important;
    flex-direction: column !important;
    align-items: center !important;
    vertical-align: top !important;
    position: relative !important;
    padding: 0 10px !important;
    /* Tight spacing, will expand as children are added */
    list-style-type: none !important;
}

#pdm-app-container div.tree li::before,
#pdm-app-container div.tree li::after {
    content: "" !important;
    position: absolute !important;
    top: 0 !important;
    right: 50% !important;
    border-top: 2px solid var(--border-color) !important;
    width: 50% !important;
    height: 80px !important;
}

#pdm-app-container div.tree li::after {
    right: auto !important;
    left: 50% !important;
    border-left: 2px solid var(--border-color) !important;
}

#pdm-app-container div.tree li:only-child::after,
#pdm-app-container div.tree li:only-child::before {
    display: none !important;
}

#pdm-app-container div.tree li:only-child {
    padding-top: 0 !important;
}

#pdm-app-container div.tree li:first-child::before,
#pdm-app-container div.tree li:last-child::after {
    border: 0 none !important;
}

#pdm-app-container div.tree li:last-child::before {
    border-right: 2px solid var(--border-color) !important;
    border-radius: 0 5px 0 0 !important;
}

#pdm-app-container div.tree li:first-child::after {
    border-radius: 5px 0 0 0 !important;
}

/* Time to add downward connectors from parents */
#pdm-app-container div.tree ul ul::before {
    content: "" !important;
    position: absolute !important;
    top: 0 !important;
    left: 50% !important;
    border-left: 2px solid var(--border-color) !important;
    width: 0 !important;
    height: 80px !important;
    /* Distance from siblings horizontal line to parent */
    transform: translateX(-50%) !important;
}

#pdm-app-container div.tree li .node-card {
    border: 1px solid var(--glass-border) !important;
    padding: 16px 20px !important;
    text-decoration: none !important;
    color: var(--text-main) !important;
    display: block !important;
    border-radius: 16px !important;
    transition: all 0.3s !important;
    min-width: 220px !important;
    width: max-content !important;
    max-width: 450px !important;
    background: var(--bg-card) !important;
    position: relative !important;
    z-index: 2 !important;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1) !important;
    margin: 0 !important;
    word-wrap: break-word !important;
}

#pdm-app-container div.tree li .node-card::after {
    content: "" !important;
    position: absolute !important;
    bottom: -80px !important;
    left: 50% !important;
    width: 2px !important;
    height: 80px !important;
    background: var(--border-color) !important;
    transform: translateX(-50%) !important;
    display: none !important;
    z-index: 1 !important;
}

#pdm-app-container div.tree li .node-card.has-children-visible::after {
    display: block !important;
}

.node-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.node-title {
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
    max-width: 180px;
}

.node-controls {
    display: flex;
    gap: 6px;
    opacity: 0.4;
    transition: 0.2s;
}

.tree li .node-card:hover .node-controls {
    opacity: 1;
}

.node-controls button {
    background: var(--bg-app);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    padding: 4px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    transition: all 0.2s;
}

.node-controls button:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.node-controls button.danger:hover {
    background: #ef4444;
    border-color: #ef4444;
}

.btn-icon-small {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    padding: 4px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    transition: all 0.2s;
}

.btn-icon-small:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: white !important;
}

.node-body {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-align: left;
    line-height: 1.5;
    max-height: 250px;
    overflow-y: auto;
    margin-top: 10px;
    padding: 12px;
    background: rgba(0, 0, 0, 0.03);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    white-space: normal;
    word-break: break-word !important;
}

.node-body mark {
    background-color: yellow;
    color: black;
    border-radius: 2px;
    padding: 0 2px;
}

.node-body b,
.node-body strong {
    font-weight: 700;
    color: var(--text-main);
}

.node-body.hidden {
    display: none !important;
}

.btn-pill {
    padding: 6px 16px;
    border-radius: 6px;
    color: var(--text-muted);
    cursor: pointer;
    transition: 0.2s;
    border: 0;
    background: transparent;
    font-weight: 600;
    font-size: 0.9rem;
}

.btn-pill:hover {
    color: var(--primary);
    background: rgba(255, 255, 255, 0.1);
}

.btn-pill.active {
    background: var(--bg-card);
    color: var(--primary);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

/* Dark mode adjustment for lines */
#pdm-app-container.dark-theme .tree li::before,
#pdm-app-container.dark-theme .tree li::after,
#pdm-app-container.dark-theme .tree ul ul::before {
    border-color: rgba(255, 255, 255, 0.1);
}

.node-card.completed {
    border-color: var(--success) !important;
    background: rgba(16, 185, 129, 0.05) !important;
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.2);
}

.node-card.completed .node-title {
    color: var(--success);
}

#pdm-app-container div.tree .toggle-btn {
    width: 24px !important;
    height: 24px !important;
    background: var(--bg-card) !important;
    border: 2px solid var(--border-color) !important;
    border-radius: 50% !important;
    position: absolute !important;
    bottom: -40px !important;
    /* Centered on the 80px line */
    left: 50% !important;
    transform: translateX(-50%) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    z-index: 10 !important;
    font-size: 10px !important;
    color: var(--text-muted) !important;
    transition: all 0.2s !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
}

#pdm-app-container div.tree .toggle-btn:hover {
    background: var(--primary) !important;
    color: white !important;
    border-color: var(--primary) !important;
}

#pdm-app-container div.tree .toggle-btn i {
    width: 14px !important;
    height: 14px !important;
}

#pdm-app-container div.tree li ul.hidden {
    display: none !important;
}

/* Connectors Logic Fix for Hidden Siblings */
#pdm-app-container div.tree li ul.hidden::before {
    display: none !important;
}