body {
            font-family: Arial, sans-serif;
            background: #f6f7f9;
            padding: 30px;
        }
        .container {
            max-width: 1100px;
            margin: auto;
            background: white;
            padding: 24px;
            border-radius: 14px;
            box-shadow: 0 4px 20px rgba(0,0,0,0.08);
        }
        h1 {
            margin-top: 0;
        }
        button {
            padding: 10px 16px;
            border: none;
            border-radius: 8px;
            cursor: pointer;
            background: #2563eb;
            color: white;
            font-size: 14px;
            margin-right: 8px;
        }
        button.secondary {
            background: #111827;
        }
        input {
            padding: 8px;
            margin: 6px 0;
        }
        table {
            width: 100%;
            border-collapse: collapse;
            margin-top: 18px;
        }
        th, td {
            border: 1px solid #ddd;
            padding: 8px;
        }
        th {
            background: #f1f5f9;
        }
        td input {
            width: 100%;
            border: 1px solid #e5e7eb;
            outline: none;
            font-size: 14px;
            padding: 6px 8px;
            border-radius: 6px;
            background: #ffffff;
            box-sizing: border-box;
        }
        td input:focus {
            border-color: #2563eb;
            box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
        }
        .status {
            margin-top: 14px;
            color: #374151;
        }
        .row-actions button {
            background: #dc2626;
            padding: 6px 10px;
        }
        .top-bar {
            display: flex;
            gap: 12px;
            flex-wrap: wrap;
            align-items: center;
        }
        .date-box {
            margin-top: 16px;
        }
        .tabs {
            display: flex;
            gap: 10px;
            margin: 18px 0 24px 0;
        }

        .tabs button {
            background: #e5e7eb;
            color: #111827;
        }

        .tabs button:hover {
        background: #d1d5db;
        }

        .section {
            display: none;
        }

.section.active {
    display: block;
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
}
#literatureTable {
    min-width: 1400px;
}

#literatureTable th,
#literatureTable td {
    vertical-align: top;
}

#literatureTable td:nth-child(1) {
    width: 260px;
}

#literatureTable td:nth-child(2) {
    width: 220px;
}

#literatureTable td:nth-child(6) {
    width: 520px;
}

#literatureTable button {
    white-space: nowrap;
    padding: 6px 10px;
    font-size: 13px;
}
.visual-timetable {
    display: grid;

    /* Keep the time axis narrow, but never squeeze weekday columns.
       The previous shared min-width:150px also applied to the 80px
       time column, which shifted Monday left into the time axis. */
    grid-template-columns: 88px repeat(5, minmax(180px, 1fr));
    min-width: 988px;

    border: 1px solid #d1d5db;
    margin-top: 18px;
    background: white;
    overflow-x: auto;
    position: relative;
}

.time-column,
.day-column {
    position: relative;
    border-right: 1px solid #e5e7eb;
    min-width: 0;
}

.time-column {
    min-width: 88px;
}

.day-column {
    min-width: 180px;
}

.class-block {
    box-sizing: border-box;
}

.grid-header {
    height: 38px;
    line-height: 38px;
    text-align: center;
    font-weight: 700;
    background: #f1f5f9;
    border-bottom: 1px solid #d1d5db;
    position: sticky;
    top: 0;
    z-index: 3;
}

.time-slot {
    height: 34px;
    line-height: 34px;
    font-size: 12px;
    color: #6b7280;
    text-align: center;
    border-bottom: 1px solid #f1f5f9;
}

.day-column::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 38px;
    bottom: 0;
    background-image: linear-gradient(to bottom, #f1f5f9 1px, transparent 1px);
    background-size: 100% 34px;
    pointer-events: none;
}

.class-block {
    position: absolute;
    left: 6px;
    right: 6px;
    border: 1px solid rgba(0, 0, 0, 0.18);
    border-radius: 8px;
    padding: 6px;
    font-size: 12px;
    color: #111827;
    overflow: hidden;
    z-index: 2;
    cursor: pointer;
}

.class-block strong {
    display: block;
    font-size: 12px;
    margin-bottom: 3px;
}

.class-block {
    user-select: none;
    transition:
        transform 0.12s ease,
        opacity 0.12s ease,
        box-shadow 0.12s ease;
}

.class-block:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

.class-block.dragging {
    opacity: 0.45;
    transform: scale(0.98);
}

.day-column.drag-target {
    background-color: rgba(37, 99, 235, 0.08);
}

input[type="color"] {
    width: 48px;
    height: 36px;
    padding: 2px;
    cursor: pointer;
}

:root {
    --bg: #eef4fb;
    --surface: rgba(255, 255, 255, 0.82);
    --surface-solid: #ffffff;
    --border: rgba(148, 163, 184, 0.28);
    --text: #0f172a;
    --muted: #64748b;
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --primary-soft: #dbeafe;
    --shadow: 0 20px 50px rgba(15, 23, 42, 0.10);
    --radius-lg: 28px;
    --radius-md: 18px;
    --radius-sm: 12px;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background:
        radial-gradient(circle at top left, rgba(96, 165, 250, 0.28), transparent 34%),
        linear-gradient(135deg, #f8fbff, #eaf2fb);
    color: var(--text);
}

.app-shell {
    width: min(1280px, calc(100vw - 40px));
    height: calc(100vh - 40px);
    margin: 20px auto;
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 20px;
}

.sidebar {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    backdrop-filter: blur(20px);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.brand-glow {
    width: fit-content;
    padding: 8px 18px;
    border-radius: 16px;
    font-size: 26px;
    font-weight: 800;
    color: rgba(255, 255, 255, 0.92);
    text-shadow: 0 2px 14px rgba(59, 130, 246, 0.55);
    background: rgba(255, 255, 255, 0.32);
    border: 1px solid rgba(255, 255, 255, 0.7);
}

.profile-card {
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 22px;
    text-align: center;
}

.avatar {
    width: 92px;
    height: 92px;
    border-radius: 50%;
    margin: 0 auto 14px;
    display: grid;
    place-items: center;
    font-size: 34px;
    font-weight: 800;
    color: #1e3a8a;
    background: linear-gradient(135deg, #dbeafe, #ffffff);
    border: 4px solid white;
    box-shadow: 0 10px 24px rgba(37, 99, 235, 0.18);
}

.profile-card h2 {
    margin: 0;
    font-size: 28px;
}

.profile-card p {
    margin: 8px 0 0;
    color: var(--muted);
}

.side-nav {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.nav-item {
    border: 0;
    width: 100%;
    padding: 18px 20px;
    border-radius: 18px;
    text-align: left;
    font-size: 22px;
    font-weight: 700;
    color: #10213f;
    background: transparent;
    cursor: pointer;
    transition: 0.16s ease;
    display: flex;
    align-items: center;
    gap: 14px;
}

.nav-item:hover {
    background: rgba(219, 234, 254, 0.65);
}

.nav-item.active {
    color: var(--primary-dark);
    background: linear-gradient(135deg, #eff6ff, #bfdbfe);
    box-shadow: inset 0 0 0 1px rgba(59, 130, 246, 0.25);
}

.main-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    backdrop-filter: blur(20px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.topbar {
    height: 96px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 34px;
    border-bottom: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.55);
}

.topbar h1 {
    margin: 0;
    font-size: 34px;
    font-weight: 800;
}

.top-actions {
    display: flex;
    gap: 12px;
}

.icon-btn {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: white;
    cursor: pointer;
    font-size: 22px;
}

.content-card {
    flex: 1;
    margin: 26px;
    padding: 28px;
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid var(--border);
    overflow: auto;
}

.section {
    display: none;
}

.section.active {
    display: block;
}

/* 兼容旧 container，避免影响 */
.container {
    max-width: none;
    margin: 0;
    padding: 0;
    background: transparent;
    box-shadow: none;
}

.document-header {
    margin-bottom: 24px;
}

.document-header h2 {
    margin-bottom: 10px;
}

.document-header p {
    color: var(--muted);
    line-height: 1.6;
}


.privacy-box {
    display: inline-flex;
    align-items: center;
    margin-top: 10px;
    padding: 10px 16px;

    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 12px;

    color: #2563eb;
    font-weight: 600;
}


.document-upload-card {
    margin-top: 20px;
    padding: 24px;

    border: 1px dashed #93c5fd;
    border-radius: 18px;

    background: rgba(239, 246, 255, 0.5);

    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}


.document-result-card {
    margin-top: 24px;
    padding: 24px;

    background: white;
    border: 1px solid var(--border);
    border-radius: 20px;
}


.document-result-card h3 {
    margin-top: 0;
}


.document-info-grid {
    display: grid;

    grid-template-columns:
        repeat(3, minmax(0, 1fr));

    gap: 16px;

    margin-top: 20px;
}


.document-info-item {
    padding: 18px;

    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
}


.document-info-item span {
    display: block;

    color: #64748b;
    font-size: 13px;

    margin-bottom: 8px;
}


.document-info-item strong {
    font-size: 18px;
    color: #0f172a;
}


@media (max-width: 800px) {

    .document-info-grid {
        grid-template-columns: 1fr;
    }
}

/* ===== Authentication ===== */
.auth-page {
    min-height: 100vh;
    margin: 0;
    padding: 24px;
    display: grid;
    place-items: center;
    box-sizing: border-box;
}

.auth-card {
    width: min(440px, 100%);
    padding: 36px;
    border: 1px solid var(--border);
    border-radius: 28px;
    background: rgba(255, 255, 255, 0.88);
    box-shadow: var(--shadow);
    backdrop-filter: blur(20px);
}

.auth-brand {
    display: inline-block;
    margin-bottom: 20px;
    padding: 8px 14px;
    border-radius: 14px;
    color: var(--primary-dark);
    background: var(--primary-soft);
    font-weight: 800;
}

.auth-card h1 {
    margin: 0;
    font-size: 34px;
}

.auth-subtitle {
    margin: 10px 0 24px;
    color: var(--muted);
}

.auth-form {
    display: grid;
    gap: 16px;
}

.auth-form label {
    display: grid;
    gap: 8px;
    color: var(--text);
    font-weight: 650;
}

.auth-form input {
    width: 100%;
    min-height: 46px;
    margin: 0;
    padding: 10px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    box-sizing: border-box;
    font-size: 16px;
    background: white;
}

.auth-form input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.16);
}

.auth-submit {
    width: 100%;
    min-height: 48px;
    margin: 4px 0 0;
    font-size: 16px;
    font-weight: 750;
}

.auth-error,
.auth-success {
    margin-bottom: 18px;
    padding: 12px 14px;
    border-radius: 12px;
}

.auth-error {
    color: #991b1b;
    background: #fee2e2;
    border: 1px solid #fecaca;
}

.auth-success {
    color: #166534;
    background: #dcfce7;
    border: 1px solid #bbf7d0;
}

.auth-switch {
    margin: 22px 0 0;
    text-align: center;
    color: var(--muted);
}

.auth-switch a {
    color: var(--primary-dark);
    font-weight: 700;
}

.signed-in-email {
    align-self: center;
    color: var(--muted);
    font-size: 14px;
}

.logout-form {
    margin: 0;
}

.logout-btn {
    margin: 0;
    background: #0f172a;
}

@media (max-width: 700px) {
    .auth-card {
        padding: 26px 20px;
    }

    .signed-in-email {
        display: none;
    }
}

.auth-logo-wrap {
    text-align: center;
    margin-bottom: 22px;
}

.auth-logo {
    display: block;
    width: 240px;
    max-width: 100%;
    height: 150px;
    margin: 0 auto;
    object-fit: contain;
}

.product-name {
    margin-top: 4px;
    color: #2563eb;
    font-size: 18px;
    font-weight: 800;
}

.sidebar-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 4px 0 8px;
}

.sidebar-logo {
    display: block;
    width: 88px;
    height: 88px;
    object-fit: contain;
}

.sidebar-product-name {
    color: #174a7e;
    font-size: 18px;
    font-weight: 800;
    letter-spacing: 0.3px;
}

/* ===== Email Center 0.94 ===== */
.email-center-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 22px;
    flex-wrap: wrap;
}

.email-center-header h2 {
    margin: 0 0 8px;
}

.email-center-header p {
    margin: 0;
    color: var(--muted);
    line-height: 1.6;
}

.email-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.email-toolbar button {
    margin: 0;
}

.email-privacy-note {
    margin-top: 18px;
    padding: 12px 16px;
    border: 1px solid #bfdbfe;
    border-radius: 14px;
    background: #eff6ff;
    color: #1d4ed8;
    font-size: 14px;
    line-height: 1.5;
}

.email-category-bar {
    display: flex;
    gap: 8px;
    margin-top: 20px;
    padding-bottom: 6px;
    overflow-x: auto;
}

.email-category {
    flex: 0 0 auto;
    margin: 0;
    padding: 9px 13px;
    border: 1px solid #dbe4f0;
    border-radius: 999px;
    background: white;
    color: #334155;
    font-weight: 700;
}

.email-category span {
    display: inline-grid;
    min-width: 22px;
    height: 22px;
    margin-left: 5px;
    padding: 0 5px;
    place-items: center;
    border-radius: 999px;
    background: #e2e8f0;
    font-size: 12px;
}

.email-category:hover {
    background: #f8fafc;
}

.email-category.active {
    border-color: #60a5fa;
    background: #dbeafe;
    color: #1d4ed8;
}

.email-category.active span {
    background: white;
    color: #1d4ed8;
}

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

.email-card {
    width: 100%;
    min-height: 154px;
    margin: 0;
    padding: 18px;
    border: 1px solid #e2e8f0;
    border-radius: 18px;
    background: white;
    color: var(--text);
    text-align: left;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.05);
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.email-card:hover {
    transform: translateY(-2px);
    border-color: #93c5fd;
    box-shadow: 0 14px 30px rgba(15, 23, 42, 0.09);
}

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

.email-card-top {
    margin-bottom: 12px;
}

.email-card-bottom {
    margin-top: 16px;
    color: #64748b;
    font-size: 13px;
}

.email-category-badge {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    padding: 5px 9px;
    border-radius: 999px;
    background: #e2e8f0;
    color: #334155;
    font-size: 12px;
    font-weight: 800;
}

.email-card-badges,
.email-detail-badges {
    display: flex;
    align-items: center;
    gap: 7px;
    flex-wrap: wrap;
}

.email-calendar-badge {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    padding: 5px 9px;
    border-radius: 999px;
    background: #dcfce7;
    color: #166534;
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}

.category-course {
    background: #dbeafe;
    color: #1d4ed8;
}

.category-assignment {
    background: #fef3c7;
    color: #92400e;
}

.category-exam {
    background: #fee2e2;
    color: #991b1b;
}

.category-administration {
    background: #ede9fe;
    color: #6d28d9;
}

.category-finance {
    background: #dcfce7;
    color: #166534;
}

.category-housing {
    background: #ffedd5;
    color: #9a3412;
}

.category-immigration {
    background: #cffafe;
    color: #155e75;
}


.category-campus_news {
    background: #e0f2fe;
    color: #075985;
}

.category-campus_event {
    background: #ecfccb;
    color: #3f6212;
}

.category-opportunity {
    background: #fae8ff;
    color: #86198f;
}

.category-advertising {
    background: #f1f5f9;
    color: #64748b;
}

.email-received {
    color: #94a3b8;
    font-size: 12px;
    white-space: nowrap;
}

.email-subject {
    display: -webkit-box;
    overflow: hidden;
    color: #0f172a;
    font-size: 17px;
    line-height: 1.4;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.email-sender {
    margin-top: 8px;
    overflow: hidden;
    color: #64748b;
    font-size: 13px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.email-deadline {
    color: #b91c1c;
    font-weight: 700;
}

.email-empty-state {
    margin-top: 22px;
    padding: 42px 20px;
    border: 1px dashed #cbd5e1;
    border-radius: 18px;
    background: rgba(248, 250, 252, 0.8);
    text-align: center;
}

.email-empty-state p {
    margin-bottom: 0;
    color: #64748b;
}

.email-empty-icon {
    margin-bottom: 10px;
    font-size: 38px;
}

.email-detail-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(15, 23, 42, 0.58);
    backdrop-filter: blur(6px);
}

.email-detail-panel {
    width: min(820px, 100%);
    max-height: min(820px, calc(100vh - 48px));
    padding: 26px;
    overflow-y: auto;
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 24px;
    background: white;
    box-shadow: 0 30px 80px rgba(15, 23, 42, 0.28);
}

.email-detail-header {
    display: flex;
    justify-content: space-between;
    gap: 18px;
}

.email-detail-header h3 {
    margin: 12px 0 6px;
    font-size: 24px;
    line-height: 1.35;
}

.email-detail-header p {
    margin: 0;
    color: #64748b;
}

.email-close-btn {
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    margin: 0;
    padding: 0;
    border-radius: 50%;
    background: #f1f5f9;
    color: #334155;
    font-size: 26px;
    line-height: 1;
}

.email-detail-meta {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-top: 22px;
}

.email-detail-meta > div {
    padding: 14px;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    background: #f8fafc;
}

.email-detail-meta span {
    display: block;
    margin-bottom: 6px;
    color: #64748b;
    font-size: 12px;
}

.email-detail-section {
    margin-top: 20px;
}

.email-detail-section h4 {
    margin: 0 0 10px;
}

.email-detail-section p,
.email-detail-section pre {
    margin: 0;
    padding: 16px;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    background: #f8fafc;
    color: #334155;
    line-height: 1.65;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.email-detail-section pre {
    max-height: 360px;
    overflow-y: auto;
    font-family: inherit;
    font-size: 14px;
}

.email-detail-actions {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-top: 22px;
    color: #64748b;
    font-size: 13px;
    flex-wrap: wrap;
}

.danger-button {
    margin: 0;
    background: #dc2626;
}

.modal-open {
    overflow: hidden;
}

@media (max-width: 850px) {
    .email-list {
        grid-template-columns: 1fr;
    }

    .email-detail-meta {
        grid-template-columns: 1fr;
    }

    .email-detail-overlay {
        padding: 10px;
    }

    .email-detail-panel {
        max-height: calc(100vh - 20px);
        padding: 20px;
        border-radius: 18px;
    }
}


/* ===== Multi-user Gmail OAuth 0.95 ===== */
.gmail-connection-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    margin-top: 18px;
    padding: 16px 18px;
    border: 1px solid #bfdbfe;
    border-radius: 16px;
    background: #eff6ff;
}

.gmail-connection-copy {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.gmail-connection-copy strong {
    display: block;
    color: #1e3a8a;
}

.gmail-connection-copy p {
    margin: 5px 0 0;
    color: #64748b;
    font-size: 13px;
    line-height: 1.5;
}

.gmail-status-dot {
    flex: 0 0 auto;
    width: 11px;
    height: 11px;
    margin-top: 5px;
    border-radius: 50%;
    background: #94a3b8;
    box-shadow: 0 0 0 5px rgba(148, 163, 184, 0.16);
}

.gmail-status-dot.connected {
    background: #16a34a;
    box-shadow: 0 0 0 5px rgba(22, 163, 74, 0.14);
}

.gmail-connection-actions {
    display: flex;
    flex: 0 0 auto;
    gap: 8px;
}

.gmail-connection-actions button {
    margin: 0;
}

.mail-account-select {
    min-width: 210px;
    max-width: 320px;
    margin: 0;
    padding: 9px 34px 9px 11px;
    border: 1px solid #bfdbfe;
    border-radius: 10px;
    background: #ffffff;
    color: #1e3a8a;
}

button:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

@media (max-width: 760px) {
    .gmail-connection-card {
        align-items: stretch;
        flex-direction: column;
    }

    .gmail-connection-actions {
        flex-direction: column;
    }

    .gmail-connection-actions button,
    .mail-account-select {
        width: 100%;
        max-width: none;
    }
}


/* ===== Built-in Calendar 0.96 ===== */
.calendar-center-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    flex-wrap: wrap;
}
.calendar-center-header h2 { margin: 0 0 8px; }
.calendar-center-header p { margin: 0; color: var(--muted); line-height: 1.6; }
.calendar-toolbar { display: flex; gap: 10px; flex-wrap: wrap; }
.calendar-toolbar button { margin: 0; }
.calendar-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 18px 0 8px;
    padding: 12px 14px;
    border: 1px solid #dbe4f0;
    border-radius: 14px;
    background: #f8fafc;
}
.calendar-filter-bar label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #334155;
    font-size: 13px;
    font-weight: 700;
}
.calendar-filter-bar input { margin: 0; }
.student-calendar {
    margin-top: 14px;
    padding: 16px;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    background: white;
    min-height: 640px;
}
.student-calendar .fc .fc-toolbar-title { font-size: 1.35rem; }
.student-calendar .fc .fc-button-primary {
    border-color: #2563eb;
    background: #2563eb;
}
.student-calendar .fc .fc-button-primary:not(:disabled):hover { background: #1d4ed8; }
.student-calendar .fc-event { cursor: pointer; border-radius: 6px; padding: 1px 3px; }
.timetable-tools {
    margin-top: 22px;
    border: 1px solid #dbe4f0;
    border-radius: 18px;
    background: rgba(248,250,252,.85);
    overflow: hidden;
}
.timetable-tools > summary {
    padding: 16px 18px;
    cursor: pointer;
    color: #0f172a;
    font-size: 17px;
    font-weight: 800;
}
.timetable-tools-body { padding: 0 18px 20px; }
.calendar-event-overlay {
    position: fixed;
    inset: 0;
    z-index: 1100;
    align-items: center;
    justify-content: center;
    padding: 22px;
    background: rgba(15,23,42,.58);
    backdrop-filter: blur(7px);
}
.calendar-event-modal {
    width: min(700px, 100%);
    max-height: calc(100vh - 44px);
    overflow-y: auto;
    padding: 26px;
    border-radius: 24px;
    background: white;
    box-shadow: 0 30px 80px rgba(15,23,42,.28);
}
.calendar-modal-header { display: flex; justify-content: space-between; gap: 18px; align-items: flex-start; }
.calendar-modal-header h3 { margin: 5px 0 0; font-size: 25px; }
.calendar-modal-kicker { color: #2563eb; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.calendar-form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 15px; margin-top: 22px; }
.calendar-field { display: grid; gap: 7px; color: #334155; font-weight: 700; }
.calendar-field.full { grid-column: 1 / -1; }
.calendar-field input, .calendar-field select, .calendar-field textarea {
    width: 100%;
    box-sizing: border-box;
    margin: 0;
    padding: 10px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 11px;
    background: white;
    font: inherit;
    font-weight: 400;
}
.calendar-field textarea { resize: vertical; }
.checkbox-field { display: flex; flex-direction: row; align-items: center; gap: 8px; align-self: end; min-height: 44px; }
.checkbox-field input { width: auto; }
.calendar-modal-actions { display: flex; align-items: center; gap: 10px; margin-top: 22px; }
.calendar-modal-actions button { margin: 0; }
.calendar-modal-spacer { flex: 1; }
@media (max-width: 760px) {
    .student-calendar { padding: 8px; min-height: 520px; }
    .student-calendar .fc .fc-toolbar { flex-direction: column; gap: 10px; }
    .calendar-form-grid { grid-template-columns: 1fr; }
    .calendar-field.full { grid-column: auto; }
    .calendar-event-overlay { padding: 8px; }
    .calendar-event-modal { padding: 19px; max-height: calc(100vh - 16px); }
}


/* =========================================================
   0.97 — AI chat + unified schedule workflow
   ========================================================= */

.ai-chat-section {
    min-height: calc(100vh - 190px);
}

.ai-chat-shell {
    min-height: 650px;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    padding: 34px 22px 12px;
}

.ai-chat-welcome {
    width: min(760px, 100%);
    margin: auto 0 24px;
    text-align: center;
}

.ai-chat-logo {
    width: 64px;
    height: 64px;
    margin: 0 auto 18px;
    border-radius: 20px;
    display: grid;
    place-items: center;
    font-size: 34px;
    background: linear-gradient(145deg, #dbeafe, #eff6ff);
    box-shadow: 0 10px 28px rgba(37, 99, 235, .12);
}

.ai-chat-welcome h2 {
    margin: 0;
    font-size: clamp(30px, 4vw, 46px);
    letter-spacing: -1.5px;
}

.ai-chat-welcome p {
    max-width: 620px;
    margin: 14px auto 24px;
    color: #64748b;
    line-height: 1.7;
}

.ai-chat-suggestions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
}

.ai-chat-suggestions button {
    background: #fff;
    color: #334155;
    border: 1px solid #dbe4f0;
    border-radius: 999px;
    padding: 10px 16px;
    box-shadow: 0 6px 18px rgba(15, 23, 42, .04);
}

.ai-chat-conversation {
    width: min(820px, 100%);
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin: 0 auto 22px;
}

.ai-message {
    max-width: 82%;
    white-space: pre-wrap;
    line-height: 1.7;
    padding: 14px 16px;
    border-radius: 18px;
}

.user-message {
    align-self: flex-end;
    background: #2563eb;
    color: #fff;
    border-bottom-right-radius: 6px;
}

.assistant-message {
    align-self: flex-start;
    background: #f1f5f9;
    color: #0f172a;
    border-bottom-left-radius: 6px;
}

.thinking-message {
    color: #64748b;
}

.ai-chat-composer {
    width: min(820px, 100%);
    margin-top: auto;
    display: flex;
    align-items: flex-end;
    gap: 10px;
    padding: 10px 10px 10px 18px;
    border: 1px solid #cbd5e1;
    border-radius: 24px;
    background: #fff;
    box-shadow: 0 12px 40px rgba(15, 23, 42, .08);
}

.ai-chat-composer textarea {
    flex: 1;
    min-height: 44px;
    max-height: 160px;
    resize: vertical;
    border: 0;
    outline: 0;
    padding: 11px 2px;
    font: inherit;
    background: transparent;
}

.ai-chat-send {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    padding: 0;
    font-size: 22px;
}

.ai-chat-footnote,
.ai-chat-status {
    width: min(820px, 100%);
    text-align: center;
    font-size: 12px;
    color: #94a3b8;
    margin-top: 8px;
}

.ai-chat-status {
    min-height: 18px;
}

.calendar-review-panel {
    border: 1px solid #bfdbfe;
    background: linear-gradient(180deg, #eff6ff 0%, #f8fbff 100%);
    border-radius: 18px;
    padding: 18px;
    margin: 0 0 18px;
}

.calendar-review-head {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
}

.calendar-review-head > div {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.calendar-review-kicker,
.calendar-review-source {
    color: #2563eb;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .04em;
}

.calendar-review-count {
    min-width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 999px;
    background: #2563eb;
    color: white;
    font-weight: 800;
}

.calendar-review-panel > p {
    color: #64748b;
    margin: 8px 0 14px;
}

.calendar-review-list {
    display: grid;
    gap: 10px;
}

.calendar-review-item {
    display: flex;
    gap: 16px;
    align-items: center;
    justify-content: space-between;
    background: #fff;
    border: 1px solid #dbeafe;
    border-radius: 14px;
    padding: 13px 14px;
}

.calendar-review-copy {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.calendar-review-copy strong {
    color: #0f172a;
}

.calendar-review-copy span:not(.calendar-review-source),
.calendar-review-copy small {
    color: #64748b;
    overflow-wrap: anywhere;
}

.calendar-review-actions {
    flex: 0 0 auto;
    display: flex;
    gap: 8px;
}

@media (max-width: 760px) {
    .calendar-review-item {
        align-items: stretch;
        flex-direction: column;
    }
    .calendar-review-actions button {
        flex: 1;
    }
    .ai-chat-shell {
        min-height: 560px;
        padding-inline: 6px;
    }
}

.nav-pending-badge {
    margin-left: auto;
    min-width: 22px;
    height: 22px;
    place-items: center;
    border-radius: 999px;
    padding: 0 6px;
    background: #ef4444;
    color: #fff;
    font-size: 11px;
    font-weight: 800;
}


/* ===== 0.98 work-order UI ===== */
.ai-chat-logo-img {
    width: 56px;
    height: 56px;
    object-fit: contain;
    display: block;
}

.schedule-hub-tabs {
    display: inline-flex;
    gap: 6px;
    padding: 5px;
    margin-bottom: 18px;
    background: #eef4fb;
    border: 1px solid #dbe5f2;
    border-radius: 14px;
}

.schedule-hub-tab {
    border: 0;
    background: transparent;
    color: #52627a;
    padding: 9px 18px;
    border-radius: 10px;
    font-weight: 700;
    cursor: pointer;
}

.schedule-hub-tab.active {
    color: #1d4ed8;
    background: #ffffff;
    box-shadow: 0 3px 12px rgba(15, 23, 42, 0.08);
}

.schedule-hub-pane + .schedule-hub-pane {
    margin-top: 28px;
    padding-top: 26px;
    border-top: 1px solid #e5eaf1;
}

.email-category-primary {
    overflow: visible;
}

.email-more-category {
    white-space: nowrap;
}

.email-dropdown-arrow {
    font-size: 12px;
    opacity: 0.7;
}

.email-subcategory-menu {
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin: -2px 0 16px;
    padding: 12px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
}

.email-subcategory {
    border: 1px solid #d7e0ec;
    background: #fff;
    color: #475569;
    padding: 8px 12px;
    border-radius: 999px;
    cursor: pointer;
    font-weight: 650;
}

.email-subcategory.active {
    border-color: #93c5fd;
    background: #eaf3ff;
    color: #2563eb;
}

.document-review-heading {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    align-items: flex-start;
    margin-bottom: 14px;
}

.document-review-heading h3 {
    margin: 0 0 5px;
}

.document-review-heading p {
    margin: 0;
    color: #64748b;
}

.document-review-badge {
    background: #fff7ed;
    color: #c2410c;
    border: 1px solid #fed7aa;
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
}

.document-warning-box,
.document-review-notice {
    background: #fffaf0;
    border: 1px solid #fde68a;
    color: #854d0e;
    border-radius: 12px;
    padding: 11px 13px;
    margin: 12px 0;
    line-height: 1.55;
}

.document-review-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 14px;
}

.document-review-table th,
.document-review-table td {
    padding: 12px 14px;
    border-bottom: 1px solid #e5e7eb;
    text-align: left;
    vertical-align: middle;
}

.document-review-table th:first-child,
.document-review-table td:first-child {
    width: 150px;
    font-weight: 700;
    color: #334155;
}

.document-review-table input,
.document-review-table select {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    padding: 10px 11px;
    background: #fff;
}

.document-result-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 18px;
}


/* ===== 0.98.1 TideVision branding ===== */
.sidebar-company-logo {
    display: block;
    width: 218px;
    max-width: 92%;
    height: 74px;
    object-fit: contain;
}

.sidebar-brand {
    gap: 2px;
    padding-top: 0;
}

.sidebar-product-name {
    margin-top: -2px;
    font-size: 14px;
    letter-spacing: 0.5px;
    color: #174a7e;
    opacity: 0.9;
}

.ai-chat-logo {
    width: 78px;
    height: 78px;
    border-radius: 24px;
    background: linear-gradient(145deg, #edf5ff, #f7fbff);
}

.ai-chat-logo-img {
    width: 66px;
    height: 66px;
    object-fit: contain;
    display: block;
}

/* Existing authentication pages can keep using:
   /static/images/logo-vertical.png
   The new PNG fallback above replaces the old artwork automatically. */
.auth-logo {
    object-fit: contain;
}


/* ===== 0.98.1.1 branding sizing fix =====
   Use tightly-cropped PNG assets so transparent artwork margins do not
   make the visible logo look tiny. */
.sidebar-company-logo {
    width: 248px;
    max-width: 96%;
    height: 66px;
    object-fit: contain;
    object-position: center;
}

.sidebar-brand {
    gap: 8px;
    padding-top: 6px;
}

.sidebar-product-name {
    margin-top: 0;
}

.ai-chat-logo {
    width: 88px;
    height: 88px;
    border-radius: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: visible;
}

.ai-chat-logo-img {
    width: 74px;
    height: 74px;
    object-fit: contain;
    object-position: center;
    display: block;
}

/* ===== Work order 2: profile / add controls / translation ===== */
.profile-card-editable {
    position: relative;
    cursor: pointer;
    transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}

.profile-card-editable:hover,
.profile-card-editable:focus-visible {
    transform: translateY(-2px);
    border-color: #93c5fd;
    box-shadow: 0 14px 34px rgba(37, 99, 235, .12);
    outline: none;
}

.profile-edit-chip {
    position: absolute;
    top: 12px;
    right: 12px;
    padding: 5px 9px;
    border-radius: 999px;
    color: #2563eb;
    background: #eff6ff;
    font-size: 12px;
    font-weight: 800;
}

.avatar {
    overflow: hidden;
}

.avatar-image {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    border-radius: inherit;
}

.profile-overlay {
    position: fixed;
    inset: 0;
    z-index: 1400;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(15, 23, 42, .58);
    backdrop-filter: blur(8px);
}

.profile-modal {
    width: min(760px, 100%);
    max-height: calc(100vh - 48px);
    overflow-y: auto;
    padding: 28px;
    border: 1px solid rgba(255,255,255,.72);
    border-radius: 26px;
    background: white;
    box-shadow: 0 32px 90px rgba(15,23,42,.3);
}

.profile-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
}

.profile-modal-header h2 {
    margin: 5px 0 6px;
    font-size: 28px;
}

.profile-modal-header p {
    margin: 0;
    color: #64748b;
    line-height: 1.6;
}

.profile-modal-kicker {
    color: #2563eb;
    font-size: 12px;
    font-weight: 900;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.profile-avatar-editor {
    display: flex;
    align-items: center;
    gap: 18px;
    margin: 24px 0;
    padding: 18px;
    border: 1px solid #dbe4f0;
    border-radius: 18px;
    background: #f8fafc;
}

.profile-avatar-preview {
    width: 92px;
    height: 92px;
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    overflow: hidden;
    border: 4px solid white;
    border-radius: 50%;
    background: linear-gradient(135deg, #dbeafe, #fff);
    color: #1e3a8a;
    box-shadow: 0 10px 24px rgba(37,99,235,.16);
    font-size: 32px;
    font-weight: 800;
}

.profile-avatar-upload {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    padding: 0 14px;
    border-radius: 10px;
    background: #2563eb;
    color: white;
    cursor: pointer;
    font-weight: 800;
}

.profile-avatar-editor p {
    margin: 8px 0 0;
    color: #64748b;
    font-size: 13px;
}

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

.profile-form-grid label {
    display: grid;
    gap: 7px;
    color: #0f172a;
    font-weight: 700;
}

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

.profile-form-grid input,
.profile-form-grid select {
    width: 100%;
    min-height: 46px;
    margin: 0;
    padding: 10px 12px;
    box-sizing: border-box;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    background: white;
    color: #0f172a;
    font: inherit;
}

.profile-form-grid input:disabled {
    background: #f1f5f9;
    color: #64748b;
}

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

.profile-modal-actions .status {
    margin-right: auto;
}

.icon-add-button {
    width: 44px;
    height: 44px;
    min-width: 44px;
    margin: 0;
    padding: 0;
    display: inline-grid;
    place-items: center;
    border-radius: 50%;
    background: #2563eb;
    color: white;
    font-size: 28px;
    font-weight: 500;
    line-height: 1;
    box-shadow: 0 8px 20px rgba(37,99,235,.2);
}

.icon-add-button:hover {
    transform: translateY(-1px);
}

.icon-add-button.compact-add {
    width: 40px;
    height: 40px;
    min-width: 40px;
    font-size: 24px;
}

.email-detail-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
}

.email-translate-button {
    margin: 0;
    min-height: 40px;
    padding: 0 14px;
    border-radius: 12px;
}

.verification-email-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
}

.verification-email-row input {
    margin: 0;
}

.verification-send-button {
    min-height: 46px;
    margin: 0;
    white-space: nowrap;
}

.auth-form select {
    width: 100%;
    min-height: 46px;
    margin: 0;
    padding: 10px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    box-sizing: border-box;
    background: white;
    font-size: 16px;
}

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

    .profile-form-grid label.full {
        grid-column: auto;
    }

    .profile-avatar-editor {
        align-items: flex-start;
    }

    .verification-email-row {
        grid-template-columns: 1fr;
    }

    .verification-send-button {
        width: 100%;
    }
}
