:root {
    --aas-green: #128c7e;
    --aas-green-dark: #075e54;
    --aas-mint: #dcf8c6;
    --aas-bg: #eef5f1;
    --aas-panel: #ffffff;
    --aas-line: #d5e4dd;
    --aas-ink: #10231e;
    --aas-muted: #60746d;
    --aas-warn: #f97316;
    --aas-danger: #dc2626;
}

* { box-sizing: border-box; }

body {
    min-height: 100vh;
    margin: 0;
    color: var(--aas-ink);
    font-family: Inter, Outfit, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background:
        linear-gradient(180deg, var(--aas-green-dark) 0 140px, transparent 140px),
        radial-gradient(circle at 18px 18px, rgba(7, 94, 84, .08) 2px, transparent 2px),
        var(--aas-bg);
    background-size: auto, 32px 32px, auto;
}

.aas-topbar,
.aas-shell {
    width: min(1480px, calc(100% - 20px));
    margin-inline: auto;
}

.aas-topbar {
    min-height: 84px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: #fff;
}

.aas-brand,
.aas-back {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.aas-brand-mark {
    width: 48px;
    height: 48px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    background: rgba(255, 255, 255, .16);
    font-size: 1.6rem;
}

.aas-brand p,
.aas-brand h1 {
    margin: 0;
}

.aas-breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
    color: rgba(255, 255, 255, .72);
    font-size: .72rem;
    font-weight: 850;
}

.aas-breadcrumb a {
    color: inherit;
    text-decoration: none;
}

.aas-breadcrumb a:hover {
    color: #fff;
}

.aas-brand p {
    max-width: min(62vw, 620px);
    overflow: hidden;
    color: rgba(255, 255, 255, .82);
    font-size: .82rem;
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.aas-brand h1 {
    font-size: 1.38rem;
    line-height: 1.1;
}

.aas-back {
    min-height: 38px;
    padding: 8px 12px;
    border-radius: 999px;
    color: #fff;
    background: rgba(255, 255, 255, .14);
    text-decoration: none;
    font-weight: 900;
}

.aas-shell {
    display: grid;
    grid-template-columns: 320px minmax(360px, 440px) minmax(0, 1fr);
    gap: 14px;
    align-items: start;
    padding-bottom: 100px;
}

.aas-panel {
    min-width: 0;
    border: 1px solid rgba(15, 23, 42, .13);
    border-radius: 18px;
    background: rgba(255, 255, 255, .96);
    box-shadow: 0 18px 50px rgba(15, 23, 42, .12);
}

.aas-filter-panel,
.aas-list-panel,
.aas-share-panel {
    padding: 16px;
}

.aas-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.aas-panel-head p,
.aas-panel-head h2 {
    margin: 0;
}

.aas-panel-head p {
    color: var(--aas-muted);
    font-size: .76rem;
    font-weight: 950;
    text-transform: uppercase;
    letter-spacing: .05em;
}

.aas-panel-head h2 {
    margin-top: 3px;
    font-size: 1.12rem;
}

.aas-icon-btn,
.aas-step-btn,
.aas-primary,
.aas-share-btn,
.aas-retry {
    min-height: 42px;
    border: 0;
    border-radius: 13px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font: inherit;
    font-weight: 950;
    cursor: pointer;
}

.aas-icon-btn {
    width: 42px;
    background: #e7f3ef;
    color: var(--aas-green-dark);
}

.aas-icon-btn:disabled,
.aas-primary:disabled {
    opacity: .64;
    cursor: progress;
}

.aas-panel-actions {
    display: flex;
    gap: 8px;
}

.aas-date-row {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) 42px;
    gap: 8px;
}

.aas-step-btn {
    min-height: 44px;
    border: 1px solid var(--aas-line);
    background: #f8fcfa;
    color: var(--aas-green-dark);
}

.aas-date-chips,
.aas-filter-chips,
.aas-template-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.aas-date-chips button,
.aas-filter-chips button,
.aas-template-tabs button,
.aas-review-head button {
    min-height: 32px;
    border: 1px solid var(--aas-line);
    border-radius: 999px;
    padding: 6px 10px;
    background: #fff;
    color: var(--aas-green-dark);
    font: inherit;
    font-size: .78rem;
    font-weight: 900;
    cursor: pointer;
}

.aas-filter-chips {
    margin: 0 0 12px;
}

.aas-template-tabs {
    margin: 0 0 12px;
}

.aas-filter-chips button.is-active,
.aas-template-tabs button.is-active {
    border-color: var(--aas-green);
    background: #dcfce7;
}

.aas-field {
    display: grid;
    gap: 7px;
    margin-bottom: 12px;
}

.aas-field label {
    color: #36584f;
    font-size: .86rem;
    font-weight: 900;
}

.aas-field input,
.aas-field select,
.aas-search input {
    width: 100%;
    min-height: 44px;
    border: 1px solid var(--aas-line);
    border-radius: 13px;
    background: #fff;
    color: var(--aas-ink);
    font: inherit;
    font-weight: 750;
}

.aas-field input,
.aas-field select {
    padding: 10px 12px;
}

.aas-primary {
    width: 100%;
    margin-top: 4px;
    color: #fff;
    background: linear-gradient(135deg, var(--aas-green-dark), var(--aas-green));
}

.aas-load-status {
    min-height: 20px;
    margin-top: 8px;
    color: var(--aas-muted);
    font-size: .78rem;
    font-weight: 850;
}

.aas-stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 14px;
}

.aas-stat {
    min-height: 78px;
    padding: 12px;
    border: 1px solid var(--aas-line);
    border-radius: 15px;
    background: #f8fcfa;
}

.aas-stat span {
    display: block;
    color: var(--aas-muted);
    font-size: .72rem;
    font-weight: 950;
    text-transform: uppercase;
}

.aas-stat strong {
    display: block;
    margin-top: 7px;
    font-size: 1.35rem;
}

.aas-count {
    min-width: 42px;
    min-height: 34px;
    padding: 7px 10px;
    border-radius: 999px;
    display: inline-grid;
    place-items: center;
    color: var(--aas-green-dark);
    background: #dcfce7;
    font-weight: 950;
}

.aas-search {
    position: relative;
    margin-bottom: 12px;
}

.aas-search i {
    position: absolute;
    left: 13px;
    top: 50%;
    color: var(--aas-muted);
    transform: translateY(-50%);
}

.aas-search input {
    padding: 10px 12px 10px 40px;
}

.aas-groups {
    display: grid;
    gap: 10px;
    max-height: calc(100vh - 210px);
    overflow: auto;
    padding-right: 2px;
}

.aas-group-card {
    width: 100%;
    border: 1px solid var(--aas-line);
    border-radius: 16px;
    background: #fff;
    display: grid;
    grid-template-columns: 46px minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    padding: 12px;
    color: inherit;
    text-align: left;
    cursor: pointer;
}

.aas-group-card.is-active {
    border-color: var(--aas-green);
    background: #f0fdf4;
    box-shadow: 0 10px 28px rgba(18, 140, 126, .16);
    position: sticky;
    top: 0;
    z-index: 2;
}

.aas-avatar {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    color: #fff;
    background: linear-gradient(135deg, var(--aas-green), #22c55e);
    font-weight: 950;
}

.aas-group-title {
    display: block;
    font-weight: 950;
}

.aas-group-meta {
    display: block;
    margin-top: 3px;
    color: var(--aas-muted);
    font-size: .84rem;
    font-weight: 750;
}

.aas-group-badge {
    min-width: 36px;
    padding: 7px 9px;
    border-radius: 999px;
    color: var(--aas-danger);
    background: #fee2e2;
    font-weight: 950;
    text-align: center;
}

.aas-group-badge.is-full {
    color: #991b1b;
    background: #fee2e2;
}

.aas-group-badge.is-partial {
    color: #92400e;
    background: #fef3c7;
}

.aas-group-badge.is-zero {
    color: #166534;
    background: #dcfce7;
}

.aas-group-card.is-full {
    border-left: 4px solid #ef4444;
}

.aas-group-card.is-partial {
    border-left: 4px solid #f59e0b;
}

.aas-group-card.is-zero {
    border-left: 4px solid #22c55e;
}

.aas-phone-preview {
    min-height: 460px;
    padding: 18px;
    border-radius: 22px;
    border: 1px solid #c9ddd4;
    background:
        radial-gradient(circle at 14px 14px, rgba(7, 94, 84, .08) 2px, transparent 2px),
        #e5ddd5;
    background-size: 28px 28px;
}

.aas-selection-summary {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 12px;
}

.aas-selection-summary span {
    min-height: 46px;
    padding: 9px 10px;
    border: 1px solid var(--aas-line);
    border-radius: 12px;
    background: #f8fcfa;
    color: var(--aas-muted);
    font-size: .76rem;
    font-weight: 850;
}

.aas-selection-summary b {
    display: block;
    margin-top: 2px;
    color: var(--aas-ink);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.aas-message-bubble {
    max-width: 760px;
    margin-left: auto;
    padding: 14px 15px;
    border-radius: 16px 16px 4px 16px;
    background: var(--aas-mint);
    box-shadow: 0 8px 18px rgba(15, 23, 42, .12);
    white-space: pre-wrap;
    line-height: 1.48;
    font-size: .98rem;
}

.aas-actions {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 10px;
    margin-top: 12px;
}

.aas-share-btn {
    padding: 11px 12px;
    color: var(--aas-green-dark);
    background: #e7f3ef;
}

.aas-share-btn.primary {
    color: #fff;
    background: #2563eb;
}

.aas-share-btn.send {
    color: #fff;
    background: var(--aas-green);
}

.aas-share-btn.is-success {
    color: #fff;
    background: #16a34a;
}

.aas-message-editor {
    width: 100%;
    min-height: 220px;
    margin-top: 12px;
    padding: 14px;
    border: 1px solid var(--aas-green);
    border-radius: 16px;
    background: #fbfffd;
    color: var(--aas-ink);
    font: 850 .96rem/1.48 Inter, system-ui, sans-serif;
    resize: vertical;
}

.aas-student-review {
    margin-top: 12px;
    border: 1px solid var(--aas-line);
    border-radius: 16px;
    background: #fff;
    overflow: hidden;
}

.aas-review-head {
    position: sticky;
    top: 0;
    z-index: 1;
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: center;
    padding: 10px 12px;
    border-bottom: 1px solid var(--aas-line);
    background: #f8fcfa;
}

.aas-review-head strong {
    font-size: .9rem;
}

.aas-review-head div {
    display: flex;
    gap: 6px;
}

.aas-review-list {
    display: grid;
    max-height: 260px;
    overflow: auto;
}

.aas-review-row {
    display: grid;
    grid-template-columns: 22px minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    padding: 10px 12px;
    border-bottom: 1px solid #edf3f0;
    font-size: .88rem;
    font-weight: 850;
}

.aas-review-row:last-child {
    border-bottom: 0;
}

.aas-review-row span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.aas-review-row b {
    color: var(--aas-muted);
    font-size: .78rem;
}

.aas-retry {
    min-height: 38px;
    padding: 8px 14px;
    color: #fff;
    background: var(--aas-green);
}

.aas-empty,
.aas-loading {
    min-height: 220px;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 8px;
    color: var(--aas-muted);
    text-align: center;
}

.aas-empty i,
.aas-loading i {
    font-size: 2.3rem;
    color: var(--aas-green);
}

.aas-empty h3,
.aas-empty p,
.aas-loading p {
    margin: 0;
}

.aas-empty h3 {
    color: var(--aas-ink);
}

.aas-spin {
    animation: aasSpin .8s linear infinite;
}

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

@media print {
    .aas-topbar,
    .aas-filter-panel,
    .aas-list-panel,
    .aas-actions,
    .aas-panel-actions,
    .aas-student-review {
        display: none !important;
    }

    body {
        background: #fff;
    }

    .aas-shell {
        display: block;
        width: 100%;
        padding: 0;
    }

    .aas-panel {
        border: 0;
        box-shadow: none;
    }
}

@media (max-width: 980px) {
    .aas-shell {
        grid-template-columns: 1fr;
    }

    .aas-groups {
        max-height: none;
    }

    .aas-phone-preview {
        min-height: 340px;
    }

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

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

@media (max-width: 640px) {
    .aas-topbar {
        min-height: 74px;
    }

    .aas-brand-mark {
        width: 42px;
        height: 42px;
    }

    .aas-brand h1 {
        font-size: 1.12rem;
    }

    .aas-breadcrumb {
        display: none;
    }

    .aas-back span {
        display: none;
    }

    .aas-filter-panel,
    .aas-list-panel,
    .aas-share-panel {
        padding: 12px;
        border-radius: 16px;
    }

    .aas-actions {
        position: sticky;
        bottom: 8px;
        z-index: 4;
        padding: 8px;
        border: 1px solid rgba(15, 23, 42, .12);
        border-radius: 16px;
        background: rgba(255, 255, 255, .92);
        backdrop-filter: blur(10px);
    }

    .aas-share-btn {
        min-height: 48px;
        padding-inline: 8px;
        font-size: .88rem;
    }

    .aas-selection-summary {
        grid-template-columns: 1fr;
    }

    .aas-review-row {
        grid-template-columns: 22px minmax(0, 1fr);
    }

    .aas-review-row b {
        grid-column: 2;
    }
}
