:root {
    --bg: #f0f2f5;
    --surface: #ffffff;
    --surface-alt: #f8f9fc;
    --text: #1e293b;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --primary: #2563eb;
    --primary-light: #eff6ff;
    --primary-hover: #1d4ed8;
    --accent: #0ea5e9;
    --success: #10b981;
    --success-light: #ecfdf5;
    --warning: #f59e0b;
    --warning-light: #fffbeb;
    --danger: #ef4444;
    --danger-light: #fef2f2;
    --info: #6366f1;
    --info-light: #eef2ff;
    --border: #e2e8f0;
    --border-light: #f1f5f9;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
    --radius: 12px;
    --radius-sm: 8px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
}

/* ===== Navbar ===== */
.navbar {
    background: linear-gradient(135deg, #1e3a5f 0%, #2563eb 100%);
    padding: 0 28px;
    display: flex;
    align-items: center;
    gap: 16px;
    height: 56px;
    box-shadow: 0 2px 8px rgba(37,99,235,0.15);
}

.logo {
    font-size: 17px;
    font-weight: 700;
    color: #ffffff;
    text-decoration: none;
    letter-spacing: 0.3px;
}

.nav-sub {
    font-size: 13px;
    color: rgba(255,255,255,0.7);
    font-weight: 500;
    padding-left: 16px;
    border-left: 1px solid rgba(255,255,255,0.2);
}

.nav-sub a.nav-back {
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    transition: color 0.15s;
}

.nav-sub a.nav-back:hover {
    color: #ffffff;
}

/* ===== Layout ===== */
.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 28px 20px;
}

h2 { margin-bottom: 18px; font-size: 20px; font-weight: 700; color: var(--text); }
h3 { margin-bottom: 14px; font-size: 17px; font-weight: 600; color: var(--text); }

/* ===== Cards ===== */
.upload-section, .meetings-section, .result-section {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 28px;
    margin-bottom: 20px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

/* ===== Forms ===== */
.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    font-size: 13px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.form-group input[type="text"],
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: var(--surface);
}

.form-group input[type="text"]:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

.form-group input[type="file"] {
    font-size: 14px;
}

.form-group small {
    display: block;
    margin-top: 5px;
    color: var(--text-muted);
    font-size: 12px;
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 22px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    color: var(--text-secondary);
    background: var(--surface);
    transition: all 0.15s ease;
    gap: 6px;
}

.btn:hover { background: var(--surface-alt); border-color: #cbd5e1; }

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, #3b82f6 100%);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 2px 4px rgba(37,99,235,0.25);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-hover) 0%, #2563eb 100%);
    box-shadow: 0 3px 8px rgba(37,99,235,0.3);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--primary-light);
    color: var(--primary);
    border-color: #bfdbfe;
}

.btn-secondary:hover { background: #dbeafe; }

.btn-danger {
    color: var(--danger);
    border-color: #fecaca;
}

.btn-danger:hover { background: var(--danger-light); }

/* ===== Meetings List ===== */
.meetings-list { display: flex; flex-direction: column; gap: 10px; }

.meeting-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--text);
    transition: all 0.15s ease;
    background: var(--surface);
}

.meeting-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow);
    transform: translateY(-1px);
}

.meeting-title { font-weight: 600; margin-bottom: 4px; font-size: 15px; }

.meeting-meta {
    display: flex;
    gap: 10px;
    font-size: 12px;
    color: var(--text-muted);
    flex-wrap: wrap;
    align-items: center;
}

/* ===== Status Badges ===== */
.status {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.2px;
}

.status-uploaded { background: #f1f5f9; color: #64748b; }
.status-transcribing { background: #fef3c7; color: #b45309; }
.status-analyzing { background: #dbeafe; color: #1d4ed8; }
.status-completed { background: #dcfce7; color: #16a34a; }
.status-failed { background: #fee2e2; color: #dc2626; }

/* ===== Meeting Detail Header ===== */
.meeting-header {
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.meeting-header h2 {
    margin-bottom: 10px;
    font-size: 24px;
}

/* ===== Processing Box ===== */
.processing-box {
    display: flex;
    align-items: center;
    gap: 16px;
    background: linear-gradient(135deg, #eff6ff 0%, #f0f9ff 100%);
    border: 1px solid #bfdbfe;
    border-radius: var(--radius);
    padding: 22px 24px;
    margin-bottom: 20px;
}

.spinner {
    width: 28px;
    height: 28px;
    border: 3px solid #bfdbfe;
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    flex-shrink: 0;
}

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

/* ===== Alerts ===== */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: 14px;
    font-weight: 500;
}

.alert.error {
    background: var(--danger-light);
    color: #b91c1c;
    border: 1px solid #fecaca;
}

/* ===== Analysis Content (Key Section) ===== */
.analysis-content {
    line-height: 1.9;
    font-size: 15px;
    color: var(--text);
}

.analysis-content h2 {
    font-size: 18px;
    font-weight: 700;
    margin-top: 28px;
    margin-bottom: 14px;
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    gap: 8px;
}

.analysis-content h2:first-child {
    margin-top: 0;
}

.analysis-content h2:nth-of-type(1) {
    background: linear-gradient(135deg, #eff6ff 0%, #e0f2fe 100%);
    color: #1e40af;
    border-left: 4px solid #2563eb;
}

.analysis-content h2:nth-of-type(2) {
    background: linear-gradient(135deg, #f0fdf4 0%, #ecfdf5 100%);
    color: #166534;
    border-left: 4px solid #16a34a;
}

.analysis-content h2:nth-of-type(3) {
    background: linear-gradient(135deg, #fefce8 0%, #fffbeb 100%);
    color: #854d0e;
    border-left: 4px solid #eab308;
}

.analysis-content h2:nth-of-type(4) {
    background: linear-gradient(135deg, #faf5ff 0%, #f3e8ff 100%);
    color: #6b21a8;
    border-left: 4px solid #9333ea;
}

.analysis-content h2:nth-of-type(5) {
    background: linear-gradient(135deg, #fff1f2 0%, #ffe4e6 100%);
    color: #9f1239;
    border-left: 4px solid #e11d48;
}

.analysis-content h2:nth-of-type(n+6) {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    color: #0c4a6e;
    border-left: 4px solid #0284c7;
}

.analysis-content h3 {
    font-size: 16px;
    font-weight: 600;
    margin-top: 20px;
    margin-bottom: 10px;
    color: var(--text);
    padding-left: 12px;
    border-left: 3px solid var(--border);
}

.analysis-content p {
    margin-bottom: 12px;
    color: var(--text-secondary);
}

.analysis-content ul, .analysis-content ol {
    padding-left: 24px;
    margin: 10px 0 16px;
}

.analysis-content li {
    margin-bottom: 8px;
    color: var(--text-secondary);
    line-height: 1.8;
}

.analysis-content li::marker {
    color: var(--primary);
}

.analysis-content strong {
    color: var(--text);
    font-weight: 700;
}

.analysis-content blockquote {
    border-left: 3px solid var(--primary);
    background: var(--primary-light);
    padding: 12px 18px;
    margin: 12px 0;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    color: var(--text-secondary);
    font-style: italic;
}

.analysis-content code {
    background: var(--surface-alt);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 13px;
    color: var(--info);
}

.analysis-content hr {
    border: none;
    height: 1px;
    background: var(--border);
    margin: 24px 0;
}

.analysis-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 12px 0;
    font-size: 14px;
}

.analysis-content th {
    background: var(--surface-alt);
    padding: 10px 14px;
    text-align: left;
    font-weight: 600;
    color: var(--text);
    border-bottom: 2px solid var(--border);
}

.analysis-content td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-secondary);
}

.analysis-content tr:hover td {
    background: var(--surface-alt);
}

/* ===== Transcript ===== */
details {
    margin-top: 8px;
}

summary {
    cursor: pointer;
    color: var(--primary);
    font-weight: 600;
    font-size: 14px;
    padding: 8px 0;
    user-select: none;
}

summary:hover { color: var(--primary-hover); }

.transcript-content {
    margin-top: 12px;
    max-height: 500px;
    overflow-y: auto;
    font-size: 14px;
    padding: 4px 0;
}

.transcript-content::-webkit-scrollbar { width: 6px; }
.transcript-content::-webkit-scrollbar-track { background: var(--surface-alt); border-radius: 3px; }
.transcript-content::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
.transcript-content::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

.segment {
    padding: 8px 12px;
    border-radius: 6px;
    margin-bottom: 4px;
    transition: background 0.1s;
}

.segment:hover { background: var(--surface-alt); }

.timestamp {
    color: var(--accent);
    font-family: "SF Mono", "Fira Code", monospace;
    font-size: 12px;
    margin-right: 10px;
    font-weight: 500;
}

.speaker {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    margin-right: 8px;
    letter-spacing: 0.3px;
}

.segment:nth-child(odd) .speaker {
    color: #7c3aed;
    background: #f5f3ff;
}

.segment:nth-child(even) .speaker {
    color: #0891b2;
    background: #ecfeff;
}

/* ===== Actions ===== */
.actions {
    margin-top: 28px;
    display: flex;
    gap: 10px;
    padding-top: 20px;
    border-top: 1px solid var(--border-light);
}

/* ===== Recorder ===== */
.recorder-box {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 0;
}

.btn-record {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 22px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text);
}

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

.btn-record.recording {
    border-color: var(--danger);
    background: var(--danger-light);
    color: var(--danger);
    box-shadow: 0 0 0 3px rgba(239,68,68,0.1);
}

.rec-icon {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #cbd5e1;
    transition: background 0.2s;
}

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

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(1.3); }
}

.rec-timer {
    font-family: "SF Mono", "Fira Code", monospace;
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
    min-width: 50px;
}

.rec-status {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
}

/* ===== Responsive ===== */
@media (max-width: 640px) {
    .navbar { padding: 0 16px; gap: 10px; }
    .logo { font-size: 15px; }
    .nav-sub { font-size: 12px; padding-left: 10px; }
    .container { padding: 16px 12px; }
    .upload-section, .meetings-section, .result-section { padding: 20px 16px; }
    .meeting-card { padding: 12px 14px; }
    .meeting-header h2 { font-size: 20px; }
    .analysis-content h2 { font-size: 16px; padding: 8px 12px; }
}

/* ===== Dashboard ===== */
.dashboard-container {
    max-width: 1000px;
}

.dashboard-hero {
    text-align: center;
    padding: 48px 20px 36px;
}

.dashboard-hero h1 {
    font-size: 32px;
    font-weight: 800;
    background: linear-gradient(135deg, #1e3a5f 0%, #2563eb 60%, #0ea5e9 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 12px;
    letter-spacing: -0.5px;
}

.hero-desc {
    color: var(--text-muted);
    font-size: 16px;
    font-weight: 400;
}

.modules-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 18px;
    margin-bottom: 48px;
}

.module-card {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 28px 24px;
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    text-decoration: none;
    color: var(--text);
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}

.module-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    border-radius: 4px 0 0 4px;
    transition: width 0.2s;
}

.module-blue::before { background: #2563eb; }
.module-emerald::before { background: #10b981; }
.module-violet::before { background: #8b5cf6; }
.module-amber::before { background: #f59e0b; }

.module-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.module-card:hover::before {
    width: 6px;
}

.module-disabled {
    opacity: 0.55;
    cursor: default;
    pointer-events: none;
}

.module-icon {
    font-size: 36px;
    flex-shrink: 0;
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 16px;
}

.module-blue .module-icon { background: #eff6ff; }
.module-emerald .module-icon { background: #ecfdf5; }
.module-violet .module-icon { background: #f5f3ff; }
.module-amber .module-icon { background: #fffbeb; }

.module-body {
    flex: 1;
    min-width: 0;
}

.module-body h3 {
    font-size: 17px;
    font-weight: 700;
    margin-bottom: 6px;
    color: var(--text);
}

.module-body p {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.5;
    margin: 0;
}

.module-arrow {
    font-size: 22px;
    color: var(--text-muted);
    transition: transform 0.2s, color 0.2s;
    flex-shrink: 0;
}

.module-card:hover .module-arrow {
    transform: translateX(4px);
    color: var(--primary);
}

.module-badge {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    background: var(--surface-alt);
    padding: 4px 10px;
    border-radius: 20px;
    border: 1px solid var(--border);
    flex-shrink: 0;
    letter-spacing: 0.3px;
}

.dashboard-footer {
    text-align: center;
    padding: 24px 0 12px;
    border-top: 1px solid var(--border-light);
    color: var(--text-muted);
    font-size: 12px;
}

@media (max-width: 640px) {
    .modules-grid {
        grid-template-columns: 1fr;
    }
    .dashboard-hero h1 {
        font-size: 24px;
    }
    .dashboard-hero {
        padding: 32px 16px 24px;
    }
    .module-card {
        padding: 20px 16px;
    }
}

/* ===== Login ===== */
.login-section {
    max-width: 380px;
    margin: 80px auto 0;
    background: var(--surface);
    border-radius: var(--radius);
    padding: 36px 32px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    text-align: center;
}

.login-section h2 {
    margin-bottom: 24px;
}

.login-form input[type="password"] {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-family: inherit;
    text-align: center;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.login-form input[type="password"]:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}
