:root {
    --background: #ffffff;
    --surface: #ffffff;
    --surface-subtle: #fafafa;
    --surface-muted: #f6f7f9;
    --foreground: #111827;
    --muted-foreground: #6b7280;
    --border: #e5e7eb;
    --border-strong: #d7dce3;
    --primary: #111827;
    --primary-foreground: #ffffff;
    --ring: rgba(17, 24, 39, .12);
    --success: #07834a;
    --success-bg: #ecfdf3;
    --warning: #a15c00;
    --warning-bg: #fff7e6;
    --danger: #b42318;
    --danger-bg: #fff1f0;
    --blue: #2563eb;
    --blue-bg: #eff6ff;
    --violet: #7c3aed;
    --violet-bg: #f5f3ff;
    --amber: #c56a00;
    --amber-bg: #fff8eb;
    --sidebar-width: 268px;
    --radius-sm: 9px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --shadow-xs: 0 1px 2px rgba(16, 24, 40, .03);
    --shadow-sm: 0 1px 3px rgba(16, 24, 40, .05), 0 1px 2px rgba(16, 24, 40, .03);
    --shadow-md: 0 12px 30px rgba(16, 24, 40, .06);
}

* { box-sizing: border-box; }
html { color-scheme: light; background: var(--background); }
body {
    margin: 0;
    min-height: 100vh;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--foreground);
    background: var(--background);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
svg.icon { width: 18px; height: 18px; flex: none; }

/* ---------- Staff app shell ---------- */
.app-shell { min-height: 100vh; background: #fff; }
.sidebar {
    width: var(--sidebar-width);
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 50;
    display: flex;
    flex-direction: column;
    padding: 18px 14px 14px;
    background: #fff;
    border-right: 1px solid var(--border);
    transition: transform .22s ease;
}
.sidebar-brand {
    min-height: 54px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 8px 14px;
}
.brand-link { display: flex; align-items: center; gap: 11px; min-width: 0; }
.brand-mark {
    width: 38px;
    height: 38px;
    border-radius: 11px;
    display: grid;
    place-items: center;
    color: #fff;
    background: #111827;
    box-shadow: 0 6px 16px rgba(17, 24, 39, .12);
}
.brand-mark .icon { width: 19px; height: 19px; }
.brand-copy { display: grid; min-width: 0; }
.brand-copy strong { font-size: 14px; letter-spacing: -.01em; }
.brand-copy small { margin-top: 2px; color: var(--muted-foreground); font-size: 11px; }
.sidebar-close { display: none !important; }
.role-card {
    margin: 3px 4px 18px;
    padding: 11px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface-subtle);
    display: flex;
    align-items: center;
    gap: 10px;
}
.role-icon {
    width: 32px;
    height: 32px;
    border-radius: 9px;
    background: #fff;
    border: 1px solid var(--border);
    display: grid;
    place-items: center;
    color: #374151;
}
.role-icon .icon { width: 16px; height: 16px; }
.role-card > span:last-child { display: grid; }
.role-card small { font-size: 10px; color: var(--muted-foreground); text-transform: uppercase; letter-spacing: .07em; }
.role-card strong { margin-top: 2px; font-size: 13px; }
.sidebar-nav { display: grid; gap: 4px; }
.nav-caption {
    margin: 2px 10px 7px;
    color: #9ca3af;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .1em;
}
.nav-item {
    min-height: 42px;
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 0 11px;
    border-radius: 10px;
    color: #5b6472;
    font-size: 13px;
    font-weight: 600;
    transition: background .15s ease, color .15s ease, transform .15s ease;
}
.nav-item:hover { background: #f7f7f8; color: #111827; }
.nav-item.is-active { background: #f1f3f5; color: #111827; box-shadow: inset 0 0 0 1px rgba(17,24,39,.025); }
.nav-item.is-active .icon { stroke-width: 2.25; }
.sidebar-spacer { flex: 1; min-height: 24px; }
.security-note {
    margin: 0 4px 10px;
    padding: 11px;
    border-radius: 11px;
    background: #f8fafc;
    color: #5b6472;
    display: flex;
    gap: 9px;
    align-items: flex-start;
}
.security-note > .icon { margin-top: 1px; width: 15px; height: 15px; color: #667085; }
.security-note div { display: grid; gap: 2px; }
.security-note strong { font-size: 11px; color: #374151; }
.security-note small { font-size: 10px; line-height: 1.35; color: #98a2b3; }
.sidebar-user {
    border-top: 1px solid var(--border);
    padding: 13px 5px 2px;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 9px;
}
.user-meta { min-width: 0; display: grid; }
.user-meta strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.user-meta small { margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted-foreground); font-size: 10px; }

.workspace { min-height: 100vh; margin-left: var(--sidebar-width); background: #fff; }
.workspace-topbar {
    height: 70px;
    position: sticky;
    top: 0;
    z-index: 35;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 0 28px;
    background: rgba(255,255,255,.94);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(14px);
}
.workspace-heading { min-width: 0; display: flex; align-items: center; gap: 10px; }
.workspace-heading > div { min-width: 0; display: grid; gap: 2px; }
.workspace-heading strong { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.breadcrumb { color: #9ca3af; font-size: 10px; }
.workspace-actions { display: flex; align-items: center; gap: 10px; }
.top-role-badge {
    height: 30px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0 10px;
    border: 1px solid var(--border);
    border-radius: 999px;
    color: #5b6472;
    background: #fff;
    font-size: 11px;
    font-weight: 600;
}
.top-role-badge .icon { width: 13px; height: 13px; }
.menu-toggle { display: none !important; }
.sidebar-backdrop { display: none; }

/* ---------- Reusable controls ---------- */
.avatar {
    display: grid;
    place-items: center;
    flex: none;
    border-radius: 999px;
    color: #fff;
    background: linear-gradient(145deg, #111827, #374151);
    font-weight: 700;
    letter-spacing: -.02em;
}
.avatar-xs { width: 31px; height: 31px; font-size: 10px; }
.avatar-sm { width: 34px; height: 34px; font-size: 10px; }
.avatar-lg { width: 50px; height: 50px; font-size: 14px; }
.icon-button {
    width: 34px;
    height: 34px;
    display: inline-grid;
    place-items: center;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 9px;
    background: transparent;
    color: #667085;
    transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.icon-button:hover { background: #f7f7f8; border-color: var(--border); color: #111827; }
.icon-button .icon { width: 16px; height: 16px; }

.page-shell { width: 100%; max-width: 1500px; margin: 0 auto; padding: 38px 34px 64px; }
.staff-page { max-width: 1540px; }
.page-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; margin-bottom: 24px; }
.page-heading h2 { margin: 0; font-size: 28px; line-height: 1.15; letter-spacing: -.035em; }
.page-heading p { max-width: 700px; margin: 7px 0 0; color: var(--muted-foreground); font-size: 14px; line-height: 1.55; }
.page-heading-modern { padding-bottom: 7px; }
.compact-heading { margin-bottom: 20px; }
.eyebrow {
    display: inline-block;
    margin-bottom: 7px;
    color: #98a2b3;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .11em;
}
.page-status {
    height: 32px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 0 11px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: #fff;
    color: #667085;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}
.page-status .icon { width: 14px; height: 14px; }

.button {
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    border: 1px solid transparent;
    border-radius: 9px;
    padding: 8px 13px;
    font-weight: 650;
    font-size: 12px;
    line-height: 1;
    transition: transform .12s ease, background .15s ease, border-color .15s ease, box-shadow .15s ease, opacity .15s ease;
}
.button:active { transform: translateY(1px); }
.button:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.button-primary { color: var(--primary-foreground); background: var(--primary); border-color: var(--primary); box-shadow: var(--shadow-xs); }
.button-primary:hover { background: #222a35; border-color: #222a35; box-shadow: 0 3px 9px rgba(17, 24, 39, .12); }
.button-outline { color: #475467; background: #fff; border-color: var(--border); }
.button-outline:hover { color: #111827; background: #f8fafc; border-color: var(--border-strong); }
.button-danger { color: var(--danger); background: var(--danger-bg); border-color: #fecaca; }
.button-icon .icon { width: 15px; height: 15px; }

/* ---------- Dashboard cards ---------- */
.feature-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 15px; }
.feature-grid-two { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 980px; }
.feature-card {
    position: relative;
    min-height: 210px;
    padding: 21px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: #fff;
    box-shadow: var(--shadow-xs);
    display: flex;
    flex-direction: column;
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.feature-card:hover { transform: translateY(-2px); border-color: #d5d9df; box-shadow: var(--shadow-md); }
.feature-icon, .panel-title-icon {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 12px;
}
.feature-icon .icon, .panel-title-icon .icon { width: 20px; height: 20px; }
.tone-blue { color: var(--blue); background: var(--blue-bg); }
.tone-violet { color: var(--violet); background: var(--violet-bg); }
.tone-amber { color: var(--amber); background: var(--amber-bg); }
.feature-copy { margin-top: auto; padding-top: 28px; padding-right: 28px; }
.feature-kicker { color: #98a2b3; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.feature-copy h3 { margin: 6px 0 5px; font-size: 18px; letter-spacing: -.02em; }
.feature-copy p { margin: 0; color: var(--muted-foreground); font-size: 12px; line-height: 1.5; }
.feature-arrow { position: absolute; top: 20px; right: 20px; color: #aeb4bd; }
.feature-arrow .icon { width: 17px; height: 17px; }
.feature-card:hover .feature-arrow { color: #111827; }
.info-grid { margin-top: 15px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; }

/* ---------- Panels / forms / tables ---------- */
.content-grid { display: grid; gap: 18px; align-items: start; }
.management-grid { grid-template-columns: minmax(390px, .82fr) minmax(560px, 1.45fr); }
.panel, .boards-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xs);
}
.panel { padding: 20px; }
.soft-panel { padding: 18px; background: #fcfcfd; }
.panel h3 { margin: 0; font-size: 15px; letter-spacing: -.015em; }
.panel p { margin: 4px 0 0; color: var(--muted-foreground); font-size: 11px; line-height: 1.45; }
.panel-title-row, .panel-icon-title { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.panel-icon-title { margin-bottom: 0; }
.panel-title-row > div:last-child, .panel-icon-title > div:last-child { min-width: 0; }
.mini-icon {
    width: 34px;
    height: 34px;
    flex: none;
    border-radius: 10px;
    display: grid;
    place-items: center;
    background: #fff;
    border: 1px solid var(--border);
    color: #475467;
}
.mini-icon .icon { width: 16px; height: 16px; }
.panel-header { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-bottom: 14px; }
.modern-panel-header { min-height: 44px; margin-bottom: 12px; }
.form-panel { position: sticky; top: 90px; }
.form-grid { display: grid !important; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px !important; }
.form-span { grid-column: 1 / -1; }
.stack { display: grid; gap: 14px; }
label { display: grid; gap: 6px; font-size: 11px; color: #475467; font-weight: 650; }
label > span { display: block; }
input, textarea, select {
    width: 100%;
    border: 1px solid var(--border);
    background: #fff;
    border-radius: 9px;
    padding: 10px 11px;
    color: var(--foreground);
    outline: none;
    font-size: 12px;
    line-height: 1.35;
    box-shadow: inset 0 0 0 1px transparent;
    transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
input::placeholder, textarea::placeholder { color: #b0b7c3; }
input:hover, textarea:hover, select:hover { border-color: var(--border-strong); }
input:focus, textarea:focus, select:focus { border-color: #98a2b3; box-shadow: 0 0 0 3px var(--ring); }
textarea { resize: vertical; min-height: 86px; }
select { appearance: auto; }
.form-actions { display: flex; align-items: center; gap: 12px; min-height: 40px; margin-top: 2px; }
.form-message { min-height: 16px; margin: 0; color: var(--muted-foreground); font-size: 10px; white-space: pre-wrap; line-height: 1.4; }
.form-message.error { color: var(--danger); }
.form-message.success { color: var(--success); }
.field-hint { display: block; margin-top: 5px; color: #98a2b3; font-size: 9px; line-height: 1.4; }
.field-hint.is-success { color: var(--success); }
.field-hint.is-error { color: var(--danger); }
.field-hint.is-checking { color: #667085; }
small { color: var(--muted-foreground); }
.table-panel { min-width: 0; }
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 11px; }
table { width: 100%; border-collapse: collapse; min-width: 600px; background: #fff; }
th, td { text-align: left; padding: 12px 13px; border-bottom: 1px solid #edf0f2; vertical-align: middle; font-size: 11px; }
th { height: 40px; color: #8b95a5; background: #fafbfc; font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: .07em; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr { transition: background .12s ease; }
tbody tr:hover { background: #fbfcfd; }
td strong { display: block; color: #344054; font-size: 11px; }
td small { display: block; max-width: 360px; margin-top: 3px; color: #98a2b3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.entity-cell { display: flex; align-items: center; gap: 9px; min-width: 180px; }
.entity-avatar {
    width: 30px;
    height: 30px;
    flex: none;
    display: grid;
    place-items: center;
    border-radius: 9px;
    background: #f3f4f6;
    border: 1px solid #e9eaec;
    color: #667085;
    font-size: 10px;
    font-weight: 800;
}
.badge { display: inline-flex; align-items: center; gap: 5px; border-radius: 999px; padding: 4px 8px; font-size: 9px; font-weight: 750; text-transform: capitalize; }
.badge::before { content: ""; width: 5px; height: 5px; border-radius: 999px; background: currentColor; opacity: .85; }
.badge-success { color: var(--success); background: var(--success-bg); }
.badge-warning { color: var(--warning); background: var(--warning-bg); }
.badge-muted { color: #667085; background: #f2f4f7; }

/* ---------- Client portal ---------- */
.client-body { background: #fff; }
.client-topbar {
    min-height: 90px;
    padding: 18px 32px;
    background: #fff;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    position: sticky;
    top: 0;
    z-index: 25;
}
.client-brand-area { display: flex; align-items: center; gap: 13px; min-width: 0; }
.brand-title { margin: 0; font-size: 23px; line-height: 1.2; letter-spacing: -.025em; }
.brand-subtitle { margin: 4px 0 0; color: var(--muted-foreground); font-size: 12px; }
.client-actions { display: flex; align-items: center; gap: 9px; }
.user-chip { padding: 7px 10px; border: 1px solid var(--border); border-radius: 999px; font-size: 10px; color: #667085; }
.client-page { padding-top: 32px; }
.client-heading { margin-bottom: 17px; }
.search-box { width: min(310px, 100%); position: relative; font-weight: 400; }
.search-box span { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: #98a2b3; }
.search-box input { padding-left: 33px; }
.boards-panel { padding: 15px; display: grid; gap: 11px; }
.board-card {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 16px;
    align-items: center;
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: 13px;
    background: #fff;
    transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
.board-card:hover { border-color: #d6dbe2; box-shadow: 0 7px 20px rgba(16,24,40,.045); transform: translateY(-1px); }
.board-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    background: #ecfdf3;
    color: #047857;
    display: grid;
    place-items: center;
    font-size: 18px;
    font-weight: 800;
}
.board-main h3 { margin: 0 0 4px; font-size: 16px; }
.board-main p { margin: 0; color: var(--muted-foreground); font-size: 11px; line-height: 1.5; }
.board-meta { margin-top: 8px; font-size: 9px; color: #98a2b3; }
.board-actions { display: flex; align-items: center; gap: 10px; }
.board-actions a { white-space: nowrap; }
.empty-state { color: var(--muted-foreground); text-align: center; padding: 34px 14px; font-size: 12px; }

/* ---------- Toast ---------- */
.toast {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 100;
    max-width: 410px;
    padding: 12px 14px;
    border: 1px solid #272f3b;
    border-radius: 11px;
    color: #fff;
    background: #111827;
    box-shadow: 0 18px 48px rgba(17,24,39,.2);
    font-size: 11px;
    line-height: 1.5;
    white-space: pre-wrap;
}

/* ---------- Auth ---------- */
.auth-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background: #fafafa;
}
.auth-card {
    width: min(420px, 100%);
    padding: 29px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: 0 18px 50px rgba(16,24,40,.07);
}
.auth-card h1 { margin: 0 0 7px; font-size: 25px; letter-spacing: -.035em; }
.auth-card > p { margin: 0 0 21px; color: var(--muted-foreground); font-size: 12px; line-height: 1.5; }
.auth-mark {
    width: 44px;
    height: 44px;
    margin-bottom: 17px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: #111827;
    color: #fff;
    font-weight: 800;
}

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
    .management-grid { grid-template-columns: 1fr; }
    .form-panel { position: static; }
    .feature-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .feature-grid .feature-card:last-child { grid-column: 1 / -1; }
}

@media (max-width: 900px) {
    .sidebar {
        transform: translateX(-105%);
        box-shadow: 20px 0 50px rgba(16,24,40,.12);
    }
    body.sidebar-open .sidebar { transform: translateX(0); }
    .sidebar-close, .menu-toggle { display: inline-grid !important; }
    .sidebar-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 45;
        background: rgba(17,24,39,.28);
        backdrop-filter: blur(2px);
    }
    .sidebar-backdrop[hidden] { display: none; }
    .workspace { margin-left: 0; }
    .workspace-topbar { padding: 0 18px; }
    .page-shell { padding: 28px 20px 48px; }
    .client-topbar { align-items: flex-start; flex-direction: column; padding: 17px 20px; }
    .client-actions { width: 100%; justify-content: space-between; }
}

@media (max-width: 680px) {
    .top-role-badge { display: none; }
    .page-heading { align-items: stretch; flex-direction: column; gap: 12px; }
    .page-status { align-self: flex-start; }
    .page-heading h2 { font-size: 24px; }
    .feature-grid, .feature-grid-two, .info-grid { grid-template-columns: 1fr; max-width: none; }
    .feature-grid .feature-card:last-child { grid-column: auto; }
    .feature-card { min-height: 175px; }
    .form-grid { grid-template-columns: 1fr; }
    .form-span { grid-column: auto; }
    .panel { padding: 16px; }
    .modern-panel-header { align-items: flex-start; flex-direction: column; }
    .board-card { grid-template-columns: auto minmax(0, 1fr); }
    .board-actions { grid-column: 1 / -1; justify-content: flex-end; }
    .search-box { width: 100%; }
    .client-brand-area { align-items: flex-start; }
    .brand-title { font-size: 19px; }
    .client-actions .user-chip { display: none; }
    .toast { left: 14px; right: 14px; bottom: 14px; max-width: none; }
}
@media (max-width: 900px) {
    body.sidebar-open { overflow: hidden; }
}

/* ---------- Client directory / integrated board management ---------- */
[hidden] { display: none !important; }
svg { display: block; }
.feature-card-static { cursor: default; }
.feature-card-static:hover { transform: none; box-shadow: var(--shadow-xs); border-color: var(--border); }
.button-sm { min-height: 32px; padding: 6px 10px; font-size: 10px; border-radius: 8px; }
.bordered-icon-button { border-color: var(--border); background: #fff; }
.bordered-icon-button:hover { border-color: var(--border-strong); }
body.overlay-open { overflow: hidden; }

.clients-heading { align-items: center; margin-bottom: 18px; }
.clients-table-panel { padding: 0; overflow: hidden; }
.clients-toolbar {
    min-height: 84px;
    padding: 18px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    border-bottom: 1px solid var(--border);
}
.clients-toolbar h3 { margin: 0; font-size: 15px; }
.clients-toolbar p { margin: 4px 0 0; color: var(--muted-foreground); font-size: 11px; }
.clients-toolbar-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; min-width: 0; }
.search-field, .select-control {
    height: 38px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 10px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: #fff;
    color: #98a2b3;
    font-weight: 400;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.search-field:focus-within, .select-control:focus-within { border-color: #98a2b3; box-shadow: 0 0 0 3px var(--ring); }
.search-field { width: min(360px, 36vw); }
.search-field .icon, .select-control .icon { width: 15px; height: 15px; flex: none; }
.search-field input, .select-control select {
    height: 36px;
    border: 0;
    padding: 0;
    box-shadow: none !important;
    background: transparent;
    min-width: 0;
}
.search-field input:focus, .select-control select:focus { box-shadow: none; border: 0; }
.select-control { min-width: 170px; }
.select-control select { color: #475467; font-size: 11px; }

.modern-table-wrap { position: relative; border: 0; border-radius: 0; min-height: 300px; }
.clients-table { min-width: 1030px; }
.clients-table th { padding: 11px 16px; }
.clients-table td { padding: 14px 16px; }
.clients-table tbody tr { cursor: default; }
.clients-table tbody tr:hover { background: #fbfcfd; }
.entity-cell-client { min-width: 220px; }
.entity-avatar-lg { width: 42px !important; height: 42px !important; border-radius: 12px !important; font-size: 12px !important; }
.cell-primary { display: block; font-size: 11px; color: #344054; }
.mono-chip {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 4px 8px;
    border: 1px solid #eaecf0;
    border-radius: 7px;
    background: #f9fafb;
    color: #475467;
    font: 600 10px ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}
.boards-count { display: inline-flex; align-items: baseline; gap: 2px; color: #667085; }
.boards-count strong { display: inline; color: #111827; font-size: 13px; }
.boards-count small { display: inline; font-size: 9px; margin: 0; }
.date-cell { color: #667085; font-size: 10px; white-space: nowrap; }
.table-actions-heading, .table-actions-cell { text-align: right; }
.table-actions-cell .button { white-space: nowrap; }
.table-empty { min-height: 230px; display: grid; place-items: center; align-content: center; gap: 5px; color: #98a2b3; text-align: center; }
.table-empty strong { color: #475467; font-size: 12px; }
.table-empty span { font-size: 10px; }
.error-state strong, .error-state span { color: var(--danger); }
.table-loading {
    position: absolute;
    inset: 40px 0 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: #667085;
    background: rgba(255,255,255,.78);
    backdrop-filter: blur(2px);
    font-size: 11px;
    z-index: 4;
}
.spinner { width: 15px; height: 15px; border: 2px solid #e5e7eb; border-top-color: #667085; border-radius: 999px; animation: spin .65s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.table-footer {
    min-height: 62px;
    padding: 13px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    border-top: 1px solid var(--border);
    color: #667085;
    font-size: 10px;
}
.pagination { display: flex; align-items: center; gap: 9px; }
.pagination-current { min-width: 86px; text-align: center; color: #475467; font-weight: 650; }
.pagination-button .icon { width: 13px; height: 13px; }

/* Modal components inspired by shadcn Dialog */
.modal-layer, .drawer-layer { position: fixed; inset: 0; z-index: 120; }
.modal-backdrop, .drawer-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, .30);
    backdrop-filter: blur(3px);
    opacity: 0;
    transition: opacity .16s ease;
}
.modal-layer.is-open .modal-backdrop, .drawer-layer.is-open .drawer-backdrop { opacity: 1; }
.dialog-card {
    position: absolute;
    left: 50%;
    top: 50%;
    width: min(92vw, 560px);
    max-height: min(88vh, 800px);
    overflow: auto;
    transform: translate(-50%, calc(-50% + 8px)) scale(.985);
    opacity: 0;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: 0 24px 80px rgba(15,23,42,.18);
    transition: opacity .16s ease, transform .16s ease;
}
.modal-layer.is-open .dialog-card { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.dialog-md { width: min(92vw, 620px); }
.dialog-header {
    min-height: 78px;
    padding: 18px 20px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    border-bottom: 1px solid var(--border);
}
.dialog-title-group { display: flex; align-items: center; gap: 12px; }
.dialog-title-group h3, .credentials-header h3 { margin: 0; font-size: 16px; letter-spacing: -.02em; }
.dialog-title-group p, .credentials-header p { margin: 4px 0 0; color: var(--muted-foreground); font-size: 10px; line-height: 1.45; }
.dialog-icon { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; flex: none; }
.dialog-icon .icon { width: 17px; height: 17px; }
.dialog-body { padding: 20px; }
.dialog-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding-top: 4px; }

.credentials-dialog { width: min(92vw, 500px); overflow: hidden; }
.credentials-header { padding: 22px 22px 14px; display: flex; gap: 13px; align-items: flex-start; }
.success-mark { width: 38px; height: 38px; flex: none; border-radius: 999px; display: grid; place-items: center; color: #067647; background: #ecfdf3; border: 1px solid #d1fadf; }
.success-mark .icon { width: 18px; height: 18px; }
.credentials-body { padding: 8px 22px 20px; display: grid; gap: 10px; }
.credential-row {
    min-height: 64px;
    padding: 11px 12px;
    border: 1px solid var(--border);
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    background: #fff;
}
.credential-row > span { min-width: 0; display: grid; gap: 4px; }
.credential-row small { color: #98a2b3; font-size: 9px; text-transform: uppercase; letter-spacing: .07em; }
.credential-row strong { overflow-wrap: anywhere; font: 700 13px ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; color: #344054; }
.credential-password { background: #fbfcfd; }
.warning-note { padding: 12px; display: flex; gap: 10px; align-items: flex-start; border-radius: 10px; background: #fff8eb; color: #8a4b08; }
.warning-note > .icon { width: 15px; height: 15px; margin-top: 1px; flex: none; }
.warning-note div { display: grid; gap: 2px; }
.warning-note strong { font-size: 10px; }
.warning-note span { font-size: 9px; line-height: 1.45; }
.credentials-actions { padding: 14px 22px 20px; border-top: 1px solid #f0f1f3; }

/* Client detail drawer */
.client-drawer {
    position: absolute;
    inset: 0 0 0 auto;
    width: min(760px, 96vw);
    height: 100%;
    display: flex;
    flex-direction: column;
    background: #fff;
    border-left: 1px solid var(--border);
    box-shadow: -22px 0 60px rgba(15,23,42,.12);
    transform: translateX(100%);
    transition: transform .20s ease;
}
.drawer-layer.is-open .client-drawer { transform: translateX(0); }
.client-drawer.is-loading { cursor: progress; }
.drawer-header {
    min-height: 88px;
    padding: 17px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    border-bottom: 1px solid var(--border);
}
.drawer-client-title { display: flex; align-items: center; gap: 12px; min-width: 0; }
.drawer-client-title h3 { margin: 1px 0 0; font-size: 17px; letter-spacing: -.025em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drawer-client-title p { margin: 3px 0 0; color: #98a2b3; font-size: 10px; }
.drawer-client-title .eyebrow { margin-bottom: 0; }
.drawer-tabs { height: 52px; padding: 0 20px; display: flex; align-items: flex-end; gap: 22px; border-bottom: 1px solid var(--border); }
.drawer-tab { position: relative; height: 52px; padding: 0 1px; border: 0; background: transparent; color: #667085; font-size: 11px; font-weight: 650; }
.drawer-tab::after { content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: transparent; }
.drawer-tab.is-active { color: #111827; }
.drawer-tab.is-active::after { background: #111827; }
.tab-count { margin-left: 5px; min-width: 19px; height: 19px; padding: 0 5px; display: inline-grid; place-items: center; border-radius: 999px; background: #f2f4f7; color: #667085; font-size: 9px; }
.drawer-content { flex: 1; overflow-y: auto; padding: 22px 22px 36px; }
.client-edit-form { max-width: 100%; }
.section-title { display: flex; justify-content: space-between; align-items: center; margin-bottom: 13px; }
.section-title h4, .boards-management-header h4 { margin: 0; font-size: 13px; }
.section-title p, .boards-management-header p { margin: 4px 0 0; color: #98a2b3; font-size: 10px; }
.section-divider { height: 1px; background: var(--border); margin: 8px 0 3px; }
.input-readonly { background: #f8fafc; color: #667085; cursor: not-allowed; }
.client-meta-strip { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.client-meta-strip > span { min-height: 56px; padding: 10px 11px; display: flex; align-items: center; gap: 9px; border: 1px solid var(--border); border-radius: 10px; background: #fbfcfd; color: #667085; }
.client-meta-strip > span > .icon { width: 14px; height: 14px; }
.client-meta-strip > span > span { display: grid; gap: 2px; }
.client-meta-strip small { font-size: 9px; color: #98a2b3; }
.client-meta-strip strong { font-size: 10px; color: #475467; }
.drawer-form-actions { position: sticky; bottom: -36px; margin: 4px -22px -36px; padding: 14px 22px 18px; display: flex; justify-content: flex-end; border-top: 1px solid var(--border); background: rgba(255,255,255,.96); backdrop-filter: blur(8px); }

.boards-management-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.managed-boards { display: grid; gap: 10px; }
.managed-board-card { position: relative; display: grid; grid-template-columns: auto minmax(0,1fr) auto; gap: 12px; padding: 14px; border: 1px solid var(--border); border-radius: 12px; background: #fff; transition: border-color .15s ease, box-shadow .15s ease; }
.managed-board-card:hover { border-color: #d7dce3; box-shadow: var(--shadow-sm); }
.managed-board-icon { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: #f4f6f8; color: #475467; font-size: 11px; font-weight: 800; }
.managed-board-copy { min-width: 0; }
.managed-board-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.managed-board-title strong { color: #344054; font-size: 12px; }
.managed-board-copy p { margin: 5px 0; color: #667085; font-size: 10px; line-height: 1.45; }
.board-url { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #2563eb; font-size: 9px; }
.board-url:hover { text-decoration: underline; }
.managed-board-copy > small { margin-top: 6px; display: block; color: #98a2b3; font-size: 9px; }
.board-edit-button { align-self: start; }
.drawer-empty { min-height: 190px; display: grid; place-items: center; align-content: center; gap: 6px; padding: 30px; border: 1px dashed #dfe3e8; border-radius: 12px; background: #fcfcfd; color: #98a2b3; text-align: center; font-size: 10px; }
.drawer-empty strong { color: #475467; font-size: 11px; }

@media (max-width: 980px) {
    .clients-toolbar { align-items: flex-start; flex-direction: column; }
    .clients-toolbar-actions { width: 100%; justify-content: flex-start; }
    .search-field { width: min(100%, 420px); }
}

@media (max-width: 680px) {
    .clients-heading { align-items: stretch; }
    .clients-heading > .button { width: 100%; }
    .clients-toolbar { padding: 15px; }
    .clients-toolbar-actions { display: grid; grid-template-columns: minmax(0, 1fr) auto; }
    .search-field { width: 100%; grid-column: 1 / -1; }
    .select-control { min-width: 0; }
    .table-footer { align-items: stretch; flex-direction: column; }
    .pagination { justify-content: space-between; }
    .pagination-button { padding: 7px 9px; }
    .dialog-card { width: calc(100vw - 24px); max-height: calc(100vh - 24px); }
    .dialog-body { padding: 17px; }
    .dialog-header { padding: 16px 17px; }
    .credentials-header, .credentials-body, .credentials-actions { padding-left: 17px; padding-right: 17px; }
    .client-drawer { width: 100vw; }
    .drawer-header, .drawer-tabs { padding-left: 16px; padding-right: 16px; }
    .drawer-content { padding: 18px 16px 32px; }
    .client-meta-strip { grid-template-columns: 1fr; }
    .drawer-form-actions { margin-left: -16px; margin-right: -16px; padding-left: 16px; padding-right: 16px; }
    .managed-board-card { grid-template-columns: auto minmax(0, 1fr); }
    .board-edit-button { grid-column: 2; justify-self: end; position: absolute; right: 12px; top: 12px; }
    .managed-board-title { padding-right: 36px; }
    .boards-management-header { align-items: stretch; flex-direction: column; }
    .boards-management-header .button { width: 100%; }
}

/* ---------- Client UI aligned with admin/shadcn-like visual language ---------- */
.avatar { overflow: hidden; }
.avatar-photo { background: #f3f4f6; }
.avatar-photo img { width: 100%; height: 100%; display: block; object-fit: cover; }
.client-page { max-width: 1540px; padding-top: 38px; }
.client-board-directory { padding: 0; overflow: hidden; }
.client-boards-toolbar { min-height: 88px; }
.client-board-filters { flex-wrap: wrap; }
.client-board-filters .search-field { width: min(390px, 34vw); }
.compact-select { min-width: 132px; }
.client-boards-table { min-width: 900px; }
.client-board-entity { min-width: 205px; }
.board-table-avatar {
    width: 38px;
    height: 38px;
    border-radius: 11px;
    background: #f0fdf4;
    border-color: #dcfce7;
    color: #067647;
    font-size: 12px;
}
.board-description-cell {
    display: block;
    max-width: 430px;
    color: #667085;
    font-size: 10px;
    line-height: 1.45;
}
.client-boards-table .table-actions-cell { min-width: 140px; }

/* ---------- Client profile ---------- */
.profile-layout {
    display: grid;
    grid-template-columns: minmax(260px, 330px) minmax(0, 1fr);
    gap: 18px;
    align-items: start;
}
.profile-summary-card {
    position: sticky;
    top: 90px;
    padding: 24px 20px;
}
.profile-photo-wrap {
    display: grid;
    justify-items: center;
    gap: 10px;
    padding: 8px 0 20px;
    border-bottom: 1px solid var(--border);
}
.profile-photo-wrap > small { font-size: 9px; text-align: center; }
.profile-avatar-xl {
    width: 108px;
    height: 108px;
    display: grid;
    place-items: center;
    overflow: hidden;
    border: 1px solid #e5e7eb;
    border-radius: 999px;
    color: #fff;
    background: linear-gradient(145deg, #111827, #374151);
    box-shadow: 0 8px 24px rgba(17,24,39,.08);
    font-size: 30px;
    font-weight: 800;
    letter-spacing: -.04em;
}
.profile-avatar-xl img { width: 100%; height: 100%; display: block; object-fit: cover; }
.profile-photo-actions { display: flex; align-items: center; justify-content: center; gap: 7px; flex-wrap: wrap; }
.profile-summary-copy { padding: 20px 2px 16px; text-align: center; }
.profile-summary-copy h3 { margin: 0; font-size: 17px; letter-spacing: -.02em; }
.profile-summary-copy p { margin: 5px 0 0; font-size: 11px; color: #667085; }
.profile-summary-list { display: grid; gap: 3px; padding-top: 5px; }
.profile-summary-list > div {
    min-height: 50px;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 4px;
    padding: 10px 11px;
    border-radius: 10px;
    transition: background .15s ease;
}
.profile-summary-list > div:hover { background: #f8fafc; }
.profile-summary-list span {
    display: flex;
    align-items: center;
    gap: 7px;
    color: #98a2b3;
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
}
.profile-summary-list span .icon { width: 13px; height: 13px; }
.profile-summary-list strong {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #344054;
    font-size: 11px;
}
.profile-content-stack { display: grid; gap: 18px; min-width: 0; }
.profile-panel { padding: 22px; }
.profile-panel .modern-panel-header { margin-bottom: 20px; }
.profile-form { display: grid; gap: 16px; }
.profile-form-actions { justify-content: flex-start; flex-wrap: wrap; }
.readonly-control {
    color: #667085;
    background: #f8fafc;
    cursor: not-allowed;
}
.readonly-control:focus { border-color: var(--border); box-shadow: none; }
.password-mask {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 0 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: #667085;
    background: #f9fafb;
    font: 700 12px ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    letter-spacing: .12em;
}

@media (max-width: 1100px) {
    .profile-layout { grid-template-columns: 1fr; }
    .profile-summary-card { position: static; }
    .profile-summary-card { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 24px; }
    .profile-photo-wrap { grid-row: 1 / span 2; border-bottom: 0; padding: 0; }
    .profile-summary-copy { text-align: left; padding: 8px 0 8px; align-self: end; }
    .profile-summary-list { align-self: start; grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
    .client-board-filters { width: 100%; justify-content: stretch; }
    .client-board-filters .search-field { width: 100%; }
    .client-board-filters .select-control { flex: 1 1 180px; }
}

@media (max-width: 680px) {
    .client-page { padding-top: 28px; }
    .clients-toolbar.client-boards-toolbar { align-items: stretch; flex-direction: column; }
    .client-board-filters { display: grid; grid-template-columns: 1fr; }
    .client-board-filters .select-control { width: 100%; min-width: 0; }
    .table-footer { align-items: stretch; flex-direction: column; }
    .pagination { justify-content: space-between; }
    .profile-summary-card { display: block; }
    .profile-photo-wrap { padding: 4px 0 18px; border-bottom: 1px solid var(--border); }
    .profile-summary-copy { text-align: center; padding: 18px 0 10px; }
    .profile-summary-list { grid-template-columns: 1fr; }
    .profile-panel { padding: 17px; }
    .password-mask { display: none; }
}


/* ---------- 2026-10-14: client photos + board appearance ---------- */
.drawer-client-avatar,
.staff-client-photo { overflow: hidden; }
.drawer-client-avatar img,
.staff-client-photo img,
.entity-avatar.avatar-photo img { width: 100%; height: 100%; display: block; object-fit: cover; }
.staff-client-photo-editor { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 13px; padding: 14px; border: 1px solid var(--border); border-radius: 12px; background: #fbfcfd; }
.staff-client-photo { width: 56px; height: 56px; display: grid; place-items: center; border: 1px solid #e4e7ec; border-radius: 999px; background: #111827; color: #fff; font-size: 14px; font-weight: 800; }
.staff-client-photo-copy { min-width: 0; display: grid; gap: 3px; }
.staff-client-photo-copy strong { font-size: 11px; color: #344054; }
.staff-client-photo-copy span { color: #98a2b3; font-size: 9px; line-height: 1.4; }
.staff-client-photo-actions { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; justify-content: flex-end; }
.client-meta-strip-single { grid-template-columns: minmax(0, 260px); }
.picker-fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
.picker-fieldset > legend { margin-bottom: 8px; color: #475467; font-size: 10px; font-weight: 650; }
.board-icon-picker { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 7px; }
.board-icon-choice { position: relative; min-width: 0; cursor: pointer; }
.board-icon-choice input { position: absolute; opacity: 0; pointer-events: none; }
.board-icon-choice > span { min-height: 48px; display: grid; place-items: center; border: 1px solid var(--border); border-radius: 10px; background: #fff; color: #667085; transition: border-color .15s ease, box-shadow .15s ease, color .15s ease, background .15s ease; }
.board-icon-choice small { display: block; margin-top: 4px; overflow: hidden; color: #98a2b3; font-size: 8px; text-align: center; text-overflow: ellipsis; white-space: nowrap; }
.board-icon-choice input:checked + span { border-color: #111827; background: #f8fafc; color: #111827; box-shadow: 0 0 0 1px #111827; }
.board-icon-choice input:focus-visible + span { outline: 2px solid #94a3b8; outline-offset: 2px; }
.board-icon-svg { width: 18px; height: 18px; }
.board-color-picker { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px; }
.board-color-choice { position: relative; min-height: 38px; padding: 0 9px; display: flex; align-items: center; gap: 7px; border: 1px solid var(--border); border-radius: 9px; background: #fff; cursor: pointer; }
.board-color-choice input { position: absolute; opacity: 0; pointer-events: none; }
.board-color-choice .color-dot { width: 17px; height: 17px; border-radius: 6px; background: currentColor; }
.board-color-choice small { color: #667085; font-size: 9px; font-weight: 650; }
.board-color-choice:has(input:checked) { border-color: #111827; box-shadow: 0 0 0 1px #111827; }
.board-color-choice:has(input:focus-visible) { outline: 2px solid #94a3b8; outline-offset: 2px; }
.board-tone-slate { background: #f2f4f7 !important; color: #475467 !important; border-color: #e4e7ec !important; }
.board-tone-emerald { background: #ecfdf3 !important; color: #067647 !important; border-color: #d1fadf !important; }
.board-tone-blue { background: #eff8ff !important; color: #175cd3 !important; border-color: #d1e9ff !important; }
.board-tone-violet { background: #f4f3ff !important; color: #5925dc !important; border-color: #e9e7fe !important; }
.board-tone-amber { background: #fffaeb !important; color: #b54708 !important; border-color: #fef0c7 !important; }
.board-tone-rose { background: #fff1f3 !important; color: #c01048 !important; border-color: #ffe4e8 !important; }
.board-tone-cyan { background: #ecfdff !important; color: #0e7090 !important; border-color: #cff9fe !important; }
.board-tone-orange { background: #fff6ed !important; color: #c4320a !important; border-color: #ffead5 !important; }
.board-color-choice.board-tone-slate,
.board-color-choice.board-tone-emerald,
.board-color-choice.board-tone-blue,
.board-color-choice.board-tone-violet,
.board-color-choice.board-tone-amber,
.board-color-choice.board-tone-rose,
.board-color-choice.board-tone-cyan,
.board-color-choice.board-tone-orange { background: #fff !important; }
.managed-board-icon .board-icon-svg, .board-table-avatar .board-icon-svg { width: 18px; height: 18px; }
@media (max-width: 680px) {
    .staff-client-photo-editor { grid-template-columns: auto minmax(0, 1fr); }
    .staff-client-photo-actions { grid-column: 1 / -1; justify-content: stretch; }
    .staff-client-photo-actions .button { flex: 1; }
    .board-icon-picker { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .board-color-picker { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .client-board-directory .modern-table-wrap { overflow: visible; padding: 0 12px 14px; }
    .client-boards-table { min-width: 0; width: 100%; display: block; }
    .client-boards-table thead { display: none; }
    .client-boards-table tbody { display: grid; gap: 11px; width: 100%; }
    .client-boards-table .client-board-row { width: 100%; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px 12px; padding: 15px; border: 1px solid var(--border); border-radius: 13px; background: #fff; box-shadow: 0 1px 2px rgba(16,24,40,.03); }
    .client-boards-table .client-board-row > td { padding: 0; border: 0; min-width: 0; }
    .client-board-name-cell, .client-board-description-cell { grid-column: 1 / -1; }
    .client-board-updated-cell { display: none !important; }
    .client-board-status-cell { grid-column: 1; align-self: center; }
    .client-board-action-cell { grid-column: 2; align-self: center; }
    .client-board-entity { min-width: 0; }
    .client-board-entity .board-table-avatar, .client-board-entity small { display: none; }
    .client-board-entity strong { font-size: 14px; }
    .board-description-cell { max-width: none; font-size: 11px; line-height: 1.5; }
    .client-board-action-cell .button { min-height: 40px; white-space: nowrap; }
    .client-board-empty-row { display: block; }
    .client-board-empty-row td { display: block; padding: 0; border: 0; }
}
@media (max-width: 420px) {
    .client-boards-table .client-board-row { grid-template-columns: 1fr; }
    .client-board-status-cell, .client-board-action-cell { grid-column: 1; }
    .client-board-action-cell .button { width: 100%; justify-content: center; }
}

/* ---------- Login 2026: minimalist shadcn-like ---------- */
.auth-body {
    min-height: 100vh;
    padding: 28px;
    display: grid;
    place-items: center;
    background:
        radial-gradient(circle at 12% 10%, rgba(17,24,39,.035), transparent 26%),
        #f8fafc;
}
.auth-layout {
    width: min(960px, 100%);
    min-height: 560px;
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(390px, .95fr);
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 22px;
    background: #fff;
    box-shadow: 0 26px 80px rgba(15,23,42,.08);
}
.auth-intro {
    position: relative;
    padding: 42px;
    display: flex;
    flex-direction: column;
    background: linear-gradient(145deg, #fbfcfd 0%, #f6f7f9 100%);
    border-right: 1px solid var(--border);
}
.auth-brand { display: flex; align-items: center; gap: 11px; }
.auth-brand-mark, .auth-mobile-mark {
    width: 40px; height: 40px; display: grid; place-items: center; flex: none;
    border-radius: 11px; color: #fff; background: #111827;
}
.auth-brand span:last-child { display: grid; gap: 1px; }
.auth-brand strong { font-size: 14px; }
.auth-brand small { color: #667085; font-size: 10px; }
.auth-intro-copy { margin: auto 0; max-width: 430px; padding: 54px 0 46px; }
.auth-intro-copy h1 { margin: 8px 0 12px; max-width: 400px; font-size: clamp(30px, 3.1vw, 43px); line-height: 1.08; letter-spacing: -.045em; }
.auth-intro-copy p { margin: 0; max-width: 420px; color: #667085; font-size: 13px; line-height: 1.65; }
.auth-trust-list { display: grid; gap: 11px; }
.auth-trust-list > span { display: flex; align-items: flex-start; gap: 10px; color: #475467; }
.auth-trust-list > span > .icon { width: 16px; height: 16px; margin-top: 2px; }
.auth-trust-list > span > span { display: grid; gap: 2px; }
.auth-trust-list strong { font-size: 10px; }
.auth-trust-list small { font-size: 9px; color: #98a2b3; }
.auth-card.auth-card-modern {
    width: auto;
    min-width: 0;
    padding: 52px 44px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    border: 0;
    border-radius: 0;
    box-shadow: none;
}
.auth-card-heading { margin-bottom: 24px; }
.auth-card-heading .eyebrow { display: block; margin-bottom: 6px; }
.auth-card-heading h2 { margin: 0; font-size: 27px; letter-spacing: -.035em; }
.auth-card-heading p { margin: 7px 0 0; color: #667085; font-size: 11px; line-height: 1.5; }
.auth-mobile-mark { display: none; margin-bottom: 20px; }
.auth-form { gap: 15px; }
.auth-input-wrap { position: relative; display: flex; align-items: center; }
.auth-input-wrap input { height: 44px; padding-left: 38px; font-size: 12px; }
.auth-field-icon { position: absolute; left: 12px; z-index: 2; display: grid; place-items: center; color: #98a2b3; pointer-events: none; }
.auth-field-icon .icon { width: 15px; height: 15px; }
.password-input-wrap input { padding-right: 44px; }
.password-visibility-button {
    position: absolute; right: 6px; width: 34px; height: 34px; display: grid; place-items: center;
    border: 0; border-radius: 8px; background: transparent; color: #667085;
}
.password-visibility-button:hover { background: #f3f4f6; color: #111827; }
.password-visibility-button:focus-visible { outline: 3px solid var(--ring); }
.password-eye { width: 16px !important; height: 16px !important; }
.remember-access-control {
    grid-template-columns: auto minmax(0, 1fr);
    align-items: flex-start;
    gap: 9px;
    cursor: pointer;
    font-weight: 400;
}
.remember-access-control > input { position: absolute; opacity: 0; pointer-events: none; }
.remember-checkbox {
    width: 18px; height: 18px; margin-top: 1px; display: grid; place-items: center;
    border: 1px solid #d0d5dd; border-radius: 5px; background: #fff; color: transparent;
    transition: background .14s ease, border-color .14s ease, color .14s ease;
}
.remember-checkbox .icon { width: 12px; height: 12px; }
.remember-access-control input:checked + .remember-checkbox { background: #111827; border-color: #111827; color: #fff; }
.remember-access-control input:focus-visible + .remember-checkbox { box-shadow: 0 0 0 3px var(--ring); }
.remember-access-control > span:last-child { display: grid; gap: 2px; }
.remember-access-control strong { color: #344054; font-size: 10px; }
.remember-access-control small { color: #98a2b3; font-size: 9px; line-height: 1.35; }
.auth-submit { min-height: 44px; width: 100%; justify-content: center; gap: 8px; margin-top: 2px; }
.auth-submit .icon { width: 15px; height: 15px; }
.auth-message { margin-top: -3px; }
.auth-security-note { margin: 22px 0 0 !important; padding-top: 17px; display: flex; align-items: center; gap: 7px; border-top: 1px solid #f0f1f3; color: #98a2b3 !important; font-size: 9px !important; }
.auth-security-note .icon { width: 13px; height: 13px; }

/* ---------- Internal users directory ---------- */
.internal-users-toolbar-actions .search-field { width: min(330px, 28vw); }
.internal-users-toolbar-actions .select-control { min-width: 145px; }
.internal-users-table { min-width: 1080px; }
.internal-user-avatar { color: #475467; background: #f8fafc; }
.role-chip {
    display: inline-flex; align-items: center; min-height: 25px; padding: 4px 8px;
    border: 1px solid #e5e7eb; border-radius: 999px; font-size: 9px; font-weight: 700;
}
.role-admin { color: #5b21b6; background: #f5f3ff; border-color: #ede9fe; }
.role-soporte { color: #1d4ed8; background: #eff6ff; border-color: #dbeafe; }
.internal-user-drawer { width: min(680px, 96vw); }
.internal-user-security-row {
    min-height: 74px; padding: 13px 14px; display: flex; align-items: center; justify-content: space-between; gap: 18px;
    border: 1px solid var(--border); border-radius: 11px; background: #fbfcfd;
}
.internal-user-security-row > div { display: grid; gap: 3px; }
.internal-user-security-row strong { color: #344054; font-size: 11px; }
.internal-user-security-row span { color: #98a2b3; font-size: 9px; line-height: 1.45; }
.internal-user-permission-note {
    padding: 11px 12px; display: flex; align-items: flex-start; gap: 9px; border: 1px solid #e4e7ec;
    border-radius: 10px; background: #f9fafb; color: #667085; font-size: 9px; line-height: 1.5;
}
.internal-user-permission-note .icon { width: 14px; height: 14px; flex: none; }

/* Client table no longer exposes last-update as a column. */
.client-boards-table { min-width: 760px; }

@media (max-width: 760px) {
    .auth-body { padding: 14px; background: #fff; }
    .auth-layout { min-height: 0; grid-template-columns: 1fr; border-radius: 17px; box-shadow: 0 12px 36px rgba(15,23,42,.06); }
    .auth-intro { display: none; }
    .auth-card.auth-card-modern { padding: 30px 22px 26px; }
    .auth-mobile-mark { display: grid; }
    .auth-card-heading h2 { font-size: 24px; }
    .internal-users-toolbar-actions { width: 100%; display: grid; grid-template-columns: 1fr 1fr auto; }
    .internal-users-toolbar-actions .search-field { width: 100%; grid-column: 1 / -1; }
    .internal-users-toolbar-actions .select-control { min-width: 0; width: 100%; }
    .internal-user-security-row { align-items: stretch; flex-direction: column; }
    .internal-user-security-row .button { width: 100%; justify-content: center; }
}

@media (max-width: 480px) {
    .auth-body { padding: 0; }
    .auth-layout { border: 0; border-radius: 0; box-shadow: none; }
    .auth-card.auth-card-modern { padding: 28px 18px; }
}


/* ---------- 2026-10-14 v7: login responsive + client board readability ---------- */
/* Login stays centered and never overflows on narrow screens. */
.auth-body {
    min-height: 100vh;
    min-height: 100dvh;
    width: 100%;
    padding: 24px;
    overflow-x: hidden;
    display: grid;
    place-items: center;
    background: #f8fafc;
}
.auth-layout {
    width: min(920px, calc(100vw - 48px));
    max-width: 920px;
    min-height: 540px;
    margin: auto;
    grid-template-columns: minmax(0, 1fr) minmax(360px, .92fr);
}
.auth-intro,
.auth-card.auth-card-modern { min-width: 0; }
.auth-intro-copy { padding: 48px 0 40px; }
.auth-intro-copy h1 { margin-bottom: 0; }
.auth-card.auth-card-modern { padding: 46px 40px; }
.auth-form,
.auth-input-wrap,
.auth-input-wrap input { min-width: 0; max-width: 100%; }

/* Larger, easier-to-scan board directory on desktop/tablet. */
.client-boards-table th {
    padding-top: 13px;
    padding-bottom: 13px;
    font-size: 11px;
    letter-spacing: .055em;
}
.client-boards-table td {
    padding-top: 15px;
    padding-bottom: 15px;
    font-size: 13px;
}
.client-board-entity strong {
    font-size: 14px;
    line-height: 1.35;
}
.client-board-entity small {
    margin-top: 4px;
    font-size: 11px;
}
.board-description-cell {
    max-width: 520px;
    font-size: 13px;
    line-height: 1.55;
}
.client-boards-table .badge {
    padding: 5px 9px;
    font-size: 11px;
}
.client-board-action-cell .button {
    min-height: 38px;
    padding-inline: 13px;
    font-size: 12px;
}

@media (max-width: 920px) {
    .auth-body {
        padding: 24px 18px;
        background: #f8fafc;
    }
    .auth-layout {
        width: min(470px, 100%);
        max-width: 470px;
        min-height: 0;
        grid-template-columns: 1fr;
        border-radius: 18px;
        overflow: hidden;
    }
    .auth-intro { display: none; }
    .auth-card.auth-card-modern {
        width: 100%;
        padding: 38px 34px 34px;
        align-self: center;
    }
    .auth-mobile-mark { display: grid; }
}

@media (max-width: 680px) {
    /* Keep the login card centered with breathing room instead of stretching edge-to-edge. */
    .auth-body {
        padding: 20px 14px;
        place-items: center;
    }
    .auth-layout {
        width: min(440px, 100%);
        border: 1px solid var(--border);
        border-radius: 17px;
        box-shadow: 0 14px 40px rgba(15,23,42,.07);
    }
    .auth-card.auth-card-modern { padding: 30px 22px 26px; }
    .auth-card-heading { margin-bottom: 22px; text-align: center; }
    .auth-mobile-mark { margin: 0 auto 18px; }
    .auth-card-heading .eyebrow { text-align: center; }
    .auth-card-heading h2 { font-size: 26px; }
    .auth-card-heading p { max-width: 310px; margin: 8px auto 0; font-size: 12px; }
    .auth-form label > span:first-child { font-size: 12px; }
    .auth-input-wrap input { height: 46px; font-size: 16px; }
    .remember-access-control { align-items: center; }
    .remember-access-control strong { font-size: 12px; }
    .remember-access-control small { font-size: 10px; }
    .auth-submit { min-height: 46px; font-size: 13px; }

    /* Mobile board view: real cards, no table-like grid, no horizontal breakage. */
    .client-board-directory { overflow: visible; }
    .client-board-directory .modern-table-wrap {
        overflow: visible;
        padding: 0 12px 14px;
        border: 0;
        border-radius: 0;
        background: transparent;
    }
    .client-boards-table {
        width: 100%;
        min-width: 0;
        display: block;
        background: transparent;
    }
    .client-boards-table thead { display: none; }
    .client-boards-table tbody {
        width: 100%;
        display: grid;
        gap: 12px;
    }
    .client-boards-table .client-board-row {
        width: 100%;
        box-sizing: border-box;
        display: flex !important;
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        padding: 18px;
        border: 1px solid var(--border);
        border-radius: 15px;
        background: #fff;
        box-shadow: 0 2px 7px rgba(16,24,40,.045);
    }
    .client-boards-table .client-board-row:hover { background: #fff; }
    .client-boards-table .client-board-row > td {
        width: 100%;
        min-width: 0;
        display: block;
        padding: 0;
        border: 0;
        text-align: left;
    }
    .client-board-name-cell,
    .client-board-description-cell,
    .client-board-status-cell,
    .client-board-action-cell { grid-column: auto !important; }
    .client-board-entity {
        width: 100%;
        min-width: 0;
        display: block;
    }
    .client-board-entity .board-table-avatar,
    .client-board-entity small { display: none; }
    .client-board-entity strong {
        display: block;
        overflow-wrap: anywhere;
        font-size: 17px;
        line-height: 1.3;
        letter-spacing: -.015em;
    }
    .board-description-cell {
        display: block;
        max-width: none;
        overflow-wrap: anywhere;
        color: #667085;
        font-size: 14px;
        line-height: 1.55;
    }
    .client-board-status-cell { align-self: stretch; }
    .client-board-status-cell .badge {
        width: max-content;
        max-width: 100%;
        padding: 6px 10px;
        font-size: 11px;
    }
    .client-board-action-cell {
        align-self: stretch;
        text-align: center !important;
    }
    .client-board-action-cell .button {
        width: 100%;
        min-height: 46px;
        padding: 11px 14px;
        justify-content: center;
        text-align: center;
        white-space: normal;
        font-size: 13px;
        line-height: 1.25;
    }
    .client-board-empty-row { display: block; }
    .client-board-empty-row td { display: block; width: 100%; padding: 0; border: 0; }

    .client-boards-toolbar { padding: 16px 14px; }
    .client-boards-toolbar h3 { font-size: 17px; }
    .client-boards-toolbar p { font-size: 12px; }
    .client-board-filters { width: 100%; display: grid; grid-template-columns: 1fr; gap: 9px; }
    .client-board-filters .search-field,
    .client-board-filters .select-control {
        width: 100%;
        min-width: 0;
    }
    .client-board-filters .search-field input,
    .client-board-filters .select-control select { font-size: 16px; }
    .client-board-directory .table-footer {
        padding: 14px;
        gap: 12px;
        font-size: 11px;
        text-align: center;
    }
    .client-board-directory .pagination {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr;
        gap: 8px;
    }
    .client-board-directory .pagination-current { order: -1; width: 100%; min-width: 0; }
    .client-board-directory .pagination-button { width: 100%; justify-content: center; min-height: 42px; font-size: 11px; }
}

@media (max-width: 420px) {
    .auth-body { padding: 14px 10px; }
    .auth-layout {
        width: 100%;
        border: 1px solid var(--border);
        border-radius: 15px;
        box-shadow: 0 10px 30px rgba(15,23,42,.06);
    }
    .auth-card.auth-card-modern { padding: 26px 17px 22px; }
    .auth-card-heading h2 { font-size: 24px; }
    .remember-access-control { align-items: flex-start; }
    .client-boards-table .client-board-row { padding: 16px; }
    .client-board-entity strong { font-size: 16px; }
    .board-description-cell { font-size: 13px; }
}

/* ---------- 2026-10-14 v8: internal CRUD, account settings and mobile board icon ---------- */
.nav-caption-secondary { margin-top: 18px; }
.top-avatar-link { display: inline-grid; border-radius: 999px; }
.top-avatar-link:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; }

.button-danger-outline {
    color: var(--danger);
    background: #fff;
    border-color: #fecaca;
}
.button-danger-outline:hover { color: #991b1b; background: #fff7f7; border-color: #fca5a5; }
.button-danger {
    color: #fff;
    background: #b42318;
    border-color: #b42318;
}
.button-danger:hover { background: #912018; border-color: #912018; }
.tone-danger { color: var(--danger); background: var(--danger-bg); }
.dialog-sm { width: min(92vw, 470px); }
.danger-confirmation-copy { display: grid; gap: 5px; }
.danger-confirmation-copy > strong { font-size: 15px; color: #111827; }
.danger-confirmation-copy > span { color: #667085; font-size: 11px; }
.danger-confirmation-copy > p { margin: 8px 0 0; color: #667085; font-size: 11px; line-height: 1.6; }
.internal-user-drawer-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.internal-user-avatar.avatar-photo img { width: 100%; height: 100%; display: block; object-fit: cover; }
.profile-password-wrap { position: relative; display: flex; align-items: center; }
.profile-password-wrap input { width: 100%; padding-right: 44px; }
.profile-password-wrap .password-visibility-button { right: 6px; }

@media (max-width: 680px) {
    .internal-user-drawer-actions { align-items: stretch; flex-direction: column-reverse; }
    .internal-user-drawer-actions .button { width: 100%; justify-content: center; }

    /* On mobile keep the board icon visible inside each card. */
    .client-board-entity {
        width: 100%;
        min-width: 0;
        display: flex !important;
        align-items: center;
        gap: 12px;
    }
    .client-board-entity .board-table-avatar {
        width: 44px;
        height: 44px;
        display: grid !important;
        place-items: center;
        flex: 0 0 44px;
        border-radius: 12px;
    }
    .client-board-entity .board-table-avatar .board-icon-svg { width: 20px; height: 20px; }
    .client-board-entity > span:last-child { min-width: 0; display: grid; }
    .client-board-entity small { display: none !important; }
    .client-board-entity strong {
        min-width: 0;
        overflow-wrap: anywhere;
        font-size: 17px;
        line-height: 1.3;
    }
}

@media (max-width: 420px) {
    .client-board-entity .board-table-avatar { width: 42px; height: 42px; flex-basis: 42px; }
    .client-board-entity strong { font-size: 16px; }
}
.profile-password-wrap .password-visibility-button { top: 50%; transform: translateY(-50%); }

/* ---------- 2026-10-14 v9: activity + statistics ---------- */
.tone-rose { color: #c01048; background: #fff1f3; }
.tone-emerald { color: #067647; background: #ecfdf3; }
.badge-error { color: #b42318; background: #fef3f2; }

.activity-panel { overflow: hidden; }
.activity-toolbar { align-items: flex-start; }
.activity-filters { flex-wrap: wrap; }
.activity-filters .search-field { min-width: 280px; }
.activity-table th,
.activity-table td { vertical-align: middle; }
.activity-user-cell { display: flex; align-items: center; gap: 10px; min-width: 180px; }
.activity-user-cell > span:last-child { display: grid; gap: 2px; min-width: 0; }
.activity-user-cell strong { color: #101828; font-size: 13px; overflow-wrap: anywhere; }
.activity-user-cell small { color: #667085; font-size: 10px; overflow-wrap: anywhere; }
.activity-description { display: block; min-width: 260px; max-width: 580px; color: #344054; font-size: 12px; line-height: 1.55; overflow-wrap: anywhere; }
.activity-date { white-space: nowrap; color: #475467; font-size: 11px; }
.activity-role-badge { white-space: nowrap; }
.role-admin { color: #6941c6; background: #f4f3ff; }
.role-soporte { color: #175cd3; background: #eff8ff; }
.role-cliente { color: #067647; background: #ecfdf3; }

.stats-dashboard { position: relative; display: grid; gap: 16px; }
.stats-kpi-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.stats-kpi-card {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 1px 2px rgba(16,24,40,.03);
}
.stats-kpi-icon,
.stats-chart-icon { width: 42px; height: 42px; display: grid; place-items: center; flex: 0 0 42px; border-radius: 11px; }
.stats-kpi-icon .icon,
.stats-chart-icon .icon { width: 20px; height: 20px; }
.stats-kpi-copy { min-width: 0; display: grid; gap: 2px; }
.stats-kpi-copy > span { color: #667085; font-size: 11px; font-weight: 600; }
.stats-kpi-copy strong { color: #101828; font-size: 27px; line-height: 1.1; letter-spacing: -.035em; }
.stats-kpi-copy small { color: #98a2b3; font-size: 10px; line-height: 1.4; }

.stats-chart-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.stats-chart-card { min-width: 0; padding: 18px; }
.stats-chart-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 18px; }
.stats-chart-heading > div:first-child { min-width: 0; }
.stats-chart-kicker { display: block; color: #667085; font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; margin-bottom: 5px; }
.stats-chart-heading h3 { margin: 0; color: #101828; font-size: 16px; letter-spacing: -.015em; }
.stats-chart-heading p { margin: 5px 0 0; color: #667085; font-size: 11px; line-height: 1.5; }

.column-chart,
.horizontal-chart { display: grid; gap: 12px; }
.bar-chart-row { min-width: 0; display: grid; gap: 6px; }
.bar-chart-meta { min-width: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.bar-chart-meta span { min-width: 0; color: #475467; font-size: 11px; overflow-wrap: anywhere; }
.bar-chart-meta strong { color: #101828; font-size: 11px; }
.bar-chart-row > small { color: #98a2b3; font-size: 9px; }
.stats-progress {
    display: block;
    width: 100%;
    height: 9px;
    border: 0;
    border-radius: 999px;
    overflow: hidden;
    appearance: none;
    -webkit-appearance: none;
    background: #f2f4f7;
}
.stats-progress::-webkit-progress-bar { background: #f2f4f7; border-radius: 999px; }
.stats-progress::-webkit-progress-value { border-radius: 999px; background: #2563eb; }
.stats-progress::-moz-progress-bar { border-radius: 999px; background: #2563eb; }
.new-clients-progress::-webkit-progress-value { background: #2563eb; }
.new-clients-progress::-moz-progress-bar { background: #2563eb; }
.boards-client-progress::-webkit-progress-value { background: #12b76a; }
.boards-client-progress::-moz-progress-bar { background: #12b76a; }
.usage-login-progress::-webkit-progress-value { background: #7f56d9; }
.usage-login-progress::-moz-progress-bar { background: #7f56d9; }
.usage-open-progress::-webkit-progress-value { background: #f79009; }
.usage-open-progress::-moz-progress-bar { background: #f79009; }

.usage-summary-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.usage-summary-row > div { min-width: 0; padding: 11px 12px; border: 1px solid #eaecf0; border-radius: 10px; background: #fcfcfd; }
.usage-summary-row strong { display: block; color: #101828; font-size: 19px; line-height: 1.1; }
.usage-summary-row span { display: block; margin-top: 4px; color: #667085; font-size: 9px; line-height: 1.4; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 12px; margin: 0 0 12px; color: #667085; font-size: 9px; }
.chart-legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend-dot { width: 7px; height: 7px; display: inline-block; border-radius: 999px; }
.legend-dot.usage-login { background: #7f56d9; }
.legend-dot.usage-open { background: #f79009; }
.usage-chart { display: grid; gap: 8px; }
.usage-chart-row { min-width: 0; display: grid; grid-template-columns: 42px minmax(0, 1fr) 28px; align-items: center; gap: 8px; }
.usage-date { color: #667085; font-size: 9px; }
.usage-bars { min-width: 0; display: grid; gap: 3px; }
.usage-bars .stats-progress { height: 5px; }
.usage-chart-row > strong { color: #344054; font-size: 9px; text-align: right; }
.stats-board-chart-card { padding-bottom: 20px; }
.stats-board-chart-card .horizontal-chart { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 24px; }
.chart-empty { padding: 28px 14px; color: #667085; font-size: 11px; text-align: center; border: 1px dashed #d0d5dd; border-radius: 10px; }
.stats-loading { position: static; min-height: 42px; border-radius: 10px; }

@media (max-width: 980px) {
    .stats-kpi-grid { grid-template-columns: 1fr; }
    .stats-chart-grid { grid-template-columns: 1fr; }
    .stats-board-chart-card .horizontal-chart { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
    .activity-filters { width: 100%; display: grid; grid-template-columns: 1fr; gap: 8px; }
    .activity-filters .search-field,
    .activity-filters .select-control,
    .activity-filters .button { width: 100%; min-width: 0; }
    .activity-table-wrap { overflow: visible; padding: 0 12px 14px; border: 0; background: transparent; }
    .activity-table { display: block; min-width: 0; }
    .activity-table thead { display: none; }
    .activity-table tbody { display: grid; gap: 10px; }
    .activity-table tbody tr { display: grid; gap: 10px; padding: 15px; border: 1px solid var(--border); border-radius: 13px; background: #fff; }
    .activity-table tbody td { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 10px; align-items: start; padding: 0; border: 0; }
    .activity-table tbody td::before { content: attr(data-label); color: #98a2b3; font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
    .activity-table tbody tr td[colspan] { display: block; }
    .activity-table tbody tr td[colspan]::before { display: none; }
    .activity-user-cell { min-width: 0; }
    .activity-description { min-width: 0; max-width: none; font-size: 12px; }
    .activity-date { white-space: normal; }
}

@media (max-width: 520px) {
    .stats-kpi-card { padding: 15px; }
    .stats-kpi-copy strong { font-size: 24px; }
    .stats-chart-card { padding: 15px; }
    .stats-chart-heading { gap: 10px; }
    .usage-summary-row { grid-template-columns: 1fr; }
    .usage-chart-row { grid-template-columns: 38px minmax(0, 1fr) 24px; gap: 6px; }
    .activity-table tbody td { grid-template-columns: 1fr; gap: 4px; }
}

/* ===== Estadísticas v6 · Chart.js ===== */
.stats-dashboard-v2 { gap: 18px; }
.stats-dashboard-v2 .stats-kpi-grid { gap: 16px; }
.stats-dashboard-v2 .stats-kpi-card {
    position: relative;
    overflow: hidden;
    min-height: 118px;
    padding: 18px;
    border: 1px solid #eaecf0;
    background: #fff;
    box-shadow: 0 1px 2px rgba(16, 24, 40, .03);
}
.stats-dashboard-v2 .stats-kpi-card::after {
    content: "";
    position: absolute;
    inset: auto -28px -42px auto;
    width: 110px;
    height: 110px;
    border-radius: 999px;
    opacity: .55;
    pointer-events: none;
}
.stats-dashboard-v2 .stats-kpi-card-blue::after { background: #eff6ff; }
.stats-dashboard-v2 .stats-kpi-card-violet::after { background: #f5f3ff; }
.stats-dashboard-v2 .stats-kpi-card-emerald::after { background: #ecfdf3; }
.stats-kpi-value-row { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; min-width: 0; }
.stats-kpi-value-row strong { position: relative; z-index: 1; }
.metric-percent {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-height: 25px;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 10px;
    line-height: 1;
    font-weight: 750;
    white-space: nowrap;
}
.metric-percent .icon { width: 13px; height: 13px; }
.metric-percent-blue { color: #1d4ed8; background: #eff6ff; }
.metric-percent-violet { color: #6d28d9; background: #f5f3ff; }
.metric-percent-emerald { color: #047857; background: #ecfdf3; }

.stats-main-grid {
    display: grid;
    grid-template-columns: minmax(320px, .82fr) minmax(0, 1.58fr);
    gap: 16px;
    align-items: stretch;
}
.stats-dashboard-v2 .stats-chart-card {
    border: 1px solid #eaecf0;
    background: #fff;
    box-shadow: 0 1px 2px rgba(16, 24, 40, .03);
}
.stats-dashboard-v2 .stats-chart-heading { margin-bottom: 14px; }
.stats-dashboard-v2 .stats-chart-heading h3 { font-size: 17px; }
.stats-dashboard-v2 .stats-chart-heading p { max-width: 620px; font-size: 11.5px; }
.stats-dashboard-v2 .stats-chart-icon { border-radius: 12px; }

.stats-ring-layout {
    display: grid;
    grid-template-columns: minmax(170px, 210px) minmax(0, 1fr);
    align-items: center;
    gap: 20px;
    min-height: 258px;
}
.stats-ring-wrap {
    position: relative;
    width: 100%;
    max-width: 220px;
    aspect-ratio: 1 / 1;
    margin: 0 auto;
}
.stats-ring-wrap canvas,
.stats-canvas canvas { width: 100% !important; height: 100% !important; }
.stats-ring-detail { display: grid; gap: 12px; min-width: 0; }
.ring-detail-item {
    display: grid;
    grid-template-columns: 12px minmax(0, 1fr);
    align-items: center;
    gap: 9px;
    min-width: 0;
}
.ring-detail-item.compact { grid-template-columns: 30px minmax(0, 1fr); }
.ring-detail-item > div { display: grid; min-width: 0; }
.ring-detail-item strong { color: #101828; font-size: 14px; line-height: 1.25; }
.ring-detail-item span:not(.ring-detail-dot):not(.mini-icon) { color: #667085; font-size: 10.5px; line-height: 1.35; }
.ring-detail-dot { width: 9px; height: 9px; border-radius: 999px; }
.dot-violet { background: #7c3aed; }
.dot-slate { background: #d0d5dd; }
.ring-detail-divider { height: 1px; background: #f2f4f7; margin: 1px 0; }
.mini-icon { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; }
.mini-icon .icon { width: 14px; height: 14px; }
.tone-orange { color: #c2410c; background: #fff7ed; }

.chart-key-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 14px;
    margin: -2px 0 10px;
    color: #667085;
    font-size: 10px;
    font-weight: 650;
}
.chart-key-row > span { display: inline-flex; align-items: center; gap: 6px; }
.chart-key { width: 8px; height: 8px; border-radius: 999px; flex: 0 0 8px; }
.key-blue { background: #2563eb; }
.key-violet { background: #7c3aed; }
.key-orange { background: #f97316; }
.key-emerald { background: #059669; }
.key-cat-0 { background: #2563eb; }
.key-cat-1 { background: #7c3aed; }
.key-cat-2 { background: #059669; }
.key-cat-3 { background: #f97316; }
.key-cat-4 { background: #db2777; }
.key-cat-5 { background: #0891b2; }
.key-cat-6 { background: #ca8a04; }
.key-cat-7 { background: #64748b; }

.stats-canvas { position: relative; width: 100%; min-width: 0; }
.stats-canvas-wide { height: 270px; }
.stats-canvas-combo { height: 300px; }
.stats-activity-combo-card { padding-bottom: 14px; }

.stats-board-donut-layout {
    display: grid;
    grid-template-columns: minmax(220px, 300px) minmax(0, 1fr);
    align-items: center;
    gap: 26px;
    min-height: 300px;
}
.stats-board-ring-wrap { max-width: 260px; }
.boards-donut-legend {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 18px;
    min-width: 0;
}
.boards-legend-item {
    display: grid;
    grid-template-columns: 10px minmax(0, 1fr);
    align-items: start;
    gap: 8px;
    min-width: 0;
    padding: 9px 0;
    border-bottom: 1px solid #f2f4f7;
}
.boards-legend-item .chart-key { margin-top: 4px; }
.boards-legend-item > div { min-width: 0; display: grid; gap: 2px; }
.boards-legend-item strong {
    min-width: 0;
    overflow: hidden;
    color: #344054;
    font-size: 11px;
    line-height: 1.35;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.boards-legend-item span { color: #98a2b3; font-size: 9.5px; line-height: 1.35; }

@media (max-width: 1120px) {
    .stats-main-grid { grid-template-columns: 1fr; }
    .stats-ring-layout { grid-template-columns: minmax(180px, 220px) minmax(0, 1fr); }
}

@media (max-width: 760px) {
    .stats-dashboard-v2 { gap: 14px; }
    .stats-dashboard-v2 .stats-kpi-card { min-height: 106px; padding: 15px; }
    .stats-main-grid { gap: 14px; }
    .stats-ring-layout { grid-template-columns: 1fr; gap: 12px; min-height: 0; }
    .stats-ring-wrap { max-width: 205px; }
    .stats-ring-detail { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .ring-detail-divider { display: none; }
    .stats-canvas-wide { height: 245px; }
    .stats-canvas-combo { height: 265px; }
    .stats-board-donut-layout { grid-template-columns: 1fr; min-height: 0; gap: 14px; }
    .stats-board-ring-wrap { max-width: 215px; }
    .boards-donut-legend { grid-template-columns: 1fr; gap: 0; }
}

@media (max-width: 460px) {
    .stats-dashboard-v2 .stats-chart-card { padding: 14px; }
    .stats-dashboard-v2 .stats-chart-heading { align-items: center; }
    .stats-dashboard-v2 .stats-chart-heading p { font-size: 11px; }
    .stats-ring-detail { grid-template-columns: 1fr; }
    .stats-canvas-wide { height: 230px; }
    .stats-canvas-combo { height: 250px; }
    .chart-key-row { gap: 10px; }
    .metric-percent { font-size: 9.5px; }
}
