/* MetaLink — layout on top of Bootstrap 5 (mobile-first). */
:root { --ml-sidebar-w: 240px; --ml-topbar-h: 56px; }

body { background: var(--bs-body-bg); }

.ml-topbar { height: var(--ml-topbar-h); flex-wrap: nowrap; }
.ml-topbar > .d-flex { min-width: 0; }
.ml-client-select { max-width: 220px; min-width: 0; }
@media (max-width: 575.98px) {
    .ml-topbar .navbar-brand { font-size: 1rem; margin-right: .5rem; }
    .ml-client-select { max-width: 150px; }
}

.ml-shell { display: flex; min-height: calc(100vh - var(--ml-topbar-h)); }

.ml-sidebar {
    width: var(--ml-sidebar-w);
    flex: 0 0 var(--ml-sidebar-w);
    overflow-y: auto;
    position: sticky;
    top: var(--ml-topbar-h);
    height: calc(100vh - var(--ml-topbar-h));
}
.ml-sidebar .nav-link { color: var(--bs-body-color); padding: .35rem 1rem; font-size: .92rem; border-radius: .375rem; margin: 0 .5rem; }
.ml-sidebar .nav-link:hover { background: var(--bs-secondary-bg); }
.ml-sidebar .nav-link.active { background: var(--bs-primary); color: #fff; }
.ml-sidebar .nav-link.disabled { color: var(--bs-secondary-color); }
.ml-sidebar .nav-link i { width: 1.25rem; display: inline-block; }
.ml-nav-group { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--bs-secondary-color); padding: .9rem 1.5rem .25rem; }

.ml-main { flex: 1 1 auto; min-width: 0; }

@media (max-width: 991.98px) {
    .ml-sidebar { position: fixed; left: 0; z-index: 1030; transform: translateX(-100%); transition: transform .2s ease; }
    .ml-sidebar.show { transform: translateX(0); box-shadow: 0 0 1rem rgba(0,0,0,.2); }
}

.ml-stat { border-left: 4px solid var(--bs-primary); }
.ml-stat .value { font-size: 1.6rem; font-weight: 600; line-height: 1.1; }
.ml-stat .label { font-size: .8rem; color: var(--bs-secondary-color); }
.ml-stat.warn { border-left-color: var(--bs-warning); }
.ml-stat.bad { border-left-color: var(--bs-danger); }

.ml-table td, .ml-table th { vertical-align: middle; font-size: .9rem; }
.ml-mono { font-family: var(--bs-font-monospace); font-size: .82rem; }
.ml-wrap { white-space: pre-wrap; word-break: break-word; }

.ml-auth { max-width: 420px; margin: 8vh auto; }

/* ---- Phase 6: conversation thread + tags */
.ml-thread { display: flex; flex-direction: column; gap: .5rem; }
.ml-msg { max-width: 80%; padding: .5rem .75rem; border-radius: .75rem; }
.ml-msg-in { align-self: flex-start; background: var(--bs-tertiary-bg, #f1f3f5); border-bottom-left-radius: .25rem; }
.ml-msg-out { align-self: flex-end; background: #dbeafe; border-bottom-right-radius: .25rem; }
.ml-thumb { max-width: 160px; max-height: 160px; border-radius: .375rem; object-fit: cover; }
.ml-tag { font-weight: 500; }

/* ---- Phase 8: unified inbox */
.ml-inbox-list { max-height: calc(100vh - 260px); overflow-y: auto; }
.ml-w-sm { width: 6rem; }
.ml-inbox-thread { height: calc(100vh - 330px); min-height: 280px; overflow-y: auto; }
.ml-pre { white-space: pre-wrap; }
@media (max-width: 991.98px) {
  .ml-inbox-list { max-height: none; }
  .ml-inbox-thread { height: calc(100vh - 300px); }
}

/* Phase 14 reports: SVG day charts (no inline styles — CSP) */
.ml-chart { width: 100%; height: auto; }
.ml-chart-label { font-size: 11px; fill: var(--bs-secondary-color); }
.ml-bar-a { fill: var(--bs-primary); }
.ml-bar-b { fill: var(--bs-success); }
.ml-bar-c { fill: var(--bs-danger); }
.ml-legend { display: inline-block; width: .75rem; height: .75rem; border-radius: 2px; vertical-align: middle; }
.ml-bar-a-bg { background: var(--bs-primary); }
.ml-bar-b-bg { background: var(--bs-success); }
.ml-bar-c-bg { background: var(--bs-danger); }
.ml-report-table { max-height: 420px; overflow-y: auto; }
