:root {
    color-scheme: light;
    --bg: #f6f7fb;
    --surface: #ffffff;
    --surface-soft: #f1f3f8;
    --surface-strong: #e4e7f0;
    --text: #181818;
    --muted: #5d6472;
    --line: #d9deea;
    --primary: #2d2b72;
    --primary-strong: #1e1c77;
    --secondary: #2d2b72;
    --secondary-strong: #1e1c77;
    --blue: #2d2b72;
    --amber: #f95602;
    --red: #da2426;
    --green: #2e7d32;
    --violet: #1e1c77;
    --shadow: 0 18px 42px rgba(24, 24, 24, .10);
    --radius: 8px;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

:root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #101010;
    --surface: #181818;
    --surface-soft: #222222;
    --surface-strong: #2f2f2f;
    --text: #fff;
    --muted: #c7c7c7;
    --line: #363636;
    --primary: #8e8cf0;
    --primary-strong: #b8b6ff;
    --secondary: #8e8cf0;
    --secondary-strong: #b8b6ff;
    --blue: #8e8cf0;
    --amber: #f95602;
    --red: #ff6264;
    --green: #43a047;
    --violet: #b8b6ff;
    --shadow: 0 18px 42px rgba(0, 0, 0, .36);
}

* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

html,
body {
    min-height: 100%;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    letter-spacing: 0;
}

button,
input,
textarea,
select {
    font: inherit;
}

button {
    cursor: pointer;
}

.login-page {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(620px, 1fr) minmax(420px, 520px);
    background: var(--bg);
}

.login-visual {
    position: relative;
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(320px, .84fr) minmax(360px, .72fr);
    align-items: center;
    gap: 34px;
    padding: clamp(42px, 5vw, 72px);
    background:
        linear-gradient(135deg, rgba(30, 28, 119, .95) 0%, rgba(45, 43, 114, .88) 52%, rgba(24, 24, 24, .70) 100%),
        url("../img/esfera-hero.jpg") center / cover;
    color: #fff;
    overflow: hidden;
}

.login-visual::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, .08) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, .08) 1px, transparent 1px);
    background-size: 64px 64px;
    opacity: .42;
    mask-image: linear-gradient(125deg, rgba(0, 0, 0, .9), rgba(0, 0, 0, .18));
}

.login-copy,
.login-art,
.login-theme-toggle {
    position: relative;
    z-index: 1;
}

.login-copy {
    max-width: 680px;
}

.login-logo {
    width: min(198px, 28vw);
    max-height: 88px;
    object-fit: contain;
    background: rgba(255, 255, 255, .94);
    padding: 14px 18px;
    border-radius: var(--radius);
    margin-bottom: 38px;
}

.login-art {
    justify-self: end;
    width: min(500px, 100%);
}

.bi-card {
    display: grid;
    gap: 14px;
    padding: 16px;
    border: 1px solid rgba(255, 255, 255, .2);
    border-radius: 8px;
    background: linear-gradient(180deg, rgba(255, 255, 255, .96), rgba(247, 244, 239, .92));
    color: #181818;
    box-shadow: 0 30px 70px rgba(0, 0, 0, .34);
    overflow: hidden;
}

.bi-toolbar {
    min-height: 36px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #686868;
    font-size: 12px;
    font-weight: 900;
}

.bi-toolbar span {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #ded9d2;
}

.bi-toolbar span:first-child {
    background: #2d2b72;
}

.bi-toolbar strong {
    margin-left: auto;
    color: #2d2b72;
    font-size: 0;
}

.bi-toolbar strong::after {
    content: "Portal - Esfera EPI";
    font-size: 12px;
}

.bi-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.bi-kpi {
    min-height: 72px;
    display: grid;
    align-content: space-between;
    padding: 14px;
    border: 1px solid #e4ddd3;
    border-radius: 12px;
    background: #fff;
}

.bi-kpi span {
    color: #686868;
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
}

.bi-kpi strong {
    display: none;
}

.bi-kpi::after {
    content: "";
    width: 58%;
    height: 10px;
    border-radius: 999px;
    background: #ded9d2;
}

.bi-kpi.accent::after {
    background: rgba(45, 43, 114, .28);
}

.bi-main {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 126px;
    gap: 14px;
}

.bi-chart,
.bi-list {
    min-height: 220px;
    border: 1px solid #e4ddd3;
    border-radius: 12px;
    background:
        linear-gradient(#f3eee7 1px, transparent 1px),
        linear-gradient(90deg, #f3eee7 1px, transparent 1px),
        #fff;
    background-size: 42px 42px;
}

.bi-chart {
    position: relative;
    padding: 18px;
    overflow: hidden;
}

.bi-chart svg {
    position: absolute;
    inset: 24px 22px 74px;
    width: calc(100% - 44px);
    height: 120px;
}

.bi-chart path {
    fill: none;
    stroke: #2d2b72;
    stroke-width: 8;
    stroke-linecap: round;
}

.bi-chart .line-accent {
    stroke: #2d2b72;
    stroke-width: 6;
}

.bi-bars {
    position: absolute;
    left: 22px;
    right: 22px;
    bottom: 20px;
    height: 70px;
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    align-items: end;
    gap: 10px;
}

.bi-bars span {
    border-radius: 8px 8px 0 0;
    background: linear-gradient(180deg, #2d2b72, #1e1c77);
}

.bi-bars span:nth-child(even) {
    background: linear-gradient(180deg, #2d2b72, #1e1c77);
}

.bi-list {
    display: grid;
    align-content: center;
    gap: 14px;
    padding: 18px;
    background: #fff;
}

.bi-list div {
    display: grid;
    grid-template-columns: 28px 1fr;
    align-items: center;
    gap: 10px;
}

.bi-list span {
    width: 28px;
    min-width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: rgba(45, 43, 114, .16);
    font-size: 0;
}

.bi-list strong {
    height: 10px;
    border-radius: 999px;
    background: #ded9d2;
    font-size: 0;
}

.bi-list div:nth-child(even) span {
    background: rgba(45, 43, 114, .16);
    color: #2d2b72;
}

.login-theme-toggle {
    position: absolute;
    top: 24px;
    right: 24px;
    border-color: rgba(255, 255, 255, .34);
    background: rgba(255, 255, 255, .14);
    color: #fff;
    backdrop-filter: blur(10px);
}

.login-visual h1,
.login-panel h2,
.topbar h1,
.modal h2 {
    margin: 0;
    line-height: 1.05;
}

.login-visual h1 {
    font-size: 48px;
    max-width: 640px;
}

.login-visual p {
    margin: 14px 0 0;
    max-width: 600px;
    font-size: 18px;
    color: rgba(255, 255, 255, .86);
}

.login-panel {
    display: grid;
    place-items: center;
    padding: 42px;
    border-left: 1px solid var(--line);
    background:
        linear-gradient(180deg, color-mix(in srgb, var(--surface) 88%, var(--bg)), var(--bg));
}

.login-form {
    width: min(420px, 100%);
    display: grid;
    gap: 18px;
    padding: 34px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.login-form h2 {
    font-size: 32px;
}

.eyebrow {
    display: block;
    margin-bottom: 6px;
    color: var(--primary);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0;
}

label {
    display: grid;
    gap: 8px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

input,
textarea,
select {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    outline: none;
    transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}

input,
select {
    min-height: 42px;
    padding: 0 12px;
}

textarea {
    min-height: 108px;
    padding: 12px;
    resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(45, 43, 114, .18);
}

.primary-btn,
.secondary-btn,
.ghost-btn,
.danger-btn,
.icon-btn {
    border: 0;
    border-radius: var(--radius);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 38px;
    padding: 0 14px;
    font-weight: 800;
}

.primary-btn {
    background: var(--primary);
    color: #fff;
}

.primary-btn:hover {
    background: var(--primary-strong);
}

.secondary-btn,
.ghost-btn {
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--text);
}

.danger-btn {
    background: rgba(196, 72, 72, .12);
    color: var(--red);
}

.primary-btn:disabled,
.secondary-btn:disabled,
.danger-btn:disabled {
    cursor: not-allowed;
    opacity: .58;
}

.icon-btn {
    width: 38px;
    padding: 0;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--text);
    text-decoration: none;
}

.icon-btn.with-label {
    width: auto;
    padding: 0 12px;
}

.icon-btn.danger {
    color: var(--red);
}

.icon-btn.success {
    color: var(--green);
}

.icon-btn.favorite-toggle[hidden] {
    display: none;
}

.icon-btn.favorite-toggle.active {
    border-color: rgba(45, 43, 114, .45);
    background: rgba(45, 43, 114, .12);
    color: var(--primary);
}

.icon-btn.favorite-toggle.active svg {
    fill: currentColor;
}

.icon-btn.has-attachment {
    border-color: var(--green);
    background: var(--green);
    color: #fff;
}

.icon-btn:disabled {
    cursor: wait;
    opacity: .58;
}

.primary-btn svg,
.secondary-btn svg,
.ghost-btn svg,
.danger-btn svg,
.icon-btn svg,
.nav svg {
    width: 18px;
    height: 18px;
}

.form-message {
    min-height: 22px;
    margin: 0;
    color: var(--red);
    font-weight: 700;
}

.app-shell {
    min-height: 100vh;
    height: 100vh;
    display: grid;
    grid-template-columns: 282px 1fr;
    overflow: hidden;
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding: 20px 12px;
    border-right: 1px solid var(--line);
    background: var(--surface);
    overflow-y: auto;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px;
    color: var(--text);
    text-decoration: none;
    font-weight: 900;
}

.brand img {
    width: 128px;
    height: 40px;
    object-fit: contain;
    border-radius: 0;
    background: transparent;
    padding: 0;
}

.nav {
    display: grid;
    gap: 10px;
}

.nav-section {
    display: grid;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    overflow: hidden;
}

.nav-section-toggle {
    width: 100%;
    min-height: 42px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 0 10px;
    border: 0;
    background: var(--surface-soft);
    color: var(--text);
    font-weight: 900;
}

.nav-section-toggle span {
    display: inline-flex;
    align-items: center;
    gap: 9px;
}

.nav-section-toggle small {
    min-width: 24px;
    min-height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: var(--surface);
    color: var(--muted);
    font-size: 11px;
}

.nav-section-toggle .chevron {
    transition: transform .18s ease;
}

.nav-section.collapsed .chevron {
    transform: rotate(-90deg);
}

.nav-section.collapsed .nav-items {
    display: none;
}

.nav-items {
    display: grid;
    gap: 4px;
    padding: 7px;
}

.nav-folder {
    display: grid;
    gap: 4px;
}

.nav-folder-toggle {
    min-height: 34px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 0 10px;
    border: 0;
    border-radius: var(--radius);
    background: transparent;
    color: var(--muted);
    font-size: 13px;
    font-weight: 900;
}

.nav-folder-toggle span {
    display: inline-flex;
    align-items: center;
    gap: 9px;
}

.nav-folder-toggle:hover {
    background: var(--surface-soft);
    color: var(--text);
}

.nav-folder-content {
    display: grid;
    gap: 4px;
    padding-left: 12px;
}

.nav-folder.collapsed .nav-folder-content {
    display: none;
}

.nav-folder.collapsed .chevron {
    transform: rotate(-90deg);
}

.nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 36px;
    padding: 0 10px;
    border-radius: var(--radius);
    color: var(--muted);
    text-decoration: none;
    font-size: 14px;
    font-weight: 800;
}

.nav a:hover,
.nav a.active {
    background: var(--surface-soft);
    color: var(--text);
}

.nav a.active {
    box-shadow: inset 3px 0 0 var(--primary);
}

.nav a.nav-section-link {
    min-height: 42px;
    justify-content: space-between;
    border-radius: 0;
    background: var(--surface-soft);
    color: var(--text);
    font-weight: 900;
}

.nav a.nav-section-link:hover,
.nav a.nav-section-link.active {
    background: var(--surface-soft);
    color: var(--text);
}

.workspace {
    min-width: 0;
    min-height: 0;
    height: 100vh;
    display: grid;
    grid-template-rows: auto 1fr;
    overflow: hidden;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    gap: 18px;
    justify-content: space-between;
    min-height: 76px;
    padding: 14px 28px;
    border-bottom: 1px solid var(--line);
    background: color-mix(in srgb, var(--bg) 84%, transparent);
    backdrop-filter: blur(12px);
}

.topbar h1 {
    font-size: 26px;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-chip {
    min-height: 38px;
    display: flex;
    align-items: center;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.mobile-nav {
    display: none;
}

.content {
    min-height: 0;
    padding: 26px 28px 40px;
    overflow: hidden;
}

.tabs-shell {
    min-width: 0;
    min-height: 0;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    overflow: hidden;
}

.tab-strip {
    min-width: 0;
    display: flex;
    gap: 8px;
    padding: 10px 28px 0;
    overflow-x: auto;
    border-bottom: 1px solid var(--line);
    background: color-mix(in srgb, var(--bg) 88%, transparent);
}

.tab-button {
    min-width: 138px;
    max-width: 230px;
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0 8px 0 12px;
    border: 1px solid var(--line);
    border-bottom: 0;
    border-radius: var(--radius) var(--radius) 0 0;
    background: var(--surface-soft);
    color: var(--muted);
    font-size: 13px;
    font-weight: 900;
}

.tab-button.active {
    background: var(--surface);
    color: var(--text);
    box-shadow: inset 0 3px 0 var(--primary);
}

.tab-button svg {
    width: 16px;
    height: 16px;
    flex: 0 0 auto;
}

.tab-button span:not(.tab-close) {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tab-close {
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    margin-left: auto;
    border-radius: 6px;
    color: var(--muted);
}

.tab-close:hover {
    background: rgba(196, 72, 72, .12);
    color: var(--red);
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
    min-height: 0;
    height: 100%;
    overflow: auto;
}

.tab-pane.module-list-pane.active {
    overflow: auto;
}

.tab-pane.module-list-pane.active .module-page {
    min-height: 100%;
    height: auto;
    display: block;
    overflow: visible;
}

.tab-pane.module-list-pane.active .table-wrap {
    margin-top: 14px;
    overflow-x: auto;
    overflow-y: visible;
}

.dashboard-grid {
    display: grid;
    gap: 18px;
}

.quick-dashboard {
    display: grid;
    gap: 18px;
}

.dashboard-hero {
    min-height: 172px;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: end;
    gap: 24px;
    padding: 28px;
    border: 1px solid color-mix(in srgb, var(--primary) 22%, var(--line));
    border-radius: var(--radius);
    background:
        linear-gradient(120deg, rgba(45, 43, 114, .16) 0%, rgba(30, 28, 119, .10) 52%, rgba(46, 125, 50, .13) 100%),
        linear-gradient(180deg, color-mix(in srgb, var(--surface) 92%, var(--primary)), var(--surface));
    box-shadow: var(--shadow);
}

.dashboard-hero h2 {
    margin: 4px 0 8px;
    font-size: 30px;
    line-height: 1.05;
}

.dashboard-hero p {
    max-width: 760px;
    margin: 0;
    color: var(--muted);
    font-size: 15px;
    font-weight: 700;
    line-height: 1.5;
}

.quick-dashboard-section {
    position: relative;
    display: grid;
    gap: 16px;
    padding: 18px 18px 20px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background:
        linear-gradient(115deg, rgba(45, 43, 114, .09), rgba(255, 255, 255, 0) 34%),
        var(--surface);
    box-shadow: 0 12px 28px rgba(24, 24, 24, .07);
    overflow: hidden;
}

.quick-dashboard-section::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 4px;
    background: linear-gradient(180deg, var(--primary), var(--secondary));
}

.dashboard-group-section[data-dashboard-group="T.I."]::before,
.dashboard-group-section[data-dashboard-group="Telas"]::before {
    background: linear-gradient(180deg, var(--primary), var(--red));
}

.dashboard-group-section[data-dashboard-group="CRM"]::before {
    background: linear-gradient(180deg, var(--green), var(--primary));
}

.dashboard-group-section[data-dashboard-group="Power BI"]::before,
.dashboard-group-section[data-dashboard-group="Indicadores"]::before {
    background: linear-gradient(180deg, var(--secondary), var(--primary));
}

.dashboard-group-section[data-dashboard-group="Administração"]::before,
.dashboard-group-section[data-dashboard-group="Administracao"]::before {
    background: linear-gradient(180deg, var(--text), var(--secondary));
}

.dashboard-section-header {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 18px;
    padding-left: 4px;
}

.dashboard-section-header h2 {
    margin: 3px 0 6px;
    font-size: 18px;
    line-height: 1.2;
}

.dashboard-section-header p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
    line-height: 1.45;
}

.quick-access-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(236px, 1fr));
    gap: 10px;
}

.dashboard-empty-note {
    min-height: 82px;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    border: 1px dashed color-mix(in srgb, var(--primary) 42%, var(--line));
    border-radius: var(--radius);
    background: color-mix(in srgb, var(--primary) 6%, var(--surface));
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.dashboard-empty-note svg {
    width: 19px;
    height: 19px;
    color: var(--primary);
}

.quick-access-card {
    min-height: 82px;
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr) 20px;
    align-items: center;
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background:
        linear-gradient(180deg, color-mix(in srgb, var(--surface) 96%, var(--primary)), var(--surface));
    color: var(--text);
    text-decoration: none;
    box-shadow: 0 7px 18px rgba(24, 24, 24, .06);
    transition: transform .18s ease, border-color .18s ease, background .18s ease, box-shadow .18s ease;
}

.quick-access-card:hover {
    transform: translateY(-2px);
    border-color: var(--primary);
    background:
        linear-gradient(180deg, color-mix(in srgb, var(--surface) 90%, var(--primary)), var(--surface));
    box-shadow: 0 12px 24px rgba(45, 43, 114, .12);
}

.quick-access-card.is-favorite {
    border-color: rgba(45, 43, 114, .36);
}

.quick-access-icon {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
    background: color-mix(in srgb, var(--primary) 13%, var(--surface));
    color: var(--primary);
}

.quick-access-icon svg {
    width: 18px;
    height: 18px;
}

.quick-access-card span:not(.quick-access-icon) {
    min-width: 0;
    display: grid;
    gap: 5px;
}

.quick-access-card small,
.quick-access-card strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.quick-access-card small {
    color: var(--muted);
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
}

.quick-access-card strong {
    font-size: 14px;
}

.quick-access-card > svg {
    width: 19px;
    height: 19px;
    color: var(--muted);
}

.quick-access-card.is-favorite > svg {
    color: var(--primary);
    fill: currentColor;
}

.document-groups-shell {
    display: grid;
    gap: 16px;
}

.document-insights-shell {
    display: grid;
    gap: 16px;
}

.document-insights-filters {
    display: grid;
    grid-template-columns: minmax(170px, 1fr) minmax(140px, 190px) minmax(140px, 190px) minmax(260px, 1.6fr) auto;
    gap: 10px;
    align-items: end;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.document-insights-filters label {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.document-insights-filter-actions {
    display: flex;
    gap: 8px;
}

.document-insights-kpis {
    display: grid;
    grid-template-columns: repeat(6, minmax(140px, 1fr));
    gap: 14px;
}

.document-insights-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.document-insights-grid .panel h3,
.document-insights-lists .panel h3 {
    margin: 0 0 12px;
    font-size: 18px;
}

.insight-bars {
    display: grid;
    gap: 10px;
}

.insight-bar-row {
    display: grid;
    grid-template-columns: minmax(0, 220px) minmax(0, 1fr) 56px;
    gap: 10px;
    align-items: center;
}

.insight-bar-row strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13px;
}

.insight-bar-row small {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    text-align: right;
}

.insight-bar-track {
    height: 12px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--line) 72%, transparent);
    overflow: hidden;
}

.insight-bar-track span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, color-mix(in srgb, var(--primary) 74%, #7c3aed) 0%, var(--primary) 100%);
}

.document-insights-lists {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.document-insight-table-wrap {
    border: 0;
    box-shadow: none;
    background: transparent;
    padding: 0;
}

.document-groups-summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(140px, 1fr));
    gap: 10px;
}

.document-groups-summary > div {
    min-height: 74px;
    display: grid;
    align-content: center;
    gap: 5px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
}

.document-groups-summary small {
    color: var(--muted);
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
}

.document-groups-summary strong {
    font-size: 24px;
    line-height: 1;
}

.document-groups-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr));
    gap: 14px;
}

.document-group-card {
    min-width: 0;
    min-height: 128px;
    display: grid;
    grid-template-columns: 46px minmax(0, 1fr) 40px;
    align-items: start;
    gap: 16px;
    padding: 18px;
    border: 1px solid var(--line);
    border-left: 4px solid var(--primary);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.document-group-card.is-inactive {
    border-left-color: var(--red);
    opacity: .78;
}

.document-group-icon {
    width: 46px;
    height: 46px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
    background: rgba(45, 43, 114, .12);
    color: var(--primary);
    align-self: center;
}

.document-group-card.is-inactive .document-group-icon {
    background: rgba(198, 40, 40, .12);
    color: var(--red);
}

.document-group-icon svg {
    width: 22px;
    height: 22px;
}

.document-group-body {
    min-width: 0;
    display: grid;
    align-content: center;
    gap: 10px;
    min-height: 76px;
}

.document-group-body > div > span {
    display: block;
    margin-bottom: 4px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
}

.document-group-body h3 {
    margin: 0;
    overflow: hidden;
    color: var(--text);
    font-size: 16px;
    line-height: 1.25;
    display: -webkit-box;
    text-overflow: ellipsis;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.document-group-body .cell-badge {
    justify-self: start;
    min-width: 76px;
    max-width: max-content;
}

.document-group-actions {
    align-self: start;
    justify-self: end;
    display: grid;
    gap: 8px;
}

.document-group-actions .icon-btn {
    width: 34px;
    height: 34px;
}

:root:not([data-theme="dark"]) .document-group-card {
    border-color: #d8d2ca;
    background: linear-gradient(180deg, #ffffff 0%, #fbfaf8 100%);
    box-shadow: 0 6px 16px rgba(24, 24, 24, .06);
}

:root:not([data-theme="dark"]) .document-group-card:hover {
    border-color: color-mix(in srgb, var(--primary) 48%, #d8d2ca);
    box-shadow: 0 10px 20px rgba(45, 43, 114, .12);
}

:root:not([data-theme="dark"]) .document-group-icon {
    border: 1px solid #f3c5b1;
    background: #fff1eb;
    color: var(--primary);
}

:root:not([data-theme="dark"]) .document-group-card.is-inactive {
    border-color: #e1c9c9;
    background: linear-gradient(180deg, #fffefe 0%, #faf8f8 100%);
}

:root:not([data-theme="dark"]) .document-group-card.is-inactive .document-group-icon {
    border-color: #e7c4c4;
    background: #fff1f1;
    color: #c62828;
}

:root:not([data-theme="dark"]) .document-group-body > div > span {
    color: #7b6657;
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(140px, 1fr));
    gap: 14px;
}

.kpi {
    min-height: 118px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.kpi span {
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.kpi strong {
    display: block;
    margin-top: 14px;
    font-size: 32px;
    line-height: 1;
}

.tone-green { border-top: 4px solid var(--primary); }
.tone-blue { border-top: 4px solid var(--blue); }
.tone-amber { border-top: 4px solid var(--amber); }
.tone-red { border-top: 4px solid var(--red); }
.tone-violet { border-top: 4px solid var(--violet); }
.tone-gray { border-top: 4px solid var(--muted); }

.dashboard-panels {
    display: grid;
    grid-template-columns: 1.05fr .95fr;
    gap: 18px;
}

.panel,
.table-wrap,
.link-card,
.empty-state {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.panel {
    padding: 18px;
}

.panel h2,
.module-header h2,
.link-card h2 {
    margin: 0;
    font-size: 18px;
}

.bars {
    display: grid;
    gap: 12px;
    margin-top: 18px;
}

.bar-row {
    display: grid;
    gap: 6px;
}

.bar-label {
    display: flex;
    justify-content: space-between;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.bar-track {
    height: 9px;
    border-radius: 999px;
    background: var(--surface-soft);
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    border-radius: inherit;
    background: var(--primary);
}

.list {
    display: grid;
    gap: 10px;
    margin-top: 16px;
}

.list-item {
    display: grid;
    gap: 4px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface-soft);
}

.list-item strong {
    font-size: 14px;
}

.list-item span {
    color: var(--muted);
    font-size: 12px;
}

.module-header {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.module-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

.quick-filters {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    min-height: 38px;
    padding: 3px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface-soft);
}

.quick-filters .secondary-btn {
    min-height: 30px;
    padding: 0 11px;
    border-color: transparent;
    background: transparent;
}

.quick-filters .secondary-btn.active {
    border-color: transparent;
    background: var(--surface);
    color: var(--primary);
    box-shadow: 0 5px 14px rgba(24, 24, 24, .08);
}

.list-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.list-filter {
    position: relative;
    min-width: 190px;
    min-height: 38px;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    padding: 0 32px 0 11px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}

.list-filter::after {
    content: "";
    position: absolute;
    right: 12px;
    top: 50%;
    width: 7px;
    height: 7px;
    border-right: 2px solid var(--muted);
    border-bottom: 2px solid var(--muted);
    pointer-events: none;
    transform: translateY(-65%) rotate(45deg);
}

.list-filter:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(45, 43, 114, .14);
}

.list-filter span {
    color: var(--muted);
    font-size: 10px;
    font-weight: 900;
    text-transform: uppercase;
}

.list-filter select {
    min-width: 0;
    min-height: 34px;
    padding: 0;
    border: 0;
    background: transparent;
    appearance: none;
    font-size: 12px;
    font-weight: 800;
}

.list-filter select:focus {
    border-color: transparent;
    box-shadow: none;
}

.module-actions .search-box input {
    min-height: 38px;
}

.module-page {
    height: 100%;
    min-height: 0;
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr) auto;
    overflow: hidden;
}

.approval-list-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 10px;
    margin-bottom: 14px;
}

.approval-list-summary > div {
    display: grid;
    gap: 4px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
}

.approval-list-summary small {
    color: var(--muted);
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
}

.approval-list-summary strong {
    font-size: 20px;
}

.search-box {
    position: relative;
    width: min(360px, 42vw);
}

.search-box svg {
    position: absolute;
    left: 12px;
    top: 50%;
    width: 17px;
    height: 17px;
    transform: translateY(-50%);
    color: var(--muted);
}

.search-box input {
    padding-left: 38px;
}

.table-wrap {
    min-height: 0;
    overflow: auto;
}

table {
    width: 100%;
    min-width: 920px;
    border-collapse: collapse;
}

th,
td {
    padding: 13px 14px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: middle;
    font-size: 14px;
}

th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--surface-soft);
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
}

.select-col {
    width: 44px;
    text-align: center;
}

.select-col input {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

tr:last-child td {
    border-bottom: 0;
}

.row-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.module-list-footer {
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 2px 0;
    border-top: 1px solid var(--line);
    background: var(--bg);
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.module-list-footer span {
    min-width: 0;
}

.module-pagination {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.page-btn {
    min-width: 38px;
    min-height: 38px;
    padding: 0 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    font-weight: 900;
}

.page-btn.active {
    border-color: var(--primary);
    background: var(--primary);
    color: #fff;
}

.page-ellipsis {
    min-width: 24px;
    color: var(--muted);
    text-align: center;
    font-weight: 900;
}

.cell-long {
    display: -webkit-box;
    max-width: 440px;
    overflow: hidden;
    color: var(--text);
    line-height: 1.35;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.cell-badge {
    min-width: 68px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 5px 10px;
    border-radius: 999px;
    background: var(--badge-bg);
    color: var(--badge-fg);
    font-size: 12px;
    font-weight: 900;
    line-height: 1;
    white-space: nowrap;
}

.attachments-form {
    display: grid;
}

.approval-shell {
    display: grid;
    gap: 16px;
}

.approval-subtitle {
    margin: 0;
    color: var(--muted);
    font-weight: 800;
}

.approval-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
}

.approval-summary-card,
.approval-note {
    min-width: 0;
    display: grid;
    gap: 6px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface-soft);
}

.approval-summary-card small,
.approval-note small,
.approval-section-title span {
    color: var(--muted);
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
}

.approval-summary-card strong {
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 15px;
}

.approval-notes {
    display: grid;
    gap: 10px;
}

.approval-note p {
    margin: 0;
    color: var(--text);
    line-height: 1.45;
    white-space: pre-wrap;
}

.approval-items {
    display: grid;
    gap: 10px;
}

.approval-section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.approval-section-title h3 {
    margin: 0;
    font-size: 16px;
}

.approval-item-list {
    display: grid;
    gap: 12px;
}

.approval-item-card {
    display: grid;
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
}

.approval-item-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--line);
}

.approval-item-head div {
    min-width: 0;
    display: grid;
    gap: 4px;
}

.approval-item-head small,
.approval-item-grid small {
    color: var(--muted);
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
}

.approval-item-head strong {
    color: var(--text);
    line-height: 1.35;
}

.approval-item-head span {
    flex: 0 0 auto;
    color: var(--primary);
    font-weight: 900;
}

.approval-item-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
}

.approval-item-grid div {
    min-width: 0;
    display: grid;
    gap: 3px;
}

.approval-item-grid strong {
    overflow-wrap: anywhere;
    font-size: 13px;
    line-height: 1.35;
}

.approval-quote-panel {
    display: grid;
    gap: 10px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
}

.approval-quote-title,
.approval-quote-group-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.approval-quote-title span {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text);
    font-size: 13px;
    font-weight: 900;
}

.approval-quote-title i {
    width: 16px;
    height: 16px;
    color: var(--primary);
}

.approval-quote-title small,
.approval-quote-group-head span {
    color: var(--muted);
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
}

.approval-quote-group {
    display: grid;
    gap: 8px;
}

.approval-quote-group-head strong {
    font-size: 12px;
}

.approval-quote-table {
    display: grid;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface-soft);
}

.approval-quote-row {
    display: grid;
    grid-template-columns: minmax(220px, 1.7fr) minmax(72px, .45fr) minmax(112px, .6fr) minmax(160px, 1fr);
    align-items: center;
    gap: 10px;
    min-width: 0;
    padding: 9px 10px;
    border-top: 1px solid var(--line);
}

.approval-quote-row:first-child {
    border-top: 0;
}

.approval-quote-row-head {
    min-height: 34px;
    background: var(--surface-strong);
    color: var(--muted);
    font-size: 10px;
    font-weight: 900;
    text-transform: uppercase;
}

.approval-quote-row strong,
.approval-quote-row span {
    min-width: 0;
    overflow-wrap: anywhere;
    font-size: 12px;
    line-height: 1.35;
}

.approval-quote-row > span:nth-child(2),
.approval-quote-row > span:nth-child(3) {
    font-weight: 800;
}

.approval-quote-row.is-best {
    background: rgba(46, 125, 50, .10);
}

.approval-quote-row.is-oc-supplier {
    box-shadow: inset 3px 0 0 var(--primary);
}

.approval-quote-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.approval-quote-tags em {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    padding: 3px 7px;
    border-radius: 6px;
    background: rgba(45, 43, 114, .12);
    color: var(--primary-strong);
    font-size: 10px;
    font-style: normal;
    font-weight: 900;
    text-transform: uppercase;
}

.approval-quote-row.is-best .approval-quote-tags em:first-child {
    background: rgba(46, 125, 50, .14);
    color: var(--green);
}

.attachments-panel {
    grid-column: 1 / -1;
    display: grid;
    gap: 12px;
}

.attachments-count-banner {
    min-height: 48px;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid rgba(46, 125, 50, .35);
    border-radius: var(--radius);
    background: rgba(46, 125, 50, .10);
    color: var(--green);
    padding: 10px 12px;
}

.attachments-count-banner svg {
    width: 20px;
    height: 20px;
}

.ticket-detail-form {
    display: block;
}

.ticket-detail-shell {
    display: grid;
    gap: 16px;
}

.ticket-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 10px;
}

.ticket-summary-item {
    min-height: 74px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 7px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface-soft);
    padding: 12px;
}

.ticket-summary-item > span {
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
}

.ticket-summary-item > strong {
    color: var(--text);
    font-size: 14px;
    line-height: 1.35;
}

.ticket-note,
.ticket-detail-attachments {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    padding: 14px;
}

.ticket-note h3,
.ticket-detail-attachments h3 {
    margin: 0 0 10px;
    font-size: 15px;
}

.ticket-note p {
    margin: 0;
    color: var(--text);
    line-height: 1.5;
    white-space: pre-wrap;
}

.record-attachments {
    grid-column: 1 / -1;
    display: grid;
    gap: 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface-soft);
    padding: 14px;
}

.record-attachments-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.record-attachments-head h3 {
    margin: 2px 0 0;
    font-size: 16px;
}

.record-attachments-head > span {
    min-width: 32px;
    min-height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: var(--green);
    color: #fff;
    font-weight: 900;
}

.empty-state.compact {
    min-height: 70px;
    padding: 12px;
}

.attachment-list {
    display: grid;
    gap: 10px;
}

.attachment-item {
    min-height: 58px;
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr) auto 24px;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    text-decoration: none;
}

.attachment-item:hover {
    border-color: var(--primary);
    background: var(--surface-soft);
}

.attachment-item > svg:first-child {
    width: 38px;
    height: 38px;
    padding: 9px;
    border-radius: var(--radius);
    background: rgba(45, 43, 114, .1);
    color: var(--primary);
}

.attachment-item span {
    min-width: 0;
    display: grid;
    gap: 3px;
}

.attachment-item strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 14px;
}

.attachment-item small {
    color: var(--muted);
    font-size: 12px;
}

.attachment-item em {
    color: var(--primary);
    font-style: normal;
    font-weight: 900;
    white-space: nowrap;
}

.attachment-item.missing {
    border-style: dashed;
    color: var(--muted);
}

.permission-shell {
    display: grid;
    gap: 16px;
}

.permission-toolbar {
    display: grid;
    grid-template-columns: minmax(160px, 220px) minmax(260px, 420px) minmax(260px, 1fr);
    gap: 12px;
    align-items: end;
}

.permission-toolbar label {
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
}

.permission-toolbar select {
    margin-top: 7px;
}

.permission-search {
    width: 100%;
}

.permission-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 10px;
}

.permission-row {
    min-height: 58px;
    display: grid;
    grid-template-columns: 20px 1fr;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
}

.permission-row input {
    width: 18px;
    height: 18px;
}

.permission-row span {
    min-width: 0;
    display: grid;
    gap: 2px;
}

.permission-row strong,
.permission-row small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.permission-row small {
    color: var(--muted);
}

.modal-root {
    position: fixed;
    inset: 0;
    z-index: 40;
    display: none;
}

.modal-root.open {
    display: block;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .42);
}

.modal {
    position: absolute;
    top: 5vh;
    right: 5vw;
    width: min(860px, 90vw);
    max-height: 90vh;
    display: grid;
    grid-template-rows: auto 1fr;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.modal.modal-wide {
    width: min(1120px, 94vw);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 20px;
    border-bottom: 1px solid var(--line);
    background: var(--surface-soft);
}

.record-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    align-items: start;
    padding: 20px;
    overflow-y: auto;
}

.record-form label {
    min-width: 0;
    align-content: start;
}

.searchable-select {
    position: relative;
    display: grid;
    gap: 6px;
}

.searchable-select-input {
    position: relative;
    display: block;
}

.searchable-select-input i,
.searchable-select-input svg {
    position: absolute;
    top: 50%;
    left: 12px;
    width: 17px;
    height: 17px;
    color: var(--muted);
    pointer-events: none;
    transform: translateY(-50%);
}

.searchable-select-input input {
    padding-left: 38px;
}

.searchable-select-menu {
    position: fixed;
    z-index: 120;
    top: var(--searchable-menu-top, 0);
    left: var(--searchable-menu-left, 0);
    width: var(--searchable-menu-width, 320px);
    max-height: var(--searchable-menu-max-height, min(360px, calc(100vh - 24px)));
    overflow: auto;
    padding: 6px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.searchable-select-option,
.searchable-select-empty {
    width: 100%;
    min-height: 36px;
    padding: 8px 10px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--text);
    font-weight: 700;
    text-align: left;
}

.searchable-select-option:hover,
.searchable-select-option.active {
    background: var(--surface-soft);
    color: var(--primary);
}

.searchable-select-empty {
    color: var(--muted);
    font-weight: 700;
    cursor: default;
}

.record-form.approval-form {
    grid-template-columns: 1fr;
}

.record-form.approval-form .approval-shell,
.record-form.approval-form .form-footer {
    grid-column: 1 / -1;
}

.record-form label.wide,
.record-form .user-access-field,
.record-form .person-extra,
.record-form .form-footer {
    grid-column: 1 / -1;
}

.record-form.person-form {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    align-content: start;
}

.record-form.person-form label[data-field-name="nome"],
.record-form.person-form label[data-field-name="documento"],
.record-form.person-form label[data-field-name="email"],
.record-form.person-form label[data-field-name="fone"] {
    grid-column: span 2;
}

.record-form.person-form label[data-field-name="obs"] {
    grid-column: 1 / -1;
}

.lookup-input-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
}

.lookup-input-row input {
    min-width: 0;
}

.cnpj-lookup-btn {
    min-height: 38px;
    white-space: nowrap;
    padding-inline: 12px;
}

.user-access-field {
    display: grid;
    gap: 14px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface-soft);
}

.user-access-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.user-access-header h3,
.access-panel h4 {
    margin: 0;
    font-size: 14px;
}

.user-access-header .search-box {
    width: min(340px, 100%);
}

.user-access-grid {
    display: grid;
    grid-template-columns: minmax(220px, .7fr) minmax(360px, 1.3fr);
    gap: 12px;
}

.group-access-field .user-access-grid {
    grid-template-columns: 1fr;
}

.access-panel {
    min-width: 0;
    display: grid;
    gap: 10px;
}

.access-panel-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.access-panel-title small {
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
}

.access-list {
    max-height: 310px;
    display: grid;
    gap: 8px;
    overflow: auto;
    padding-right: 4px;
}

.access-list.compact {
    max-height: 220px;
}

.group-access-list {
    max-height: 360px;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.access-empty {
    padding: 14px;
    border: 1px dashed var(--line);
    border-radius: var(--radius);
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
    text-align: center;
}

.access-row {
    min-height: 44px;
    display: grid;
    grid-template-columns: 20px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
}

.access-row input {
    width: 18px;
    height: 18px;
}

.access-row span {
    min-width: 0;
    display: grid;
    gap: 2px;
}

.access-row strong,
.access-row small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.access-row small {
    color: var(--muted);
}

.person-extra,
.person-readonly-shell,
.person-readonly-section {
    display: grid;
    gap: 14px;
}

.person-extra {
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface-soft);
}

.person-extra-header,
.person-section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.person-extra-header h3,
.person-section-title h4 {
    margin: 0;
    font-size: 14px;
}

.person-extra-header span,
.person-section-title small {
    color: var(--muted);
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
}

.person-extra-grid {
    display: grid;
    grid-template-columns: minmax(260px, .85fr) minmax(360px, 1.15fr);
    gap: 12px;
    align-items: start;
}

.person-panel {
    min-width: 0;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
}

.person-panel-wide {
    grid-column: 1 / -1;
}

.compact-btn {
    min-height: 32px;
    padding: 0 10px;
    font-size: 12px;
}

.person-section {
    display: grid;
    gap: 10px;
}

.person-group-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 8px;
}

.person-check-row {
    min-height: 42px;
    display: grid;
    grid-template-columns: 18px minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    padding: 9px 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    font-size: 13px;
    font-weight: 800;
}

.person-check-row input {
    width: 17px;
    height: 17px;
    accent-color: var(--primary);
}

.person-check-row span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.person-dynamic-list {
    display: grid;
    gap: 10px;
}

.person-detail-row {
    display: grid;
    gap: 10px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
}

.person-contact-row {
    grid-template-columns: repeat(2, minmax(0, 1fr)) 38px;
}

.person-address-row {
    grid-template-columns: repeat(6, minmax(0, 1fr)) 38px;
}

.person-detail-row label {
    min-width: 0;
}

.person-contact-row label:nth-of-type(1),
.person-contact-row label:nth-of-type(2) {
    grid-column: span 1;
}

.person-contact-row label:nth-of-type(3),
.person-contact-row label:nth-of-type(4) {
    grid-column: span 1;
}

.person-address-row label:nth-of-type(1),
.person-address-row label:nth-of-type(2),
.person-address-row label:nth-of-type(3),
.person-address-row label:nth-of-type(4),
.person-address-row label:nth-of-type(5) {
    grid-column: span 1;
}

.person-address-row label:nth-of-type(6),
.person-address-row label:nth-of-type(7) {
    grid-column: span 2;
}

.person-address-wide {
    grid-column: span 2;
}

.person-detail-row .icon-btn {
    align-self: end;
}

.person-empty {
    padding: 13px;
    border: 1px dashed var(--line);
    border-radius: var(--radius);
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
    text-align: center;
}

.record-form.person-readonly-form {
    grid-template-columns: 1fr;
}

.record-form.person-readonly-form .person-readonly-shell,
.record-form.person-readonly-form .form-footer {
    grid-column: 1 / -1;
}

.person-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 10px;
}

.person-info-card {
    min-width: 0;
    display: grid;
    gap: 5px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface-soft);
}

.person-info-card small {
    color: var(--muted);
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
}

.person-info-card strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 14px;
}

.person-note {
    margin: 0;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface-soft);
    white-space: pre-wrap;
}

.person-readonly-table {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.person-readonly-table table {
    min-width: 760px;
}

.form-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 8px;
}

.form-footer [data-start-person-negotiation] {
    margin-right: auto;
}

.field-hint {
    color: var(--muted);
    font-size: 12px;
}

.password-input {
    display: grid;
    grid-template-columns: minmax(0, 1fr) repeat(3, 42px);
    gap: 8px;
    align-items: center;
}

.password-input input {
    min-width: 0;
}

.password-input .icon-btn {
    width: 42px;
    min-height: 42px;
}

.attachment-upload-field input[type="file"] {
    min-height: auto;
    padding: 10px 12px;
    border-style: dashed;
    background: var(--surface-soft);
}

.attachment-upload-field input[type="file"]::file-selector-button {
    margin-right: 12px;
    border: 0;
    border-radius: var(--radius);
    background: var(--primary);
    color: #fff;
    font-weight: 800;
    padding: 8px 12px;
}

.file-field {
    gap: 8px;
}

.field-file-link {
    width: fit-content;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface-soft);
    color: var(--primary);
    font-size: 13px;
    font-weight: 900;
    text-decoration: none;
}

.field-file-list {
    display: grid;
    gap: 8px;
}

.field-file-link:hover {
    border-color: var(--primary);
    background: rgba(45, 43, 114, .1);
}

.field-file-link svg {
    width: 16px;
    height: 16px;
}

.links-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}

.link-card {
    overflow: hidden;
}

.link-card-main {
    min-height: 132px;
    display: grid;
    grid-template-columns: 46px minmax(0, 1fr) 20px;
    align-items: center;
    gap: 14px;
    padding: 18px;
    color: var(--text);
    text-decoration: none;
}

.link-card-main:hover {
    background: rgba(45, 43, 114, .08);
}

.link-card-main > span:not(.quick-access-icon) {
    min-width: 0;
    display: grid;
    gap: 5px;
}

.link-card-main small {
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
}

.link-card-main strong {
    overflow-wrap: anywhere;
    white-space: normal;
    font-size: 17px;
    line-height: 1.2;
}

.link-card-main em {
    display: -webkit-box;
    overflow: hidden;
    color: var(--muted);
    font-size: 13px;
    font-style: normal;
    line-height: 1.35;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.link-card-main > svg {
    color: var(--muted);
}

.kanban-page {
    display: grid;
    gap: 16px;
}

.kanban-filters {
    display: grid;
    grid-template-columns: repeat(4, minmax(170px, 1fr));
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
}

.kanban-filters label {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
}

.kanban-filter-actions {
    display: flex;
    align-items: end;
    gap: 8px;
}

.kanban-board {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(290px, 340px);
    gap: 14px;
    overflow-x: auto;
    padding-bottom: 10px;
}

.kanban-column {
    min-height: calc(100vh - 310px);
    display: grid;
    grid-template-rows: auto 1fr;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    overflow: hidden;
}

.kanban-column.drop-active {
    border-color: var(--primary);
    box-shadow: inset 0 0 0 1px var(--primary);
}

.kanban-column header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-height: 48px;
    padding: 0 12px;
    border-top: 4px solid var(--stage-color);
    border-bottom: 1px solid var(--line);
    background: var(--surface-soft);
}

.kanban-column header span {
    min-width: 0;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 900;
}

.kanban-column header svg {
    width: 12px;
    height: 12px;
    fill: var(--stage-color);
    color: var(--stage-color);
}

.kanban-column header strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.kanban-column header small {
    min-width: 24px;
    min-height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: var(--surface);
    color: var(--muted);
    font-weight: 900;
}

.kanban-items {
    display: grid;
    align-content: start;
    gap: 10px;
    padding: 10px;
}

.kanban-card {
    position: relative;
    display: grid;
    gap: 10px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface-soft);
    cursor: grab;
}

.kanban-card.dragging {
    opacity: .55;
}

.kanban-card-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding-right: 34px;
}

.kanban-card-title strong {
    color: var(--primary);
}

.kanban-card-title span {
    font-size: 12px;
    font-weight: 900;
}

.kanban-card p {
    margin: 0;
    padding-right: 34px;
    font-weight: 900;
    line-height: 1.3;
}

.kanban-card dl {
    display: grid;
    gap: 6px;
    margin: 0;
}

.kanban-card dl div {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
}

.kanban-card dt,
.kanban-card dd {
    margin: 0;
    font-size: 12px;
}

.kanban-card dt {
    color: var(--muted);
    font-weight: 900;
}

.kanban-card dd {
    overflow: hidden;
    max-width: 62%;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.kanban-card .icon-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 30px;
    height: 30px;
}

.kanban-empty {
    padding: 18px 10px;
    border: 1px dashed var(--line);
    border-radius: var(--radius);
    color: var(--muted);
    text-align: center;
    font-size: 13px;
    font-weight: 900;
}

.negotiation-detail-form {
    display: block;
}

.negotiation-detail {
    display: grid;
    gap: 16px;
}

.negotiation-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.negotiation-toolbar strong {
    display: block;
    margin-top: 4px;
    font-size: 18px;
    line-height: 1.25;
}

.negotiation-toolbar-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.negotiation-steps {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(170px, 1fr);
    overflow-x: auto;
    border-radius: var(--radius);
    background: var(--surface-soft);
}

.negotiation-step {
    position: relative;
    min-height: 46px;
    border: 0;
    border-right: 1px solid color-mix(in srgb, var(--surface) 60%, transparent);
    background: color-mix(in srgb, var(--stage-color) 18%, var(--surface-soft));
    color: var(--text);
    font-weight: 900;
    cursor: pointer;
}

.negotiation-step.is-done,
.negotiation-step.is-current {
    background: var(--stage-color);
    color: #fff;
}

.negotiation-step.is-current {
    box-shadow: inset 0 -4px 0 rgba(255, 255, 255, .45);
}

.negotiation-info-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(150px, 1fr));
    gap: 10px;
}

.negotiation-info-grid > div {
    display: grid;
    gap: 6px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface-soft);
}

.negotiation-info-grid span,
.activity-card span,
.timeline-event span {
    color: var(--muted);
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
}

.negotiation-info-grid strong {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.activity-modal-shell {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.activity-modal-shell[hidden] {
    display: none;
}

.activity-modal-backdrop {
    position: absolute;
    inset: 0;
    border: 0;
    background: color-mix(in srgb, #000 52%, transparent);
}

.activity-modal {
    position: relative;
    z-index: 1;
    width: min(780px, 94vw);
    max-height: min(88vh, 760px);
    overflow: auto;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-lg);
}

.activity-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(190px, 1fr));
    gap: 12px;
    margin-top: 12px;
}

.activity-form-grid label {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
}

.activity-form-grid .wide {
    grid-column: 1 / -1;
}

.negotiation-workspace {
    display: grid;
    grid-template-columns: minmax(280px, .85fr) minmax(420px, 1.6fr);
    gap: 16px;
}

.negotiation-timeline-panel,
.negotiation-main-panel,
.negotiation-list-panel {
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
}

.negotiation-timeline-panel,
.negotiation-main-panel {
    padding: 14px;
}

.section-title,
.negotiation-list-panel header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.section-title h3 {
    margin: 2px 0 0;
    font-size: 16px;
}

.section-title > strong,
.negotiation-list-panel header strong {
    min-width: 28px;
    min-height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: var(--surface-soft);
    color: var(--muted);
    font-size: 12px;
}

.timeline-list {
    position: relative;
    display: grid;
    gap: 12px;
    margin-top: 14px;
}

.timeline-list::before {
    content: "";
    position: absolute;
    top: 10px;
    bottom: 10px;
    left: 15px;
    width: 2px;
    background: var(--line);
}

.timeline-event {
    position: relative;
    display: grid;
    grid-template-columns: 32px 1fr;
    gap: 10px;
}

.timeline-dot {
    z-index: 1;
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: var(--event-color);
    color: #fff;
}

.timeline-dot svg {
    width: 15px;
    height: 15px;
}

.timeline-event > div:last-child {
    min-width: 0;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface-soft);
}

.timeline-event strong {
    display: block;
    margin-top: 3px;
}

.timeline-event p {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.4;
    white-space: pre-line;
}

.activity-agenda {
    display: grid;
    grid-template-columns: minmax(240px, 320px) 1fr;
    gap: 14px;
    margin-top: 14px;
}

.mini-calendar {
    align-self: start;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--surface-soft);
}

.mini-calendar header {
    padding: 11px;
    border-bottom: 1px solid var(--line);
    font-weight: 900;
    text-transform: capitalize;
}

.mini-calendar-weekdays,
.mini-calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
}

.mini-calendar-weekdays span {
    padding: 8px 4px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 900;
    text-align: center;
}

.mini-calendar-grid span {
    position: relative;
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-top: 1px solid var(--line);
    border-right: 1px solid var(--line);
    font-size: 12px;
}

.mini-calendar-grid .mini-day {
    position: relative;
    min-height: 38px;
    border: 0;
    border-top: 1px solid var(--line);
    border-right: 1px solid var(--line);
    background: transparent;
    color: inherit;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.mini-calendar-grid .mini-day:hover {
    background: color-mix(in srgb, var(--primary) 12%, transparent);
}

.mini-calendar-grid span:nth-child(7n) {
    border-right: 0;
}

.mini-calendar-grid .mini-day:nth-child(7n) {
    border-right: 0;
}

.mini-calendar-grid .has-activity {
    background: color-mix(in srgb, var(--primary) 16%, transparent);
    color: var(--primary);
    font-weight: 900;
}

.mini-calendar-grid em {
    position: absolute;
    right: 4px;
    bottom: 4px;
    min-width: 15px;
    height: 15px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: var(--primary);
    color: #fff;
    font-size: 10px;
    font-style: normal;
}

.activity-list {
    display: grid;
    gap: 10px;
}

.activity-card {
    position: relative;
    display: grid;
    gap: 10px;
    padding: 12px;
    padding-right: 50px;
    border: 1px solid var(--line);
    border-left: 4px solid var(--activity-color);
    border-radius: var(--radius);
    background: var(--surface-soft);
}

.activity-card > .icon-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 30px;
    height: 30px;
}

.activity-card strong {
    display: block;
    margin-top: 3px;
}

.activity-card dl {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin: 0;
}

.activity-card dt,
.activity-card dd {
    margin: 0;
    font-size: 12px;
}

.activity-card dt {
    color: var(--muted);
    font-weight: 900;
}

.activity-card p {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.4;
}

.negotiation-extra-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-top: 16px;
}

.negotiation-list-panel {
    overflow: hidden;
}

.negotiation-list-panel header {
    min-height: 44px;
    padding: 0 12px;
    border-bottom: 1px solid var(--line);
    background: var(--surface-soft);
}

.negotiation-list-panel header span {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 900;
}

.negotiation-list-panel header svg {
    width: 15px;
    height: 15px;
    color: var(--primary);
}

.negotiation-list-panel > div {
    display: grid;
    gap: 8px;
    max-height: 190px;
    overflow: auto;
    padding: 10px;
}

.negotiation-action-panel {
    display: grid;
    gap: 10px;
    padding: 10px;
    border-bottom: 1px solid var(--line);
    background: var(--surface);
}

.negotiation-action-panel label {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
}

.negotiation-action-panel textarea {
    min-height: 82px;
}

.negotiation-action-panel input[type="file"] {
    min-height: auto;
    padding: 10px 12px;
    border-style: dashed;
    background: var(--surface-soft);
}

.negotiation-action-panel .primary-btn {
    width: fit-content;
    justify-self: end;
}

.negotiation-list-panel article {
    display: grid;
    gap: 4px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface-soft);
}

.negotiation-list-panel article span {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.35;
}

.negotiation-list-panel article a {
    display: grid;
    gap: 4px;
    color: inherit;
    text-decoration: none;
}

.negotiation-list-panel article a:hover strong {
    color: var(--primary);
}

.embed-page {
    display: grid;
    gap: 16px;
}

.agenda-page {
    display: grid;
    gap: 14px;
}

.agenda-toolbar {
    display: flex;
    justify-content: flex-end;
}

.agenda-filters {
    display: grid;
    grid-template-columns: repeat(6, minmax(130px, 1fr));
    gap: 10px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
}

.agenda-filters label {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
}

.agenda-search {
    align-self: end;
}

.agenda-filter-actions {
    display: flex;
    align-items: end;
    gap: 8px;
}

.agenda-summary {
    display: grid;
    grid-template-columns: repeat(2, minmax(180px, 1fr));
    gap: 10px;
}

.agenda-summary > div {
    display: grid;
    gap: 6px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface-soft);
}

.agenda-summary small {
    color: var(--muted);
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
}

.agenda-calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.agenda-calendar-header > strong {
    text-transform: capitalize;
    font-size: 18px;
}

.agenda-calendar-nav {
    display: flex;
    align-items: center;
    gap: 8px;
}

.agenda-calendar-wrap {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    overflow: auto;
}

.agenda-calendar-empty {
    border-bottom: 1px solid var(--line);
    border-radius: 0;
}

.agenda-calendar-grid {
    min-width: 940px;
    display: grid;
    grid-template-columns: repeat(7, minmax(120px, 1fr));
    gap: 0;
}

.agenda-weekday {
    min-height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid var(--line);
    border-right: 1px solid var(--line);
    background: var(--surface-soft);
    color: var(--muted);
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
}

.agenda-weekday:nth-child(7n) {
    border-right: 0;
}

.agenda-calendar-day {
    min-height: 138px;
    padding: 6px;
    border-bottom: 1px solid var(--line);
    border-right: 1px solid var(--line);
    display: grid;
    grid-template-rows: 20px 1fr;
    gap: 4px;
    background: var(--surface);
}

.agenda-calendar-day:nth-child(7n) {
    border-right: 0;
}

.agenda-calendar-day.is-out {
    background: var(--surface-soft);
}

.agenda-calendar-day > header {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-align: right;
    padding-right: 2px;
}

.agenda-calendar-events {
    display: grid;
    gap: 4px;
    align-content: start;
}

.agenda-calendar-event {
    border: 0;
    border-left: 3px solid color-mix(in srgb, var(--agenda-color) 88%, #fff);
    border-radius: 6px;
    background: color-mix(in srgb, var(--agenda-color) 82%, #111827);
    color: #fff;
    text-align: left;
    padding: 4px 6px;
    cursor: pointer;
    display: grid;
    gap: 2px;
}

.agenda-calendar-event strong {
    font-size: 11px;
}

.agenda-calendar-event span {
    font-size: 11px;
    font-weight: 800;
    line-height: 1.25;
}

.agenda-calendar-event small {
    font-size: 10px;
    opacity: .95;
}

.agenda-calendar-event:hover {
    filter: brightness(1.06);
}

.agenda-more {
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    padding: 2px 4px;
}

.agenda-day-list {
    display: grid;
    gap: 14px;
}

.agenda-day {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    overflow: hidden;
}

.agenda-day > header {
    min-height: 46px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 0 12px;
    border-bottom: 1px solid var(--line);
    background: var(--surface-soft);
}

.agenda-day > header small {
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
}

.agenda-cards {
    display: grid;
    gap: 10px;
    padding: 10px;
}

.agenda-card {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    border: 1px solid var(--line);
    border-left: 4px solid var(--agenda-color);
    border-radius: var(--radius);
    background: var(--surface-soft);
    padding: 10px;
}

.agenda-card-main {
    min-width: 0;
    display: grid;
    gap: 8px;
}

.agenda-card-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.agenda-card-title span {
    min-width: 0;
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
}

.agenda-card p {
    margin: 0;
    font-weight: 900;
    line-height: 1.35;
}

.agenda-card dl {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin: 0;
}

.agenda-card dt,
.agenda-card dd {
    margin: 0;
    font-size: 12px;
}

.agenda-card dt {
    color: var(--muted);
    font-weight: 900;
}

.agenda-card dd {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.agenda-card small {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.35;
}

.agenda-card-actions {
    display: grid;
    align-content: start;
}

.embed-frame-wrap {
    min-height: calc(100vh - 230px);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.embed-frame-wrap iframe {
    display: block;
    width: 100%;
    height: max(720px, calc(100vh - 230px));
    border: 0;
    background: var(--surface);
}

.empty-state {
    padding: 28px;
    color: var(--muted);
    font-weight: 800;
}

.toast {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 80;
    display: none;
    max-width: 360px;
    padding: 13px 15px;
    border-radius: var(--radius);
    background: var(--text);
    color: var(--surface);
    box-shadow: var(--shadow);
    font-weight: 800;
}

.toast.show {
    display: block;
}

@media (max-width: 1180px) {
    .kpi-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .document-insights-kpis {
        grid-template-columns: repeat(3, minmax(140px, 1fr));
    }

    .document-insights-grid,
    .document-insights-lists {
        grid-template-columns: 1fr;
    }

    .dashboard-panels {
        grid-template-columns: 1fr;
    }

    .dashboard-hero {
        grid-template-columns: 1fr;
        align-items: start;
    }

}

@media (max-width: 860px) {
    .document-insights-filters {
        grid-template-columns: 1fr;
    }

    .document-insights-filter-actions {
        align-items: stretch;
        flex-wrap: wrap;
    }

    .insight-bar-row {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 48px;
    }

    .kanban-filters {
        grid-template-columns: 1fr;
    }

    .kanban-filter-actions {
        align-items: stretch;
        flex-wrap: wrap;
    }

    .kanban-board {
        grid-auto-columns: minmax(260px, 86vw);
    }

    .agenda-filters,
    .agenda-summary,
    .agenda-card dl {
        grid-template-columns: 1fr;
    }

    .agenda-filter-actions {
        align-items: stretch;
        flex-wrap: wrap;
    }

    .agenda-calendar-header {
        align-items: stretch;
        flex-direction: column;
    }

    .negotiation-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .negotiation-toolbar-actions {
        justify-content: flex-start;
    }

    .negotiation-info-grid,
    .activity-form-grid,
    .negotiation-workspace,
    .activity-agenda,
    .negotiation-extra-grid {
        grid-template-columns: 1fr;
    }

    .login-page {
        grid-template-columns: 1fr;
    }

    .login-visual {
        min-height: auto;
        grid-template-columns: 1fr;
        gap: 24px;
        padding: 32px;
        align-items: center;
    }

    .login-visual h1 {
        font-size: 40px;
    }

    .login-logo {
        width: 190px;
        margin-bottom: 24px;
    }

    .login-art {
        justify-self: start;
        width: min(440px, 100%);
    }

    .bi-card {
        transform: none;
    }

    .bi-main {
        grid-template-columns: 1fr;
    }

    .bi-list {
        min-height: 150px;
    }

    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: fixed;
        z-index: 30;
        transform: translateX(-100%);
        transition: transform .2s ease;
        width: 282px;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .mobile-nav {
        display: inline-flex;
    }

    .topbar {
        padding: 12px 16px;
    }

    .content {
        padding: 18px 16px 30px;
    }

    .dashboard-hero,
    .quick-dashboard-section {
        padding: 18px;
    }

    .dashboard-hero h2 {
        font-size: 26px;
    }

    .tab-strip {
        padding: 8px 16px 0;
    }

    .tab-button {
        min-width: 128px;
    }

    .kpi-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .document-insights-kpis {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .module-header {
        align-items: stretch;
        flex-direction: column;
    }

    .module-actions {
        flex-wrap: wrap;
    }

    .module-list-footer {
        align-items: stretch;
        flex-direction: column;
    }

    .module-pagination {
        flex-wrap: wrap;
    }

    .list-filters,
    .list-filter {
        width: 100%;
    }

    .search-box {
        width: 100%;
    }

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

    .record-form {
        grid-template-columns: 1fr;
    }

    .record-form.person-form,
    .person-extra-grid {
        grid-template-columns: 1fr;
    }

    .record-form.person-form label[data-field-name],
    .person-panel-wide {
        grid-column: auto;
    }

    .lookup-input-row {
        grid-template-columns: 1fr;
    }

    .user-access-grid {
        grid-template-columns: 1fr;
    }

    .approval-quote-title,
    .approval-quote-group-head {
        align-items: flex-start;
        flex-direction: column;
        gap: 4px;
    }

    .approval-quote-row {
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: start;
    }

    .approval-quote-row > strong {
        grid-column: 1 / -1;
    }

    .approval-quote-row-head {
        display: none;
    }

    .approval-quote-row > span:nth-child(2)::before {
        content: "Qtd: ";
        color: var(--muted);
        font-weight: 900;
    }

    .approval-quote-row > span:nth-child(3)::before {
        content: "Preco: ";
        color: var(--muted);
        font-weight: 900;
    }

    .approval-quote-tags {
        grid-column: 1 / -1;
    }

    .person-contact-row,
    .person-address-row {
        grid-template-columns: 1fr;
    }

    .person-address-wide {
        grid-column: auto;
    }
}

@media (max-width: 540px) {
    .login-visual {
        display: grid;
        padding: 28px 20px;
    }

    .login-visual h1 {
        font-size: 32px;
    }

    .login-visual p {
        font-size: 15px;
    }

    .login-theme-toggle {
        top: 14px;
        right: 14px;
    }

    .bi-card {
        padding: 14px;
    }

    .bi-grid {
        grid-template-columns: 1fr;
    }

    .bi-chart {
        min-height: 180px;
    }

    .bi-list {
        display: none;
    }

    .kpi-grid {
        grid-template-columns: 1fr;
    }

    .document-insights-kpis {
        grid-template-columns: 1fr;
    }

    .dashboard-section-header {
        flex-direction: column;
    }

    .quick-access-grid {
        grid-template-columns: 1fr;
    }

    .topbar-actions .user-chip {
        display: none;
    }

    .modal {
        inset: auto 10px 10px;
        top: 10px;
        width: auto;
        max-height: calc(100vh - 20px);
    }
}
