/* Tanzeel Expert Portal - refined teaching studio UI */

:root {
    --ink-950: #070806;
    --ink-925: #0b0d0a;
    --ink-900: #10110d;
    --ink-850: #171610;
    --ink-800: #211f16;
    --paper-50: #fbf4e3;
    --paper-100: #f3e8cc;
    --paper-200: #e1cfa5;
    --gold-300: #f3d98c;
    --gold-400: #d8b76c;
    --gold-500: #b99450;
    --gold-600: #8e6a35;
    --clay-400: #b48763;
    --danger: #d96b66;
    --success: #9fc98e;
    --info: #a9bed0;
    --text-primary: #fbf4e3;
    --text-secondary: rgba(251, 244, 227, 0.74);
    --text-tertiary: rgba(251, 244, 227, 0.54);
    --text-muted: rgba(251, 244, 227, 0.36);
    --surface-1: rgba(251, 244, 227, 0.045);
    --surface-2: rgba(251, 244, 227, 0.075);
    --surface-3: rgba(251, 244, 227, 0.105);
    --surface-rich: linear-gradient(145deg, rgba(251, 244, 227, 0.095), rgba(251, 244, 227, 0.035));
    --border-subtle: rgba(243, 217, 140, 0.14);
    --border-strong: rgba(243, 217, 140, 0.28);
    --border-accent: rgba(216, 183, 108, 0.42);
    --shadow-soft: 0 18px 44px rgba(0, 0, 0, 0.28);
    --shadow-strong: 0 28px 80px rgba(0, 0, 0, 0.42);
    --radius-sm: 7px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-pill: 999px;
    --transition-fast: 150ms ease;
    --transition-base: 240ms cubic-bezier(0.22, 1, 0.36, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    min-height: 100vh;
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--text-primary);
    background:
        linear-gradient(140deg, rgba(243, 217, 140, 0.09), transparent 36%),
        linear-gradient(225deg, rgba(180, 135, 99, 0.08), transparent 42%),
        linear-gradient(180deg, var(--ink-950), var(--ink-925) 46%, var(--ink-950));
    line-height: 1.55;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    opacity: 0.2;
    background-image:
        linear-gradient(rgba(251, 244, 227, 0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(251, 244, 227, 0.025) 1px, transparent 1px);
    background-size: 48px 48px;
    mask-image: linear-gradient(to bottom, black, transparent 82%);
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: 'Fraunces', 'Outfit', serif;
    font-weight: 600;
    letter-spacing: 0;
    line-height: 1.08;
}

button,
input,
textarea,
select {
    font: inherit;
}

button {
    cursor: pointer;
}

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(243, 217, 140, 0.18); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: rgba(243, 217, 140, 0.28); }

.screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hidden {
    display: none !important;
}

/* Login */
#login-screen {
    position: relative;
    padding: 24px;
}

.login-container {
    position: relative;
    width: min(440px, 100%);
    padding: 46px;
    background: var(--surface-rich);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-strong);
    backdrop-filter: blur(18px);
}

.login-header {
    text-align: center;
    margin-bottom: 34px;
}

.login-icon {
    width: 84px;
    height: 84px;
    margin: 0 auto 20px;
    border-radius: 20px;
    overflow: hidden;
    background: #010200;
    border: 1px solid var(--border-strong);
    box-shadow: 0 18px 44px rgba(185, 148, 80, 0.24);
}

.login-icon.small {
    width: 46px;
    height: 46px;
    margin: 0 0 14px;
    border-radius: 12px;
}

.login-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.login-header h1 {
    color: var(--paper-50);
    font-size: 36px;
    margin-bottom: 8px;
}

.login-header p {
    color: var(--gold-300);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.form-group input,
.form-group select,
.form-group textarea,
.chat-input input,
.search-box input {
    width: 100%;
    padding: 13px 15px;
    color: var(--text-primary);
    background: rgba(7, 8, 6, 0.56);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    outline: none;
    transition: border-color var(--transition-base), box-shadow var(--transition-base), background var(--transition-base);
}

.form-group textarea {
    resize: vertical;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus,
.chat-input input:focus,
.search-box input:focus {
    border-color: var(--gold-400);
    background: rgba(7, 8, 6, 0.72);
    box-shadow: 0 0 0 4px rgba(216, 183, 108, 0.13);
}

.form-group input::placeholder,
.form-group textarea::placeholder,
.search-box input::placeholder,
.chat-input input::placeholder {
    color: var(--text-muted);
}

.error-message {
    color: var(--danger);
    font-size: 13px;
    margin-top: 14px;
    text-align: center;
}

.forgot-password {
    margin-top: 18px;
    text-align: center;
}

.forgot-password a {
    color: var(--gold-300);
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
}

.forgot-password a:hover {
    text-decoration: underline;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 42px;
    padding: 10px 18px;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 800;
    text-decoration: none;
    transition: transform var(--transition-base), box-shadow var(--transition-base), border-color var(--transition-base), background var(--transition-base);
}

.btn:hover {
    transform: translateY(-1px);
}

.btn-primary {
    color: #171006;
    background: linear-gradient(135deg, var(--gold-300), var(--gold-500));
    box-shadow: 0 14px 34px rgba(185, 148, 80, 0.30);
}

.btn-secondary {
    color: var(--text-primary);
    background: var(--surface-1);
    border-color: var(--border-subtle);
}

.btn-secondary:hover {
    background: var(--surface-2);
    border-color: var(--border-strong);
}

.btn-full { width: 100%; }
.btn-small { min-height: 34px; padding: 7px 12px; font-size: 12px; }

/* Shell */
#dashboard-screen {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    min-height: 100vh;
    background: transparent;
}

.sidebar {
    position: sticky;
    top: 0;
    z-index: 50;
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: rgba(13, 15, 12, 0.9);
    border-right: 1px solid var(--border-subtle);
    backdrop-filter: blur(18px);
}

.sidebar-header {
    padding: 26px 24px 22px;
    border-bottom: 1px solid var(--border-subtle);
}

.sidebar-header h2 {
    color: var(--paper-50);
    font-size: 25px;
}

.sidebar-header span {
    display: block;
    margin-top: 5px;
    color: var(--gold-400);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.nav-menu {
    list-style: none;
    padding: 16px 12px;
    flex: 1;
}

.nav-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 46px;
    padding: 10px 12px;
    margin-bottom: 6px;
    color: var(--text-secondary);
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: color var(--transition-base), background var(--transition-base), border-color var(--transition-base);
}

.nav-item:hover {
    color: var(--text-primary);
    background: var(--surface-1);
}

.nav-item.active {
    color: var(--gold-300);
    background: rgba(216, 183, 108, 0.12);
    border-color: rgba(216, 183, 108, 0.28);
}

.nav-icon,
.stat-icon {
    display: grid;
    place-items: center;
    flex-shrink: 0;
    font-weight: 900;
    letter-spacing: 0;
}

.nav-icon {
    width: 30px;
    height: 30px;
    color: var(--gold-300);
    background: rgba(216, 183, 108, 0.10);
    border: 1px solid rgba(216, 183, 108, 0.16);
    border-radius: 9px;
    font-size: 11px;
}

.stat-icon {
    width: 54px;
    height: 54px;
    color: #171006;
    background: linear-gradient(135deg, var(--gold-300), var(--gold-500));
    border-radius: 14px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.26);
    font-size: 13px;
}

[data-icon="chart"]::before { content: "D"; }
[data-icon="students"]::before { content: "S"; }
[data-icon="recording"]::before { content: "R"; }
[data-icon="messages"]::before { content: "M"; }
[data-icon="pending"]::before { content: "P"; }
[data-icon="completed"]::before { content: "C"; }

.badge {
    margin-left: auto;
    padding: 2px 8px;
    color: #fff7f2;
    background: var(--danger);
    border-radius: var(--radius-pill);
    font-size: 11px;
    font-weight: 900;
}

.sidebar-footer {
    padding: 18px;
    border-top: 1px solid var(--border-subtle);
}

.expert-info {
    padding: 13px;
    margin-bottom: 12px;
    color: var(--text-secondary);
    background: var(--surface-1);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    text-align: center;
}

#expert-name {
    color: var(--text-primary);
    font-weight: 800;
}

.main-content {
    min-height: 100vh;
    min-width: 0;
}

.top-bar {
    position: sticky;
    top: 0;
    z-index: 40;
    min-height: 74px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 18px 32px;
    background: rgba(7, 8, 6, 0.74);
    border-bottom: 1px solid var(--border-subtle);
    backdrop-filter: blur(18px);
}

#page-title {
    color: var(--paper-50);
    font-size: 28px;
}

#current-date {
    color: var(--text-tertiary);
    font-size: 13px;
    font-weight: 700;
}

.content-section {
    padding: 32px;
    animation: riseIn 360ms var(--transition-base) both;
}

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

/* Cards and stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 30px;
}

.stat-card,
.card,
.student-card,
.recording-item,
.messages-container {
    background: var(--surface-rich);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
}

.stat-card {
    min-height: 122px;
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 22px;
}

.stat-card.highlight {
    border-color: var(--border-accent);
    background: linear-gradient(145deg, rgba(216, 183, 108, 0.14), rgba(251, 244, 227, 0.035));
}

.stat-info h3 {
    font-family: 'Outfit', sans-serif;
    color: var(--paper-50);
    font-size: 32px;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 7px;
}

.stat-info p {
    color: var(--text-tertiary);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 22px;
}

.card {
    overflow: hidden;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 18px 22px;
    border-bottom: 1px solid var(--border-subtle);
}

.card-header h3 {
    font-size: 18px;
}

.card-header a {
    color: var(--gold-300);
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0.06em;
    text-decoration: none;
    text-transform: uppercase;
}

.card-body {
    max-height: 330px;
    overflow-y: auto;
    padding: 14px;
}

.list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 5px;
    padding: 13px 14px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background var(--transition-base);
}

.list-item:hover {
    background: var(--surface-1);
}

.list-item-info {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.list-item-info strong {
    font-size: 14px;
    font-weight: 800;
}

.list-item-info span {
    color: var(--text-tertiary);
    font-size: 12px;
}

.empty-state {
    padding: 38px 20px;
    color: var(--text-tertiary);
    text-align: center;
    font-size: 14px;
}

/* Section controls */
.section-header {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 22px;
    flex-wrap: wrap;
}

.search-box {
    width: min(430px, 100%);
}

.search-box input {
    padding-left: 44px;
    border-radius: var(--radius-pill);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' fill='none' viewBox='0 0 24 24' stroke='%23d8b76c' stroke-width='2'%3E%3Cpath stroke-linecap='round' d='m21 21-4.2-4.2M10.8 18a7.2 7.2 0 1 1 0-14.4 7.2 7.2 0 0 1 0 14.4Z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 15px center;
}

.students-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
    gap: 18px;
}

.student-card {
    display: flex;
    gap: 16px;
    padding: 22px;
    cursor: pointer;
    transition: transform var(--transition-base), background var(--transition-base), border-color var(--transition-base);
}

.student-card:hover,
.recording-item:hover {
    transform: translateY(-2px);
    border-color: var(--border-strong);
    background: linear-gradient(145deg, rgba(251, 244, 227, 0.11), rgba(251, 244, 227, 0.04));
}

.student-avatar,
.conversation-avatar,
.msg-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #171006;
    background: linear-gradient(135deg, var(--gold-300), var(--gold-500));
    border-radius: var(--radius-md);
    font-weight: 900;
}

.student-avatar { width: 56px; height: 56px; font-size: 20px; }
.student-avatar.small { width: 36px; height: 36px; font-size: 13px; }
.student-avatar.large { width: 72px; height: 72px; font-size: 26px; }

.student-info {
    min-width: 0;
}

.student-info h4 {
    margin-bottom: 4px;
    font-size: 17px;
}

.student-info p {
    margin-bottom: 12px;
    color: var(--text-tertiary);
    font-size: 13px;
}

.student-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
}

.student-stats span {
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 700;
}

/* Recordings */
.filter-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.filter-tab {
    min-height: 38px;
    padding: 8px 17px;
    color: var(--text-secondary);
    background: var(--surface-1);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-pill);
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    transition: background var(--transition-base), border-color var(--transition-base), color var(--transition-base);
}

.filter-tab:hover {
    color: var(--text-primary);
    border-color: var(--border-strong);
}

.filter-tab.active {
    color: #171006;
    background: linear-gradient(135deg, var(--gold-300), var(--gold-500));
    border-color: transparent;
}

.recordings-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.recording-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 19px 22px;
    cursor: pointer;
    transition: transform var(--transition-base), background var(--transition-base), border-color var(--transition-base);
}

.recording-info {
    display: flex;
    align-items: center;
    gap: 18px;
    min-width: 0;
}

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

.recording-details {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.recording-details strong {
    font-size: 15px;
    font-weight: 800;
}

.recording-details span,
.response-count {
    color: var(--text-tertiary);
    font-size: 13px;
}

.recording-meta {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 4px 10px;
    border-radius: var(--radius-pill);
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

.status-pending { background: rgba(216, 183, 108, 0.16); color: var(--gold-300); }
.status-in_review { background: rgba(169, 190, 208, 0.16); color: var(--info); }
.status-completed { background: rgba(159, 201, 142, 0.16); color: var(--success); }
.status-archived { background: rgba(251, 244, 227, 0.08); color: var(--text-tertiary); }

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    flex-wrap: wrap;
    margin-top: 28px;
}

.pagination button {
    min-height: 36px;
    min-width: 38px;
    padding: 8px 12px;
    color: var(--text-primary);
    background: var(--surface-1);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    font-size: 12px;
    font-weight: 800;
}

.pagination button:hover:not(:disabled) {
    border-color: var(--gold-400);
}

.pagination button.active {
    color: #171006;
    background: linear-gradient(135deg, var(--gold-300), var(--gold-500));
    border-color: transparent;
}

.pagination button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.pagination-info {
    color: var(--text-tertiary);
    font-size: 13px;
}

/* Messages */
.messages-container {
    display: grid;
    grid-template-columns: 340px minmax(0, 1fr);
    height: calc(100vh - 180px);
    min-height: 640px;
    overflow: hidden;
}

.conversations-list {
    min-height: 0;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border-subtle);
}

.conversations-header {
    padding: 18px 22px;
    border-bottom: 1px solid var(--border-subtle);
}

.conversations-header h3 {
    font-size: 18px;
}

#conversations-items {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

.conversation-item {
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 15px 18px;
    border-bottom: 1px solid rgba(243, 217, 140, 0.10);
    cursor: pointer;
    transition: background var(--transition-base), border-color var(--transition-base);
}

.conversation-item:hover {
    background: var(--surface-1);
}

.conversation-item.active {
    background: rgba(216, 183, 108, 0.12);
    border-left: 3px solid var(--gold-400);
}

.conversation-avatar {
    width: 46px;
    height: 46px;
    font-size: 15px;
}

.conversation-info {
    flex: 1;
    min-width: 0;
}

.conversation-info strong {
    display: block;
    margin-bottom: 2px;
    font-size: 14px;
    font-weight: 800;
}

.conversation-info span {
    display: block;
    overflow: hidden;
    color: var(--text-tertiary);
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.conv-name-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 3px;
}

.conv-name-row strong {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.conv-time {
    flex-shrink: 0;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.conversation-info > strong {
    display: none;
}

.chat-area {
    min-height: 0;
    display: flex;
    flex-direction: column;
    background: rgba(7, 8, 6, 0.46);
}

.chat-placeholder {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-tertiary);
    gap: 14px;
}

.chat-placeholder-icon {
    width: 54px;
    height: 54px;
    display: grid;
    place-items: center;
    color: #171006;
    background: linear-gradient(135deg, var(--gold-300), var(--gold-500));
    border-radius: 15px;
}

.chat-placeholder-icon::before {
    content: "M";
    font-weight: 900;
}

.chat-header {
    flex-shrink: 0;
    padding: 16px 22px;
    background: rgba(7, 8, 6, 0.64);
    border-bottom: 1px solid var(--border-subtle);
}

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

.chat-user span {
    font-weight: 800;
}

.chat-header .conversation-avatar {
    width: 40px;
    height: 40px;
    font-size: 14px;
}

.chat-messages {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow-y: auto;
    padding: 22px;
}

.message {
    max-width: 72%;
    display: flex;
    flex-direction: column;
}

.message.sent {
    align-self: flex-end;
}

.message.received {
    align-self: flex-start;
    flex-direction: row;
    align-items: flex-end;
    gap: 8px;
}

.message-content {
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
}

.message.sent .message-content {
    color: #171006;
    background: linear-gradient(135deg, var(--gold-300), var(--gold-500));
    border-bottom-right-radius: 4px;
}

.message.received .message-content {
    color: var(--text-primary);
    background: var(--surface-2);
    border: 1px solid var(--border-subtle);
    border-bottom-left-radius: 4px;
}

.msg-avatar {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    font-size: 11px;
}

.msg-body {
    display: flex;
    flex-direction: column;
    min-width: 0;
    max-width: 100%;
}

.message-text {
    white-space: pre-wrap;
    word-break: break-word;
}

.message-audio audio {
    display: block;
    width: 100%;
    min-width: 180px;
}

.message-time {
    margin-top: 4px;
    padding: 0 4px;
    color: var(--text-muted);
    font-size: 11px;
}

.message.sent .message-time {
    text-align: right;
}

.chat-input {
    flex-shrink: 0;
    display: flex;
    gap: 12px;
    padding: 16px 22px;
    background: rgba(7, 8, 6, 0.64);
    border-top: 1px solid var(--border-subtle);
}

.chat-input input {
    flex: 1;
    border-radius: var(--radius-pill);
}

/* Modals */
.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(7, 8, 6, 0.78);
    backdrop-filter: blur(10px);
}

.modal-content {
    width: min(540px, 100%);
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: rgba(13, 15, 12, 0.98);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-strong);
}

.modal-large {
    max-width: 800px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 22px 24px;
    border-bottom: 1px solid var(--border-subtle);
}

.modal-header h2 {
    font-size: 21px;
}

.close-btn {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    color: var(--text-secondary);
    background: var(--surface-1);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    font-size: 22px;
    line-height: 1;
}

.close-btn:hover {
    color: var(--text-primary);
    border-color: var(--border-strong);
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

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

.recording-detail,
.student-detail {
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.recording-header,
.responses-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.recording-info-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.info-item,
.audio-player,
.response-item {
    background: var(--surface-1);
    border: 1px solid rgba(243, 217, 140, 0.10);
    border-radius: var(--radius-md);
}

.info-item {
    padding: 15px;
}

.info-item label,
.audio-player label {
    display: block;
    margin-bottom: 5px;
    color: var(--text-tertiary);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.info-item span {
    font-size: 15px;
    font-weight: 800;
}

.audio-player {
    padding: 18px;
}

.audio-player audio {
    width: 100%;
    height: 40px;
}

.responses-section {
    padding-top: 22px;
    border-top: 1px solid var(--border-subtle);
}

.responses-header h4,
.student-recordings h4 {
    font-size: 16px;
}

.response-item {
    padding: 15px;
    margin-bottom: 12px;
}

.response-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}

.response-type {
    color: var(--gold-300);
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.response-message {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.6;
}

.student-header {
    display: flex;
    align-items: center;
    gap: 18px;
}

.text-muted {
    color: var(--text-tertiary);
}

/* Recorder */
.media-recorder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 24px 16px;
    text-align: center;
}

.recorder-hint {
    margin-bottom: 8px;
    color: var(--text-tertiary);
    font-size: 13px;
}

.record-btn,
.stop-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    color: #fff7f2;
    background: var(--danger);
    font-weight: 900;
    transition: transform var(--transition-base), opacity var(--transition-base);
}

.record-btn {
    gap: 10px;
    padding: 15px 32px;
    border-radius: var(--radius-pill);
    box-shadow: 0 12px 28px rgba(217, 107, 102, 0.28);
}

.record-btn:hover,
.stop-btn:hover {
    transform: translateY(-1px);
}

.record-btn-icon,
.recording-dot {
    width: 12px;
    height: 12px;
    background: #fff7f2;
    border-radius: 50%;
    flex-shrink: 0;
}

.recording-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--danger);
    font-size: 14px;
    font-weight: 900;
}

.recording-dot {
    background: var(--danger);
    animation: pulse-dot 1.2s ease-in-out infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.45; transform: scale(0.72); }
}

.record-timer {
    color: var(--text-primary);
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 34px;
    font-weight: 800;
    letter-spacing: 0;
}

.recorder-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 8px;
}

.stop-btn {
    min-height: 40px;
    padding: 10px 24px;
    border-radius: var(--radius-md);
}

.media-preview {
    width: 100%;
    max-width: 420px;
    border-radius: var(--radius-md);
}

audio.media-preview { height: 40px; }
video.media-preview { max-height: 280px; }

.upload-progress {
    width: min(360px, 100%);
    height: 7px;
    margin: 8px auto;
    overflow: hidden;
    background: var(--surface-2);
    border-radius: var(--radius-pill);
}

.upload-progress-bar {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, var(--gold-300), var(--gold-500));
    border-radius: var(--radius-pill);
    transition: width 300ms ease;
}

.upload-status {
    color: var(--text-tertiary);
    font-size: 12px;
    font-weight: 700;
}

/* Toast */
.toast {
    position: fixed;
    right: 28px;
    bottom: 28px;
    z-index: 9999;
    padding: 15px 20px;
    color: var(--text-primary);
    background: rgba(13, 15, 12, 0.98);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-strong);
    font-size: 14px;
    font-weight: 700;
    animation: slideIn 220ms var(--transition-base);
}

.toast.success { border-color: rgba(159, 201, 142, 0.48); }
.toast.error { border-color: rgba(217, 107, 102, 0.55); }

@keyframes slideIn {
    from { transform: translateX(18px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

@media (max-width: 1200px) {
    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

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

@media (max-width: 900px) {
    #dashboard-screen {
        grid-template-columns: minmax(0, 1fr);
    }

    .sidebar {
        min-width: 0;
        max-width: 100%;
        position: static;
        height: auto;
        border-right: 0;
        border-bottom: 1px solid var(--border-subtle);
    }

    .sidebar-header {
        display: flex;
        align-items: center;
        gap: 14px;
    }

    .login-icon.small {
        margin: 0;
    }

    .nav-menu {
        display: flex;
        gap: 6px;
        overflow-x: auto;
        padding: 12px 16px;
    }

    .nav-item {
        white-space: nowrap;
        margin-bottom: 0;
        flex-shrink: 0;
    }

    .sidebar-footer {
        display: none;
    }

    .top-bar {
        position: static;
    }

    .messages-container {
        grid-template-columns: 1fr;
        height: auto;
        min-height: 0;
    }

    .conversations-list {
        border-right: 0;
        border-bottom: 1px solid var(--border-subtle);
        max-height: 260px;
    }

    .message {
        max-width: 86%;
    }
}

@media (max-width: 640px) {
    .login-container {
        padding: 34px 24px;
    }

    .content-section {
        padding: 20px;
    }

    .top-bar {
        padding: 18px 20px;
        align-items: flex-start;
        flex-direction: column;
    }

    .stats-grid,
    .students-grid,
    .recording-info-grid {
        grid-template-columns: 1fr;
    }

    .recording-item,
    .recording-info,
    .recording-meta {
        align-items: flex-start;
        flex-direction: column;
    }

    .chat-input,
    .modal-actions,
    .recorder-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .toast {
        right: 16px;
        bottom: 16px;
        left: 16px;
    }
}
