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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #f0f2f5;
    color: #1a1a2e;
    line-height: 1.5;
}

/* ── Login ─────────────────────────────────────────────────────────────── */

.login-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: #f0f1f3;
    position: relative;
    overflow: hidden;
}

#login-bg-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

.login-screen[hidden] {
    display: none;
}

.login-card {
    background: rgba(255, 255, 255, 0.55);
    backdrop-filter: blur(40px) saturate(1.4);
    -webkit-backdrop-filter: blur(40px) saturate(1.4);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 22px;
    padding: 48px 40px;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.06), inset 0 1px 0 rgba(255, 255, 255, 0.6);
    max-width: 400px;
    width: 90%;
    position: relative;
    z-index: 1;
}

.login-card h1 {
    font-size: 22px;
    margin-bottom: 8px;
    color: #1a1a2e;
    font-weight: 600;
}

.login-card p {
    color: #666;
    margin-bottom: 24px;
    font-size: 14px;
}

#google-signin-btn {
    display: flex;
    justify-content: center;
}

.error {
    color: #e74c3c;
    font-size: 13px;
    margin-top: 16px;
}

/* ── Header ────────────────────────────────────────────────────────────── */

header {
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(24px) saturate(1.3);
    -webkit-backdrop-filter: blur(24px) saturate(1.3);
    border-bottom: 1px solid rgba(255, 255, 255, 0.4);
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-left h1 {
    font-size: 18px;
    font-weight: 600;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
}

.avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
}

.btn-text {
    background: none;
    border: none;
    color: #667eea;
    cursor: pointer;
    font-size: 13px;
}

.btn-text:hover {
    text-decoration: underline;
}

/* ── Tabs ──────────────────────────────────────────────────────────────── */

.tabs {
    display: flex;
    background: rgba(255, 255, 255, 0.45);
    backdrop-filter: blur(20px) saturate(1.2);
    -webkit-backdrop-filter: blur(20px) saturate(1.2);
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
    padding: 0 24px;
}

.tab {
    background: none;
    border: none;
    padding: 12px 20px;
    font-size: 14px;
    color: #666;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.tab:hover {
    color: #333;
}

.tab.active {
    color: #667eea;
    border-bottom-color: #667eea;
    font-weight: 500;
}

/* ── Main content ──────────────────────────────────────────────────────── */

main {
    max-width: 960px;
    margin: 24px auto;
    padding: 0 24px;
}

.tab-content {
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.loading {
    text-align: center;
    color: #999;
    padding: 40px;
    font-size: 14px;
}

/* ── Neural canvas ─────────────────────────────────────────────────────── */

#tab-projects {
    position: static;
}

#neural-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 0;
}

#app {
    position: relative;
    z-index: 1;
}

/* ── Projects cards ────────────────────────────────────────────────────── */

.cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
}

.card {
    background: rgba(255, 255, 255, 0.55);
    backdrop-filter: blur(24px) saturate(1.3);
    -webkit-backdrop-filter: blur(24px) saturate(1.3);
    border-radius: 16px;
    padding: 20px;
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04), inset 0 1px 0 rgba(255, 255, 255, 0.5);
    transition: box-shadow 0.25s, background 0.25s, transform 0.25s;
}

.card:hover {
    background: rgba(255, 255, 255, 0.75);
    box-shadow: 0 8px 28px rgba(102, 126, 234, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.6);
    transform: translateY(-2px);
}

.card-clickable {
    cursor: pointer;
}

.card h3 {
    font-size: 16px;
    margin-bottom: 8px;
}

.card .project-stats {
    display: flex;
    gap: 12px;
    margin-bottom: 10px;
}

.card .stat-item {
    font-size: 13px;
    color: #555;
}

.card .stat-item.recordings::before {
    content: "";
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #667eea;
    margin-right: 5px;
}

.card .stat-item.documents::before {
    content: "";
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #7b1fa2;
    margin-right: 5px;
}

.card .stat-item.empty {
    color: #bbb;
    font-style: italic;
}

.card .keywords {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
}

.card .keyword {
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
    padding: 2px 8px;
    border-radius: 8px;
    font-size: 12px;
}

.card .card-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.card .drive-link {
    font-size: 13px;
    color: #667eea;
    text-decoration: none;
}

.card .drive-link:hover {
    text-decoration: underline;
}

.card .memo-link {
    font-size: 13px;
    color: #7c5cff;
    text-decoration: none;
    background: rgba(124, 92, 255, 0.08);
    border: 1px solid rgba(124, 92, 255, 0.25);
    padding: 2px 8px;
    border-radius: 8px;
}

.card .memo-link:hover {
    background: rgba(124, 92, 255, 0.15);
    text-decoration: none;
}

.card .btn-add-material {
    background: rgba(102, 126, 234, 0.08);
    border: 1px solid rgba(102, 126, 234, 0.3);
    color: #667eea;
    padding: 3px 10px;
    border-radius: 8px;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.card .btn-add-material:hover {
    background: #667eea;
    border-color: #667eea;
    color: #fff;
}

/* ── Companies ─────────────────────────────────────────────────────────── */

.companies-toolbar {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    align-items: center;
}

.btn-outline {
    background: rgba(255, 255, 255, 0.6);
    color: #667eea;
    border: 1px solid rgba(102, 126, 234, 0.3);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.btn-outline:hover {
    background: rgba(102, 126, 234, 0.08);
}

.btn-save {
    background: #27ae60;
}

.btn-save:hover {
    background: #219a52;
}

.company-group {
    background: rgba(255, 255, 255, 0.55);
    backdrop-filter: blur(20px) saturate(1.2);
    -webkit-backdrop-filter: blur(20px) saturate(1.2);
    border-radius: 14px;
    padding: 16px 20px;
    border: 1px solid rgba(255, 255, 255, 0.45);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
    margin-bottom: 12px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.company-group.drag-over {
    border-color: rgba(102, 126, 234, 0.5);
    background: rgba(240, 240, 255, 0.6);
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.1);
}

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

.company-group h3 {
    font-size: 15px;
    margin-bottom: 0;
    color: #333;
}

.company-group .btn-delete-company {
    background: none;
    border: none;
    color: #ccc;
    font-size: 18px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}

.company-group .btn-delete-company:hover {
    color: #e74c3c;
}

.company-group .names {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 28px;
}

.company-group .name-tag {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 13px;
    color: #444;
    cursor: grab;
    user-select: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    border: 1px solid rgba(200, 200, 210, 0.3);
    transition: background 0.15s, box-shadow 0.15s;
}

.company-group .name-tag:hover {
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.company-group .name-tag.dragging {
    opacity: 0.4;
}

.company-group .name-tag .btn-delete-name {
    display: none;
    background: none;
    border: none;
    color: #ccc;
    font-size: 14px;
    cursor: pointer;
    padding: 0;
    margin-left: 2px;
    line-height: 1;
}

.company-group .name-tag:hover .btn-delete-name {
    display: inline;
}

.company-group .name-tag .btn-delete-name:hover {
    color: #e74c3c;
}

.company-group .btn-add-name {
    background: none;
    border: 1px dashed rgba(180, 180, 190, 0.5);
    border-radius: 20px;
    padding: 4px 12px;
    font-size: 13px;
    color: #999;
    cursor: pointer;
}

.company-group .btn-add-name:hover {
    border-color: #667eea;
    color: #667eea;
}

.inline-edit-input {
    border: 1px solid rgba(102, 126, 234, 0.5);
    border-radius: 8px;
    padding: 2px 8px;
    font-size: 13px;
    outline: none;
    width: 140px;
    background: rgba(255, 255, 255, 0.8);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.company-name-input {
    border: 1px solid rgba(102, 126, 234, 0.5);
    border-radius: 10px;
    padding: 6px 12px;
    font-size: 15px;
    font-weight: 500;
    outline: none;
    width: 200px;
    background: rgba(255, 255, 255, 0.8);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* ── Add Material Forms ────────────────────────────────────────────────── */

.add-material-forms {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
}

.add-material-form {
    flex: 1;
    background: rgba(255, 255, 255, 0.55);
    backdrop-filter: blur(20px) saturate(1.2);
    -webkit-backdrop-filter: blur(20px) saturate(1.2);
    border: 1px solid rgba(255, 255, 255, 0.45);
    border-radius: 14px;
    padding: 16px 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
}

.add-material-header {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 10px;
    color: #333;
}

.add-material-header .hint {
    font-weight: 400;
    color: #999;
    font-size: 12px;
}

.add-material-row {
    display: flex;
    gap: 12px;
}

.add-material-row input {
    flex: 1;
    padding: 8px 14px;
    border: 1px solid rgba(200, 200, 210, 0.4);
    border-radius: 10px;
    font-size: 14px;
    background: rgba(255, 255, 255, 0.7);
}

.add-material-row input:focus {
    outline: none;
    border-color: rgba(102, 126, 234, 0.5);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.add-material-row select {
    padding: 8px 12px;
    border: 1px solid rgba(200, 200, 210, 0.4);
    border-radius: 10px;
    font-size: 14px;
    background: rgba(255, 255, 255, 0.7);
    min-width: 120px;
}

.add-material-hint {
    font-size: 12px;
    color: #999;
    margin-top: 8px;
    line-height: 1.4;
}

.add-status {
    margin-top: 12px;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 13px;
}

.add-status.processing {
    background: rgba(255, 248, 225, 0.7);
    color: #f57f17;
}

.add-status.success {
    background: rgba(232, 245, 233, 0.7);
    color: #2e7d32;
}

.add-status.success a {
    color: #667eea;
    text-decoration: none;
}

.add-status.success a:hover {
    text-decoration: underline;
}

.add-status.error {
    background: rgba(252, 228, 236, 0.7);
    color: #c62828;
}

/* ── Recordings ────────────────────────────────────────────────────────── */

.recordings-controls {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    align-items: center;
}

.recordings-controls select {
    padding: 8px 12px;
    border: 1px solid rgba(200, 200, 210, 0.4);
    border-radius: 10px;
    font-size: 14px;
    background: rgba(255, 255, 255, 0.7);
}

.recordings-controls .date-range-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #555;
}

.recordings-controls input[type="date"] {
    padding: 7px 10px;
    border: 1px solid rgba(200, 200, 210, 0.4);
    border-radius: 10px;
    font-size: 13px;
    background: rgba(255, 255, 255, 0.7);
}

.btn-secondary {
    padding: 7px 14px;
    background: rgba(102, 126, 234, 0.08);
    color: #667eea;
    border: 1px solid rgba(102, 126, 234, 0.3);
    border-radius: 10px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.15s;
}

.btn-secondary:hover {
    background: rgba(102, 126, 234, 0.15);
}

.btn {
    padding: 8px 20px;
    background: rgba(102, 126, 234, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s, box-shadow 0.2s;
}

.btn:hover {
    background: rgba(90, 111, 214, 0.95);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.25);
}

.btn:disabled {
    background: rgba(176, 176, 176, 0.6);
    cursor: not-allowed;
}

.card-add-project {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 2px dashed rgba(102, 126, 234, 0.3);
    background: rgba(255, 255, 255, 0.3);
    min-height: 140px;
    transition: border-color 0.2s, background 0.2s;
}

.card-add-project:hover {
    border-color: rgba(102, 126, 234, 0.6);
    background: rgba(102, 126, 234, 0.05);
}

.add-project-icon {
    font-size: 36px;
    font-weight: 300;
    color: rgba(102, 126, 234, 0.6);
    line-height: 1;
    margin-bottom: 8px;
}

.add-project-label {
    font-size: 14px;
    color: rgba(102, 126, 234, 0.8);
    font-weight: 500;
}

.modal-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid rgba(200, 200, 210, 0.4);
    border-radius: 12px;
    font-size: 14px;
    font-family: inherit;
    background: rgba(255, 255, 255, 0.7);
}

.modal-input:focus {
    outline: none;
    border-color: rgba(102, 126, 234, 0.5);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.modal-error {
    margin-top: 8px;
    font-size: 13px;
    color: #dc2626;
}

.recording-item {
    background: rgba(255, 255, 255, 0.55);
    backdrop-filter: blur(16px) saturate(1.2);
    -webkit-backdrop-filter: blur(16px) saturate(1.2);
    border: 1px solid rgba(255, 255, 255, 0.45);
    border-radius: 14px;
    padding: 14px 20px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
    transition: background 0.2s, box-shadow 0.2s, opacity 0.2s, transform 0.2s;
    position: relative;
}

.recording-item:hover {
    background: rgba(255, 255, 255, 0.75);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
}

.recording-item.reassigning {
    pointer-events: none;
}

.recording-item.reassigning::after {
    content: "Переиндексация…";
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    border-radius: 14px;
    font-size: 13px;
    font-weight: 500;
    color: #555;
    gap: 8px;
}

.recording-item.reassigning::before {
    content: "";
    position: absolute;
    top: 50%;
    left: calc(50% - 80px);
    width: 14px;
    height: 14px;
    margin-top: -7px;
    border: 2px solid rgba(0, 0, 0, 0.15);
    border-top-color: rgba(0, 0, 0, 0.55);
    border-radius: 50%;
    animation: reassign-spin 0.8s linear infinite;
    z-index: 1;
}

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

.recording-item.removing {
    opacity: 0;
    transform: translateX(20px);
}

.recording-info {
    flex: 1;
}

.recording-info .date {
    font-size: 13px;
    color: #999;
}

.recording-info .topic {
    font-size: 14px;
    font-weight: 500;
    margin-top: 2px;
    cursor: pointer;
    padding: 1px 4px;
    margin: 1px -4px;
    border-radius: 6px;
    border: 1px solid transparent;
}

.recording-info .topic:hover {
    background: rgba(245, 245, 250, 0.7);
    border-color: rgba(220, 220, 230, 0.5);
}

.recording-info .topic-input {
    font-size: 14px;
    font-weight: 500;
    padding: 2px 6px;
    margin-top: 2px;
    border: 1px solid rgba(102, 126, 234, 0.5);
    border-radius: 8px;
    outline: none;
    width: 100%;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.recording-info .rename-ok {
    color: #27ae60;
    font-size: 13px;
    margin-top: 2px;
    animation: fadeIn 0.2s;
}

.recording-info .rename-error {
    color: #e74c3c;
    font-size: 13px;
    margin-top: 2px;
}

.recording-info .speaker-labels {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 4px;
}

.recording-info .speaker-label {
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
    padding: 1px 8px;
    border-radius: 10px;
    font-size: 11px;
    white-space: nowrap;
    cursor: pointer;
}

.recording-info .speaker-label:hover {
    background: rgba(102, 126, 234, 0.18);
}

.recording-info .speaker-select {
    font-size: 11px;
    padding: 1px 6px;
    border-radius: 10px;
    border: 1px solid rgba(102, 126, 234, 0.3);
    background: rgba(255, 255, 255, 0.8);
    color: #667eea;
    cursor: pointer;
}

.recording-info .meta {
    font-size: 12px;
    color: #888;
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.reassign-project {
    font-size: 12px;
    padding: 1px 4px;
    border: 1px solid rgba(200, 200, 210, 0.4);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.6);
    color: #555;
    cursor: pointer;
}

.reassign-project:hover {
    border-color: rgba(102, 126, 234, 0.5);
}

.source-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.source-badge.zoom { background: rgba(45, 140, 255, 0.1); color: #2d8cff; }
.source-badge.telemost { background: rgba(230, 81, 0, 0.1); color: #e65100; }
.source-badge.local { background: rgba(46, 125, 50, 0.1); color: #2e7d32; }
.source-badge.document { background: rgba(123, 31, 162, 0.1); color: #7b1fa2; }

/* ── Emotion Analysis ─────────────────────────────────────────────────── */

.btn-emotion {
    font-size: 11px;
    padding: 2px 10px;
    border-radius: 8px;
    border: 1px solid rgba(233, 137, 58, 0.3);
    background: rgba(233, 137, 58, 0.08);
    color: #e9893a;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-emotion:hover {
    background: rgba(233, 137, 58, 0.15);
    border-color: rgba(233, 137, 58, 0.5);
}

.btn-emotion.analyzed {
    border-color: rgba(46, 125, 50, 0.3);
    background: rgba(46, 125, 50, 0.08);
    color: #2e7d32;
}

.btn-emotion.analyzed:hover {
    background: rgba(46, 125, 50, 0.15);
}

.btn-emotion.loading {
    opacity: 0.7;
    cursor: wait;
}

.btn-emotion:disabled {
    cursor: wait;
}

.emotion-result {
    margin-top: 8px;
}

.emotion-card {
    background: rgba(233, 137, 58, 0.05);
    border: 1px solid rgba(233, 137, 58, 0.15);
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 13px;
    animation: fadeIn 0.3s;
}

.emotion-title {
    font-weight: 600;
    font-size: 12px;
    color: #e9893a;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.emotion-overall {
    margin-bottom: 8px;
    font-size: 14px;
}

.emotion-section {
    margin-top: 8px;
}

.emotion-subtitle {
    font-weight: 600;
    font-size: 11px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-bottom: 4px;
}

.emotion-moment {
    display: flex;
    align-items: baseline;
    gap: 6px;
    padding: 2px 0;
    font-size: 12px;
    flex-wrap: wrap;
}

.emotion-time {
    font-family: monospace;
    color: #999;
    min-width: 36px;
    font-size: 11px;
}

.emotion-moment-speaker {
    font-weight: 500;
    color: #555;
    min-width: 80px;
}

.emotion-moment-tag {
    background: rgba(233, 137, 58, 0.12);
    color: #c97630;
    padding: 1px 6px;
    border-radius: 6px;
    font-size: 11px;
    white-space: nowrap;
}

.emotion-moment-text {
    color: #999;
    font-size: 11px;
    font-style: italic;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 300px;
}

.emotion-muted {
    color: #999;
    font-size: 12px;
    font-style: italic;
}

.emotion-speaker {
    margin-top: 2px;
    color: #555;
}

.emotion-error {
    color: #e74c3c;
    font-size: 12px;
    margin-top: 4px;
}

/* ── Ask Q&A ───────────────────────────────────────────────────────────── */

.ask-form {
    margin-bottom: 0;
}

.ask-guide {
    margin: 12px 0 16px;
}

.ask-guide details {
    background: rgba(255, 255, 255, 0.55);
    backdrop-filter: blur(20px) saturate(1.2);
    -webkit-backdrop-filter: blur(20px) saturate(1.2);
    border: 1px solid rgba(255, 255, 255, 0.45);
    border-radius: 12px;
    overflow: hidden;
}

.ask-guide summary {
    padding: 10px 16px;
    font-size: 13px;
    color: #667eea;
    cursor: pointer;
    font-weight: 500;
}

.ask-guide summary:hover {
    background: rgba(102, 126, 234, 0.04);
}

.ask-guide-body {
    padding: 4px 20px 16px;
    font-size: 13px;
    color: #555;
    line-height: 1.6;
}

.ask-guide-body h4 {
    margin: 16px 0 6px;
    font-size: 13px;
    color: #333;
}

.ask-guide-body h4:first-child {
    margin-top: 4px;
}

.ask-guide-body p {
    margin: 4px 0;
}

.ask-guide-body ul, .ask-guide-body ol {
    margin: 4px 0;
    padding-left: 20px;
}

.ask-guide-body li {
    margin: 3px 0;
}

.ask-row {
    display: flex;
    gap: 12px;
}

.ask-row select {
    padding: 8px 12px;
    border: 1px solid rgba(200, 200, 210, 0.4);
    border-radius: 10px;
    font-size: 14px;
    background: rgba(255, 255, 255, 0.7);
    min-width: 150px;
}

.ask-row input[type="date"] {
    padding: 6px 10px;
    border: 1px solid rgba(200, 200, 210, 0.4);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.7);
    font-size: 13px;
    color: #555;
    width: 140px;
    flex-shrink: 0;
}

.ask-row input[type="date"]::-webkit-datetime-edit-text { color: #bbb; }

.btn-date-reset {
    padding: 4px 8px;
    border: 1px solid rgba(200, 200, 210, 0.4);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.7);
    font-size: 13px;
    color: #999;
    cursor: pointer;
    flex-shrink: 0;
    line-height: 1;
    transition: all 0.2s;
}
.btn-date-reset:hover {
    background: rgba(255, 100, 100, 0.1);
    border-color: rgba(255, 100, 100, 0.4);
    color: #e55;
}
.btn-date-reset.active {
    background: rgba(102, 126, 234, 0.1);
    border-color: rgba(102, 126, 234, 0.4);
    color: #667eea;
}

.ask-row input[type="text"] {
    flex: 1;
    padding: 8px 14px;
    border: 1px solid rgba(200, 200, 210, 0.4);
    border-radius: 10px;
    font-size: 14px;
    background: rgba(255, 255, 255, 0.7);
}

.ask-row input:focus {
    outline: none;
    border-color: rgba(102, 126, 234, 0.5);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.answer {
    background: rgba(255, 255, 255, 0.55);
    backdrop-filter: blur(20px) saturate(1.2);
    -webkit-backdrop-filter: blur(20px) saturate(1.2);
    border: 1px solid rgba(255, 255, 255, 0.45);
    border-radius: 14px;
    padding: 20px;
    margin-bottom: 12px;
    font-size: 14px;
    line-height: 1.7;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
}

.answer p { margin-bottom: 8px; }
.answer ul, .answer ol { margin-left: 20px; margin-bottom: 8px; }
.answer strong { font-weight: 600; }

.sources {
    background: rgba(250, 250, 252, 0.55);
    backdrop-filter: blur(16px) saturate(1.1);
    -webkit-backdrop-filter: blur(16px) saturate(1.1);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 14px;
    padding: 16px 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
}

.sources h4 {
    font-size: 13px;
    color: #888;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sources a {
    display: block;
    color: #667eea;
    text-decoration: none;
    font-size: 13px;
    padding: 4px 0;
}

.sources a:hover {
    text-decoration: underline;
}

.sources .source-item {
    font-size: 13px;
    padding: 4px 0;
    color: #555;
}

/* ── Feedback ─────────────────────────────────────────────────────────── */

.feedback-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
    font-size: 14px;
    color: #666;
}

.feedback-btn {
    background: none;
    border: 1px solid transparent;
    border-radius: 10px;
    font-size: 22px;
    cursor: pointer;
    padding: 4px 8px;
    transition: transform 0.15s, background 0.15s;
    line-height: 1;
}

.feedback-btn:hover {
    transform: scale(1.2);
    background: rgba(102, 126, 234, 0.06);
}

.feedback-btn.selected {
    background: rgba(102, 126, 234, 0.12);
    border-color: rgba(102, 126, 234, 0.3);
    transform: scale(1.15);
}

.feedback-comment {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    animation: fadeIn 0.2s;
}

.feedback-comment input {
    flex: 1;
    padding: 6px 12px;
    border: 1px solid rgba(200, 200, 210, 0.4);
    border-radius: 10px;
    font-size: 13px;
    background: rgba(255, 255, 255, 0.7);
}

.feedback-comment input:focus {
    outline: none;
    border-color: rgba(102, 126, 234, 0.5);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.btn-help {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1px solid rgba(200, 200, 210, 0.4);
    background: rgba(255, 255, 255, 0.6);
    color: #667eea;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s, border-color 0.15s;
}

.btn-help:hover {
    background: rgba(102, 126, 234, 0.1);
    border-color: rgba(102, 126, 234, 0.4);
}

.btn-small {
    padding: 6px 14px;
    font-size: 13px;
}

.feedback-thanks {
    margin-top: 10px;
    color: #27ae60;
    font-size: 13px;
    animation: fadeIn 0.2s;
}

/* ── Analytics ────────────────────────────────────────────────────────── */

.analytics-table {
    background: rgba(255, 255, 255, 0.55);
    backdrop-filter: blur(20px) saturate(1.2);
    -webkit-backdrop-filter: blur(20px) saturate(1.2);
    border: 1px solid rgba(255, 255, 255, 0.45);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
    width: 100%;
}

.analytics-row {
    display: grid;
    grid-template-columns: 120px 100px minmax(150px, 2fr) 90px 60px minmax(100px, 1fr);
    gap: 8px;
    padding: 10px 16px;
    align-items: start;
    border-bottom: 1px solid rgba(230, 230, 240, 0.4);
    font-size: 13px;
}

.analytics-row:last-child {
    border-bottom: none;
}

.analytics-header {
    background: rgba(245, 245, 250, 0.5);
    font-weight: 500;
    color: #888;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.3px;
}

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

.a-col.a-query,
.a-col.a-comment {
    white-space: normal;
    word-break: break-word;
}

.a-date { color: #999; }
.a-feedback { text-align: center; font-size: 16px; }
.a-comment { color: #666; font-style: italic; }

/* ── Suggestion FAB + Modal ────────────────────────────────────────────── */

.suggestion-fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: none;
    background: rgba(102, 126, 234, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.3);
    transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
    z-index: 10;
    line-height: 1;
}

.suggestion-fab:hover {
    transform: scale(1.08);
    background: rgba(90, 111, 214, 0.95);
    box-shadow: 0 6px 28px rgba(102, 126, 234, 0.4);
}

.suggestion-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20;
}

.suggestion-overlay[hidden] {
    display: none;
}

.suggestion-modal {
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(32px) saturate(1.4);
    -webkit-backdrop-filter: blur(32px) saturate(1.4);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 18px;
    padding: 24px;
    width: 90%;
    max-width: 480px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.suggestion-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    font-size: 16px;
    font-weight: 500;
}

.suggestion-close {
    background: none;
    border: none;
    font-size: 22px;
    color: #999;
    cursor: pointer;
    line-height: 1;
    padding: 0 4px;
}

.suggestion-close:hover {
    color: #333;
}

.suggestion-textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid rgba(200, 200, 210, 0.4);
    border-radius: 12px;
    font-size: 14px;
    font-family: inherit;
    background: rgba(255, 255, 255, 0.7);
    resize: vertical;
    min-height: 80px;
}

.suggestion-textarea:focus {
    outline: none;
    border-color: rgba(102, 126, 234, 0.5);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.suggestion-modal-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
}

.suggestion-chars {
    font-size: 12px;
    color: #999;
}

.a-type-badge {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    vertical-align: middle;
}

.a-type-badge.suggestion {
    background: rgba(255, 193, 7, 0.15);
    color: #f57f17;
}

.help-modal-wide {
    max-width: 600px;
}

.help-content {
    max-height: 60vh;
    overflow-y: auto;
    font-size: 14px;
    line-height: 1.6;
}

.help-content h4 {
    margin: 16px 0 8px;
    font-size: 14px;
    color: #333;
}

.help-content h4:first-child {
    margin-top: 0;
}

.help-content ul {
    margin: 0 0 4px 20px;
}

.help-content li {
    margin-bottom: 4px;
    color: #555;
}

.help-content em {
    color: #667eea;
    font-style: normal;
}

/* ── Footer ────────────────────────────────────────────────────────────── */

.app-footer {
    text-align: center;
    padding: 12px 20px;
    font-size: 11px;
    color: rgba(100, 110, 130, 0.5);
    letter-spacing: 0.3px;
}

/* ── Responsive ────────────────────────────────────────────────────────── */

@media (max-width: 600px) {
    .add-material-forms {
        flex-direction: column;
    }

    .add-material-row {
        flex-direction: column;
    }

    .ask-row {
        flex-direction: column;
    }

    .recording-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .tabs {
        overflow-x: auto;
    }

    header {
        flex-direction: column;
        gap: 8px;
    }

    .analytics-row {
        grid-template-columns: 1fr;
        gap: 2px;
    }

    .analytics-header {
        display: none;
    }
}
