.teams-page {
    max-width: 1680px;
    margin: 0 auto;
    padding: 2rem 1.5rem 3rem;
}

.teams-page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.teams-header-actions {
    display: flex;
    gap: 0.75rem;
}

.teams-list-toolbar {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.teams-search-input {
    width: 100%;
    border-radius: 14px;
    border: 1px solid rgba(148, 163, 184, 0.28);
    background: rgba(15, 23, 42, 0.82);
    color: #f8fbff;
    padding: 0.8rem 0.95rem;
}

.teams-search-input:focus {
    border-color: rgba(96, 165, 250, 0.72);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.18);
    outline: none;
}

.teams-filter-group {
    display: flex;
    gap: 0.55rem;
    flex-wrap: wrap;
}

.teams-filter-chip {
    border: 1px solid rgba(148, 163, 184, 0.24);
    background: rgba(15, 23, 42, 0.5);
    color: rgba(226, 236, 255, 0.78);
    border-radius: 999px;
    padding: 0.45rem 0.8rem;
    font-size: 0.84rem;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.teams-filter-chip.active {
    background: rgba(59, 130, 246, 0.24);
    border-color: rgba(96, 165, 250, 0.56);
    color: #eff6ff;
}

.teams-layout {
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr);
    gap: 1.5rem;
    align-items: start;
}

.teams-sidebar,
.teams-main,
.teams-section-grid {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.teams-card {
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 24px;
    background:
        linear-gradient(160deg, rgba(20, 28, 44, 0.88), rgba(13, 18, 29, 0.88)),
        radial-gradient(circle at top right, rgba(63, 131, 248, 0.22), transparent 42%);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.22);
    padding: 1.25rem;
    color: #e5eefc;
}

.teams-card-stacked {
    gap: 1rem;
}

.teams-card-header,
.teams-subpanel-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.teams-card-title,
.teams-subtitle {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: #f8fbff;
}

.teams-card-subtitle,
.summary-footnote,
.field-hint,
.teams-permission-note {
    color: rgba(226, 236, 255, 0.72);
    font-size: 0.9rem;
}

.teams-summary-grid,
.teams-analytics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
}

.teams-summary-card,
.teams-analytics-tile {
    padding: 1rem 1.1rem;
    border-radius: 20px;
    background: linear-gradient(140deg, rgba(15, 23, 42, 0.92), rgba(30, 41, 59, 0.72));
    border: 1px solid rgba(148, 163, 184, 0.18);
    min-height: 108px;
}

.summary-label {
    color: rgba(201, 216, 255, 0.72);
    font-size: 0.86rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.summary-value {
    margin-top: 0.5rem;
    font-size: 2rem;
    font-weight: 700;
    color: #fff7e6;
}

.summary-value-text {
    font-size: 1.35rem;
    line-height: 1.35;
}

.teams-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.compact-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.teams-inline-form,
.teams-inline-form-wide,
.teams-split-panel,
.teams-row-actions,
.assignment-actions,
.shared-asset-actions,
.prompt-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.teams-inline-form-wide input {
    min-width: 180px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.form-group label,
.checkbox-label {
    font-size: 0.92rem;
    color: rgba(240, 246, 255, 0.92);
    font-weight: 600;
}

.form-group input,
.form-group textarea,
.form-group select,
.teams-inline-form input,
.teams-inline-form select,
.teams-inline-form-wide input,
.teams-inline-form-wide select {
    width: 100%;
    border-radius: 14px;
    border: 1px solid rgba(148, 163, 184, 0.28);
    background: rgba(15, 23, 42, 0.82);
    color: #f8fbff;
    padding: 0.8rem 0.95rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-group textarea {
    resize: vertical;
    min-height: 96px;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus,
.teams-inline-form input:focus,
.teams-inline-form select:focus,
.teams-inline-form-wide input:focus,
.teams-inline-form-wide select:focus {
    border-color: rgba(96, 165, 250, 0.72);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.18);
    outline: none;
}

.form-group-full {
    grid-column: 1 / -1;
}

.form-checkbox-group {
    align-items: flex-start;
}

.checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

.teams-list {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}

.teams-list.compact-list {
    gap: 0.7rem;
}

.teams-list-item {
    border-radius: 18px;
    padding: 1rem;
    border: 1px solid rgba(148, 163, 184, 0.2);
    background: rgba(15, 23, 42, 0.7);
}

.teams-member-item {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}

.teams-member-profile {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    min-width: 0;
}

.teams-member-avatar {
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    border-radius: 50%;
    object-fit: cover;
    background: rgba(15, 23, 42, 0.86);
    border: 1px solid rgba(148, 163, 184, 0.32);
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.12);
}

.teams-member-copy {
    min-width: 0;
    flex: 1;
}

.teams-member-copy .teams-item-title,
.teams-member-copy .teams-item-meta {
    overflow-wrap: anywhere;
}

.teams-member-actions {
    align-items: center;
}

.teams-member-actions select {
    min-width: 112px;
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.28);
    background: rgba(15, 23, 42, 0.82);
    color: #f8fbff;
    padding: 0.58rem 0.72rem;
}

.teams-list-item.active {
    border-color: rgba(251, 191, 36, 0.55);
    box-shadow: inset 0 0 0 1px rgba(251, 191, 36, 0.38);
}

.teams-sidebar-item {
    width: 100%;
    text-align: left;
    border: 0;
    cursor: pointer;
}

.teams-item-title {
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
}

.teams-item-meta,
.teams-inline-meta {
    margin-top: 0.35rem;
    color: rgba(226, 236, 255, 0.74);
    font-size: 0.88rem;
}

.teams-item-tags {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 0.65rem;
}

.teams-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    padding: 0.28rem 0.7rem;
    font-size: 0.78rem;
    font-weight: 700;
    background: rgba(96, 165, 250, 0.16);
    color: #cfe3ff;
}

.teams-badge.warn {
    background: rgba(245, 158, 11, 0.16);
    color: #fde68a;
}

.teams-badge.success {
    background: rgba(34, 197, 94, 0.16);
    color: #bbf7d0;
}

.teams-badge.danger {
    background: rgba(248, 113, 113, 0.18);
    color: #fecaca;
}

.teams-badge.muted {
    background: rgba(148, 163, 184, 0.16);
    color: rgba(226, 232, 240, 0.85);
}

.teams-split-panel {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    align-items: start;
}

.teams-split-panel-single {
    grid-template-columns: 1fr;
}

.teams-resource-summary {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
}

.resource-picker {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.75rem;
}

.resource-chip {
    border-radius: 16px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    background: rgba(2, 6, 23, 0.46);
    padding: 0.75rem 0.85rem;
}

.resource-chip label {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    cursor: pointer;
    color: #f8fbff;
}

.resource-chip input[type="checkbox"] {
    margin-top: 0.2rem;
}

.assignment-detail-panel {
    margin-bottom: 1rem;
    padding: 1rem;
    border-radius: 18px;
    background: rgba(2, 6, 23, 0.4);
    border: 1px solid rgba(148, 163, 184, 0.18);
}

.teams-info-banner {
    margin-top: 1rem;
    padding: 1rem;
    border-radius: 18px;
    background: linear-gradient(140deg, rgba(30, 41, 59, 0.82), rgba(15, 23, 42, 0.72));
    border: 1px solid rgba(148, 163, 184, 0.16);
}

.teams-info-banner:first-child {
    margin-top: 0;
}

.teams-info-banner .teams-item-title {
    margin-bottom: 0.35rem;
}

.assignment-manager-toolbar {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    margin-top: 1rem;
}

.assignment-roster-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.75rem;
}

.assignment-roster-card {
    border-radius: 16px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    background: rgba(2, 6, 23, 0.34);
    padding: 0.85rem 0.95rem;
}

.assignment-roster-card .summary-value {
    font-size: 1.5rem;
}

.submission-status-pill {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 0.26rem 0.7rem;
    font-size: 0.78rem;
    font-weight: 700;
    margin-top: 0.65rem;
    background: rgba(148, 163, 184, 0.14);
    color: rgba(226, 236, 255, 0.86);
}

.submission-status-pill.pending {
    background: rgba(245, 158, 11, 0.16);
    color: #fde68a;
}

.submission-status-pill.graded {
    background: rgba(34, 197, 94, 0.16);
    color: #bbf7d0;
}

.submission-status-pill.missing {
    background: rgba(248, 113, 113, 0.16);
    color: #fecaca;
}

.submission-manager-card {
    border-style: dashed;
}

.teams-subpanel {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(148, 163, 184, 0.16);
}

.teams-empty-state {
    min-height: 280px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.empty-state {
    color: rgba(226, 236, 255, 0.64);
    padding: 1.25rem;
    border-radius: 18px;
    background: rgba(15, 23, 42, 0.45);
    border: 1px dashed rgba(148, 163, 184, 0.28);
}

.modal {
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 23, 0.78);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    z-index: 1200;
}

.modal.hidden {
    display: none;
}

.modal-content {
    width: min(680px, 100%);
    border-radius: 24px;
    background: linear-gradient(145deg, rgba(15, 23, 42, 0.98), rgba(30, 41, 59, 0.94));
    border: 1px solid rgba(148, 163, 184, 0.2);
    color: #f8fbff;
}

.modal-header,
.modal-body {
    padding: 1.25rem 1.4rem;
}

.teams-action-modal-description {
    margin: 0 0 1rem;
    color: rgba(226, 236, 255, 0.82);
    line-height: 1.6;
}

.teams-action-confirm-button.is-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    border-color: rgba(248, 113, 113, 0.56);
    color: #fff7f7;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(148, 163, 184, 0.18);
}

.modal-title {
    margin: 0;
    font-size: 1.1rem;
}

.modal-close {
    border: 0;
    background: transparent;
    color: #f8fbff;
    font-size: 1.8rem;
    cursor: pointer;
}

.teams-section-grid > .teams-card {
    min-height: 200px;
}

@media (max-width: 1280px) {
    .teams-layout {
        grid-template-columns: 1fr;
    }

    .teams-sidebar {
        order: 2;
    }

    .teams-main {
        order: 1;
    }
}

@media (max-width: 860px) {
    .teams-page {
        padding: 1.25rem 0.9rem 2rem;
    }

    .teams-page-header,
    .teams-card-header,
    .teams-subpanel-header,
    .teams-inline-form,
    .teams-inline-form-wide,
    .assignment-actions,
    .shared-asset-actions,
    .prompt-actions,
    .teams-header-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .teams-form-grid,
    .compact-grid,
    .teams-split-panel {
        grid-template-columns: 1fr;
    }

    .teams-resource-summary,
    .resource-picker,
    .teams-summary-grid,
    .teams-analytics-grid,
    .assignment-roster-summary {
        grid-template-columns: 1fr;
    }

    .teams-filter-group {
        gap: 0.45rem;
    }

    .teams-filter-chip {
        width: 100%;
        justify-content: center;
    }

    .form-actions {
        justify-content: stretch;
    }

    .form-actions .btn,
    .teams-header-actions .btn,
    .teams-inline-form .btn,
    .teams-inline-form-wide .btn {
        width: 100%;
    }
}