/* Shadcn Admin composition, with the RVIBS typefaces and brand tokens. */
:root { --sidebar-width: 256px; --radius-md: 6px; --radius-lg: 12px; --radius-xl: 16px; }
body { background: var(--color-bg-card); font-size: 14px; }
::selection { background: var(--color-primary-100); color: var(--color-primary-dark); }
input, textarea { caret-color: var(--color-primary); }
:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 3px; }
.skip-link { position: fixed; top: -60px; left: 16px; z-index: 5000; padding: 8px 16px; background: white; border: 1px solid var(--color-border); border-radius: 6px; }
.skip-link:focus { top: 12px; }
.sidebar { background: var(--color-bg); color: var(--color-text); border-right: 1px solid var(--color-border); }
.sidebar__brand { padding: 16px; border: 0; }
.sidebar__brand-logo { width: 100%; height: auto; padding: 0; object-fit: contain; border: 0; border-radius: 0; background: transparent; }
.sidebar__brand-text { display: flex; flex-direction: column; line-height: 1.5; }
.sidebar__brand-text strong { color: var(--color-primary); font-size: 14px; }
.sidebar__brand-text span { color: var(--color-text-muted); font-size: 12px; }
.sidebar__nav { padding: 0 8px 16px; }
.sidebar__section-label { color: var(--color-text-muted); text-transform: none; letter-spacing: 0; font-weight: 500; font-size: 12px; padding: 20px 8px 8px; }
.sidebar__link { min-height: 34px; padding: 7px 8px; gap: 9px; border-radius: 6px; color: var(--color-text); font-weight: 400; line-height: 1.4; }
.sidebar__link-icon { width: 17px; height: 17px; }
.sidebar__link:hover { background: var(--color-primary-50); color: var(--color-primary); }
.sidebar__link.active { background: var(--color-primary-50); color: var(--color-primary); box-shadow: none; font-weight: 600; }
.sidebar__user { margin: 8px; padding: 8px; gap: 10px; border: 0; border-radius: 6px; color: var(--color-text); }
.sidebar__user:hover { background: var(--color-primary-50); }
.sidebar__user-name { color: var(--color-dark); font-size: 13px; }
.sidebar__user-role { color: var(--color-text-muted); font-size: 12px; }
.sidebar__user-avatar { border-radius: 8px; }
.sidebar__nav::-webkit-scrollbar-thumb { background: var(--color-border); }
.main-area { min-width: 0; }
.topbar { padding: 0 24px; border-bottom: 0; gap: 16px; }
.topbar__toggle { display: flex; align-items: center; justify-content: center; width: 30px; height: 30px; padding: 5px; border: 1px solid var(--color-border); border-radius: 6px; flex-shrink: 0; }
.topbar__toggle svg { width: 16px; height: 16px; }
.topbar__toggle:hover { background: var(--color-bg); }
.topbar__title { display: flex; align-items: center; gap: 14px; border-left: 1px solid var(--color-border); padding-left: 16px; font-size: 13px; white-space: nowrap; }
.topbar__title a { color: var(--color-text-muted); }
.topbar__title > span:first-of-type { color: var(--color-text-light); }
.topbar__actions { gap: 12px; }
.topbar__actions > form { order: 3; }
.topbar__search input { width: 240px; height: 34px; border-radius: 6px; background: var(--color-bg); font-size: 13px; }
.search-results { position: absolute; top: 42px; right: 0; width: 280px; padding: 4px; background: white; border: 1px solid var(--color-border); border-radius: 8px; box-shadow: var(--shadow-md); }
.search-results a, .search-results p { display: block; padding: 8px 10px; font-size: 13px; border-radius: 4px; }
.search-results a:hover { background: var(--color-primary-50); }
.content { padding: 24px; width: 100%; max-width: 1440px; margin-inline: auto; }
.content__header { margin-bottom: 24px; align-items: center; gap: 12px; }
.content__header-title h2 { font-size: 26px; letter-spacing: -0.025em; font-weight: 700; }
.content__header-title p { margin-top: 4px; }
.grid { gap: 16px; }
.grid--sidebar { grid-template-columns: minmax(0, 4fr) minmax(0, 3fr); }
.grid > *, .flex > .card { min-width: 0; }
.card, .stat-card { border-radius: 12px; box-shadow: none; }
.card:hover, .stat-card:hover { box-shadow: none; transform: none; }
.card__header { padding: 24px 24px 16px; border-bottom: 0; gap: 12px; }
.card__header h3 { font-size: 18px; letter-spacing: -0.02em; }
.card__body { padding: 24px; }
.card__header + .card__body { padding-top: 4px; }
.stat-card { position: relative; padding: 24px; min-height: 130px; }
.stat-card__icon { position: absolute; right: 24px; top: 24px; width: 18px; height: 18px; background: transparent !important; border-radius: 0; }
.stat-card__icon svg { width: 17px; height: 17px; }
.stat-card > div:last-child { display: flex; flex-direction: column; gap: 12px; }
.stat-card__label { order: -1; color: var(--color-text); padding-right: 24px; font-size: 13px; line-height: 1.4; }
.stat-card__value { font-size: 28px; font-variant-numeric: tabular-nums; }
.btn { border-radius: 6px; min-height: 36px; font-size: 13px; font-weight: 500; box-shadow: none; }
.btn:hover { transform: none; box-shadow: none; }
.btn--sm { min-height: 32px; padding: 6px 12px; }
.form-control { border-radius: 6px; min-height: 36px; font-size: 14px; }
.form-label { font-weight: 500; }
.table-wrap { border-radius: 8px; }
thead th { padding: 12px 16px; text-transform: none; letter-spacing: 0; font-weight: 500; font-size: 13px; background: white; }
tbody td { padding: 12px 16px; border-color: var(--color-border); font-variant-numeric: tabular-nums; }
tbody tr:hover { background: var(--color-bg); }
.badge { border-radius: 5px; padding: 2px 7px; font-weight: 500; font-size: 11px; }
.tabs { border-bottom: 1px solid var(--color-border); flex-wrap: wrap; overflow: visible; }
.tabs .tab { white-space: normal; text-align: left; }
.role-tabs { display: flex; flex-wrap: nowrap; width: fit-content; max-width: 100%; padding: 4px; gap: 3px; background: var(--color-bg); border: 0; border-radius: 8px; margin-bottom: 20px; overflow-x: auto; }
.role-tab { border: 0; border-radius: 5px; padding: 6px 12px; font-size: 13px; white-space: nowrap; color: var(--color-text-muted); background: transparent; }
.role-tab.active { color: var(--color-primary); background: white; box-shadow: var(--shadow-xs); }
.progress { height: 8px; }
.ai-fab { width: 44px; height: 44px; border-radius: 12px; background: var(--color-primary); box-shadow: var(--shadow-md); }
.ai-fab__pulse { display: none; }
.empty-state { padding: 32px 24px; }
.auth-page { background: var(--color-bg-card); padding: 24px; }
.auth-page::before, .auth-page::after { display: none; }
.auth-card { max-width: 400px; }
.auth-card__panel { border: 1px solid var(--color-border); border-radius: 12px; box-shadow: none; padding: 28px; text-align: center; }
.auth-card__logo { width: 160px; margin-bottom: 24px; }
.auth-card__panel h2 { font-size: 24px; letter-spacing: -0.025em; }
.google-btn { min-height: 40px; font-size: 14px; padding: 10px 16px; }
@media (min-width: 769px) {
    .sidebar-collapsed .sidebar { transform: translateX(-100%); }
    .sidebar-collapsed .main-area { margin-left: 0; }
}
@media (max-width: 1100px) { .topbar__search input { width: 180px; } .topbar__title a, .topbar__title > span:first-of-type { display: none; } }
@media (max-width: 1024px) { .grid--sidebar { grid-template-columns: 1fr; } }
@media (max-width: 768px) {
    .topbar { padding: 0 16px; gap: 12px; border-bottom: 1px solid var(--color-border); }
    .topbar__title { padding-left: 12px; overflow: hidden; }
    .topbar__title > span:last-child { overflow: hidden; text-overflow: ellipsis; }
    .topbar__actions { gap: 6px; }
    .content { padding: 24px 16px; }
    .content__header { align-items: flex-start; }
    .content__header-title h2 { font-size: 24px; }
    .grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .stat-card { padding: 16px; min-height: 128px; }
    .stat-card__icon { right: 16px; top: 16px; }
    .card__header { padding: 20px 16px 16px; }
    .card__body { padding: 16px; }
    .notif-panel { position: fixed; right: 16px; top: 60px; }
    .sidebar { z-index: 1100; }
    .sidebar-backdrop { z-index: 1050; }
}
@media (max-width: 380px) { .grid--4 { grid-template-columns: 1fr; } .topbar__actions .btn { padding-inline: 8px; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }
@media print { .sidebar, .topbar, .ai-fab, .skip-link { display: none; } .main-area { margin-left: 0; } }

/* Riva uses the same shell in its full page and floating composer. */
.riva-workspace { display: grid; grid-template-columns: 260px minmax(0, 1fr); min-height: 560px; height: min(740px, calc(100dvh - 190px)); border: 1px solid var(--color-border); border-radius: 12px; overflow: hidden; }
.riva-history { padding: 20px 16px; background: var(--color-bg); border-right: 1px solid var(--color-border); overflow-y: auto; }
.riva-conversations { display: flex; flex-direction: column; gap: 4px; margin-top: 16px; }
.riva-conversation { display: flex; flex-direction: column; text-align: left; padding: 12px; border: 0; border-radius: 6px; background: transparent; color: var(--color-text); cursor: pointer; gap: 4px; }
.riva-conversation strong { font-weight: 500; overflow-wrap: anywhere; }
.riva-conversation span { font-size: 11px; color: var(--color-text-muted); }
.riva-conversation:hover, .riva-conversation.active { background: var(--color-primary-50); color: var(--color-primary); }
.riva-thread { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.riva-thread__header { padding: 20px 24px; border-bottom: 1px solid var(--color-border); }
.riva-thread__header h3 { font-size: 18px; overflow-wrap: anywhere; }
.riva-thread .ai-chat__messages { flex: 1; min-height: 0; max-height: none; padding: 24px; }
.riva-thread .ai-chat__msg { max-width: 88%; }
.riva-welcome { margin: auto; padding: 24px; text-align: center; color: var(--color-text-muted); }
.riva-message-label { font-size: 11px; font-weight: 600; margin-bottom: 4px; opacity: 0.85; }
.riva-message-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.riva-markdown { white-space: normal; }
.riva-markdown > * + * { margin-top: 12px; }
.riva-markdown h3, .riva-markdown h4, .riva-markdown h5, .riva-markdown h6 { font-family: var(--font-body); font-size: 1em; font-weight: 700; line-height: 1.5; }
.riva-markdown h3 { font-size: 1.125em; }
.riva-markdown ul, .riva-markdown ol { padding-left: 22px; }
.riva-markdown li + li { margin-top: 5px; }
.riva-markdown strong { font-weight: 700; }
.riva-markdown code { font-family: ui-monospace, monospace; font-size: 0.875em; padding: 2px 5px; background: var(--color-bg); border-radius: 4px; }
.riva-markdown pre { white-space: pre; max-width: 100%; }
.riva-markdown pre code { padding: 0; background: transparent; }
.riva-markdown blockquote { padding-left: 12px; border-left: 2px solid var(--color-border); color: var(--color-text-muted); }
.riva-markdown hr { border: 0; border-top: 1px solid var(--color-border); }
.riva-markdown a { text-decoration: underline; text-underline-offset: 3px; }
.riva-table { overflow-x: auto; max-width: 100%; }
.riva-table th, .riva-table td { padding: 8px 10px; font-size: 12px; white-space: normal; }
.riva-attachment { display: block; margin-top: 8px; padding: 6px 8px; border: 1px solid currentColor; border-radius: 5px; font-size: 12px; color: inherit; overflow-wrap: anywhere; }
.riva-composer { display: flex; align-items: flex-end; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--color-border); }
.riva-composer textarea { flex: 1; min-width: 0; max-height: 160px; resize: vertical; }
.riva-attach { position: relative; display: flex; align-items: center; justify-content: center; width: 36px; height: 36px; flex-shrink: 0; border: 1px solid var(--color-border); border-radius: 6px; cursor: pointer; color: var(--color-primary); }
.riva-attach:focus-within { outline: 2px solid var(--color-primary); outline-offset: 2px; }
.riva-attach input { position: absolute; inset: 0; width: 100%; opacity: 0; cursor: pointer; }
.riva-hint { padding: 0 16px 12px; font-size: 11px; color: var(--color-text-muted); }
.riva-error { padding: 10px 16px; color: var(--color-danger); font-size: 13px; }
.riva-files { display: flex; flex-wrap: wrap; gap: 6px; padding-inline: 16px; }
.riva-files > span { padding: 4px 8px; font-size: 11px; background: var(--color-primary-50); border-radius: 4px; overflow-wrap: anywhere; }
.riva-status { padding: 8px; color: var(--color-text-muted); font-size: 13px; }
.ai-chat__header { gap: 10px; }
.ai-chat__header h4 { font-size: 16px; }
.riva-history-link { margin-left: auto; color: inherit; font-size: 12px; text-decoration: underline; }
.riva-close { background: transparent; color: inherit; border: 0; font-size: 24px; width: 32px; height: 32px; cursor: pointer; }
.ai-chat { max-height: calc(100dvh - 100px); }
@media (max-width: 768px) {
    .riva-workspace { grid-template-columns: 1fr; height: auto; min-height: 0; overflow: visible; }
    .riva-history { border-right: 0; border-bottom: 1px solid var(--color-border); max-height: 240px; }
    .riva-thread { min-height: 520px; height: 70dvh; }
    .riva-thread .ai-chat__messages { padding: 16px; }
    .riva-thread .ai-chat__msg { max-width: 95%; }
}
