:root {
    --bg:           #0B2530; /* Deep Dark Blue-Green (Neon) */
    --panel:        #0E3141; /* Slightly Lighter Dark Blue-Green */
    --panel-hover:  #144256; /* Hover State */
    --border:       rgba(255,255,255,0.08);
    --cyan:         #00f0ff;
    --cyan-rgb:     0, 240, 255;
    --pink:         #ffaae5;
    --pink-rgb:     255, 170, 229;
    --text:         #e2e8f0;
    --text-dim:     #90a7c8;
    --card-bg:      #0E3141;
    --radius:       6px;
    --font-family:  'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

[data-theme="gold"] {
    --bg:           #1e252b; /* Deep Dark Slate-Grey (Gold Theme) */
    --panel:        #262e35; /* Slightly Lighter Slate-Grey */
    --panel-hover:  #303942; /* Hover State */
    --border:       rgba(255,255,255,0.08);
    --cyan:         #e5c158; /* Warm Gold */
    --cyan-rgb:     229, 193, 88;
    --pink:         #c5a059; /* Soft Gold/Amber */
    --pink-rgb:     197, 160, 89;
    --text:         #e2e8f0;
    --text-dim:     #90a7c8;
    --card-bg:      #262e35;
}

[data-theme="light"] {
    --bg:           #F9F7F2; /* Designer Cream Background */
    --panel:        #ffffff;
    --panel-hover:  #fdfcfb;
    --border:       rgba(0,0,0,0.08);
    --cyan:         #064E3B; /* Deep Emerald Accent */
    --cyan-rgb:     6, 78, 59;
    --pink:         #B45309; /* Luxury Brown/Gold */
    --text:         #1F2937;
    --text-dim:     #6B7280;
    --card-bg:      #ffffff;
    --card-shadow:  0 10px 25px -5px rgba(0, 0, 0, 0.05);
    --ds-accent-soft: #ECFDF5;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    font-family: var(--font-family);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    /* Вимикаємо системне "гумове" опускання сторінки та системний PTR */
    overscroll-behavior-y: none;
}

.hidden { display: none !important; }

/* ---- LOGIN ---- */
.login-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(ellipse at 50% 0%, rgba(var(--cyan-rgb),0.07) 0%, transparent 60%);
}
.login-box {
    width: 360px;
    padding: 40px;
    background: var(--panel);
    border: 1px solid rgba(var(--cyan-rgb),0.2);
    box-shadow: 0 0 40px rgba(var(--cyan-rgb),0.05);
}
.login-logo {
    font-size: 1.3rem;
    font-weight: 800;
    letter-spacing: 3px;
    color: var(--cyan);
    text-shadow: 0 0 12px var(--cyan);
    margin-bottom: 4px;
}
.login-sub {
    font-size: 0.65rem;
    letter-spacing: 2px;
    color: var(--text-dim);
    margin-bottom: 32px;
}
.login-error {
    background: rgba(255,0,127,0.1);
    border: 1px solid var(--pink);
    color: var(--pink);
    padding: 8px 12px;
    font-size: 0.8rem;
    margin-bottom: 16px;
}
.login-input {
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 12px 14px;
    font-family: inherit;
    font-size: 0.9rem;
    letter-spacing: 1px;
    margin-bottom: 12px;
    outline: none;
    transition: border-color 0.2s;
}
.login-input:focus { border-color: var(--cyan); }

/* Password visibility toggle */
.password-input-container {
    position: relative;
    margin-bottom: 12px;
}
.password-input-container .login-input {
    margin-bottom: 0; /* Прибираємо нижній відступ, бо контейнер його вже має */
    padding-right: 40px; /* Звільняємо місце для кнопки */
}
.toggle-password-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    color: var(--text-dim);
    transition: color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.toggle-password-btn:hover {
    color: var(--text);
}
.toggle-password-btn::before {
    content: '';
    display: block;
    width: 20px;
    height: 20px;
    background-color: currentColor;
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24'/%3E%3Cline x1='1' y1='1' x2='23' y2='23'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24'/%3E%3Cline x1='1' y1='1' x2='23' y2='23'/%3E%3C/svg%3E");
    -webkit-mask-size: contain;
    mask-size: contain;
    mask-repeat: no-repeat;
    -webkit-mask-repeat: no-repeat;
}
.toggle-password-btn.visible::before {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z'/%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z'/%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3C/svg%3E");
}

.login-btn {
    width: 100%;
    padding: 13px;
    background: transparent;
    border: 1px solid var(--cyan);
    color: var(--cyan);
    font-family: inherit;
    font-size: 0.9rem;
    letter-spacing: 2px;
    cursor: pointer;
    transition: background 0.2s, box-shadow 0.2s, color 0.2s;
    margin-top: 4px;
}
.login-btn:hover {
    background: rgba(var(--cyan-rgb),0.08);
    box-shadow: 0 0 16px rgba(var(--cyan-rgb),0.2);
}
.login-btn-primary {
    background: var(--cyan);
    color: var(--bg);
    border-color: var(--cyan);
    font-weight: 700;
}
.login-btn-primary:hover {
    background: #00d8e6;
    box-shadow: 0 0 16px rgba(var(--cyan-rgb),0.4);
    color: var(--bg);
}
.login-back-btn {
    display: block;
    width: 100%;
    text-align: center;
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 0.8rem;
    letter-spacing: 1px;
    cursor: pointer;
    padding: 8px 0;
    transition: color 0.2s;
    margin-top: 8px;
}
.login-back-btn:hover {
    color: var(--cyan);
}
@keyframes loginFadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}
.login-options-container, .specialist-login-container {
    animation: loginFadeIn 0.3s ease-out forwards;
}

/* ---- SIDEBAR LAYOUT ---- */
.sidebar {
    width: 260px;
    height: 100vh;
    background: var(--panel);
    border-right: 1px solid var(--border); /* Кордон тепер праворуч */
    display: flex;
    flex-direction: column;
    padding: 24px 20px;
    flex-shrink: 0;
    z-index: 100;
    transition: all 0.3s ease;
}
.sidebar-header {
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border);
}
.logo {
    font-size: 1.15rem;
    letter-spacing: 2px;
    color: var(--cyan);
    text-shadow: 0 0 10px rgba(var(--cyan-rgb), 0.3);
    font-weight: 800;
    text-transform: uppercase;
    display: inline-block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: middle;
}

/* Premium User Card in Sidebar */
.sidebar-user-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 24px;
    cursor: pointer;
    transition: all 0.2s ease;
}
.sidebar-user-card:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(var(--cyan-rgb), 0.25);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}
.user-card-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid var(--cyan);
    overflow: hidden;
    background: var(--bg);
    flex-shrink: 0;
    box-shadow: 0 0 10px rgba(var(--cyan-rgb), 0.15);
}
.user-card-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.user-card-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow: hidden;
}
.user-card-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}
.user-card-role {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--pink);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    width: fit-content;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
    overflow-y: auto;
    padding-right: 2px;
}

/* Custom Nav Item buttons */
.sidebar-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 11px 16px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 8px;
    color: var(--text-dim);
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    outline: none;
}
.sidebar-nav-item svg {
    flex-shrink: 0;
    transition: stroke 0.2s ease, transform 0.2s ease;
}
.sidebar-nav-item:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.04);
}
.sidebar-nav-item:hover svg {
    transform: translateX(2px);
    color: var(--cyan);
}
.sidebar-nav-item.active {
    color: var(--cyan);
    background: rgba(var(--cyan-rgb), 0.06);
    border-color: rgba(var(--cyan-rgb), 0.15);
    font-weight: 600;
}
.sidebar-nav-item.active svg {
    color: var(--cyan);
}

/* Premium Add Project Button */
.btn-add-project-premium {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px;
    background: rgba(var(--cyan-rgb), 0.08);
    border: 1px solid var(--cyan);
    border-radius: 8px;
    color: var(--cyan);
    font-family: inherit;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 12px;
}
.btn-add-project-premium:hover {
    background: var(--cyan);
    color: var(--bg);
    box-shadow: 0 0 16px rgba(var(--cyan-rgb), 0.3);
}

.sidebar-bottom {
    margin-top: auto;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}
.sidebar-bottom-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logout-btn-premium {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex: 1;
    height: 44px;
    background: rgba(255, 0, 127, 0.03);
    border: 1px solid rgba(255, 0, 127, 0.2);
    border-radius: 8px;
    color: var(--pink);
    font-family: inherit;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.2s ease;
}
.logout-btn-premium:hover {
    background: var(--pink);
    color: white;
    border-color: var(--pink);
    box-shadow: 0 0 12px rgba(255, 0, 127, 0.2);
}

/* ---- MAIN WRAPPER (TOP HEADER) ---- */
.top-header {
    background: var(--panel);
    border-bottom: 1px solid var(--border);
    padding: 14px 24px;
    display: flex;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 90;
}

#header-board-name { font-size: 0.85rem; color: var(--text-dim); letter-spacing: 1px; }

/* Keep icons styles */
.header-icons-group {
    display: flex;
    align-items: center;
}

.settings-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-dim);
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    width: 36px;
    height: 36px;
    flex-shrink: 0;
}
.settings-btn:hover {
    color: var(--cyan);
    filter: drop-shadow(0 0 8px var(--cyan));
}

/* ---- GENERIC ICON BUTTONS (Calendar, People) ---- */
.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-dim);
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    width: 56px;
    height: 56px;
    flex-shrink: 0;
}
.btn-icon:hover {
    color: var(--cyan);
    filter: drop-shadow(0 0 8px var(--cyan));
}

/* ---- NOTIFICATIONS BELL ---- */
.btn-notification {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-dim);
    padding: 0; /* Прибираємо внутрішній відступ */
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    width: 56px;
    height: 56px;
    flex-shrink: 0;
}
.btn-notification.has-unread {
    color: var(--cyan);
    filter: drop-shadow(0 0 8px var(--cyan));
}
.btn-notification svg { transition: stroke 0.3s; }

#header-user { font-size: 0.85rem; color: var(--text); }
.role-badge {
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 8px;
    border: 1px solid var(--pink);
    color: var(--pink);
    text-transform: uppercase;
}

/* ---- HOME VIEW ---- */
.home-container {
    padding: 20px;
    max-width: 1000px;
    margin: 0 auto;
    overflow-x: hidden;
}
.user-welcome-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 25px;
}
.user-welcome { margin-bottom: 25px; }
.user-welcome-row .user-welcome { margin-bottom: 0; }
.user-welcome h1 { font-size: 1.4rem; color: var(--text); }
.user-welcome p { color: var(--pink); font-weight: 700; text-transform: uppercase; font-size: 0.75rem; letter-spacing: 1px; }

.user-welcome-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}
.avatar-circle-sm {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 2px solid var(--cyan);
    overflow: hidden;
    cursor: pointer;
    background: var(--bg);
    box-shadow: 0 0 15px rgba(var(--cyan-rgb),0.1);
}
.avatar-circle-sm img { width: 100%; height: 100%; object-fit: cover; }

.home-section-title {
    font-size: 0.7rem;
    letter-spacing: 2px;
    color: var(--cyan);
    margin-bottom: 12px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 6px;
    text-transform: uppercase;
}

.user-projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, 100px); /* Жорстка ширина контейнера */
    gap: 12px;
    margin-bottom: 35px;
    justify-content: flex-start;
}

/* Адаптація сітки для модальних вікон */
#status-list-content {
    padding: 10px;
    justify-content: center;
}

.mini-card {
    width: 100px;
    height: 160px; /* Компактна висота */
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s, border-color 0.2s;
    flex-shrink: 0;
}
.mini-card:hover { transform: translateY(-3px); border-color: var(--cyan); }
.mini-card-img { width: 100%; height: 100px; object-fit: cover; border-bottom: 1px solid var(--border); }
.mini-card-title {
    padding: 5px;
    font-size: 0.65rem;
    color: var(--text);
    text-align: center;
    line-height: 1.2;
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    word-break: break-word;
}

/* ---- BUTTONS ---- */
.btn {
    padding: 7px 16px;
    font-family: inherit;
    font-size: 0.75rem;
    letter-spacing: 1px;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.2s;
}
.btn-primary {
    background: transparent;
    border-color: var(--cyan);
    color: var(--cyan);
}
.btn-primary:hover { background: rgba(var(--cyan-rgb),0.1); box-shadow: 0 0 12px rgba(var(--cyan-rgb),0.2); }
.btn-ghost {
    background: transparent;
    border-color: var(--text-dim);
    color: var(--text);
    font-weight: 600;
}
.btn-ghost:hover { border-color: var(--cyan); color: var(--cyan); }
.btn-danger {
    background: transparent;
    border-color: var(--pink);
    color: var(--pink);
}
.btn-danger:hover { background: rgba(255,0,127,0.1); }
.btn-full { width: 100%; margin-top: 8px; padding: 12px; }

/* ---- BOARD ---- */
.board {
    display: flex;
    gap: 18px;
    padding: 24px;
    overflow-x: auto;
    overflow-y: hidden;
    align-items: flex-start;
    height: calc(100vh - 57px);
}

/* ---- COLUMN ---- */
.column {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: 280px;
    min-width: 280px;
    display: flex;
    flex-direction: column;
    max-height: 100%;
    transition: all 0.2s ease-in-out;
}
.column-header {
    padding: 12px 14px;
    border-bottom: 3px solid var(--pink);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.column-header .toggle-icon {
    display: none; /* Приховано на десктопі */
    width: 8px;
    height: 8px;
    border-right: 2px solid var(--pink);
    border-bottom: 2px solid var(--pink);
    transform: rotate(-45deg); /* Дивиться вправо за замовчуванням */
    transition: transform 0.3s ease;
}
.column-title {
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--pink);
    text-transform: uppercase;
}
.column-count {
    font-size: 0.7rem;
    font-weight: 800;
    color: var(--pink);
    background: rgba(255,0,127,0.15);
    padding: 1px 7px;
    border-radius: 10px;
}
.cards-container {
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 80px;
    flex: 1;
    overflow-y: auto;
}
.cards-container.drag-over {
    background: rgba(var(--cyan-rgb),0.04);
    border: 1px dashed rgba(var(--cyan-rgb),0.3);
    border-radius: var(--radius);
}

/* ---- CARD ---- */
.card {
    background: var(--card-bg);
    border-left: 3px solid var(--cyan);
    padding: 12px;
    border-radius: 2px;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    user-select: none;
    box-shadow: var(--card-shadow, none);
}
.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(var(--cyan-rgb),0.15);
}
.card.dragging { opacity: 0.4; cursor: grabbing; }
.card-title {
    font-size: 0.9rem;
    color: var(--text);
    margin-bottom: 4px;
    line-height: 1.3;
}
.card-brand {
    font-size: 0.72rem;
    color: var(--text-dim);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 1px;
}
.card-date {
    font-size: 0.68rem;
    color: var(--text-dim);
}
.card-image {
    width: 100%;
    max-height: 160px;
    object-fit: cover;
    border-radius: var(--radius);
    margin-bottom: 10px;
    border: 1px solid var(--border);
    display: block;
}
.card-urgent-badge {
    background: #ff0000;
    color: white;
    font-size: 0.65rem;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 2px;
    margin-bottom: 8px;
    display: inline-block;
}
.card-type {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--cyan);
    margin-bottom: 4px;
    text-transform: uppercase;
}

/* ---- MODAL ---- */
.modal { position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center; }
.modal-overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.75); }
.modal-box {
    position: relative;
    background: var(--panel);
    border-radius: 12px;
    border: 1px solid rgba(var(--cyan-rgb),0.2);
    width: 720px;
    max-width: 95vw;
    max-height: 90vh;
    overflow-y: auto;
    padding: 32px;
}

#modal-status-list {
    z-index: 220; /* Має бути вище ніж #modal-tz (210) */
}

.modal-box--sm {
    width: 700px;
    height: 85vh;
    display: flex;
    flex-direction: column;
}

.comments-modal-content-area {
    flex-grow: 1; overflow-y: auto; padding-right: 10px;
}

.comment-form--modal {
    padding: 10px;
    margin-top: 0;
    border-top: 1px solid var(--border);
}

[data-theme="light"] #modal-comments .modal-box {
    background: var(--bg); /* Cream background */
}

[data-theme="light"] .comment-form--modal .comment-input {
    background: var(--panel); /* White input */
}
.modal-close {
    position: absolute;
    top: 14px; right: 16px;
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 1.1rem;
    cursor: pointer;
}
.modal-close:hover { color: var(--text); }

.modal-title {
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--cyan);
    margin-bottom: 20px;
}

.modal-box--image {
    background: transparent;
    border: none;
    padding: 0;
    width: auto;
    max-width: 90vw;
    display: flex;
    justify-content: center;
}

/* Адаптивне вікно для гри */
.modal-box--full {
    width: 480px;
    max-width: 95vw;
}

@media (max-width: 768px) {
    .modal-box--full {
        width: 100vw;
        height: 100vh;
        max-width: 100vw;
        max-height: 100vh;
        padding: 20px;
        display: flex;
    /* Змінено для ПК версії */
    flex-direction: column;
    justify-content: center;
    gap: 10px;
        flex-direction: column;
        justify-content: center;
        border-radius: 0;
        border: none;
    }
}

/* ---- PROFILE MODAL CUSTOM STYLES ---- */
.profile-layout {
    display: flex;
    gap: 40px;
    padding: 10px 0;
}
.profile-sidebar {
    flex: 0 0 160px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}
.profile-main {
    flex: 1;
}
.profile-stats {
    margin-top: 20px;
    width: 100%;
    border-top: 1px solid var(--border);
    padding-top: 15px;
    font-size: 0.75rem;
    color: var(--text-dim);
    gap: 24px;
}
.stat-item { margin-bottom: 8px; }

.avatar-frame {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    border: 2px solid var(--cyan);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    margin-bottom: 10px;
    box-shadow: 0 0 20px rgba(var(--cyan-rgb),0.1);
}
.avatar-frame img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* Щоб фото не сплющувалось */
}

/* ---- PROJECT MODAL V2 ---- */
#modal-project .modal-box {
    width: 1280px; /* Wider modal, landscape */
    max-height: none;
    overflow: visible;
}

[data-theme="light"] #modal-project .modal-box {
    background: var(--bg); /* Cream background for the modal itself */
}

/* Override for project modal to allow scrolling the whole modal instead of just the box */
#modal-project {
    align-items: flex-start;
    overflow-y: auto;
    padding: 5vh 15px;
}
.pm-breadcrumb {
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--cyan);
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.pm-layout {
    display: grid;
    grid-template-columns: 4fr 6fr; /* 40% / 60% */
    gap: 24px;
}

.pm-col-left, .pm-col-right {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* --- Left Column --- */
.pm-image-wrapper {
    position: relative;
    width: 100%;
}
.pm-image-wrapper img {
    width: 100%;
    height: auto;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--border);
    display: block;
}
.pm-urgent-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    background: rgba(255, 0, 0, 0.8);
    color: white;
    font-size: 0.7rem;
    font-weight: bold;
    padding: 4px 8px;
    border-radius: 6px;
    text-transform: uppercase;
    z-index: 1;
}

.pm-block {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    background: var(--bg);
}
[data-theme="light"] .pm-block {
    border-color: #064E3B; /* Deep Emerald Accent for light theme */
    background: #ffffff;
}

.pm-block-title {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 16px;
}

.pm-deadlines .pm-block-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.pm-deadlines .pm-deadline-item {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    padding: 6px 0;
}
.pm-deadlines .pm-deadline-item:not(:last-child) {
    border-bottom: 1px solid var(--border);
}
.pm-deadlines .pm-deadline-item span:first-child {
    color: var(--text-dim);
}
.pm-deadlines .pm-deadline-item span:last-child {
    font-weight: 700; /* Bolder */
    color: var(--text);
}

.btn-icon-toggle {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-dim);
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s, transform 0.2s;
}
.btn-icon-toggle:hover {
    color: var(--cyan);
    transform: scale(1.1);
}

.pm-date-input {
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 2px 5px;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 700;
    border-radius: 4px;
}

/* --- Right Column --- */
.pm-form-group {
    margin-bottom: 14px;
}
.pm-form-group:last-child {
    margin-bottom: 0;
}
.pm-form-group label {
    display: block;
    font-size: 0.7rem;
    font-weight: 600; /* Bolder */
    color: var(--text-dim);
    margin-bottom: 6px;
}
.pm-form-group .form-input {
    border-radius: 6px;
}
.pm-form-group.checkbox-group {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 16px;
}
.pm-form-group.checkbox-group input {
    width: 16px;
    height: 16px;
}
.pm-form-group.checkbox-group label {
    margin-bottom: 0;
    font-size: 0.85rem;
    color: var(--text);
}

.pm-actions .pm-action-row {
    display: flex;
    gap: 12px; /* Збільшив відступ для кращої видимості */
    justify-content: space-between;
    flex-wrap: wrap; /* Дозволяє кнопкам переноситись, якщо не вистачає місця */
    align-items: center;
}
.pm-actions .pm-action-row:first-of-type {
    margin-bottom: 15px; /* Додаємо чіткий відступ між рядами кнопок */
}
.pm-actions .pm-action-row .btn {
    flex: 1;
}
.btn-icon-danger {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--pink); /* Зроблено червоним за замовчуванням */
    transition: all 0.2s;
}
.btn-icon-danger:hover {
    transform: scale(1.15); /* Ефект при наведенні залишається */
}

/* --- Footer --- */
.pm-footer {
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.pm-footer-meta {
    font-size: 0.75rem;
    color: var(--text-dim);
}
.btn-large {
    padding: 10px 24px;
    font-size: 0.85rem;
    letter-spacing: 1.5px;
    background-color: var(--cyan);
    color: var(--bg);
    border-color: var(--cyan);
}
.btn-large:hover {
    opacity: 0.9;
    box-shadow: 0 0 12px var(--cyan);
}

/* ---- COMMENTS ---- */
.comments-section { margin-top: 24px; grid-column: 1 / -1; }
.comment {
    padding: 10px 12px;
    background: var(--card-bg);
    border-left: 2px solid var(--border);
    margin-bottom: 8px;
}
.comment-author { font-size: 0.7rem; color: var(--cyan); margin-bottom: 4px; }
.comment-text { 
    font-size: 0.82rem; 
    line-height: 1.5; 
    white-space: pre-wrap; 
    font-family: monospace; 
}
.comment-date { font-size: 0.65rem; color: var(--text-dim); margin-top: 4px; }
.comment-form { display: flex; gap: 8px; margin-top: 12px; }
.comment-input {
    flex: 1;
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 9px 12px;
    font-family: inherit;
    font-size: 0.82rem;
    outline: none;
    resize: none;
}
.comment-form--modal .comment-input {
    padding: 6px 10px;
    min-height: 40px;
}
.comment-form--modal .btn { padding: 6px 12px; }
.comment-input:focus { border-color: var(--cyan); }

/* ---- NOTIFICATION LIST ---- */
.notification-item {
    padding: 12px;
    border-bottom: 1px solid var(--border);
}
.notification-item.unread {
    background: rgba(var(--cyan-rgb), 0.04);
    border-left: 2px solid var(--cyan);
}
.notification-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--cyan);
    margin-bottom: 4px;
}
.notification-body {
    font-size: 0.8rem;
    color: var(--text);
    line-height: 1.4;
}
.notification-date {
    font-size: 0.65rem;
    color: var(--text-dim);
    margin-top: 4px;
}

/* ---- FORMS ---- */
.form-label {
    display: block;
    font-size: 0.65rem;
    letter-spacing: 1px;
    color: var(--text-dim);
    margin-bottom: 5px;
    margin-top: 12px;
    text-transform: uppercase;
}
.form-input {
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 9px 12px;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 500; /* Bolder for readability */
    outline: none;
    transition: border-color 0.2s;
}
.form-input:focus { border-color: var(--cyan); }
.form-textarea { resize: vertical; }
.checkbox-label { display: flex; align-items: center; gap: 8px; font-size: 0.8rem; color: var(--text); cursor: pointer; }

/* ---- USERS LIST ---- */
.user-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    margin-bottom: 6px;
}
.user-info { flex: 1; }
.user-name { font-size: 0.85rem; color: var(--text); }
.user-meta { font-size: 0.7rem; color: var(--text-dim); margin-top: 2px; }
.user-actions { display: flex; gap: 6px; }

/* ---- PEOPLE GRID ---- */
.people-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 15px;
    margin-top: 10px;
}
.person-card {
    background: var(--bg);
    border: 1px solid var(--border);
    padding: 20px 10px;
    text-align: center;
    transition: border-color 0.2s;
}
.person-card:hover { border-color: var(--cyan); }
.person-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    margin: 0 auto 10px;
    overflow: hidden;
    background: var(--panel);
    display: flex; align-items: center; justify-content: center;
}
.person-avatar img { width: 100%; height: 100%; object-fit: cover; }
.person-name { font-size: 0.8rem; color: var(--text); margin-bottom: 4px; }
.person-role { font-size: 0.6rem; font-weight: 700; color: var(--pink); letter-spacing: 0.5px; }

/* ---- PULL TO REFRESH STYLES ---- */
#pull-indicator {
    position: fixed;
    top: 0; /* Починаємо з самого верху екрана */
    left: 0;
    right: 0;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1100; 
    pointer-events: none;
    opacity: 0;
    transform: translateY(-100%); /* Приховуємо над екраном за замовчуванням */
    transition: transform 0.3s cubic-bezier(0.2, 0, 0.3, 1), opacity 0.3s; /* Плавний перехід */
    background: transparent; /* Робимо фон прозорим, щоб було видно тільки спіннер */
}

.ptr-spinner {
    width: 28px;
    height: 28px;
    border: 3px solid var(--border);
    border-top-color: var(--cyan);
    border-radius: 50%;
    transition: transform 0.2s;
    background: var(--panel);
    box-shadow: 0 3px 10px rgba(0,0,0,0.3);
}

#pull-indicator.ready .ptr-spinner {
    border-top-color: var(--pink);
    transform: rotate(180deg);
}

#pull-indicator.refreshing .ptr-spinner {
    animation: ptr-rotate 0.8s linear infinite;
}

@keyframes ptr-rotate {
    to { transform: rotate(360deg); }
}

/* ---- IMAGE GALLERY NAVIGATION ---- */
#image-prev-btn, #image-next-btn {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.4);
    color: white;
    border: none;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 2rem;
    z-index: 250;
    transition: all 0.2s;
    user-select: none;
    backdrop-filter: blur(4px);
}
#image-prev-btn:hover, #image-next-btn:hover { background: rgba(var(--cyan-rgb), 0.3); color: var(--cyan); }
#image-prev-btn { left: 20px; }
#image-next-btn { right: 20px; }

#image-prev-btn::before { content: '‹'; }
#image-next-btn::before { content: '›'; }

#image-viewer-src {
    max-width: 95vw;
    max-height: 90vh;
    object-fit: contain;
    user-select: none;
}

/* ---- CREATE PROJECT PREVIEWS ---- */
#create-project-previews {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

.create-project-preview-item {
    position: relative;
    width: 80px;
    height: 80px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--bg);
    flex-shrink: 0;
}

.create-project-preview-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.create-project-preview-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
}

.create-project-preview-item:hover .create-project-preview-overlay,
.create-project-preview-item.is-main .create-project-preview-overlay {
    opacity: 1;
}

.create-project-preview-item.is-main {
    border: 2px solid var(--cyan);
}

/* ---- SNAKE GAME ---- */
.game-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}
#snake-canvas {
    border: 2px solid var(--cyan);
    background: #000;
    box-shadow: 0 0 20px rgba(var(--cyan-rgb), 0.15);
    image-rendering: pixelated;
    max-width: 100%;
    height: auto;
}
.game-score { font-family: 'Courier New', Courier, monospace; font-size: 1.2rem; color: var(--pink); letter-spacing: 2px; }

/* ---- BOTTOM NAVIGATION (MOBILE) ---- */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 65px;
    background: var(--panel);
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 1000;
    padding-bottom: env(safe-area-inset-bottom);
}
.bottom-nav .nav-item {
    background: none;
    border: none;
    color: var(--text-dim);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    flex: 1;
    transition: color 0.2s;
}
.bottom-nav .nav-item.active { color: var(--cyan); }
.bottom-nav .nav-item span { font-size: 0.65rem; font-weight: 600; }

#drag-placeholder {
    width: 100%; /* Заповнюємо всю ширину колонки */
}

/* ---- CALENDAR ---- */
.calendar-header {
    display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px;
}
.calendar-month-year { font-size: 1rem; font-weight: bold; color: var(--cyan); text-transform: uppercase; }
.calendar-grid {
    display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px;
}
.calendar-day-name {
    font-size: 0.65rem; color: var(--text-dim); padding: 5px 0; border-bottom: 1px solid var(--border); text-align: center;
}
.calendar-day {
    background: var(--panel-hover); border: 1px solid var(--border); min-height: 50px;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    cursor: pointer; transition: all 0.2s; position: relative;
}
.calendar-day:hover { border-color: var(--cyan); background: var(--bg); }
.calendar-day.empty { background: transparent; border: none; cursor: default; }
.calendar-day.today { border-color: var(--pink); box-shadow: inset 0 0 5px rgba(255,0,127,0.2); }
.calendar-day.selected { border-color: var(--cyan); background: rgba(var(--cyan-rgb),0.05); }

.day-number { font-size: 0.85rem; }
.worked-hours {
    font-size: 0.6rem; font-weight: 700; 
    color: var(--pink); background: rgba(255,0,127,0.15);
    padding: 2px 4px; border-radius: 2px; margin-top: 4px;
}

.calendar-header {
    gap: 10px; /* Додаємо проміжок між елементами */
}

/* ---- CALENDAR REPORT STYLES ---- */
.report-table {
    width: 100%;
    border-collapse: collapse;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.85rem;
    color: var(--text);
}
.report-table th, .report-table td {
    border: 1px solid var(--border);
    padding: 8px;
    text-align: center;
}
.report-table th {
    background-color: var(--panel);
    color: var(--cyan);
    text-transform: uppercase;
}
.report-table .month-header {
    background-color: var(--cyan);
    color: var(--bg); /* Темний текст на ціановому фоні */
    font-size: 1.1rem;
    font-weight: bold;
    padding: 10px;
}
.report-table .day-number {
    font-weight: bold;
    color: var(--text);
}
.report-table .worked-hours-report {
    color: var(--pink);
    font-size: 0.75rem;
    margin-top: 4px;
}
.report-table .weekend {
    background-color: var(--panel-hover);
}
.report-table .total-row {
    background-color: var(--panel);
    font-weight: bold;
    color: var(--cyan);
}

/* ============================================================
   MOBILE STYLES
   ============================================================ */
@media (max-width: 768px) {
    .menu-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.6);
        backdrop-filter: blur(2px);
        z-index: 998;
        display: none;
    }
    .menu-overlay.active { display: block; }

    .header {
        padding: 10px 15px;
    }

    /* Ховаємо всі іконки з шапки на мобільних пристроях */
    .header-actions {
        display: none !important;
    }

    /* ПРИХОВУЄМО ім'я та роль у шапці на мобільних пристроях */
    .pc-only, .header-user-pc {
        display: none !important;
    }

    /* Додаємо відступ знизу, щоб контент не ховався за нижнім меню.
       Враховуємо висоту меню (65px) + запас + safe area для iPhone */
    #app {
        padding-bottom: calc(75px + env(safe-area-inset-bottom));
    }

    /* Приховуємо ім'я та роль у мобільному меню */
    .menu-user-info.mobile-only {
        display: none !important;
    }
    .header-sep, #header-board-name { display: none; }

    .sidebar {
        display: none; /* Hide on mobile to prioritize bottom-nav */
    }

    .board {
        flex-direction: column; /* Колонки розташовуються вертикально */
        overflow-x: hidden; /* Приховуємо горизонтальний скрол */
        overflow-y: auto; /* Дозволяємо вертикальний скрол для всієї дошки */
        height: auto; /* Висота визначається вмістом */
        padding: 15px;
    }
    .column {
        width: 100%;
        min-width: unset; /* Прибираємо мінімальну ширину */
        margin-bottom: 15px; /* Відступ між колонками */
        max-height: unset; /* Прибираємо максимальну висоту */
    }
    .column-header { cursor: pointer; } /* Робимо заголовок клікабельним */
    .column.expanded .column-header { border-bottom: 2px solid var(--pink); } /* Додаємо рамку при розгорнутій колонці */
    .column-header .toggle-icon {
        display: block; /* Показуємо тільки на мобілці */
    }
    .column.expanded .column-header .toggle-icon { 
        transform: rotate(45deg); /* Повертаємо вниз при розгортанні */
    }
    .cards-container {
        display: none; /* Приховано за замовчуванням на мобільних */
        overflow-y: unset; /* Прибираємо внутрішній скрол для контейнера карток */
        padding: 10px;
    }
    .column.expanded .cards-container {
        display: flex; /* Показуємо, коли колонка розгорнута */
    }

    /* Приховуємо стрілки в галереї на мобільних, оскільки є свайпи */
    #image-prev-btn, #image-next-btn { display: none !important; }

    /* Налаштування модального вікна проекту для мобільних */
    .modal-box { padding: 20px 15px; }
    .modal-content {
        display: flex;
        flex-direction: column;
    }
    .project-detail {
        display: contents; /* Дозволяє керувати порядком дочірніх елементів */
    }
    .project-detail-left {
        display: contents;
    }
    #main-project-image {
        order: 1; /* Фото обкладинки найпершим */
        width: 100% !important;
        max-height: 350px;
        object-fit: cover;
        margin-bottom: 15px;
    }
    .renders-gallery {
        display: block !important; /* Повертаємо видимість галереї на мобільних */
        order: 2; /* Розміщуємо відразу під головною обкладинкою */
        margin-bottom: 20px;
    }
    .renders-gallery .project-section-label {
        margin-bottom: 10px;
    }
    .project-title-container {
        order: 3; /* Заголовок тепер після галереї */
        margin-bottom: 5px !important;
    }
    .project-brand {
        order: 4;
        margin-bottom: 15px !important;
    }
    .project-detail-right {
        order: 5;
        display: flex;
        margin-top: 15px; /* Додаємо відступ зверху */
        flex-direction: column;
        gap: 12px;
    }
    .project-section { margin-bottom: 10px; }
    .project-upload-section {
        display: none !important; /* Панель завантаження залишаємо прихованою для економії місця */
        /* Reset desktop styles */
        padding: 0;
        border: none;
        border-radius: 0;
    }
    .dates-grid {
        order: 6;
        margin-top: 15px;
        padding-top: 15px;
        border-top: 1px solid var(--border);
        gap: 5px;
        /* Reset desktop styles */
        padding: 0;
        border: none;
        background: transparent;
    }
    .comments-section {
        order: 7;
        margin-top: 25px;
    }
}

/* Ховаємо мобільні елементи на десктопі */
@media (min-width: 769px) {
    .mobile-only {
        display: none !important;
    }
    .pc-only {
        display: none !important;
    }
    /* Reset desktop styles for modal-project */
    #modal-project .modal-box {
        padding: 20px 15px; /* Restore mobile padding */
    }
}

@media (min-width: 769px) {
    .pc-only {
        display: flex !important;
    }
}

/* Reset desktop styles for modal-project on mobile */
@media (max-width: 768px) {
    #modal-project .modal-box {
        width: 100vw;
        max-width: 100vw;
        height: 100vh;
        max-height: 100vh;
        padding: 20px;
        border-radius: 0;
        border: none;
        flex-direction: column;
        justify-content: center;
        gap: 10px;
        background: var(--panel); /* Restore original background for mobile */
    }
    #modal-project #modal-content {
        padding: 0; /* Reset padding */
        gap: 10px; /* Reset gap */
        background: transparent; /* Remove background */
        border: none; /* Remove border */
    }
    #modal-project .project-title-container {
        flex-direction: column;
        align-items: flex-start;
        margin-bottom: 5px;
        padding-bottom: 5px;
        border-bottom: 1px solid var(--border);
    }
    #modal-project .project-title-container .project-title {
        font-size: 1.2rem;
    }
    #modal-project .project-title-container span:not(.project-title) {
        font-size: 0.8rem;
    }

    #modal-project #modal-content > .btn-ghost,
    #modal-project #modal-content > .project-brand {
        margin-bottom: 0;
    }

    #modal-project .project-detail-left,
    #modal-project .project-detail-right {
        gap: 10px;
    }

    #modal-project .card-urgent-badge {
        padding: 6px 10px;
        font-size: 0.8rem;
        margin-bottom: 8px;
        display: inline-block; /* Restore inline-block for mobile */
        background: #ff0000; /* Restore original red for mobile */
        box-shadow: none; /* Remove shadow for mobile */
    }

    #modal-project #main-project-image,
    #modal-project .no-image {
        height: auto;
        max-height: 350px;
        margin-bottom: 0;
    }

    #modal-project .renders-gallery {
        margin-top: 16px;
    }

    #modal-project .project-upload-section {
        margin-top: 10px;
        padding: 0;
        border: none;
        border-radius: 0;
    }

    #modal-project .dates-grid {
        margin-top: 15px;
        padding: 0;
        border: none;
        background: transparent;
        gap: 5px;
    }
    #modal-project .dates-grid .date-item {
        flex-direction: row; /* Restore row direction for mobile */
        justify-content: space-between;
        align-items: center;
        padding-bottom: 5px;
        border-bottom: 1px solid var(--border);
    }
    #modal-project .dates-grid .date-item:last-child {
        border-bottom: none;
        padding-bottom: 0;
    }
    #modal-project .dates-grid .date-item label {
        margin-bottom: 0;
    }
    #modal-project .dates-grid .date-item span,
    #modal-project .dates-grid .date-item input {
        text-align: right;
    }
    #modal-project .dates-grid .date-item input {
        border: none;
        padding: 0;
    }

    /* Reset borders for mobile sections in project-detail-right */
    #modal-project .project-detail-right > .project-section:nth-child(1),
    #modal-project .project-detail-right > .project-section:nth-child(2),
    #modal-project .project-detail-right > .project-section:nth-child(3),
    #modal-project .project-detail-right > #edit-order-number-group,
    #modal-project .project-detail-right > .project-section:nth-child(5),
    #modal-project .project-detail-right > .project-section:nth-child(6),
    #modal-project .project-detail-right > .project-section:nth-child(7),
    #modal-project .project-detail-right > #edit-original-tz-group,
    #modal-project .project-detail-right > div:nth-last-child(3),
    #modal-project .project-detail-right > div:nth-last-child(2) {
        border: none;
        padding: 0;
        margin-top: 0;
        margin-bottom: 0;
    }
    #modal-project .project-detail-right > div:nth-last-child(3) {
        margin-top: 15px;
    }
    #modal-project .project-detail-right > div:nth-last-child(2) {
        margin-top: 8px;
    }

    #modal-project .comments-section {
        margin-top: 25px;
        padding-top: 12px;
        border-top: 1px solid var(--border);
    }

    #modal-project #modal-content > div[style*="margin-top:24px; padding-top:12px; border-top:1px solid var(--border);"] {
        flex-direction: column;
        align-items: flex-start;
        margin-top: 15px !important;
        padding-top: 12px !important;
        border-top: 1px solid var(--border) !important;
    }
}

/* General project-section margin adjustment */
#modal-project .project-section {
    margin-bottom: 8px; /* Default reduced margin */
}
#modal-project .project-section:last-child {
    margin-bottom: 0;
}

/* ---- DESIGNER ACTIVITY WIDGET ---- */
.activity-widget {
    background-color: var(--panel);
    border-radius: 24px;
    padding: 20px;
    margin-bottom: 25px;
    box-shadow: var(--card-shadow);
    border: 1px solid var(--border);
}
.activity-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}
.activity-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    letter-spacing: -0.01em;
}
.period-selector {
    background-color: var(--bg);
    padding: 6px 12px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    border: 1px solid var(--border);
    transition: opacity 0.2s;
}
.period-selector span {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text);
}
.metrics-grid-ds {
    display: flex;
    justify-content: space-between;
}
.metric-item-ds {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    position: relative;
}
.metric-item-ds:not(:last-child)::after {
    content: "";
    position: absolute;
    right: 0;
    top: 20%;
    bottom: 20%;
    width: 1px;
    background-color: var(--border);
}
.icon-circle-ds {
    width: 38px;
    height: 38px;
    background-color: var(--bg);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
    color: var(--cyan);
}
.metric-value-ds {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--text);
    line-height: 1;
}
.metric-label-ds {
    display: flex;
    flex-direction: column;
    margin-top: 5px;
}
.metric-label-ds span {
    font-size: 0.6rem;
    font-weight: 500;
    color: var(--text-dim);
    line-height: 1.2;
    text-transform: lowercase;
}

/* ---- DESIGNER CATEGORY GRID ---- */
.ds-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding: 0 4px;
}
.ds-section-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    letter-spacing: -0.01em;
}
.ds-all-link {
    color: var(--cyan);
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: none;
    transition: opacity 0.2s;
}
.ds-all-link:hover { opacity: 0.7; }

.ds-category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(85px, 1fr));
    gap: 10px;
    margin-bottom: 30px;
}
@media (max-width: 480px) {
    .ds-category-grid {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    }
}

.ds-category-card {
    background: var(--panel);
    border-radius: 20px;
    padding: 24px;
    border: 1px solid var(--border);
    box-shadow: var(--card-shadow);
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: transform 0.2s ease;
    cursor: pointer;
}
.ds-category-card:active { transform: scale(0.96); }
.ds-category-img-container {
    width: 100%;
    aspect-ratio: 1.2;
    background: var(--bg);
    border-radius: 14px;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--cyan);
}
.ds-category-img-container svg {
    width: 48px !important;
    height: 48px !important;
}
.ds-category-title { font-weight: 700; font-size: 1rem; color: var(--text); text-align: center; line-height: 1.1; }
.ds-category-count { font-size: 0.85rem; color: var(--text-dim); margin-top: 4px; }

/* ---- SCROLLBAR ---- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }
/* ---- VIEWER DASHBOARD ---- */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}
.kpi-card {
    background: var(--panel);
    border: 1px solid var(--border);
    padding: 24px;
    border-radius: var(--radius);
    position: relative;
    overflow: hidden;
}
.kpi-card.highlight-cyan { border-color: var(--cyan); box-shadow: 0 0 20px rgba(var(--cyan-rgb),0.05); }
.kpi-label { font-size: 0.7rem; letter-spacing: 1.5px; color: var(--text-dim); text-transform: uppercase; margin-bottom: 10px; }
.kpi-value { font-size: 2.2rem; font-weight: 800; color: var(--text); line-height: 1; margin-bottom: 8px; }
.kpi-sub { font-size: 0.75rem; color: var(--text-dim); opacity: 0.7; }

.viewer-search-section { margin-bottom: 30px; position: relative; }
.search-box-wrapper {
    display: flex;
    align-items: center;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 30px;
    transition: border-color 0.3s;
}
.search-box-wrapper:focus-within { border-color: var(--cyan); }
#viewer-project-search {
    width: 100%;
    background: none;
    border: none;
    padding: 14px 20px;
    color: var(--text);
    font-family: inherit;
    outline: none;
}
.search-results-overlay {
    position: absolute;
    top: 100%; left: 0; right: 0;
    background: var(--panel);
    border: 1px solid var(--cyan);
    z-index: 10;
    margin-top: 5px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}
.search-result-item {
    padding: 12px 20px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    display: flex; flex-direction: column;
}
.search-result-item:hover { background: var(--panel-hover); }
.search-result-item span { font-size: 0.7rem; color: var(--text-dim); }

.viewer-main-layout { display: grid; grid-template-columns: 1.5fr 1fr; gap: 30px; }
@media (max-width: 900px) { .viewer-main-layout { grid-template-columns: 1fr; } }

.viewer-content-block {
    background: var(--panel);
    border: 1px solid var(--border);
    padding: 25px;
    border-radius: var(--radius);
}

/* Distribution Bars */
.dist-row { margin-bottom: 18px; }
.dist-info { display: flex; justify-content: space-between; margin-bottom: 6px; font-size: 0.8rem; }
.dist-bar-bg { height: 6px; background: rgba(255,255,255,0.05); border-radius: 3px; overflow: hidden; }
.dist-bar-fill { height: 100%; background: var(--cyan); box-shadow: 0 0 10px var(--cyan); border-radius: 3px; }

/* Pulse Timeline */
/* (Ця секція була видалена з home.js, але стилі залишаються, якщо знадобляться) */
.activity-timeline { position: relative; padding-left: 20px; }
.activity-timeline::before {
    content: '';
    position: absolute; left: 4px; top: 5px; bottom: 0;
    width: 2px; background: var(--border);
}
.timeline-item { position: relative; margin-bottom: 20px; }
.timeline-dot {
    position: absolute; left: -20px; top: 5px;
    width: 10px; height: 10px; border-radius: 50%;
    background: var(--bg); border: 2px solid var(--cyan);
}
.timeline-content { padding-left: 10px; }
.timeline-title { font-size: 0.85rem; font-weight: 700; color: var(--text); }
.timeline-body { font-size: 0.8rem; color: var(--text-dim); margin: 2px 0; }
.timeline-time { font-size: 0.65rem; color: var(--cyan); opacity: 0.6; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

/* ---- HOME LAYOUT 60/40 SPLIT ---- */
.home-layout-row {
    display: flex;
    flex-wrap: wrap; /* responsive wrap */
    gap: 20px;
    margin-top: 20px;
    align-items: stretch;
}

.home-col-left {
    flex: 3; /* 60% relative to 40% (which is flex: 2) */
    min-width: 300px;
    display: flex;
    flex-direction: column;
}

.home-col-right {
    flex: 2; /* 40% relative to 60% (which is flex: 3) */
    min-width: 280px;
}

@media (max-width: 900px) {
    .home-layout-row {
        flex-direction: column;
    }
    .home-col-left, .home-col-right {
        flex: 1;
        width: 100%;
    }
}

/* ---- TO DO WIDGET STYLING ---- */
.todo-widget {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--card-shadow);
}

.todo-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: background 0.2s, border-color 0.2s;
}

.todo-item:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.15);
}

.todo-item-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

/* Custom Round Checkbox */
.todo-checkbox {
    appearance: none;
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border: 2px solid var(--text-dim);
    border-radius: 50%;
    outline: none;
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.todo-checkbox:hover {
    border-color: var(--cyan);
}

.todo-checkbox:checked {
    background-color: var(--cyan);
    border-color: var(--cyan);
}

.todo-checkbox:checked::after {
    content: '';
    position: absolute;
    width: 5px;
    height: 9px;
    border: solid var(--bg);
    border-width: 0 2px 2px 0;
    transform: rotate(45deg) translate(0px, -1px);
    display: block;
}

.todo-text {
    font-size: 0.9rem;
    color: var(--text);
    word-break: break-word;
    transition: all 0.2s ease;
    user-select: none;
    cursor: pointer;
}

.todo-text.completed {
    text-decoration: line-through;
    opacity: 0.5;
    color: var(--text-dim);
}

.todo-delete-btn {
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    opacity: 0.6;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    border-radius: 4px;
}

.todo-delete-btn:hover {
    opacity: 1;
    color: var(--pink);
    background: rgba(255, 170, 229, 0.1);
}

/* ---- TO DO SUBTASKS STYLING ---- */
.todo-item-container {
    background: rgba(255, 255, 255, 0.01);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Override .todo-item inside container to have no extra border/bg */
.todo-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0;
    background: none;
    border: none;
}

.todo-item-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.todo-action-btn {
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    opacity: 0.6;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    border-radius: 4px;
}

.todo-action-btn:hover, .todo-action-btn.active {
    opacity: 1;
    color: var(--cyan);
    background: rgba(var(--cyan-rgb), 0.1);
}

.todo-subtasks-wrapper {
    margin-left: 28px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    border-left: 1px dashed var(--border);
    padding-left: 10px;
}

.todo-subtask-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 8px;
    background: rgba(255, 255, 255, 0.015);
    border: 1px solid rgba(255, 255, 255, 0.03);
    border-radius: 4px;
    transition: background 0.2s;
}

.todo-subtask-item:hover {
    background: rgba(255, 255, 255, 0.03);
}

/* Scale down checkboxes for subtasks */
.todo-subtask-checkbox {
    width: 16px;
    height: 16px;
    border-width: 1.5px;
}

.todo-subtask-checkbox:checked::after {
    width: 4px;
    height: 7px;
    border-width: 0 1.5px 1.5px 0;
    transform: rotate(45deg) translate(0px, -1px);
}

.todo-subtask-text {
    font-size: 0.8rem;
}

.todo-subtask-delete-btn {
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    opacity: 0.5;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3px;
    border-radius: 3px;
}

.todo-subtask-delete-btn:hover {
    opacity: 1;
    color: var(--pink);
    background: rgba(255, 170, 229, 0.08);
}

.todo-subtask-input-row {
    display: flex;
    gap: 6px;
    margin-top: 4px;
    align-items: center;
}

.todo-subtask-input {
    height: 28px;
    padding: 0 8px;
    font-size: 0.75rem;
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text);
    outline: none;
    border-radius: var(--radius);
    flex: 1;
    margin-bottom: 0;
}

.todo-subtask-input:focus {
    border-color: var(--cyan);
}

/* Inline edit (double-click) */
.todo-inline-edit {
    flex: 1;
    background: var(--bg);
    border: 1px solid var(--cyan);
    border-radius: 4px;
    color: var(--text);
    font-size: 0.9rem;
    font-family: inherit;
    padding: 2px 8px;
    outline: none;
    width: 100%;
    min-width: 0;
    box-shadow: 0 0 0 2px rgba(var(--cyan-rgb), 0.15);
}

.todo-subtask-inline-edit {
    font-size: 0.8rem;
}

.todo-empty-msg {
    color: var(--text-dim);
    text-align: center;
    padding: 20px 0;
    font-size: 0.85rem;
    font-style: italic;
}

/* ---- TODO: Drag handle ---- */
.todo-drag-handle {
    cursor: grab;
    display: flex;
    align-items: center;
    padding: 0 4px 0 2px;
    color: var(--text-dim);
    opacity: 0.4;
    flex-shrink: 0;
    transition: opacity 0.15s;
}
.todo-drag-handle:hover { opacity: 1; }
.todo-drag-handle:active { cursor: grabbing; }

/* ---- TODO: Priority colors (left border) ---- */
.todo-item-container.priority-grey  { border-left: 3px solid #7f8c8d; }
.todo-item-container.priority-low   { border-left: 3px solid transparent; }
.todo-item-container.priority-mid   { border-left: 3px solid #f5c542; }
.todo-item-container.priority-high  { border-left: 3px solid #e74c3c; }

/* ---- TODO: Priority button ---- */
.todo-priority-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px 3px;
    border-radius: 4px;
    font-size: 1rem;
    line-height: 1;
    display: flex;
    align-items: center;
    transition: transform 0.15s, background 0.15s;
    flex-shrink: 0;
}
.todo-priority-btn:hover {
    transform: scale(1.25);
    background: rgba(255,255,255,0.06);
}

/* ---- TODO: Drag & Drop states ---- */
.todo-item-container.todo-dragging {
    opacity: 0.4;
    transform: scale(0.98);
}
.todo-item-container.todo-drag-over {
    outline: 2px dashed var(--cyan);
    outline-offset: 2px;
    background: rgba(var(--cyan-rgb), 0.05);
}

/* ---- Comment image insertion styling ---- */
.comment-input-wrapper {
    position: relative;
    flex: 1;
    display: flex;
}
.comment-input-wrapper .comment-input {
    padding-right: 36px; /* Space for the attachment button */
}
.comment-attach-btn {
    position: absolute;
    right: 8px;
    bottom: 8px;
    background: transparent;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    border-radius: 4px;
    transition: all 0.2s ease;
}
.comment-attach-btn:hover {
    color: var(--cyan);
    background: rgba(var(--cyan-rgb), 0.1);
}
.comment-image-wrapper {
    margin-top: 6px;
    max-width: 100%;
}
.comment-image {
    max-width: 100%;
    max-height: 250px;
    border-radius: 6px;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: block;
}
.comment-image:hover {
    transform: scale(1.01);
    box-shadow: 0 4px 12px rgba(var(--cyan-rgb), 0.15);
}

/* ---- Comment done state ---- */
.comment.comment--done {
    background: #0a2e1c !important; /* Dark Green background */
    border-left: 2px solid #2ecc71 !important;
}
.comment.comment--done .comment-text {
    color: #e2e8f0;
}
.comment.comment--done .comment-date {
    color: rgba(255, 255, 255, 0.5);
}
.comment.comment--done .comment-author {
    color: #2ecc71;
}

[data-theme="light"] .comment.comment--done {
    background: #145a32 !important; /* Rich Dark Green background for light mode */
    border-left: 2px solid #28a745 !important;
}
[data-theme="light"] .comment.comment--done .comment-text {
    color: #f4f6f7;
}
[data-theme="light"] .comment.comment--done .comment-date {
    color: rgba(255, 255, 255, 0.6);
}
[data-theme="light"] .comment.comment--done .comment-author {
    color: #2ecc71;
}

/* ---- STANDARDS PAGE STYLING ---- */
.standards-sidebar {
    width: 220px;
    background: var(--panel);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 16px;
    gap: 6px;
    flex-shrink: 0;
}
.standards-menu-item {
    text-align: left;
    background: none;
    border: none;
    color: var(--text-dim);
    padding: 10px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
}
.standards-menu-item svg {
    opacity: 0.6;
    transition: opacity 0.2s;
}
.standards-menu-item:hover {
    background: var(--panel-hover);
    color: var(--text);
}
.standards-menu-item:hover svg {
    opacity: 1;
}
.standards-menu-item.active {
    background: rgba(var(--cyan-rgb), 0.08);
    color: var(--cyan);
}
.standards-menu-item.active svg {
    color: var(--cyan);
    opacity: 1;
}
.standards-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    font-size: 0.82rem;
}
.standards-table th {
    background: rgba(255, 255, 255, 0.02);
    color: var(--cyan);
    font-weight: 600;
    text-align: left;
    padding: 10px 12px;
    border-bottom: 2px solid var(--border);
}
.standards-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
}
.standards-table tr:hover td {
    background: rgba(var(--cyan-rgb), 0.02);
}
.standards-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 18px;
    margin-bottom: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s ease, border-color 0.2s ease;
}
.standards-card:hover {
    transform: translateY(-2px);
    border-color: rgba(var(--cyan-rgb), 0.25);
    box-shadow: 0 8px 20px rgba(var(--cyan-rgb), 0.06);
}
.standards-tab-content h2 {
    font-weight: 700;
    letter-spacing: 0.5px;
}

/* ---- STANDARDS PAGE RESPONSIVE STYLING ---- */
@media (max-width: 768px) {
    #standards-view {
        flex-direction: column !important;
    }
    .standards-sidebar {
        width: 100%;
        height: auto;
        flex-direction: row;
        border-right: none;
        border-bottom: 1px solid var(--border);
        padding: 10px 16px;
        gap: 10px;
        justify-content: space-around;
        flex-shrink: 0;
    }
    .standards-menu-item {
        justify-content: center;
        text-align: center;
        font-size: 0.8rem;
        padding: 8px 12px;
        flex: 1;
    }
    .standards-content {
        padding: 16px !important;
    }
    .standards-table {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .standards-table th,
    .standards-table td {
        min-width: 90px;
        white-space: normal;
    }
    .standards-table th:nth-child(2),
    .standards-table td:nth-child(2) {
        min-width: 160px;
    }
    .standards-table th:nth-child(3),
    .standards-table td:nth-child(3) {
        min-width: 140px;
    }
}
.mini-project-row {
    transition: border-color 0.2s, background-color 0.2s !important;
}
.mini-project-row:hover {
    border-color: var(--cyan) !important;
    background: rgba(var(--cyan-rgb),0.02) !important;
}

/* ---- ACCESSIBILITY: BIG FONTS MODE ---- */
html[data-font-size="big"] {
    font-size: 22px !important;
}
html[data-font-size="big"] * {
    font-family: Arial, Helvetica, sans-serif !important;
}
html[data-font-size="big"] *:not(strong):not(b):not(h1):not(h2):not(h3):not(h4):not(h5):not(h6):not(.home-section-title):not(.ds-section-title):not(.user-card-role):not(.card-brand):not(.card-type):not(.kpi-label):not(label):not(th) {
    font-weight: 500 !important; /* Prevents thin fonts, ensures solid/thick letters */
}
html[data-font-size="big"] strong,
html[data-font-size="big"] b,
html[data-font-size="big"] h1,
html[data-font-size="big"] h2,
html[data-font-size="big"] h3,
html[data-font-size="big"] h4,
html[data-font-size="big"] h5,
html[data-font-size="big"] h6,
html[data-font-size="big"] .home-section-title,
html[data-font-size="big"] .ds-section-title,
html[data-font-size="big"] .user-welcome p,
html[data-font-size="big"] .user-card-role,
html[data-font-size="big"] .card-brand,
html[data-font-size="big"] .card-type,
html[data-font-size="big"] .kpi-label,
html[data-font-size="big"] label,
html[data-font-size="big"] th {
    font-weight: 800 !important; /* Very thick and solid headers/bold text */
}



