/* CODARIA Workspace — дополнение к style.css платформы */

.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.project-card {
    background: white;
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
    display: block;
    border: 1px solid rgba(0, 0, 0, 0.06);
}

.project-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.project-card-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.project-card-title {
    font-size: 17px;
    margin-bottom: 6px;
    font-family: 'Space Grotesk', sans-serif;
}

.project-card-meta,
.project-card-client,
.project-card-deadline {
    font-size: 13px;
    color: var(--text-secondary);
}

.project-pending {
    background: var(--danger);
    color: white;
    min-width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    padding: 0 6px;
}

.status-brief { background: #e2e8f0; color: #475569; }
.status-progress { background: #dbeafe; color: #1d4ed8; }
.status-review { background: #fef3c7; color: #b45309; }
.status-completed { background: #d1fae5; color: #047857; }
.status-archived { background: #f1f5f9; color: #64748b; }
.stage-draft { background: #f1f5f9; color: #64748b; }
.stage-review { background: #fef3c7; color: #b45309; }
.stage-approved { background: #d1fae5; color: #047857; }
.stage-revision { background: #fee2e2; color: #b91c1c; }

.alert-banner {
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid rgba(245, 158, 11, 0.3);
    padding: 14px 18px;
    border-radius: 12px;
    margin-bottom: 24px;
    font-size: 14px;
}

.page-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

.back-link {
    display: inline-block;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    margin-bottom: 8px;
}

.back-link:hover {
    color: var(--primary);
}

.progress-bar-wrap {
    margin-top: 12px;
}

.progress-label {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.progress-bar {
    height: 8px;
    background: #e2e8f0;
    border-radius: 999px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--gradient-2);
    border-radius: 999px;
}

.workspace-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 24px;
    flex-wrap: wrap;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.workspace-tab {
    padding: 10px 16px;
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}

.workspace-tab:hover,
.workspace-tab.active {
    color: var(--primary);
    border-bottom-color: var(--secondary);
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.detail-list {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 8px 16px;
    font-size: 14px;
}

.detail-list dt {
    color: var(--text-secondary);
}

.contact-row {
    margin-bottom: 12px;
    font-size: 14px;
}

.contact-row span {
    display: block;
    color: var(--text-secondary);
    font-size: 13px;
}

.stage-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.stage-desc {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.stage-link {
    color: var(--accent);
    font-weight: 500;
}

.file-list {
    list-style: none;
    margin: 12px 0;
}

.file-list li {
    font-size: 14px;
    margin-bottom: 6px;
}

.review-form {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.review-actions {
    display: flex;
    gap: 10px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.stage-hint {
    margin-top: 12px;
    padding: 10px 14px;
    background: #fef3c7;
    border-radius: 12px;
    font-size: 13px;
    color: #92400e;
}

.doc-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.draft-tag {
    font-size: 11px;
    background: #f1f5f9;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 6px;
}

.ack-done {
    font-size: 13px;
    color: var(--success);
}

.inline-form {
    display: inline;
}

.activity-list .activity-item {
    padding: 14px 20px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    font-size: 14px;
}

.activity-list .activity-item:last-child {
    border-bottom: none;
}

.activity-time {
    font-size: 12px;
    color: var(--text-light);
    margin-bottom: 4px;
}

.activity-project {
    font-weight: 600;
}

.activity-user {
    color: var(--text-secondary);
}

.comment-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 16px;
}

.comment-item {
    background: white;
    border-radius: 12px;
    padding: 16px;
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(0, 0, 0, 0.06);
}

.comment-meta {
    display: flex;
    gap: 12px;
    margin-bottom: 8px;
    font-size: 13px;
    color: var(--text-secondary);
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-grid .span-2 {
    grid-column: span 2;
}

.form-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    cursor: pointer;
    min-height: 42px;
}

.subsection-title {
    font-size: 15px;
    margin: 20px 0 12px;
    color: var(--text-secondary);
    font-weight: 600;
}

.admin-stage-list {
    margin-bottom: 24px;
}

.admin-stage-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 14px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    flex-wrap: wrap;
}

.admin-stage-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.queue-badge {
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 999px;
    margin-right: 4px;
    display: inline-block;
}

.queue-revision {
    background: #fee2e2;
    color: #b91c1c;
}

.queue-review {
    background: #fef3c7;
    color: #92400e;
}

.hint-box {
    padding: 16px;
    background: white;
    border-radius: 12px;
    color: var(--text-secondary);
    font-size: 14px;
    border: 1px solid rgba(0, 0, 0, 0.06);
}

.workspace-flash {
    padding: 12px 16px;
    border-radius: 12px;
    margin-bottom: 20px;
    font-size: 14px;
    text-align: center;
}

.workspace-flash-success {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

.workspace-flash-error {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.btn-success {
    background: var(--success);
    color: white;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 18px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    text-decoration: none;
    font-family: inherit;
}

.btn-warning {
    background: var(--warning);
    color: white;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 18px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    font-family: inherit;
}

.btn-danger {
    background: var(--danger);
    color: white;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 12px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    font-family: inherit;
}

.btn-sm {
    padding: 6px 12px !important;
    font-size: 13px !important;
}

.page-header-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    flex-wrap: wrap;
}

.project-header-main {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.project-header-status {
    display: inline-block;
    margin-bottom: 10px;
}

/* Сворачиваемые панели админа */
.ws-admin-panel {
    margin-top: 20px;
    background: white;
    border-radius: var(--radius);
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.ws-admin-panel-summary {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 20px;
    font-size: 14px;
    font-weight: 600;
    color: var(--primary);
    cursor: pointer;
    list-style: none;
    user-select: none;
    transition: background 0.15s ease;
}

.ws-admin-panel-summary::-webkit-details-marker {
    display: none;
}

.ws-admin-panel-summary::before {
    content: '+';
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 8px;
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
    font-size: 16px;
    font-weight: 600;
    line-height: 1;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.ws-admin-panel[open] .ws-admin-panel-summary::before {
    content: '−';
}

.ws-admin-panel-summary:hover {
    background: rgba(99, 102, 241, 0.04);
}

.ws-admin-panel-body {
    padding: 0 20px 20px;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
}

/* Кастомный выбор файла */
.ws-file-field-control {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    min-height: 42px;
    padding: 6px 6px 6px 8px;
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    background: white;
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.ws-file-field-control:hover {
    border-color: rgba(99, 102, 241, 0.35);
}

.ws-file-field-control.has-file {
    border-color: rgba(16, 185, 129, 0.35);
    background: rgba(16, 185, 129, 0.03);
}

.ws-file-field-input {
    position: absolute;
    width: 0.1px;
    height: 0.1px;
    opacity: 0;
    overflow: hidden;
    z-index: -1;
}

.ws-file-field-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 14px;
    border-radius: 10px;
    background: var(--gradient-2);
    color: white;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
}

.ws-file-field-text {
    font-size: 13px;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
    flex: 1;
}

.ws-file-field-control.has-file .ws-file-field-text {
    color: var(--text-primary);
    font-weight: 500;
}

/* Чекбоксы-чипы в ряд */
.ws-checkbox-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: stretch;
}

.ws-checkbox-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 200px;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    background: white;
    cursor: pointer;
    font-size: 14px;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.ws-checkbox-chip:hover {
    border-color: rgba(99, 102, 241, 0.3);
}

.ws-checkbox-chip input {
    width: 18px;
    height: 18px;
    margin: 0;
    accent-color: var(--primary);
    flex-shrink: 0;
}

.ws-checkbox-chip:has(input:checked) {
    border-color: rgba(99, 102, 241, 0.45);
    background: rgba(99, 102, 241, 0.06);
}

.ws-checkbox-chip span {
    line-height: 1.35;
}

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

    .form-grid .span-2 {
        grid-column: span 1;
    }

    .review-actions {
        flex-direction: column;
    }

    .review-actions .btn-success,
    .review-actions .btn-warning {
        width: 100%;
    }

    .finance-forms-grid {
        grid-template-columns: 1fr;
    }
}

/* Финансы — компактно, как student-payment на Platform */
.finance-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.finance-summary-grid .student-payment-price-item {
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 8px;
    min-height: 88px;
}

.finance-summary-grid .student-payment-price-item strong {
    font-size: 20px;
}

.finance-summary-paid {
    color: var(--success);
}

.finance-summary-remaining {
    color: var(--warning);
}

.finance-project-prices {
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    padding: 0 24px 16px;
    margin-bottom: 16px;
}

.finance-project-prices .student-payment-price-item {
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 8px;
    min-height: 88px;
}

.finance-project-prices .student-payment-price-item strong {
    font-size: 20px;
}

.finance-project-prices .student-payment-price-item .status-badge {
    margin-top: 2px;
}

@media (max-width: 1024px) {
    .finance-project-prices,
    .finance-summary-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 520px) {
    .finance-project-prices,
    .finance-summary-grid {
        grid-template-columns: 1fr;
    }
}

.finance-progress {
    margin-bottom: 16px;
    padding: 0 24px;
}

.finance-payments-table {
    margin-top: 0;
}

.finance-inline-form {
    padding: 20px;
    border-radius: 14px;
    background: var(--bg-secondary);
    border: 1px solid rgba(0, 0, 0, 0.06);
}

.finance-inline-form .subsection-title {
    margin-top: 0;
}

.finance-forms-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.ws-admin-panel .finance-forms-grid {
    margin-bottom: 0;
}

.finance-not-set { background: #f1f5f9; color: #64748b; }
.finance-unpaid { background: #fee2e2; color: #b91c1c; }
.finance-partial { background: #fef3c7; color: #b45309; }
.finance-paid { background: #d1fae5; color: #047857; }
.finance-overpaid { background: #dbeafe; color: #1d4ed8; }

.student-payment-price-item .status-badge {
    font-size: 12px;
}
