/* ==========================================================================
   Cuadro Compass — stylesheet
   Plain CSS. No framework, no inline styles, no animations.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Fonts
   -------------------------------------------------------------------------- */

@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('../fonts/inter-400.woff2') format('woff2');
}

@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url('../fonts/inter-500.woff2') format('woff2');
}

@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url('../fonts/inter-600.woff2') format('woff2');
}

@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('../fonts/inter-700.woff2') format('woff2');
}

@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 800;
    font-display: swap;
    src: url('../fonts/inter-800.woff2') format('woff2');
}

/* --------------------------------------------------------------------------
   2. Design tokens
   -------------------------------------------------------------------------- */

:root {
    --bg: #f0f4f8;
    --bg-alt: #e2e8f0;
    --surface: #ffffff;
    --surface-muted: #f8fafc;
    --panel: rgba(255, 255, 255, 0.6);
    --panel-alt: rgba(241, 245, 249, 0.4);
    --border: rgba(255, 255, 255, 0.6);
    --border-solid: #e2e8f0;
    --border-strong: #cbd5e1;

    --text: #334155;
    --text-strong: #1e293b;
    --text-dark: #0f172a;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --brand: #131c2f;

    --blue: #2563eb;
    --blue-soft: #dbeafe;
    --blue-text: #1d4ed8;
    --green: #059669;
    --green-soft: #d1fae5;
    --green-text: #047857;
    --amber: #d97706;
    --amber-soft: #fef3c7;
    --amber-text: #b45309;
    --rose: #e11d48;
    --rose-soft: #ffe4e6;
    --rose-text: #be123c;
    --indigo: #4f46e5;
    --indigo-soft: #e0e7ff;
    --indigo-text: #4338ca;
    --slate-soft: #f1f5f9;

    --shadow-soft: 0 10px 40px -10px rgba(148, 163, 184, 0.15);
    --shadow-panel: 0 20px 40px -10px rgba(19, 28, 47, 0.08),
                    inset 0 1px 0 rgba(255, 255, 255, 0.8);
    --shadow-sidebar: 0 20px 50px rgba(19, 28, 47, 0.08);
    --shadow-float: 0 25px 50px -12px rgba(19, 28, 47, 0.15);

    --radius-sm: 8px;
    --radius: 14px;
    --radius-lg: 20px;
    --radius-xl: 28px;
    --radius-2xl: 36px;
    --radius-pill: 999px;

    --sidebar-w-min: 200px;
    --sidebar-w-max: 340px;
    --sidebar-w-collapsed: 76px;
}

/* --------------------------------------------------------------------------
   3. Reset & base
   -------------------------------------------------------------------------- */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    height: 100vh;
    display: flex;
    overflow: hidden;
    /* Anchors the absolutely positioned global search. */
    position: relative;
    font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text);
    background-color: var(--bg);
    background-image:
        radial-gradient(circle at 0% 0%, rgba(226, 232, 240, 0.6) 0%, transparent 40%),
        radial-gradient(circle at 100% 0%, rgba(203, 213, 225, 0.5) 0%, transparent 40%),
        radial-gradient(circle at 100% 100%, rgba(241, 245, 249, 0.5) 0%, transparent 40%),
        linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
    background-attachment: fixed;
}

body::selection,
::selection {
    background: var(--bg-alt);
    color: var(--text-dark);
}

h1, h2, h3, h4, h5, h6 {
    margin: 0;
    font-weight: 700;
    color: var(--text-dark);
}

p {
    margin: 0;
}

ul, ol {
    margin: 0;
    padding: 0;
}

a {
    color: inherit;
    text-decoration: none;
}

button {
    font-family: inherit;
    font-size: inherit;
    color: inherit;
    background: none;
    border: 0;
    cursor: pointer;
}

table {
    width: 100%;
    border-collapse: collapse;
}

/* --------------------------------------------------------------------------
   4. Icons (SVG sprite)
   -------------------------------------------------------------------------- */

.icon {
    width: 1em;
    height: 1em;
    fill: currentColor;
    flex-shrink: 0;
    vertical-align: -0.125em;
}

.icon-lg { width: 1.5em; height: 1.5em; }
.icon-xl { width: 2em; height: 2em; }

/* --------------------------------------------------------------------------
   5. Layout
   -------------------------------------------------------------------------- */

.sidebar-container {
    height: 100vh;
    flex-shrink: 0;
    padding: 16px 0 16px 16px;
    z-index: 50;
}

.sidebar {
    width: max-content;
    min-width: var(--sidebar-w-min);
    max-width: var(--sidebar-w-max);
    height: calc(100vh - 32px);
    display: flex;
    flex-direction: column;
    position: relative;
    background: linear-gradient(180deg, rgba(248, 250, 252, 0.8) 0%, rgba(241, 245, 249, 0.6) 100%);
    border: 1px solid var(--border);
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-sidebar);
}

.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    position: relative;
    z-index: 0;
}

.app-view {
    width: 100%;
    max-width: 1600px;
    margin: 0 auto;
    padding: 32px 40px 40px;
}

/* --------------------------------------------------------------------------
   6. Sidebar
   -------------------------------------------------------------------------- */

.sidebar-toggle {
    position: absolute;
    top: 40px;
    right: -18px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: var(--text-muted);
    background: var(--surface);
    border: 1px solid var(--slate-soft);
    border-radius: 50%;
    box-shadow: var(--shadow-soft);
    z-index: 50;
}

.sidebar-toggle:hover {
    color: var(--text-strong);
}

.sidebar-body {
    flex: 1;
    min-height: 0;
    padding: 0 14px 12px;
    overflow-y: auto;
    overflow-anchor: none;
    scrollbar-width: thin;
}

.sidebar-body::-webkit-scrollbar { width: 5px; }
.sidebar-body::-webkit-scrollbar-track { background: transparent; }
.sidebar-body::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 10px; }

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
    padding: 22px 20px 18px;
    overflow: hidden;
}

.sidebar-logo-mark {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 18px;
    color: var(--text-strong);
    background: linear-gradient(135deg, #ffffff 0%, var(--surface-muted) 100%);
    border: 1px solid var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-soft);
}

.sidebar-logo-title {
    display: block;
    font-size: 19px;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.15;
    color: var(--text-dark);
}

.nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-group-label {
    margin: 16px 0 4px;
    padding: 0 16px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--text-muted);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    align-self: stretch;
    padding: 10px 16px;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--text-secondary);
    border: 1px solid transparent;
    border-radius: var(--radius-pill);
}

.nav-item:hover {
    color: var(--brand);
    background: rgba(255, 255, 255, 0.6);
    border-color: rgba(255, 255, 255, 0.5);
    box-shadow: 0 4px 15px rgba(19, 28, 47, 0.05);
}

.nav-item.active {
    font-weight: 700;
    color: var(--brand);
    background: linear-gradient(135deg, #ffffff 0%, var(--slate-soft) 100%);
    border-color: rgba(255, 255, 255, 0.8);
    box-shadow: 0 8px 20px rgba(19, 28, 47, 0.08),
                inset 0 1px 0 rgba(255, 255, 255, 1);
}

.nav-item .icon {
    width: 20px;
    font-size: 16px;
}

/* User block */

.user-menu-container {
    position: relative;
    flex-shrink: 0;
    margin: 0 10px 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border-solid);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-width: 0;
    padding: 10px;
    text-align: left;
    overflow: hidden;
    border: 1px solid transparent;
    border-radius: var(--radius-xl);
}

.user-profile:hover {
    background: rgba(255, 255, 255, 0.4);
    border-color: rgba(255, 255, 255, 0.5);
}

.user-avatar {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 12px;
    font-weight: 700;
    color: #ffffff;
    background: linear-gradient(135deg, var(--brand) 0%, #334155 100%);
    border: 1px solid var(--border);
    border-radius: 50%;
}

.user-meta {
    flex: 1;
    min-width: 0;
    max-width: 150px;
    overflow: hidden;
}

.user-name {
    display: block;
    font-size: 14px;
    font-weight: 700;
    color: var(--text-strong);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    display: block;
    font-size: 10px;
    font-weight: 500;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-menu-popup {
    position: absolute;
    bottom: 0;
    left: 100%;
    margin-left: 12px;
    width: 240px;
    padding: 8px;
    display: none;
    flex-direction: column;
    gap: 4px;
    background: var(--surface);
    border: 1px solid var(--border-solid);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-float);
    z-index: 60;
}

.user-menu-popup.open {
    display: flex;
}

.user-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 16px;
    font-size: 12px;
    font-weight: 700;
    color: var(--rose);
    text-align: left;
    border-radius: var(--radius-lg);
}

.user-menu-item:hover {
    background: var(--rose-soft);
}

.user-menu-item form {
    display: contents;
}

/* Collapsed state */

.sidebar.collapsed {
    width: var(--sidebar-w-collapsed);
    min-width: var(--sidebar-w-collapsed);
    max-width: var(--sidebar-w-collapsed);
}

.sidebar.collapsed .sidebar-text {
    display: none;
}

.sidebar.collapsed .sidebar-body,
.sidebar.collapsed .nav-item,
.sidebar.collapsed .user-profile {
    padding-left: 0;
    padding-right: 0;
    justify-content: center;
}

.sidebar.collapsed .nav {
    align-items: center;
}

/* The "Other" label is hidden when collapsed; a rule stands in for it. */
.sidebar.collapsed .nav-group-label.sidebar-text {
    display: block;
    width: 24px;
    height: 1px;
    margin: 10px 0;
    padding: 0;
    overflow: hidden;
    text-indent: -999px;
    background: var(--border-solid);
}

.sidebar.collapsed .sidebar-logo {
    padding: 18px 0 14px;
    justify-content: center;
}

.sidebar.collapsed .sidebar-logo-mark {
    width: 38px;
    height: 38px;
    font-size: 17px;
}

.sidebar.collapsed .nav-item {
    width: 44px;
}

.sidebar.collapsed .user-menu-popup {
    width: 200px;
}

/* --------------------------------------------------------------------------
   7. Panels & cards
   -------------------------------------------------------------------------- */

.panel {
    background: linear-gradient(135deg, var(--panel) 0%, var(--panel-alt) 100%);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-panel);
}

.panel-solid {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-panel);
}

.panel-pad {
    padding: 24px;
}

.card {
    padding: 20px;
    background: var(--surface);
    border: 1px solid var(--border-solid);
    border-radius: var(--radius-lg);
}

.section-block {
    margin-bottom: 24px;
}

.panel-head {
    padding-right: 20px;
}

.pager {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 20px;
    font-size: 13px;
    border-top: 1px solid var(--border-solid);
}

/* --------------------------------------------------------------------------
   8. Page header
   -------------------------------------------------------------------------- */

.page-head {
    display: flex;
    align-items: flex-start;
    /* Pages carry no title: an actions-only head sits flush right. */
    justify-content: flex-end;
    gap: 24px;
    margin-bottom: 28px;
}

/* Detail pages still lead with the record identity. */
.page-head:has(h1) {
    justify-content: space-between;
}

.page-head h1,
.page-title {
    font-size: 34px;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--text-dark);
}

.page-head h1 + p,
.page-sub {
    margin-top: 4px;
    font-size: 15px;
    color: var(--text-secondary);
}

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

/* --------------------------------------------------------------------------
   9. Buttons
   -------------------------------------------------------------------------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 22px;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-strong);
    background: var(--surface);
    border: 1px solid var(--border-solid);
    border-radius: var(--radius-pill);
    box-shadow: var(--shadow-soft);
}

.btn:hover {
    border-color: var(--border-strong);
}

.btn-primary {
    color: #ffffff;
    background: linear-gradient(135deg, var(--brand) 0%, var(--text-strong) 100%);
    border-color: transparent;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #0b1220 0%, var(--brand) 100%);
}

.btn-block {
    width: 100%;
}

.btn-icon {
    padding: 10px;
    width: 38px;
    height: 38px;
    color: var(--text-muted);
    box-shadow: none;
    background: transparent;
    border-color: transparent;
}

.btn-icon:hover {
    color: var(--text-strong);
    background: var(--surface);
}

.btn-danger {
    color: var(--rose);
    background: transparent;
    border-color: transparent;
    box-shadow: none;
}

.btn-danger:hover {
    background: var(--rose-soft);
}

/* --------------------------------------------------------------------------
   10. Forms
   -------------------------------------------------------------------------- */

main form label,
.field-label {
    display: block;
    margin-bottom: 8px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--text-muted);
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
input[type="date"],
input[type="search"],
select,
textarea {
    width: 100%;
    padding: 14px 20px;
    font-family: inherit;
    font-size: 14px;
    color: var(--text);
    background-color: rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: var(--radius-lg);
    box-shadow: inset 0 2px 4px rgba(148, 163, 184, 0.05);
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    background-color: rgba(255, 255, 255, 0.9);
    border-color: var(--surface);
    box-shadow: 0 8px 20px rgba(19, 28, 47, 0.08),
                inset 0 0 0 1px var(--text-muted);
}

input::placeholder,
textarea::placeholder {
    color: var(--text-muted);
}

select {
    appearance: none;
    padding-right: 40px;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%2364748b' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 12px center;
    background-repeat: no-repeat;
    background-size: 1.2em 1.2em;
}

textarea {
    resize: vertical;
}

/* Global search — sits in the sidebar, above the nav. It follows the sidebar
   width instead of floating over the page, so it costs no room on the right. */

.search {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 4px;
    margin: 0 14px 10px;
    height: 40px;
    background: var(--surface);
    border: 1px solid var(--border-solid);
    border-radius: var(--radius-pill);
    box-shadow: var(--shadow-soft);
    overflow: hidden;
}

.search:focus-within {
    border-color: var(--border-strong);
}

.search-toggle {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--text-secondary);
}

.search:hover .search-toggle,
.search:focus-within .search-toggle {
    color: var(--text-dark);
}

.search input {
    width: 100%;
    min-width: 0;
    padding: 0 16px 0 0;
    font-size: 13px;
    background: transparent;
    border: 0;
    box-shadow: none;
    border-radius: 0;
}

.search input:focus {
    background: transparent;
    border: 0;
    box-shadow: none;
    outline: none;
}

/* Collapsed sidebar: the field goes, the icon stays as the click target. */
.sidebar.collapsed .search {
    width: 44px;
    margin-left: auto;
    margin-right: auto;
    justify-content: center;
}

/* --------------------------------------------------------------------------
   11. Tables
   -------------------------------------------------------------------------- */

.table-wrap {
    overflow-x: auto;
}

main table th,
.table th {
    padding: 16px 20px;
    font-size: 10px;
    font-weight: 700;
    text-align: left;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-muted);
    white-space: nowrap;
}

main table td,
.table td {
    padding: 18px 20px;
    font-size: 14px;
    border-top: 1px solid var(--border-solid);
    vertical-align: middle;
}

main table tbody tr:hover td,
.table tbody tr:hover td {
    background: rgba(255, 255, 255, 0.5);
}

main table .col-right,
.table .col-right {
    text-align: right;
}

main table td,
.cell-muted {
    color: var(--text-secondary);
}

.cell-strong {
    font-weight: 600;
    color: var(--text-strong);
}

/* --------------------------------------------------------------------------
   12. Badges & pills
   -------------------------------------------------------------------------- */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
    border-radius: var(--radius-sm);
    white-space: nowrap;
}

.badge-blue   { color: var(--blue-text);   background: var(--blue-soft); }
.badge-green  { color: var(--green-text);  background: var(--green-soft); }
.badge-amber  { color: var(--amber-text);  background: var(--amber-soft); }
.badge-rose   { color: var(--rose-text);   background: var(--rose-soft); }
.badge-indigo { color: var(--indigo-text); background: var(--indigo-soft); }
.badge-slate  { color: var(--text-secondary); background: var(--slate-soft); }

.badge-upper {
    text-transform: uppercase;
}

.count-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    font-size: 10px;
    font-weight: 700;
    color: #ffffff;
    background: var(--rose);
    border-radius: var(--radius-pill);
}

.dot-online {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--green);
    flex-shrink: 0;
}

/* --------------------------------------------------------------------------
   13. Section labels & breadcrumb
   -------------------------------------------------------------------------- */

.panel > h2,
.section-label {
    padding: 20px 24px 12px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--text-muted);
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
    font-size: 13px;
    color: var(--text-secondary);
}

.breadcrumb .sep {
    color: var(--text-muted);
}

/* --------------------------------------------------------------------------
   14. KPI tiles
   -------------------------------------------------------------------------- */

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.kpi {
    padding: 24px 28px;
}

.kpi-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--text-secondary);
}

.kpi-value {
    margin-top: 8px;
    font-size: 32px;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--text-dark);
}

/* --------------------------------------------------------------------------
   15. Tabs
   -------------------------------------------------------------------------- */

.tabs {
    display: flex;
    align-items: center;
    gap: 32px;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border-solid);
}

.tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 2px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}

.tab:hover {
    color: var(--text-strong);
}

.tab.active {
    font-weight: 700;
    color: var(--text-dark);
    border-bottom-color: var(--text-dark);
}

/* --------------------------------------------------------------------------
   16. Files page
   -------------------------------------------------------------------------- */

.folder-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 20px;
    padding: 0 24px 24px;
}

.folder-card {
    padding: 20px;
    background: var(--surface);
    border: 1px solid var(--border-solid);
    border-radius: var(--radius-lg);
}

.folder-icon {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    font-size: 18px;
    border-radius: var(--radius);
}

.folder-name {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-strong);
}

.folder-meta {
    margin-top: 4px;
    font-size: 12px;
    color: var(--text-secondary);
}

.file-icon {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 14px;
    border-radius: var(--radius-sm);
}

.tone-indigo { color: var(--indigo-text); background: var(--indigo-soft); }
.tone-green  { color: var(--green-text);  background: var(--green-soft); }
.tone-amber  { color: var(--amber-text);  background: var(--amber-soft); }
.tone-rose   { color: var(--rose-text);   background: var(--rose-soft); }
.tone-blue   { color: var(--blue-text);   background: var(--blue-soft); }

.file-name-cell {
    display: flex;
    align-items: center;
    gap: 14px;
}

/* --------------------------------------------------------------------------
   17. Chat page
   -------------------------------------------------------------------------- */

.chat-layout {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 24px;
    align-items: start;
}

.chat-sidebar {
    padding: 20px;
}

.channel-list {
    list-style: none;
    margin-top: 8px;
}

.channel-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    font-size: 14px;
    color: var(--text-secondary);
    border-radius: var(--radius);
}

.channel-item:hover {
    background: rgba(255, 255, 255, 0.6);
}

.channel-item.active {
    font-weight: 700;
    color: var(--text-dark);
    background: var(--surface);
}

.channel-hash {
    color: var(--text-muted);
}

.channel-name {
    flex: 1;
}

.dm-avatar {
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 9px;
    font-weight: 700;
    color: var(--text-secondary);
    background: var(--slate-soft);
    border-radius: 50%;
}

.chat-main {
    display: flex;
    flex-direction: column;
    min-height: 640px;
}

.chat-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 22px 26px;
    border-bottom: 1px solid var(--border-solid);
}

.chat-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-dark);
}

.chat-topic {
    margin-top: 2px;
    font-size: 13px;
    color: var(--text-secondary);
}

.chat-head-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.chat-messages {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 22px;
    padding: 26px;
    overflow-y: auto;
}

.message {
    display: flex;
    gap: 14px;
}

.message-avatar {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 11px;
    font-weight: 700;
    color: #ffffff;
    border-radius: 50%;
}

.avatar-slate  { background: #334155; }
.avatar-rose   { background: var(--rose); }
.avatar-indigo { background: var(--indigo); }
.avatar-amber  { background: var(--amber); }

.message-head {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 3px;
}

.message-author {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-strong);
}

.message-time {
    font-size: 11px;
    color: var(--text-muted);
}

.message-text {
    font-size: 14px;
    color: var(--text);
}

.chat-composer {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px 26px;
    border-top: 1px solid var(--border-solid);
}

.chat-composer input {
    flex: 1;
    border-radius: var(--radius-pill);
}

.composer-send {
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #ffffff;
    background: var(--brand);
    border-radius: 50%;
}

/* --------------------------------------------------------------------------
   18. Notes page
   -------------------------------------------------------------------------- */

.notes-layout {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 24px;
    align-items: start;
}

.notes-list {
    padding: 20px;
}

.notes-filters {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 16px 0 8px;
}

.chip {
    padding: 6px 14px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    border-radius: var(--radius-pill);
}

.chip:hover {
    background: rgba(255, 255, 255, 0.6);
}

.chip.active {
    font-weight: 700;
    color: #ffffff;
    background: var(--brand);
}

.note-item {
    display: block;
    padding: 16px;
    border-top: 1px solid var(--border-solid);
}

.note-item:first-of-type {
    border-top: 0;
}

.note-item:hover {
    background: rgba(255, 255, 255, 0.5);
}

.note-item.active {
    background: var(--surface);
    border-radius: var(--radius);
}

.note-item-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.note-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-strong);
}

.note-preview {
    margin-top: 4px;
    font-size: 13px;
    color: var(--text-secondary);
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.note-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
    font-size: 11px;
    color: var(--text-muted);
}

.note-pin {
    color: var(--amber);
}

.note-editor {
    min-height: 640px;
    display: flex;
    flex-direction: column;
}

.editor-toolbar {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-solid);
}

.editor-toolbar .spacer {
    flex: 1;
}

.editor-divider {
    width: 1px;
    height: 20px;
    margin: 0 8px;
    background: var(--border-solid);
}

.editor-body {
    padding: 32px 40px;
}

.editor-title {
    font-size: 30px;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--text-dark);
}

.editor-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 10px;
    font-size: 12px;
    color: var(--text-muted);
}

.editor-content {
    margin-top: 28px;
    font-size: 15px;
    line-height: 1.7;
}

.editor-content h2 {
    margin: 28px 0 12px;
    font-size: 18px;
}

.editor-content ul {
    padding-left: 22px;
    list-style: disc;
}

.editor-content li {
    margin-bottom: 8px;
}

.editor-content p + p {
    margin-top: 12px;
}

/* --------------------------------------------------------------------------
   19. Login page
   -------------------------------------------------------------------------- */

.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    overflow: auto;
}

.login-card {
    width: 100%;
    max-width: 440px;
    padding: 40px;
}

.login-head {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 40px;
}

.login-field {
    margin-bottom: 24px;
}

.login-error {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 24px;
    font-size: 12px;
    font-weight: 700;
    color: var(--rose);
}

.login-submit {
    margin-top: 8px;
    padding: 16px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.15em;
}

/* --------------------------------------------------------------------------
   20. Empty state
   -------------------------------------------------------------------------- */

.empty {
    padding: 80px 24px;
    text-align: center;
}

.empty .icon {
    font-size: 34px;
    color: var(--text-muted);
}

.empty-title {
    margin-top: 18px;
    font-size: 17px;
    font-weight: 700;
    color: var(--text-strong);
}

.empty-text {
    margin-top: 6px;
    font-size: 14px;
    color: var(--text-secondary);
}

/* --------------------------------------------------------------------------
   21. Utilities
   -------------------------------------------------------------------------- */

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.stack-sm { display: flex; flex-direction: column; gap: 8px; }
.row      { display: flex; align-items: center; gap: 12px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.spacer   { flex: 1; }
.nowrap   { white-space: nowrap; }
.text-muted { color: var(--text-secondary); }
.text-faint { color: var(--text-muted); }

/* --------------------------------------------------------------------------
   22. Mobile navigation
   -------------------------------------------------------------------------- */

.mobile-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 60;
    padding: 8px 6px calc(8px + env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, 0.95);
    border-top: 1px solid var(--border);
}

.mnav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 4px 0;
    font-size: 10px;
    font-weight: 700;
    color: var(--text-muted);
}

.mnav-item .icon {
    font-size: 17px;
}

.mnav-item.active {
    color: var(--brand);
}

/* --------------------------------------------------------------------------
   23. Toolbar & view switch
   -------------------------------------------------------------------------- */

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

.toolbar .search {
    max-width: 320px;
}

.view-switch {
    display: inline-flex;
    padding: 3px;
    background: var(--slate-soft);
    border-radius: var(--radius-pill);
}

.view-switch a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 16px;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-secondary);
    border-radius: var(--radius-pill);
}

.view-switch a.active {
    color: var(--text-dark);
    background: var(--surface);
    box-shadow: var(--shadow-soft);
}

/* --------------------------------------------------------------------------
   24. Kanban board
   -------------------------------------------------------------------------- */

.board {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    overflow-x: auto;
    padding-bottom: 12px;
}

.board-column {
    flex: 0 0 300px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.45);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
}

.board-column-head {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 4px;
}

.board-column-title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-secondary);
}

.board-count {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
}

.board-card {
    display: block;
    padding: 14px;
    background: var(--surface);
    border: 1px solid var(--border-solid);
    border-radius: var(--radius);
    box-shadow: var(--shadow-soft);
}

.board-card:hover {
    border-color: var(--border-strong);
}

.board-card-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.board-card-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-strong);
}

.board-card-sub {
    font-size: 12px;
    color: var(--text-secondary);
}

.board-card-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 12px;
    font-size: 11px;
    color: var(--text-muted);
}

.mini-avatar {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 10px;
    font-weight: 700;
    color: #ffffff;
    border-radius: 50%;
}

/* --------------------------------------------------------------------------
   25. Progress bar
   -------------------------------------------------------------------------- */

.progress {
    height: 6px;
    background: var(--slate-soft);
    border-radius: var(--radius-pill);
    overflow: hidden;
}

.progress > span {
    display: block;
    height: 100%;
    background: var(--brand);
    border-radius: var(--radius-pill);
}

/* Fill widths in 5% steps — inline styles are not allowed, so the value is
   rounded to the nearest step and picked up as a class. */
.progress-0   { width: 0; }
.progress-5   { width: 5%; }
.progress-10  { width: 10%; }
.progress-15  { width: 15%; }
.progress-20  { width: 20%; }
.progress-25  { width: 25%; }
.progress-30  { width: 30%; }
.progress-35  { width: 35%; }
.progress-40  { width: 40%; }
.progress-45  { width: 45%; }
.progress-50  { width: 50%; }
.progress-55  { width: 55%; }
.progress-60  { width: 60%; }
.progress-65  { width: 65%; }
.progress-70  { width: 70%; }
.progress-75  { width: 75%; }
.progress-80  { width: 80%; }
.progress-85  { width: 85%; }
.progress-90  { width: 90%; }
.progress-95  { width: 95%; }
.progress-100 { width: 100%; }

.progress-row {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 140px;
}

.progress-row .progress {
    flex: 1;
}

.progress-value {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    min-width: 34px;
    text-align: right;
}

/* --------------------------------------------------------------------------
   26. Detail layout
   -------------------------------------------------------------------------- */

.detail-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 24px;
    align-items: start;
}

.detail-section + .detail-section {
    margin-top: 20px;
}

.detail-list {
    list-style: none;
}

.detail-list li {
    display: flex;
    gap: 16px;
    padding: 12px 0;
    border-top: 1px solid var(--border-solid);
    font-size: 13px;
}

.detail-list li:first-child {
    border-top: 0;
}

.detail-key {
    flex: 0 0 120px;
    color: var(--text-secondary);
}

.detail-value {
    flex: 1;
    color: var(--text-strong);
    font-weight: 500;
    word-break: break-word;
}

/* Sequence strip */

.sequence {
    display: flex;
    align-items: stretch;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
}

.sequence-step {
    flex: 1;
    min-width: 96px;
    padding: 14px 12px;
    text-align: center;
    background: var(--surface);
    border: 1px solid var(--border-solid);
    border-radius: var(--radius);
}

.sequence-step.done {
    background: var(--green-soft);
    border-color: transparent;
}

.sequence-step.current {
    border-color: var(--brand);
    box-shadow: 0 0 0 1px var(--brand) inset;
}

.sequence-day {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
}

.sequence-channel {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-strong);
}

/* Timeline */

.timeline {
    list-style: none;
}

.timeline li {
    display: flex;
    gap: 14px;
    padding: 14px 0;
    border-top: 1px solid var(--border-solid);
}

.timeline li:first-child {
    border-top: 0;
}

.timeline-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 12px;
    color: var(--text-secondary);
    background: var(--slate-soft);
    border-radius: 50%;
}

.timeline-when {
    font-size: 11px;
    color: var(--text-muted);
}

.timeline-what {
    font-size: 13px;
    color: var(--text-strong);
}

/* Message rows on the lead detail */

.msg-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 0;
    border-top: 1px solid var(--border-solid);
}

.msg-row:first-of-type {
    border-top: 0;
}

.msg-row.inbound .msg-subject {
    font-weight: 700;
    color: var(--text-dark);
}

.msg-body {
    flex: 1;
    min-width: 0;
}

.msg-subject {
    font-size: 13px;
    color: var(--text-strong);
}

.msg-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
    font-size: 11px;
    color: var(--text-muted);
}

/* Mockup notice */

.mock-note {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    padding: 12px 16px;
    font-size: 12px;
    color: var(--amber-text);
    background: var(--amber-soft);
    border-radius: var(--radius);
}

/* --------------------------------------------------------------------------
   27. Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 1023px) {
    .sidebar-container {
        display: none;
    }

    .mobile-nav {
        display: flex;
    }

    .app-view {
        padding: 64px 20px 96px;
    }

    /* The sidebar is gone here, so the search floats over the page instead. */
    .search {
        position: absolute;
        top: 16px;
        left: 20px;
        right: 20px;
        z-index: 40;
        margin: 0;
    }

    .chat-layout,
    .notes-layout,
    .detail-layout {
        grid-template-columns: 1fr;
    }

    .page-head {
        flex-direction: column;
        gap: 16px;
    }

    .page-head h1,
    .page-title {
        font-size: 27px;
    }
}
