body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 20px;
    background-color: #f5f5f5;
}

.container {
    max-width: 1280px;
    margin: 0 24px;
}

.section {
    background: white;
    padding: 20px;
    margin: 12px 0;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.section h2 {
    margin-top: 0;
}

.review-card {
    border: 1px solid #ddd;
    padding: 15px;
    margin-bottom: 15px;
    border-radius: 5px;
}

.suggestions {
    margin: 10px 0;
    padding: 10px;
    background: #f9f9f9;
}

button {
    background: #007bff;
    color: white;
    border: none;
    padding: 8px 16px;
    margin: 5px;
    border-radius: 4px;
    cursor: pointer;
}

button:hover {
    background: #0056b3;
}

.results {
    margin-top: 20px;
    padding: 15px;
    background: #e9ecef;
    border-radius: 5px;
}

textarea {
    width: 100%;
    height: 100px;
    margin: 10px 0;
}

input[type="file"] {
    margin: 10px 0;
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.modal {
    background: #fff;
    width: 520px;
    max-width: calc(100% - 32px);
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    padding: 20px;
}
.modal h3 { margin-top: 0; }
.modal-actions { margin-top: 14px; text-align: right; }
.btn-secondary { background: #e5e7eb; color: #111827; }
.btn-secondary:hover { background: #d1d5db; }
.btn-warning { background: #ff9800; color: white; border: 1px solid #e68a00; }
.btn-warning:hover { background: #e68a00; }
.tab-btn { background: #e5e7eb; color: #111827; border: none; padding: 10px 16px; border-radius: 8px; cursor: pointer; }
.tab-btn.active { background: #eef2ff; color: #3730a3; font-weight: 600; }

/* Spinner */
.spinner {
    width: 28px;
    height: 28px;
    border: 3px solid #e5e7eb;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    display: inline-block;
    vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* App layout */
.layout {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    gap: 24px;
}
.sidebar {
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.08);
    padding: 16px;
    height: fit-content;
    position: sticky;
    top: 20px;
}
.sidebar h3 {
    margin-top: 0;
    font-size: 16px;
    color: #111827;
}
.nav {
    list-style: none;
    margin: 0;
    padding: 0;
}
.nav li { margin: 8px 0; }
.nav a {
    display: block;
    padding: 8px 10px;
    border-radius: 6px;
    text-decoration: none;
    color: #374151;
}
.nav a:hover { background: #f3f4f6; }
.nav a.active { background: #eef2ff; color: #3730a3; font-weight: 600; }

.main { min-height: 60vh; }

/* Dictionary page layout */
.dict-table {
    width: 100%;
    border-collapse: collapse;
}
.dict-table th, .dict-table td {
    padding: 10px 8px;
    border-bottom: 1px solid #eee;
    text-align: left;
}
.dict-table th {
    font-weight: 600;
    font-size: 14px;
    color: #555;
}
.dict-word {
    font-weight: 700;
}
.dict-ipa code {
    background: #f6f8fa;
    padding: 3px 6px;
    border-radius: 4px;
    font-family: 'Noto Serif', 'Charis SIL', 'Doulos SIL', 'Segoe UI Symbol', 'Noto Sans', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}
.meta-note {
    color: #6b7280;
    font-size: 12px;
}

.candidate-card {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 10px;
    background: #fff;
}
.suggest-box {
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 12px;
    background: #fafafa;
    margin-bottom: 12px;
}

/* Automatic panel with internal scroll to cap visible height */
.auto-panel {
    max-height: 420px; /* ~3-4 cards depending on content */
    overflow: auto;
    padding-right: 6px; /* room for scrollbar */
}
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 12px;
    background: #eef2ff;
    color: #3730a3;
    margin-left: 8px;
}

/* Organization selector styles */
.org-selector {
    border-left: 4px solid #2196F3;
}

.org-selector select {
    background: white;
    cursor: pointer;
}

.org-selector select:hover {
    border-color: #2196F3;
}

/* Source indicators */
.source-global {
    color: #4CAF50;
    font-size: 10px;
    margin-left: 4px;
}

.source-org {
    color: #2196F3;
    font-size: 10px;
    margin-left: 4px;
}

.source-voice {
    color: #9C27B0;
    font-size: 10px;
    margin-left: 4px;
}

/* IPA-friendly rendering for Google suggestions */
.ipa-text {
    font-family: 'Noto Serif', 'Charis SIL', 'Doulos SIL', 'Segoe UI Symbol', 'Noto Sans', Arial, sans-serif;
    font-size: 15px;
}