/* ===== Reset & Base ===== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg: #1a1b2e;
    --bg-card: #232440;
    --bg-input: #2c2d4f;
    --text: #e8e8f0;
    --text-muted: #9294b8;
    --accent: #7c6bf0;
    --accent-hover: #9584f7;
    --accent-glow: rgba(124, 107, 240, 0.15);
    --green: #4ade80;
    --green-bg: rgba(74, 222, 128, 0.12);
    --red: #f87171;
    --red-bg: rgba(248, 113, 113, 0.12);
    --orange: #fb923c;
    --orange-bg: rgba(251, 146, 60, 0.12);
    --border: #3a3b5c;
    --radius: 12px;
    --shadow: 0 2px 12px rgba(0,0,0,0.25);
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.5;
}

/* ===== App Container ===== */
.app {
    max-width: 1440px;
    margin: 0 auto;
    padding: 20px 24px 60px;
}

/* ===== Header ===== */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 0 28px;
    gap: 16px;
    flex-wrap: wrap;
}

.header-content {
    text-align: left;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    font-size: 36px;
    filter: drop-shadow(0 2px 8px rgba(124, 107, 240, 0.4));
}

.header h1 {
    font-size: 26px;
    font-weight: 700;
    color: var(--text);
    background: linear-gradient(135deg, #e8e8f0, #9584f7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    color: var(--text-muted);
    font-size: 14px;
    margin-top: 4px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.btn-refresh-sync {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    color: var(--text);
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}

.btn-refresh-sync:hover {
    background: var(--bg-input);
    border-color: var(--green);
    color: var(--green);
    transform: translateY(-1px);
}

.refresh-icon {
    display: inline-block;
    transition: transform 0.3s;
}

.refresh-icon.spinning {
    animation: refreshSpin 0.9s linear infinite;
}

@keyframes refreshSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.btn-github-sync {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    color: var(--text);
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}

.btn-github-sync:hover {
    background: var(--bg-input);
    border-color: var(--accent);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(124, 107, 240, 0.2);
}

.gh-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
    transition: all 0.2s;
}

.gh-status-dot.connected {
    background: var(--green);
    box-shadow: 0 0 8px var(--green);
}

.gh-status-dot.error {
    background: var(--red);
    box-shadow: 0 0 8px var(--red);
}

/* ===== Two Column Layout ===== */
.two-col-layout {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 24px;
    align-items: start;
}

/* ===== Left Panel ===== */
.left-panel {
    position: sticky;
    top: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* ===== Add Member Section ===== */
.add-member-section {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.add-member-section h2 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 14px;
}

.add-form-vertical {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.add-form-vertical input {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-family: inherit;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.add-form-vertical input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.add-form-vertical input::placeholder {
    color: var(--text-muted);
}

/* ===== Role Picker ===== */
.role-picker-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.role-label {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
}

.role-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.role-tag {
    padding: 5px 12px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: var(--bg-input);
    color: var(--text-muted);
    font-family: inherit;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
}

.role-tag:hover {
    border-color: var(--accent);
    color: var(--text);
    background: rgba(124, 107, 240, 0.08);
}

.role-tag.selected {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
    box-shadow: 0 2px 8px rgba(124, 107, 240, 0.3);
}

/* ===== Summary Section (Left Sidebar on Desktop) ===== */
.summary-section {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.summary-section h2 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 14px;
    color: var(--text);
}

.summary-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}

.summary-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: var(--bg-input);
    border-radius: 8px;
    font-size: 13px;
    border: 1px solid rgba(255, 255, 255, 0.04);
}

.summary-item .label {
    color: var(--text-muted);
    font-size: 12px;
}

.summary-item .value {
    font-weight: 600;
    color: var(--text);
    font-size: 14px;
}

.summary-item .value.accent {
    color: var(--accent);
}

.summary-item .value.green {
    color: var(--green);
}

.summary-progress {
    margin-top: 4px;
    background: var(--bg-input);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.04);
    padding: 10px 14px;
}

.summary-progress .progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.summary-progress .label {
    font-size: 12px;
    color: var(--text-muted);
}

.summary-progress .value {
    font-size: 14px;
    font-weight: 600;
}

.summary-progress .progress-bar {
    width: 100%;
    height: 6px;
    background: var(--bg);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 8px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--green));
    border-radius: 3px;
    transition: width 0.4s ease;
}

/* ===== Right Panel ===== */
.right-panel {
    min-width: 0;
}

/* ===== Members Grid — 2 columns ===== */
.members-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

/* ===== Buttons ===== */
.btn {
    padding: 10px 18px;
    border: none;
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s, box-shadow 0.2s;
    white-space: nowrap;
}

.btn:active {
    transform: scale(0.97);
}

.btn-add-member {
    background: var(--accent);
    color: #fff;
    width: 100%;
}

.btn-add-member:hover {
    background: var(--accent-hover);
    box-shadow: 0 4px 16px rgba(124, 107, 240, 0.3);
}

.btn-add-task {
    background: var(--accent);
    color: #fff;
    padding: 8px 14px;
    font-size: 13px;
}

.btn-add-task:hover {
    background: var(--accent-hover);
}

.btn-icon {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    font-size: 16px;
    transition: background 0.2s, color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    background: var(--bg-input);
    color: var(--text);
}

.btn-icon.delete:hover {
    background: var(--red-bg);
    color: var(--red);
}

.btn-cancel {
    background: var(--bg-input);
    color: var(--text-muted);
}

.btn-cancel:hover {
    background: var(--border);
    color: var(--text);
}

.btn-save {
    background: var(--accent);
    color: #fff;
}

.btn-save:hover {
    background: var(--accent-hover);
}

.btn-delete {
    background: var(--red);
    color: #fff;
}

.btn-delete:hover {
    background: #ef4444;
}

/* ===== Member Card ===== */
.member-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    animation: fadeIn 0.25s ease;
    transition: border-color 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
}

.member-card:hover {
    border-color: rgba(124, 107, 240, 0.3);
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.member-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    gap: 8px;
}

.member-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.member-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), #9584f7);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 15px;
    color: #fff;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(124, 107, 240, 0.3);
}

.member-name {
    font-weight: 600;
    font-size: 14px;
}

.member-roles {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    margin-top: 3px;
}

.member-role {
    font-size: 10px;
    color: var(--text-muted);
    background: var(--bg-input);
    padding: 1px 8px;
    border-radius: 20px;
    display: inline-block;
    white-space: nowrap;
}

.member-actions {
    display: flex;
    gap: 2px;
    flex-shrink: 0;
}

/* ===== Task Area ===== */
.task-area {
    padding: 12px 16px;
    flex: 1;
}

.add-task-form {
    display: flex;
    gap: 6px;
    margin-bottom: 10px;
}

.add-task-form input {
    flex: 1;
    padding: 7px 10px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-family: inherit;
    font-size: 12px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    min-width: 0;
}

.add-task-form input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.add-task-form input::placeholder {
    color: var(--text-muted);
}

/* ===== File Upload Button ===== */
.btn-attach {
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 7px 10px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    flex-shrink: 0;
}

.btn-attach:hover {
    border-color: var(--accent);
    color: var(--text);
    background: rgba(124, 107, 240, 0.08);
}

.btn-attach input[type="file"] {
    display: none;
}

/* ===== Task Item ===== */
.task-list {
    list-style: none;
}

.task-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 8px;
    margin-bottom: 5px;
    transition: background 0.15s;
    background: var(--bg-input);
}

.task-item:hover {
    background: #33345a;
}

.task-checkbox {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid var(--border);
    border-radius: 4px;
    cursor: pointer;
    flex-shrink: 0;
    position: relative;
    transition: background 0.2s, border-color 0.2s;
    margin-top: 2px;
}

.task-checkbox:checked {
    background: var(--green);
    border-color: var(--green);
}

.task-checkbox:checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #1a1b2e;
    font-size: 12px;
    font-weight: 700;
}

.task-content {
    flex: 1;
    min-width: 0;
}

.task-name {
    font-size: 13px;
    font-weight: 500;
    transition: color 0.2s;
    word-break: break-word;
}

.task-name.done {
    text-decoration: line-through;
    color: var(--text-muted);
}

.task-date {
    font-size: 10px;
    color: var(--green);
    margin-top: 2px;
}

/* ===== File Attachment Display ===== */
.task-files {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 4px;
}

.file-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    background: var(--orange-bg);
    border: 1px solid rgba(251, 146, 60, 0.25);
    border-radius: 12px;
    font-size: 10px;
    color: var(--orange);
    cursor: pointer;
    transition: all 0.2s;
    max-width: 170px;
    text-decoration: none;
}

.file-badge:hover {
    background: rgba(251, 146, 60, 0.25);
    border-color: var(--orange);
}

.file-badge.github-badge {
    background: rgba(124, 107, 240, 0.15);
    border-color: rgba(124, 107, 240, 0.35);
    color: #c4b5fd;
}

.file-badge.github-badge:hover {
    background: rgba(124, 107, 240, 0.25);
    border-color: var(--accent);
    color: #fff;
}

.file-badge .gh-tag {
    font-size: 9px;
    background: rgba(124, 107, 240, 0.35);
    color: #e0e7ff;
    padding: 0 4px;
    border-radius: 4px;
    font-weight: 600;
    margin-left: 2px;
}

.file-badge .btn-sync-file {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 10px;
    padding: 0 2px;
    color: var(--orange);
    transition: transform 0.15s;
}

.file-badge .btn-sync-file:hover {
    transform: scale(1.3);
}

.file-badge .file-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-badge .file-remove {
    background: none;
    border: none;
    color: var(--red);
    cursor: pointer;
    font-size: 10px;
    padding: 0 2px;
    opacity: 0;
    transition: opacity 0.15s;
    flex-shrink: 0;
}

.file-badge:hover .file-remove {
    opacity: 1;
}

.task-actions {
    display: flex;
    gap: 2px;
    opacity: 0;
    transition: opacity 0.15s;
    flex-shrink: 0;
}

.task-item:hover .task-actions {
    opacity: 1;
}

/* ===== No Tasks ===== */
.no-tasks {
    text-align: center;
    color: var(--text-muted);
    font-size: 12px;
    padding: 12px 0 4px;
}

/* ===== Empty State ===== */
.empty-state {
    text-align: center;
    padding: 80px 20px;
    color: var(--text-muted);
    grid-column: 1 / -1;
}

.empty-icon {
    font-size: 56px;
    display: block;
    margin-bottom: 16px;
    filter: drop-shadow(0 4px 12px rgba(0,0,0,0.3));
}

.empty-state p {
    font-size: 15px;
}

/* ===== Modal ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
    animation: fadeInOverlay 0.2s ease;
}

@keyframes fadeInOverlay {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    width: 100%;
    max-width: 480px;
    animation: slideUp 0.2s ease;
    box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}

@keyframes slideUp {
    from { transform: translateY(16px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal h3 {
    font-size: 18px;
    margin-bottom: 16px;
}

.modal input,
.modal select {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-family: inherit;
    font-size: 14px;
    outline: none;
    margin-bottom: 12px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.modal input:focus,
.modal select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.modal .role-picker-section {
    margin-bottom: 12px;
}

.modal-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.modal-header-row h3 {
    margin-bottom: 0;
}

.modal-confirm p {
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 20px;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* ===== File Preview Modal ===== */
.modal-file-preview {
    max-width: 640px;
    max-height: 80vh;
    overflow: auto;
}

.file-preview-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.file-preview-item {
    background: var(--bg-input);
    border-radius: 8px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.file-preview-item .file-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}

.file-preview-item .file-icon {
    font-size: 20px;
}

.file-preview-item .file-details {
    flex: 1;
}

.file-preview-item .file-details .name {
    font-weight: 600;
    color: var(--text);
}

.file-preview-item .file-details .size {
    font-size: 11px;
    color: var(--text-muted);
}

.file-preview-media-box {
    margin: 8px 0;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.25);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    overflow: hidden;
    min-height: 90px;
}

.file-preview-item .file-preview-image {
    max-width: 100%;
    max-height: 280px;
    border-radius: 6px;
    object-fit: contain;
    cursor: pointer;
    display: block;
    margin: 0 auto;
}

.file-img-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 24px 16px;
    color: var(--text-muted);
    font-size: 12px;
}

.file-img-loading .spinner-small {
    width: 22px;
    height: 22px;
    border: 2.5px solid rgba(255, 255, 255, 0.15);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: refreshSpin 0.8s linear infinite;
}

.file-img-error {
    padding: 16px;
    color: var(--red);
    font-size: 12px;
    text-align: center;
}

.file-preview-audio {
    margin: 8px 0;
    width: 100%;
}

.file-preview-audio audio {
    width: 100%;
    height: 40px;
    border-radius: 8px;
    outline: none;
    filter: invert(0.9) hue-rotate(180deg);
}

.file-preview-video {
    margin: 8px 0;
    width: 100%;
}

.file-preview-video video {
    max-width: 100%;
    max-height: 280px;
    border-radius: 8px;
    background: #000;
}

.file-preview-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 4px;
}

.file-preview-item .btn-download {
    padding: 6px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 6px;
    font-family: inherit;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.file-preview-item .btn-download:hover {
    background: var(--bg-input);
    border-color: var(--accent);
}

.btn-gh-link {
    padding: 6px 14px;
    background: rgba(124, 107, 240, 0.2);
    border: 1px solid var(--accent);
    color: #e0e7ff;
    border-radius: 6px;
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-gh-link:hover {
    background: var(--accent);
    color: #fff;
}

.btn-sync-action {
    padding: 6px 14px;
    background: rgba(251, 146, 60, 0.2);
    border: 1px solid var(--orange);
    color: #fed7aa;
    border-radius: 6px;
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-sync-action:hover {
    background: var(--orange);
    color: #fff;
}

.btn-delete-file-action {
    padding: 6px 14px;
    background: var(--red-bg);
    border: 1px solid rgba(248, 113, 113, 0.4);
    color: var(--red);
    border-radius: 6px;
    font-family: inherit;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.btn-delete-file-action:hover {
    background: var(--red);
    color: #fff;
}

/* 3D Preview Button */
.btn-3d-preview {
    padding: 6px 14px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.25), rgba(139, 92, 246, 0.35));
    border: 1px solid rgba(139, 92, 246, 0.6);
    color: #e0e7ff;
    border-radius: 6px;
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.15);
}

.btn-3d-preview:hover {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border-color: #a78bfa;
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
}

.file-preview-item .file-preview-image {
    max-width: 100%;
    max-height: 240px;
    border-radius: 8px;
    object-fit: cover;
    cursor: zoom-in;
    border: 1px solid var(--border);
    transition: transform 0.2s, border-color 0.2s;
}

.file-preview-item .file-preview-image:hover {
    transform: scale(1.01);
    border-color: var(--accent);
}

/* ===== 3D Model Viewer Modal ===== */
.modal-3d-viewer {
    max-width: 960px;
    width: 92vw;
    height: 82vh;
    display: flex;
    flex-direction: column;
    padding: 20px;
    background: #0f131d;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7);
    border-radius: 16px;
}

.model-viewer-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-tool {
    padding: 5px 12px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #cbd5e1;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.btn-tool:hover, .btn-tool.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.btn-texture-tool {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.25), rgba(217, 119, 6, 0.35)) !important;
    border-color: rgba(245, 158, 11, 0.5) !important;
    color: #fef3c7 !important;
}

.btn-texture-tool:hover {
    background: linear-gradient(135deg, #f59e0b, #d97706) !important;
    border-color: #f59e0b !important;
    color: #fff !important;
    transform: translateY(-1px);
}

.model-viewer-canvas-container {
    flex: 1;
    position: relative;
    overflow: hidden;
    background: radial-gradient(circle at center, #1e2436 0%, #0d1017 100%);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    margin-top: 12px;
}

.model-viewer-canvas-container canvas {
    width: 100% !important;
    height: 100% !important;
    display: block;
    outline: none;
    cursor: grab;
}

.model-viewer-canvas-container canvas:active {
    cursor: grabbing;
}

.model-loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(13, 16, 23, 0.85);
    backdrop-filter: blur(4px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    z-index: 10;
    color: #e2e8f0;
    font-size: 14px;
}

.model-viewer-info {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(15, 23, 42, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(8px);
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 11px;
    color: #94a3b8;
    pointer-events: none;
    white-space: nowrap;
    z-index: 5;
}

/* ===== Image Lightbox ===== */
.lightbox-container {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.95);
    padding: 16px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
}

.lightbox-container img {
    max-width: 85vw;
    max-height: 75vh;
    object-fit: contain;
    border-radius: 6px;
    display: block;
}

.lightbox-caption {
    margin-top: 10px;
    font-size: 13px;
    color: #cbd5e1;
    font-weight: 500;
}

.lightbox-close {
    position: absolute;
    top: -14px;
    right: -14px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #ef4444;
    border: 2px solid #fff;
    color: #fff;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    transition: transform 0.2s;
}

.lightbox-close:hover {
    transform: scale(1.1);
}

/* ===== GitHub Modal ===== */
.modal-github {
    max-width: 500px;
    width: 100%;
}

.modal-description {
    font-size: 13px;
    color: var(--text-muted);
    margin: 8px 0 16px;
    line-height: 1.4;
}

.form-row-2col {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 12px;
}

.input-with-action {
    position: relative;
    display: flex;
    align-items: center;
}

.input-with-action input {
    width: 100%;
    padding-right: 42px;
}

.btn-icon-addon {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    padding: 4px;
    color: var(--text-muted);
    border-radius: 4px;
}

.btn-icon-addon:hover {
    color: var(--text);
}

.required-star {
    color: var(--red);
}

.helper-text {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

.helper-text code {
    background: var(--bg-card);
    padding: 2px 5px;
    border-radius: 4px;
    color: var(--accent);
    font-size: 11px;
}

.form-group-checkbox {
    margin: 14px 0 18px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text);
    cursor: pointer;
}

.checkbox-label input {
    cursor: pointer;
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
}

.gh-test-result {
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 12px;
    margin-bottom: 16px;
    line-height: 1.5;
}

.gh-test-result.success {
    background: var(--green-bg);
    color: var(--green);
    border: 1px solid rgba(74, 222, 128, 0.3);
}

.gh-test-result.error {
    background: var(--red-bg);
    color: var(--red);
    border: 1px solid rgba(248, 113, 113, 0.3);
}

/* ===== Toast Notifications ===== */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 10000;
    pointer-events: none;
}

.toast {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 18px;
    color: var(--text);
    font-size: 13px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 280px;
    max-width: 420px;
    pointer-events: auto;
    animation: toastSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    backdrop-filter: blur(10px);
}

.toast.toast-success {
    border-color: rgba(74, 222, 128, 0.5);
    background: linear-gradient(135deg, var(--bg-card), rgba(74, 222, 128, 0.08));
}

.toast.toast-error {
    border-color: rgba(248, 113, 113, 0.5);
    background: linear-gradient(135deg, var(--bg-card), rgba(248, 113, 113, 0.08));
}

.toast.toast-info {
    border-color: rgba(124, 107, 240, 0.5);
    background: linear-gradient(135deg, var(--bg-card), rgba(124, 107, 240, 0.08));
}

.toast-icon {
    font-size: 16px;
    flex-shrink: 0;
}

.toast-message {
    flex: 1;
    word-break: break-word;
}

@keyframes toastSlideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.hidden {
    display: none !important;
}

/* ===== Stats Badge ===== */
.stats-badge {
    font-size: 11px;
    color: var(--text-muted);
    margin-left: auto;
    margin-right: 4px;
    white-space: nowrap;
}

.stats-badge .done-count {
    color: var(--green);
    font-weight: 600;
}

/* ===== Responsive & Mobile Scaling ===== */
@media (hover: none) and (pointer: coarse) {
    .task-actions {
        opacity: 1 !important;
    }
    .file-badge .file-remove {
        opacity: 1 !important;
    }
}

@media (max-width: 1100px) {
    .members-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 860px) {
    .summary-section {
        width: 100%;
        box-sizing: border-box;
        margin-bottom: 16px;
        padding: 14px 16px;
    }

    .summary-grid {
        display: grid;
        grid-template-columns: repeat(6, 1fr);
        gap: 8px;
        width: 100%;
    }

    /* Row 1: 3 Task stats (33.3% each) */
    .summary-item.item-tasks,
    .summary-item.item-done,
    .summary-item.item-pending {
        grid-column: span 2;
    }

    /* Row 2: 2 Team & File stats (50% each) */
    .summary-item.item-members,
    .summary-item.item-files {
        grid-column: span 3;
    }

    .summary-item {
        flex-direction: column;
        align-items: center;
        justify-content: center;
        text-align: center;
        padding: 10px 4px;
        gap: 4px;
        box-sizing: border-box;
        width: 100%;
    }

    .summary-item .label {
        font-size: 11px;
    }

    .summary-item .value {
        font-size: 17px;
    }

    /* Row 3: Progress (100% full width) */
    .summary-progress {
        grid-column: span 6;
        width: 100%;
        box-sizing: border-box;
        padding: 10px 14px;
    }

    .two-col-layout {
        display: flex;
        flex-direction: column;
        gap: 16px;
        width: 100%;
    }

    /* Tasks first on mobile! */
    .right-panel {
        order: 1;
        width: 100%;
    }

    /* Add Member form at bottom on mobile! */
    .left-panel {
        order: 2;
        width: 100%;
        position: static;
    }

    .add-member-section {
        width: 100%;
        box-sizing: border-box;
    }

    .members-section,
    .members-grid,
    .member-card {
        width: 100%;
        box-sizing: border-box;
    }

    .members-grid {
        grid-template-columns: 1fr;
    }

    .task-actions {
        opacity: 1;
    }

    .file-badge .file-remove {
        opacity: 1;
    }
}

@media (max-width: 640px) {
    .app {
        padding: 10px 10px 40px;
        width: 100%;
        box-sizing: border-box;
    }

    .summary-section {
        padding: 12px 12px;
        margin-bottom: 12px;
        border-radius: 12px;
        width: 100%;
    }

    .summary-section h2 {
        font-size: 13.5px;
    }

    .summary-grid {
        grid-template-columns: repeat(6, 1fr);
        gap: 6px;
        width: 100%;
    }

    .summary-item {
        padding: 8px 3px;
    }

    .summary-item .label {
        font-size: 10.5px;
    }

    .summary-item .value {
        font-size: 15px;
    }

    .summary-progress {
        padding: 8px 12px;
    }

    .summary-progress .label {
        font-size: 11px;
    }

    .summary-progress .value {
        font-size: 14px;
    }

    .header {
        padding: 12px 0 14px;
        gap: 12px;
        width: 100%;
    }

    .logo-icon {
        font-size: 28px;
    }

    .header h1 {
        font-size: 20px;
    }

    .subtitle {
        font-size: 12px;
    }

    .header-actions {
        width: 100%;
        display: flex;
        gap: 8px;
    }

    .btn-refresh-sync, .btn-github-sync {
        flex: 1;
        justify-content: center;
        padding: 7px 8px;
        font-size: 12px;
    }

    .member-card {
        border-radius: 12px;
        width: 100%;
    }

    .member-header {
        padding: 12px 12px;
        flex-wrap: wrap;
        gap: 8px;
    }

    .member-name {
        font-size: 14px;
    }

    .member-body {
        padding: 10px 12px 12px;
    }

    .task-item {
        padding: 9px 8px;
        gap: 8px;
    }

    .task-checkbox {
        width: 20px;
        height: 20px;
        margin-top: 1px;
    }

    .task-name {
        font-size: 13px;
    }

    .task-actions {
        opacity: 1;
        gap: 1px;
    }

    .task-actions .btn-icon {
        padding: 5px;
        font-size: 15px;
    }

    .file-badge {
        max-width: 100%;
        padding: 3px 8px;
    }

    .file-badge .file-name {
        max-width: 130px;
    }

    .add-task-form input {
        font-size: 14px;
    }

    /* Modals on Mobile */
    .modal-overlay {
        padding: 8px;
    }

    .modal {
        padding: 18px 14px;
        border-radius: 14px;
        width: 100%;
        max-width: 100%;
    }

    .modal-file-preview {
        width: 96vw;
        max-height: 90vh;
        padding: 14px 12px;
    }

    .file-preview-item .file-preview-image {
        max-height: 220px;
    }

    .file-preview-actions {
        gap: 6px;
    }

    .file-preview-actions .btn-tool,
    .file-preview-actions .btn-download,
    .file-preview-actions .btn-gh-link,
    .file-preview-actions .btn-3d-preview,
    .file-preview-actions .btn-delete-file-action {
        flex: 1 1 auto;
        justify-content: center;
        text-align: center;
        padding: 6px 10px;
        font-size: 11px;
    }

    .modal-3d-viewer {
        width: 98vw;
        height: 85vh;
        padding: 10px;
    }

    .modal-header-row {
        flex-wrap: wrap;
        gap: 6px;
    }

    .modal-header-row h3 {
        font-size: 14px;
    }

    .model-viewer-controls {
        flex-wrap: wrap;
        gap: 4px;
    }

    .model-viewer-controls .btn-tool {
        padding: 4px 8px;
        font-size: 10px;
    }

    .form-row-2col {
        grid-template-columns: 1fr;
    }

    .lightbox-container {
        max-width: 96vw;
        max-height: 90vh;
        padding: 10px;
    }

    .lightbox-container img {
        max-width: 92vw;
        max-height: 80vh;
    }

    .lightbox-close {
        top: 4px;
        right: 4px;
        width: 28px;
        height: 28px;
        font-size: 12px;
    }
}
