/* ============================================================
   Blue Ivy Review Assistant — Complete Stylesheet
   Classless HTML5 design med utility-klasser.
   ============================================================ */

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    scrollbar-gutter: stable;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: #f1f5f9;
    color: #0f172a;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a { color: #2563eb; text-decoration: none; transition: color 0.15s; }
a:hover { color: #1d4ed8; text-decoration: underline; }

/* --- Header --- */
body > header {
    background: rgba(255,255,255,0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid #e2e8f0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    max-width: 1344px;
    margin: 0 auto;
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
}

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

.brand-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #2563eb;
    color: #fff;
    font-weight: 700;
    font-size: 15px;
    flex-shrink: 0;
}

.brand-name {
    font-size: 18px;
    font-weight: 600;
    color: #0f172a;
    white-space: nowrap;
}
.brand-name:hover { text-decoration: none; color: #0f172a; }

nav {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    flex-wrap: wrap;
}

nav a {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    border-radius: 8px;
    color: #475569;
    font-weight: 500;
    transition: all 0.15s;
    white-space: nowrap;
}
nav a:hover {
    background: #f1f5f9;
    color: #1d4ed8;
    text-decoration: none;
}
nav a.active {
    background: #eff6ff;
    color: #1d4ed8;
    font-weight: 600;
}
nav a.logout-link { color: #b91c1c; }
nav a.logout-link:hover { background: #fef2f2; color: #dc2626; }

nav a svg, nav a i { width: 15px; height: 15px; flex-shrink: 0; }

/* --- Main Content --- */
main {
    flex: 1;
    width: 100%;
    max-width: 1344px;
    margin: 0 auto;
    padding: 28px 24px 48px;
}

/* --- Cards --- */
.card, section, article, aside {
    background: #fff;
    border-radius: 14px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.03);
}

.card-header,
section > header, article > header, aside > header, form > header {
    padding: 16px 20px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    background: #f8fafc;
    border-radius: 14px 14px 0 0;
}

.card-body {
    padding: 20px;
}

main > .card + .card,
main > section + section,
main > article + article,
.stack > * + * {
    margin-top: 20px;
}

/* --- Headings --- */
h1 { font-size: 26px; font-weight: 700; letter-spacing: -0.3px; }
h2 { font-size: 17px; font-weight: 600; }
h3 { font-size: 16px; font-weight: 600; }
h4 { font-size: 15px; font-weight: 600; }

/* --- Buttons --- */
button, .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 9px 18px;
    border: 1px solid #cbd5e1;
    border-radius: 9px;
    background: #fff;
    color: #334155;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
    line-height: 1.4;
    white-space: nowrap;
    user-select: none;
}
button:hover { background: #f8fafc; border-color: #94a3b8; }
button:active { background: #f1f5f9; }
button:disabled { opacity: 0.45; cursor: not-allowed; pointer-events: none; }

button.primary, .btn-primary {
    background: #0f172a;
    color: #fff;
    border-color: #0f172a;
    font-weight: 600;
}
button.primary:hover { background: #1e293b; border-color: #1e293b; }

button.secondary, .btn-secondary {
    background: #2563eb;
    color: #fff;
    border-color: #2563eb;
    font-weight: 600;
}
button.secondary:hover { background: #1d4ed8; border-color: #1d4ed8; }

button.danger {
    background: #dc2626;
    color: #fff;
    border-color: #dc2626;
}

button.saved:disabled {
    opacity: 1;
    background: #d1fae5;
    color: #065f46;
    border-color: #a7f3d0;
}

button svg, button i { width: 16px; height: 16px; flex-shrink: 0; }

/* --- Forms --- */
input[type="text"],
input[type="password"],
input[type="email"],
input[type="search"],
input:not([type]),
textarea,
select {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #cbd5e1;
    border-radius: 9px;
    font-size: 14px;
    font-family: inherit;
    color: #0f172a;
    background: #fff;
    transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
}
textarea { resize: vertical; min-height: 100px; line-height: 1.6; }
label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; color: #334155; text-transform: uppercase; letter-spacing: 0.3px; }

/* --- Tables --- */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead { background: #f8fafc; border-bottom: 2px solid #e2e8f0; }
th {
    padding: 11px 14px;
    text-align: left;
    font-weight: 600;
    color: #475569;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
td { padding: 11px 14px; border-bottom: 1px solid #f1f5f9; }
tr:hover td { background: #f8fafc; }

/* --- Badges --- */
.badge, .chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 9999px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}
.badge-amber  { background: #fef3c7; color: #92400e; }
.badge-emerald { background: #d1fae5; color: #065f46; }
.badge-rose   { background: #fee2e2; color: #991b1b; }
.badge-blue   { background: #dbeafe; color: #1e40af; }
.badge-slate  { background: #f1f5f9; color: #475569; }

/* --- Status badges --- */
.status-badge {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 6px;
    font-weight: 500;
}
.status-unresponded { background: #fef3c7; color: #92400e; }
.status-responded   { background: #d1fae5; color: #065f46; }

/* --- Layout grid --- */
.grid { display: grid; gap: 24px; }
.grid-cols-1 { grid-template-columns: 1fr; }
.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }

.reviews-layout {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 24px;
    align-items: start;
}
@media (max-width: 1024px) {
    .reviews-layout { grid-template-columns: 1fr; }
}

/* --- Flex helpers --- */
.flex { display: flex; }
.inline-flex { display: inline-flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.items-baseline { align-items: baseline; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.gap-6 { gap: 24px; }
.flex-1 { flex: 1 1 0; min-width: 0; }
.shrink-0 { flex-shrink: 0; }
.min-w-0 { min-width: 0; }

/* --- Spacing --- */
.p-1 { padding: 4px; }
.p-2 { padding: 8px; }
.p-3 { padding: 12px; }
.p-4 { padding: 16px; }
.p-5 { padding: 20px; }
.p-6 { padding: 24px; }
.px-2 { padding-left: 8px; padding-right: 8px; }
.px-3 { padding-left: 12px; padding-right: 12px; }
.px-4 { padding-left: 16px; padding-right: 16px; }
.px-5 { padding-left: 20px; padding-right: 20px; }
.py-1 { padding-top: 4px; padding-bottom: 4px; }
.py-2 { padding-top: 8px; padding-bottom: 8px; }
.py-3 { padding-top: 12px; padding-bottom: 12px; }
.py-6 { padding-top: 24px; padding-bottom: 24px; }
.py-8 { padding-top: 32px; padding-bottom: 32px; }
.m-0 { margin: 0; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mt-5 { margin-top: 20px; }
.mt-6 { margin-top: 24px; }
.mt-8 { margin-top: 32px; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mb-5 { margin-bottom: 20px; }
.mb-6 { margin-bottom: 24px; }
.mb-8 { margin-bottom: 32px; }
.ml-1 { margin-left: 4px; }
.mr-1 { margin-right: 4px; }

/* Stack spacing */
.space-y-3 > * + * { margin-top: 12px; }
.space-y-4 > * + * { margin-top: 16px; }
.space-y-6 > * + * { margin-top: 24px; }

/* --- Typography --- */
.text-xs  { font-size: 12px; }
.text-sm  { font-size: 13px; }
.text-base { font-size: 15px; }
.text-lg  { font-size: 18px; }
.text-xl  { font-size: 20px; }
.text-2xl { font-size: 24px; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.text-left { text-align: left; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.uppercase { text-transform: uppercase; }
.capitalize { text-transform: capitalize; }
.tracking-wide { letter-spacing: 0.3px; }
.leading-relaxed { line-height: 1.75; }
.whitespace-pre-wrap { white-space: pre-wrap; }
.whitespace-nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.break-words { word-break: break-word; overflow-wrap: break-word; }

/* Text colors */
.text-slate-400 { color: #94a3b8; }
.text-slate-500 { color: #64748b; }
.text-slate-600 { color: #475569; }
.text-slate-700 { color: #334155; }
.text-slate-800 { color: #1e293b; }
.text-blue-600 { color: #2563eb; }
.text-blue-700 { color: #1d4ed8; }
.text-blue-800 { color: #1e40af; }
.text-blue-900 { color: #1e3a8a; }
.text-emerald-600 { color: #059669; }
.text-emerald-800 { color: #065f46; }
.text-rose-600 { color: #e11d48; }
.text-rose-800 { color: #9f1239; }
.text-amber-500 { color: #f59e0b; }
.text-amber-600 { color: #d97706; }
.text-amber-800 { color: #92400e; }
.text-red-500 { color: #ef4444; }
.text-red-600 { color: #dc2626; }
.text-red-800 { color: #991b1b; }
.text-gray-500 { color: #6b7280; }
.text-gray-600 { color: #4b5563; }
.text-gray-700 { color: #374151; }
.text-gray-900 { color: #111827; }
.text-white { color: #fff; }

/* --- Borders --- */
.border { border: 1px solid #e2e8f0; }
.border-0 { border: none; }
.border-t { border-top: 1px solid #e2e8f0; }
.border-b { border-bottom: 1px solid #e2e8f0; }
.border-l { border-left: 1px solid #e2e8f0; }
.rounded-sm { border-radius: 4px; }
.rounded-md { border-radius: 8px; }
.rounded-lg { border-radius: 12px; }
.rounded-xl { border-radius: 14px; }
.rounded-2xl { border-radius: 18px; }
.rounded-full { border-radius: 9999px; }

/* --- Backgrounds --- */
.bg-white { background: #fff; }
.bg-slate-50 { background: #f8fafc; }
.bg-slate-100 { background: #f1f5f9; }
.bg-gray-50 { background: #f9fafb; }
.bg-blue-50 { background: #eff6ff; }
.bg-blue-100 { background: #dbeafe; }
.bg-emerald-50 { background: #ecfdf5; }
.bg-emerald-100 { background: #d1fae5; }
.bg-rose-50 { background: #fef2f2; }
.bg-rose-100 { background: #fee2e2; }
.bg-amber-50 { background: #fffbeb; }
.bg-amber-100 { background: #fef3c7; }
.bg-red-50 { background: #fef2f2; }

/* --- Hover --- */
.hover\:bg-slate-50:hover { background: #f8fafc; }
.hover\:bg-slate-100:hover { background: #f1f5f9; }
.hover\:bg-gray-50:hover { background: #f9fafb; }
.hover\:underline:hover { text-decoration: underline; }
.hover\:no-underline:hover { text-decoration: none; }

/* --- Overflow --- */
.overflow-hidden { overflow: hidden; }
.overflow-auto { overflow: auto; }
.overflow-y-auto { overflow-y: auto; }
.overflow-x-auto { overflow-x: auto; }

/* --- Height --- */
.h-full { height: 100%; }
.h-screen { height: 100vh; }

/* --- Shadow --- */
.shadow-sm { box-shadow: 0 1px 2px rgba(0,0,0,0.04); }
.shadow { box-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04); }

/* --- Width --- */
.w-full { width: 100%; }
.max-w-7xl { max-width: 1344px; }
.max-w-3xl { max-width: 800px; }
.max-w-5xl { max-width: 1100px; }
.max-w-sm { max-width: 400px; }
.mx-auto { margin-left: auto; margin-right: auto; }

/* --- Details / Summary --- */
details { border: 1px solid #e2e8f0; border-radius: 14px; overflow: hidden; }
details summary {
    cursor: pointer;
    padding: 14px 20px;
    background: #f8fafc;
    font-weight: 500;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    user-select: none;
    list-style: none;
}
details summary::-webkit-details-marker { display: none; }
details summary:hover { background: #f1f5f9; }
details[open] summary { border-bottom: 1px solid #e2e8f0; }

/* --- Footer --- */
body > footer {
    text-align: center;
    padding: 20px 24px;
    color: #94a3b8;
    font-size: 13px;
    margin-top: auto;
    border-top: 1px solid #e2e8f0;
    background: #fff;
}

/* --- Spinner --- */
@keyframes spin { to { transform: rotate(360deg); } }
.animate-spin { animation: spin 1s linear infinite; }

/* --- Scrollbar --- */
.scroll-thin::-webkit-scrollbar { width: 7px; }
.scroll-thin::-webkit-scrollbar-track { background: transparent; }
.scroll-thin::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 10px; }
.scroll-thin::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* --- Hidden --- */
.hidden { display: none !important; }
[x-cloak] { display: none !important; }

/* --- Top bar (split active/ignored) --- */
.mode-switch {
    display: inline-flex;
    border-radius: 9px;
    border: 1px solid #e2e8f0;
    overflow: hidden;
    font-size: 12px;
    background: #fff;
}
.mode-switch button {
    border: none;
    border-radius: 0;
    padding: 5px 14px;
    font-size: 12px;
    font-weight: 500;
    background: #fff;
    color: #64748b;
}
.mode-switch button:first-child { border-right: 1px solid #e2e8f0; }
.mode-switch button.active {
    background: #0f172a;
    color: #fff;
}

/* --- Line clamp --- */
.line-clamp-4 {
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* --- Rating stars --- */
.stars { letter-spacing: 1px; }

/* --- Rating buttons (manual page) --- */
.rating-btn {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    border: 2px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
    cursor: pointer;
    background: #fff;
    color: #94a3b8;
    transition: all 0.15s;
}
.rating-btn:hover { border-color: #fcd34d; color: #b45309; }
.rating-btn.selected { background: #fef3c7; border-color: #f59e0b; color: #b45309; }

/* --- Deep Dive specific --- */
.score-square {
    width: 32px; height: 32px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 4px;
    font-weight: 700; font-size: 14px; color: #fff;
}
.score-positive { background: #10b981; }
.score-neutral { background: #6b7280; }
.score-negative { background: #ef4444; }

.filter-dropdown { position: relative; display: inline-block; }
.filter-menu {
    display: none;
    position: absolute; top: 100%; left: 0;
    background: #fff; border: 1px solid #e5e7eb; border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    z-index: 50; min-width: 130px;
}
.filter-dropdown:hover .filter-menu { display: block; }
.filter-option {
    padding: 8px 14px; cursor: pointer;
    border-bottom: 1px solid #f3f4f6;
    font-size: 13px;
    display: flex; align-items: center; gap: 8px;
}
.filter-option:hover { background: #f9fafb; }
.filter-option:last-child { border-bottom: none; }

.keyword-positive { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.keyword-negative { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }

.explanation-item {
    padding: 8px; margin-bottom: 4px; border-radius: 6px; border-left: 4px solid;
}
.explanation-positive { background: #f0fdf4; border-left-color: #10b981; }
.explanation-negative { background: #fef2f2; border-left-color: #ef4444; }

.table-container { width: 100%; overflow-x: auto; }
.full-width-table { min-width: 1400px; }
.col-published-date { width: 140px; min-width: 140px; }
.col-url { width: 120px; min-width: 120px; }
.col-score { width: 60px; min-width: 60px; }
.col-explanations { width: 600px; min-width: 600px; }
.col-keywords { width: 300px; min-width: 300px; }
.col-rating { width: 90px; min-width: 90px; }

.toggle-button {
    padding: 4px 8px; border-radius: 5px;
    border: 1px solid #d1d5db; background: #f9fafb;
    color: #6b7280; cursor: pointer; font-size: 11px;
    transition: all 0.15s;
}
.toggle-button.active { background: #3b82f6; color: #fff; border-color: #3b82f6; }
.toggle-button:hover:not(.active) { background: #e5e7eb; }

/* --- Analysis Dashboard --- */
.chart-container { position: relative; width: 100%; height: 280px; }
.chart-container canvas { width: 100% !important; height: 100% !important; }

.chip-active { background: #0f172a; color: #fff; border-color: #0f172a; }
.chip-inactive { background: #fff; color: #334155; border-color: #cbd5e1; }
.chip-inactive:hover { background: #f8fafc; }
.chip-btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 7px 15px; border-radius: 9px; border: 1px solid #cbd5e1;
    font-size: 13px; font-weight: 500; cursor: pointer;
    transition: all 0.15s;
}

/* --- Management Insights Prose --- */
.prose { line-height: 1.75; font-size: 16px; color: #374151; max-width: none; }
.prose h1 { font-size: 24px; font-weight: 700; margin: 36px 0 20px; padding-bottom: 8px; border-bottom: 2px solid #e2e8f0; }
.prose h2 { font-size: 20px; font-weight: 600; margin: 32px 0 14px; }
.prose h3 { font-size: 17px; font-weight: 600; margin: 24px 0 10px; }
.prose h4 { font-size: 15px; font-weight: 600; margin: 16px 0 8px; }
.prose p { margin-bottom: 18px; }
.prose ul, .prose ol { margin-bottom: 20px; padding-left: 24px; }
.prose li { margin-bottom: 10px; }
.prose ul li { list-style: disc; }
.prose ol li { list-style: decimal; }
.prose strong { font-weight: 600; color: #0f172a; }
.prose code { background: #f1f5f9; padding: 2px 6px; border-radius: 4px; font-size: 14px; }
.prose pre { background: #f1f5f9; padding: 16px; border-radius: 8px; overflow-x: auto; margin-bottom: 20px; font-size: 14px; }
.prose blockquote { border-left: 4px solid #2563eb; padding: 4px 16px; background: #eff6ff; margin: 20px 0; }
.prose hr { margin: 32px 0; border: none; border-top: 1px solid #e2e8f0; }

/* --- Login Page --- */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
}

.login-card {
    width: 100%;
    max-width: 400px;
    background: #fff;
    border-radius: 16px;
    border: 1px solid #e2e8f0;
    padding: 32px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.06);
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .header-inner { flex-direction: column; align-items: flex-start; }
    nav { gap: 2px; }
    nav a { padding: 5px 9px; font-size: 12px; }
    main { padding: 16px 12px 32px; }
    .grid-cols-2 { grid-template-columns: 1fr; }
    .card-header { padding: 12px 16px; }
    .card-body { padding: 16px; }
    h1 { font-size: 22px; }
}

/* --- Print --- */
@media print {
    body > header, body > footer { display: none; }
    body { background: #fff; }
}

/* Sticky list-row in deep dive */
.sticky-left { position: sticky; left: 0; z-index: 5; }

/* Review list item button reset */
.review-item-btn {
    display: block;
    width: 100%;
    text-align: left;
    padding: 14px 16px;
    border: none;
    border-bottom: 1px solid #f1f5f9;
    border-radius: 0;
    background: #fff;
    cursor: pointer;
    transition: background 0.1s;
}
.review-item-btn:hover { background: #f8fafc; }
.review-item-btn.selected { background: #eff6ff; }

/* ============================================================
   Reviews page
   ============================================================ */

[x-cloak] { display: none !important; }

.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Card footer, mirroring the card header */
section > footer, article > footer, aside > footer {
    padding: 12px 16px;
    border-top: 1px solid #e2e8f0;
    background: #fff;
    border-radius: 0 0 14px 14px;
}

/* --- List column --- */
.review-list {
    display: flex;
    flex-direction: column;
    height: 75vh;
    position: sticky;
    top: 84px;
}
.review-list ul {
    flex: 1;
    overflow-y: auto;
    list-style: none;
}
.review-list ul:empty::after {
    content: "No reviews here.";
    display: block;
    padding: 20px;
    color: #94a3b8;
    font-size: 14px;
}
.review-item-btn {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}
.review-item-btn > div { min-width: 0; }
.review-item-btn strong,
.review-item-btn p {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
}
.review-item-btn strong { font-weight: 500; }
.review-item-btn p { font-size: 12px; color: #64748b; }
.review-item-btn time { font-size: 12px; color: #94a3b8; }
.review-item-side {
    display: grid;
    justify-items: end;
    gap: 5px;
    flex-shrink: 0;
}

/* --- Detail column --- */
.notice {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 12px;
    background: #fffbeb;
    color: #92400e;
    border-bottom: 1px solid #fde68a;
}
.review-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    list-style: none;
    margin-top: 10px;
}
.review-meta li {
    padding: 3px 10px;
    border-radius: 9999px;
    font-size: 12px;
    background: #f1f5f9;
    color: #475569;
}
.review-meta b { color: #0f172a; font-weight: 500; }
.review-text {
    margin-top: 16px;
    white-space: pre-wrap;
    line-height: 1.7;
}
.posted-response {
    margin-top: 24px;
    padding: 16px;
    border-radius: 10px;
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
}
.posted-response h4 { color: #065f46; display: flex; align-items: center; gap: 8px; }
.posted-response p { margin-top: 8px; white-space: pre-wrap; }

/* --- Guest history --- */
.previous-reviews {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    list-style: none;
    margin-top: 8px;
}
.previous-reviews li {
    padding: 12px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #f8fafc;
}
.previous-reviews strong { display: block; overflow: hidden; text-overflow: ellipsis; }
.previous-reviews time { display: block; font-size: 12px; color: #94a3b8; }
.previous-reviews p {
    margin: 8px 0;
    font-size: 14px;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.previous-reviews a { font-size: 12px; }

/* --- Analysis panel --- */
.analysis { margin-top: 24px; }
.analysis > div {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    padding: 16px;
}
.analysis section { padding: 14px; }
.analysis section:last-child { grid-column: 1 / -1; }
.analysis h4 { margin-bottom: 8px; }
.analysis dl { font-size: 14px; }
.analysis dt { text-transform: capitalize; font-weight: 500; }
.analysis dd { color: #334155; }
.scores div {
    display: flex;
    justify-content: space-between;
}
.explanations dd { margin-bottom: 8px; }
.explanations p { color: #94a3b8; font-size: 14px; }
.keywords {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    list-style: none;
}
.keywords li {
    padding: 3px 10px;
    border-radius: 9999px;
    font-size: 12px;
}
.keywords .positive { background: #d1fae5; color: #065f46; }
.keywords .negative { background: #fee2e2; color: #991b1b; }

/* --- Draft & context --- */
.draft-box { min-height: 340px; }
.context-box {
    height: 260px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 12px;
    background: #f8fafc;
}
.hint { font-size: 12px; color: #94a3b8; margin-top: 8px; }

@media (max-width: 900px) {
    .reviews-layout { grid-template-columns: 1fr; }
    .review-list { position: static; height: 50vh; }
    .analysis > div,
    .previous-reviews { grid-template-columns: 1fr; }
}

/* Layout odds and ends used by the reviews page */
.review-list > footer button { width: 100%; }
.actions { display: flex; align-items: center; gap: 12px; }
.review-headline {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 16px;
}
.card-body > * + * { margin-top: 12px; }

/* ============================================================
   Icons
   ============================================================ */
.icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    vertical-align: -3px;
}
h1 > .icon, h2 > .icon { width: 18px; height: 18px; }
nav a .icon { width: 15px; height: 15px; }

/* ============================================================
   Analysis dashboard
   ============================================================ */
.dashboard {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 20px;
}
.periods { gap: 4px; }
.periods a {
    padding: 5px 12px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    font-size: 13px;
    color: #475569;
}
.periods a.active {
    background: #0f172a;
    border-color: #0f172a;
    color: #fff;
}
.periods a.active:hover { color: #fff; }

.chart {
    width: 100%;
    height: auto;
    display: block;
    overflow: visible;
}
.chart .grid { stroke: #e2e8f0; stroke-width: 1; }
.chart .axis { fill: #94a3b8; font-size: 9px; }
.chart .line { fill: none; stroke: #2563eb; stroke-width: 2; stroke-linejoin: round; }
.chart circle { fill: #2563eb; }
.chart rect { transition: opacity 0.15s; }
.chart rect:hover { opacity: 0.75; }

.chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    list-style: none;
    font-size: 12px;
    color: #475569;
}
.chart-legend li { display: flex; align-items: center; gap: 6px; }
.chart-legend i { width: 10px; height: 10px; border-radius: 3px; }

table.compact { font-size: 13px; }
table.compact td, table.compact th { padding: 5px 8px; }
table.compact .positive { color: #059669; font-weight: 600; }
table.compact .negative { color: #dc2626; font-weight: 600; }

/* ============================================================
   Deep dive
   ============================================================ */
.table-scroll {
    overflow-x: auto;
    border-top: 1px solid #e2e8f0;
}
table.deep-dive { font-size: 12px; }
table.deep-dive td { padding: 8px 10px; vertical-align: top; border-bottom: 1px solid #f1f5f9; }
table.deep-dive th { padding: 8px 10px; white-space: nowrap; }
table.deep-dive tbody tr:hover { background: #f8fafc; }
table.deep-dive .sticky-left {
    position: sticky;
    left: 0;
    background: #fff;
    white-space: nowrap;
}
table.deep-dive thead .sticky-left { background: #f8fafc; }
table.deep-dive .wide { min-width: 420px; }
table.deep-dive .stars { color: #f59e0b; white-space: nowrap; }
table.deep-dive .keywords { max-width: 280px; }

.score-col { text-align: center; }
.score-filter { display: flex; gap: 2px; justify-content: center; margin-top: 4px; }
.score-square {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 5px;
    font-weight: 600;
    font-size: 11px;
}
a.score-square { opacity: 0.45; }
a.score-square:hover { opacity: 1; text-decoration: none; }
.score-positive { background: #d1fae5; color: #065f46; }
.score-neutral  { background: #f1f5f9; color: #94a3b8; }
.score-negative { background: #fee2e2; color: #991b1b; }

.chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 9999px;
    background: #fff;
    border: 1px solid #bfdbfe;
    font-size: 12px;
}
.chip:hover { text-decoration: none; border-color: #2563eb; }
.chip .icon { width: 12px; height: 12px; }

.toggle-button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 12px;
    color: #475569;
}
.toggle-button:hover { text-decoration: none; background: #f8fafc; }

.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13px;
    color: #475569;
}
.pagination .btn { padding: 5px 12px; border: 1px solid #cbd5e1; border-radius: 8px; }
.pagination .btn:hover { text-decoration: none; background: #f8fafc; }

@media (max-width: 900px) {
    .dashboard { grid-template-columns: 1fr; }
}
.filters {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 20px;
    background: #eff6ff;
    border-bottom: 1px solid #dbeafe;
    font-size: 13px;
}

/* ============================================================
   Single-column pages
   ============================================================ */
.narrow { max-width: 860px; margin: 0 auto; }

.login-page .brand { margin-bottom: 20px; }
.login-page h1 { font-size: 22px; }
.login-page label { margin-top: 14px; }
.login-page button { width: 100%; margin-top: 20px; }
.login-page .error { color: #b91c1c; font-size: 13px; min-height: 20px; }

/* --- Knowledge editor --- */
.knowledge-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 20px;
    align-items: start;
}
.knowledge-layout ul { list-style: none; padding: 8px; }
.knowledge-layout li a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 8px;
    color: #334155;
}
.knowledge-layout li a:hover { background: #f8fafc; text-decoration: none; }
.knowledge-layout li a.selected { background: #eff6ff; color: #1d4ed8; font-weight: 500; }
.knowledge-layout small { display: block; font-size: 11px; color: #94a3b8; font-weight: 400; }
.knowledge-layout .saved {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 20px;
    font-size: 13px;
    color: #065f46;
    background: #ecfdf5;
}
.editor {
    height: 70vh;
    border: none;
    border-radius: 0 0 14px 14px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 13px;
    resize: none;
}
.editor:focus { box-shadow: none; }

/* --- Manual review --- */
.rating {
    display: flex;
    gap: 8px;
    border: none;
    align-items: center;
}
.rating legend {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: #334155;
    margin-bottom: 5px;
}
.rating input { position: absolute; opacity: 0; width: 0; }
.rating span {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-weight: 700;
    color: #94a3b8;
    cursor: pointer;
}
.rating span:hover { border-color: #cbd5e1; }
.rating input:checked + span { border-color: #0f172a; background: #0f172a; color: #fff; }
.rating input:focus-visible + span { box-shadow: 0 0 0 3px rgba(37,99,235,0.3); }

.analysis-panels {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
.analysis-panels section { padding: 14px; }
.analysis-panels section:last-child { grid-column: 1 / -1; }
.analysis-panels h4 { margin-bottom: 8px; }
.analysis-panels dl { font-size: 14px; }
.analysis-panels dt { text-transform: capitalize; font-weight: 500; }
.analysis-panels dd { color: #334155; margin-bottom: 6px; }

@media (max-width: 900px) {
    .knowledge-layout,
    .analysis-panels { grid-template-columns: 1fr; }
}

.login-page { min-height: 60vh; background: none; padding: 0; }

/* --- Phones ---------------------------------------------------------------
   Everything here applies at 640px and under only, so the desktop and tablet
   layouts above that width are untouched by construction. */
@media (max-width: 640px) {

    /* A stacked grid column is never narrower than its widest child that
       cannot wrap. Review titles are nowrap, so without this the column —
       and with it the whole page — grows to the longest title and the body
       scrolls sideways. */
    .reviews-layout > *,
    .review-list ul,
    .review-list li,
    .review-item-btn,
    .review-item-btn > div {
        min-width: 0;
    }

    /* Eight menu items wrap into three rows and eat a third of the screen.
       One row that scrolls sideways keeps every page one thumb away. */
    nav {
        flex-wrap: nowrap;
        overflow-x: auto;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
        /* The nav is itself a flex item. Without this it refuses to be
           narrower than its own contents and simply widens the header. */
        min-width: 0;
        max-width: 100%;
    }
    nav::-webkit-scrollbar { display: none; }
    nav a { flex-shrink: 0; white-space: nowrap; }

    /* The header is sticky; on a short screen it must not claim more than a
       glance of it. */
    .header-inner { padding: 8px 12px; gap: 6px; }
    body > header nav { margin: 0 -12px; padding: 0 12px; }

    /* Wide tables scroll within their card instead of widening the page. */
    .card-body { overflow-x: auto; }

    /* Safari zooms the page in when a focused field is under 16px, and never
       zooms back out. The typed and class selectors are spelled out so this
       outranks the more specific field rules further up the file. */
    input, textarea, select,
    input[type="text"], input[type="password"],
    input[type="email"], input[type="search"],
    .context-box, .editor { font-size: 16px; }

    /* Thumbs are not mouse pointers. */
    button, .btn { min-height: 44px; }
    .periods a { padding: 8px 12px; }

    /* One review at a time is plenty; give the detail more of the screen. */
    .review-list { height: 42vh; }
}
