/* ============================================================
   TutoraX - Management Components (tables, modals, badges, forms)
   ============================================================ */

/* ---- Page header / action bar ---- */
.page-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}
.page-toolbar h2 { font-size: 1.3rem; }

/* ---- Table card ---- */
.table-card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    margin-bottom: 28px;
    animation: fadeInUp 0.5s var(--ease) both;
}
.table-card .table-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
}
.table-card .table-header h3 { font-size: 1.05rem; }
.table-wrap { overflow-x: auto; }
table.data-table { width: 100%; border-collapse: collapse; min-width: 600px; }
.data-table thead th {
    text-align: left;
    padding: 14px 24px;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    color: var(--text-muted);
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.data-table tbody td {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
    font-size: 0.92rem;
    vertical-align: middle;
}
.data-table tbody tr { transition: var(--transition); }
.data-table tbody tr:hover { background: var(--surface-2); }
.data-table tbody tr:last-child td { border-bottom: none; }

/* ---- User cell (avatar + name) ---- */
.cell-user { display: flex; align-items: center; gap: 12px; }
.cell-user .mini-avatar {
    width: 40px; height: 40px; flex-shrink: 0;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: #fff; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.95rem;
}
.cell-user .cu-name { font-weight: 600; }
.cell-user .cu-sub { font-size: 0.78rem; color: var(--text-muted); }

/* ---- Badges ---- */
.badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 5px 12px;
    border-radius: var(--pill);
    font-size: 0.76rem;
    font-weight: 600;
    white-space: nowrap;
}
.badge-success { background: var(--accent-soft); color: var(--accent-dark); }
.badge-pending { background: var(--warning-soft); color: #B9770E; }
.badge-danger { background: var(--danger-soft); color: #C0392B; }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-muted { background: var(--surface-2); color: var(--text-muted); }
.badge-primary { background: var(--primary-soft); color: var(--primary); }

/* ---- Action buttons row ---- */
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; white-space: nowrap; }
.action-link {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 7px 12px;
    border-radius: var(--pill);
    font-size: 0.8rem; font-weight: 600;
    background: var(--surface-2);
    color: var(--text);
    border: 1.5px solid var(--border);
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}
.action-link:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.action-link.approve { color: var(--accent-dark); border-color: #B5ECDd; background: var(--accent-soft); }
.action-link.warn { color: #B9770E; border-color: #FCE3B6; background: var(--warning-soft); }
.action-link.danger { color: #C0392B; border-color: #F5C9C9; background: var(--danger-soft); }
.action-link.primary { color: var(--primary); border-color: #C7DBFE; background: var(--info-soft); }

/* ---- Search box ---- */
.search-box { position: relative; }
.search-box input {
    padding: 11px 16px 11px 42px;
    border-radius: var(--pill);
    border: 2px solid var(--border);
    background: var(--surface-2);
    font-family: var(--font); font-size: 0.9rem;
    min-width: 260px;
    transition: var(--transition);
}
.search-box input:focus { outline: none; border-color: var(--primary); background: var(--surface); box-shadow: 0 0 0 4px var(--primary-soft); }
.search-box .search-icon { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--text-light); }

/* Playlist search (recordings): fill the available box instead of the default
   min-width sizing; keep margins inside the parent so it can't overflow on
   small screens either. */
.search-box.playlist-search { width: auto; }
.search-box.playlist-search input { width: 100%; min-width: 0; }

/* ---- Modal ---- */
.modal-overlay {
    position: fixed; inset: 0; z-index: 1000;
    background: rgba(11,17,40,0.55);
    backdrop-filter: blur(4px);
    display: none; align-items: center; justify-content: center;
    padding: 20px;
}
.modal-overlay.show { display: flex; animation: fadeIn 0.25s ease both; }
.modal {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%; max-width: 480px;
    max-height: 90vh; overflow-y: auto;
    animation: scaleIn 0.3s var(--ease) both;
}
.modal-header {
    padding: 22px 26px;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
}
.modal-header h3 { font-size: 1.1rem; }
.modal-close {
    width: 34px; height: 34px; border-radius: 50%;
    border: none; background: var(--surface-2);
    cursor: pointer; font-size: 1.1rem; color: var(--text-muted);
    display: flex; align-items: center; justify-content: center;
    transition: var(--transition);
}
.modal-close:hover { background: var(--danger-soft); color: var(--danger); }
.modal-body { padding: 24px 26px 8px; }
.modal-footer { padding: 16px 26px 24px; display: flex; gap: 12px; justify-content: flex-end; }

/* ---- Confirm modal ---- */
.confirm-modal .confirm-icon {
    width: 72px; height: 72px; margin: 6px auto 16px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 2rem;
    background: var(--danger-soft); color: var(--danger);
}
.confirm-modal.warning .confirm-icon { background: var(--warning-soft); color: var(--warning); }
.confirm-modal.success .confirm-icon { background: var(--accent-soft); color: var(--accent); }
.confirm-modal p { text-align: center; color: var(--text-muted); font-size: 0.92rem; }

/* ---- Empty state ---- */
.empty-state { text-align: center; padding: 50px 20px; }
.empty-state .es-icon {
    width: 84px; height: 84px; margin: 0 auto 16px;
    border-radius: 24px;
    background: var(--surface-2);
    display: flex; align-items: center; justify-content: center;
    font-size: 2.4rem;
}
.empty-state h4 { margin-bottom: 6px; }
.empty-state p { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 18px; }

/* ---- Grid cards (for classes/events/etc) ---- */
.grid-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 22px;
}
.item-card {
    background: var(--surface);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: var(--transition);
    display: flex; flex-direction: column;
    animation: fadeInUp 0.5s var(--ease) both;
}
.item-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-lg); }
.item-card .item-thumb {
    height: 150px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    display: flex; align-items: center; justify-content: center;
    position: relative; color: #fff;
}
.item-card .item-thumb img { width: 100%; height: 100%; object-fit: cover; }
.item-card .item-thumb .thumb-fallback { font-size: 2.6rem; }
.item-card .item-body { padding: 18px 20px; flex: 1; }
.item-card .item-body h4 { font-size: 1.05rem; margin-bottom: 6px; }
.item-card .item-body .item-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.item-card .item-body .item-desc { font-size: 0.86rem; color: var(--text-muted); margin-bottom: 14px; }
.item-card .item-foot {
    padding: 14px 20px;
    border-top: 1px solid var(--border);
    background: var(--surface-2);
    display: flex; gap: 8px; flex-wrap: wrap;
}

.schedule-links {
    display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
}

/* ---- Thumbnail preview ---- */
.thumb-preview {
    margin-top: 12px;
    border-radius: var(--radius);
    overflow: hidden;
    max-width: 320px;
    border: 2px solid var(--border);
    position: relative;
}
.thumb-preview img { width: 100%; display: block; }
.thumb-preview .tp-label { position: absolute; bottom: 8px; left: 8px; background: rgba(0,0,0,0.6); color: #fff; font-size: 0.7rem; padding: 3px 8px; border-radius: var(--pill); }

/* ---- Upload dropzone ---- */
.dropzone {
    border: 2.5px dashed var(--border);
    border-radius: var(--radius);
    padding: 30px 20px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    background: var(--surface-2);
}
.dropzone:hover, .dropzone.dragover { border-color: var(--primary); background: var(--primary-soft); }
.dropzone .dz-icon { font-size: 2rem; margin-bottom: 10px; }
.dropzone p { color: var(--text-muted); font-size: 0.9rem; }
.dropzone p strong { color: var(--primary); }

/* ---- Slip upload preview + progress ---- */
.dz-preview {
    display: flex;
    align-items: center;
    gap: 14px;
    text-align: left;
    padding: 10px;
    border-radius: var(--radius);
    background: var(--surface);
    border: 1px solid var(--border);
}
.dz-preview-img {
    width: 64px;
    height: 64px;
    object-fit: cover;
    border-radius: 10px;
    border: 1px solid var(--border);
    flex-shrink: 0;
}
.dz-preview-file {
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    background: var(--primary-soft);
    border-radius: 10px;
    flex-shrink: 0;
}
.dz-preview-info { min-width: 0; }
.dz-preview-name {
    font-weight: 600;
    font-size: 0.86rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-bottom: 2px;
}
.dz-preview-meta { font-size: 0.75rem; color: var(--text-muted); }
.dz-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-top: 8px;
    padding: 4px 10px;
    border-radius: var(--pill);
    cursor: pointer;
}
.dz-badge-ok { background: rgba(72, 187, 120, 0.12); color: #2f9e5f; }
.dz-progress {
    margin-top: 10px;
    align-items: center;
    gap: 10px;
    font-size: 0.78rem;
    color: var(--text-muted);
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 12px;
}
.dz-progress-active { display: flex; }
.dz-progress-bar {
    height: 6px;
    border-radius: 99px;
    background: linear-gradient(90deg, var(--primary), #B983FF);
    width: 0%;
    transition: width 0.25s ease;
}
.dz-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translate(-50%, 20px);
    background: #c0392b;
    color: #fff;
    padding: 10px 18px;
    border-radius: var(--pill);
    font-size: 0.85rem;
    opacity: 0;
    transition: all 0.2s ease;
    z-index: 2000;
    box-shadow: 0 8px 24px rgba(0,0,0,0.18);
}
.dz-toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---- Email-sending animation (staff assignment) ---- */
.mailing-card {
    width: 100%; max-width: 360px;
    background: var(--surface);
    border-radius: 26px;
    box-shadow: var(--shadow-lg);
    padding: 34px 30px 28px 30px;
    text-align: center;
    animation: scaleIn 0.35s var(--ease) both;
}
.mailing-head { display: flex; justify-content: center; margin-bottom: 6px; }
.mailing-env {
    position: relative;
    width: 108px; height: 92px;
    animation: mailingFloat 2.4s ease-in-out infinite;
}
.mailing-env svg { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 108px; height: 82px; }
.mailing-env .mailing-env-flap { transform-origin: 32px 2px; animation: mailingFlap 2.4s ease-in-out infinite; }
.mailing-env .mailing-runner { position: absolute; left: 50%; top: 30%; transform: translateX(-50%); width: 40px; height: 12px; animation: mailingShoot 2.4s ease-in-out infinite; opacity: 0; }
.mailing-ring {
    position: absolute; inset: -10px; border-radius: 50%;
    border: 3px dashed var(--primary-light);
    animation: mailingSpin 9s linear infinite;
    mask-image: linear-gradient(90deg, rgba(0,0,0,0.5), rgba(0,0,0,0.9));
    -webkit-mask-image: linear-gradient(90deg, rgba(0,0,0,0.5), rgba(0,0,0,0.9));
}
.mailing-title {
    margin-top: 16px;
    font-size: 1.05rem; font-weight: 700; color: var(--text);
    letter-spacing: 0.2px;
}
.mailing-track {
    margin-top: 20px;
    height: 8px; border-radius: 99px;
    background: var(--surface-2);
    overflow: hidden;
    border: 1px solid var(--border);
}
.mailing-track-fill {
    height: 100%; width: 0%;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    border-radius: 99px;
    animation: mailingFill 2.8s ease-in-out forwards;
}
.mailing-track-fill span {
    display: block; width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.55), transparent);
    animation: mailingShine 1.1s linear infinite;
}
.mailing-status {
    margin-top: 12px;
    font-size: 0.78rem; color: var(--text-muted);
    display: flex; align-items: center; justify-content: center; gap: 7px;
}
.mailing-status-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--accent);
    animation: mailingBlink 1s ease-in-out infinite;
}
.mailing-dots { display: flex; justify-content: center; gap: 6px; margin-top: 18px; }
.mailing-dots span {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--primary-light);
    animation: mailingDot 1.2s ease-in-out infinite;
}
.mailing-dots span:nth-child(2) { animation-delay: 0.2s; }
.mailing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes mailingFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes mailingFlap { 0%, 20%, 100% { transform: rotateX(0); } 40%, 60% { transform: rotateX(-58deg); } 80% { transform: rotateX(0); } }
@keyframes mailingShoot { 0% { transform: translateX(-42%) translateY(0); opacity: 0; } 25% { opacity: 1; } 70% { opacity: 1; } 100% { transform: translateX(46%) translateY(-2px); opacity: 0; } }
@keyframes mailingSpin { to { transform: rotate(360deg); } }
@keyframes mailingFill { 0% { width: 0%; } 100% { width: 100%; } }
@keyframes mailingShine { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
@keyframes mailingBlink { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }
@keyframes mailingDot { 0%, 100% { transform: translateY(0); opacity: 0.4; } 50% { transform: translateY(-6px); opacity: 1; } }

/* ---- Two-column layout ---- */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.two-col > * { min-width: 0; }
@media (max-width: 800px) { .two-col { grid-template-columns: 1fr; } }

/* ---- Profile grid (avatar side card + full-width forms) ---- */
.profile-grid { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 22px; align-items: start; }
@media (max-width: 880px) { .profile-grid { grid-template-columns: 1fr; } }
@media (max-width: 480px) { .profile-grid { gap: 16px; } }

/* ---- Detail cards ---- */
.detail-row { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px dashed var(--border); }
.detail-row:last-child { border-bottom: none; }
.detail-row .k { color: var(--text-muted); font-size: 0.86rem; }
.detail-row .v { font-weight: 600; text-align: right; }

/* ---- Video player (custom, no link leak) ---- */
.player-wrap {
    position: relative;
    width: 100%;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    aspect-ratio: 16 / 9;
    background: #000;
}
.player-wrap iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* In fullscreen the wrapper must fill the physical screen: drop the 16:9
   aspect ratio, corners and shadow that would otherwise letterbox the video. */
.player-wrap:fullscreen,
.player-wrap:-webkit-full-screen {
    width: 100vw !important;
    height: 100vh !important;
    max-width: none !important;
    max-height: none !important;
    aspect-ratio: auto !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    margin: 0 !important;
    background: #000 !important;
}
.player-wrap:fullscreen iframe,
.player-wrap:-webkit-full-screen iframe {
    border-radius: 0 !important;
}
.player-wrap:fullscreen .cp-controls,
.player-wrap:-webkit-full-screen .cp-controls {
    padding-top: max(10px, env(safe-area-inset-top));
    padding-bottom: max(10px, env(safe-area-inset-bottom));
}

/* ---- Recordings layout (player + playlist) ---- */
.recorder-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 22px;
    align-items: start;
}

/* ---- Playlist ---- */
.playlist-card { border-radius: var(--radius); }
.playlist-head {
    padding: 16px 18px;
    border-bottom: 1px solid var(--border);
    font-weight: 700;
}
.playlist-scroll {
    max-height: 520px;
    overflow-y: auto;
}
.playlist-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    text-decoration: none;
    color: inherit;
    border-bottom: 1px solid var(--border);
    transition: background 0.15s ease;
    min-width: 0; /* allow children (and their ellipsis) to shrink */
}
.playlist-item:last-child { border-bottom: none; }
.playlist-item:hover { background: rgba(109, 93, 246, 0.06); }
.playlist-item.active { background: rgba(109, 93, 246, 0.12); }
.playlist-item.active .pl-title { color: var(--accent); font-weight: 700; }

.pl-thumb {
    flex: 0 0 auto;
    width: 88px;
    aspect-ratio: 16 / 9;
    border-radius: 8px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.08);
}
.pl-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Text column: min-width:0 enables ellipsis truncation (responsive) */
.playlist-item > div:last-child { min-width: 0; flex: 1 1 auto; }
.pl-title {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.pl-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ---- Playlist tracklist (videos inside a YouTube playlist) ---- */
.pl-tracklist {
    border-top: 1px solid var(--border);
}
.pl-tracklist-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 22px;
    border-bottom: 1px solid var(--border);
    font-weight: 700;
    font-size: 0.95rem;
}
.pl-track-count {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--accent);
    background: var(--accent-soft, #E7FBF5);
    padding: 3px 10px;
    border-radius: 999px;
}
.pl-tracklist-body {
    max-height: 260px;
    overflow-y: auto;
    padding: 6px 8px;
}
.pl-track-load {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-muted);
    font-size: 0.85rem;
    padding: 16px 14px;
}
.pl-track {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    border-radius: 10px;
    cursor: pointer;
    border: 0;
    background: transparent;
    width: 100%;
    text-align: left;
    color: inherit;
    font-family: inherit;
    transition: background 0.15s ease;
}
.pl-track:hover { background: var(--primary-soft, #EEF1FF); }
.pl-track.active { background: var(--primary-soft, #EEF1FF); }
.pl-track.active .pl-track-num,
.pl-track.active .pl-track-title { color: var(--primary); font-weight: 700; }
.pl-track-num {
    flex: 0 0 auto;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--border);
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}
.pl-track-title {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 0.88rem;
    color: var(--text);
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}
.pl-track-now {
    flex: 0 0 auto;
    color: var(--accent);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
}
.pl-track-empty {
    color: var(--text-muted);
    font-size: 0.85rem;
    padding: 16px 14px;
}

/* ---- Responsive: stack playlist below player on smaller screens ---- */
@media (max-width: 992px) {
    .recorder-layout { grid-template-columns: 1fr; }
    .playlist-scroll { max-height: 340px; }
    .pl-thumb { width: 76px; }
}
@media (max-width: 480px) {
    .playlist-item { gap: 10px; padding: 10px 12px; }
    .pl-thumb { width: 64px; }
    .pl-title { font-size: 0.85rem; }
    .pl-meta { font-size: 0.75rem; }
}

/* ---- Custom player UI ---- */
.cp-youtube {
    position: absolute; inset: 0;
    z-index: 1;
    width: 100%; height: 100%; border: 0;
    pointer-events: none !important;
}
.cp-clickcatcher {
    position: absolute; inset: 0;
    z-index: 2;
    background: transparent;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.cp-wrap { cursor: pointer; user-select: none; -webkit-tap-highlight-color: transparent; }
.cp-wrap.playing .cp-overlay { opacity: 0; pointer-events: none; }
.cp-wrap.playing .cp-controls { transform: translateY(0); }
.cp-wrap.paused .cp-overlay { opacity: 1; }

/* overlay (big play + title + buffering) */
.cp-overlay {
    position: absolute; inset: 0; z-index: 3;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(to top, rgba(0,0,0,0.55), rgba(0,0,0,0.15) 45%, rgba(0,0,0,0.3));
    transition: opacity 0.3s ease;
    pointer-events: auto;
}
.cp-bigplay {
    width: 88px; height: 88px; border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    border: none; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.4);
    transition: transform 0.2s ease;
}
.cp-bigplay:hover { transform: scale(1.06); }
.cp-bigplay svg { margin-left: 6px; }
.cp-top {
    position: absolute; top: 0; left: 0; right: 0;
    padding: 16px 18px;
    display: flex; align-items: flex-start;
}
.cp-top-title {
    color: #fff; font-weight: 600; font-size: 0.95rem;
    text-shadow: 0 1px 4px rgba(0,0,0,0.6);
    max-width: 70%;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cp-center-loading { position: absolute; }
.spinner {
    width: 44px; height: 44px; border-radius: 50%;
    border: 4px solid rgba(255,255,255,0.25);
    border-top-color: #fff;
    animation: spin 0.8s linear infinite;
    display: block;
}

/* control bar */
.cp-controls {
    position: absolute; left: 0; right: 0; bottom: 0; z-index: 4;
    display: flex; align-items: center; gap: 12px;
    padding: 10px 14px;
    background: linear-gradient(to top, rgba(0,0,0,0.85), rgba(0,0,0,0));
    transform: translateY(8px);
    transition: transform 0.3s ease, opacity 0.3s ease;
    opacity: 0;
}
.cp-wrap.controls-visible .cp-controls { opacity: 1; }
.cp-btn {
    background: transparent; border: none; cursor: pointer;
    color: #fff; display: flex; align-items: center; justify-content: center;
    opacity: 0.9; transition: opacity 0.15s ease;
    padding: 4px;
}
.cp-btn:hover { opacity: 1; }
.cp-btn svg { display: block; }
.cp-time {
    color: #fff; font-size: 0.8rem; font-variant-numeric: tabular-nums;
    min-width: 86px; white-space: nowrap;
}

/* progress / seek */
.cp-progress {
    position: relative; flex: 1; height: 22px;
    display: flex; align-items: center; cursor: pointer;
}
.cp-progress-track {
    position: relative; width: 100%; height: 5px;
    background: rgba(255,255,255,0.3);
    border-radius: var(--pill); overflow: visible;
}
.cp-buffered {
    position: absolute; left: 0; top: 0; height: 100%;
    background: rgba(255,255,255,0.35); border-radius: var(--pill);
}
.cp-progress-fill {
    position: absolute; left: 0; top: 0; height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    border-radius: var(--pill);
}
.cp-scrubber {
    position: absolute; top: 50%; margin-top: -7px;
    width: 14px; height: 14px; border-radius: 50%;
    background: #fff; box-shadow: 0 1px 5px rgba(0,0,0,0.5);
    transform: translateX(-50%) scale(0);
    transition: transform 0.15s ease;
}
.cp-progress:hover .cp-scrubber, .cp-progress:active .cp-scrubber { transform: translateX(-50%) scale(1); }
.cp-seek {
    position: absolute; inset: 0; width: 100%; height: 100%;
    opacity: 0; cursor: pointer; margin: 0;
}

/* speed */
.cp-speed {
    font-size: 0.85rem; font-weight: 600; min-width: 34px;
}
.cp-speed-menu {
    position: absolute; bottom: 54px; right: 60px; z-index: 5;
    background: rgba(15,15,25,0.95);
    border: 1px solid var(--border); border-radius: 12px;
    padding: 6px; display: flex; flex-direction: column; gap: 2px;
    box-shadow: var(--shadow-lg);
}
.cp-speed-item {
    background: transparent; border: none; color: #dcdce6; cursor: pointer;
    text-align: left; padding: 7px 14px; border-radius: 8px; font-size: 0.85rem;
}
.cp-speed-item:hover { background: rgba(255,255,255,0.08); }
.cp-speed-item.active { color: var(--accent); font-weight: 700; background: rgba(109,93,246,0.15); }

/* quality */
.cp-quality { gap: 4px; }
.cp-q-label {
    font-size: 0.78rem; font-weight: 600; color: #fff;
    background: rgba(255,255,255,0.15);
    padding: 2px 7px; border-radius: var(--pill);
}
.cp-quality-menu {
    position: absolute; bottom: 54px; right: 118px; z-index: 5;
    background: rgba(15,15,25,0.95);
    border: 1px solid var(--border); border-radius: 12px;
    padding: 8px; display: flex; flex-direction: column; gap: 2px;
    box-shadow: var(--shadow-lg);
    min-width: 150px;
}
.cp-menu-title {
    color: rgba(255,255,255,0.55); font-size: 0.72rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.5px; padding: 4px 10px 6px;
}
.cp-quality-item {
    background: transparent; border: none; color: #e8e8f0; cursor: pointer;
    text-align: left; padding: 7px 10px; border-radius: 8px; font-size: 0.85rem;
}
.cp-quality-item:hover { background: rgba(255,255,255,0.08); }
.cp-quality-item.active { color: var(--accent); font-weight: 700; background: rgba(109,93,246,0.15); }

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

@media (max-width: 640px) {
    .cp-bigplay { width: 66px; height: 66px; }
    .cp-time { min-width: 74px; }
}

/* ---- Chat ---- */
.chat-layout { display: flex; gap: 20px; height: calc(100vh - 200px); min-height: 480px; }
.chat-sessions { width: 300px; flex-shrink: 0; }
.chat-sessions .session-list { overflow-y: auto; flex: 1; }
.chat-window { flex: 1; display: flex; flex-direction: column; }
.chat-messages { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 12px; background: var(--surface-2); border-radius: 12px; }
.chat-msg { max-width: 75%; padding: 12px 16px; border-radius: 16px; font-size: 0.9rem; line-height: 1.45; animation: fadeInUp 0.3s ease both; }
.chat-msg .cm-meta { font-size: 0.72rem; opacity: 0.7; margin-top: 4px; }
.chat-msg.incoming { align-self: flex-start; background: var(--surface); border: 1px solid var(--border); border-bottom-left-radius: 4px; box-shadow: var(--shadow-sm); }
.chat-msg.outgoing { align-self: flex-end; background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: #fff; border-bottom-right-radius: 4px; }
.chat-input-bar { display: flex; gap: 10px; padding-top: 14px; }
.chat-input-bar input { flex: 1; }
@media (max-width: 800px) { .chat-layout { flex-direction: column; height: auto; } .chat-sessions { width: 100%; } }

/* ---- Toggle switch ---- */
.switch { position: relative; display: inline-block; width: 50px; height: 28px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
    position: absolute; inset: 0; cursor: pointer;
    background: var(--border); border-radius: var(--pill);
    transition: var(--transition);
}
.switch .slider::before {
    content: ''; position: absolute; height: 22px; width: 22px;
    left: 3px; bottom: 3px; background: #fff; border-radius: 50%;
    transition: var(--transition); box-shadow: var(--shadow-sm);
}
.switch input:checked + .slider { background: var(--accent); }
.switch input:checked + .slider::before { transform: translateX(22px); }

/* Responsive */
@media (max-width: 640px) {
    .data-table thead { display: none; }
    .data-table, .data-table tbody, .data-table tr, .data-table td { display: block; width: 100%; }
    table.data-table { min-width: 0; }
    .data-table tbody tr { padding: 10px 0; border-bottom: 1px solid var(--border); }
    .data-table tbody td { box-sizing: border-box; border: none; padding: 8px 24px; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
    .data-table tbody td::before { content: attr(data-label); font-weight: 700; color: var(--text-muted); font-size: 0.75rem; }
}

/* ---- Live Chat (AJAX) ---- */
.chat-layout { align-items: stretch; }
.chat-sidebar {
    width: 320px; flex-shrink: 0; display: flex; flex-direction: column;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-sm); overflow: hidden; box-shadow: var(--shadow-sm);
}
.chat-sidebar-head {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 16px 18px; border-bottom: 1px solid var(--border);
}
.chat-sidebar-head h3 { margin: 0; font-size: 1rem; }
.convos { flex: 1; overflow-y: auto; padding: 8px; }
.convo-item {
    display: flex; align-items: center; gap: 12px; padding: 10px 12px;
    border-radius: 12px; color: var(--text); text-decoration: none;
    transition: background 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
    animation: fadeInUp 0.35s ease both;
}
.convo-item:hover { background: var(--surface-2); transform: translateX(2px); }
.convo-item.active {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff; box-shadow: var(--shadow-primary);
}
.mini-avatar {
    width: 40px; height: 40px; border-radius: 50%; flex: none;
    display: grid; place-items: center; font-weight: 700; color: #fff; font-size: 0.9rem;
    background: linear-gradient(135deg, var(--primary), var(--accent));
}
.convo-item.active .mini-avatar { background: rgba(255,255,255,0.22); }
.convo-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.convo-name { font-weight: 600; font-size: 0.9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.convo-time { font-size: 0.7rem; color: var(--text-muted); }
.convo-item.active, .convo-item.active .convo-name { color: #fff; }
.convo-item.active .convo-time,
.convo-item.active .cu-sub { color: rgba(255,255,255,0.78); }
.convo-item .badge { animation: badgePulse 1.6s ease infinite; }
.convo-item.active .badge { background: #fff; color: var(--primary); }
.cu-sub { font-size: 0.72rem; color: var(--text-muted); }

.chat-main {
    flex: 1; min-width: 0; display: flex; flex-direction: column;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-sm); overflow: hidden; box-shadow: var(--shadow-sm);
}
.chat-thread-head {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 14px 18px; border-bottom: 1px solid var(--border); background: var(--surface);
}
.chat-thread-live {
    display: inline-flex; align-items: center; gap: 7px;
    font-size: 0.7rem; font-weight: 700; letter-spacing: 0.6px; text-transform: uppercase;
    color: var(--accent-dark); background: var(--accent-soft);
    border: 1px solid #BDEBE0; padding: 5px 12px; border-radius: var(--pill);
}
.chat-thread-live .live-dot {
    width: 8px; height: 8px; border-radius: 50%; background: var(--accent);
    animation: livePing 1.6s ease infinite;
}
.chat-sound-btn {
    width: 38px; height: 38px; border-radius: 50%; cursor: pointer;
    display: grid; place-items: center; font-size: 1.05rem;
    background: var(--surface-2); border: 1px solid var(--border);
    transition: all 0.18s ease; color: var(--text);
}
.chat-sound-btn:hover { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }
.chat-sound-btn.off { opacity: 0.55; background: var(--danger-soft); border-color: #F5C6C8; }
.chat-messages {
    flex: 1; overflow-y: auto; padding: 22px 20px; display: flex; flex-direction: column; gap: 14px;
    background: var(--surface-2);
}
.chat-messages::-webkit-scrollbar { width: 8px; }
.chat-messages::-webkit-scrollbar-thumb { background: var(--border); border-radius: var(--pill); }
.chat-messages::-webkit-scrollbar-thumb:hover { background: var(--text-light); }
.chat-bubble {
    max-width: 78%; padding: 11px 15px; border-radius: 18px;
    font-size: 0.9rem; line-height: 1.5; word-break: break-word; position: relative;
    box-shadow: var(--shadow-sm);
}
.chat-bubble.incoming {
    align-self: flex-start; background: var(--surface); border: 1px solid var(--border);
    border-bottom-left-radius: 6px; animation: msgIn 0.35s ease both;
}
.chat-bubble.mine {
    align-self: flex-end; color: #fff;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-bottom-right-radius: 6px; animation: msgPop 0.32s ease both;
}
.cb-text { white-space: pre-wrap; }
.cb-time { font-size: 0.68rem; opacity: 0.72; margin-top: 5px; text-align: right; font-variant-numeric: tabular-nums; }
.chat-bubble.mine .cb-time { color: rgba(255,255,255,0.85); }
.chat-bubble.highlight { box-shadow: 0 0 0 4px var(--primary-soft), var(--shadow-sm); }

.chat-input { display: flex; gap: 10px; padding: 14px 16px; border-top: 1px solid var(--border); background: var(--surface); }
.chat-field {
    flex: 1; min-width: 0; padding: 12px 18px; font-size: 0.9rem;
    border: 1.5px solid var(--border); border-radius: var(--pill); background: var(--surface-2);
    color: var(--text); transition: all 0.2s ease;
}
.chat-field:focus { outline: none; border-color: var(--primary); background: var(--surface); box-shadow: 0 0 0 4px var(--primary-soft); }
.chat-field::placeholder { color: var(--text-light); }
.chat-send {
    border-radius: var(--pill); padding: 12px 24px; font-weight: 600;
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.chat-send.sending { opacity: 0.65; pointer-events: none; }
.chat-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 40px; text-align: center; color: var(--text-muted); animation: fadeInUp 0.4s ease both; }
.chat-empty h4 { margin: 0; color: var(--text); }

.typing-dots { display: inline-flex; align-items: center; gap: 4px; }
.typing-dots span {
    width: 6px; height: 6px; border-radius: 50%; background: currentColor;
    animation: dotBounce 1s ease-in-out infinite;
}
.typing-dots span:nth-child(2) { animation-delay: 0.15s; }
.typing-dots span:nth-child(3) { animation-delay: 0.3s; }
.chat-send .typing-dots span { background: #fff; }

.chat-notice {
    align-self: center; font-size: 0.72rem; color: var(--text-muted);
    background: var(--surface); border: 1px dashed var(--border);
    padding: 5px 14px; border-radius: var(--pill); animation: fadeInUp 0.3s ease both;
}

@keyframes msgIn { from { opacity: 0; transform: translateY(12px) scale(0.96); } to { opacity: 1; transform: none; } }
@keyframes msgPop { 0% { opacity: 0; transform: scale(0.7); } 60% { transform: scale(1.05); } 100% { opacity: 1; transform: scale(1); } }
@keyframes livePing { 0% { box-shadow: 0 0 0 0 rgba(18,195,154,0.5); } 100% { box-shadow: 0 0 0 8px rgba(18,195,154,0); } }
@keyframes dotBounce { 0%, 80%, 100% { transform: translateY(0); opacity: 0.5; } 40% { transform: translateY(-4px); opacity: 1; } }
@keyframes badgePulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.15); } }
@keyframes titleFlash { from { opacity: 0.35; } to { opacity: 1; } }

@media (max-width: 800px) {
    .chat-layout { flex-direction: column; height: auto; }
    .chat-sidebar { width: 100%; max-height: 320px; }
    .chat-main { min-height: 420px; }
}

/* ---- Global chat notification toast (any dashboard page) ---- */
.nt-toast {
    position: fixed; top: 22px; right: 22px; z-index: 9999;
    display: flex; align-items: center; gap: 12px;
    max-width: 340px; padding: 12px 16px 12px 12px;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 16px; box-shadow: var(--shadow-lg);
    text-decoration: none; color: var(--text);
    animation: ntIn 0.4s var(--ease) both;
}
.nt-toast:hover { transform: translateY(-2px); box-shadow: 0 22px 55px rgba(23,43,99,0.18); }
.nt-toast.hide { animation: ntOut 0.28s ease-in both; }
.nt-toast-icon {
    width: 42px; height: 42px; border-radius: 50%; flex: none;
    display: grid; place-items: center; font-size: 1.25rem;
    background: linear-gradient(135deg, var(--primary), var(--accent));
}
.nt-toast-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.nt-toast-title { font-weight: 700; font-size: 0.88rem; }
.nt-toast-sub { font-size: 0.76rem; color: var(--text-muted); }
.nt-toast-arrow { color: var(--primary); font-weight: 700; margin-left: 2px; }

.nav-badge-pop { animation: badgePop 0.4s var(--ease); }

@keyframes ntIn {
    from { opacity: 0; transform: translateX(30px) scale(0.94); }
    to { opacity: 1; transform: none; }
}
@keyframes ntOut {
    from { opacity: 1; transform: none; }
    to { opacity: 0; transform: translateY(-14px) scale(0.95); }
}
@keyframes badgePop {
    0% { transform: scale(0.6); }
    55% { transform: scale(1.35); }
    100% { transform: scale(1); }
}

@media (max-width: 640px) {
    .nt-toast { left: 14px; right: 14px; max-width: none; }
}

/* Center uploaded profile avatar (global img{display:block} makes it a block
   element that ignores text-align on the card) */
.profile-avatar { margin: 0 auto; }

/* ---- Conductor "Invite Students" share panel (academy/index.php) ----
   Compact creative design: head row + inline link box & share buttons +
   a slim public-page line. Minimal vertical footprint (matches the old
   compact panel height) but keeps the gradient, blobs and share colors. */
.invite-panel {
    position: relative;
    overflow: hidden;
    border-radius: var(--radius);
    background: var(--surface);
    border: 1.5px solid var(--primary-light);
    box-shadow: var(--shadow-sm);
    margin-bottom: 24px;
    padding: 18px 20px;
    animation: inviteIn 0.5s var(--ease) both;
}
@keyframes inviteIn {
    from { opacity: 0; transform: translateY(16px) scale(0.99); }
    to { opacity: 1; transform: none; }
}

/* floating background blobs */
.invite-blob {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
}
.invite-blob-1 { width: 150px; height: 150px; top: -60px; right: -30px; background: radial-gradient(circle, rgba(109,93,246,.18), transparent 70%); animation: blobFloat 7s ease-in-out infinite; }
.invite-blob-2 { width: 110px; height: 110px; bottom: -50px; left: -30px; background: radial-gradient(circle, rgba(18,195,154,.16), transparent 70%); animation: blobFloat 9s ease-in-out infinite reverse; }
@keyframes blobFloat {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-10px) scale(1.05); }
}

/* compact head row */
.invite-head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}
.invite-head-icon {
    width: 44px; height: 44px; flex-shrink: 0;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    box-shadow: var(--shadow-sm);
}
.invite-head-icon svg { display: block; }
.invite-head-text h3 { font-size: 1rem; margin-bottom: 2px; }
.invite-head-text p { color: var(--text-muted); font-size: 0.8rem; margin: 0; }

/* main row: link box + share buttons inline */
.invite-main {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.invite-link-box {
    flex: 1;
    min-width: 240px;
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--primary-soft);
    border: 1.5px solid var(--primary-light);
    border-radius: var(--radius-sm);
    padding: 6px 6px 6px 14px;
    transition: var(--transition);
}
.invite-link-box:focus-within { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(109,93,246,.12); }
.invite-link-icon { color: var(--primary); flex-shrink: 0; display: flex; align-items: center; }
.share-link-input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 0.85rem;
    font-family: monospace;
    color: var(--text);
    min-width: 0;
}
.share-link-input:focus { outline: none; }
.share-copy-btn {
    border: none;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    font-weight: 700;
    font-size: 0.8rem;
    padding: 8px 14px;
    border-radius: 10px;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    display: inline-flex; align-items: center; gap: 6px;
}
.share-copy-btn:hover { filter: brightness(1.08); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.share-copy-btn:active { transform: translateY(0); }

/* share buttons (single inline row) */
.invite-share-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.inv-share {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: var(--pill);
    border: none;
    font-weight: 700;
    font-size: 0.8rem;
    cursor: pointer;
    color: #fff;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}
.inv-share::after {
    content: '';
    position: absolute; top: 0; left: -60%;
    width: 50%; height: 100%;
    background: linear-gradient(120deg, transparent, rgba(255,255,255,.25), transparent);
    transition: left .5s var(--ease);
}
.inv-share:hover::after { left: 120%; }
.inv-share:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.inv-share:active { transform: translateY(0); }
.inv-share-ic { display: block; flex-shrink: 0; }
.inv-share-wa { background: #25D366; }
.inv-share-fb { background: #1877F2; }
.inv-share-mail { background: #EA4335; }
.inv-share-link { background: linear-gradient(135deg, var(--primary), var(--accent)); }

/* public page slim row */
.invite-public {
    position: relative;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px dashed var(--border);
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.invite-public-label {
    font-weight: 700; font-size: 0.8rem; color: var(--text-muted); white-space: nowrap;
    display: inline-flex; align-items: center; gap: 6px;
}
.invite-public-label svg { display: block; flex-shrink: 0; }
.invite-public-link {
    flex: 1;
    min-width: 180px;
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 6px 6px 6px 12px;
}
.invite-public-url {
    font-family: monospace;
    font-size: 0.76rem;
    color: var(--primary);
    word-break: break-all;
    flex: 1;
}
.share-link-copy {
    border: none;
    background: var(--primary-soft);
    color: var(--primary);
    width: 26px; height: 26px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    display: inline-flex; align-items: center; justify-content: center;
    transition: var(--transition);
    flex-shrink: 0;
}
.share-link-copy:hover { background: var(--primary); color: #fff; }
.share-toast {
    position: fixed;
    bottom: 26px; left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--primary);
    color: #fff;
    padding: 12px 22px;
    border-radius: var(--pill);
    font-weight: 600;
    font-size: 0.88rem;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    transition: opacity 0.3s var(--ease), transform 0.3s var(--ease);
    z-index: 9999;
    pointer-events: none;
}
.share-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.warning-row { display: flex; gap: 12px; align-items: flex-start; padding: 14px 18px; border-bottom: 1px solid var(--border, #E3E7F5); }
.warning-row:last-child { border-bottom: none; }
.warning-row .wr-icon { font-size: 1.1rem; line-height: 1.4; }
.warning-row .wr-body { flex: 1; min-width: 0; color: var(--text, #1C1C3A); }
.warning-row .wr-meta { font-size: 0.8rem; margin-top: 4px; }

.special-banner {
    position: relative;
    overflow: hidden;
    margin: 0 0 22px;
    border-radius: var(--radius);
    background: linear-gradient(135deg, #7C3AED 0%, #6D5DF6 45%, #4F46E5 100%);
    color: #fff;
    box-shadow: 0 10px 24px rgba(109, 93, 246, 0.28);
    animation: sbEnter 0.6s var(--ease) both;
}
.special-banner::after {
    content: "";
    position: absolute; top: 0; left: -120%;
    width: 60%; height: 100%;
    background: linear-gradient(105deg, transparent, rgba(255, 255, 255, 0.35), transparent);
    animation: sbShine 3.5s ease-in-out infinite;
}
.special-banner .special-banner-inner {
    position: relative; z-index: 2;
    display: flex; align-items: center; gap: 16px;
    padding: 18px 22px; flex-wrap: wrap;
}
.special-banner .sb-icon { font-size: 1.8rem; flex-shrink: 0; animation: sbBob 2.2s ease-in-out infinite; }
.special-banner .sb-body { flex: 1; min-width: 200px; }
.special-banner .sb-title { font-weight: 700; font-size: 1.05rem; margin-bottom: 4px; }
.special-banner .sb-sub { font-size: 0.88rem; color: rgba(255, 255, 255, 0.92); line-height: 1.5; }
.special-banner .sb-sub strong { color: #FFE259; }
.special-banner .sb-action { flex-shrink: 0; background: #fff; color: var(--primary); border: none; }
.special-banner.anim { animation: sbEnter 0.6s var(--ease) both; }
@keyframes sbEnter {
    0% { opacity: 0; transform: translateY(-14px) scale(0.97); }
    60% { transform: translateY(2px) scale(1.01); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes sbShine {
    0% { left: -120%; }
    60%, 100% { left: 130%; }
}
@keyframes sbBob {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}

.plan-feature-checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.feature-check {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--border, #E3E7F5);
    border-radius: var(--radius-sm, 8px);
    background: var(--surface-2, #F7F8FD);
    cursor: pointer;
}
.feature-check input { margin-top: 3px; accent-color: var(--primary, #6D5DF6); cursor: pointer; }
.feature-check-label { display: flex; flex-direction: column; line-height: 1.3; }
.feature-check-label > span { font-weight: 600; font-size: 0.9rem; color: var(--text, #1C1C3A); }
.feature-check-label small { color: var(--text-light, #8A90A8); font-size: 0.74rem; margin-top: 2px; }

@media (max-width: 640px) {
    .invite-panel { padding: 14px 14px; }
    .invite-main { flex-direction: column; align-items: stretch; }
    .invite-link-box { min-width: 0; }
    .invite-share-btns { justify-content: center; }
}

/* ---- Extended mobile responsiveness ---- */

/* Modal full-width on small screens */
@media (max-width: 600px) {
    .modal-overlay { padding: 12px; align-items: flex-end; }
    .modal { max-width: 100%; border-radius: var(--radius-lg) var(--radius-lg) 0 0; max-height: 92vh; }
    .modal-header { padding: 18px 20px; }
    .modal-body { padding: 20px 20px 8px; }
    .modal-footer { padding: 14px 20px 20px; flex-direction: column; }
    .modal-footer .btn { width: 100%; }
}

/* Page toolbar: stack on mobile */
@media (max-width: 640px) {
    .page-toolbar { flex-direction: column; align-items: stretch; }
    .page-toolbar h2 { font-size: 1.15rem; }
}

/* Search box: full width on mobile */
@media (max-width: 640px) {
    .search-box { width: 100%; }
    .search-box input { min-width: 0; width: 100%; }
}

/* Grid cards: tighter gap on small screens */
@media (max-width: 640px) {
    .grid-cards { grid-template-columns: 1fr; gap: 16px; }
    .item-card .item-body { padding: 15px 16px; }
    .item-card .item-foot { padding: 12px 16px; }
}

/* Detail rows: keep key/value clean on narrow screens */
@media (max-width: 480px) {
    .detail-row { flex-direction: column; gap: 2px; }
    .detail-row .v { text-align: left; }
}

/* Mailing card: full width on tiny screens */
@media (max-width: 480px) {
    .mailing-card { padding: 26px 18px 22px; }
}

/* Feature check grid: single column on small screens */
@media (max-width: 480px) {
    .plan-feature-checks { grid-template-columns: 1fr; }
}

/* Special banner: stack on mobile */
@media (max-width: 560px) {
    .special-banner .special-banner-inner { flex-direction: column; align-items: flex-start; text-align: left; }
    .special-banner .sb-action { width: 100%; justify-content: center; }
}

/* NT toast already handled at 640px above */

/* Chat on very small screens: full-height thread, tighter spacing */
@media (max-width: 480px) {
    .chat-main { min-height: 70vh; }
    .chat-bubble { max-width: 90%; }
    .chat-messages { padding: 16px 12px; }
    .chat-cinput, .chat-input { padding: 12px 12px; }
    .chat-input { gap: 8px; }
    .chat-sidebar { max-height: 200px; }
    .chat-send { padding: 12px 16px; }
}

/* ============================================================
   Landscape phones (short viewports)
   ============================================================ */
@media (max-height: 520px) and (orientation: landscape) {
    .page-toolbar { margin-bottom: 10px; }
    .page-toolbar h2 { font-size: 1.1rem; }
    .table-card { margin-bottom: 16px; }

    /* Profile: full-width fields, no cramped columns in short viewports */
    .profile-grid { grid-template-columns: 1fr; }
    .two-col { grid-template-columns: 1fr; gap: 14px; }

    /* Chat: side-by-side and viewport-height so the thread fits on screen */
    .chat-layout { flex-direction: row; height: calc(100vh - 120px); min-height: 160px; }
    .chat-sidebar { width: 240px; max-height: none; }
    .chat-main { min-height: 0; }
    .chat-thread-head { padding: 8px 14px; }
    .chat-messages { padding: 10px 14px; }
    .chat-input { padding: 10px 12px; }

    /* Recorder: cap player height so the playlist stays reachable */
    .player-wrap { aspect-ratio: auto; height: 46vh; }
    .playlist-scroll { max-height: 26vh; }

    /* Modals: compact, centered */
    .modal-header { padding: 12px 18px; }
    .modal-body { padding: 14px 18px 4px; }
    .modal-footer { padding: 12px 18px 16px; }

    /* Denser cards */
    .grid-cards { gap: 12px; }
}

/* Landscape phones: denser 2-col cards + tables as stacked cards (also covers the 901-920px band where the sidebar eats width) */
@media (max-height: 520px) and (orientation: landscape) and (max-width: 920px) {
    .grid-cards { grid-template-columns: repeat(2, 1fr); }
    .data-table thead { display: none; }
    .data-table, .data-table tbody, .data-table tr, .data-table td { display: block; width: 100%; }
    table.data-table { min-width: 0; }
    .data-table tbody tr { padding: 10px 0; border-bottom: 1px solid var(--border); }
    .data-table tbody td { box-sizing: border-box; border: none; padding: 8px 24px; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
    .data-table tbody td::before { content: attr(data-label); font-weight: 700; color: var(--text-muted); font-size: 0.75rem; }
}



