/* ============================================
           DESIGN SYSTEM — Modern SaaS 2026
           ============================================ */
:root {
    /* Primary Palette */
    --primary-50: #eff6ff;
    --primary-100: #dbeafe;
    --primary-200: #bfdbfe;
    --primary-300: #93c5fd;
    --primary-400: #60a5fa;
    --primary-500: #3b82f6;
    --primary-600: #2563eb;
    --primary-700: #1d4ed8;
    --primary-800: #1e40af;
    --primary-900: #1e3a8a;

    /* Neutral Palette */
    --gray-0: #ffffff;
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;

    /* Semantic Colors */
    --success-50: #f0fdf4;
    --success-100: #dcfce7;
    --success-500: #22c55e;
    --success-600: #16a34a;
    --warning-50: #fffbeb;
    --warning-100: #fef3c7;
    --warning-500: #f59e0b;
    --warning-600: #d97706;
    --danger-50: #fef2f2;
    --danger-100: #fee2e2;
    --danger-500: #ef4444;
    --danger-600: #dc2626;
    --info-50: #eff6ff;
    --info-500: #3b82f6;
    --info-600: #2563eb;

    /* Theme Variables */
    --bg-body: #f8fafc;
    --bg-surface: #ffffff;
    --bg-elevated: #ffffff;
    --bg-subtle: #f1f5f9;
    --bg-hover: #f8fafc;
    --bg-active: #f1f5f9;
    --bg-inset: #e2e8f0;

    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-tertiary: #64748b;
    --text-quaternary: #94a3b8;
    --text-on-primary: #ffffff;
    --text-on-danger: #ffffff;

    --border-subtle: #f1f5f9;
    --border-default: #e2e8f0;
    --border-strong: #cbd5e1;
    --border-focus: #3b82f6;

    --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.06), 0 2px 4px -2px rgba(15, 23, 42, 0.04);
    --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.06), 0 4px 6px -4px rgba(15, 23, 42, 0.04);
    --shadow-xl: 0 20px 25px -5px rgba(15, 23, 42, 0.08), 0 8px 10px -6px rgba(15, 23, 42, 0.04);
    --shadow-inner: inset 0 2px 4px rgba(15, 23, 42, 0.04);

    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-full: 9999px;

    --sidebar-width: 240px;
    --sidebar-collapsed: 64px;
    --topbar-height: 56px;

    --transition-fast: 150ms ease;
    --transition-base: 200ms ease;
    --transition-slow: 300ms ease;

    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-mono: 'SF Mono', Monaco, "Cascadia Code", "Roboto Mono", Consolas, "Courier New", monospace;

    /* Status backgrounds */
    --status-not-started-bg: #fef2f2;
    --status-not-started-text: #dc2626;
    --status-in-progress-bg: #fffbeb;
    --status-in-progress-text: #d97706;
    --status-done-bg: #f0fdf4;
    --status-done-text: #16a34a;
}

/* Dark Theme */
html[data-theme="dark"] {
    --bg-body: #0f172a;
    --bg-surface: #1e293b;
    --bg-elevated: #334155;
    --bg-subtle: #1e293b;
    --bg-hover: #334155;
    --bg-active: #475569;
    --bg-inset: #0f172a;

    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-tertiary: #94a3b8;
    --text-quaternary: #64748b;

    --border-subtle: #334155;
    --border-default: #475569;
    --border-strong: #64748b;

    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.2);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -2px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -4px rgba(0, 0, 0, 0.3);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.4);

    --status-not-started-bg: rgba(239, 68, 68, 0.1);
    --status-not-started-text: #f87171;
    --status-in-progress-bg: rgba(245, 158, 11, 0.1);
    --status-in-progress-text: #fbbf24;
    --status-done-bg: rgba(34, 197, 94, 0.1);
    --status-done-text: #4ade80;

    /* Dark mode overrides for info & primary soft tints */
    --info-50: rgba(59, 130, 246, 0.15);
    --info-100: rgba(59, 130, 246, 0.22);
    --info-500: #60a5fa;
    --info-700: #93c5fd;
    --primary-50: rgba(59, 130, 246, 0.12);
    --primary-100: rgba(59, 130, 246, 0.22);
    --primary-700: #93c5fd;
}

/* ============================================
           BASE & RESET
           ============================================ */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-body);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Scrollbar Styling — Hide & Show on Hover */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

/* Default: scrollbar thumb is transparent (hidden) */
::-webkit-scrollbar-thumb {
    background: transparent;
    border-radius: var(--radius-full);
    transition: background var(--transition-base);
}

/* Show scrollbar on hover of any scrollable element */
*:hover::-webkit-scrollbar-thumb {
    background: var(--gray-300);
}

/* Dark mode: show scrollbar on hover */
html[data-theme="dark"] *:hover::-webkit-scrollbar-thumb {
    background: var(--gray-600);
}

/* Selection */
::selection {
    background: rgba(37, 99, 235, 0.2);
    color: inherit;
}

/* ============================================
           APP SHELL LAYOUT
           ============================================ */
.app-shell {
    display: flex;
    min-height: 100vh;
}

/* --- Top Navigation Bar --- */
.topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--topbar-height);
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-default);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 100;
    transition: left var(--transition-base);
}

.topbar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.topbar-brand .brand-logo-btn {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--primary-500), var(--primary-700));
    border-radius: var(--radius-md);
    color: white;
    font-size: 16px;
    font-weight: 700;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    overflow: hidden;
    transition: opacity var(--transition-fast);
}

.topbar-brand .brand-logo-btn:hover {
    opacity: 0.85;
}

.topbar-brand .brand-title-input {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    background: transparent;
    border: none;
    outline: none;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    width: 100px;
    transition: background var(--transition-fast);
}

.topbar-brand .brand-title-input:hover,
.topbar-brand .brand-title-input:focus {
    background: var(--bg-subtle);
}

.topbar-brand .brand-divider {
    width: 1px;
    height: 20px;
    background: var(--border-default);
}

.topbar-brand .course-title-input {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    outline: none;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    min-width: 250px;
    flex: 1;
    max-width: 600px;
    transition: background var(--transition-fast);
}

.topbar-brand .course-title-input:hover {
    background: var(--bg-subtle);
}

.topbar-brand .course-title-input:focus {
    background: var(--bg-subtle);
    box-shadow: 0 0 0 2px var(--primary-200);
}

html[data-theme="dark"] .topbar-brand .course-title-input:focus {
    box-shadow: 0 0 0 2px var(--primary-800);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* --- Sidebar --- */
.sidebar {
    position: fixed;
    top: var(--topbar-height);
    left: 0;
    width: var(--sidebar-width);
    height: calc(100vh - var(--topbar-height));
    background: var(--bg-surface);
    border-right: 1px solid var(--border-default);
    display: flex;
    flex-direction: column;
    z-index: 90;
    transition: width var(--transition-base), transform var(--transition-base);
    overflow: hidden;
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed);
}

.sidebar-nav {
    flex: 1;
    padding: 12px 10px;
    overflow-y: auto;
    overflow-x: hidden;
}

.nav-section {
    margin-bottom: 20px;
}

.nav-section-label {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-quaternary);
    padding: 0 10px;
    margin-bottom: 6px;
    white-space: nowrap;
    opacity: 1;
    transition: opacity var(--transition-fast);
}

.sidebar.collapsed .nav-section-label {
    opacity: 0;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 10px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    white-space: nowrap;
}

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

.nav-item:active {
    background: var(--bg-active);
}

.nav-item .nav-icon {
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

.nav-item .nav-label {
    opacity: 1;
    transition: opacity var(--transition-fast);
}

.sidebar.collapsed .nav-label {
    opacity: 0;
    width: 0;
}

.nav-item.nav-sub-item {
    padding-left: 32px;
}

.sidebar.collapsed .nav-item.nav-sub-item {
    padding-left: 10px;
}

.nav-item.active {
    background: var(--primary-50);
    color: var(--primary-600);
}

html[data-theme="dark"] .nav-item.active {
    background: rgba(37, 99, 235, 0.15);
}

/* Cloud Sync sidebar badge (status indicator) */
.nav-badge-cloud {
    display: inline-block;
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--text-tertiary, #94a3b8);
    margin-left: auto;
    margin-right: 12px;
    flex-shrink: 0;
    box-shadow: 0 0 0 2px var(--bg-surface, #fff);
}
.nav-badge-cloud.signed-in { background: #22c55e; }
.nav-badge-cloud.syncing {
    background: var(--primary-500, #3b82f6);
    animation: gdsync-pulse 1.2s ease-in-out infinite;
}
.nav-badge-cloud.error { background: #ef4444; }
.nav-badge-cloud.needs-setup { background: #f59e0b; }
html[data-theme="dark"] .nav-badge-cloud { box-shadow: 0 0 0 2px var(--bg-elevated, #1e293b); }
@keyframes gdsync-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.4); }
}
    color: var(--primary-400);
}

.sidebar-footer {
    padding: 12px 10px;
    border-top: 1px solid var(--border-default);
}

/* Sidebar toggle */
.sidebar-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: var(--radius-md);
    border: none;
    background: var(--bg-subtle);
    color: var(--text-tertiary);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 0.8rem;
}

.sidebar-toggle:hover {
    background: var(--bg-active);
    color: var(--text-primary);
}

/* --- Main Content --- */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    margin-top: var(--topbar-height);
    padding: 24px 28px;
    min-height: calc(100vh - var(--topbar-height));
    transition: margin-left var(--transition-base);
    max-width: calc(100% - var(--sidebar-width));
}

.sidebar.collapsed~.main-content {
    margin-left: var(--sidebar-collapsed);
    max-width: calc(100% - var(--sidebar-collapsed));
}

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

.page-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    line-height: 1.2;
    border: none;
    padding: 0;
    margin: 0;
}

.page-header p {
    font-size: 0.875rem;
    color: var(--text-tertiary);
    margin-top: 4px;
}

/* ============================================
           CARD COMPONENT
           ============================================ */
.card {
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xs);
    transition: box-shadow var(--transition-base);
    overflow: hidden;
}

.card:hover {
    box-shadow: var(--shadow-sm);
}

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

.card-header h2,
.card-header h3 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    border: none;
    padding: 0;
    margin: 0;
}

.card-body {
    padding: 20px;
}

.card-body.compact {
    padding: 12px 16px;
}

/* ============================================
           BUTTONS
           ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 14px;
    font-family: var(--font-sans);
    font-size: 0.82rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
    line-height: 1.4;
    background: none;
    color: var(--text-secondary);
}

.btn:hover {
    background: var(--bg-subtle);
}

.btn:active {
    transform: scale(0.98);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Button variants */
.btn-primary {
    background: var(--primary-600);
    color: white;
    border-color: var(--primary-600);
}

.btn-primary:hover {
    background: var(--primary-700);
    border-color: var(--primary-700);
}

.btn-secondary {
    background: var(--bg-surface);
    color: var(--text-secondary);
    border-color: var(--border-default);
}

.btn-secondary:hover {
    background: var(--bg-subtle);
    border-color: var(--border-strong);
    color: var(--text-primary);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border-color: transparent;
}

.btn-ghost:hover {
    background: var(--bg-subtle);
    color: var(--text-primary);
}

.btn-danger {
    background: var(--danger-500);
    color: white;
    border-color: var(--danger-500);
}

.btn-danger:hover {
    background: var(--danger-600);
    border-color: var(--danger-600);
}

.btn-success {
    background: var(--success-600);
    color: white;
    border-color: var(--success-600);
}

.btn-success:hover {
    background: var(--success-600);
    filter: brightness(0.95);
}

.btn-info {
    background: var(--info-500);
    color: white;
    border-color: var(--info-500);
}

.btn-info:hover {
    background: var(--info-600);
}

.btn-sm {
    padding: 5px 10px;
    font-size: 0.75rem;
    border-radius: var(--radius-sm);
}

.btn-lg {
    padding: 10px 18px;
    font-size: 0.9rem;
}

.btn-icon {
    padding: 8px;
    gap: 0;
}

.btn-icon-sm {
    padding: 5px;
    font-size: 0.8rem;
    gap: 0;
}

/* ============================================
           FORMS & INPUTS
           ============================================ */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    align-items: end;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

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

.form-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 0.01em;
}

.form-input,
.form-select,
.form-textarea {
    font-family: var(--font-sans);
    font-size: 0.85rem;
    padding: 8px 12px;
    background: var(--bg-surface);
    color: var(--text-primary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    outline: none;
    transition: all var(--transition-fast);
    width: 100%;
}

.form-input:hover,
.form-select:hover,
.form-textarea:hover {
    border-color: var(--border-strong);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

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

.form-select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M3 5h6L6 9z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 30px;
}

/* Floating label style */
.form-floating {
    position: relative;
}

.form-floating .form-input,
.form-floating .form-select {
    padding-top: 18px;
    padding-bottom: 6px;
}

.form-floating .form-label {
    position: absolute;
    left: 12px;
    top: 10px;
    font-size: 0.7rem;
    color: var(--text-quaternary);
    pointer-events: none;
    transition: all var(--transition-fast);
}

/* ============================================
           ACCORDION
           ============================================ */
.accordion {
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--bg-surface);
    box-shadow: var(--shadow-xs);
    transition: box-shadow var(--transition-base);
}

.accordion:hover {
    box-shadow: var(--shadow-sm);
}

.accordion summary {
    padding: 14px 20px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-primary);
    background: var(--bg-subtle);
    transition: background var(--transition-fast);
    user-select: none;
}

.accordion summary:hover {
    background: var(--bg-hover);
}

.accordion summary::-webkit-details-marker {
    display: none;
}

.accordion summary::before {
    content: '';
    width: 20px;
    height: 20px;
    border-radius: var(--radius-sm);
    background: var(--primary-100);
    color: var(--primary-600);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    flex-shrink: 0;
    transition: transform var(--transition-fast);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpath fill='%232563eb' d='M3 4l2 2 2-2H3z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
}

.accordion[open] summary::before {
    transform: rotate(180deg);
}

.accordion-content {
    padding: 20px;
}

/* ============================================
           STATISTICS / KPI CARDS
           ============================================ */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.kpi-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: all var(--transition-base);
    box-shadow: var(--shadow-xs);
    position: relative;
    overflow: hidden;
}

.kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--primary-500);
    opacity: 0;
    transition: opacity var(--transition-base);
}

.kpi-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.kpi-card:hover::before {
    opacity: 1;
}

.kpi-card .kpi-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.kpi-card .kpi-icon.icon-blue {
    background: var(--primary-50);
    color: var(--primary-600);
}

.kpi-card .kpi-icon.icon-green {
    background: var(--success-50);
    color: var(--success-600);
}

.kpi-card .kpi-icon.icon-amber {
    background: var(--warning-50);
    color: var(--warning-600);
}

.kpi-card .kpi-icon.icon-red {
    background: var(--danger-50);
    color: var(--danger-600);
}

.kpi-card .kpi-icon.icon-purple {
    background: #f3e8ff;
    color: #9333ea;
}

.kpi-card .kpi-icon.icon-cyan {
    background: #cffafe;
    color: #0891b2;
}

html[data-theme="dark"] .kpi-card .kpi-icon.icon-blue {
    background: rgba(37, 99, 235, 0.15);
    color: var(--primary-400);
}

html[data-theme="dark"] .kpi-card .kpi-icon.icon-green {
    background: rgba(34, 197, 94, 0.15);
    color: var(--success-500);
}

html[data-theme="dark"] .kpi-card .kpi-icon.icon-amber {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning-500);
}

html[data-theme="dark"] .kpi-card .kpi-icon.icon-red {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger-500);
}

html[data-theme="dark"] .kpi-card .kpi-icon.icon-purple {
    background: rgba(147, 51, 234, 0.15);
    color: #c084fc;
}

html[data-theme="dark"] .kpi-card .kpi-icon.icon-cyan {
    background: rgba(8, 145, 178, 0.18);
    color: #22d3ee;
}

.kpi-card .kpi-value {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.03em;
    line-height: 1.1;
}

.kpi-card .kpi-label {
    font-size: 0.78rem;
    color: var(--text-tertiary);
    font-weight: 500;
}

.kpi-card .kpi-trend {
    font-size: 0.72rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    width: fit-content;
}

.kpi-trend.up {
    background: var(--success-50);
    color: var(--success-600);
}

.kpi-trend.down {
    background: var(--danger-50);
    color: var(--danger-600);
}

/* ============================================
           TOOLBAR / CONTROLS
           ============================================ */
.toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    margin-bottom: 16px;
    flex-wrap: wrap;
    box-shadow: var(--shadow-xs);
}

.toolbar-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.toolbar-divider {
    width: 1px;
    height: 24px;
    background: var(--border-default);
}

/* Search */
.search-box {
    position: relative;
    flex: 1;
    min-width: 200px;
    max-width: 400px;
}

.search-box .search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-quaternary);
    font-size: 0.85rem;
    pointer-events: none;
}

.search-box input {
    width: 100%;
    padding: 7px 32px 7px 34px;
    font-family: var(--font-sans);
    font-size: 0.82rem;
    background: var(--bg-subtle);
    color: var(--text-primary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    outline: none;
    transition: all var(--transition-fast);
}

.search-box input:hover {
    border-color: var(--border-strong);
}

.search-box input:focus {
    background: var(--bg-surface);
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.search-box .search-clear {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-quaternary);
    cursor: pointer;
    padding: 2px;
    font-size: 0.8rem;
    display: none;
}

.search-box .search-clear:hover {
    color: var(--danger-500);
}

/* ============================================
           DATA TABLE — Modern Grid
           ============================================ */
.data-table-wrapper {
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-xs);
}

.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.82rem;
}

.data-table thead th {
    position: sticky;
    top: 0;
    background: var(--bg-subtle);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border-default);
    white-space: nowrap;
    z-index: 2;
}

.data-table tbody tr {
    transition: background var(--transition-fast);
}

.data-table tbody tr:hover {
    background: var(--bg-hover);
}

.data-table tbody td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-primary);
    vertical-align: middle;
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

/* Status badges in table */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: 0.72rem;
    font-weight: 600;
}

.status-badge.not-started {
    background: var(--status-not-started-bg);
    color: var(--status-not-started-text);
}

.status-badge.in-progress {
    background: var(--status-in-progress-bg);
    color: var(--status-in-progress-text);
}

.status-badge.done {
    background: var(--status-done-bg);
    color: var(--status-done-text);
}

/* Progress bar */
.progress-track {
    width: 100%;
    height: 6px;
    background: var(--bg-inset);
    border-radius: var(--radius-full);
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-500), var(--primary-400));
    border-radius: var(--radius-full);
    transition: width var(--transition-slow);
}

.progress-text {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-tertiary);
    min-width: 32px;
    text-align: right;
}

/* Grade badge */
.grade-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: var(--radius-md);
    font-size: 0.75rem;
    font-weight: 700;
}

.grade-a {
    background: var(--success-50);
    color: var(--success-600);
}

.grade-b {
    background: var(--primary-50);
    color: var(--primary-600);
}

.grade-c {
    background: var(--warning-50);
    color: var(--warning-600);
}

.grade-d {
    background: #fff7ed;
    color: #ea580c;
}

.grade-e {
    background: var(--danger-50);
    color: var(--danger-600);
}

html[data-theme="dark"] .grade-a {
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
}

html[data-theme="dark"] .grade-b {
    background: rgba(37, 99, 235, 0.15);
    color: #60a5fa;
}

html[data-theme="dark"] .grade-c {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
}

html[data-theme="dark"] .grade-d {
    background: rgba(234, 88, 12, 0.15);
    color: #fb923c;
}

html[data-theme="dark"] .grade-e {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
}

/* Drag handle */
.drag-handle {
    cursor: grab;
    color: var(--text-quaternary);
    padding: 0 4px;
    font-size: 1rem;
    transition: color var(--transition-fast);
}

.drag-handle:hover {
    color: var(--text-tertiary);
}

tr.dragging {
    opacity: 0.5;
}

tr.drag-over {
    border-top: 2px solid var(--primary-500);
}

/* Overdue badge */
.overdue-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-size: 0.68rem;
    font-weight: 700;
    margin-top: 4px;
}

.overdue-badge.overdue {
    background: var(--danger-50);
    color: var(--danger-600);
}

.overdue-badge.warning {
    background: var(--warning-50);
    color: var(--warning-600);
}

/* ============================================
           MODAL — Slide Over Panel
           ============================================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-base), visibility var(--transition-base);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-panel {
    background: var(--bg-surface);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    width: 95%;
    max-width: 720px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.95) translateY(10px);
    transition: transform var(--transition-slow);
}

.modal-overlay.active .modal-panel {
    transform: scale(1) translateY(0);
}

.modal-panel.slide-over {
    position: fixed;
    right: 0;
    top: 0;
    bottom: 0;
    width: 560px;
    max-width: 95vw;
    border-radius: var(--radius-xl) 0 0 var(--radius-xl);
    transform: translateX(100%);
    max-height: 100vh;
}

.modal-overlay.active .modal-panel.slide-over {
    transform: translateX(0);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-default);
    flex-shrink: 0;
}

.modal-header h3 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    border: none;
    padding: 0;
    margin: 0;
}

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

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    border-top: 1px solid var(--border-default);
    background: var(--bg-subtle);
    flex-shrink: 0;
}

.modal-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-md);
    border: none;
    background: var(--bg-subtle);
    color: var(--text-tertiary);
    cursor: pointer;
    font-size: 1rem;
    transition: all var(--transition-fast);
}

.modal-close:hover {
    background: var(--danger-50);
    color: var(--danger-500);
}

/* ============================================
           DROPZONE
           ============================================ */
.dropzone {
    border: 2px dashed var(--border-strong);
    border-radius: var(--radius-lg);
    padding: 32px 24px;
    text-align: center;
    color: var(--text-tertiary);
    cursor: pointer;
    transition: all var(--transition-base);
    background: var(--bg-subtle);
}

.dropzone:hover {
    border-color: var(--primary-400);
    background: var(--primary-50);
    color: var(--primary-600);
}

.dropzone.dragover {
    border-color: var(--primary-500);
    background: var(--primary-50);
    border-style: solid;
}

.dropzone-icon {
    font-size: 2rem;
    margin-bottom: 8px;
    display: block;
}

/* ============================================
           DOCUMENT LIST
           ============================================ */
.doc-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.doc-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: var(--bg-subtle);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.doc-item:hover {
    border-color: var(--border-strong);
    background: var(--bg-hover);
}

.doc-item a {
    color: var(--primary-600);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.82rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.doc-item a:hover {
    text-decoration: underline;
}

/* ============================================
           NOTES SECTION
           ============================================ */
.notes-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.note-card {
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--bg-surface);
    transition: box-shadow var(--transition-base), border-color var(--transition-base);
}

.note-card:hover {
    border-color: var(--border-strong);
    box-shadow: var(--shadow-sm);
}

.note-header-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: var(--bg-subtle);
    border-bottom: 1px solid var(--border-subtle);
}

.note-title-input {
    font-weight: 600;
    font-size: 0.88rem;
    border: none;
    background: transparent;
    outline: none;
    flex: 1;
    color: var(--text-primary);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    transition: background var(--transition-fast);
}

.note-title-input:focus {
    background: var(--bg-surface);
    box-shadow: inset 0 0 0 1px var(--primary-300);
}

/* ============================================
           CATATAN UTAMA — PINNED MAIN NOTE
           (Prominent, always at top of Notes section)
           ============================================ */
.main-note-wrapper {
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    margin-bottom: 16px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    position: relative;
    transition: box-shadow var(--transition-base), border-color var(--transition-base);
}

.main-note-wrapper:hover {
    border-color: var(--border-strong);
    box-shadow: var(--shadow-md);
}

html[data-theme="dark"] .main-note-wrapper {
    background: var(--bg-surface);
    border-color: var(--border-default);
}

.main-note-wrapper::before {
    content: none;
}

@keyframes shimmer {
    0% { background-position: 0% 0; }
    100% { background-position: 200% 0; }
}

.main-note-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: var(--bg-subtle);
    border-bottom: 1px solid var(--border-subtle);
    gap: 10px;
}

html[data-theme="dark"] .main-note-header {
    background: var(--bg-subtle);
    border-bottom-color: var(--border-subtle);
}

.main-note-title-group {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.main-note-star {
    color: var(--text-tertiary);
    font-size: 1rem;
    flex-shrink: 0;
}

@keyframes starPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

.main-note-title {
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--text-primary);
    letter-spacing: 0.2px;
}

html[data-theme="dark"] .main-note-title {
    color: var(--text-primary);
}

.main-note-badge {
    font-size: 0.6rem;
    font-weight: 700;
    padding: 2px 7px;
    background: var(--primary-100);
    color: var(--primary-700);
    border-radius: var(--radius-full);
    letter-spacing: 0.4px;
    text-transform: uppercase;
    flex-shrink: 0;
}

html[data-theme="dark"] .main-note-badge {
    background: var(--primary-100);
    color: var(--primary-700);
}

.main-note-status {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.72rem;
    color: #16a34a;
    font-weight: 500;
    flex-shrink: 0;
}

.main-note-status i {
    font-size: 0.85rem;
}

.main-note-status.saving {
    color: var(--text-tertiary);
}

.main-note-status.saving i {
    animation: pulse 1.2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.main-note-editor-container {
    background: var(--bg-surface);
    min-height: 140px;
    max-height: 350px;
    overflow: auto;
    padding: 0;
}

.main-note-editor-container .ck-editor {
    border: none !important;
    box-shadow: none !important;
    background: var(--bg-surface) !important;
}

.main-note-editor-container .ck-editor__top {
    border-bottom: 1px solid var(--border-subtle) !important;
    background: var(--bg-subtle) !important;
}

html[data-theme="dark"] .main-note-editor-container .ck-editor__top {
    background: var(--bg-subtle) !important;
}

.main-note-editor-container .ck-editor__main {
    background: var(--bg-surface) !important;
}

.main-note-editor-container .ck-editor__editable {
    min-height: 140px !important;
    max-height: 320px !important;
    padding: 14px 18px !important;
    font-size: 0.92rem !important;
    line-height: 1.65 !important;
    background: var(--bg-surface) !important;
}

.main-note-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 14px;
    background: var(--bg-subtle);
    border-top: 1px solid var(--border-subtle);
    gap: 10px;
    flex-wrap: wrap;
}

html[data-theme="dark"] .main-note-footer {
    background: var(--bg-subtle);
    border-top-color: var(--border-subtle);
}

.main-note-hint {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.7rem;
    color: var(--text-tertiary);
    flex: 1;
    min-width: 200px;
}

html[data-theme="dark"] .main-note-hint {
    color: var(--text-tertiary);
}

.main-note-hint i {
    font-size: 0.8rem;
    flex-shrink: 0;
}

.main-note-char-count {
    font-size: 0.7rem;
    color: var(--text-tertiary);
    font-weight: 500;
    white-space: nowrap;
    flex-shrink: 0;
}

/* === Section Divider (Main Note vs Additional Notes) === */
.notes-section-divider {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 18px 0 12px;
}

.notes-section-divider-line {
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border-default), transparent);
}

.notes-section-divider-content {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-tertiary);
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 0 4px;
    flex-shrink: 0;
}

.notes-section-divider-content i {
    font-size: 0.85rem;
    color: var(--primary-500);
}

.notes-section-divider-content .btn {
    margin-left: 6px;
    min-height: 30px;
    padding: 4px 10px;
    font-size: 0.7rem;
    text-transform: none;
    letter-spacing: 0;
}

html[data-theme="dark"] .notes-section-divider-line {
    background: linear-gradient(90deg, transparent, var(--border-strong), transparent);
}

/* === Hide redundant "Tambah Catatan" button in empty state ===
   The "Catatan Baru" button in the section divider above already serves this purpose,
   so the empty state's CTA button is redundant and visually noisy. */
#details-modal .detail-notes-empty > button {
    display: none !important;
}

/* === Empty state for "Belum ada catatan tambahan" — desktop default ===
   Simple, unified text-only empty state (no icon dependency) */
#details-modal .detail-notes-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px 14px;
    text-align: center;
    color: var(--text-tertiary);
    min-height: 50px;
}

#details-modal .detail-notes-empty i {
    display: none; /* Hide icon — keep the empty state clean and text-only */
}

#details-modal .detail-notes-empty p {
    margin: 0;
    font-size: 0.82rem;
    font-weight: 500;
    line-height: 1.4;
    color: var(--text-tertiary);
    letter-spacing: 0.1px;
}

/* ============================================
           AI ASSESSMENT BOX
           ============================================ */
.ai-box {
    background: var(--bg-subtle);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    padding: 16px;
}

/* ============================================
           DETAIL MODAL — UI/UX REDESIGN
           Card-based layout with logical grouping
           (Visual Hierarchy + Gestalt Proximity)
           ============================================ */

/* === Modal Panel override for Detail === */
#details-modal .modal-panel.detail-modal-panel {
    max-width: 1080px;
    width: 96vw;
    max-height: 92vh;
    border-radius: var(--radius-xl);
    box-shadow: 0 24px 48px -8px rgba(15, 23, 42, 0.18),
                0 12px 24px -8px rgba(15, 23, 42, 0.12);
}

/* === Sticky Header === */
#details-modal .detail-modal-header {
    position: sticky;
    top: 0;
    z-index: 5;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-default);
    padding: 14px 20px;
    gap: 14px;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    box-shadow: 0 1px 0 rgba(15, 23, 42, 0.02);
}

#details-modal .detail-modal-title-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

#details-modal .detail-modal-title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

#details-modal .detail-modal-title i {
    color: var(--primary-500);
    font-size: 1.1rem;
}

#details-modal #detail-last-edited {
    padding-left: 12px;
    border-left: 1px solid var(--border-default);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
    font-size: 0.72rem;
}

/* === Modal Body — Custom scrollbar === */
#details-modal .detail-modal-body {
    padding: 20px;
    background: var(--bg-body);
    display: flex;
    flex-direction: column;
    gap: 16px;
    scrollbar-width: thin;
    scrollbar-color: var(--border-strong) transparent;
}

#details-modal .detail-modal-body::-webkit-scrollbar {
    width: 8px;
}

#details-modal .detail-modal-body::-webkit-scrollbar-track {
    background: transparent;
}

#details-modal .detail-modal-body::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border-radius: 8px;
}

#details-modal .detail-modal-body::-webkit-scrollbar-thumb:hover {
    background: var(--text-quaternary);
}

/* === Row Layouts === */
#details-modal .detail-row {
    display: grid;
    gap: 16px;
}

#details-modal .detail-row-2col {
    grid-template-columns: 1.4fr 1fr;
}

#details-modal .detail-row-3col {
    grid-template-columns: 1fr 1fr 1fr;
}

#details-modal .detail-row-attachments {
    align-items: stretch;
}

/* === Card (Common Region — Gestalt) === */
#details-modal .detail-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: border-color var(--transition-base), box-shadow var(--transition-base);
    display: flex;
    flex-direction: column;
}

#details-modal .detail-card:hover {
    border-color: var(--border-strong);
    box-shadow: var(--shadow-sm);
}

#details-modal .detail-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-subtle);
    border-bottom: 1px solid var(--border-subtle);
    flex-shrink: 0;
}

#details-modal .detail-card-title-group {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1;
}

#details-modal .detail-card-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    gap: 6px;
}

#details-modal .detail-card-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    flex-shrink: 0;
}

#details-modal .detail-card-icon-primary {
    background: var(--primary-100);
    color: var(--primary-700);
}

#details-modal .detail-card-icon-accent {
    background: #ede9fe;
    color: #6d28d9;
}

#details-modal .detail-card-icon-warning {
    background: var(--warning-100);
    color: var(--warning-600);
}

#details-modal .detail-card-icon-info {
    background: #dbeafe;
    color: #1d4ed8;
}

#details-modal .detail-card-icon-success {
    background: var(--success-100);
    color: var(--success-600);
}

#details-modal .detail-card-icon-danger {
    background: var(--danger-100);
    color: var(--danger-600);
}

#details-modal .detail-card-icon-ai {
    background: linear-gradient(135deg, #e0e7ff, #c7d2fe);
    color: #4338ca;
}

#details-modal .detail-card-actions {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-shrink: 0;
}

#details-modal .detail-card-body {
    padding: 14px 16px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 0;
}

/* === Form Field Spacing inside cards === */
#details-modal .detail-field {
    margin-bottom: 0;
}

#details-modal .detail-field-full {
    grid-column: 1 / -1;
}

#details-modal .detail-field .form-label {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 4px;
}

/* === Grid System inside cards === */
#details-modal .detail-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 12px;
}

/* === Color Picker Styling === */
#details-modal .detail-color-input {
    height: 40px;
    padding: 3px;
    cursor: pointer;
    border-radius: var(--radius-md);
}

/* === Notes Card — Special emphasis (primary content) === */
#details-modal .detail-card-notes {
    border-color: var(--primary-200);
    background: linear-gradient(180deg, var(--bg-surface) 0%, var(--bg-surface) 100%);
    flex-shrink: 0; /* Prevent collapse inside modal-body flex container */
}

#details-modal .detail-card-notes .detail-card-header {
    background: linear-gradient(135deg, var(--primary-50), var(--primary-100));
    border-bottom: 1px solid var(--primary-200);
}

#details-modal .detail-card-notes .detail-card-title {
    color: var(--primary-700);
}

/* === Links Container (chip-like) === */
#details-modal .detail-links-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 240px;
    overflow-y: auto;
    padding-right: 2px;
    scrollbar-width: thin;
}

#details-modal .detail-links-container:empty::before {
    content: "Belum ada link / sub-materi. Klik 'Tambah' untuk membuat link baru.";
    display: block;
    text-align: center;
    color: var(--text-tertiary);
    font-size: 0.78rem;
    padding: 18px 8px;
    font-style: italic;
}

/* === Image Previews (gallery grid) === */
#details-modal .detail-image-previews {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 8px;
    max-height: 220px;
    overflow-y: auto;
    padding: 2px;
    scrollbar-width: thin;
}

#details-modal .detail-image-previews:empty::before {
    content: "Belum ada gambar terlampir.";
    display: block;
    grid-column: 1 / -1;
    text-align: center;
    color: var(--text-tertiary);
    font-size: 0.78rem;
    padding: 18px 8px;
    font-style: italic;
}

/* === AI Assessment Actions === */
#details-modal .detail-ai-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 4px;
}

/* === Dropzone (compact inside card) === */
#details-modal .detail-card-documents .dropzone {
    padding: 18px 14px;
}

#details-modal .detail-card-documents .dropzone-icon {
    font-size: 1.6rem;
    margin-bottom: 4px;
}

#details-modal .dropzone-title {
    font-weight: 600;
    font-size: 0.82rem;
    margin-bottom: 2px;
    color: var(--text-primary);
}

#details-modal .dropzone-subtitle {
    font-size: 0.72rem;
    color: var(--text-quaternary);
}

#details-modal .doc-empty {
    color: var(--text-tertiary);
    font-size: 0.78rem;
    text-align: center;
    padding: 12px 8px;
    margin: 0;
    font-style: italic;
}

/* === Footer override for detail === */
#details-modal .detail-modal-footer {
    background: var(--bg-surface);
    border-top: 1px solid var(--border-default);
    padding: 14px 20px;
    gap: 10px;
    border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}

#details-modal .detail-footer-download {
    width: auto;
    padding: 10px 18px;
    font-size: 0.85rem;
}

#details-modal .detail-footer-save {
    padding: 10px 20px;
    font-weight: 600;
}

/* === Action label visibility (controls icon-only on smaller screens) === */
#details-modal .detail-action-label {
    display: inline;
}

/* === Tablet (768px - 1023px) === */
@media (min-width: 768px) and (max-width: 1023px) {
    #details-modal .modal-panel.detail-modal-panel {
        max-width: 96vw;
    }

    #details-modal .detail-row-2col {
        grid-template-columns: 1.3fr 1fr;
    }

    #details-modal .detail-row-3col {
        grid-template-columns: 1fr 1fr;
    }

    #details-modal .detail-card-documents {
        grid-column: 1 / -1;
    }
}

/* === Small Tablet / Large Phone (600px - 767px) === */
@media (max-width: 767px) {
    #details-modal .modal-panel.detail-modal-panel {
        max-width: 100%;
        width: 100%;
        max-height: 95vh;
        border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    }

    #details-modal .detail-modal-header {
        padding: 12px 14px;
    }

    #details-modal .detail-modal-title {
        font-size: 0.95rem;
    }

    #details-modal .detail-modal-body {
        padding: 14px;
        gap: 14px;
    }

    #details-modal .detail-row-2col,
    #details-modal .detail-row-3col {
        grid-template-columns: 1fr;
    }

    #details-modal .detail-card-header {
        padding: 10px 12px;
    }

    #details-modal .detail-card-body {
        padding: 12px;
    }

    #details-modal .detail-card-title {
        font-size: 0.78rem;
    }

    #details-modal .detail-card-icon {
        width: 26px;
        height: 26px;
        font-size: 0.85rem;
    }

    /* On small screens, hide labels inside action buttons (icon-only) */
    #details-modal .detail-action-label {
        display: none;
    }

    /* Notes card action buttons still keep full label (primary action) */
    #details-modal .detail-card-notes .detail-action-label {
        display: inline;
    }

    #details-modal .detail-card-notes .detail-action-download .detail-action-label,
    #details-modal .detail-card-notes .btn:not(.btn-primary) .detail-action-label {
        display: none;
    }

    #details-modal .detail-image-previews {
        grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
    }

    #details-modal .detail-modal-footer {
        padding: 10px 14px;
        flex-direction: row;
        gap: 8px;
    }

    #details-modal .detail-footer-download,
    #details-modal .detail-footer-save {
        flex: 1;
        min-height: 44px;
    }

    #details-modal .detail-modal-footer span {
        display: inline;
    }
}

/* === Very Small Phone (≤480px) === */
@media (max-width: 480px) {
    #details-modal .detail-modal-header {
        padding: 10px 12px;
        gap: 8px;
    }

    #details-modal .detail-modal-title {
        font-size: 0.9rem;
        gap: 6px;
    }

    #details-modal #detail-last-edited {
        display: none;
    }

    #details-modal .detail-modal-body {
        padding: 12px;
        gap: 12px;
    }

    #details-modal .detail-card-header {
        padding: 10px;
    }

    #details-modal .detail-card-body {
        padding: 10px;
    }

    #details-modal .detail-grid-2 {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    #details-modal .detail-card-actions {
        gap: 4px;
    }

    #details-modal .detail-card-actions .btn {
        min-height: 38px;
        padding: 6px 10px;
    }

    #details-modal .detail-card-notes .detail-card-actions .btn {
        min-height: 38px;
    }

    #details-modal .detail-card-notes .btn-primary {
        flex: 1;
    }

    #details-modal .detail-image-previews {
        grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
        max-height: 180px;
    }

    #details-modal .detail-modal-footer {
        padding: 10px 12px;
    }

    #details-modal .detail-modal-footer .btn span {
        font-size: 0.8rem;
    }

    /* === MOBILE: Floating Add Note FAB === */
    #details-modal .detail-card-notes .detail-card-header {
        position: relative;
    }

    #details-modal .detail-card-actions-desktop {
        gap: 4px;
    }

    #details-modal .detail-notes-empty {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 8px;
        padding: 24px 14px;
        text-align: center;
        color: var(--text-tertiary);
    }

    #details-modal .detail-notes-empty i {
        font-size: 2.4rem;
        color: var(--primary-300);
        opacity: 0.7;
    }

    #details-modal .detail-notes-empty p {
        margin: 0;
        font-size: 0.85rem;
        font-weight: 500;
    }

    /* === MOBILE: Floating FAB for Add Note === */
    #details-modal .detail-card-notes .detail-card-body {
        position: relative;
        padding-bottom: 70px;
    }

    #details-modal .detail-mobile-fab {
        position: sticky;
        bottom: 8px;
        left: 0;
        right: 0;
        margin-top: 12px;
        display: flex;
        justify-content: center;
        pointer-events: none;
        z-index: 4;
    }

    #details-modal .detail-mobile-fab .btn {
        pointer-events: auto;
        box-shadow: 0 6px 16px rgba(59, 130, 246, 0.35);
        padding: 12px 20px;
        font-size: 0.88rem;
        font-weight: 600;
        min-height: 48px;
        border-radius: var(--radius-full);
    }

    #details-modal .detail-mobile-fab .btn i {
        font-size: 1.05rem;
    }

    /* Better CKEditor mobile sizing in detail notes */
    #details-modal .scrollable-text {
        min-height: 100px !important;
    }

    /* === MOBILE: Catatan Utama — compact sizing === */
    #details-modal .main-note-header {
        padding: 8px 12px;
        flex-wrap: wrap;
        gap: 6px;
    }

    #details-modal .main-note-title {
        font-size: 0.85rem;
    }

    #details-modal .main-note-badge {
        font-size: 0.58rem;
        padding: 2px 6px;
    }

    #details-modal .main-note-status {
        font-size: 0.68rem;
    }

    #details-modal .main-note-editor-container {
        min-height: 110px;
        max-height: 280px;
    }

    #details-modal .main-note-editor-container .ck-editor__editable {
        min-height: 110px !important;
        max-height: 260px !important;
        padding: 12px 14px !important;
        font-size: 0.95rem !important;
    }

    #details-modal .main-note-editor-container .ck-editor .ck-toolbar {
        padding: 2px 4px !important;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    #details-modal .main-note-editor-container .ck-editor .ck-toolbar .ck-toolbar__items {
        flex-wrap: wrap;
    }

    #details-modal .main-note-footer {
        padding: 6px 12px;
    }

    #details-modal .main-note-hint {
        font-size: 0.65rem;
        min-width: 0;
    }

    #details-modal .notes-section-divider {
        margin: 14px 0 10px;
    }

    #details-modal .notes-section-divider-content {
        font-size: 0.65rem;
        flex-wrap: wrap;
        justify-content: center;
    }

    #details-modal .notes-section-divider-content .btn {
        margin-left: 0;
        margin-top: 4px;
        width: 100%;
        min-height: 36px;
    }
}

/* === Dark Mode adjustments for detail modal === */

/* === Dark Mode adjustments for detail modal === */
html[data-theme="dark"] #details-modal .detail-card-notes {
    background: var(--bg-surface);
    border-color: var(--primary-700);
}

html[data-theme="dark"] #details-modal .detail-card-notes .detail-card-header {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.12), rgba(29, 78, 216, 0.18));
    border-bottom-color: var(--primary-700);
}

html[data-theme="dark"] #details-modal .detail-card-notes .detail-card-title {
    color: var(--primary-300);
}

html[data-theme="dark"] #details-modal .detail-modal-body {
    background: var(--bg-body);
}

/* ============================================
           FULLSCREEN NOTES
           ============================================ */
.fs-modal {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(8px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-base), visibility var(--transition-base);
}

.fs-modal.active {
    opacity: 1;
    visibility: visible;
}

.fs-content {
    background: var(--bg-surface);
    width: 95%;
    height: 95%;
    max-width: 1300px;
    border-radius: var(--radius-xl);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.95);
    transition: transform var(--transition-slow);
    box-shadow: var(--shadow-xl);
}

.fs-modal.active .fs-content {
    transform: scale(1);
}

/* === Top Bar Layout === */
.fs-topbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.fs-topbar-icon {
    color: var(--primary-500);
    font-size: 1.2rem;
    flex-shrink: 0;
}

.fs-topbar-titles {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.fs-topbar-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fs-topbar-subtitle {
    font-size: 0.72rem;
    color: var(--text-tertiary);
}

.fs-topbar-center {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-shrink: 0;
}

.fs-topbar-right {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-shrink: 0;
    margin-left: 8px;
}

.fs-topbar-mobile-right {
    display: none;
}

.fs-note-index-display {
    font-size: 0.72rem;
    color: var(--text-tertiary);
    white-space: nowrap;
}

.fs-desktop-only {
    display: flex;
}

.fs-mobile-only {
    display: none;
}

/* --- Google Docs Style Layout --- */
.fs-docs-layout {
    width: 100%;
    max-width: 1000px;
    height: 92vh;
    border-radius: var(--radius-lg);
}

.fs-docs-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 18px;
    border-bottom: 1px solid var(--border-default);
    background: var(--bg-surface);
    flex-shrink: 0;
    gap: 12px;
}

.fs-docs-topbar .fs-note-select {
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    padding: 5px 10px;
    background: var(--bg-subtle);
    color: var(--text-primary);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.fs-docs-topbar .fs-note-select:hover {
    border-color: var(--primary-400);
}

.fs-docs-topbar .fs-note-select:focus {
    border-color: var(--primary-500);
    box-shadow: 0 0 0 2px var(--primary-100);
    outline: none;
}

/* Navigation Bar */
.fs-nav-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 6px 18px;
    border-bottom: 1px solid var(--border-subtle);
    background: var(--bg-subtle);
    flex-shrink: 0;
}

.fs-nav-info {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1;
    max-width: 480px;
    justify-content: center;
}

.fs-nav-title {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
    flex: 1;
    text-align: center;
}

.fs-nav-counter {
    font-size: 0.7rem;
    color: var(--text-tertiary);
    background: var(--bg-surface);
    padding: 2px 8px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-default);
    white-space: nowrap;
    flex-shrink: 0;
    font-weight: 600;
}

.fs-nav-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-default);
    background: var(--bg-surface);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 0.85rem;
}

.fs-nav-arrow:hover:not(:disabled) {
    background: var(--primary-50);
    border-color: var(--primary-400);
    color: var(--primary-600);
}

.fs-nav-arrow:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

/* Docs Body - fill remaining space, no overflow here */
.fs-docs-body {
    flex: 1;
    overflow: hidden;
    padding: 0;
    background: var(--bg-surface);
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* The single "page" card */
.fs-docs-page {
    width: 100%;
    height: 100%;
    background: var(--bg-surface);
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
    min-height: 0;
}

/* Title input bar - fixed at top, always visible */
.fs-page-title-bar {
    padding: 16px 28px 12px 28px;
    flex-shrink: 0;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-subtle);
    z-index: 10;
}

.fs-page-title-input {
    width: 100%;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary);
    border: none;
    outline: none;
    background: transparent;
    padding: 4px 0;
    transition: color var(--transition-fast);
}

.fs-page-title-input:focus {
    color: var(--primary-600);
}

.fs-page-title-input::placeholder {
    color: var(--text-quaternary);
}

/* Editor container - fills remaining space, CKEditor will be rendered here */
.fs-note-editor-container {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* ============================================
   CKEDITOR FULLSCREEN EDITOR OVERRIDES
   ============================================ */

/* CKEditor main wrapper - fill container */
.fs-note-editor-container .ck-editor {
    display: flex !important;
    flex-direction: column !important;
    height: 100% !important;
    border: none !important;
    min-height: 0 !important;
}

/* CKEditor top area (toolbar wrapper) */
.fs-note-editor-container .ck-editor__top {
    flex-shrink: 0 !important;
    border: none !important;
}

/* CKEditor toolbar */
.fs-note-editor-container .ck-editor .ck-toolbar {
    border: none !important;
    border-radius: 0 !important;
    background: var(--bg-subtle) !important;
    padding: 4px 10px !important;
    border-bottom: 1px solid var(--border-default) !important;
}

/* CKEditor main area - this is where scroll happens */
.fs-note-editor-container .ck-editor__main {
    flex: 1 !important;
    overflow: auto !important;
    border: none !important;
    min-height: 0 !important;
}

/* CKEditor editable area */
.fs-note-editor-container .ck-editor__editable {
    min-height: 100% !important;
    border: none !important;
    border-radius: 0 !important;
    font-size: 1rem !important;
    line-height: 1.8 !important;
    padding: 18px 28px 80px 28px !important;
    background: var(--bg-surface) !important;
}

/* CKEditor dropdown & balloon panels */
.fs-note-editor-container .ck.ck-dropdown__panel,
.fs-note-editor-container .ck.ck-balloon-panel {
    z-index: 9999 !important;
}

/* Footer */
.fs-docs-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 18px;
    border-top: 1px solid var(--border-default);
    background: var(--bg-surface);
    flex-shrink: 0;
}

.fs-footer-stats {
    display: flex;
    align-items: center;
    gap: 12px;
}

.fs-char-count {
    font-size: 0.72rem;
    color: var(--text-quaternary);
}

.fs-mobile-char-count {
    font-size: 0.72rem;
    color: var(--text-quaternary);
}

/* ============================================
   FULLSCREEN NOTES — MOBILE OPTIMIZATION
   ============================================ */

/* === Mobile Action Bar (Bottom Sheet-style) === */
.fs-mobile-action-bar {
    position: relative;
    flex-shrink: 0;
    display: none;
    background: var(--bg-surface);
    border-top: 1px solid var(--border-default);
    padding: 8px 8px;
    padding-bottom: max(8px, env(safe-area-inset-bottom));
    box-shadow: 0 -2px 12px rgba(15, 23, 42, 0.06);
    gap: 4px;
    align-items: stretch;
    justify-content: space-between;
    z-index: 5;
}

.fs-mobile-action {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 8px 4px;
    background: none;
    border: none;
    color: var(--text-tertiary);
    font-size: 0.62rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    min-height: 52px;
    -webkit-tap-highlight-color: transparent;
}

.fs-mobile-action i {
    font-size: 1.2rem;
    line-height: 1;
}

.fs-mobile-action:active {
    background: var(--bg-subtle);
    transform: scale(0.96);
}

.fs-mobile-action:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.fs-mobile-action-primary {
    background: linear-gradient(135deg, var(--primary-500), var(--primary-600));
    color: white;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.25);
    flex: 1.4;
    margin: 0 2px;
}

.fs-mobile-action-primary:active {
    background: linear-gradient(135deg, var(--primary-600), var(--primary-700));
}

.fs-mobile-action-primary i {
    font-size: 1.3rem;
}

/* === Mobile More Menu (Bottom Sheet) === */
.fs-mobile-more-menu {
    position: fixed;
    inset: 0;
    z-index: 100;
    pointer-events: none;
}

.fs-mobile-more-menu[aria-hidden="false"] {
    pointer-events: auto;
}

.fs-mobile-more-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(2px);
    opacity: 0;
    transition: opacity 0.25s ease;
}

.fs-mobile-more-menu[aria-hidden="false"] .fs-mobile-more-backdrop {
    opacity: 1;
}

.fs-mobile-more-sheet {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-surface);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    box-shadow: 0 -8px 24px rgba(15, 23, 42, 0.18);
    padding: 8px 0 12px;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    max-height: 80vh;
    overflow-y: auto;
    padding-bottom: max(12px, env(safe-area-inset-bottom));
}

.fs-mobile-more-menu[aria-hidden="false"] .fs-mobile-more-sheet {
    transform: translateY(0);
}

.fs-mobile-more-handle {
    width: 36px;
    height: 4px;
    background: var(--border-strong);
    border-radius: 2px;
    margin: 6px auto 12px;
}

.fs-mobile-more-title {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-tertiary);
    text-align: center;
    padding: 0 16px 8px;
}

.fs-mobile-more-item {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 14px 20px;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    transition: background var(--transition-fast);
    -webkit-tap-highlight-color: transparent;
}

.fs-mobile-more-item i {
    font-size: 1.15rem;
    color: var(--text-secondary);
    width: 24px;
    text-align: center;
}

.fs-mobile-more-item:active {
    background: var(--bg-subtle);
}

.fs-mobile-more-item:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.fs-mobile-more-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px 4px;
    border-top: 1px solid var(--border-subtle);
    margin-top: 8px;
}

.fs-mobile-more-cancel {
    display: block;
    width: calc(100% - 32px);
    margin: 12px 16px 0;
    padding: 12px;
    background: var(--bg-subtle);
    color: var(--text-primary);
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--transition-fast);
    -webkit-tap-highlight-color: transparent;
}

.fs-mobile-more-cancel:active {
    background: var(--bg-hover);
}

.fs-footer-desktop {
    /* Default: visible */
}

.fs-mobile-action-bar {
    display: none;
}

.fs-mobile-more-menu {
    display: none;
}

/* === Mobile: Fullscreen Notes Layout === */
@media (max-width: 768px) {
    /* Full-screen modal: no rounded corners, take full screen */
    .fs-content.fs-docs-layout {
        width: 100%;
        max-width: 100%;
        height: 100%;
        height: 100dvh; /* Dynamic viewport for mobile browsers */
        border-radius: 0;
    }

    /* Hide desktop-only top bar elements */
    .fs-desktop-only {
        display: none !important;
    }

    /* Show mobile top right (close button) */
    .fs-topbar-mobile-right {
        display: flex;
        align-items: center;
        flex-shrink: 0;
    }

    .fs-topbar-mobile-right .modal-close {
        width: 40px;
        height: 40px;
        min-height: 40px;
        font-size: 1.05rem;
        background: var(--bg-subtle);
    }

    /* Compact top bar */
    .fs-docs-topbar {
        padding: 8px 12px;
        gap: 8px;
        min-height: 52px;
    }

    .fs-topbar-icon {
        font-size: 1.1rem;
    }

    .fs-topbar-title {
        font-size: 0.85rem;
    }

    .fs-topbar-subtitle {
        font-size: 0.68rem;
    }

    /* Nav bar: more compact */
    .fs-nav-bar {
        padding: 6px 10px;
        gap: 8px;
    }

    .fs-nav-arrow {
        width: 38px;
        height: 38px;
        min-height: 38px;
        font-size: 1rem;
    }

    .fs-nav-title {
        font-size: 0.78rem;
    }

    .fs-nav-counter {
        font-size: 0.65rem;
        padding: 2px 6px;
    }

    /* Title bar */
    .fs-page-title-bar {
        padding: 12px 16px 10px;
    }

    .fs-page-title-input {
        font-size: 1.15rem;
    }

    /* Editor area: more vertical space on mobile */
    .fs-note-editor-container .ck-editor .ck-toolbar {
        padding: 2px 4px !important;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .fs-note-editor-container .ck-editor .ck-toolbar .ck-toolbar__items {
        flex-wrap: wrap;
    }

    .fs-note-editor-container .ck-editor__editable {
        font-size: 1rem !important;
        line-height: 1.7 !important;
        padding: 14px 16px 100px 16px !important;
        -webkit-overflow-scrolling: touch;
    }

    /* Hide desktop footer, show mobile action bar */
    .fs-footer-desktop {
        display: none !important;
    }

    .fs-mobile-action-bar {
        display: flex;
    }

    .fs-mobile-more-menu {
        display: block;
    }

    /* Modal body — extra bottom padding for action bar */
    .fs-docs-body {
        padding-bottom: max(70px, calc(60px + env(safe-area-inset-bottom)));
    }
}

/* === Very Small Mobile: ≤480px === */
@media (max-width: 480px) {
    .fs-docs-topbar {
        padding: 6px 10px;
    }

    .fs-topbar-titles {
        max-width: 70%;
    }

    .fs-nav-arrow {
        width: 36px;
        height: 36px;
    }

    .fs-mobile-action {
        font-size: 0.58rem;
        min-height: 50px;
        padding: 6px 2px;
    }

    .fs-mobile-action i {
        font-size: 1.1rem;
    }

    .fs-mobile-action-primary i {
        font-size: 1.2rem;
    }

    .fs-page-title-input {
        font-size: 1.05rem;
    }
}

/* === Dark Mode Adjustments for Fullscreen Notes Mobile === */
html[data-theme="dark"] .fs-mobile-action-primary {
    box-shadow: 0 2px 8px rgba(96, 165, 250, 0.3);
}

html[data-theme="dark"] .fs-mobile-more-sheet {
    background: var(--bg-elevated);
}

html[data-theme="dark"] .fs-mobile-more-item i {
    color: var(--text-secondary);
}

/* ============================================
           GANTT / SCHEDULE
           ============================================ */
.gantt-container {
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    background: var(--bg-surface);
    overflow: hidden;
}

.gantt-bar {
    height: 16px;
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
    font-size: 0.65rem;
    font-weight: 600;
    color: white;
    display: flex;
    align-items: center;
    padding-left: 6px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.gantt-bar:hover {
    transform: scaleY(1.15);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    z-index: 3;
}

/* ============================================
           CALENDAR
           ============================================ */
.cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--bg-surface);
}

.cal-grid .cal-header-cell {
    padding: 10px;
    background: var(--bg-subtle);
    color: var(--text-secondary);
    font-weight: 600;
    text-align: center;
    border-bottom: 1px solid var(--border-default);
    border-right: 1px solid var(--border-default);
    font-size: 0.8rem;
}

.cal-grid .cal-header-cell:nth-child(7) {
    border-right: none;
}

.cal-grid .cal-header-cell.weekend {
    color: var(--danger-500);
}

.cal-grid .cal-day {
    min-height: 85px;
    padding: 6px;
    border-bottom: 1px solid var(--border-subtle);
    border-right: 1px solid var(--border-subtle);
    background: var(--bg-surface);
    overflow-y: auto;
    overflow-x: hidden;
}

.cal-grid .cal-day:nth-child(7n) {
    border-right: none;
}

.cal-grid .cal-day.empty-day {
    background: var(--bg-subtle);
    opacity: 0.5;
}

.cal-grid .cal-day.today {
    background: rgba(239, 68, 68, 0.04);
    box-shadow: inset 0 0 0 2px var(--danger-500);
}

.cal-grid .cal-date-number {
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
    display: block;
    font-size: 0.8rem;
}

.cal-grid .cal-task {
    font-size: 0.7rem;
    padding: 2px 6px;
    margin-bottom: 2px;
    border-radius: var(--radius-sm);
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
    box-shadow: var(--shadow-xs);
    display: block;
}

.cal-grid .cal-task:hover {
    opacity: 0.85;
}

/* ============================================
           SEARCH HIGHLIGHT & SNIPPETS
           ============================================ */
mark.search-highlight {
    background: rgba(37, 99, 235, 0.2);
    color: inherit;
    padding: 0 2px;
    border-radius: 2px;
    font-weight: 600;
}

html[data-theme="dark"] mark.search-highlight {
    background: rgba(96, 165, 250, 0.25);
}

.search-suggestions-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    width: 100%;
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    z-index: 1005;
    max-height: 320px;
    overflow-y: auto;
    display: none;
    padding: 6px;
}

.search-suggestion-item {
    padding: 10px 12px;
    cursor: pointer;
    border-radius: var(--radius-md);
    font-size: 0.82rem;
    display: flex;
    flex-direction: column;
    gap: 4px;
    transition: background var(--transition-fast);
    margin-bottom: 2px;
}

.search-suggestion-item:hover {
    background: var(--bg-subtle);
}

.search-suggestion-header {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--primary-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.search-suggestion-text {
    color: var(--text-secondary);
    word-break: break-word;
    line-height: 1.4;
}

.search-preview-container {
    margin-top: 6px;
    font-size: 0.78rem;
    background: var(--bg-subtle);
    border-left: 3px solid var(--primary-500);
    padding: 8px 12px;
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.search-snippet {
    color: var(--text-tertiary);
    line-height: 1.4;
}

.search-snippet-label {
    font-weight: 700;
    color: var(--primary-500);
    margin-right: 4px;
}

.clickable-snippet {
    cursor: pointer;
    padding: 3px 6px;
    border-radius: var(--radius-sm);
    transition: background var(--transition-fast);
    display: block;
}

.clickable-snippet:hover {
    background: rgba(37, 99, 235, 0.08);
}

.active-search-row {
    background: rgba(37, 99, 235, 0.06) !important;
    transition: background var(--transition-base);
}

.active-highlight-field {
    border: 2px solid var(--primary-500) !important;
    background: rgba(37, 99, 235, 0.04) !important;
    border-radius: var(--radius-md);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.08) !important;
    padding: 4px;
    transition: all var(--transition-base);
}

/* ============================================
           REPORT MODAL
           ============================================ */
.report-semester {
    background: var(--bg-subtle);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    padding: 16px;
    margin-bottom: 12px;
}

.report-semester h3 {
    margin: 0 0 12px 0;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-default);
    padding-bottom: 8px;
}

.report-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
}

.report-stat-item {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.report-stat-item strong {
    color: var(--text-primary);
}

/* ============================================
           AUDIT LOG
           ============================================ */
.audit-entry {
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    padding: 14px;
    background: var(--bg-surface);
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    transition: box-shadow var(--transition-fast);
}

.audit-entry:hover {
    box-shadow: var(--shadow-sm);
}

/* ============================================
           ATTACHMENTS GALLERY
           ============================================ */
.gallery-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border-default);
    margin-bottom: 16px;
}

.gallery-tab {
    padding: 10px 18px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-tertiary);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    gap: 6px;
}

.gallery-tab:hover {
    color: var(--text-primary);
}

.gallery-tab.active {
    color: var(--primary-600);
    border-bottom-color: var(--primary-600);
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
}

.gallery-card {
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--bg-surface);
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.gallery-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* ============================================
           LINK INPUT GROUPS
           ============================================ */
.link-inputs-container {
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    padding: 12px;
    background: var(--bg-subtle);
}

.link-input-group {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
    align-items: center;
}

.link-input-group:last-child {
    margin-bottom: 0;
}

/* ============================================
           IMAGE PREVIEWS
           ============================================ */
.image-previews {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

.preview-item {
    position: relative;
}

.preview-item img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-default);
    cursor: pointer;
    transition: transform var(--transition-fast);
}

.preview-item img:hover {
    transform: scale(1.05);
}

.preview-item .remove-img-btn {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--danger-500);
    color: white;
    border: 2px solid var(--bg-surface);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    transition: all var(--transition-fast);
}

.preview-item .remove-img-btn:hover {
    background: var(--danger-600);
    transform: scale(1.1);
}

/* ============================================
           LIGHTBOX
           ============================================ */
.lightbox {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(8px);
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-base), visibility var(--transition-base);
}

.lightbox.active {
    opacity: 1;
    visibility: visible;
}

.lightbox img {
    max-width: 90%;
    max-height: 90vh;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
}

/* ============================================
           MOBILE BOTTOM NAVIGATION
           Hidden by default; shown on mobile via @media
           ============================================ */
.mobile-bottom-nav {
    display: none;
}

/* ============================================
           FLOATING ACTION BUTTONS
           ============================================ */
.fab-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 999;
}

.fab {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    transition: all var(--transition-fast);
}

.fab:hover {
    transform: scale(1.08);
    box-shadow: var(--shadow-xl);
}

.fab-primary {
    background: var(--primary-600);
    color: white;
}

.fab-primary:hover {
    background: var(--primary-700);
}

.fab-secondary {
    background: var(--bg-elevated);
    color: var(--text-secondary);
    border: 1px solid var(--border-default);
    width: 40px;
    height: 40px;
    font-size: 0.9rem;
}

.fab-secondary:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* ============================================
           FLOATING STICKY NOTE (Desktop Only)
           ============================================ */
.sticky-note-fab {
    position: fixed;
    right: 24px;
    top: 50%;
    transform: translateY(-50%);
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border: 1px solid #f59e0b;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 9998; /* Was 90 — bumped above modals so sticky note stays on top */
    /* Default glow matches default yellow theme; overridden per color-* class below */
    box-shadow:
        0 6px 16px rgba(245, 158, 11, 0.25),
        0 2px 4px rgba(0, 0, 0, 0.06);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.25s ease, opacity 0.2s ease;
    color: #92400e;
    font-size: 1.3rem;
}

.sticky-note-fab:hover {
    transform: translateY(-50%) scale(1.08);
    /* Hover glow is overridden per color-* class below */
    box-shadow:
        0 8px 24px rgba(245, 158, 11, 0.35),
        0 2px 4px rgba(0, 0, 0, 0.1);
}

.sticky-note-fab:active {
    transform: translateY(-50%) scale(0.96);
}

.sticky-note-fab .bi {
    transition: transform 0.2s ease;
}

.sticky-note-fab:hover .bi {
    transform: rotate(-12deg);
}

.sticky-note-fab.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateY(-50%) scale(0.7);
}

.sticky-note-panel {
    position: fixed;
    right: 24px;
    top: 50%;
    transform: translate(20px, -50%) scale(0.95);
    width: 320px;
    max-width: calc(100vw - 48px);
    background: #fef3c7;
    border: 1px solid #f59e0b;
    border-radius: 16px;
    box-shadow:
        0 20px 40px rgba(0, 0, 0, 0.15),
        0 4px 8px rgba(245, 158, 11, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.5);
    z-index: 9999; /* Was 95 — bumped above modals (z-index ~100-200) so sticky note stays on top */
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    transition:
        opacity 0.25s ease,
        visibility 0.25s ease,
        transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    max-height: 70vh;
    overflow: hidden;
}

.sticky-note-panel.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translate(0, -50%) scale(1);
}

/* Color theme variants */
.sticky-note-panel.color-yellow { background: #fef3c7; border-color: #f59e0b; }
.sticky-note-panel.color-blue { background: #dbeafe; border-color: #3b82f6; }
.sticky-note-panel.color-green { background: #dcfce7; border-color: #22c55e; }
.sticky-note-panel.color-pink { background: #fce7f3; border-color: #ec4899; }
.sticky-note-panel.color-purple { background: #ede9fe; border-color: #8b5cf6; }

/* === FAB color sync with selected panel color (Step 3) + glow color match (v5.9.11) === */
.sticky-note-fab.color-yellow { background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%); border-color: #f59e0b; color: #92400e; box-shadow: 0 6px 16px rgba(245, 158, 11, 0.25), 0 2px 4px rgba(0, 0, 0, 0.06); }
.sticky-note-fab.color-yellow:hover { box-shadow: 0 8px 24px rgba(245, 158, 11, 0.35), 0 2px 4px rgba(0, 0, 0, 0.1); }
.sticky-note-fab.color-blue { background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%); border-color: #3b82f6; color: #1e40af; box-shadow: 0 6px 16px rgba(59, 130, 246, 0.30), 0 2px 4px rgba(0, 0, 0, 0.06); }
.sticky-note-fab.color-blue:hover { box-shadow: 0 8px 24px rgba(59, 130, 246, 0.40), 0 2px 4px rgba(0, 0, 0, 0.1); }
.sticky-note-fab.color-green { background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%); border-color: #22c55e; color: #166534; box-shadow: 0 6px 16px rgba(34, 197, 94, 0.30), 0 2px 4px rgba(0, 0, 0, 0.06); }
.sticky-note-fab.color-green:hover { box-shadow: 0 8px 24px rgba(34, 197, 94, 0.40), 0 2px 4px rgba(0, 0, 0, 0.1); }
.sticky-note-fab.color-pink { background: linear-gradient(135deg, #fce7f3 0%, #fbcfe8 100%); border-color: #ec4899; color: #9d174d; box-shadow: 0 6px 16px rgba(236, 72, 153, 0.30), 0 2px 4px rgba(0, 0, 0, 0.06); }
.sticky-note-fab.color-pink:hover { box-shadow: 0 8px 24px rgba(236, 72, 153, 0.40), 0 2px 4px rgba(0, 0, 0, 0.1); }
.sticky-note-fab.color-purple { background: linear-gradient(135deg, #ede9fe 0%, #ddd6fe 100%); border-color: #8b5cf6; color: #5b21b6; box-shadow: 0 6px 16px rgba(139, 92, 246, 0.30), 0 2px 4px rgba(0, 0, 0, 0.06); }
.sticky-note-fab.color-purple:hover { box-shadow: 0 8px 24px rgba(139, 92, 246, 0.40), 0 2px 4px rgba(0, 0, 0, 0.1); }

/* === Sticky note: text always dark (backgrounds are always light pastel regardless of theme) === */
/* Fixes dark-mode text invisibility — the panel backgrounds (#fef3c7/#dbeafe/etc) are always light,
   so the text inside must always be dark for readability. */
.sticky-note-panel,
.sticky-note-panel .sticky-note-textarea,
.sticky-note-panel .sticky-note-meta,
.sticky-note-panel .sticky-note-hint,
.sticky-note-panel .sticky-note-icon-btn {
    color: #1e293b; /* slate-800 - strong dark for contrast on pastel */
}

.sticky-note-panel .sticky-note-textarea {
    color: #1e293b !important;
    font-weight: 600;
    -webkit-text-fill-color: #1e293b; /* override browser autofill/forced colors */
}

.sticky-note-panel .sticky-note-textarea::placeholder {
    color: #64748b !important; /* slate-500 - medium gray for placeholder */
    opacity: 0.6;
    -webkit-text-fill-color: #64748b;
}

.sticky-note-panel .sticky-note-meta,
.sticky-note-panel .sticky-note-hint {
    color: #475569 !important; /* slate-600 */
}

.sticky-note-panel .sticky-note-icon-btn {
    color: #475569 !important; /* slate-600 */
}

.sticky-note-panel .sticky-note-icon-btn:hover {
    color: #0f172a !important; /* slate-900 - darkest on hover */
    background: rgba(0, 0, 0, 0.08);
}

.sticky-note-panel .sticky-note-icon-btn-danger:hover {
    color: #b91c1c !important; /* red-700 - danger color preserved */
    background: rgba(239, 68, 68, 0.15);
}

.sticky-note-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px 8px 14px;
    background: rgba(255, 255, 255, 0.5);
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    gap: 8px;
    flex-shrink: 0;
    backdrop-filter: blur(4px);
}

.sticky-note-header-left {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    min-width: 0;
    color: #78350f;
    font-size: 0.85rem;
    font-weight: 700;
}

.sticky-note-color-blue .sticky-note-header-left { color: #1e40af; }
.sticky-note-color-green .sticky-note-header-left { color: #166534; }
.sticky-note-color-pink .sticky-note-header-left { color: #9d174d; }
.sticky-note-color-purple .sticky-note-header-left { color: #5b21b6; }

.sticky-note-header-left .bi {
    font-size: 1rem;
    flex-shrink: 0;
}

.sticky-note-title {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sticky-note-header-right {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.sticky-note-colors {
    display: flex;
    gap: 3px;
    margin-right: 4px;
}

.sticky-note-color {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
    flex-shrink: 0;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.05);
}

.sticky-note-color:hover {
    transform: scale(1.2);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.3);
}

.sticky-note-color.active {
    transform: scale(1.2);
    box-shadow: 0 0 0 2px var(--primary-500);
}

.sticky-note-icon-btn {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-md);
    background: transparent;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.sticky-note-icon-btn:hover {
    background: rgba(0, 0, 0, 0.08);
    color: var(--text-primary);
}

.sticky-note-icon-btn-danger:hover {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger-500);
}

.sticky-note-textarea {
    flex: 1;
    width: 100%;
    border: none;
    background: transparent;
    padding: 14px 16px;
    font-family: var(--font-sans);
    font-size: 0.88rem;
    line-height: 1.6;
    color: var(--text-primary);
    resize: none;
    outline: none;
    font-weight: 500;
    background-image: repeating-linear-gradient(
        to bottom,
        transparent,
        transparent 28px,
        rgba(0, 0, 0, 0.05) 28px,
        rgba(0, 0, 0, 0.05) 29px
    );
    background-attachment: local;
}

.sticky-note-textarea::placeholder {
    color: var(--text-tertiary);
    font-style: italic;
    opacity: 0.7;
}

.sticky-note-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 12px;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    background: rgba(255, 255, 255, 0.4);
    font-size: 0.65rem;
    color: var(--text-tertiary);
    flex-shrink: 0;
    gap: 8px;
}

.sticky-note-meta {
    font-weight: 600;
}

.sticky-note-hint {
    font-size: 0.6rem;
    opacity: 0.7;
}

/* [Step 5] Resize handle for sticky note */
.sticky-note-resize-handle {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 16px;
    height: 16px;
    cursor: nwse-resize;
    background: linear-gradient(135deg, transparent 50%, rgba(0, 0, 0, 0.25) 50%);
    border-bottom-right-radius: 16px;
    z-index: 2;
    touch-action: none;
}

.sticky-note-resize-handle:hover {
    background: linear-gradient(135deg, transparent 50%, rgba(0, 0, 0, 0.4) 50%);
}

@media (max-width: 600px) {
    .sticky-note-fab,
    .sticky-note-panel {
        display: none !important;
    }
}

/* ============================================
           DUE DATE NOTIFICATIONS
           ============================================ */
.due-countdown-wrapper {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 12px;
    z-index: 9999;
    display: none;
}

.due-countdown-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 4px;
    background: var(--warning-500);
    pointer-events: none;
    box-shadow: 0 -2px 8px rgba(245, 158, 11, 0.5);
}

.due-notification-toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-left: 4px solid var(--danger-500);
    box-shadow: var(--shadow-xl);
    padding: 16px;
    border-radius: var(--radius-lg);
    max-width: 360px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transform: translateY(120px);
    opacity: 0;
    transition: all var(--transition-slow);
}

.due-notification-toast.show {
    transform: translateY(0);
    opacity: 1;
}

/* ============================================
   CKEDITOR 5 OVERRIDES
   ============================================ */
:root {
    --ck-border-radius: var(--radius-md);
    --ck-font-size-base: 0.88rem;
    --ck-font-family: var(--font-sans);
}

.ck.ck-editor__main>.ck-editor__editable {
    min-height: 120px;
    background: transparent;
    border: none !important;
}

.ck.ck-editor__editable:not(.ck-editor__nested-editable).ck-focused {
    outline: none !important;
    box-shadow: none !important;
}

.ck.ck-toolbar {
    border: none !important;
    border-bottom: 1px solid var(--border-default) !important;
    background: var(--bg-subtle) !important;
    border-radius: var(--radius-md) var(--radius-md) 0 0 !important;
    padding: 8px 12px !important;
}

html[data-theme="dark"] {
    --ck-color-base-background: var(--bg-default);
    --ck-color-base-text: var(--text-primary);
    --ck-color-toolbar-background: var(--gray-800);
    --ck-color-toolbar-border: var(--border-default);
    --ck-color-button-default-hover-background: var(--gray-700);
    --ck-color-button-default-active-background: var(--gray-700);
    --ck-color-text: var(--text-primary);
    --ck-color-list-background: var(--bg-elevated);
    --ck-color-list-button-hover-background: var(--bg-subtle);
    --ck-color-panel-background: var(--bg-elevated);
    --ck-color-panel-border: var(--border-default);
}

/* ============================================
           DETAIL LINK GROUPS
           ============================================ */
.detail-link-group {
    display: flex;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 12px;
    background: var(--bg-subtle);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    margin-bottom: 8px;
    transition: border-color var(--transition-fast);
    position: relative;
}

.detail-link-group:hover {
    border-color: var(--border-strong);
}

.detail-link-group .detail-link-completed {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary-600);
    margin-top: 4px;
    flex-shrink: 0;
}

.detail-link-display {
    color: var(--primary-600);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.85rem;
    word-break: break-all;
}

.detail-link-display:hover {
    text-decoration: underline;
}

/* === Link Group: Edit/View Containers — proper layout === */
.link-view-container,
.link-edit-container {
    flex: 1 1 200px;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* Inner rows inside link-edit-container */
.link-edit-container > div {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.link-edit-container input[type="text"] {
    flex: 1 1 100px;
    min-width: 0;
    font-size: 0.8rem;
    padding: 6px 8px;
}

.link-edit-container .detail-link-start,
.link-edit-container .detail-link-end {
    flex: 1 1 120px;
    min-width: 110px;
    font-size: 0.78rem;
    padding: 5px 6px;
}

.link-edit-container label {
    font-size: 0.72rem;
    color: var(--text-tertiary);
    white-space: nowrap;
    flex-shrink: 0;
}

.link-edit-container .save-link-mode-btn {
    flex-shrink: 0;
}

/* Action buttons (Edit/Catatan/Delete) — wrap cleanly */
.link-view-container > div {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

/* Remove (trash) button — always visible, top right */
.detail-link-group .remove-link-btn {
    flex-shrink: 0;
    margin-left: auto;
    align-self: flex-start;
}

/* === Mobile: stack link group vertically === */
@media (max-width: 480px) {
    .detail-link-group {
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
    }

    .detail-link-group .detail-link-completed {
        position: absolute;
        top: 10px;
        right: 10px;
        margin-top: 0;
    }

    .detail-link-group .remove-link-btn {
        position: absolute;
        top: 10px;
        right: 38px;
        margin-left: 0;
    }

    .link-view-container,
    .link-edit-container {
        flex: 1 1 100%;
        width: 100%;
        padding-right: 60px; /* space for checkbox + trash */
    }

    .link-edit-container > div {
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
    }

    .link-edit-container input[type="text"],
    .link-edit-container .detail-link-start,
    .link-edit-container .detail-link-end {
        flex: 1 1 100%;
        width: 100%;
        font-size: 0.9rem;
    }

    .link-edit-container > div:last-child {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .link-edit-container > div:last-child input[type="date"] {
        flex: 1 1 calc(50% - 30px);
    }
}

/* ============================================
           RECOMMENDED DOWNLOAD BUTTON
           ============================================ */
.recommend-badge {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: #fff;
    font-size: 0.6rem;
    font-weight: 800;
    padding: 2px 10px;
    border-radius: var(--radius-full);
    white-space: nowrap;
    box-shadow: var(--shadow-sm);
    z-index: 10;
    letter-spacing: 0.5px;
}

.recommend-download-btn {
    width: 100%;
    padding: 14px;
    font-size: 1rem;
    font-weight: 700;
    border: none;
    border-radius: var(--radius-lg);
    cursor: pointer;
    color: #fff !important;
    background: linear-gradient(135deg, #fbbf24, #f59e0b) !important;
    box-shadow: 0 4px 16px rgba(245, 158, 11, 0.35);
    animation: golden-pulse 3s infinite ease-in-out;
    transition: transform var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    position: relative;
}

.recommend-download-btn:hover {
    transform: scale(1.02);
}

@keyframes golden-pulse {

    0%,
    100% {
        box-shadow: 0 4px 16px rgba(245, 158, 11, 0.3);
    }

    50% {
        box-shadow: 0 6px 24px rgba(245, 158, 11, 0.5);
    }
}

/* ============================================
           SCROLLABLE TEXT
           ============================================ */
.scrollable-text {
    min-height: 80px;
    max-height: 400px;
    overflow-y: auto;
    resize: vertical;
    padding: 12px;
    background: var(--bg-subtle);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-default);
    color: var(--text-primary);
    font-size: 0.85rem;
    line-height: 1.6;
}

.scrollable-text:not(.ck-editor__editable) {
    white-space: pre-wrap;
}

#notes-container,
#detail-ai-assessment-container {
    resize: vertical;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 150px;
    max-height: 500px;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    background: var(--bg-surface);
}

#notes-container .ck-editor__editable,
#detail-ai-assessment-container .ck-editor__editable {
    flex-grow: 1;
    overflow-y: auto;
    min-height: 0;
}

/* ============================================
           SCHEDULE TASK CARD
           ============================================ */
.schedule-task-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    background: var(--bg-surface);
    transition: all var(--transition-fast);
}

.schedule-task-card:hover {
    border-color: var(--primary-300);
    box-shadow: var(--shadow-sm);
}

.task-status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.task-status-dot.dot-done {
    background: var(--success-500);
}

.task-status-dot.dot-in-progress {
    background: var(--warning-500);
}

.task-status-dot.dot-not-started {
    background: var(--gray-300);
}

.task-status-dot.dot-overdue {
    background: var(--danger-500);
}

/* ============================================
           SCHEDULE FORM OVERLAY
           ============================================ */
.schedule-form-overlay {
    background: var(--bg-subtle);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    padding: 18px;
    margin-bottom: 16px;
    animation: formSlideIn 0.2s ease-out;
}

@keyframes formSlideIn {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
           PDF EXPORT
           ============================================ */
.pdf-export-container table,
.pdf-export-container tr,
.pdf-export-container td,
.pdf-export-container th,
.pdf-export-container img,
.pdf-export-container pre,
.pdf-export-container blockquote {
    page-break-inside: avoid !important;
    break-inside: avoid !important;
}

/* ============================================
           GANTT TOOLTIP
           ============================================ */
.gantt-tooltip {
    position: fixed;
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    padding: 12px 16px;
    font-size: 0.82rem;
    box-shadow: var(--shadow-xl);
    z-index: 9999;
    pointer-events: none;
    max-width: 280px;
    opacity: 0;
    transition: opacity var(--transition-fast);
    color: var(--text-primary);
    line-height: 1.5;
}

.gantt-tooltip.visible {
    opacity: 1;
}

.gantt-tooltip .tt-title {
    font-weight: 700;
    margin-bottom: 6px;
    color: var(--text-primary);
}

.gantt-tooltip .tt-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 3px;
    color: var(--text-tertiary);
}

.gantt-tooltip .tt-row span:last-child {
    font-weight: 600;
    color: var(--text-primary);
}

/* ============================================
           UTILITY CLASSES
           ============================================ */
.hidden {
    display: none !important;
}

.flex {
    display: flex;
}

.items-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.gap-2 {
    gap: 8px;
}

.gap-3 {
    gap: 12px;
}

.gap-4 {
    gap: 16px;
}

.mt-2 {
    margin-top: 8px;
}

.mt-3 {
    margin-top: 12px;
}

.mt-4 {
    margin-top: 16px;
}

.mb-2 {
    margin-bottom: 8px;
}

.mb-3 {
    margin-bottom: 12px;
}

.mb-4 {
    margin-bottom: 16px;
}

.text-sm {
    font-size: 0.82rem;
}

.text-xs {
    font-size: 0.72rem;
}

.font-medium {
    font-weight: 500;
}

.font-semibold {
    font-weight: 600;
}

.font-bold {
    font-weight: 700;
}

.text-primary {
    color: var(--text-primary);
}

.text-secondary {
    color: var(--text-secondary);
}

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

.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.w-full {
    width: 100%;
}

/* ============================================
           RESPONSIVE — Smartphone-first Compat
           ============================================ */

/* Sidebar backdrop (mobile only) */
.sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    opacity: 0;
    visibility: hidden;
    z-index: 89;
    transition: opacity var(--transition-base), visibility var(--transition-base);
    touch-action: none;
}

.sidebar-backdrop.show {
    opacity: 1;
    visibility: visible;
}

/* Hide card view by default (desktop) */
.data-cards-view {
    display: none;
}

/* === Tablet: ≤1024px (sidebar becomes drawer) === */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
        width: var(--sidebar-width);
        box-shadow: var(--shadow-xl);
    }

    .sidebar.mobile-open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
        max-width: 100%;
    }

    .sidebar.collapsed~.main-content {
        margin-left: 0;
        max-width: 100%;
    }

    .modal-panel.slide-over {
        width: 100%;
        max-width: 100%;
        border-radius: 0;
    }

    /* Gantt panels: allow horizontal scroll instead of resize */
    .gantt-labels-panel {
        resize: none !important;
        width: 200px !important;
        max-width: 40vw !important;
    }
}

/* === Mobile: ≤768px (smartphone) === */
@media (max-width: 768px) {
    /* --- Topbar --- */
    .topbar {
        padding: 0 12px;
        padding-left: max(12px, env(safe-area-inset-left));
        padding-right: max(12px, env(safe-area-inset-right));
    }

    .topbar-brand {
        gap: 8px;
        flex: 1;
        min-width: 0;
    }

    .topbar-brand .brand-title-input {
        display: none;
    }

    .topbar-brand .course-title-input {
        min-width: 100px;
        font-size: 0.85rem;
        flex: 1;
        width: auto;
    }

    .sidebar-toggle {
        width: 36px;
        height: 36px;
        font-size: 0.95rem;
        /* Min 44px touch target via padding */
    }

    .topbar-actions {
        gap: 4px;
    }

    /* --- Main content padding --- */
    .main-content {
        padding: 14px 14px;
        padding-left: max(14px, env(safe-area-inset-left));
        padding-right: max(14px, env(safe-area-inset-right));
    }

    /* --- Page header --- */
    .page-header {
        margin-bottom: 16px;
    }

    .page-header h1 {
        font-size: 1.2rem;
    }

    .page-header p {
        font-size: 0.8rem;
    }

    /* --- KPI grid: 2 columns --- */
    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
        margin-bottom: 16px;
    }

    .kpi-card {
        padding: 12px 14px;
    }

    .kpi-card .kpi-value {
        font-size: 1.35rem;
    }

    .kpi-card .kpi-label {
        font-size: 0.72rem;
    }

    .kpi-card .kpi-icon {
        width: 30px;
        height: 30px;
        font-size: 0.9rem;
    }

    /* --- Accordion --- */
    .accordion summary {
        padding: 12px 16px;
        font-size: 0.85rem;
    }

    .accordion-content {
        padding: 14px;
    }

    /* --- Form --- */
    .form-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .form-input,
    .form-select,
    .form-textarea {
        font-size: 0.95rem;
        /* Prevents iOS zoom on focus */
        padding: 10px 12px;
    }

    .form-label {
        font-size: 0.75rem;
    }

    .btn {
        padding: 9px 14px;
        font-size: 0.8rem;
        min-height: 40px;
        /* Touch target */
    }

    .btn-sm {
        min-height: 36px;
    }

    .btn-icon-sm {
        width: 36px;
        height: 36px;
        min-height: 36px;
    }

    /* --- Toolbar: improved mobile layout --- */
    .toolbar {
        padding: 12px;
        gap: 10px;
        flex-direction: column;
        align-items: stretch;
    }

    .search-box {
        max-width: 100%;
        width: 100%;
    }

    .search-box input {
        padding: 12px 38px 12px 38px;
        font-size: 0.95rem;
        min-height: 44px;
    }

    .toolbar-divider {
        display: none;
    }

    .toolbar-group {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
        width: 100%;
    }

    .toolbar-group:has(.form-select:only-child) {
        grid-template-columns: 1fr;
    }

    .toolbar-group .form-select {
        width: 100%;
        min-width: 0;
        font-size: 0.88rem;
        padding: 12px 32px 12px 14px;
        min-height: 44px;
    }

    .toolbar-group .btn {
        width: 100%;
        min-height: 44px;
        padding: 10px 12px;
        font-size: 0.82rem;
        font-weight: 600;
        justify-content: center;
        gap: 6px;
    }

    .toolbar-group .btn i {
        font-size: 1rem;
    }

    /* Hide the secondary 3-icon button group on mobile (moved to bottom nav) */
    .toolbar-group.secondary-actions {
        display: none;
    }

    /* --- Data Table → Card View (smartphone) --- */
    .data-table-wrapper {
        display: none;
    }

    .data-cards-view {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }

    /* --- Gantt: mobile-friendly scroll & interaction --- */
    .gantt-container {
        -webkit-overflow-scrolling: touch;
    }

    .gantt-2panel {
        -webkit-overflow-scrolling: touch;
    }

    .gantt-labels-panel {
        /* Make sure touch scrolling works on labels panel */
        -webkit-overflow-scrolling: touch;
        touch-action: pan-y;
        position: relative;
    }

    .gantt-labels-body {
        -webkit-overflow-scrolling: touch;
        touch-action: pan-y;
    }

    .gantt-timeline-panel {
        -webkit-overflow-scrolling: touch;
        touch-action: pan-x pan-y;
    }

    /* Bigger Gantt bars on mobile for easier touch */
    .gantt-bar {
        height: 22px !important;
        min-height: 22px;
        /* Better touch target */
    }

    .gantt-bar .resize-handle {
        width: 16px !important;
        /* Bigger resize handles for fingers */
    }

    /* Gantt label rows bigger on mobile */
    .gantt-label-row {
        min-height: 32px !important;
        padding-top: 4px !important;
        padding-bottom: 4px !important;
    }

    /* Scroll hint overlay on first render */
    .gantt-scroll-hint {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        background: rgba(15, 23, 42, 0.85);
        backdrop-filter: blur(4px);
        color: white;
        padding: 10px 18px;
        border-radius: var(--radius-full);
        font-size: 0.8rem;
        font-weight: 600;
        z-index: 10;
        pointer-events: none;
        opacity: 0;
        transition: opacity 0.3s ease;
        white-space: nowrap;
    }

    .gantt-scroll-hint.show {
        opacity: 1;
        animation: hintFade 3s forwards;
    }

    @keyframes hintFade {
        0% { opacity: 0; transform: translate(-50%, -50%) scale(0.9); }
        15% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
        85% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
        100% { opacity: 0; transform: translate(-50%, -50%) scale(0.95); }
    }

    /* Tap feedback for Gantt bars on mobile */
    .gantt-bar.tap-feedback {
        transform: scaleY(1.4);
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    }

    /* --- Gantt Edit Sheet mobile optimizations --- */
    #gantt-edit-sheet .modal-panel {
        max-height: 92vh;
    }

    #gantt-edit-sheet .modal-body {
        padding: 14px 14px 10px;
    }

    #gantt-edit-sheet .modal-footer {
        padding: 10px 14px;
        gap: 8px;
    }

    #gantt-edit-sheet .modal-footer > div {
        width: 100%;
    }

    #gantt-edit-sheet .form-grid {
        gap: 8px;
    }

    #gantt-edit-sheet .form-group {
        margin-bottom: 0;
    }

    #gantt-edit-sheet .form-input[type="date"] {
        font-size: 1rem;
        min-height: 44px;
        padding: 10px 12px;
    }

    /* Quick adjust buttons on mobile — bigger touch targets */
    #gantt-edit-sheet [data-quick] {
        min-height: 44px;
        font-size: 0.85rem;
        font-weight: 600;
    }

    #gantt-edit-sheet .modal-footer {
        flex-direction: column;
        gap: 8px;
    }

    #gantt-edit-sheet .modal-footer > div {
        width: 100%;
    }

    #gantt-edit-sheet .modal-footer > div:last-child {
        display: flex;
        gap: 8px;
    }

    #gantt-edit-sheet .modal-footer button {
        flex: 1;
        min-height: 44px;
    }

    /* --- Gantt Sheet sub-components (dark-mode friendly) --- */
    .gantt-sheet-titlebar {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 8px 12px;
        background: var(--bg-subtle);
        border-radius: var(--radius-md);
        margin-bottom: 10px;
        border-left: 4px solid var(--primary-500);
    }

    .gantt-sheet-title-text {
        font-weight: 700;
        font-size: 0.95rem;
        color: var(--text-primary);
        flex: 1;
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .gantt-jadwal-badge {
        font-size: 0.68rem;
        padding: 3px 8px;
        background: var(--primary-100);
        color: var(--primary-700);
        border-radius: var(--radius-full);
        font-weight: 600;
        white-space: nowrap;
        flex-shrink: 0;
        display: inline-flex;
        align-items: center;
        gap: 4px;
    }

    .gantt-quick-adjust-box {
        margin-top: 10px;
        padding: 10px 12px;
        background: var(--bg-subtle);
        border-radius: var(--radius-md);
        border: 1px solid var(--border-subtle);
    }

    .gantt-quick-adjust-header {
        font-size: 0.78rem;
        font-weight: 600;
        color: var(--text-primary);
        margin-bottom: 8px;
        display: flex;
        align-items: center;
        gap: 6px;
    }

    .gantt-quick-adjust-grid {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 6px;
    }

    .gantt-tip-box {
        margin-top: 10px;
        padding: 10px 12px;
        background: var(--info-50);
        color: var(--text-primary);
        border-left: 3px solid var(--info-500);
        border-radius: var(--radius-md);
        display: flex;
        gap: 10px;
        align-items: flex-start;
    }

    .gantt-tip-icon {
        color: var(--info-500);
        font-size: 1.05rem;
        flex-shrink: 0;
        margin-top: 1px;
    }

    .gantt-tip-text {
        font-size: 0.78rem;
        color: var(--text-primary);
        line-height: 1.5;
    }

    .gantt-tip-text strong {
        color: var(--text-primary);
    }

    /* Footer row: 2 columns side-by-side like date pickers */
    .gantt-footer-row {
        display: flex;
        gap: 8px;
        width: 100%;
    }

    .gantt-footer-row > button {
        flex: 1;
        min-width: 0;
        min-height: 44px;
        white-space: nowrap;
        padding-left: 8px;
        padding-right: 8px;
    }

    .data-card {
        background: var(--bg-surface);
        border: 1px solid var(--border-default);
        border-radius: var(--radius-lg);
        padding: 14px;
        box-shadow: var(--shadow-xs);
        display: flex;
        flex-direction: column;
        gap: 10px;
        transition: box-shadow var(--transition-fast), transform var(--transition-fast);
    }

    .data-card:active {
        transform: scale(0.99);
    }

    .data-card-header {
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        gap: 10px;
    }

    .data-card-title {
        font-weight: 700;
        font-size: 0.95rem;
        color: var(--text-primary);
        line-height: 1.3;
        flex: 1;
        word-break: break-word;
    }

    .data-card-code {
        font-family: var(--font-mono);
        font-size: 0.7rem;
        color: var(--text-tertiary);
        background: var(--bg-subtle);
        padding: 2px 8px;
        border-radius: var(--radius-sm);
        white-space: nowrap;
    }

    .data-card-meta {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        font-size: 0.75rem;
        color: var(--text-tertiary);
    }

    .data-card-meta-item {
        display: inline-flex;
        align-items: center;
        gap: 4px;
    }

    .data-card-progress {
        display: flex;
        align-items: center;
        gap: 8px;
    }

    .data-card-progress .progress-track {
        flex: 1;
    }

    .data-card-actions {
        display: flex;
        gap: 6px;
        padding-top: 8px;
        border-top: 1px solid var(--border-subtle);
    }

    .data-card-actions .btn {
        flex: 1;
    }

    /* --- Schedule / Gantt: stack labels and timeline --- */
    .gantt-2panel {
        flex-direction: column;
        max-height: none;
    }

    .gantt-labels-panel {
        width: 100% !important;
        max-width: 100% !important;
        max-height: 280px !important;
        border-right: none !important;
        border-bottom: 1px solid var(--border-default);
        position: relative;
    }

    /* Scroll fade indicator on labels panel (shows there's more content below) */
    .gantt-labels-panel::after {
        content: "";
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        height: 24px;
        background: linear-gradient(to top, var(--bg-surface), transparent);
        pointer-events: none;
        border-bottom-left-radius: var(--radius-md);
        border-bottom-right-radius: var(--radius-md);
    }

    .gantt-timeline-panel {
        max-height: 380px !important;
    }

    .gantt-wrapper {
        min-width: 100% !important;
    }

    .gantt-header {
        font-size: 0.65rem !important;
        height: 38px !important;
    }

    #gantt-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    #gantt-toolbar>div {
        flex-wrap: wrap;
    }

    #gantt-toolbar select,
    #gantt-toolbar .btn {
        flex: 1;
    }

    /* Expand Gantt button — toggle full height on mobile */
    #gantt-expand-btn {
        display: inline-flex;
    }

    .gantt-2panel.gantt-expanded {
        max-height: none !important;
    }

    .gantt-2panel.gantt-expanded .gantt-labels-panel,
    .gantt-2panel.gantt-expanded .gantt-timeline-panel {
        max-height: none !important;
    }

    .gantt-2panel.gantt-expanded .gantt-timeline-panel {
        max-height: 70vh !important;
    }

    /* --- Calendar --- */
    .cal-grid .cal-day {
        min-height: 56px;
        padding: 3px;
    }

    .cal-grid .cal-header-cell {
        padding: 6px 4px;
        font-size: 0.7rem;
    }

    .cal-grid .cal-task {
        font-size: 0.62rem;
        padding: 1px 4px;
    }

    #cal-month-year {
        font-size: 0.95rem;
    }

    #cal-prev-btn,
    #cal-next-btn {
        font-size: 0.72rem;
        padding: 6px 10px;
    }

    /* --- Modals: full screen sheet --- */
    .modal-overlay {
        align-items: flex-end;
    }

    .modal-panel {
        width: 100%;
        max-width: 100%;
        max-height: 95vh;
        border-radius: var(--radius-xl) var(--radius-xl) 0 0;
        transform: translateY(100%);
    }

    .modal-overlay.active .modal-panel {
        transform: translateY(0);
    }

    .modal-panel.slide-over {
        border-radius: 0;
    }

    .modal-header {
        padding: 14px 16px;
    }

    .modal-body {
        padding: 14px 16px;
    }

    .modal-footer {
        padding: 12px 16px;
        flex-wrap: wrap;
        gap: 8px;
    }

    .modal-footer>div {
        flex: 1 1 100%;
    }

    /* --- Fullscreen editor --- */
    .fs-content {
        border-radius: 0;
        width: 100%;
        height: 100%;
        max-width: 100%;
    }

    .fs-docs-topbar {
        padding: 8px 12px;
        gap: 6px;
    }

    .fs-page-title-bar {
        padding: 12px 18px 8px 18px;
    }

    .fs-page-title-input {
        font-size: 1.15rem;
    }

    .fs-note-editor-container .ck-editor__editable {
        padding: 14px 18px 60px 18px !important;
        font-size: 0.95rem !important;
    }

    /* --- Floating Action Buttons --- */
    .fab-container {
        bottom: 16px;
        right: 16px;
        gap: 8px;
    }

    .fab {
        width: 44px;
        height: 44px;
    }

    .fab-secondary {
        width: 38px;
        height: 38px;
    }

    /* --- Personal Space --- */
    .ps-container {
        padding: 0 10px;
    }

    .threads-banner {
        height: 140px;
        border-radius: 8px;
    }

    .threads-avatar {
        width: 68px;
        height: 68px;
        font-size: 1.6rem;
    }

    .threads-avatar-wrap {
        margin-top: -40px;
    }

    .threads-profile-name {
        font-size: 1.35rem;
    }

    .threads-thread-gallery-img {
        width: 200px !important;
        height: 140px !important;
    }

    /* --- Search suggestions full-width on mobile --- */
    .search-suggestions-dropdown {
        left: -8px;
        right: -8px;
        width: auto;
    }

    /* --- Gallery grid --- */
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
        gap: 8px;
    }

    /* --- Lightbox padding --- */
    .lightbox img {
        max-width: 95%;
        max-height: 85vh;
    }

    /* --- Notification toast --- */
    .due-notification-toast {
        left: 12px;
        right: 12px;
        bottom: 12px;
        max-width: none;
    }

    /* --- Drag handle hidden on touch --- */
    .drag-handle {
        font-size: 1.1rem;
        padding: 8px;
    }

    /* --- Schedule form overlay --- */
    .schedule-form-overlay {
        padding: 14px;
    }

    /* --- Document list --- */
    .doc-item {
        padding: 10px 12px;
        flex-wrap: wrap;
        gap: 6px;
    }

    .doc-item a {
        font-size: 0.8rem;
    }

    /* --- Audit entry --- */
    .audit-entry {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    /* === Mobile Bottom Navigation Bar === */
    .mobile-bottom-nav {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        display: flex;
        align-items: stretch;
        justify-content: space-around;
        background: var(--bg-surface);
        border-top: 1px solid var(--border-default);
        box-shadow: 0 -4px 16px rgba(15, 23, 42, 0.08);
        z-index: 95;
        padding: 8px 4px;
        padding-bottom: max(8px, env(safe-area-inset-bottom));
        gap: 2px;
    }

    .mobile-nav-item {
        flex: 1;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 3px;
        padding: 6px 4px !important;
        border-radius: var(--radius-md) !important;
        background: transparent !important;
        background-color: transparent !important;
        border: 0 !important;
        outline: 0 !important;
        box-shadow: none !important;
        -webkit-appearance: none !important;
        -moz-appearance: none !important;
        appearance: none !important;
        color: var(--text-tertiary);
        font-family: var(--font-sans) !important;
        font-size: 0.65rem;
        font-weight: 600;
        line-height: 1.2;
        cursor: pointer;
        transition: color var(--transition-fast), background var(--transition-fast), transform var(--transition-fast);
        min-height: 56px;
        min-width: 0;
        -webkit-tap-highlight-color: transparent;
        text-decoration: none !important;
    }

    .mobile-nav-item i {
        font-size: 1.25rem;
        line-height: 1;
        display: block;
    }

    .mobile-nav-item span {
        display: block;
        font-size: 0.65rem;
        font-weight: 600;
        line-height: 1.2;
    }

    .mobile-nav-item:hover {
        background: transparent !important;
    }

    .mobile-nav-item:focus,
    .mobile-nav-item:focus-visible,
    .mobile-nav-item:active {
        background: var(--bg-subtle) !important;
        outline: 0 !important;
        box-shadow: none !important;
        transform: scale(0.96);
    }

    .mobile-nav-item.active {
        color: var(--primary-600);
        background: var(--primary-50) !important;
        font-weight: 700;
    }

    .mobile-nav-item.active i {
        color: var(--primary-600);
    }

    html[data-theme="dark"] .mobile-nav-item.active {
        color: var(--primary-400);
        background: rgba(59, 130, 246, 0.12) !important;
    }

    html[data-theme="dark"] .mobile-nav-item.active i {
        color: var(--primary-400);
    }

    /* FAB hidden on mobile — help is accessible via sidebar menu */
    .fab-container {
        display: none;
    }

    /* Add bottom padding to main content so content isn't hidden behind nav */
    .main-content {
        padding-bottom: 88px;
    }
}

/* === Small Mobile: ≤480px (iPhone SE etc.) === */
@media (max-width: 480px) {
    .kpi-grid {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .kpi-card {
        padding: 10px 12px;
    }

    .kpi-card .kpi-value {
        font-size: 1.2rem;
    }

    .btn {
        padding: 10px 14px;
        font-size: 0.8rem;
        min-height: 44px;
    }

    .topbar {
        padding: 0 10px;
    }

    .topbar-brand .course-title-input {
        min-width: 80px;
        font-size: 0.8rem;
    }

    .main-content {
        padding: 12px 10px;
        padding-bottom: 86px;
    }

    .data-card {
        padding: 12px;
    }

    .data-card-title {
        font-size: 0.9rem;
    }

    .accordion summary {
        padding: 10px 14px;
        font-size: 0.82rem;
    }

    .accordion-content {
        padding: 12px;
    }

    /* Stack schedule toolbar buttons */
    #schedule-view-selector,
    #gantt-edit-toggle-btn,
    #gantt-scroll-today-btn {
        flex: 1;
        font-size: 0.78rem;
    }

    .mobile-nav-item {
        font-size: 0.6rem !important;
        min-height: 52px;
        padding: 4px 2px !important;
    }

    .mobile-nav-item i {
        font-size: 1.15rem !important;
    }

    .mobile-nav-item span {
        font-size: 0.6rem !important;
    }
}

/* === Landscape orientation on phones === */
@media (max-width: 900px) and (orientation: landscape) {
    .threads-banner {
        height: 110px;
    }

    .kpi-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* === iOS safe area & notched phones === */
@supports (padding: max(0px)) {
    .topbar {
        padding-top: max(0px, env(safe-area-inset-top));
        height: calc(var(--topbar-height) + env(safe-area-inset-top));
    }

    .sidebar {
        top: calc(var(--topbar-height) + env(safe-area-inset-top));
        height: calc(100vh - var(--topbar-height) - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    }

    .main-content {
        margin-top: calc(var(--topbar-height) + env(safe-area-inset-top));
        min-height: calc(100vh - var(--topbar-height) - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    }

    .fab-container {
        bottom: max(16px, env(safe-area-inset-bottom));
        right: max(16px, env(safe-area-inset-right));
    }

    .modal-panel {
        padding-bottom: env(safe-area-inset-bottom);
    }
}

/* === Touch device improvements === */
@media (hover: none) and (pointer: coarse) {
    /* Larger touch targets */
    .nav-item {
        padding: 12px 10px;
    }

    .form-input,
    .form-select,
    .form-textarea {
        font-size: 16px;
        /* Prevents iOS auto-zoom on focus */
        padding: 11px 12px;
    }

    /* Disable hover states that stick on touch */
    .btn:hover,
    .nav-item:hover,
    .data-table tbody tr:hover,
    .kpi-card:hover {
        background: inherit;
        transform: none;
    }

    /* Active state feedback */
    .btn:active,
    .nav-item:active {
        transform: scale(0.98);
        opacity: 0.85;
    }

    /* Better scrolling */
    .sidebar-nav,
    .main-content,
    .modal-body,
    .cal-day {
        -webkit-overflow-scrolling: touch;
    }

    /* Hide scrollbar visuals on touch */
    ::-webkit-scrollbar {
        width: 0;
        height: 0;
    }
}

/* === High DPI / small fonts override === */
@media (max-width: 360px) {
    html {
        font-size: 13px;
    }

    .topbar-brand .course-title-input {
        display: none;
    }
}

/* Gantt Enhancements Restored from v3 */
.gantt-day-col {
    flex-shrink: 0;
    text-align: center;
    padding: 4px 0;
    font-size: 0.72rem;
    line-height: 1.3;
    border-right: 1px solid var(--border-subtle);
}

.gantt-day-col[data-today="true"] {
    background-color: rgba(239, 68, 68, 0.05);
    color: var(--danger-600);
    font-weight: bold;
    border-left: 1px solid rgba(239, 68, 68, 0.2);
    border-right: 1px solid rgba(239, 68, 68, 0.2);
}

.gantt-day-col.weekend {
    background-color: var(--bg-subtle);
    color: var(--text-tertiary);
}

.gantt-progress {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.25);
    border-radius: inherit;
    pointer-events: none;
}

.gantt-warning-pulse {
    position: absolute;
    right: -6px;
    top: 50%;
    transform: translateY(-50%);
    color: #fff;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--danger-500);
    border-radius: 50%;
    width: 14px;
    height: 14px;
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.9);
    animation: warningPulse 1s infinite ease-out;
    z-index: 2;
}

.gantt-warning-pulse.today {
    background: var(--warning-500);
    box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.9);
    animation: warningPulseToday 1s infinite ease-out;
}

@keyframes warningPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.9);
        transform: translateY(-50%) scale(1);
    }

    50% {
        box-shadow: 0 0 0 8px rgba(239, 68, 68, 0.3);
        transform: translateY(-50%) scale(1.3);
    }

    100% {
        box-shadow: 0 0 0 12px rgba(239, 68, 68, 0);
        transform: translateY(-50%) scale(1);
    }
}

@keyframes warningPulseToday {
    0% {
        box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.9);
        transform: translateY(-50%) scale(1);
    }

    50% {
        box-shadow: 0 0 0 8px rgba(245, 158, 11, 0.3);
        transform: translateY(-50%) scale(1.3);
    }

    100% {
        box-shadow: 0 0 0 12px rgba(245, 158, 11, 0);
        transform: translateY(-50%) scale(1);
    }
}

.gantt-label {
    width: 100%;
    overflow: hidden;
    white-space: nowrap;
    padding-right: 6px;
    display: flex;
    align-items: center;
}

.gantt-label-text {
    display: inline-block;
    white-space: nowrap;
    transition: transform 0.3s ease-out;
}

@keyframes customBarGlow {
    0% {
        box-shadow: 0 0 5px var(--glow-color);
    }

    50% {
        box-shadow: 0 0 15px 4px var(--glow-color);
    }

    100% {
        box-shadow: 0 0 5px var(--glow-color);
    }
}

.gantt-bar-glow {
    animation: customBarGlow 1.5s infinite ease-in-out !important;
    z-index: 10 !important;
}

@keyframes glowingRed {
    0% {
        box-shadow: 0 0 5px rgba(220, 53, 69, 0.5);
    }

    50% {
        box-shadow: 0 0 20px rgba(220, 53, 69, 1);
    }

    100% {
        box-shadow: 0 0 5px rgba(220, 53, 69, 0.5);
    }
}

.btn-glowing-red {
    background-color: var(--danger-500) !important;
    color: white !important;
    border-color: var(--danger-600) !important;
    animation: glowingRed 1s infinite alternate;
}

@keyframes glowingYellow {
    0% {
        box-shadow: 0 0 5px #eab308;
    }

    100% {
        box-shadow: 0 0 20px #eab308, 0 0 10px #eab308;
    }
}

.btn-glowing-yellow {
    background-color: #eab308 !important;
    color: white !important;
    border-color: #ca8a04 !important;
    animation: glowingYellow 1s infinite alternate;
}

@keyframes sizeWarningPulse {
    0% {
        opacity: 1;
        text-shadow: 0 0 5px rgba(220, 53, 69, 0.5);
    }

    50% {
        opacity: 0.7;
        text-shadow: 0 0 15px rgba(220, 53, 69, 1);
    }

    100% {
        opacity: 1;
        text-shadow: 0 0 5px rgba(220, 53, 69, 0.5);
    }
}

.size-warning-glow {
    animation: sizeWarningPulse 1.2s infinite alternate;
    font-weight: bold;
    color: var(--danger-500) !important;
}

/* ============================================
   PERSONAL SPACE — META THREADS DESIGN
   ============================================ */

/* --- Profile Header --- */
/* ============================================
           PERSONAL SPACE
           ============================================ */
#personal-space-content {
    overflow-y: auto;
    overflow-x: hidden;
}

#personal-space-content::-webkit-scrollbar {
    width: 8px;
}

#personal-space-content::-webkit-scrollbar-thumb {
    background-color: var(--border-strong);
    border-radius: 4px;
}

#personal-space-content::-webkit-scrollbar-track {
    background: var(--bg-subtle);
}

.ps-container {
    max-width: 620px;
    margin: 0 auto;
    padding: 0 16px;
}

.threads-profile {
    padding: 0 0 16px;
}

/* --- Profile Banner --- */
.threads-banner {
    position: relative;
    width: 100%;
    height: 180px;
    border-radius: 12px;
    overflow: hidden;
    background: var(--bg-subtle);
    margin-bottom: 0;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.threads-banner .ep-banner-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-quaternary);
    gap: 8px;
}

.threads-banner .ep-banner-placeholder i {
    font-size: 2rem;
}

.threads-banner .ep-banner-placeholder span {
    font-size: 0.85rem;
}

.threads-banner-edit-btn {
    position: absolute;
    bottom: 10px;
    right: 10px;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(4px);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: background 0.2s;
}

.threads-banner-edit-btn:hover {
    background: rgba(0, 0, 0, 0.75);
}

.threads-profile-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
    padding: 0 8px;
}

/* Overlap avatar on banner */
.threads-avatar-wrap {
    flex-shrink: 0;
    margin-top: -50px;
    position: relative;
    z-index: 2;
}

.threads-avatar {
    width: 84px;
    height: 84px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-500), var(--primary-700));
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2rem;
    font-weight: 700;
    background-size: cover;
    background-position: center;
    border: 4px solid var(--bg-primary);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.threads-profile-info {
    flex: 1;
    padding-right: 16px;
    padding-top: 8px;
}

.threads-profile-name {
    font-size: 1.7rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 4px;
    line-height: 1.2;
}

.threads-profile-handle {
    font-size: 0.95rem;
    color: var(--text-secondary);
    font-weight: 400;
}

.threads-bio {
    margin: 16px 0 0;
    padding: 0;
    font-size: 0.95rem;
    color: var(--text-primary);
    line-height: 1.5;
    outline: none;
    min-height: 20px;
}

.threads-bio:empty::before {
    content: attr(data-placeholder);
    color: var(--text-quaternary);
    pointer-events: none;
}

.threads-followers {
    margin-top: 12px;
    color: var(--text-tertiary);
    font-size: 0.95rem;
}

.threads-edit-profile-btn {
    width: 100%;
    padding: 8px 16px;
    border: 1px solid var(--border-default);
    border-radius: 8px;
    background: transparent;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    margin-top: 24px;
    margin-bottom: 16px;
}

.threads-edit-profile-btn:hover {
    background: var(--bg-subtle);
}

/* --- Edit Profile Modal --- */
.ep-banner-preview {
    position: relative;
    width: 100%;
    height: 140px;
    border-radius: 12px;
    overflow: visible;
    background: var(--bg-subtle);
    margin-bottom: 20px;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    border: 2px dashed var(--border-default);
    cursor: pointer;
    transition: border-color 0.2s;
}

.ep-banner-preview:hover {
    border-color: var(--primary-400);
}

.ep-banner-preview.has-image {
    border: none;
    overflow: hidden;
}

.ep-banner-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-quaternary);
    gap: 8px;
    pointer-events: none;
}

.ep-banner-placeholder i {
    font-size: 2rem;
}

.ep-banner-placeholder span {
    font-size: 0.85rem;
}

/* Banner hover overlay (camera icon) */
.ep-banner-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
    color: white;
    font-size: 1.5rem;
    pointer-events: none;
    border-radius: 12px;
}

.ep-banner-preview.has-image:hover .ep-banner-overlay {
    opacity: 1;
}

/* Remove button (x) for banner and avatar */
.ep-remove-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    opacity: 0;
    transition: opacity 0.2s, background 0.2s;
    z-index: 5;
}

.ep-remove-btn:hover {
    background: rgba(220, 53, 69, 0.85);
}

.ep-banner-preview.has-image .ep-remove-btn {
    opacity: 1;
}

.ep-avatar-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 24px;
    padding: 16px 0;
    border-bottom: 1px solid var(--border-default);
}

.ep-avatar-wrap {
    position: relative;
    display: inline-block;
}

.ep-avatar-preview {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-500), var(--primary-700));
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2rem;
    font-weight: 700;
    background-size: cover;
    background-position: center;
    border: 3px solid var(--border-default);
    cursor: pointer;
    transition: border-color 0.2s;
}

.ep-avatar-preview:hover {
    border-color: var(--primary-400);
}

/* Avatar hover overlay */
.ep-avatar-overlay {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    pointer-events: none;
}

.ep-avatar-preview[style*="url"] ~ .ep-avatar-overlay,
.ep-avatar-wrap.has-avatar .ep-avatar-overlay {
    pointer-events: auto;
}

.ep-avatar-wrap:hover .ep-avatar-overlay {
    opacity: 1;
}

/* Avatar remove button */
.ep-avatar-remove {
    top: -4px;
    right: -4px;
    width: 24px;
    height: 24px;
    font-size: 0.7rem;
}

.ep-avatar-wrap.has-avatar .ep-avatar-remove {
    opacity: 1;
}

.ep-handle-input-wrap {
    display: flex;
    align-items: center;
    gap: 0;
}

.ep-handle-prefix {
    display: flex;
    align-items: center;
    padding: 0 12px;
    background: var(--bg-subtle);
    border: 1px solid var(--border-default);
    border-right: none;
    border-radius: var(--radius-md) 0 0 var(--radius-md);
    color: var(--text-tertiary);
    font-size: 0.9rem;
    height: 40px;
}

.ep-handle-input {
    border-radius: 0 var(--radius-md) var(--radius-md) 0 !important;
}

.form-hint {
    display: block;
    margin-top: 4px;
    font-size: 0.75rem;
    color: var(--text-quaternary);
}

.ep-bio-counter {
    text-align: right;
    font-size: 0.72rem;
    color: var(--text-quaternary);
    margin-top: 4px;
}

.ep-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border-default);
}

.threads-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-default);
    margin-top: 16px;
}

.threads-tab {
    flex: 1;
    text-align: center;
    padding: 12px 0;
    color: var(--text-tertiary);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
}

.threads-tab.active {
    color: var(--text-primary);
    border-bottom: 2px solid var(--text-primary);
}

/* --- Feed Divider --- */
.threads-feed-divider {
    height: 1px;
    background: var(--border-default);
    margin: 8px 0;
}

/* --- Search Bar --- */
.ps-search-bar {
    position: relative;
    display: flex;
    align-items: center;
    margin-top: 16px;
    margin-bottom: 12px;
    padding: 0 0 0 12px;
    height: 40px;
    background: var(--bg-subtle);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.ps-search-bar:focus-within {
    border-color: var(--primary-400);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.ps-search-bar .bi-search {
    color: var(--text-quaternary);
    font-size: 1rem;
    flex-shrink: 0;
}

.ps-search-bar input {
    flex: 1;
    border: none;
    background: transparent;
    outline: none;
    font-size: 0.9rem;
    color: var(--text-primary);
    padding: 8px;
    font-family: inherit;
}

.ps-search-bar input::placeholder {
    color: var(--text-quaternary);
}

.ps-search-clear {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    color: var(--text-tertiary);
    cursor: pointer;
    border-radius: 50%;
    margin-right: 6px;
    font-size: 0.85rem;
    transition: background 0.15s;
    flex-shrink: 0;
}

.ps-search-clear:hover {
    background: var(--bg-overlay);
}

/* --- Feed Container --- */
.threads-feed {
    padding-bottom: 40px;
}

/* --- Composer --- */
.threads-composer-container {
    padding: 16px 0;
    border-bottom: 1px solid var(--border-default);
}

.threads-composer {
    display: flex;
    gap: 12px;
}

.threads-composer-left {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 36px;
    flex-shrink: 0;
}

.threads-composer-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-500), var(--primary-700));
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1rem;
    font-weight: 700;
    background-size: cover;
    background-position: center;
}

.threads-composer-line {
    width: 2px;
    flex: 1;
    background: var(--border-default);
    margin-top: 8px;
    border-radius: 1px;
    min-height: 24px;
}

.threads-composer-right {
    flex: 1;
    min-width: 0;
}

.threads-composer-header {
    display: flex;
    align-items: center;
    margin-bottom: 4px;
}

.threads-composer-username {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-primary);
}

/* Editor wrapper inside composer */
.threads-editor-wrapper {
    display: flex;
    flex-direction: column;
    transition: max-height var(--transition-base), min-height var(--transition-base);
    max-height: 300px;
    min-height: 40px;
    overflow: hidden;
}

.threads-editor-wrapper.compact {
    max-height: 50px;
    min-height: 20px;
}

.threads-editor-wrapper.compact .ck.ck-editor__main>.ck-editor__editable {
    min-height: 10px !important;
    max-height: 30px !important;
}

.threads-editor {
    min-height: 24px;
    font-size: 0.95rem;
    color: var(--text-primary);
}

.threads-editor .ck.ck-editor__main>.ck-editor__editable {
    font-family: var(--font-sans);
    font-size: 1.1rem;
    border: none !important;
    padding: 0;
    min-height: 40px;
    color: var(--text-primary);
}

.threads-editor .ck.ck-editor__editable.ck-placeholder::before {
    color: var(--text-tertiary);
    font-style: normal;
    left: 0;
    font-size: 0.95rem;
}

.ps-quill-toolbar-hidden {
    display: none;
}

.ps-quill-toolbar-visible {
    display: flex;
    flex-wrap: wrap;
    border: none !important;
    background: transparent;
    padding: 4px 0;
    margin-bottom: 4px;
    border-bottom: 1px solid var(--border-default) !important;
}

/* Staged attachments */
.threads-staged {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.ps-staged-item {
    position: relative;
    border: 1px solid var(--border-default);
    border-radius: 12px;
    overflow: hidden;
    background: var(--bg-body);
}

.ps-staged-image {
    max-width: 90px;
    max-height: 90px;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
}

.ps-staged-file {
    padding: 8px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    width: 140px;
}

.ps-staged-file-icon {
    font-size: 1.3rem;
    color: var(--primary-500);
}

.ps-staged-file-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.ps-staged-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    background: rgba(0, 0, 0, 0.55);
    color: white;
    border: none;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    font-size: 0.7rem;
}

.ps-staged-remove:hover {
    background: var(--danger-500);
}

/* Composer action icons */
.threads-composer-actions {
    display: flex;
    gap: 12px;
    margin-top: 10px;
}

.threads-action-icon {
    background: none;
    border: none;
    color: var(--text-tertiary);
    font-size: 1.15rem;
    cursor: pointer;
    padding: 4px;
    transition: color 0.15s;
}

.threads-action-icon:hover {
    color: var(--text-primary);
}

.threads-composer-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0 0 48px;
    /* Offset to align with right column */
}

.threads-post-hint {
    font-size: 0.85rem;
    color: var(--text-tertiary);
}

.threads-post-btn {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border-default);
    border-radius: 20px;
    padding: 6px 16px;
    font-weight: 600;
    font-size: 1.05rem;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.threads-post-btn:hover {
    background: var(--bg-subtle);
}

.threads-post-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* --- Feed / Thread Post --- */
.threads-post {
    display: flex;
    gap: 12px;
    padding: 16px 4px;
    border-bottom: 1px solid var(--border-default);
}

.threads-post-left {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 40px;
    flex-shrink: 0;
}

.threads-post-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-500), var(--primary-700));
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1rem;
    font-weight: 700;
    background-size: cover;
    background-position: center;
}

.threads-post-line {
    width: 2px;
    flex: 1;
    background: var(--border-default);
    margin: 8px 0;
    border-radius: 1px;
    min-height: 0;
}

.threads-post-right {
    flex: 1;
    min-width: 0;
}

.threads-post-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 2px;
}

.threads-post-username {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-primary);
}

.threads-post-time {
    font-size: 0.82rem;
    color: var(--text-tertiary);
}

.threads-post-more {
    margin-left: auto;
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    font-size: 1rem;
    padding: 4px;
    border-radius: 50%;
    transition: background 0.15s;
}

.threads-post-more:hover {
    background: var(--bg-subtle);
}

.threads-post-body {
    font-size: 0.95rem;
    line-height: 1.55;
    color: var(--text-primary);
}

.threads-post-body .ck-content {
    padding: 0;
    min-height: 0;
}

/* Post Gallery */
.threads-post-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 8px;
    margin-top: 10px;
}

.threads-post-gallery-img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 12px;
    border: 1px solid var(--border-default);
    cursor: pointer;
    transition: opacity 0.15s;
}

.threads-post-gallery-img:hover {
    opacity: 0.85;
}

/* Post file attachments */
.threads-post-files {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 10px;
}

.threads-post-file {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--border-default);
    border-radius: 12px;
    background: var(--bg-subtle);
}

.threads-post-file-icon {
    font-size: 1.4rem;
    color: var(--text-tertiary);
}

.threads-post-file-info {
    flex: 1;
    overflow: hidden;
}

.threads-post-file-name {
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.threads-post-file-meta {
    font-size: 0.78rem;
    color: var(--text-tertiary);
}

.threads-post-file-dl {
    background: none;
    border: 1px solid var(--border-default);
    border-radius: 8px;
    padding: 5px 10px;
    cursor: pointer;
    color: var(--text-primary);
    font-size: 0.82rem;
    font-weight: 500;
    transition: background 0.15s;
}

.threads-post-file-dl:hover {
    background: var(--bg-subtle);
}

/* Post actions row */
.threads-post-actions {
    display: flex;
    gap: 18px;
    margin-top: 10px;
}

.threads-post-action {
    background: none;
    border: none;
    color: var(--text-tertiary);
    font-size: 1.15rem;
    cursor: pointer;
    padding: 6px;
    border-radius: 50%;
    transition: color 0.15s, background 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.threads-post-action:hover {
    color: var(--text-primary);
    background: var(--bg-subtle);
}

.threads-post-action.danger:hover {
    color: var(--danger-500);
}

/* Nav disabled */
.nav-item:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: transparent !important;
    color: var(--text-tertiary) !important;
}

/* Animated Yellow Gradient Outline Button */
.btn-outline-gradient-yellow {
    position: relative;
    background: transparent !important;
    color: var(--warning-600) !important;
    border: 2px solid transparent !important;
    border-radius: var(--radius-md);
    z-index: 1;
}

.btn-outline-gradient-yellow::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -2;
    border-radius: inherit;
    background: linear-gradient(90deg, #fbbf24, #d97706, #fbbf24);
    background-size: 200% 100%;
    animation: btnGradientAnim 3s linear infinite;
}

.btn-outline-gradient-yellow::after {
    content: "";
    position: absolute;
    inset: 2px;
    z-index: -1;
    border-radius: calc(var(--radius-md) - 2px);
    background: var(--bg-surface);
    transition: background 0.2s;
}

@keyframes btnGradientAnim {
    0% {
        background-position: 0% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

.btn-outline-gradient-yellow:hover::after {
    background: var(--bg-subtle);
}

html[data-theme="dark"] .btn-outline-gradient-yellow {
    color: var(--warning-500) !important;
}

html[data-theme="dark"] .btn-outline-gradient-yellow::before {
    background: linear-gradient(90deg, #f59e0b, #fcd34d, #f59e0b);
    background-size: 200% 100%;
}

html[data-theme="dark"] .btn-outline-gradient-yellow:hover::after {
    background: var(--bg-subtle);
}

/* ============================================
       PERSONAL SPACE — THREADS FEED FIX
       ============================================ */
.ps-thread {
    display: flex;
    gap: 12px;
    padding: 16px 0;
    border-bottom: 1px solid var(--border-default);
}

.ps-thread-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-500), var(--primary-700));
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1rem;
    font-weight: 700;
    flex-shrink: 0;
    background-size: cover;
    background-position: center;
}

.ps-thread-content {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.ps-thread-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 4px;
}

.ps-thread-name {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-primary);
    margin-right: 4px;
}

.ps-thread-handle {
    font-size: 0.85rem;
    color: var(--text-tertiary);
}

.ps-thread-time {
    font-size: 0.82rem;
    color: var(--text-tertiary);
}

.ps-thread-text {
    font-size: 0.95rem;
    line-height: 1.55;
    color: var(--text-primary);
    margin-bottom: 8px;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.ps-thread-text a.ps-link,
.threads-bio a.ps-link {
    color: var(--primary-500);
    text-decoration: none;
    word-break: break-all;
}

.ps-thread-text a.ps-link:hover,
.threads-bio a.ps-link:hover {
    text-decoration: underline;
}

.ps-thread-text img {
    max-width: 100% !important;
    height: auto !important;
    border-radius: 12px;
    border: 1px solid var(--border-default);
    margin-top: 8px;
    display: block !important;
    box-sizing: border-box;
}

/* Gallery Wrapper with Navigation Buttons */
.ps-thread-gallery-wrapper {
    position: relative;
    margin-top: 10px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 0;
}

.ps-thread-gallery {
    display: flex;
    flex-direction: row;
    gap: 8px;
    overflow-x: auto;
    scroll-snap-type: x proximity;
    padding: 8px 0;
    cursor: grab;
    -webkit-user-select: none;
    user-select: none;
    flex: 1;
    scroll-behavior: smooth;
}

.ps-thread-gallery:active {
    cursor: grabbing;
}

.ps-thread-gallery::-webkit-scrollbar {
    height: 0;
    display: none;
}

.ps-thread-gallery::-webkit-scrollbar-thumb {
    background: transparent;
}

.ps-thread-gallery::-webkit-scrollbar-track {
    background: transparent;
}

/* Minimalist Navigation Buttons */
.ps-gallery-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-fast);
    font-size: 0.85rem;
    box-shadow: var(--shadow-sm);
    padding: 0;
}

.ps-thread-gallery-wrapper:hover .ps-gallery-nav-btn {
    opacity: 1;
    visibility: visible;
}

.ps-gallery-nav-btn:hover {
    background: rgba(15, 23, 42, 0.85);
    transform: translateY(-50%) scale(1.1);
}

.ps-gallery-nav-btn:active {
    transform: translateY(-50%) scale(0.95);
}

.ps-gallery-nav-prev {
    left: 4px;
}

.ps-gallery-nav-next {
    right: 4px;
}

.ps-thread-gallery-img {
    flex: 0 0 auto;
    scroll-snap-align: start;
    width: 280px !important;
    height: 200px !important;
    border-radius: 12px;
    border: 1px solid var(--border-default);
    cursor: zoom-in;
    object-fit: cover;
    display: block !important;
    box-sizing: border-box;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
    pointer-events: auto;
}

.ps-thread-gallery-img:hover {
    transform: scale(1.02);
    box-shadow: var(--shadow-md);
}

.ps-thread-actions {
    display: flex;
    gap: 4px;
    margin-top: 10px;
    align-items: center;
}

.ps-thread-action-btn {
    background: none;
    border: none;
    color: var(--text-tertiary);
    font-size: 1.05rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 6px 8px;
    border-radius: var(--radius-md);
    transition: background 0.15s, color 0.15s;
    position: relative;
}

.ps-thread-action-btn:hover {
    background: var(--bg-subtle);
    color: var(--text-primary);
}

.ps-thread-action-btn.ps-action-reply:hover {
    color: var(--primary-500);
}

.ps-thread-action-btn.ps-action-edit:hover {
    color: var(--primary-500);
}

.ps-thread-action-btn.ps-action-delete:hover {
    color: var(--danger-500);
}

.ps-thread-action-label {
    font-size: 0.78rem;
    font-weight: 500;
}

/* Reply count badge */
.ps-thread-reply-count {
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--text-tertiary);
    margin-left: 8px;
    padding: 2px 0;
}

.ps-thread-reply-count:hover {
    color: var(--text-primary);
}

/* Replies container */
.ps-thread-replies {
    margin-top: 8px;
    padding-left: 48px;
    border-left: 2px solid var(--border-default);
    margin-left: 18px;
}

.ps-thread-replies .ps-thread {
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-default);
}

.ps-thread-replies .ps-thread:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

/* Inline reply composer */
.ps-inline-reply-composer {
    margin-top: 10px;
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.ps-inline-reply-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-500), var(--primary-700));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    flex-shrink: 0;
}

.ps-inline-reply-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ps-inline-reply-input {
    width: 100%;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    padding: 10px 12px;
    font-size: 0.88rem;
    color: var(--text-primary);
    background: var(--bg-subtle);
    outline: none;
    font-family: inherit;
    resize: vertical;
    min-height: 60px;
    transition: border-color 0.2s;
}

.ps-inline-reply-input:focus {
    border-color: var(--primary-400);
}

.ps-inline-reply-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

/* Edited indicator */
.ps-thread-edited {
    font-size: 0.75rem;
    color: var(--text-quaternary);
    font-style: italic;
    margin-left: 4px;
}

.ps-thread-files {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 10px;
}

.ps-thread-file-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--border-default);
    border-radius: 12px;
    background: var(--bg-subtle);
}

.ps-thread-file-icon {
    font-size: 1.4rem;
    color: var(--text-tertiary);
}

.ps-thread-file-info {
    flex: 1;
    overflow: hidden;
}

.ps-thread-file-name {
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ps-thread-file-meta {
    font-size: 0.78rem;
    color: var(--text-tertiary);
}

.ps-thread-file-download {
    background: none;
    border: 1px solid var(--border-default);
    border-radius: 8px;
    padding: 6px 12px;
    cursor: pointer;
    color: var(--text-primary);
    font-size: 0.85rem;
    font-weight: 500;
    transition: background 0.15s;
}

.ps-thread-file-download:hover {
    background: var(--bg-hover);
}

/* Material Links - Panel & Badges */

/* Badge container in editor area (shown after selection) */
.ps-thread-material-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 0 4px 0;
}

.ps-editor-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px 5px 12px;
    border-radius: 16px;
    font-size: 0.72rem;
    font-weight: 600;
    color: white;
    max-width: 250px;
    overflow: hidden;
    min-width: 0;
}

.ps-editor-badge i {
    font-size: 0.65rem;
    flex-shrink: 0;
    width: 12px;
}

.ps-editor-badge .badge-text {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ps-editor-badge .badge-remove {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    min-width: 16px;
    border-radius: 50%;
    background: rgba(255,255,255,0.25);
    border: none;
    color: white;
    font-size: 0.6rem;
    cursor: pointer;
    flex-shrink: 0;
    margin-left: 4px;
    transition: background 0.15s;
}

.ps-editor-badge .badge-remove:hover {
    background: rgba(255,255,255,0.45);
}

/* Selection Panel */
.ps-material-links-panel {
    border-top: 1px solid var(--border-subtle);
    padding: 12px 0 0 0;
    max-height: 300px;
    overflow-y: auto;
    transition: max-height var(--transition-base);
}

.ps-material-links-panel.expanded {
    max-height: 450px;
}

.ps-material-links-panel.hidden {
    display: none !important;
}

.ps-material-links-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* Close/Done Button */
.ps-material-close-btn {
    padding: 4px 12px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-default);
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

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

/* Selected Chips Row */
.ps-selected-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
}

@keyframes chipIn {
    from { opacity: 0; transform: scale(0.8); }
    to { opacity: 1; transform: scale(1); }
}

.ps-selected-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px 6px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    color: white;
    max-width: 260px;
    overflow: hidden;
    min-width: 0;
    animation: chipIn 0.2s ease;
}

.ps-selected-chip .chip-text {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ps-selected-chip .ps-chip-remove {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    min-width: 16px;
    border-radius: 50%;
    background: rgba(255,255,255,0.25);
    border: none;
    color: white;
    font-size: 0.65rem;
    cursor: pointer;
    flex-shrink: 0;
    margin-left: 4px;
    transition: background 0.15s;
}

.ps-selected-chip .ps-chip-remove:hover {
    background: rgba(255,255,255,0.45);
}

/* Search Box */
.ps-material-search-box {
    position: relative;
    display: flex;
    align-items: center;
    margin-bottom: 8px;
}

.ps-material-search-box .bi-search {
    position: absolute;
    left: 10px;
    color: var(--text-quaternary);
    font-size: 0.85rem;
    pointer-events: none;
}

.ps-material-search-box input {
    width: 100%;
    padding: 7px 30px 7px 30px;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    background: var(--bg-subtle);
    color: var(--text-primary);
    font-size: 0.8rem;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.ps-material-search-box input:focus {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 0 0 0 2px var(--primary-100);
}

.ps-material-search-box input::placeholder {
    color: var(--text-quaternary);
}

.ps-search-clear {
    position: absolute;
    right: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--text-quaternary);
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.15s;
}

.ps-search-clear:hover {
    background: var(--bg-active);
    color: var(--text-primary);
}

/* Material Chips Container */
.ps-material-chips-container {
    max-height: 180px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
    transition: max-height var(--transition-base);
}

.ps-material-links-panel.expanded .ps-material-chips-container {
    max-height: 300px;
}

.ps-material-chips-container::-webkit-scrollbar {
    width: 4px;
}

.ps-material-chips-container::-webkit-scrollbar-thumb {
    background: var(--border-default);
    border-radius: 2px;
}

/* Material Chip Item */
.ps-material-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 0.8rem;
    color: var(--text-secondary);
    border-left: 3px solid transparent;
}

.ps-material-chip:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.ps-material-chip.selected {
    background: var(--primary-50);
    color: var(--primary-600);
    border-left-color: var(--primary-500);
    font-weight: 600;
}

html[data-theme="dark"] .ps-material-chip.selected {
    background: rgba(37, 99, 235, 0.15);
    color: var(--primary-400);
    border-left-color: var(--primary-400);
}

.ps-chip-color-dot {
    width: 8px;
    height: 8px;
    min-width: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.ps-chip-text {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ps-chip-type {
    font-size: 0.68rem;
    color: var(--text-quaternary);
    flex-shrink: 0;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-left: 4px;
}

.ps-chip-check {
    color: var(--primary-500);
    font-size: 0.85rem;
    flex-shrink: 0;
    width: 16px;
    min-width: 16px;
    display: none;
    margin-left: 4px;
}

.ps-material-chip.selected .ps-chip-check {
    display: block;
}

.ps-chip-indent {
    padding-left: 28px;
}

.ps-chip-empty {
    text-align: center;
    padding: 16px;
    color: var(--text-quaternary);
    font-size: 0.8rem;
}

/* Close Button */
.ps-material-close-btn {
    margin-top: 10px;
    padding: 6px 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-default);
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.78rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

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

/* Material Links Badges in Thread Post */
.ps-thread-material-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
    margin-bottom: 8px;
}

.ps-material-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 600;
    color: white;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    overflow: hidden;
    position: relative;
    max-width: 250px;
}

.ps-material-badge i {
    font-size: 0.72rem;
    flex-shrink: 0;
}

.ps-material-badge .badge-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
}

.ps-material-badge:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px) scale(1.02);
    z-index: 10;
}

/* Composer Bottom - simplified */
.threads-composer-bottom {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: 10px 0 0 0;
    border-top: 1px solid var(--border-subtle);
    margin-top: 8px;
}

.ps-posting-btn {
    background-color: var(--warning-500) !important;
    color: var(--gray-900) !important;
    border-color: var(--warning-500) !important;
    opacity: 0.9 !important;
}

@keyframes spin-hourglass {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(180deg);
    }
}

.ps-posting-btn .bi-hourglass-split {
    display: inline-block;
    animation: spin-hourglass 1.5s ease-in-out infinite;
}

/* =========================================
       Personal Space - Compose Trigger & Modal
       ========================================= */
.ps-composer-trigger {
    display: flex;
    align-items: center;
    padding: 16px 24px;
    background: transparent;
    border-bottom: 1px solid var(--border-default);
    cursor: text;
    transition: background 0.2s;
    gap: 16px;
}

.ps-composer-trigger:hover {
    background: var(--bg-hover);
}

.ps-trigger-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--primary-500);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.ps-trigger-text {
    flex: 1;
    color: var(--text-tertiary);
    font-size: 1rem;
}

.ps-trigger-btn {
    opacity: 0.9;
    cursor: pointer;
    transition: opacity var(--transition-fast), transform var(--transition-fast);
}

.ps-trigger-btn:hover {
    opacity: 1;
    transform: scale(1.03);
}

/* Compose Modal Layout */
.compose-modal-panel {
    max-width: 600px;
    width: 95vw;
    max-height: 85vh;
    padding: 0;
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.compose-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-default);
    flex-shrink: 0;
}

.compose-modal-cancel {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 400;
    cursor: pointer;
    padding: 0;
    width: 50px;
    text-align: left;
}

.compose-modal-title {
    font-weight: 600;
    font-size: 1.05rem;
    color: var(--text-primary);
    text-align: center;
    flex: 1;
}

.modal-composer-container {
    padding: 16px 24px;
    border: none;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

/* Composer bottom - sticky at bottom of modal */
.threads-composer-bottom {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: 10px 0 0 0;
    border-top: 1px solid var(--border-subtle);
    margin-top: 8px;
    flex-shrink: 0;
    background: var(--bg-surface);
    z-index: 10;
}

/* ============================================
   NOTE EDITOR HEIGHT & RESIZING OVERRIDES
   ============================================ */
.note-card .ck-editor__editable {
    min-height: 250px !important;
    resize: vertical !important;
    overflow-y: auto !important;
}

#fullscreen-notes-list .ck-editor__editable {
    min-height: 300px !important;
    resize: vertical !important;
    overflow-y: auto !important;
}

.link-notes-container .ck-editor__editable {
    min-height: 150px !important;
    resize: vertical !important;
    overflow-y: auto !important;
}

/* ============================================
   MODERN APP TOAST
   ============================================ */
.app-toast-modern {
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    padding: 16px;
    box-shadow: var(--shadow-xl);
    width: 340px;
    transform: translateX(-150%);
    transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.5s ease;
    pointer-events: auto;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 8px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

html[data-theme="dark"] .app-toast-modern {
    background: rgba(30, 41, 59, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.app-toast-modern::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--primary-500);
    border-radius: 4px 0 0 4px;
}

.app-toast-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.app-toast-title {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.app-toast-icon-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    background: var(--primary-50);
    color: var(--primary-600);
}

html[data-theme="dark"] .app-toast-icon-wrap {
    background: rgba(59, 130, 246, 0.15);
    color: var(--primary-400);
}

.app-toast-close {
    font-size: 1.1rem;
    color: var(--text-tertiary);
    cursor: pointer;
    background: none;
    border: none;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition-fast), color var(--transition-fast);
}

.app-toast-close:hover {
    background: var(--bg-subtle);
    color: var(--text-primary);
}

.app-toast-body {
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.5;
    white-space: pre-wrap;
    padding-left: 38px;
}

.app-toast-body a {
    color: var(--primary-600);
    text-decoration: none;
    font-weight: 600;
    transition: opacity var(--transition-fast);
}

.app-toast-body a:hover {
    text-decoration: underline;
    opacity: 0.8;
}

html[data-theme="dark"] .app-toast-body a {
    color: var(--primary-400);
}

/* ============================================
   SECURITY & MASTER PASSWORD SYSTEM STYLES
   ============================================ */

#master-unlock-overlay.active {
    display: flex !important;
    opacity: 1 !important;
    visibility: visible !important;
}

#master-unlock-overlay .modal-panel {
    background: var(--bg-surface) !important;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25) !important;
    border: 1px solid var(--border-default) !important;
}

html[data-theme="dark"] #master-unlock-overlay {
    background: rgba(15, 23, 42, 0.75) !important;
}

html[data-theme="dark"] #master-unlock-overlay .modal-panel {
    background: #1e293b !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
}

#unlock-password-toggle {
    transition: color var(--transition-fast);
}

#unlock-password-toggle:hover {
    color: var(--text-primary) !important;
}

.status-badge.done {
    background: var(--status-done-bg) !important;
    color: var(--status-done-text) !important;
}

.status-badge.not-started {
    background: var(--status-not-started-bg) !important;
    color: var(--status-not-started-text) !important;
}

/* App Locked State styling to completely dim/blur and block all interactions */
body.app-locked {
    overflow: hidden !important;
}

body.app-locked .app-shell {
    pointer-events: none !important;
    user-select: none !important;
    filter: blur(12px) brightness(0.35) grayscale(0.2) !important;
    transition: filter 0.4s cubic-bezier(0.4, 0, 0.2, 1), transform 0.4s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

/* Sembunyikan FAB & Tombol ganti tema saat terkunci */
body.app-locked .fab-container,
body.app-locked #theme-toggle-btn {
    display: none !important;
}

/* Glassmorphism gelap aman untuk overlay kunci */
#master-unlock-overlay {
    background: rgba(8, 8, 12, 0.9) !important;
    backdrop-filter: blur(28px) saturate(180%) !important;
    -webkit-backdrop-filter: blur(28px) saturate(180%) !important;
    transition: opacity 0.3s ease, visibility 0.3s ease !important;
}

html[data-theme="dark"] #master-unlock-overlay {
    background: rgba(5, 5, 8, 0.95) !important;
}

/* ============================================ */
/* Auto-Lock Countdown Warning (WhatsApp-style) */
/* ============================================ */
@keyframes slideInRight {
    from {
        transform: translateX(120%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

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

@keyframes countdownPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

#auto-lock-warning {
    user-select: none;
    -webkit-user-select: none;
    max-width: 320px;
}

#auto-lock-warning:hover {
    transform: scale(1.03);
    transition: transform 0.2s ease;
}

#auto-lock-warning #auto-lock-countdown {
    display: inline-block;
    min-width: 28px;
    padding: 2px 8px;
    background: rgba(255, 255, 255, 0.25);
    border-radius: 6px;
    font-weight: 800;
    animation: countdownPulse 1s ease-in-out infinite;
}

#auto-lock-warning i.bi-hourglass-split {
    display: inline-block;
}

/* Pulse animation for the lock icon when warning is shown */
#auto-lock-warning.urgent {
    background: linear-gradient(135deg, #ef4444, #dc2626) !important;
    animation: slideInRight 0.3s ease-out, urgentPulse 0.8s ease-in-out infinite 0.3s;
}

@keyframes urgentPulse {
    0%, 100% { box-shadow: 0 10px 30px rgba(239, 68, 68, 0.4); }
    50% { box-shadow: 0 10px 40px rgba(239, 68, 68, 0.8), 0 0 0 4px rgba(239, 68, 68, 0.2); }
}

/* =============================================================================
 *  Cloud Sync Modal (Google Drive) — gdsync.js
 *  All styles use the app's design system tokens (no hardcoded colors).
 *  Scoped with #gdsync-modal to avoid conflicts.
 *  ============================================================================= */
#gdsync-modal .gdsync-modal-content {
    max-width: 640px;
    width: 92%;
    height: auto;
    max-height: 90vh;
    background: var(--bg-surface, #ffffff);
    border-radius: var(--radius-xl, 16px);
    box-shadow: var(--shadow-xl, 0 20px 25px -5px rgba(15,23,42,0.1));
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-default, #e2e8f0);
}
#gdsync-modal .fs-topbar {
    background: linear-gradient(135deg, var(--primary-600, #2563eb) 0%, var(--primary-700, #1d4ed8) 100%);
    color: var(--text-on-primary, #ffffff);
    padding: 14px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-default, #e2e8f0);
}
#gdsync-modal .fs-topbar h3 { color: var(--text-on-primary, #ffffff) !important; font-weight: 700; }
#gdsync-modal .fs-topbar h3 i { margin-right: 6px; opacity: 0.95; }
#gdsync-modal .fs-topbar .modal-close { color: var(--text-on-primary, #ffffff); opacity: 0.9; }
#gdsync-modal .fs-topbar .modal-close:hover { opacity: 1; }
#gdsync-modal .fs-body { background: var(--bg-surface, #ffffff); color: var(--text-primary, #0f172a); }

/* --- Wizard (first-time setup, only shown if no Client ID) --- */
#gdsync-modal .gdsync-wizard { text-align: center; padding: 8px 0; }
#gdsync-modal .gdsync-wizard-icon { font-size: 3rem; color: var(--primary-500, #3b82f6); margin-bottom: 6px; }
#gdsync-modal .gdsync-wizard h3 { font-size: 1.3rem; margin: 0 0 6px; color: var(--text-primary, #0f172a); }
#gdsync-modal .gdsync-wizard p { color: var(--text-secondary, #475569); margin: 0 0 14px; font-size: 0.9rem; line-height: 1.5; }
#gdsync-modal .gdsync-wizard code { background: var(--bg-subtle, #f1f5f9); padding: 1px 6px; border-radius: var(--radius-sm, 6px); font-size: 0.85em; color: var(--primary-700, #1d4ed8); }

/* --- Form rows --- */
#gdsync-modal .gdsync-form-row { text-align: left; margin-bottom: 14px; }
#gdsync-modal .gdsync-form-row > label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 0.88rem; color: var(--text-primary, #0f172a); }
#gdsync-modal .gdsync-input {
    width: 100%; padding: 10px 12px;
    border: 1px solid var(--border-default, #e2e8f0);
    border-radius: var(--radius-md, 8px);
    font-size: 0.88rem; font-family: var(--font-mono, 'SF Mono', Menlo, Consolas, monospace);
    background: var(--bg-surface, #fff);
    color: var(--text-primary, #0f172a);
    box-sizing: border-box; transition: border-color var(--transition-fast, 0.15s), box-shadow var(--transition-fast, 0.15s);
}
#gdsync-modal .gdsync-input:focus { outline: none; border-color: var(--primary-500, #3b82f6); box-shadow: 0 0 0 3px rgba(59,130,246,0.15); }
#gdsync-modal .gdsync-hint { font-size: 0.78rem; color: var(--text-tertiary, #64748b); margin-top: 4px; line-height: 1.4; }
#gdsync-modal .gdsync-hint code { background: var(--bg-subtle, #f1f5f9); padding: 1px 5px; border-radius: 3px; font-size: 0.92em; }
#gdsync-modal .gdsync-checkbox-label { display: flex !important; align-items: center; gap: 8px; cursor: pointer; font-weight: 500 !important; }
#gdsync-modal .gdsync-checkbox-label input { width: 18px; height: 18px; cursor: pointer; accent-color: var(--primary-600, #2563eb); }
#gdsync-modal .gdsync-monospace {
    font-family: var(--font-mono, 'SF Mono', Menlo, Consolas, monospace);
    font-size: 0.78rem;
    background: var(--bg-subtle, #f1f5f9); padding: 8px 10px;
    border-radius: var(--radius-md, 8px);
    word-break: break-all; color: var(--text-secondary, #475569);
    border: 1px solid var(--border-subtle, #f1f5f9);
}

/* --- Status messages --- */
#gdsync-modal .gdsync-status { margin: 12px 0; min-height: 22px; font-size: 0.88rem; }
#gdsync-modal .gdsync-success { color: var(--success-600, #16a34a); font-weight: 500; }
#gdsync-modal .gdsync-error { color: var(--danger-600, #dc2626); font-weight: 500; }
#gdsync-modal .gdsync-info { color: var(--text-secondary, #475569); }
#gdsync-modal .gdsync-info code { background: var(--bg-subtle, #f1f5f9); padding: 1px 5px; border-radius: 3px; font-size: 0.92em; color: var(--primary-700, #1d4ed8); }

/* --- Actions --- */
#gdsync-modal .gdsync-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; flex-wrap: wrap; }
#gdsync-modal .btn-block { width: 100%; }

/* --- Sign-in view (primary: "Login dengan Google" button) --- */
#gdsync-modal .gdsync-signin { text-align: center; padding: 8px 0; }
#gdsync-modal .gdsync-user-avatar {
    width: 72px; height: 72px; margin: 0 auto 14px;
    background: var(--bg-subtle, #f1f5f9);
    color: var(--primary-500, #3b82f6);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 2.2rem;
    border: 2px solid var(--border-subtle, #f1f5f9);
}
#gdsync-modal .gdsync-signin h3 { font-size: 1.25rem; margin: 0 0 6px; color: var(--text-primary, #0f172a); }
#gdsync-modal .gdsync-signin > p { color: var(--text-secondary, #475569); margin: 0 0 14px; font-size: 0.9rem; }
#gdsync-modal .gdsync-info-box {
    display: flex; gap: 12px; align-items: flex-start;
    background: var(--bg-subtle, #f1f5f9); padding: 10px 14px;
    border-radius: var(--radius-md, 8px); margin: 10px 0; text-align: left;
    border-left: 3px solid var(--primary-500, #3b82f6);
}
#gdsync-modal .gdsync-info-box i { color: var(--primary-500, #3b82f6); font-size: 1.05rem; flex-shrink: 0; margin-top: 2px; }
#gdsync-modal .gdsync-info-box strong { display: block; margin-bottom: 2px; font-size: 0.85rem; color: var(--text-primary, #0f172a); }
#gdsync-modal .gdsync-info-box div { font-size: 0.82rem; line-height: 1.45; color: var(--text-secondary, #475569); }
#gdsync-modal .gdsync-link { color: var(--primary-600, #2563eb); text-decoration: none; font-size: 0.82rem; }
#gdsync-modal .gdsync-link:hover { text-decoration: underline; color: var(--primary-700, #1d4ed8); }
#gdsync-modal .gdsync-secondary-actions {
    display: flex; align-items: center; justify-content: center; gap: 10px;
    margin-top: 14px; flex-wrap: wrap;
}
#gdsync-modal .gdsync-secondary-actions .gdsync-link { color: var(--text-tertiary, #64748b); font-size: 0.8rem; display: inline-flex; align-items: center; gap: 4px; }
#gdsync-modal .gdsync-secondary-actions .gdsync-link:hover { color: var(--primary-600, #2563eb); }
#gdsync-modal .gdsync-link-sep { color: var(--text-quaternary, #94a3b8); opacity: 0.5; }

/* --- Main view (signed in) --- */
#gdsync-modal .gdsync-main { padding: 4px; }
#gdsync-modal .gdsync-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 14px; background: var(--bg-subtle, #f1f5f9);
    border-radius: var(--radius-md, 8px); margin-bottom: 16px;
    border: 1px solid var(--border-subtle, #f1f5f9);
}
#gdsync-modal .gdsync-user-info { display: flex; align-items: center; gap: 12px; }
#gdsync-modal .gdsync-avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; border: 2px solid var(--bg-surface, #fff); }
#gdsync-modal .gdsync-avatar-placeholder {
    width: 40px; height: 40px; border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-500, #3b82f6), var(--primary-700, #1d4ed8));
    display: flex; align-items: center; justify-content: center;
    color: var(--text-on-primary, #fff); font-size: 1.4rem;
}
#gdsync-modal .gdsync-user-name { font-weight: 600; font-size: 0.92rem; color: var(--text-primary, #0f172a); }
#gdsync-modal .gdsync-user-email { font-size: 0.78rem; color: var(--text-tertiary, #64748b); }

/* --- Tabs --- */
#gdsync-modal .gdsync-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border-default, #e2e8f0); margin-bottom: 16px; }
#gdsync-modal .gdsync-tab {
    padding: 10px 16px; background: none; border: none; cursor: pointer;
    color: var(--text-tertiary, #64748b); font-size: 0.88rem; font-weight: 500;
    border-bottom: 2px solid transparent; transition: all var(--transition-fast, 0.15s);
}
#gdsync-modal .gdsync-tab:hover { color: var(--text-primary, #0f172a); }
#gdsync-modal .gdsync-tab.active { color: var(--primary-600, #2563eb); border-bottom-color: var(--primary-500, #3b82f6); }

/* --- Backup list --- */
#gdsync-modal .gdsync-restore-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 12px; font-size: 0.85rem; color: var(--text-secondary, #475569);
}
#gdsync-modal .gdsync-backup-list { display: flex; flex-direction: column; gap: 8px; }
#gdsync-modal .gdsync-backup-item {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 14px; background: var(--bg-subtle, #f1f5f9);
    border: 1px solid var(--border-default, #e2e8f0);
    border-radius: var(--radius-md, 8px);
    transition: background var(--transition-fast, 0.15s), border-color var(--transition-fast, 0.15s);
}
#gdsync-modal .gdsync-backup-item:hover { background: var(--bg-hover, #f8fafc); border-color: var(--primary-300, #93c5fd); }
#gdsync-modal .gdsync-backup-name { font-weight: 600; font-size: 0.85rem; word-break: break-all; margin-bottom: 2px; color: var(--text-primary, #0f172a); }
#gdsync-modal .gdsync-backup-meta { font-size: 0.75rem; color: var(--text-tertiary, #64748b); }
#gdsync-modal .gdsync-backup-actions { display: flex; gap: 6px; flex-shrink: 0; margin-left: 10px; }
#gdsync-modal .gdsync-empty { padding: 24px; text-align: center; color: var(--text-quaternary, #94a3b8); font-size: 0.88rem; }

/* --- Dark mode (use app's existing dark mode tokens) --- */
[data-theme="dark"] #gdsync-modal .gdsync-modal-content { background: var(--bg-elevated, #1e293b); border-color: var(--border-default, #334155); }
[data-theme="dark"] #gdsync-modal .fs-body { background: var(--bg-elevated, #1e293b); }
[data-theme="dark"] #gdsync-modal .gdsync-header { background: var(--bg-subtle, #334155); border-color: var(--border-subtle, #334155); }
[data-theme="dark"] #gdsync-modal .gdsync-user-avatar { background: var(--bg-subtle, #334155); border-color: var(--border-default, #334155); }
[data-theme="dark"] #gdsync-modal .gdsync-input { background: var(--bg-subtle, #334155); border-color: var(--border-default, #475569); color: var(--text-primary, #f1f5f9); }
[data-theme="dark"] #gdsync-modal .gdsync-monospace { background: var(--bg-subtle, #334155); color: var(--text-secondary, #cbd5e1); border-color: var(--border-subtle, #334155); }
[data-theme="dark"] #gdsync-modal .gdsync-info-box { background: var(--bg-subtle, #334155); }
[data-theme="dark"] #gdsync-modal .gdsync-backup-item { background: var(--bg-subtle, #334155); border-color: var(--border-default, #475569); }
[data-theme="dark"] #gdsync-modal .gdsync-backup-item:hover { background: var(--bg-hover, #404e63); border-color: var(--primary-400, #60a5fa); }
[data-theme="dark"] #gdsync-modal .gdsync-tabs { border-bottom-color: var(--border-default, #475569); }
[data-theme="dark"] #gdsync-modal .gdsync-wizard code { background: var(--bg-subtle, #334155); }
[data-theme="dark"] #gdsync-modal .gdsync-info code { background: var(--bg-subtle, #334155); }

/* --- Mobile responsive --- */
@media (max-width: 600px) {
    #gdsync-modal .gdsync-modal-content { width: 100%; max-width: 100%; height: 100%; max-height: 100vh; border-radius: 0; }
    #gdsync-modal .gdsync-tabs { gap: 0; }
    #gdsync-modal .gdsync-tab { flex: 1; padding: 10px 6px; font-size: 0.82rem; }
    #gdsync-modal .gdsync-backup-item { flex-direction: column; align-items: flex-start; gap: 10px; }
    #gdsync-modal .gdsync-backup-actions { width: 100%; margin-left: 0; }
    #gdsync-modal .gdsync-backup-actions .btn { flex: 1; }
}

/* =============================================================================
 *  Cloud Sync Topbar Button v2 — pill-shaped with status indicator
 *  Always-visible entry point with clear icon + label + status dot.
 *  Animates during syncing state (spin icon, glow background, pulse dot).
 *  ============================================================================= */
#gdsync-topbar-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 36px;
    padding: 0 12px 0 10px;
    background: var(--bg-subtle, #f8fafc);
    border: 1px solid var(--border-default, #e2e8f0);
    border-radius: 18px;
    color: var(--text-primary, #0f172a);
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
    overflow: visible;
    flex-shrink: 0;
}
#gdsync-topbar-btn:hover {
    background: var(--bg-hover, #e2e8f0);
    border-color: var(--border-strong, #cbd5e1);
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}
#gdsync-topbar-btn:active { transform: translateY(0); }
#gdsync-topbar-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(59,130,246,0.25);
}

#gdsync-topbar-btn .gdsync-topbar-icon {
    font-size: 1.05rem;
    color: var(--primary-500, #3b82f6);
    line-height: 1;
    transition: transform 0.2s ease;
    flex-shrink: 0;
}
#gdsync-topbar-btn:hover .gdsync-topbar-icon {
    transform: translateY(-2px);
}
#gdsync-topbar-btn .gdsync-topbar-label {
    line-height: 1;
    color: var(--text-primary, #0f172a);
    white-space: nowrap;
}
#gdsync-topbar-btn .gdsync-topbar-badge {
    position: static; /* in flow next to label */
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--text-tertiary, #94a3b8);
    box-shadow: 0 0 0 2px var(--bg-surface, #fff);
    flex-shrink: 0;
    transition: background 0.2s ease;
}
#gdsync-topbar-btn .gdsync-topbar-badge.signed-in { background: #22c55e; }
#gdsync-topbar-btn .gdsync-topbar-badge.error { background: #ef4444; }
#gdsync-topbar-btn .gdsync-topbar-badge.needs-setup { background: #f59e0b; }

/* --- SYNCING STATE — animated button --- */
#gdsync-topbar-btn.syncing {
    background: linear-gradient(135deg, var(--primary-50, #eff6ff), var(--bg-subtle, #f8fafc));
    border-color: var(--primary-400, #60a5fa);
    animation: gdsync-button-glow 1.6s ease-in-out infinite;
}
#gdsync-topbar-btn.syncing .gdsync-topbar-icon {
    animation: gdsync-icon-spin 1.4s linear infinite;
    color: var(--primary-600, #2563eb);
}
#gdsync-topbar-btn.syncing .gdsync-topbar-badge {
    background: var(--primary-500, #3b82f6);
    animation: gdsync-dot-pulse 1.2s ease-in-out infinite;
}

/* Animations */
@keyframes gdsync-icon-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* --- TOPBAR TIMER (small countdown + progress text next to the Sync button) --- */
.gdsync-topbar-timer {
    font-size: 0.7rem;
    color: var(--text-tertiary, #94a3b8);
    min-width: 44px;
    text-align: left;
    display: none;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.02em;
    user-select: none;
    white-space: nowrap;
}
.gdsync-topbar-timer.visible { display: inline-block; }
.gdsync-topbar-timer.pending { color: var(--text-tertiary, #94a3b8); }
.gdsync-topbar-timer.syncing { color: var(--primary-600, #2563eb); font-weight: 600; }
.gdsync-topbar-timer.success { color: #16a34a; font-weight: 600; }
.gdsync-topbar-timer.error   { color: #dc2626; font-weight: 600; }
@media (max-width: 640px) {
    .gdsync-topbar-timer { display: none !important; }
}
@keyframes gdsync-button-glow {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(59, 130, 246, 0);
        background: linear-gradient(135deg, var(--primary-50, #eff6ff), var(--bg-subtle, #f8fafc));
    }
    50% {
        box-shadow: 0 0 0 5px rgba(59, 130, 246, 0.15);
        background: linear-gradient(135deg, var(--primary-100, #dbeafe), var(--primary-50, #eff6ff));
    }
}
@keyframes gdsync-dot-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.5); }
}

/* Mobile — hide label, keep icon + dot */
@media (max-width: 600px) {
    #gdsync-topbar-btn .gdsync-topbar-label { display: none; }
    #gdsync-topbar-btn { padding: 0 10px; }
    #gdsync-topbar-btn { width: 40px; justify-content: center; }
}

/* Dark mode */
[data-theme="dark"] #gdsync-topbar-btn {
    background: var(--bg-subtle, #334155);
    border-color: var(--border-default, #475569);
    color: var(--text-primary, #f1f5f9);
}
[data-theme="dark"] #gdsync-topbar-btn:hover {
    background: var(--bg-hover, #404e63);
    border-color: var(--border-strong, #6b7280);
}
[data-theme="dark"] #gdsync-topbar-btn .gdsync-topbar-label {
    color: var(--text-primary, #f1f5f9);
}
[data-theme="dark"] #gdsync-topbar-btn .gdsync-topbar-icon {
    color: var(--primary-400, #60a5fa);
}
[data-theme="dark"] #gdsync-topbar-btn .gdsync-topbar-badge {
    box-shadow: 0 0 0 2px var(--bg-elevated, #1e293b);
}
[data-theme="dark"] #gdsync-topbar-btn.syncing {
    background: linear-gradient(135deg, rgba(59,130,246,0.25), var(--bg-subtle, #334155));
    border-color: var(--primary-500, #3b82f6);
}
[data-theme="dark"] #gdsync-topbar-btn.syncing .gdsync-topbar-icon {
    color: var(--primary-300, #93c5fd);
}

/* =============================================================================
 *  Cloud Sync v2 — Redesigned Modal (proper UI/UX)
 *  KISS: hero → primary action → trust signals → advanced disclosure
 *  ============================================================================= */
#gdsync-modal .gdsync-modal-content {
    max-width: 480px;
    width: 95%;
    max-height: 92vh;
    background: var(--bg-surface, #ffffff);
    border-radius: var(--radius-xl, 16px);
    box-shadow: var(--shadow-xl, 0 25px 50px -12px rgba(0,0,0,0.25));
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-default, #e2e8f0);
}

/* --- Header (clean white, prominent close) --- */
#gdsync-modal .gdsync-modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-subtle, #f1f5f9);
    background: var(--bg-surface, #ffffff);
    flex-shrink: 0;
}
#gdsync-modal .gdsync-header-left {
    display: flex; align-items: center; gap: 12px;
}
#gdsync-modal .gdsync-header-icon {
    width: 40px; height: 40px;
    border-radius: var(--radius-md, 8px);
    background: linear-gradient(135deg, #4285F4 0%, #34A853 100%);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}
#gdsync-modal .gdsync-header-title {
    margin: 0; font-size: 1.05rem; font-weight: 700;
    color: var(--text-primary, #0f172a);
    line-height: 1.2;
}
#gdsync-modal .gdsync-header-subtitle {
    margin: 0; font-size: 0.75rem;
    color: var(--text-tertiary, #64748b);
    line-height: 1.2;
}
#gdsync-modal .gdsync-close-btn {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: var(--bg-subtle, #f1f5f9);
    border: none;
    color: var(--text-secondary, #475569);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: 1rem;
    transition: all 0.15s;
    flex-shrink: 0;
}
#gdsync-modal .gdsync-close-btn:hover {
    background: var(--bg-hover, #e2e8f0);
    color: var(--text-primary, #0f172a);
    transform: rotate(90deg);
}
#gdsync-modal .gdsync-close-btn:active { transform: rotate(90deg) scale(0.92); }

/* --- Body (scrollable) --- */
#gdsync-modal .gdsync-modal-body {
    padding: 20px 22px 22px;
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1;
    background: var(--bg-surface, #ffffff);
}
#gdsync-modal .gdsync-view {
    display: flex; flex-direction: column;
    gap: 14px;
}

/* --- Hero (Google G logo) --- */
#gdsync-modal .gdsync-hero {
    display: flex; justify-content: center;
    margin: 8px 0 4px;
}
#gdsync-modal .gdsync-google-g {
    width: 72px; height: 72px;
    display: flex; align-items: center; justify-content: center;
}
#gdsync-modal .gdsync-google-g svg { width: 72px; height: 72px; }

/* --- Title & subtitle --- */
#gdsync-modal .gdsync-title {
    margin: 0; font-size: 1.4rem; font-weight: 700;
    text-align: center;
    color: var(--text-primary, #0f172a);
}
#gdsync-modal .gdsync-subtitle {
    margin: -4px 0 4px; text-align: center;
    color: var(--text-secondary, #475569);
    font-size: 0.88rem; line-height: 1.5;
}

/* --- Big Google sign-in button (official branding) --- */
#gdsync-modal .gdsync-btn-google {
    display: flex; align-items: center; justify-content: center;
    gap: 12px;
    width: 100%;
    padding: 14px 20px;
    background: #ffffff;
    color: #1f2937;
    border: 1.5px solid #dadce0;
    border-radius: var(--radius-md, 8px);
    font-size: 0.95rem; font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    margin-top: 4px;
}
#gdsync-modal .gdsync-btn-google:hover {
    background: #f8fafc;
    border-color: #c4c7c5;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
}
#gdsync-modal .gdsync-btn-google:active {
    background: #f1f5f9;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05) inset;
}
#gdsync-modal .gdsync-btn-google:disabled {
    opacity: 0.5; cursor: not-allowed;
}
#gdsync-modal .gdsync-btn-g {
    display: inline-flex; width: 20px; height: 20px;
    flex-shrink: 0;
}
#gdsync-modal .gdsync-btn-g svg { width: 20px; height: 20px; }
#gdsync-modal .gdsync-btn-label { line-height: 1; }

/* --- Primary & secondary action buttons --- */
#gdsync-modal .gdsync-btn-primary {
    display: flex; align-items: center; justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 13px 18px;
    background: var(--primary-600, #2563eb);
    color: #ffffff;
    border: none;
    border-radius: var(--radius-md, 8px);
    font-size: 0.92rem; font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}
#gdsync-modal .gdsync-btn-primary:hover {
    background: var(--primary-700, #1d4ed8);
    box-shadow: 0 4px 8px rgba(37,99,235,0.25);
}
#gdsync-modal .gdsync-btn-primary:active { transform: translateY(1px); }
#gdsync-modal .gdsync-btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

#gdsync-modal .gdsync-btn-secondary {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 9px 16px;
    background: var(--bg-subtle, #f1f5f9);
    color: var(--text-primary, #0f172a);
    border: 1px solid var(--border-default, #e2e8f0);
    border-radius: var(--radius-md, 8px);
    font-size: 0.85rem; font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
}
#gdsync-modal .gdsync-btn-secondary:hover {
    background: var(--bg-hover, #e2e8f0);
    border-color: var(--border-strong, #cbd5e1);
}

#gdsync-modal .gdsync-btn-icon {
    width: 34px; height: 34px;
    border-radius: 50%;
    background: transparent;
    border: 1px solid var(--border-default, #e2e8f0);
    color: var(--text-secondary, #475569);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.95rem;
    transition: all 0.15s;
    flex-shrink: 0;
}
#gdsync-modal .gdsync-btn-icon:hover {
    background: var(--bg-subtle, #f1f5f9);
    color: var(--text-primary, #0f172a);
    border-color: var(--border-strong, #cbd5e1);
}

/* --- Trust signals (compact row) --- */
#gdsync-modal .gdsync-trust {
    display: flex; justify-content: space-around;
    gap: 6px; padding: 10px 4px 4px;
    border-top: 1px solid var(--border-subtle, #f1f5f9);
    margin-top: 4px;
}
#gdsync-modal .gdsync-trust-item {
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    font-size: 0.7rem;
    color: var(--text-tertiary, #64748b);
    text-align: center;
    flex: 1;
}
#gdsync-modal .gdsync-trust-item i {
    font-size: 1.05rem;
    color: var(--primary-500, #3b82f6);
}

/* --- Status pills (main view) --- */
#gdsync-modal .gdsync-pills {
    display: flex; gap: 6px; flex-wrap: wrap;
    justify-content: center;
    padding: 2px 0;
}
#gdsync-modal .gdsync-pill {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 4px 10px;
    background: var(--bg-subtle, #f1f5f9);
    border: 1px solid var(--border-default, #e2e8f0);
    border-radius: 20px;
    font-size: 0.72rem;
    color: var(--text-secondary, #475569);
    font-weight: 500;
}
#gdsync-modal .gdsync-pill i { font-size: 0.78rem; }
#gdsync-modal .gdsync-pill-success {
    background: rgba(34,197,94,0.08);
    border-color: rgba(34,197,94,0.25);
    color: #16a34a;
}
#gdsync-modal .gdsync-pill-success i { color: #16a34a; }

/* --- User card (main view) --- */
#gdsync-modal .gdsync-user-card {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 14px;
    background: var(--bg-subtle, #f1f5f9);
    border: 1px solid var(--border-subtle, #f1f5f9);
    border-radius: var(--radius-md, 8px);
}
#gdsync-modal .gdsync-user-card .gdsync-avatar,
#gdsync-modal .gdsync-user-card .gdsync-avatar-placeholder {
    width: 44px; height: 44px; border-radius: 50%; flex-shrink: 0;
}
#gdsync-modal .gdsync-user-card .gdsync-avatar { object-fit: cover; border: 2px solid var(--bg-surface, #fff); }
#gdsync-modal .gdsync-user-card .gdsync-avatar-placeholder {
    background: linear-gradient(135deg, #4285F4, #34A853);
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 1.3rem;
}
#gdsync-modal .gdsync-user-info { flex: 1; min-width: 0; }
#gdsync-modal .gdsync-user-name { font-weight: 600; font-size: 0.92rem; color: var(--text-primary, #0f172a); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#gdsync-modal .gdsync-user-email { font-size: 0.76rem; color: var(--text-tertiary, #64748b); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* --- Status messages --- */
#gdsync-modal .gdsync-status { min-height: 0; font-size: 0.85rem; line-height: 1.5; }
#gdsync-modal .gdsync-success { color: #16a34a; font-weight: 500; }
#gdsync-modal .gdsync-error { color: #dc2626; font-weight: 500; }
#gdsync-modal .gdsync-info { color: var(--text-secondary, #475569); }

/* --- Advanced disclosure (uses native <details>) --- */
#gdsync-modal .gdsync-advanced {
    border: 1px solid var(--border-subtle, #f1f5f9);
    border-radius: var(--radius-md, 8px);
    background: var(--bg-subtle, #f8fafc);
    margin-top: 4px;
}
#gdsync-modal .gdsync-advanced > summary {
    display: flex; align-items: center; gap: 8px;
    padding: 10px 14px;
    cursor: pointer;
    list-style: none;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary, #475569);
    user-select: none;
    transition: background 0.15s;
}
#gdsync-modal .gdsync-advanced > summary::-webkit-details-marker { display: none; }
#gdsync-modal .gdsync-advanced > summary::after {
    content: "\\F282"; /* bi-chevron-down */
    font-family: "bootstrap-icons";
    font-size: 0.9rem;
    color: var(--text-tertiary, #94a3b8);
    margin-left: auto;
    transition: transform 0.2s;
}
#gdsync-modal .gdsync-advanced[open] > summary {
    border-bottom: 1px solid var(--border-subtle, #f1f5f9);
    background: var(--bg-surface, #ffffff);
}
#gdsync-modal .gdsync-advanced[open] > summary::after { transform: rotate(180deg); }
#gdsync-modal .gdsync-advanced > summary:hover { background: var(--bg-hover, #e2e8f0); }
#gdsync-modal .gdsync-advanced-content {
    padding: 14px;
    display: flex; flex-direction: column; gap: 10px;
}

/* --- Form elements --- */
#gdsync-modal .gdsync-form-row { display: flex; flex-direction: column; gap: 4px; }
#gdsync-modal .gdsync-form-row > label { font-size: 0.82rem; font-weight: 600; color: var(--text-primary, #0f172a); }
#gdsync-modal .gdsync-input {
    width: 100%; padding: 9px 12px;
    border: 1px solid var(--border-default, #e2e8f0);
    border-radius: var(--radius-md, 8px);
    font-size: 0.82rem; font-family: var(--font-mono, "SF Mono", Menlo, Consolas, monospace);
    background: var(--bg-surface, #fff);
    color: var(--text-primary, #0f172a);
    box-sizing: border-box;
    transition: border-color 0.15s, box-shadow 0.15s;
}
#gdsync-modal .gdsync-input:focus {
    outline: none;
    border-color: var(--primary-500, #3b82f6);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}
#gdsync-modal .gdsync-hint { font-size: 0.74rem; color: var(--text-tertiary, #64748b); line-height: 1.4; }
#gdsync-modal .gdsync-hint code { background: var(--bg-subtle, #f1f5f9); padding: 1px 5px; border-radius: 3px; font-size: 0.92em; }
#gdsync-modal .gdsync-checkbox-label { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 0.82rem; font-weight: 500; }
#gdsync-modal .gdsync-checkbox-label input { width: 16px; height: 16px; cursor: pointer; accent-color: var(--primary-600, #2563eb); }
#gdsync-modal .gdsync-link { color: var(--primary-600, #2563eb); text-decoration: none; font-size: 0.82rem; }
#gdsync-modal .gdsync-link:hover { text-decoration: underline; }

/* --- Restore section --- */
#gdsync-modal .gdsync-restore-header {
    display: flex; justify-content: space-between; align-items: center;
    font-size: 0.82rem; color: var(--text-secondary, #475569);
    font-weight: 500;
}
#gdsync-modal .gdsync-backup-list { display: flex; flex-direction: column; gap: 6px; }
#gdsync-modal .gdsync-backup-item {
    display: flex; align-items: center; justify-content: space-between;
    padding: 8px 12px;
    background: var(--bg-surface, #ffffff);
    border: 1px solid var(--border-default, #e2e8f0);
    border-radius: var(--radius-md, 8px);
    font-size: 0.82rem;
    transition: background 0.15s, border-color 0.15s;
}
#gdsync-modal .gdsync-backup-item:hover { background: var(--bg-hover, #f8fafc); border-color: var(--primary-300, #93c5fd); }
#gdsync-modal .gdsync-backup-name { font-weight: 600; color: var(--text-primary, #0f172a); word-break: break-all; font-size: 0.78rem; }
#gdsync-modal .gdsync-backup-meta { font-size: 0.7rem; color: var(--text-tertiary, #64748b); margin-top: 2px; }
#gdsync-modal .gdsync-backup-actions { display: flex; gap: 4px; flex-shrink: 0; margin-left: 8px; }
#gdsync-modal .gdsync-empty { padding: 16px; text-align: center; color: var(--text-quaternary, #94a3b8); font-size: 0.82rem; }

/* --- Dark mode --- */
[data-theme="dark"] #gdsync-modal .gdsync-modal-content,
[data-theme="dark"] #gdsync-modal .gdsync-modal-header { background: var(--bg-elevated, #1e293b); border-color: var(--border-default, #334155); }
[data-theme="dark"] #gdsync-modal .gdsync-modal-body { background: var(--bg-elevated, #1e293b); }
[data-theme="dark"] #gdsync-modal .gdsync-header-title { color: var(--text-primary, #f1f5f9); }
[data-theme="dark"] #gdsync-modal .gdsync-subtitle { color: var(--text-secondary, #cbd5e1); }
[data-theme="dark"] #gdsync-modal .gdsync-close-btn { background: var(--bg-subtle, #334155); color: var(--text-secondary, #cbd5e1); }
[data-theme="dark"] #gdsync-modal .gdsync-close-btn:hover { background: var(--bg-hover, #404e63); color: var(--text-primary, #f1f5f9); }
[data-theme="dark"] #gdsync-modal .gdsync-btn-google { background: #2d3748; color: #f1f5f9; border-color: #4a5568; }
[data-theme="dark"] #gdsync-modal .gdsync-btn-google:hover { background: #374151; border-color: #6b7280; }
[data-theme="dark"] #gdsync-modal .gdsync-user-card { background: var(--bg-subtle, #334155); border-color: var(--border-subtle, #334155); }
[data-theme="dark"] #gdsync-modal .gdsync-pill { background: var(--bg-subtle, #334155); border-color: var(--border-default, #475569); color: var(--text-secondary, #cbd5e1); }
[data-theme="dark"] #gdsync-modal .gdsync-advanced { background: var(--bg-subtle, #334155); border-color: var(--border-subtle, #334155); }
[data-theme="dark"] #gdsync-modal .gdsync-advanced[open] > summary { background: var(--bg-elevated, #1e293b); }
[data-theme="dark"] #gdsync-modal .gdsync-advanced > summary:hover { background: var(--bg-hover, #404e63); }
[data-theme="dark"] #gdsync-modal .gdsync-input { background: var(--bg-subtle, #334155); border-color: var(--border-default, #475569); color: var(--text-primary, #f1f5f9); }
[data-theme="dark"] #gdsync-modal .gdsync-hint code { background: var(--bg-subtle, #334155); }
[data-theme="dark"] #gdsync-modal .gdsync-backup-item { background: var(--bg-subtle, #334155); border-color: var(--border-default, #475569); }
[data-theme="dark"] #gdsync-modal .gdsync-backup-item:hover { background: var(--bg-hover, #404e63); border-color: var(--primary-400, #60a5fa); }
[data-theme="dark"] #gdsync-modal .gdsync-trust-item { color: var(--text-secondary, #cbd5e1); }
[data-theme="dark"] #gdsync-modal .gdsync-trust-item i { color: var(--primary-400, #60a5fa); }
[data-theme="dark"] #gdsync-modal .gdsync-pill-success { background: rgba(34,197,94,0.15); border-color: rgba(34,197,94,0.35); color: #4ade80; }
[data-theme="dark"] #gdsync-modal .gdsync-pill-success i { color: #4ade80; }

/* --- Mobile responsive --- */
@media (max-width: 600px) {
    #gdsync-modal .gdsync-modal-content { width: 100%; max-width: 100%; height: 100%; max-height: 100vh; border-radius: 0; }
    #gdsync-modal .gdsync-modal-body { padding: 16px 18px 20px; }
}

/* =============================================================================
 *  Cloud Sync v2 â€” Redesigned Modal (proper UI/UX)
 *  KISS: hero â†’ primary action â†’ trust signals â†’ advanced disclosure
 *  ============================================================================= */
#gdsync-modal .gdsync-modal-content {
    max-width: 480px;
    width: 95%;
    max-height: 92vh;
    background: var(--bg-surface, #ffffff);
    border-radius: var(--radius-xl, 16px);
    box-shadow: var(--shadow-xl, 0 25px 50px -12px rgba(0,0,0,0.25));
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-default, #e2e8f0);
}

/* --- Header (clean white, prominent close) --- */
#gdsync-modal .gdsync-modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-subtle, #f1f5f9);
    background: var(--bg-surface, #ffffff);
    flex-shrink: 0;
}
#gdsync-modal .gdsync-header-left {
    display: flex; align-items: center; gap: 12px;
}
#gdsync-modal .gdsync-header-icon {
    width: 40px; height: 40px;
    border-radius: var(--radius-md, 8px);
    background: linear-gradient(135deg, #4285F4 0%, #34A853 100%);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}
#gdsync-modal .gdsync-header-title {
    margin: 0; font-size: 1.05rem; font-weight: 700;
    color: var(--text-primary, #0f172a);
    line-height: 1.2;
}
#gdsync-modal .gdsync-header-subtitle {
    margin: 0; font-size: 0.75rem;
    color: var(--text-tertiary, #64748b);
    line-height: 1.2;
}
#gdsync-modal .gdsync-close-btn {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: var(--bg-subtle, #f1f5f9);
    border: none;
    color: var(--text-secondary, #475569);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: 1rem;
    transition: all 0.15s;
    flex-shrink: 0;
}
#gdsync-modal .gdsync-close-btn:hover {
    background: var(--bg-hover, #e2e8f0);
    color: var(--text-primary, #0f172a);
    transform: rotate(90deg);
}
#gdsync-modal .gdsync-close-btn:active { transform: rotate(90deg) scale(0.92); }

/* --- Body (scrollable) --- */
#gdsync-modal .gdsync-modal-body {
    padding: 20px 22px 22px;
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1;
    background: var(--bg-surface, #ffffff);
}
#gdsync-modal .gdsync-view {
    display: flex; flex-direction: column;
    gap: 14px;
}

/* --- Hero (Google G logo) --- */
#gdsync-modal .gdsync-hero {
    display: flex; justify-content: center;
    margin: 8px 0 4px;
}
#gdsync-modal .gdsync-google-g {
    width: 72px; height: 72px;
    display: flex; align-items: center; justify-content: center;
}
#gdsync-modal .gdsync-google-g svg { width: 72px; height: 72px; }

/* --- Title & subtitle --- */
#gdsync-modal .gdsync-title {
    margin: 0; font-size: 1.4rem; font-weight: 700;
    text-align: center;
    color: var(--text-primary, #0f172a);
}
#gdsync-modal .gdsync-subtitle {
    margin: -4px 0 4px; text-align: center;
    color: var(--text-secondary, #475569);
    font-size: 0.88rem; line-height: 1.5;
}

/* --- Big Google sign-in button (official branding) --- */
#gdsync-modal .gdsync-btn-google {
    display: flex; align-items: center; justify-content: center;
    gap: 12px;
    width: 100%;
    padding: 14px 20px;
    background: #ffffff;
    color: #1f2937;
    border: 1.5px solid #dadce0;
    border-radius: var(--radius-md, 8px);
    font-size: 0.95rem; font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    margin-top: 4px;
}
#gdsync-modal .gdsync-btn-google:hover {
    background: #f8fafc;
    border-color: #c4c7c5;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
}
#gdsync-modal .gdsync-btn-google:active {
    background: #f1f5f9;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05) inset;
}
#gdsync-modal .gdsync-btn-google:disabled {
    opacity: 0.5; cursor: not-allowed;
}
#gdsync-modal .gdsync-btn-g {
    display: inline-flex; width: 20px; height: 20px;
    flex-shrink: 0;
}
#gdsync-modal .gdsync-btn-g svg { width: 20px; height: 20px; }
#gdsync-modal .gdsync-btn-label { line-height: 1; }

/* --- Primary & secondary action buttons --- */
#gdsync-modal .gdsync-btn-primary {
    display: flex; align-items: center; justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 13px 18px;
    background: var(--primary-600, #2563eb);
    color: #ffffff;
    border: none;
    border-radius: var(--radius-md, 8px);
    font-size: 0.92rem; font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}
#gdsync-modal .gdsync-btn-primary:hover {
    background: var(--primary-700, #1d4ed8);
    box-shadow: 0 4px 8px rgba(37,99,235,0.25);
}
#gdsync-modal .gdsync-btn-primary:active { transform: translateY(1px); }
#gdsync-modal .gdsync-btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

#gdsync-modal .gdsync-btn-secondary {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 9px 16px;
    background: var(--bg-subtle, #f1f5f9);
    color: var(--text-primary, #0f172a);
    border: 1px solid var(--border-default, #e2e8f0);
    border-radius: var(--radius-md, 8px);
    font-size: 0.85rem; font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
}
#gdsync-modal .gdsync-btn-secondary:hover {
    background: var(--bg-hover, #e2e8f0);
    border-color: var(--border-strong, #cbd5e1);
}

#gdsync-modal .gdsync-btn-icon {
    width: 34px; height: 34px;
    border-radius: 50%;
    background: transparent;
    border: 1px solid var(--border-default, #e2e8f0);
    color: var(--text-secondary, #475569);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.95rem;
    transition: all 0.15s;
    flex-shrink: 0;
}
#gdsync-modal .gdsync-btn-icon:hover {
    background: var(--bg-subtle, #f1f5f9);
    color: var(--text-primary, #0f172a);
    border-color: var(--border-strong, #cbd5e1);
}

/* --- Trust signals (compact row) --- */
#gdsync-modal .gdsync-trust {
    display: flex; justify-content: space-around;
    gap: 6px; padding: 10px 4px 4px;
    border-top: 1px solid var(--border-subtle, #f1f5f9);
    margin-top: 4px;
}
#gdsync-modal .gdsync-trust-item {
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    font-size: 0.7rem;
    color: var(--text-tertiary, #64748b);
    text-align: center;
    flex: 1;
}
#gdsync-modal .gdsync-trust-item i {
    font-size: 1.05rem;
    color: var(--primary-500, #3b82f6);
}

/* --- Status pills (main view) --- */
#gdsync-modal .gdsync-pills {
    display: flex; gap: 6px; flex-wrap: wrap;
    justify-content: center;
    padding: 2px 0;
}
#gdsync-modal .gdsync-pill {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 4px 10px;
    background: var(--bg-subtle, #f1f5f9);
    border: 1px solid var(--border-default, #e2e8f0);
    border-radius: 20px;
    font-size: 0.72rem;
    color: var(--text-secondary, #475569);
    font-weight: 500;
}
#gdsync-modal .gdsync-pill i { font-size: 0.78rem; }
#gdsync-modal .gdsync-pill-success {
    background: rgba(34,197,94,0.08);
    border-color: rgba(34,197,94,0.25);
    color: #16a34a;
}
#gdsync-modal .gdsync-pill-success i { color: #16a34a; }

/* --- User card (main view) --- */
#gdsync-modal .gdsync-user-card {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 14px;
    background: var(--bg-subtle, #f1f5f9);
    border: 1px solid var(--border-subtle, #f1f5f9);
    border-radius: var(--radius-md, 8px);
}
#gdsync-modal .gdsync-user-card .gdsync-avatar,
#gdsync-modal .gdsync-user-card .gdsync-avatar-placeholder {
    width: 44px; height: 44px; border-radius: 50%; flex-shrink: 0;
}
#gdsync-modal .gdsync-user-card .gdsync-avatar { object-fit: cover; border: 2px solid var(--bg-surface, #fff); }
#gdsync-modal .gdsync-user-card .gdsync-avatar-placeholder {
    background: linear-gradient(135deg, #4285F4, #34A853);
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 1.3rem;
}
#gdsync-modal .gdsync-user-info { flex: 1; min-width: 0; }
#gdsync-modal .gdsync-user-name { font-weight: 600; font-size: 0.92rem; color: var(--text-primary, #0f172a); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#gdsync-modal .gdsync-user-email { font-size: 0.76rem; color: var(--text-tertiary, #64748b); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* --- Status messages --- */
#gdsync-modal .gdsync-status { min-height: 0; font-size: 0.85rem; line-height: 1.5; }
#gdsync-modal .gdsync-success { color: #16a34a; font-weight: 500; }
#gdsync-modal .gdsync-error { color: #dc2626; font-weight: 500; }
#gdsync-modal .gdsync-info { color: var(--text-secondary, #475569); }

/* --- Advanced disclosure (uses native <details>) --- */
#gdsync-modal .gdsync-advanced {
    border: 1px solid var(--border-subtle, #f1f5f9);
    border-radius: var(--radius-md, 8px);
    background: var(--bg-subtle, #f8fafc);
    margin-top: 4px;
}
#gdsync-modal .gdsync-advanced > summary {
    display: flex; align-items: center; gap: 8px;
    padding: 10px 14px;
    cursor: pointer;
    list-style: none;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary, #475569);
    user-select: none;
    transition: background 0.15s;
}
#gdsync-modal .gdsync-advanced > summary::-webkit-details-marker { display: none; }
#gdsync-modal .gdsync-advanced > summary::after {
    content: "\F282"; /* bi-chevron-down */
    font-family: "bootstrap-icons";
    font-size: 0.9rem;
    color: var(--text-tertiary, #94a3b8);
    margin-left: auto;
    transition: transform 0.2s;
}
#gdsync-modal .gdsync-advanced[open] > summary {
    border-bottom: 1px solid var(--border-subtle, #f1f5f9);
    background: var(--bg-surface, #ffffff);
}
#gdsync-modal .gdsync-advanced[open] > summary::after { transform: rotate(180deg); }
#gdsync-modal .gdsync-advanced > summary:hover { background: var(--bg-hover, #e2e8f0); }
#gdsync-modal .gdsync-advanced-content {
    padding: 14px;
    display: flex; flex-direction: column; gap: 10px;
}

/* --- Form elements --- */
#gdsync-modal .gdsync-form-row { display: flex; flex-direction: column; gap: 4px; }
#gdsync-modal .gdsync-form-row > label { font-size: 0.82rem; font-weight: 600; color: var(--text-primary, #0f172a); }
#gdsync-modal .gdsync-input {
    width: 100%; padding: 9px 12px;
    border: 1px solid var(--border-default, #e2e8f0);
    border-radius: var(--radius-md, 8px);
    font-size: 0.82rem; font-family: var(--font-mono, "SF Mono", Menlo, Consolas, monospace);
    background: var(--bg-surface, #fff);
    color: var(--text-primary, #0f172a);
    box-sizing: border-box;
    transition: border-color 0.15s, box-shadow 0.15s;
}
#gdsync-modal .gdsync-input:focus {
    outline: none;
    border-color: var(--primary-500, #3b82f6);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}
#gdsync-modal .gdsync-hint { font-size: 0.74rem; color: var(--text-tertiary, #64748b); line-height: 1.4; }
#gdsync-modal .gdsync-hint code { background: var(--bg-subtle, #f1f5f9); padding: 1px 5px; border-radius: 3px; font-size: 0.92em; }
#gdsync-modal .gdsync-checkbox-label { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 0.82rem; font-weight: 500; }
#gdsync-modal .gdsync-checkbox-label input { width: 16px; height: 16px; cursor: pointer; accent-color: var(--primary-600, #2563eb); }
#gdsync-modal .gdsync-link { color: var(--primary-600, #2563eb); text-decoration: none; font-size: 0.82rem; }
#gdsync-modal .gdsync-link:hover { text-decoration: underline; }

/* --- Restore section --- */
#gdsync-modal .gdsync-restore-header {
    display: flex; justify-content: space-between; align-items: center;
    font-size: 0.82rem; color: var(--text-secondary, #475569);
    font-weight: 500;
}
#gdsync-modal .gdsync-backup-list { display: flex; flex-direction: column; gap: 6px; }
#gdsync-modal .gdsync-backup-item {
    display: flex; align-items: center; justify-content: space-between;
    padding: 8px 12px;
    background: var(--bg-surface, #ffffff);
    border: 1px solid var(--border-default, #e2e8f0);
    border-radius: var(--radius-md, 8px);
    font-size: 0.82rem;
    transition: background 0.15s, border-color 0.15s;
}
#gdsync-modal .gdsync-backup-item:hover { background: var(--bg-hover, #f8fafc); border-color: var(--primary-300, #93c5fd); }
#gdsync-modal .gdsync-backup-name { font-weight: 600; color: var(--text-primary, #0f172a); word-break: break-all; font-size: 0.78rem; }
#gdsync-modal .gdsync-backup-meta { font-size: 0.7rem; color: var(--text-tertiary, #64748b); margin-top: 2px; }
#gdsync-modal .gdsync-backup-actions { display: flex; gap: 4px; flex-shrink: 0; margin-left: 8px; }
#gdsync-modal .gdsync-empty { padding: 16px; text-align: center; color: var(--text-quaternary, #94a3b8); font-size: 0.82rem; }

/* --- Dark mode --- */
[data-theme="dark"] #gdsync-modal .gdsync-modal-content,
[data-theme="dark"] #gdsync-modal .gdsync-modal-header { background: var(--bg-elevated, #1e293b); border-color: var(--border-default, #334155); }
[data-theme="dark"] #gdsync-modal .gdsync-modal-body { background: var(--bg-elevated, #1e293b); }
[data-theme="dark"] #gdsync-modal .gdsync-header-title { color: var(--text-primary, #f1f5f9); }
[data-theme="dark"] #gdsync-modal .gdsync-subtitle { color: var(--text-secondary, #cbd5e1); }
[data-theme="dark"] #gdsync-modal .gdsync-close-btn { background: var(--bg-subtle, #334155); color: var(--text-secondary, #cbd5e1); }
[data-theme="dark"] #gdsync-modal .gdsync-close-btn:hover { background: var(--bg-hover, #404e63); color: var(--text-primary, #f1f5f9); }
[data-theme="dark"] #gdsync-modal .gdsync-btn-google { background: #2d3748; color: #f1f5f9; border-color: #4a5568; }
[data-theme="dark"] #gdsync-modal .gdsync-btn-google:hover { background: #374151; border-color: #6b7280; }
[data-theme="dark"] #gdsync-modal .gdsync-user-card { background: var(--bg-subtle, #334155); border-color: var(--border-subtle, #334155); }
[data-theme="dark"] #gdsync-modal .gdsync-pill { background: var(--bg-subtle, #334155); border-color: var(--border-default, #475569); color: var(--text-secondary, #cbd5e1); }
[data-theme="dark"] #gdsync-modal .gdsync-advanced { background: var(--bg-subtle, #334155); border-color: var(--border-subtle, #334155); }
[data-theme="dark"] #gdsync-modal .gdsync-advanced[open] > summary { background: var(--bg-elevated, #1e293b); }
[data-theme="dark"] #gdsync-modal .gdsync-advanced > summary:hover { background: var(--bg-hover, #404e63); }
[data-theme="dark"] #gdsync-modal .gdsync-input { background: var(--bg-subtle, #334155); border-color: var(--border-default, #475569); color: var(--text-primary, #f1f5f9); }
[data-theme="dark"] #gdsync-modal .gdsync-hint code { background: var(--bg-subtle, #334155); }
[data-theme="dark"] #gdsync-modal .gdsync-backup-item { background: var(--bg-subtle, #334155); border-color: var(--border-default, #475569); }
[data-theme="dark"] #gdsync-modal .gdsync-backup-item:hover { background: var(--bg-hover, #404e63); border-color: var(--primary-400, #60a5fa); }
[data-theme="dark"] #gdsync-modal .gdsync-trust-item { color: var(--text-secondary, #cbd5e1); }
[data-theme="dark"] #gdsync-modal .gdsync-trust-item i { color: var(--primary-400, #60a5fa); }
[data-theme="dark"] #gdsync-modal .gdsync-pill-success { background: rgba(34,197,94,0.15); border-color: rgba(34,197,94,0.35); color: #4ade80; }
[data-theme="dark"] #gdsync-modal .gdsync-pill-success i { color: #4ade80; }

/* --- Mobile responsive --- */
@media (max-width: 600px) {
    #gdsync-modal .gdsync-modal-content { width: 100%; max-width: 100%; height: 100%; max-height: 100vh; border-radius: 0; }
    #gdsync-modal .gdsync-modal-body { padding: 16px 18px 20px; }
}


/* Minimal bottom-edge countdown for the inactivity auto-lock setting. */
#auto-lock-progress {
    position: fixed;
    inset: auto 0 0 0;
    width: 100%;
    height: 3px;
    z-index: 100000;
    pointer-events: none;
    background: rgba(148, 163, 184, 0.16);
    overflow: hidden;
}

#auto-lock-progress > span {
    display: block;
    width: 100%;
    height: 100%;
    background: #f59e0b;
    transform: scaleX(1);
    transform-origin: left center;
    will-change: transform;
    box-shadow: 0 0 5px rgba(245, 158, 11, 0.28);
}

@media (prefers-reduced-motion: reduce) {
    #auto-lock-progress > span {
        will-change: auto;
    }
}

/* =========================================================
   RESPONSIVE UX HARDENING
   Progressive overrides: preserve existing features and layouts
   while preventing overflow at narrow, short, and zoomed viewports.
   ========================================================= */

/* Grid/flex children must be allowed to shrink instead of forcing page overflow. */
.app-shell,
.main-content,
#dashboard-content,
#personal-space-content,
.page-header,
.accordion,
.accordion-content,
.kpi-grid,
.toolbar,
.toolbar-group,
.data-table-wrapper,
.gantt-container,
.ps-container,
.threads-feed,
.modal-panel,
.modal-body {
    min-width: 0;
}

img,
video,
canvas,
iframe {
    max-width: 100%;
}

input,
select,
textarea {
    max-width: 100%;
    min-width: 0;
}

button,
[role="button"],
input,
select,
textarea,
summary,
a {
    -webkit-tap-highlight-color: transparent;
}

:where(button, a, input, select, textarea, summary, [tabindex]):focus-visible {
    outline: 3px solid var(--primary-400, #60a5fa);
    outline-offset: 2px;
}

:where(p, h1, h2, h3, h4, label, .nav-label, .kpi-label, .data-card-title) {
    overflow-wrap: anywhere;
}

.modal-overlay {
    padding: max(8px, env(safe-area-inset-top, 0px))
             max(8px, env(safe-area-inset-right, 0px))
             max(8px, env(safe-area-inset-bottom, 0px))
             max(8px, env(safe-area-inset-left, 0px));
    overflow-y: auto;
    overscroll-behavior: contain;
}

.modal-panel {
    max-height: min(90vh, 900px);
    max-height: min(90dvh, 900px);
}

.modal-body {
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

.sidebar {
    height: calc(100vh - var(--topbar-height));
    height: calc(100dvh - var(--topbar-height));
    overscroll-behavior: contain;
}

@media (min-width: 1440px) {
    .main-content {
        padding-left: clamp(28px, 2.2vw, 40px);
        padding-right: clamp(28px, 2.2vw, 40px);
    }

    .page-header,
    #dashboard-content > .accordion,
    #dashboard-content > .kpi-grid,
    #dashboard-content > .data-table-wrapper {
        max-width: 1800px;
    }
}

@media (max-width: 1024px) {
    .main-content,
    .sidebar.collapsed ~ .main-content {
        width: 100%;
        min-width: 0;
        margin-left: 0;
        max-width: 100%;
    }

    .data-table-wrapper {
        max-width: 100%;
        overflow-x: auto;
        overscroll-behavior-x: contain;
        -webkit-overflow-scrolling: touch;
    }

    .gantt-container {
        max-width: 100%;
        overflow-x: auto;
        overscroll-behavior-x: contain;
    }
}

@media (max-width: 768px) {
    .main-content {
        width: 100%;
        min-width: 0;
        padding-bottom: calc(88px + env(safe-area-inset-bottom, 0px));
    }

    .topbar {
        gap: 8px;
        max-width: 100vw;
    }

    .topbar-brand {
        flex: 1 1 auto;
        min-width: 0;
    }

    .topbar-actions {
        flex: 0 0 auto;
        min-width: 0;
    }

    .sidebar-toggle,
    .topbar-actions > button,
    .nav-item,
    .mobile-nav-item {
        touch-action: manipulation;
    }

    .page-header h1 {
        line-height: 1.25;
        overflow-wrap: anywhere;
    }

    .form-grid,
    .detail-grid-2,
    .detail-row-2col,
    .detail-row-3col {
        min-width: 0;
    }

    .form-grid > *,
    .kpi-grid > *,
    .toolbar-group > *,
    .detail-grid-2 > *,
    .detail-row-2col > *,
    .detail-row-3col > * {
        min-width: 0;
    }

    .modal-overlay {
        align-items: center;
        padding-top: max(12px, env(safe-area-inset-top, 0px));
        padding-bottom: max(12px, env(safe-area-inset-bottom, 0px));
    }

    .modal-panel {
        width: min(96%, 720px);
        max-width: 96%;
        max-height: calc(100vh - 24px);
        max-height: calc(100dvh - max(24px, env(safe-area-inset-top, 0px) + env(safe-area-inset-bottom, 0px)));
    }

    .modal-header,
    .modal-footer {
        flex-wrap: wrap;
        gap: 8px;
    }

    .modal-body {
        min-height: 0;
    }

    .btn,
    .form-control,
    .form-select,
    input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]),
    select,
    summary {
        min-height: 44px;
    }
}

@media (max-width: 480px) {
    .topbar {
        padding-left: max(10px, env(safe-area-inset-left, 0px));
        padding-right: max(10px, env(safe-area-inset-right, 0px));
        gap: 6px;
    }

    .topbar-brand {
        gap: 6px;
    }

    .topbar-brand .brand-logo-btn {
        flex: 0 0 auto;
    }

    .topbar-brand .course-title-input {
        min-width: 0;
        width: 100%;
    }

    .topbar-actions {
        gap: 4px;
    }

    #gdsync-topbar-btn .gdsync-topbar-label {
        display: none;
    }

    .main-content {
        padding-left: max(10px, env(safe-area-inset-left, 0px));
        padding-right: max(10px, env(safe-area-inset-right, 0px));
    }

    .page-header {
        overflow-wrap: anywhere;
    }

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

    .kpi-card {
        min-width: 0;
    }

    .kpi-card .kpi-value {
        overflow-wrap: anywhere;
        font-variant-numeric: tabular-nums;
    }

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

    .toolbar-group .btn,
    .toolbar-group .form-select {
        min-width: 0;
        white-space: normal;
        overflow-wrap: anywhere;
    }

    .modal-panel {
        width: 100%;
        max-width: 100%;
    }

    .modal-overlay:not(#master-unlock-overlay) {
        padding-left: max(8px, env(safe-area-inset-left, 0px));
        padding-right: max(8px, env(safe-area-inset-right, 0px));
    }

    .data-table {
        font-size: 0.78rem;
    }
}

@media (max-width: 360px) {
    .topbar-brand .brand-title-input,
    .topbar-brand .course-title-input {
        display: none;
    }

    .kpi-grid {
        gap: 8px;
    }

    .toolbar-group {
        grid-template-columns: minmax(0, 1fr);
    }

    .main-content {
        padding-left: 8px;
        padding-right: 8px;
    }
}

@media (max-height: 560px) and (orientation: landscape) {
    .modal-panel {
        max-height: calc(100vh - 16px);
        max-height: calc(100dvh - 16px);
    }

    .sidebar {
        overflow-y: auto;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Prevent row action controls from being clipped or covered at narrow widths. */
.data-table-wrapper {
    position: relative;
    isolation: isolate;
    overflow-x: auto;
    overflow-y: hidden;
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
}

.data-table {
    width: 100%;
    min-width: 980px;
    table-layout: auto;
}

.data-table thead th:last-child,
.data-table tbody td:last-child {
    width: 132px;
    min-width: 132px;
    white-space: nowrap;
    padding-left: 12px;
    padding-right: 16px;
    text-align: center;
}

.data-table tbody td:last-child {
    position: relative;
    z-index: 1;
    background-clip: padding-box;
}

.data-table tbody td:last-child > *,
.data-table tbody td:last-child .btn,
.data-table tbody td:last-child button {
    flex-shrink: 0;
    white-space: nowrap;
}

.data-table tbody td:last-child button {
    position: relative;
    z-index: 1;
    min-width: 32px;
}

/* Keep the floating help affordance clear of the table's bottom-right actions. */
.fab-container {
    z-index: 30;
}

@media (max-width: 1024px) {
    .data-table-wrapper {
        overflow-x: auto;
        overflow-y: hidden;
        padding-bottom: 2px;
        scrollbar-gutter: stable;
    }

    .data-table {
        min-width: 1060px;
    }
}

@media (max-width: 768px) {
    .data-table-wrapper {
        border-radius: var(--radius-lg);
        margin-right: 0;
    }

    .data-table thead th:last-child,
    .data-table tbody td:last-child {
        position: sticky;
        right: 0;
        z-index: 4;
        background: var(--bg-surface);
        box-shadow: -6px 0 10px rgba(15, 23, 42, 0.06);
    }

    .data-table thead th:last-child {
        z-index: 5;
        background: var(--bg-subtle);
    }

    .data-table tbody tr:hover td:last-child {
        background: var(--bg-hover);
    }

    .data-table tbody td:last-child button {
        min-height: 36px;
        min-width: 36px;
    }
}

@media (max-width: 480px) {
    .data-table {
        min-width: 1040px;
    }

    .data-table thead th:last-child,
    .data-table tbody td:last-child {
        width: 140px;
        min-width: 140px;
        padding-left: 8px;
        padding-right: 10px;
    }
}

/* Keep the floating help button out of the syllabus table's right-side action lane.
   The table wrapper is an isolated scrolling layer, so raising table z-index alone
   cannot reliably place its controls above this viewport-level button. */
@media (max-width: 1024px) {
    .fab-container {
        right: auto;
        left: max(16px, env(safe-area-inset-left, 0px));
        bottom: max(16px, env(safe-area-inset-bottom, 0px));
        z-index: 30;
    }
}

@media (max-width: 768px) {
    .fab-container {
        display: none;
    }
}

/* Keep Progress, Nilai and especially Aksi reachable when the viewport is narrower
   than the full syllabus table. The sticky action lane is applied at tablet widths
   too (not only phone widths), and the wrapper is the single horizontal scroll area. */
.data-table-wrapper {
    overflow-x: auto !important;
    overflow-y: hidden !important;
    max-width: 100%;
    position: relative;
    isolation: isolate;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
}

.data-table {
    min-width: 1060px;
    width: max(100%, 1060px);
}

.data-table thead th:last-child,
.data-table tbody td:last-child {
    position: sticky;
    right: 0;
    width: 140px;
    min-width: 140px;
    max-width: 140px;
    white-space: nowrap;
    background: var(--bg-surface);
    box-shadow: -8px 0 12px rgba(15, 23, 42, 0.08);
    z-index: 6;
}

.data-table thead th:last-child {
    background: var(--bg-subtle);
    z-index: 7;
}

.data-table tbody td:last-child > div {
    display: flex;
    flex-wrap: nowrap;
    justify-content: center;
    align-items: center;
    gap: 4px;
    min-width: max-content;
}

.data-table tbody td:last-child button {
    flex: 0 0 32px;
    min-width: 32px;
    min-height: 32px;
}

.data-table tbody tr:hover td:last-child {
    background: var(--bg-hover);
}

@media (max-width: 1024px) {
    .data-table {
        min-width: 1060px;
    }

    .data-table thead th:last-child,
    .data-table tbody td:last-child {
        width: 140px;
        min-width: 140px;
        max-width: 140px;
        padding-left: 8px;
        padding-right: 8px;
    }
}

@media (max-width: 768px) {
    /* The existing card view is preferred on phones; do not force the desktop table. */
    .data-table-wrapper {
        display: none;
    }

    .data-cards-view {
        display: flex;
    }
}



/* ==========================================================================
   SILABUS WARM EDITORIAL WORKSPACE — v1
   Intentional design layer. Existing selectors/IDs and application behavior
   remain intact; this layer changes presentation only.
   ========================================================================== */
:root {
    color-scheme: light;
    --primary-50: #f7eaf1;
    --primary-100: #f0d7e5;
    --primary-200: #e5bdd3;
    --primary-300: #d5a0be;
    --primary-400: #c58aab;
    --primary-500: #a96e8d;
    --primary-600: #80506a;
    --primary-700: #633d52;
    --primary-800: #4c303f;
    --primary-900: #35212d;

    --gray-0: #fffdf7;
    --gray-50: #f8f3e7;
    --gray-100: #f0ebdd;
    --gray-200: #e1dacb;
    --gray-300: #d0c8b8;
    --gray-400: #a59e91;
    --gray-500: #777267;
    --gray-600: #5d594f;
    --gray-700: #46433b;
    --gray-800: #2c2b27;
    --gray-900: #20201e;

    --bg-body: #f8f3e7;
    --bg-surface: #fffdf7;
    --bg-elevated: #fffefb;
    --bg-subtle: #f0ebdd;
    --bg-hover: #f7f1e5;
    --bg-active: #ece4d5;
    --bg-inset: #e5dfd2;

    --text-primary: #24231f;
    --text-secondary: #57544c;
    --text-tertiary: #777267;
    --text-quaternary: #938d80;
    --text-on-primary: #fffdf7;
    --text-on-danger: #ffffff;

    --border-subtle: #eee8dc;
    --border-default: #ddd6c8;
    --border-strong: #c7beae;
    --border-focus: #80506a;

    --shadow-xs: 0 1px 2px rgba(43, 37, 27, .035);
    --shadow-sm: 0 2px 5px rgba(43, 37, 27, .045);
    --shadow-md: 0 5px 14px rgba(43, 37, 27, .07);
    --shadow-lg: 0 12px 28px rgba(43, 37, 27, .13);
    --shadow-xl: 0 20px 44px rgba(43, 37, 27, .17);

    --radius-sm: 5px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --sidebar-width: 248px;
    --sidebar-collapsed: 68px;
    --topbar-height: 64px;
    --transition-fast: 140ms ease-out;
    --transition-base: 180ms ease-out;
    --transition-slow: 240ms ease-out;
    --font-sans: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-display: 'Bricolage Grotesque', 'DM Sans', sans-serif;

    --status-not-started-bg: #f9e9e8;
    --status-not-started-text: #a43e39;
    --status-in-progress-bg: #fbf0d4;
    --status-in-progress-text: #8a5a08;
    --status-done-bg: #e5efdf;
    --status-done-text: #42683b;
}
html[data-theme="dark"] {
    color-scheme: dark;
    --primary-50: rgba(213, 160, 190, .12);
    --primary-100: rgba(213, 160, 190, .19);
    --primary-200: rgba(213, 160, 190, .28);
    --primary-300: #e0b3cb;
    --primary-400: #d5a0be;
    --primary-500: #d5a0be;
    --primary-600: #e4bdd2;
    --primary-700: #f0d7e5;
    --primary-800: #f7eaf1;
    --primary-900: #fff4fa;

    --bg-body: #1d1d1a;
    --bg-surface: #272723;
    --bg-elevated: #302f2a;
    --bg-subtle: #302f2a;
    --bg-hover: #383730;
    --bg-active: #414036;
    --bg-inset: #171714;
    --text-primary: #f5f0e5;
    --text-secondary: #d2cbbb;
    --text-tertiary: #b0a999;
    --text-quaternary: #8e887a;
    --border-subtle: #35342e;
    --border-default: #45443b;
    --border-strong: #5b594f;
    --border-focus: #e0b3cb;
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, .15);
    --shadow-sm: 0 2px 5px rgba(0, 0, 0, .18);
    --shadow-md: 0 5px 14px rgba(0, 0, 0, .24);
    --shadow-lg: 0 12px 28px rgba(0, 0, 0, .32);
    --shadow-xl: 0 20px 44px rgba(0, 0, 0, .4);
    --status-not-started-bg: rgba(220, 95, 85, .15);
    --status-not-started-text: #f19a91;
    --status-in-progress-bg: rgba(227, 177, 71, .15);
    --status-in-progress-text: #efc56d;
    --status-done-bg: rgba(123, 166, 105, .16);
    --status-done-text: #b0d49d;
}

/* Global rhythm and typography */
html { scroll-padding-top: calc(var(--topbar-height) + 16px); }
body {
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.55;
    background: var(--bg-body);
}
h1, h2, h3, h4, .page-header h1, .card-header h2, .card-header h3 {
    font-family: var(--font-display);
    letter-spacing: -.025em;
}
a, button, input, select, textarea { -webkit-tap-highlight-color: transparent; }
:where(button, a, input, select, textarea, summary, [tabindex]):focus-visible {
    outline: 2px solid var(--border-focus);
    outline-offset: 3px;
}
::selection { background: var(--primary-200); color: #20201e; }

/* App shell: dark, quiet navigation against a warm workspace */
.topbar {
    height: var(--topbar-height);
    padding-inline: clamp(12px, 2vw, 28px);
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-default);
    box-shadow: none;
}
.topbar-brand { min-width: 0; gap: 10px; }
.topbar-brand .brand-logo-btn {
    background: #20201e;
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 9px;
    color: #fffdf7;
}
.topbar-brand .brand-title-input {
    font-family: var(--font-display);
    font-size: 1.18rem;
    font-weight: 700;
    width: 92px;
}
.topbar-brand .course-title-input {
    min-width: 0;
    width: min(38vw, 440px);
    max-width: 440px;
    border-left: 1px solid var(--border-default);
    border-radius: 0;
    padding-left: 14px;
}
.topbar-actions { gap: 8px; }
.topbar-actions > button {
    min-height: 38px;
    border-radius: 8px;
}
.sidebar {
    background: #171715;
    color: #f5f0e5;
    border-right: 1px solid #302f2a;
    box-shadow: none;
}
.sidebar-nav { padding: 18px 12px 12px; }
.nav-section { margin-bottom: 24px; }
.nav-section-label {
    color: #9d998e;
    font-size: 10px;
    letter-spacing: .1em;
    padding-inline: 12px;
    margin-bottom: 8px;
}
.nav-item {
    color: #c9c4b8;
    min-height: 39px;
    gap: 11px;
    padding: 9px 12px;
    border-radius: 7px;
    font-size: 13px;
    font-weight: 500;
    transition: background-color 140ms ease-out, color 140ms ease-out;
}
.nav-item:hover { background: #292824; color: #fffdf7; }
.nav-item:active { background: #34322d; }
.nav-item.active {
    background: #39312f;
    color: #f0c5dc;
}
.nav-item.active .nav-icon { color: #e7a9cd; }
.nav-item .nav-icon { font-size: 16px; color: #a7a194; }
.nav-item.nav-sub-item { padding-left: 34px; }
.sidebar.collapsed .nav-item.nav-sub-item { padding-left: 12px; }
.sidebar-footer { border-top-color: #302f2a; }
.sidebar-footer .nav-item { color: #aaa497; }
.sidebar-toggle {
    border: 1px solid var(--border-default);
    background: var(--bg-subtle);
    color: var(--text-secondary);
    min-width: 34px;
    min-height: 34px;
}
.sidebar-toggle:hover { background: var(--bg-active); color: var(--text-primary); }
.main-content {
    padding: clamp(18px, 2.4vw, 34px);
    max-width: calc(100% - var(--sidebar-width));
    min-width: 0;
}
.sidebar.collapsed ~ .main-content {
    max-width: calc(100% - var(--sidebar-collapsed));
}
.page-header {
    margin-bottom: 28px;
    padding: 4px 0 20px;
    border-bottom: 1px solid var(--border-default);
}
.page-header h1 {
    font-size: clamp(1.8rem, 2.1vw, 2.35rem);
    line-height: 1.12;
    font-weight: 700;
    color: var(--text-primary);
}
.page-header p {
    max-width: 66ch;
    margin-top: 8px;
    color: var(--text-secondary);
    font-size: .95rem;
}

/* Panels: mostly outlined, elevation reserved for overlays */
.card, .accordion {
    border: 1px solid var(--border-default);
    border-radius: 11px;
    background: var(--bg-surface);
    box-shadow: none;
}
.card:hover, .accordion:hover { box-shadow: none; }
.card-header {
    padding: 15px 18px;
    border-bottom-color: var(--border-subtle);
}
.card-body { padding: 18px; }
.accordion summary {
    padding: 15px 18px;
    background: var(--bg-surface);
    font-size: .92rem;
    gap: 11px;
}
.accordion summary:hover { background: var(--bg-hover); }
.accordion summary::before {
    border-radius: 6px;
    background: var(--primary-100);
    color: var(--primary-700);
}
.accordion[open] > summary { border-bottom: 1px solid var(--border-subtle); }
.accordion-content { padding: clamp(14px, 2vw, 22px); }

/* Controls: quiet borders, deliberate action hierarchy */
.btn {
    min-height: 36px;
    padding: 8px 13px;
    border-radius: 7px;
    font-weight: 600;
    transition: background-color 140ms ease-out, border-color 140ms ease-out, color 140ms ease-out;
}
.btn:active { transform: none; }
.btn-primary {
    background: #262622;
    border-color: #262622;
    color: #fffdf7;
}
.btn-primary:hover { background: #3a3933; border-color: #3a3933; }
.btn-info {
    background: #324c42;
    border-color: #324c42;
    color: #fffdf7;
}
.btn-info:hover { background: #263c33; border-color: #263c33; }
.btn-secondary {
    background: var(--bg-surface);
    border-color: var(--border-default);
    color: var(--text-primary);
}
.btn-secondary:hover { background: var(--bg-hover); border-color: var(--border-strong); }
.btn-danger { background: #b84640; border-color: #b84640; }
.btn-ghost:hover { background: var(--bg-subtle); }
.btn-icon, .btn-icon-sm { flex-shrink: 0; }
.form-label { color: var(--text-secondary); font-size: .82rem; font-weight: 600; }
.form-input, .form-select, .form-textarea {
    min-height: 40px;
    padding: 9px 11px;
    border-radius: 7px;
    border-color: var(--border-default);
    background-color: var(--bg-surface);
    font-size: .9rem;
    transition: border-color 140ms ease-out, box-shadow 140ms ease-out;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--border-focus) 17%, transparent);
}

/* Table is a work surface; preserve its contained scroll and stable action lane */
.data-table-wrapper {
    border: 1px solid var(--border-default);
    border-radius: 11px;
    background: var(--bg-surface);
    box-shadow: none;
    scrollbar-color: var(--border-strong) transparent;
}
.data-table { border-collapse: separate; border-spacing: 0; }
.data-table thead th {
    background: var(--bg-subtle);
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-default);
    font-size: 10px;
    letter-spacing: .07em;
    font-weight: 700;
    padding: 13px 14px;
}
.data-table tbody td {
    padding: 13px 14px;
    border-bottom-color: var(--border-subtle);
    font-size: 13px;
}
.data-table tbody tr:hover { background: var(--bg-hover); }
.data-table tbody td:last-child {
    background: var(--bg-surface);
    box-shadow: -7px 0 10px rgba(32, 32, 30, .045);
}
.data-table thead th:last-child { background: var(--bg-subtle); }
.data-table tbody tr:hover td:last-child { background: var(--bg-hover); }
.data-table tbody td:last-child button {
    border-radius: 7px;
    min-width: 34px;
    min-height: 34px;
}
.status-badge { padding: 4px 9px; font-size: 11px; font-weight: 650; }
.progress-track { height: 5px; background: var(--bg-inset); }
.progress-fill { background: var(--primary-500); }
.grade-badge { border-radius: 7px; }
.data-cards-view .data-card,
.data-cards-view .syllabus-card {
    border: 1px solid var(--border-default);
    border-radius: 11px;
    background: var(--bg-surface);
    box-shadow: none;
}

/* Dialogs: clear edge, calm surface, useful depth */
.modal-overlay {
    background: rgba(24, 23, 20, .56);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
}
.modal-panel, .modal-content, .detail-modal-panel {
    border: 1px solid var(--border-default);
    border-radius: 13px;
    box-shadow: var(--shadow-lg);
}
.modal-header, .detail-modal-header {
    border-bottom-color: var(--border-subtle);
}
.modal-footer, .detail-modal-footer {
    border-top-color: var(--border-subtle);
    background: var(--bg-surface);
}
.modal-close {
    border-radius: 7px;
    transition: background-color 140ms ease-out, color 140ms ease-out;
}
.modal-close:hover { background: var(--bg-subtle); }

/* Schedule and calendar surfaces inherit the same token language. */
#schedule-section .accordion-content { padding: 14px; }
#schedule-calendar-view { color: var(--text-primary); }
.gantt-container, .gantt-labels-panel, .gantt-timeline-panel {
    border-color: var(--border-default);
}
.gantt-header { background: var(--bg-subtle); }
.gantt-labels-panel { background: var(--bg-surface); }
.gantt-labels-body { background: var(--bg-surface); }
.gantt-timeline-panel { background: var(--bg-surface); }

/* Avoid overflow from long titles, code, links, and nested widgets. */
.main-content, .page-header, .accordion, .accordion-content,
.card, .card-body, .modal-panel, .modal-body { min-width: 0; }
.page-header p, .threads-bio, .detail-modal-title { overflow-wrap: anywhere; }
img, video, iframe { max-width: 100%; }
.data-table-wrapper { max-width: 100%; overscroll-behavior-x: contain; }
.data-table tbody td:last-child > div {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-width: max-content;
}
.fab-container { z-index: 25; }
.sticky-note-panel { z-index: 80; }

/* Tablet: compact topbar and controlled content width. */
@media (max-width: 1024px) {
    :root { --sidebar-width: 220px; }
    .main-content { padding: 20px; }
    .topbar { padding-inline: 14px; }
    .topbar-brand { flex: 1; min-width: 0; }
    .topbar-brand .course-title-input { max-width: 32vw; }
    .data-table { min-width: 1060px; }
}

/* Mobile uses the app's existing card view and bottom navigation. */
@media (max-width: 768px) {
    :root { --topbar-height: 58px; }
    .topbar { gap: 8px; padding-inline: 10px; }
    .topbar-brand { gap: 7px; }
    .topbar-brand .brand-logo-btn { width: 30px; height: 30px; }
    .topbar-brand .brand-title-input { width: 72px; font-size: 1.05rem; }
    .topbar-brand .course-title-input {
        min-width: 0;
        width: auto;
        max-width: none;
        flex: 1;
        font-size: .8rem;
        padding-left: 8px;
    }
    .topbar-actions { gap: 4px; }
    .topbar-actions > button { min-width: 36px; min-height: 36px; }
    .main-content {
        margin-left: 0;
        margin-top: var(--topbar-height);
        padding: 18px 14px calc(92px + env(safe-area-inset-bottom, 0px));
        max-width: 100%;
        width: 100%;
    }
    .page-header { margin-bottom: 20px; padding-bottom: 16px; }
    .page-header h1 { font-size: clamp(1.55rem, 5vw, 2rem); }
    .page-header p { font-size: .88rem; }
    .accordion summary { padding: 13px 14px; }
    .accordion-content { padding: 14px; }
    .card-header { padding: 13px 14px; }
    .card-body { padding: 14px; }
    .data-table-wrapper { display: none !important; }
    .data-cards-view { display: flex !important; flex-direction: column; gap: 12px; }
    .data-table tbody td:last-child { box-shadow: none; }
    .fab-container { display: none !important; }
    .mobile-bottom-nav {
        z-index: 95;
        background: var(--bg-surface);
        border-top: 1px solid var(--border-default);
        box-shadow: 0 -5px 20px rgba(32, 32, 30, .06);
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }
    .mobile-nav-item { min-height: 52px; color: var(--text-tertiary); }
    .mobile-nav-item.active { color: var(--primary-700); }
    .mobile-nav-item.active i { color: var(--primary-600); }
    .modal-overlay { padding: 12px; }
    .modal-panel, .modal-content {
        max-width: 100%;
        max-height: calc(100dvh - 24px);
        overflow-y: auto;
    }
    .sticky-note-panel {
        max-width: calc(100vw - 24px);
        max-height: calc(100dvh - 100px);
    }
}
@media (max-width: 420px) {
    .topbar-brand .course-title-input { display: none; }
    .topbar-brand .brand-title-input { width: 76px; }
    .topbar-actions #gdsync-topbar-btn .gdsync-topbar-label { display: none; }
    .main-content { padding-inline: 11px; }
    .form-grid { grid-template-columns: minmax(0, 1fr); }
    .btn { max-width: 100%; }
    .accordion-content { padding: 11px; }
    .mobile-nav-item { font-size: 10px; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        scroll-behavior: auto !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}
/* Deadline notification: redesigned information hierarchy, not just recolored. */
.due-notification-toast{
  position:fixed!important;right:22px!important;bottom:22px!important;
  width:min(410px,calc(100vw - 32px))!important;max-width:410px!important;
  padding:0!important;gap:0!important;overflow:hidden!important;
  color:#172033!important;background:#fff!important;
  border:1px solid #dbe3ef!important;border-top:3px solid #2563eb!important;border-left:1px solid #dbe3ef!important;
  border-radius:16px!important;box-shadow:0 22px 54px rgba(20,35,60,.22)!important;
}
.due-toast-header{
  display:flex;align-items:center;justify-content:space-between;
  min-height:62px;padding:13px 16px!important;
  color:#15233a!important;background:#fff!important;border-bottom:1px solid #e7edf5;
  font-size:.9rem!important;font-weight:800!important;
}
.due-toast-header>span{display:flex;align-items:center;gap:10px}
.due-toast-header>span>i{
  display:inline-flex;align-items:center;justify-content:center;
  width:34px;height:34px;margin:0!important;border-radius:11px;
  color:#2455b8!important;background:#e8f0ff;font-size:.9rem;
}
.due-toast-header button{
  display:inline-flex;align-items:center;justify-content:center;width:30px;height:30px;
  border-radius:9px;color:#718096!important;background:transparent!important;
}
.due-toast-header button:hover{background:#f0f4fa!important;color:#15233a!important}
.due-toast-list{
  display:flex;flex-direction:column;gap:8px!important;
  max-height:250px!important;overflow-y:auto!important;padding:12px!important;
  background:#f7f9fc!important;font-size:.8rem!important;
  scrollbar-width:thin;scrollbar-color:#cbd5e1 transparent;
}
.due-notification-item{
  display:grid;grid-template-columns:34px minmax(0,1fr) auto;align-items:center;gap:10px;
  padding:11px 10px!important;border:1px solid #e3e9f2!important;border-left:3px solid #d49a20!important;
  border-radius:12px!important;background:#fff!important;color:#25344a!important;
  box-shadow:0 2px 4px rgba(23,42,70,.035);min-width:0;
}
.due-notification-item.is-overdue{border-left-color:#e05252!important}
.due-notification-item.is-today{border-left-color:#d97706!important}
.due-notification-item.is-upcoming{border-left-color:#5686f5!important}
.due-item-icon{
  display:flex;align-items:center;justify-content:center;width:32px;height:32px;
  border-radius:10px;color:#a16207;background:#fff2cf;font-size:.9rem;
}
.due-notification-item.is-overdue .due-item-icon{color:#b42332;background:#ffeaec}
.due-notification-item.is-upcoming .due-item-icon{color:#2455b8;background:#eaf1ff}
.due-item-copy{display:flex;flex-direction:column;gap:4px;min-width:0}
.due-item-title{display:block;color:#243247;font-size:.8rem;font-weight:750;line-height:1.35;overflow-wrap:anywhere}
.due-item-meta{display:block;color:#778399;font-size:.7rem;line-height:1.35;font-weight:550}
.due-item-status{
  justify-self:end;align-self:center;max-width:100px;padding:5px 7px;border-radius:7px;
  background:#edf3ff;color:#315da7;font-size:.65rem;font-weight:800;line-height:1.25;text-align:center;
}
.due-notification-item.is-overdue .due-item-status{background:#ffeaec;color:#b42332}
.due-notification-item.is-today .due-item-status{background:#fff2cf;color:#985b08}
html[data-theme="dark"] .due-notification-toast{
  color:#f3f6fb!important;background:#172538!important;border-color:#3b4d63!important;
  border-top-color:#6f9dff!important;box-shadow:0 22px 54px rgba(0,0,0,.42)!important;
}
html[data-theme="dark"] .due-toast-header{color:#f3f6fb!important;background:#172538!important;border-bottom-color:#354961}
html[data-theme="dark"] .due-toast-header>span>i{color:#a9c6ff!important;background:#243b5d}
html[data-theme="dark"] .due-toast-header button{color:#c5d0df!important}
html[data-theme="dark"] .due-toast-header button:hover{background:#2a3d54!important;color:#fff!important}
html[data-theme="dark"] .due-toast-list{background:#101d2d!important}
html[data-theme="dark"] .due-notification-item{background:#1b2b40!important;color:#e7edf6!important;border-color:#354961!important}
html[data-theme="dark"] .due-item-title{color:#f3f6fb!important}
html[data-theme="dark"] .due-item-meta{color:#b5c2d4!important}
html[data-theme="dark"] .due-item-status{color:#c6d9ff;background:#263d60}
html[data-theme="dark"] .due-notification-item.is-overdue .due-item-status{color:#ffc0c5;background:#512b38}
html[data-theme="dark"] .due-notification-item.is-today .due-item-status{color:#ffdfa0;background:#4c3a20}
html[data-theme="dark"] .due-notification-item.is-overdue .due-item-icon{color:#ffb7bf;background:#512b38}
html[data-theme="dark"] .due-notification-item.is-upcoming .due-item-icon{color:#b5ceff;background:#263d60}
@media(max-width:600px){
  .due-notification-toast{left:12px!important;right:12px!important;bottom:76px!important;width:auto!important;max-width:none!important}
  .due-toast-list{max-height:34vh!important}
  .due-notification-item{grid-template-columns:30px minmax(0,1fr);gap:8px;padding:10px!important}
  .due-item-status{grid-column:2;justify-self:start;max-width:none}
  .due-item-icon{width:29px;height:29px}
}


/* Google Drive backup status — compact, app-native surface with clear state accent. */
#gdsync-topbar-btn .gdsync-topbar-badge.pending{background:#d69e18}
#gdsync-topbar-btn .gdsync-topbar-badge.success{background:#25845b}
#gdsync-topbar-btn .gdsync-topbar-badge.warning{background:#d69e18}
#gdsync-topbar-btn .gdsync-topbar-badge.error{background:#c74747}
#gdsync-topbar-btn[data-backup-state="pending"]{border-color:#d69e18}
#gdsync-topbar-btn[data-backup-state="success"]{border-color:#25845b}
#gdsync-topbar-btn[data-backup-state="warning"]{border-color:#d69e18}
#gdsync-topbar-btn[data-backup-state="error"]{border-color:#c74747}
.gdsync-autobackup-indicator{
 display:flex;align-items:center;gap:12px;padding:14px 15px;margin:12px 0 14px;
 border:1px solid var(--line,#d8d5cd);border-left:3px solid var(--line,#d8d5cd);
 border-radius:13px;background:var(--surface,#fffdf8);color:var(--ink,#202724);
 box-shadow:0 2px 8px rgba(25,35,30,.035);transition:border-color .18s,background .18s;
}
.gdsync-autobackup-indicator-icon{
 display:grid;place-items:center;width:38px;height:38px;flex:0 0 38px;border-radius:11px;
 background:var(--paper,#f1efe7);color:var(--muted,#64716b);font-size:21px;
}
.gdsync-autobackup-indicator-copy{display:flex;flex:1;min-width:0;flex-direction:column;gap:4px}
.gdsync-autobackup-indicator-copy strong{font-size:.88rem;line-height:1.3;font-weight:650;color:var(--ink,#202724)}
.gdsync-autobackup-indicator-copy span{color:var(--muted,#64716b);font-size:.78rem;line-height:1.45;overflow-wrap:anywhere}
.gdsync-autobackup-indicator-time{flex:0 0 auto;align-self:flex-start;padding-top:2px;font-size:.7rem;color:var(--muted,#64716b);font-variant-numeric:tabular-nums}
.gdsync-autobackup-indicator[data-state="pending"]{border-color:#d69e18;background:color-mix(in srgb,#d69e18 7%,var(--surface,#fffdf8))}
.gdsync-autobackup-indicator[data-state="pending"] .gdsync-autobackup-indicator-icon{background:color-mix(in srgb,#d69e18 14%,var(--surface,#fffdf8));color:#a87900}
.gdsync-autobackup-indicator[data-state="syncing"]{border-color:var(--cobalt,#3568e8);background:color-mix(in srgb,var(--cobalt,#3568e8) 5%,var(--surface,#fffdf8))}
.gdsync-autobackup-indicator[data-state="syncing"] .gdsync-autobackup-indicator-icon{background:color-mix(in srgb,var(--cobalt,#3568e8) 13%,var(--surface,#fffdf8));color:var(--cobalt,#3568e8);animation:gdsync-icon-spin 1.4s linear infinite}
.gdsync-autobackup-indicator[data-state="success"]{border-color:#25845b;background:color-mix(in srgb,#25845b 5%,var(--surface,#fffdf8))}
.gdsync-autobackup-indicator[data-state="success"] .gdsync-autobackup-indicator-icon{background:color-mix(in srgb,#25845b 13%,var(--surface,#fffdf8));color:#25845b}
.gdsync-autobackup-indicator[data-state="error"]{border-color:#c74747;background:color-mix(in srgb,#c74747 5%,var(--surface,#fffdf8))}
.gdsync-autobackup-indicator[data-state="error"] .gdsync-autobackup-indicator-icon{background:color-mix(in srgb,#c74747 13%,var(--surface,#fffdf8));color:#c74747}
.gdsync-autobackup-indicator[data-state="warning"]{border-color:#d69e18;background:color-mix(in srgb,#d69e18 6%,var(--surface,#fffdf8))}
.gdsync-autobackup-indicator[data-state="warning"] .gdsync-autobackup-indicator-icon{background:color-mix(in srgb,#d69e18 13%,var(--surface,#fffdf8));color:#a87900}
@media(max-width:480px){
 .gdsync-autobackup-indicator{gap:10px;padding:12px}
 .gdsync-autobackup-indicator-icon{width:34px;height:34px;flex-basis:34px;font-size:19px}
 .gdsync-autobackup-indicator-time{font-size:.66rem}
}
@media(prefers-reduced-motion:reduce){.gdsync-autobackup-indicator[data-state="syncing"] .gdsync-autobackup-indicator-icon{animation:none}}

/* Cloud Sync modal layout + reliable hit targets (2026-10-09). */
#gdsync-modal{z-index:2147483000!important;isolation:isolate;pointer-events:auto!important}
#gdsync-modal.active{display:flex!important;opacity:1!important;visibility:visible!important;pointer-events:auto!important}
#gdsync-modal .gdsync-modal-content{width:min(640px,calc(100vw - 32px))!important;max-width:640px!important;max-height:min(88dvh,820px)!important;height:auto!important;margin:auto!important;border-radius:20px!important;overflow:hidden!important;display:flex!important;flex-direction:column!important}
#gdsync-modal .gdsync-modal-header{flex:0 0 auto!important;padding:18px 22px!important}
#gdsync-modal .gdsync-modal-body{flex:1 1 auto!important;min-height:0!important;overflow-y:auto!important;padding:24px clamp(18px,4vw,32px) 26px!important}
#gdsync-modal .gdsync-view{gap:14px!important}
#gdsync-modal .gdsync-hero{margin:2px 0 4px!important;max-height:76px!important;overflow:hidden!important;pointer-events:none!important}
#gdsync-modal .gdsync-google-g,#gdsync-modal .gdsync-google-g svg{width:64px!important;height:64px!important;max-width:64px!important;max-height:64px!important;flex:0 0 64px!important}
#gdsync-modal .gdsync-title{text-align:left!important;font-size:clamp(1.35rem,2.4vw,1.7rem)!important;line-height:1.2!important}
#gdsync-modal .gdsync-subtitle{text-align:left!important;font-size:.95rem!important;line-height:1.55!important;margin:0!important;max-width:58ch}
#gdsync-modal .gdsync-btn-google{position:relative!important;z-index:2!important;pointer-events:auto!important;touch-action:manipulation!important;min-height:52px!important;width:100%!important;margin:8px 0 0!important;border-radius:12px!important}
#gdsync-modal .gdsync-btn-google *{pointer-events:none!important}
#gdsync-modal .gdsync-trust{display:flex!important;flex-wrap:wrap!important;justify-content:flex-start!important;gap:8px!important;margin-top:2px!important}
#gdsync-modal .gdsync-trust-item{font-size:.78rem!important;padding:9px 11px!important;border-radius:10px!important}
#gdsync-modal .gdsync-advanced{margin-top:4px!important;border-radius:12px!important}
#gdsync-modal .gdsync-advanced summary{cursor:pointer!important;min-height:48px!important;display:flex!important;align-items:center!important;gap:10px!important}
#gdsync-modal .gdsync-advanced-content{padding:12px 14px!important}
#gdsync-modal .gdsync-close-btn{position:relative!important;z-index:3!important;pointer-events:auto!important;touch-action:manipulation!important}
#gdsync-modal .gdsync-close-btn *{pointer-events:none!important}
#gdsync-modal .gdsync-status:empty{display:none!important}
@media(max-width:600px){#gdsync-modal .gdsync-modal-content{width:calc(100vw - 20px)!important;max-height:90dvh!important;border-radius:16px!important}#gdsync-modal .gdsync-modal-header{padding:14px 16px!important}#gdsync-modal .gdsync-modal-body{padding:18px 16px 20px!important}#gdsync-modal .gdsync-hero{display:none!important}#gdsync-modal .gdsync-trust{display:grid!important;grid-template-columns:1fr!important}#gdsync-modal .gdsync-trust-item{justify-content:flex-start!important}}

/* OAuth button feedback */
#gdsync-modal .gdsync-btn-google[aria-busy="true"]{opacity:.72;cursor:progress}
#gdsync-modal .gdsync-btn-google:focus-visible{outline:3px solid var(--primary-500,#3568e8);outline-offset:3px}

/* Cloud Sync compact editorial layout — prevent the Google mark from expanding into a hero. */
#gdsync-modal .gdsync-modal-content{width:min(560px,calc(100vw - 28px))!important;max-width:560px!important;max-height:min(82dvh,700px)!important;border-radius:20px!important}
#gdsync-modal .gdsync-modal-header{padding:18px 22px!important}
#gdsync-modal .gdsync-modal-body{padding:22px 24px 24px!important}
#gdsync-modal #gdsync-view-signin{gap:12px!important}
#gdsync-modal .gdsync-hero{display:none!important}
#gdsync-modal .gdsync-title{font-size:clamp(1.35rem,2vw,1.6rem)!important;text-align:left!important;margin:0!important}
#gdsync-modal .gdsync-subtitle{text-align:left!important;margin:0!important;font-size:.92rem!important}
#gdsync-modal .gdsync-btn-google{margin-top:8px!important;min-height:52px!important}
#gdsync-modal .gdsync-trust{justify-content:flex-start!important;gap:8px!important;margin-top:2px!important}
#gdsync-modal .gdsync-advanced{margin-top:4px!important}
#gdsync-modal .gdsync-status:not(:empty){display:block!important;padding:8px 0!important}
@media(max-width:600px){
 #gdsync-modal .gdsync-modal-content{width:calc(100vw - 24px)!important;max-height:84dvh!important;border-radius:16px!important}
 #gdsync-modal .gdsync-modal-header{padding:14px 16px!important}
 #gdsync-modal .gdsync-modal-body{padding:18px 16px 20px!important}
 #gdsync-modal .gdsync-trust{display:grid!important;grid-template-columns:1fr!important}
}

/* Cloud Sync sign-in: compact, stable layout. The oversized decorative Google SVG
   is removed from the template; these rules constrain the content across browsers. */
#gdsync-modal .gdsync-modal-content{width:min(520px,calc(100vw - 32px))!important;max-width:520px!important;max-height:min(80dvh,660px)!important;height:auto!important;overflow:hidden!important}
#gdsync-modal .gdsync-modal-body{padding:24px!important;overflow-y:auto!important;min-height:0!important}
#gdsync-modal #gdsync-view-signin{display:flex!important;flex-direction:column!important;align-items:stretch!important;gap:14px!important}
#gdsync-modal #gdsync-view-signin .gdsync-hero{display:none!important;position:static!important;width:0!important;height:0!important;margin:0!important;padding:0!important;overflow:hidden!important}
#gdsync-modal #gdsync-view-signin .gdsync-title{font-size:1.55rem!important;line-height:1.25!important;text-align:left!important;margin:0!important}
#gdsync-modal #gdsync-view-signin .gdsync-subtitle{text-align:left!important;max-width:48ch!important;line-height:1.55!important;margin:0!important}
#gdsync-modal #gdsync-view-signin .gdsync-status:empty{display:none!important}
#gdsync-modal #gdsync-view-signin .gdsync-btn-google{width:100%!important;min-height:52px!important;margin:2px 0 0!important}
#gdsync-modal #gdsync-view-signin .gdsync-trust{display:grid!important;grid-template-columns:repeat(3,minmax(0,1fr))!important;gap:8px!important;padding:12px 0 0!important;border-top:1px solid var(--border-subtle,#e5e7eb)!important}
#gdsync-modal #gdsync-view-signin .gdsync-trust-item{display:flex!important;flex-direction:row!important;align-items:center!important;justify-content:center!important;gap:6px!important;padding:9px 7px!important;background:var(--bg-subtle,#f4f2eb)!important;border:1px solid var(--border-default,#dedbd1)!important;border-radius:10px!important;font-size:.72rem!important;line-height:1.25!important}
#gdsync-modal #gdsync-view-signin .gdsync-advanced{margin-top:0!important}
#gdsync-modal #gdsync-view-signin .gdsync-advanced summary{min-height:48px!important;padding:10px 12px!important}
@media(max-width:600px){
 #gdsync-modal .gdsync-modal-content{width:calc(100vw - 24px)!important;max-height:82dvh!important;border-radius:16px!important}
 #gdsync-modal .gdsync-modal-body{padding:20px 16px!important}
 #gdsync-modal #gdsync-view-signin .gdsync-title{font-size:1.35rem!important}
 #gdsync-modal #gdsync-view-signin .gdsync-trust{grid-template-columns:1fr!important}
 #gdsync-modal #gdsync-view-signin .gdsync-trust-item{justify-content:flex-start!important;padding:10px 12px!important}
}


/* Final responsive Cloud Sync layout: explicit sizing beats global modal-panel rules. */
#gdsync-modal{position:fixed!important;inset:0!important;box-sizing:border-box!important;padding:clamp(12px,3vh,28px) 12px!important;display:none;align-items:center!important;justify-content:center!important;overflow:auto!important}
#gdsync-modal.active{display:flex!important}
#gdsync-modal>.modal-panel.gdsync-modal-content,
#gdsync-modal .modal-panel.gdsync-modal-content{
 position:relative!important;inset:auto!important;flex:0 1 auto!important;align-self:center!important;
 width:min(520px,calc(100vw - 24px))!important;min-width:0!important;max-width:520px!important;
 height:auto!important;min-height:0!important;max-height:calc(100dvh - 32px)!important;
 margin:0 auto!important;transform:none!important;box-sizing:border-box!important;
 display:flex!important;flex-direction:column!important;overflow:hidden!important;
}
#gdsync-modal .gdsync-modal-header{box-sizing:border-box!important;min-width:0!important}
#gdsync-modal .gdsync-modal-body{box-sizing:border-box!important;width:100%!important;min-width:0!important;overflow-y:auto!important;overscroll-behavior:contain!important}
#gdsync-modal #gdsync-view-signin{width:100%!important;min-width:0!important;box-sizing:border-box!important}
#gdsync-modal #gdsync-view-signin>*{max-width:100%!important;box-sizing:border-box!important}
#gdsync-modal #gdsync-view-signin .gdsync-title{font-size:clamp(1.25rem,2.5vw,1.6rem)!important;line-height:1.25!important}
#gdsync-modal #gdsync-view-signin .gdsync-subtitle{font-size:clamp(.88rem,1.5vw,.98rem)!important;overflow-wrap:anywhere!important}
#gdsync-modal #gdsync-view-signin .gdsync-trust{grid-template-columns:repeat(3,minmax(0,1fr))!important;align-items:stretch!important}
#gdsync-modal #gdsync-view-signin .gdsync-trust-item{min-width:0!important;overflow-wrap:anywhere!important}
#gdsync-modal #gdsync-view-signin .gdsync-btn-google{flex-shrink:0!important;opacity:1!important;cursor:pointer!important;touch-action:manipulation!important}
@media(max-width:600px){
 #gdsync-modal{padding:12px!important;align-items:center!important}
 #gdsync-modal>.modal-panel.gdsync-modal-content,#gdsync-modal .modal-panel.gdsync-modal-content{
  width:100%!important;max-width:480px!important;max-height:calc(100dvh - 24px)!important;border-radius:16px!important
 }
 #gdsync-modal .gdsync-modal-header{padding:14px 16px!important}
 #gdsync-modal .gdsync-modal-body{padding:18px 16px 20px!important}
 #gdsync-modal #gdsync-view-signin .gdsync-trust{grid-template-columns:1fr!important}
 #gdsync-modal #gdsync-view-signin .gdsync-trust-item{justify-content:flex-start!important}
}
@media(max-height:560px){
 #gdsync-modal{align-items:flex-start!important;padding:8px!important}
 #gdsync-modal>.modal-panel.gdsync-modal-content,#gdsync-modal .modal-panel.gdsync-modal-content{max-height:calc(100dvh - 16px)!important}
 #gdsync-modal .gdsync-modal-body{padding-top:12px!important;padding-bottom:12px!important}
}
