* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: #f7f4ed;
    color: #22332d;
    font-family: "Segoe UI", Arial, sans-serif;
}

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

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

button,
.primary-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0 18px;
    border: 0;
    border-radius: 8px;
    background: #416743;
    color: #fff;
    font-weight: 750;
    cursor: pointer;
}

button.secondary,
.secondary-link,
.secondary {
    border: 1px solid #ded8c9;
    background: #fffdf9;
    color: #416743;
}

button.danger,
.danger {
    background: #b43d35;
    color: #fff;
}

.small {
    min-height: 34px;
    padding: 0 12px;
    font-size: 0.85rem;
}

.full {
    width: 100%;
}

.crm-shell {
    display: grid;
    grid-template-columns: 292px minmax(0, 1fr);
    min-height: 100vh;
}

.crm-sidebar {
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow-y: auto;
    padding: 36px 28px 30px;
    border-right: 1px solid #e0d8ca;
    background: linear-gradient(180deg, rgba(255, 253, 249, 0.98), rgba(250, 248, 243, 0.96));
    box-shadow: 14px 0 42px rgba(56, 70, 54, 0.05);
}

.crm-brand {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-bottom: 42px;
}

.crm-brand-mark {
    display: grid;
    grid-template-columns: repeat(3, 10px);
    gap: 4px;
    place-content: center;
    width: 62px;
    height: 62px;
    border-radius: 18px;
    background: linear-gradient(135deg, #416743, #86a46f);
    box-shadow: 0 20px 36px rgba(65, 103, 67, 0.2);
}

.crm-brand-mark span {
    width: 10px;
    height: 10px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.86);
}

.crm-brand strong {
    font-size: 1.45rem;
}

.crm-nav {
    display: grid;
    gap: 12px;
}

.crm-nav a,
.settings-link {
    display: flex;
    align-items: center;
    min-height: 54px;
    padding: 0 18px;
    border-radius: 10px;
    color: #49604b;
    font-size: 1.03rem;
    font-weight: 650;
}

.crm-nav a:hover,
.settings-link:hover,
.crm-nav a.active,
.settings-link.active {
    background: rgba(84, 122, 85, 0.1);
    color: #416743;
}

.crm-nav-divider {
    height: 1px;
    margin: 12px 18px;
    background: #ded8c9;
}

.crm-sidebar-footer {
    display: grid;
    gap: 18px;
    margin-top: auto;
}

.crm-user-card {
    display: grid;
    gap: 9px;
    padding: 18px;
    border: 1px solid #e0d8ca;
    border-radius: 12px;
    background: rgba(255, 253, 249, 0.84);
}

.crm-user-card span,
.muted {
    color: #7a8277;
}

.language-switcher {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    padding: 6px;
    border: 1px solid #e0d8ca;
    border-radius: 12px;
    background: rgba(255, 253, 249, 0.84);
}

.language-switcher button {
    min-height: 40px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #416743;
}

.language-switcher button.active {
    background: #416743;
    color: #fff;
}

.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    border: 1px solid #e0d8ca;
    background: rgba(255, 253, 249, 0.84);
    color: #416743;
}

.theme-switch {
    position: relative;
    width: 46px;
    height: 26px;
    border-radius: 999px;
    background: #dfe8d6;
}

.theme-switch span {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    transition: transform 150ms ease;
}

body.theme-dark .theme-switch span {
    transform: translateX(20px);
}

.crm-main {
    min-width: 0;
    padding: 30px 36px 48px;
}

.activity-reminder {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 50;
    width: min(390px, calc(100vw - 32px));
    padding: 18px;
    border: 1px solid #d8d0c0;
    border-radius: 12px;
    background: #fffdf9;
    box-shadow: 0 24px 70px rgba(56, 70, 54, 0.18);
}

.activity-reminder-header {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    margin-bottom: 8px;
}

body.theme-dark {
    background: #141b17;
    color: #edf3e8;
}

body.theme-dark .crm-sidebar,
body.theme-dark .panel,
body.theme-dark .company-card,
body.theme-dark .kpi-grid article,
body.theme-dark .crm-user-card,
body.theme-dark .language-switcher,
body.theme-dark .theme-toggle,
body.theme-dark .activity-reminder,
body.theme-dark .lead-card,
body.theme-dark .pipeline-column,
body.theme-dark .package-option,
body.theme-dark .finance-package-card,
body.theme-dark .calendar-day,
body.theme-dark .compact-edit-form {
    border-color: #334235;
    background: #1d271f;
    color: #edf3e8;
}

body.theme-dark input,
body.theme-dark select,
body.theme-dark textarea {
    border-color: #334235;
    background: #141b17;
    color: #edf3e8;
}

body.theme-dark .muted,
body.theme-dark .page-header p,
body.theme-dark .lead-card span,
body.theme-dark .list-row span,
body.theme-dark .crm-user-card span {
    color: #aab9a5;
}

body.theme-dark .calendar-day-items a,
body.theme-dark .calendar-day-items span,
body.theme-dark .bar-meter {
    background: #263626;
}

body.theme-dark .bar-row span {
    color: #aab9a5;
}

body.theme-dark .crm-toast {
    border-color: #334235;
    background: #1d271f;
    color: #edf3e8;
}

.page {
    display: grid;
    gap: 22px;
    min-width: 0;
}

.page.narrow {
    max-width: 980px;
}

.page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
}

.page-header > * {
    min-width: 0;
}

.page-header h1 {
    margin: 0;
    font-size: 2.1rem;
    letter-spacing: 0;
}

.page-header p {
    margin: 7px 0 0;
    color: #707b6e;
}

.eyebrow {
    margin: 0 0 8px !important;
    color: #416743 !important;
    font-size: 0.78rem;
    font-weight: 850;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

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

.flash,
.error-box {
    margin-bottom: 18px;
    padding: 14px 16px;
    border-radius: 10px;
}

.flash {
    border: 1px solid #c8ddc5;
    background: #edf7ea;
}

.error-box {
    border: 1px solid #f0c4c0;
    background: #fff0ed;
    color: #7d2823;
}

.panel,
.company-card,
.kpi-grid article {
    border: 1px solid #e0d8ca;
    border-radius: 10px;
    background: rgba(255, 253, 249, 0.86);
    box-shadow: 0 18px 42px rgba(56, 70, 54, 0.06);
}

.panel {
    min-width: 0;
    padding: 22px;
}

.panel h2 {
    margin: 0 0 18px;
    font-size: 1.1rem;
}

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

.panel-header h2 {
    margin: 0;
}

.panel-header a {
    color: #416743;
    font-weight: 750;
}

.panel-subtitle {
    margin: 5px 0 0;
    color: #747d71;
    font-size: 0.92rem;
}

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

.kpi-grid article {
    display: grid;
    gap: 8px;
    min-height: 112px;
    padding: 20px;
}

.kpi-grid span {
    color: #747d71;
    font-weight: 700;
}

.kpi-grid strong {
    font-size: 1.55rem;
}

.dashboard-grid,
.detail-grid,
.tabs-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.dashboard-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 18px;
    align-items: start;
}

.dashboard-main {
    display: grid;
    gap: 18px;
    min-width: 0;
}

.dashboard-secondary-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.dashboard-side {
    position: sticky;
    top: 24px;
    display: grid;
    gap: 18px;
    min-width: 0;
}

.dashboard-grid .wide {
    grid-column: 1 / -1;
}

.dashboard-toolbar {
    grid-template-columns: minmax(220px, 320px) auto auto;
    justify-content: start;
}

.team-grid,
.automation-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 12px;
}

.team-card,
.automation-card {
    display: grid;
    gap: 10px;
    padding: 14px;
    border: 1px solid #e6dfd2;
    border-radius: 8px;
    background: #fffdf9;
    color: inherit;
    text-decoration: none;
}

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

.team-card dt {
    color: #747d71;
    font-size: 0.72rem;
    font-weight: 850;
    text-transform: uppercase;
}

.team-card dd {
    margin: 2px 0 0;
    font-weight: 850;
}

.dashboard-side-card {
    display: grid;
    gap: 14px;
    min-width: 0;
}

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

.side-card-header h2 {
    margin: 0;
}

.side-card-header span {
    display: grid;
    min-width: 28px;
    height: 28px;
    place-items: center;
    border: 1px solid #c8ddc5;
    border-radius: 999px;
    background: #e5eedf;
    color: #315333;
    font-size: 0.86rem;
    font-weight: 850;
}

.side-list {
    display: grid;
    gap: 0;
}

.side-row {
    display: grid;
    grid-template-columns: 30px minmax(0, 1fr);
    gap: 10px;
    align-items: start;
    padding: 12px 0;
    border-bottom: 1px solid #eee7da;
}

.side-row:last-child {
    border-bottom: 0;
}

.side-row a {
    display: grid;
    gap: 4px;
    min-width: 0;
    color: inherit;
    text-decoration: none;
}

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

.side-row span {
    color: #61705f;
    font-size: 0.86rem;
}

.side-status-button {
    width: 26px;
    min-height: 26px;
    padding: 0;
    border: 1px solid #c8ddc5;
    border-radius: 8px;
    background: #edf7ea;
}

.side-status-button.is-done {
    background: #86a46f;
}

.side-status-button.is-done::after {
    content: "✓";
    color: #fff;
    font-weight: 850;
}

.side-card-link {
    display: flex;
    justify-content: space-between;
    padding-top: 6px;
    border-top: 1px solid #eee7da;
    color: #315333;
    font-weight: 850;
    text-decoration: none;
}

.pipeline-board {
    display: grid;
    width: 100%;
    min-width: 0;
    grid-template-columns: repeat(7, minmax(190px, 1fr));
    gap: 14px;
    overflow-x: auto;
}

.pipeline-column {
    display: grid;
    align-content: start;
    gap: 10px;
    min-height: 240px;
    padding: 14px;
    border: 1px solid #e6dfd2;
    border-radius: 10px;
    background: #faf8f3;
    transition: border-color 150ms ease, background 150ms ease, box-shadow 150ms ease;
}

.pipeline-column.is-drop-target {
    border-color: rgba(65, 103, 67, 0.6);
    background: #f0f5ec;
    box-shadow: inset 0 0 0 2px rgba(65, 103, 67, 0.12);
}

.pipeline-title {
    display: flex;
    justify-content: space-between;
    color: #416743;
}

.pipeline-card-stack {
    display: grid;
    gap: 10px;
}

.pipeline-column:not(.is-expanded) .lead-card.is-extra {
    display: none;
}

.pipeline-column.is-expanded .pipeline-card-stack {
    max-height: 460px;
    overflow-y: auto;
    padding-right: 4px;
}

.show-all-stage {
    min-height: 38px;
    border: 1px solid #d8d0c0;
    border-radius: 8px;
    background: #fffdf9;
    color: #416743;
    font-weight: 850;
}

.lead-card,
.list-row {
    display: grid;
    gap: 5px;
    padding: 13px 0;
    border-top: 1px solid #eee7da;
}

.lead-card {
    padding: 12px;
    border: 1px solid #e6dfd2;
    border-radius: 8px;
    background: #fffdf9;
    cursor: grab;
    user-select: none;
    touch-action: pan-y;
}

.lead-card-link {
    display: grid;
    gap: 5px;
    color: inherit;
    text-decoration: none;
}

.lead-card:active {
    cursor: grabbing;
}

.lead-card small {
    color: #747d71;
    font-weight: 700;
}

.pipeline-deal-quick {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #eee7da;
    cursor: default;
}

.pipeline-deal-quick summary {
    color: #416743;
    font-size: 0.84rem;
    font-weight: 850;
    cursor: pointer;
}

.pipeline-deal-quick form {
    display: grid;
    gap: 7px;
    margin-top: 8px;
}

.pipeline-deal-quick input,
.pipeline-deal-quick button {
    min-height: 36px;
    padding: 8px 9px;
    border-radius: 8px;
    font-size: 0.86rem;
}

.lead-card.is-dragging {
    opacity: 0.55;
    box-shadow: 0 22px 48px rgba(56, 70, 54, 0.18);
}

.lead-card.is-won {
    animation: wonPulse 900ms ease both;
    border-color: rgba(65, 103, 67, 0.82);
}

.pipeline-status {
    min-height: 20px;
    margin: 12px 0 0;
    color: #416743;
    font-size: 0.9rem;
    font-weight: 800;
}

.crm-toast {
    position: fixed;
    right: 24px;
    top: 24px;
    z-index: 80;
    max-width: min(360px, calc(100vw - 32px));
    padding: 14px 18px;
    border: 1px solid #d8d0c0;
    border-radius: 10px;
    background: #fffdf9;
    color: #22332d;
    box-shadow: 0 18px 54px rgba(56, 70, 54, 0.18);
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 180ms ease, transform 180ms ease;
}

.crm-toast.show {
    opacity: 1;
    transform: translateY(0);
}

.crm-toast.won {
    border-color: rgba(65, 103, 67, 0.55);
    background: #eef6e9;
    color: #315333;
}

.won-overlay {
    position: fixed;
    inset: 0;
    z-index: 90;
    display: grid;
    place-items: center;
    overflow: hidden;
    background: rgba(34, 51, 45, 0.18);
    opacity: 0;
    pointer-events: none;
    transition: opacity 180ms ease;
}

.won-overlay.show {
    opacity: 1;
}

.won-overlay div {
    display: grid;
    gap: 8px;
    max-width: min(520px, calc(100vw - 36px));
    padding: 28px 34px;
    border: 1px solid rgba(65, 103, 67, 0.28);
    border-radius: 12px;
    background: #fffdf9;
    box-shadow: 0 28px 90px rgba(34, 51, 45, 0.22);
    text-align: center;
}

.won-overlay strong {
    color: #315333;
    font-size: 1.45rem;
}

.won-overlay span {
    color: #61705f;
    font-weight: 800;
}

.won-overlay i {
    position: absolute;
    top: -20px;
    width: 9px;
    height: 18px;
    border-radius: 3px;
    animation: wonParticle 1200ms ease-in forwards;
}

@keyframes wonParticle {
    to {
        transform: translateY(105vh) rotate(260deg);
        opacity: 0;
    }
}

@keyframes wonPulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 rgba(65, 103, 67, 0);
    }
    35% {
        transform: scale(1.035);
        box-shadow: 0 0 0 8px rgba(65, 103, 67, 0.12);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 rgba(65, 103, 67, 0);
    }
}

.lead-card-placeholder {
    border: 1px dashed rgba(65, 103, 67, 0.42);
    border-radius: 8px;
    background: rgba(65, 103, 67, 0.06);
}

.lead-card span,
.list-row span {
    color: #737c71;
    font-size: 0.9rem;
}

.list-stack {
    display: grid;
}

.with-action,
.calendar-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.activity-list-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 20px;
    padding: 18px 0;
}

.activity-list-content {
    display: grid;
    min-width: 0;
    gap: 10px;
    color: inherit;
    text-decoration: none;
}

.activity-list-heading {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 9px;
}

.activity-list-heading strong {
    font-size: 1.02rem;
}

.activity-type-chip,
.status-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    padding: 5px 10px;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 850;
    line-height: 1;
}

.activity-type-chip {
    background: #edf4e8;
    color: #416743;
}

.status-pill {
    border: 1px solid #ded8c9;
    background: #fffdf9;
    color: #416743;
}

.activity-list-content p {
    max-width: 980px;
    margin: 0;
    color: #596657;
    line-height: 1.45;
}

.activity-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 22px;
    margin: 0;
}

.activity-meta div {
    display: flex;
    gap: 6px;
    min-width: 160px;
}

.activity-meta dt {
    color: #747d71;
    font-weight: 850;
}

.activity-meta dd {
    margin: 0;
}

.activity-list-actions {
    display: grid;
    justify-items: end;
    gap: 8px;
}

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

.editable-row {
    align-items: flex-start;
}

.inline-edit {
    margin-top: 8px;
}

.inline-edit summary {
    width: fit-content;
    color: #416743;
    font-weight: 800;
    cursor: pointer;
}

.compact-edit-form {
    margin-top: 10px;
    padding: 12px;
    border: 1px solid #e6dfd2;
    border-radius: 10px;
    background: #faf8f3;
}

.calendar-row {
    justify-content: flex-start;
}

.calendar-row time {
    flex: 0 0 150px;
    color: #416743;
    font-weight: 800;
}

.calendar-shell {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(320px, 0.7fr);
    gap: 18px;
}

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

.calendar-weekdays span {
    padding: 0 8px 10px;
    color: #747d71;
    font-size: 0.78rem;
    font-weight: 850;
    text-transform: uppercase;
}

.calendar-month-grid {
    gap: 8px;
}

.calendar-day {
    display: grid;
    align-content: start;
    gap: 8px;
    min-height: 128px;
    padding: 10px;
    border: 1px solid #e6dfd2;
    border-radius: 10px;
    background: #fffdf9;
}

.calendar-day.is-muted {
    opacity: 0.55;
}

.calendar-day.is-today {
    border-color: rgba(65, 103, 67, 0.62);
    box-shadow: inset 0 0 0 2px rgba(65, 103, 67, 0.12);
}

.calendar-day-items {
    display: grid;
    gap: 5px;
}

.calendar-day-items a,
.calendar-day-items span {
    overflow: hidden;
    padding: 5px 7px;
    border-radius: 7px;
    background: #e5eedf;
    color: #416743;
    font-size: 0.78rem;
    font-weight: 750;
    text-overflow: ellipsis;
    white-space: nowrap;
}

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

.bar-row {
    display: grid;
    grid-template-columns: minmax(160px, 1fr) minmax(140px, 1.2fr) auto;
    gap: 14px;
    align-items: center;
}

.bar-row div:first-child {
    display: grid;
    gap: 3px;
}

.bar-row span {
    color: #6d766a;
    font-size: 0.86rem;
}

.linked-bar-row {
    color: inherit;
    text-decoration: none;
}

.bar-meter {
    overflow: hidden;
    height: 10px;
    border-radius: 999px;
    background: #ece5d7;
}

.bar-meter span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: #416743;
}

.bar-meter.pipeline span {
    background: #a06032;
}

.bar-meter.invoice span {
    background: #d4a63f;
}

.toolbar,
.mini-form,
.user-row {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 12px;
    align-items: center;
}

.toolbar input,
.toolbar select,
.mini-form input,
.mini-form select,
.mini-form textarea,
.user-row input,
.user-row select,
.form-grid input,
.form-grid select,
.form-grid textarea,
.finance-form input,
.finance-form select,
.finance-form textarea,
.form-stack input {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid #ded8c9;
    border-radius: 8px;
    background: #fffdf9;
    color: #22332d;
}

textarea {
    min-height: 96px;
    resize: vertical;
}

.toolbar input[type="search"] {
    grid-column: span 2;
}

.toolbar .secondary-link {
    min-height: 44px;
    padding: 10px 16px;
    border-radius: 8px;
}

.bulk-owner-panel {
    display: grid;
    grid-template-columns: auto auto minmax(220px, 320px) auto;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
}

.bulk-owner-panel select {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid #ded8c9;
    border-radius: 8px;
    background: #fffdf9;
    color: #22332d;
}

.bulk-select-all,
.company-select-control {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #416743;
    font-weight: 850;
}

.bulk-select-all input,
.company-select-control input {
    width: 18px;
    height: 18px;
    accent-color: #416743;
}

.bulk-owner-summary {
    display: inline-flex;
    align-items: baseline;
    gap: 5px;
    color: #61705f;
    font-weight: 800;
}

.bulk-owner-summary strong {
    color: #22332d;
    font-size: 1.2rem;
}

.company-select-control {
    justify-self: start;
    min-height: 34px;
    padding: 6px 10px;
    border: 1px solid #e2dbcf;
    border-radius: 8px;
    background: #faf8f3;
    font-size: 0.9rem;
}

.company-card:has([data-company-checkbox]:checked) {
    border-color: rgba(65, 103, 67, 0.72);
    box-shadow: 0 16px 36px rgba(56, 70, 54, 0.14);
}

.company-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 18px;
}

[data-company-results] {
    transition: opacity 140ms ease;
}

[data-company-results].is-loading {
    opacity: 0.58;
}

.company-card {
    display: grid;
    gap: 18px;
    padding: 16px;
}

.company-card-main {
    display: grid;
    grid-template-columns: 50px minmax(0, 1fr);
    gap: 13px;
    align-items: center;
}

.company-card h2 {
    margin: 0 0 4px;
    font-size: 1.08rem;
}

.company-card p {
    margin: 0;
    color: #747d71;
}

.avatar {
    display: grid;
    place-items: center;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: #e5eedf;
    color: #416743;
    font-weight: 850;
}

.meta-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 13px;
    margin: 0;
}

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

.meta-grid dt,
.insight-list dt {
    color: #747d71;
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
}

.meta-grid dd,
.insight-list dd {
    margin: 4px 0 0;
    overflow-wrap: anywhere;
}

.badge {
    display: inline-flex;
    padding: 5px 9px;
    border-radius: 999px;
    background: #e5eedf;
    color: #416743;
    font-size: 0.78rem;
    font-weight: 850;
}

.badge.soft {
    background: #f0ecd9;
    color: #6b5c2c;
}

.inline-form select {
    width: 100%;
    min-height: 38px;
    border: 1px solid #ded8c9;
    border-radius: 8px;
    background: #fffdf9;
}

.card-actions {
    display: flex;
    gap: 10px;
}

.card-actions a {
    color: #416743;
    font-weight: 800;
    text-decoration: none;
}

.card-action-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 9px 14px;
    border: 1px solid #d8d0c0;
    border-radius: 8px;
    background: #fffdf9;
    box-shadow: 0 8px 18px rgba(56, 70, 54, 0.08);
    transition: transform 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

.card-action-button.primary {
    border-color: #416743;
    background: #416743;
    color: #fffdf9;
}

.card-action-button:hover {
    box-shadow: 0 12px 22px rgba(56, 70, 54, 0.12);
    transform: translateY(-1px);
}

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

.form-grid label,
.form-stack label {
    display: grid;
    gap: 7px;
}

.form-grid label span,
.form-stack label span {
    color: #61705f;
    font-weight: 750;
}

.span-2 {
    grid-column: 1 / -1;
}

.form-section-title {
    margin: 12px 0 0;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.company-registration-page {
    width: min(1440px, 100%);
    max-width: none;
    margin: 0 auto;
}

.company-registration-hero {
    position: relative;
    z-index: 0;
    display: grid;
    padding-top: 6px;
    margin-bottom: 18px;
}

.company-registration-hero > div {
    display: grid;
    gap: 16px;
}

.company-registration-hero::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    z-index: 0;
    width: 26px;
    height: 78px;
    background: #3867c8;
}

.company-registration-hero h1 {
    position: relative;
    z-index: 1;
    max-width: 1060px;
    margin: 0;
    color: #1d3a68;
    font-size: 3.55rem;
    line-height: 1;
    letter-spacing: 0;
}

.company-registration-hero p {
    position: relative;
    z-index: 1;
    max-width: 820px;
    margin: 0;
    color: #435a7c;
    font-size: 1.05rem;
}

.company-registration-form {
    gap: 18px;
    padding: 34px 30px 28px;
    border-radius: 24px;
    box-shadow: 0 28px 70px rgba(56, 70, 54, 0.1);
}

.company-registration-intro {
    display: grid;
    gap: 10px;
    margin-bottom: 8px;
}

.company-registration-intro h2 {
    margin: 0;
    font-size: 1.6rem;
    letter-spacing: 0;
}

.company-registration-intro p:not(.eyebrow) {
    max-width: 720px;
    margin: 0;
    color: #6f746e;
}

.company-registration-form label {
    gap: 0;
}

.company-registration-form label span {
    position: absolute;
    overflow: hidden;
    width: 1px;
    height: 1px;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.company-registration-form input,
.company-registration-form select,
.company-registration-form textarea {
    min-height: 56px;
    padding: 0 16px;
    border-radius: 14px;
    background: #fffdf9;
}

.company-registration-form textarea {
    min-height: 126px;
    padding-top: 18px;
}

.company-registration-form .form-section-title {
    margin-top: 20px;
    padding-top: 18px;
    border-top: 1px solid #eee7da;
    color: #1d3a68;
}

.company-registration-form .form-actions {
    align-items: center;
    padding-top: 0;
}

.company-registration-form .form-actions button {
    min-height: 52px;
    padding: 0 24px;
}

.mini-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-bottom: 16px;
}

.mini-form button,
.mini-form textarea {
    grid-column: 1 / -1;
}

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

.company-tabs,
.segmented-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.company-tabs {
    margin-bottom: 16px;
    padding: 6px;
    border: 1px solid #e6dfd2;
    border-radius: 10px;
    background: #faf8f3;
}

.company-tabs button,
.segmented-actions button {
    min-height: 38px;
    padding: 8px 13px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: #61705f;
    font-weight: 850;
    cursor: pointer;
}

.company-tabs button.active,
.segmented-actions button.active {
    border-color: #d8d0c0;
    background: #fffdf9;
    color: #315333;
    box-shadow: 0 6px 16px rgba(56, 70, 54, 0.08);
}

.company-show-page {
    gap: 12px;
}

.company-hero {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 22px;
}

.company-hero-main {
    display: grid;
    gap: 10px;
    min-width: 0;
}

.company-back-link {
    color: #49604b;
    font-size: 0.92rem;
    font-weight: 850;
    text-decoration: none;
}

.company-hero h1 {
    margin: 0;
    color: #102320;
    font-size: 2.55rem;
    line-height: 1;
}

.company-hero h1 span {
    color: #c39945;
    font-size: 1.2rem;
    vertical-align: top;
}

.company-pill-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.company-pill-row span {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 36px;
    padding: 8px 18px;
    border-radius: 999px;
    background: #dfead1;
    color: #102320;
    font-weight: 850;
}

.company-pill-row .with-dot::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #37c888;
}

.company-hero-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 12px;
}

.company-hero-actions > .secondary-link {
    min-height: 48px;
    padding: 0 22px;
    border-radius: 8px;
}

.company-action-menu {
    position: relative;
}

.company-action-menu summary,
.company-full-width-details summary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 11px 18px;
    border: 1px solid #ded8c9;
    border-radius: 8px;
    background: #fffdf9;
    color: #22332d;
    font-weight: 850;
    cursor: pointer;
    list-style: none;
}

.company-action-menu summary::-webkit-details-marker,
.company-full-width-details summary::-webkit-details-marker {
    display: none;
}

.company-action-menu.primary-action summary {
    border-color: #416743;
    background: #416743;
    color: #fffdf9;
    box-shadow: 0 18px 40px rgba(65, 103, 67, 0.16);
}

.company-action-menu.icon-only summary {
    width: 48px;
    padding: 0;
    color: #315333;
}

.company-popover-form {
    position: absolute;
    right: 0;
    z-index: 30;
    display: grid;
    width: min(420px, calc(100vw - 38px));
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 8px;
    padding: 14px;
    border: 1px solid #ded8c9;
    border-radius: 10px;
    background: #fffdf9;
    box-shadow: 0 22px 60px rgba(56, 70, 54, 0.16);
}

.company-popover-form.is-static {
    position: static;
    width: 100%;
    margin-top: 12px;
    box-shadow: none;
}

.company-popover-form input,
.company-popover-form select,
.company-popover-form textarea {
    min-height: 40px;
    padding: 9px 10px;
    border: 1px solid #ded8c9;
    border-radius: 8px;
    background: #fffdf9;
}

.company-popover-form textarea,
.company-popover-form button {
    grid-column: 1 / -1;
}

.company-tabs-line {
    gap: 24px;
    margin: 0;
    padding: 0;
    border: 0;
    border-bottom: 1px solid #ded8c9;
    border-radius: 0;
    background: transparent;
}

.company-tabs-line button {
    min-height: 44px;
    padding: 0 0 12px;
    border: 0;
    border-bottom: 3px solid transparent;
    border-radius: 0;
    background: transparent;
}

.company-tabs-line button.active {
    border-bottom-color: #416743;
    background: transparent;
    box-shadow: none;
}

.company-overview-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    gap: 18px;
    align-items: start;
}

.company-overview-main,
.company-overview-side {
    display: grid;
    gap: 18px;
    min-width: 0;
}

.company-overview-side {
    position: sticky;
    top: 24px;
}

.company-info-card h2,
.company-value-card h2,
.company-side-card h2 {
    margin-bottom: 20px;
}

.company-info-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px 42px;
    margin: 0;
}

.company-info-grid div,
.company-metric-list div,
.company-quick-info div {
    display: grid;
    grid-template-columns: minmax(130px, 0.8fr) minmax(0, 1fr);
    gap: 12px;
}

.company-info-grid dt,
.company-metric-list dt,
.company-quick-info dt {
    color: #102320;
    font-weight: 850;
}

.company-info-grid dd,
.company-metric-list dd,
.company-quick-info dd {
    margin: 0;
    overflow-wrap: anywhere;
    color: #102320;
    font-weight: 750;
}

.company-value-columns {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 26px;
}

.company-value-columns > div + div {
    padding-left: 22px;
    border-left: 1px solid #ded8c9;
}

.company-section-title {
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    margin-bottom: 12px;
}

.company-section-title span,
.company-insight-grid article > span {
    display: grid;
    width: 36px;
    height: 36px;
    place-items: center;
    border-radius: 12px;
    background: #dfead1;
    color: #315333;
    font-weight: 850;
}

.company-section-title em {
    padding: 5px 8px;
    border-radius: 999px;
    background: #ece8dd;
    color: #777065;
    font-size: 0.76rem;
    font-style: normal;
    font-weight: 850;
}

.company-metric-list,
.company-quick-info {
    display: grid;
    gap: 10px;
    margin: 0;
}

.company-metric-list .is-divider {
    padding-top: 12px;
    border-top: 1px solid #ded8c9;
}

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

.company-insight-grid article {
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr);
    gap: 12px;
    min-height: 132px;
    padding: 14px;
    border: 1px solid #e6dfd2;
    border-radius: 8px;
    background: #fffdf9;
}

.company-insight-grid strong,
.company-contact-card strong {
    color: #173b68;
}

.company-insight-grid p {
    margin: 6px 0 0;
    color: #6f746e;
    font-size: 0.9rem;
}

.company-history-preview {
    display: grid;
    gap: 12px;
}

.company-history-preview div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px;
    border: 1px solid #e6dfd2;
    border-radius: 8px;
    background: #fffdf9;
}

.company-history-preview span {
    color: #747d71;
    font-size: 0.86rem;
}

.company-side-card {
    display: grid;
    gap: 14px;
}

.company-contact-card {
    display: grid;
    gap: 14px;
    padding: 18px;
    border: 1px solid #e6dfd2;
    border-radius: 10px;
    background: #fffdf9;
}

.company-contact-card span {
    color: #173b68;
}

.company-contact-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.company-contact-actions details,
.company-contact-actions form {
    min-width: 0;
}

.company-contact-actions summary,
.company-full-width-details summary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 48px;
    padding: 11px 18px;
    border: 1px solid #ded8c9;
    border-radius: 8px;
    background: #f8f3ea;
    color: #22332d;
    font-weight: 850;
    cursor: pointer;
    list-style: none;
}

.company-contact-actions summary::-webkit-details-marker {
    display: none;
}

.company-contact-actions form {
    margin: 0;
}

.company-contact-actions .danger {
    width: 100%;
    min-height: 48px;
    border: 1px solid #e2b9b2;
    background: #f2d7d2;
    color: #ad3e34;
}

.company-contact-actions details {
    position: relative;
}

.company-contact-actions .company-popover-form {
    left: 0;
    right: auto;
}

.company-side-card .side-card-header {
    margin-bottom: 0;
}

.finance-form {
    display: grid;
    gap: 20px;
}

.finance-dashboard {
    gap: 18px;
}

.finance-dashboard > * {
    min-width: 0;
}

.finance-hero .header-actions {
    align-items: flex-start;
}

.finance-invoice-action {
    position: relative;
}

.finance-invoice-action summary {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 10px 16px;
    border: 1px solid #ded8c9;
    border-radius: 8px;
    background: #fffdf9;
    color: #22332d;
    font-weight: 850;
    cursor: pointer;
}

.finance-invoice-form {
    position: absolute;
    right: 0;
    z-index: 20;
    display: grid;
    width: min(520px, calc(100vw - 40px));
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 8px;
    padding: 14px;
    border: 1px solid #ded8c9;
    border-radius: 10px;
    background: #fffdf9;
    box-shadow: 0 20px 60px rgba(56, 70, 54, 0.16);
}

.finance-invoice-form select,
.finance-invoice-form input {
    min-height: 40px;
    padding: 9px 10px;
    border: 1px solid #ded8c9;
    border-radius: 8px;
    background: #fffdf9;
}

.finance-invoice-form button {
    grid-column: 1 / -1;
}

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

.finance-kpi-card {
    display: grid;
    gap: 7px;
    min-height: 116px;
    padding: 20px;
    border: 1px solid #e6dfd2;
    border-radius: 10px;
    background: #fffdf9;
    box-shadow: 0 14px 44px rgba(56, 70, 54, 0.06);
}

.finance-kpi-card span,
.finance-kpi-card small {
    color: #61705f;
    font-weight: 750;
}

.finance-kpi-card strong {
    color: #102320;
    font-size: 1.55rem;
}

.finance-main-grid,
.finance-detail-grid {
    display: grid;
    grid-template-columns: 1.7fr 0.8fr 1fr;
    gap: 16px;
}

.finance-detail-grid {
    grid-template-columns: 1.7fr 0.6fr 0.65fr 0.65fr;
}

.finance-card {
    overflow: hidden;
    min-width: 0;
}

.finance-card h2 {
    margin: 0;
}

.finance-period {
    padding: 7px 10px;
    border: 1px solid #ded8c9;
    border-radius: 8px;
    color: #22332d;
    font-size: 0.82rem;
    font-weight: 850;
}

.finance-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
    margin-bottom: 12px;
    color: #61705f;
    font-size: 0.86rem;
    font-weight: 750;
}

.finance-legend span {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.finance-legend i {
    width: 14px;
    height: 10px;
    border-radius: 3px;
}

.finance-legend .solid {
    background: #416743;
}

.finance-legend .dashed {
    border: 1px dashed #416743;
    background: rgba(65, 103, 67, 0.08);
}

.finance-bar-chart {
    display: grid;
    grid-template-columns: repeat(12, minmax(30px, 1fr));
    align-items: end;
    gap: 10px;
    min-height: 220px;
    padding-top: 12px;
    border-top: 1px solid #eee7da;
}

.finance-month-bar {
    display: grid;
    gap: 8px;
    align-items: end;
    min-width: 0;
    height: 210px;
}

.finance-bar-stack {
    position: relative;
    display: flex;
    align-items: end;
    justify-content: center;
    height: 175px;
}

.finance-bar-stack span {
    position: absolute;
    bottom: 0;
    width: 54%;
    border-radius: 4px 4px 0 0;
}

.finance-bar-stack .actual {
    background: linear-gradient(180deg, #5f8a61, #416743);
}

.finance-bar-stack .expected {
    border: 1px dashed #416743;
    background: rgba(65, 103, 67, 0.08);
}

.finance-month-bar small {
    overflow: hidden;
    color: #61705f;
    font-size: 0.72rem;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.finance-line-chart {
    width: 100%;
    height: 205px;
    margin-top: 12px;
    border-bottom: 1px solid #e6dfd2;
    background: linear-gradient(180deg, transparent 24%, rgba(65, 103, 67, 0.06) 24%, transparent 25%, transparent 49%, rgba(65, 103, 67, 0.06) 49%, transparent 50%, transparent 74%, rgba(65, 103, 67, 0.06) 74%, transparent 75%);
}

.finance-line-chart polyline {
    fill: none;
    stroke: #416743;
    stroke-width: 3;
    vector-effect: non-scaling-stroke;
}

.finance-card-footer {
    display: flex;
    justify-content: space-between;
    margin-top: 12px;
    color: #61705f;
    font-weight: 750;
}

.finance-card-footer strong {
    color: #102320;
}

.finance-category-layout {
    display: grid;
    grid-template-columns: 180px minmax(0, 1fr);
    gap: 18px;
    align-items: center;
}

.finance-donut {
    display: grid;
    width: 170px;
    aspect-ratio: 1;
    place-items: center;
    border-radius: 50%;
    background: #ece5d7;
}

.finance-donut > div {
    display: grid;
    width: 92px;
    aspect-ratio: 1;
    place-items: center;
    border-radius: 50%;
    background: #fffdf9;
    text-align: center;
}

.finance-donut strong {
    font-size: 1rem;
}

.finance-donut span,
.finance-category-list small {
    color: #61705f;
    font-size: 0.78rem;
}

.finance-category-list {
    display: grid;
    gap: 11px;
    min-width: 0;
}

.finance-category-list div {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto 44px;
    gap: 10px;
    align-items: center;
}

.finance-category-list span {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.finance-category-list span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.finance-category-list i {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.finance-mini-metrics {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin: 12px 0;
    padding: 12px;
    border: 1px solid #eee7da;
    border-radius: 10px;
    background: #faf8f3;
}

.finance-mini-metrics div {
    display: grid;
    gap: 4px;
}

.finance-mini-metrics span,
.finance-mini-metrics small {
    color: #61705f;
    font-size: 0.8rem;
    font-weight: 750;
}

.finance-table {
    display: grid;
    overflow: hidden;
    border: 1px solid #eee7da;
    border-radius: 10px;
}

.finance-table-head,
.finance-table-row {
    display: grid;
    grid-template-columns: 1.5fr 1fr 1fr 1fr 1fr;
    gap: 12px;
    align-items: center;
    padding: 10px 12px;
    border-bottom: 1px solid #eee7da;
}

.finance-table-head {
    color: #61705f;
    font-size: 0.75rem;
    font-weight: 850;
    text-transform: uppercase;
}

.finance-table-row {
    color: inherit;
    text-decoration: none;
}

.finance-table-row:last-child {
    border-bottom: 0;
}

.probability-badge {
    display: inline-flex;
    padding: 4px 8px;
    border-radius: 999px;
    background: #e5eedf;
    color: #416743;
    font-size: 0.78rem;
}

.finance-compact-list {
    display: grid;
    gap: 4px;
}

.finance-compact-list a {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    padding: 9px 0;
    border-bottom: 1px solid #eee7da;
    color: inherit;
    text-decoration: none;
}

.finance-compact-list a small {
    color: #61705f;
}

.finance-compact-list a strong {
    justify-self: end;
}

.finance-package-strip {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 18px;
}

.finance-package-mini {
    position: relative;
    display: grid;
    gap: 18px;
    align-content: start;
    min-height: 184px;
    padding: 18px;
    border: 1px solid #e6dfd2;
    border-radius: 10px;
    background: #fffdf9;
}

.finance-package-mini-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-height: 38px;
}

.finance-package-mini-head > strong {
    min-width: 0;
    overflow-wrap: anywhere;
    line-height: 1.2;
}

.finance-package-mini dl,
.finance-bottom-strip {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin: 0;
}

.finance-package-mini dl {
    padding-top: 18px;
    border-top: 1px solid #eee7da;
}

.finance-package-mini dt {
    color: #61705f;
    font-size: 0.72rem;
    font-weight: 850;
}

.finance-package-mini dd {
    margin: 3px 0 0;
    font-weight: 850;
}

.finance-bottom-strip {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    padding: 18px;
    border: 1px solid #e6dfd2;
    border-radius: 10px;
    background: #fffdf9;
}

.finance-bottom-strip article {
    display: grid;
    gap: 5px;
    border-right: 1px solid #eee7da;
}

.finance-bottom-strip article:last-child {
    border-right: 0;
}

.finance-bottom-strip span,
.finance-bottom-strip small {
    color: #61705f;
    font-weight: 750;
}

.finance-form-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.finance-form-grid label,
.package-option {
    display: grid;
    gap: 7px;
}

.finance-form-grid label span {
    color: #61705f;
    font-weight: 750;
}

.finance-check {
    align-self: end;
    min-height: 44px;
}

.package-grid,
.finance-package-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 14px;
}

.package-option,
.finance-package-card {
    padding: 14px;
    border: 1px solid #e6dfd2;
    border-radius: 10px;
    background: #fffdf9;
}

.package-option-main {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 10px;
}

.package-option small,
.finance-package-card span {
    display: block;
    margin-top: 4px;
    color: #747d71;
    line-height: 1.35;
}

.package-price-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 110px;
    gap: 10px;
    align-items: center;
    color: #61705f;
    font-size: 0.9rem;
    font-weight: 700;
}

.package-price-row input {
    min-height: 38px;
    padding: 8px 10px;
    border: 1px solid #ded8c9;
    border-radius: 8px;
    background: #fff;
}

.invoice-form {
    grid-template-columns: repeat(6, minmax(0, 1fr));
}

.finance-package-card {
    display: grid;
    gap: 14px;
}

.finance-package-card dl {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin: 0;
}

.finance-package-card dt {
    color: #747d71;
    font-size: 0.75rem;
    font-weight: 850;
    text-transform: uppercase;
}

.finance-package-card dd {
    margin: 4px 0 0;
    font-weight: 800;
}

.package-edit-panel summary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 8px 13px;
    border: 1px solid #416743;
    border-radius: 8px;
    background: #416743;
    color: #fffdf9;
    font-weight: 850;
    cursor: pointer;
}

.package-edit-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-height: 34px;
    padding: 7px 11px;
    border: 1px solid #cbd7c6;
    border-radius: 8px;
    background: #fffdf9;
    color: #416743;
    font-weight: 850;
    white-space: nowrap;
    cursor: pointer;
}

.package-edit-modal {
    width: min(720px, calc(100vw - 32px));
    max-height: min(780px, calc(100vh - 44px));
    margin: auto;
    padding: 0;
    border: 1px solid #d9d1c3;
    border-radius: 14px;
    background: #fffdf9;
    color: #22332d;
    box-shadow: 0 32px 90px rgba(33, 43, 36, 0.24);
}

.package-edit-modal::backdrop {
    background: rgba(20, 27, 23, 0.52);
    backdrop-filter: blur(2px);
}

.package-edit-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 20px 22px;
    border-bottom: 1px solid #eee7da;
}

.package-edit-modal-header div {
    display: grid;
    gap: 4px;
}

.package-edit-modal-header span {
    color: #61705f;
    font-size: 0.76rem;
    font-weight: 850;
    text-transform: uppercase;
}

.package-edit-modal-header strong {
    font-size: 1.35rem;
}

.package-edit-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    padding: 22px;
}

.package-edit-form label {
    display: grid;
    gap: 6px;
}

.package-edit-form label span {
    color: #61705f;
    font-size: 0.78rem;
    font-weight: 850;
    text-transform: uppercase;
}

.package-edit-form input,
.package-edit-form textarea {
    width: 100%;
    min-height: 40px;
    padding: 9px 10px;
    border: 1px solid #ded8c9;
    border-radius: 8px;
    background: #fffdf9;
    color: #22332d;
}

.package-edit-form textarea {
    min-height: 82px;
}

.package-edit-check {
    align-self: end;
    min-height: 40px;
}

.package-edit-form button {
    justify-self: stretch;
}

.package-edit-form button[type="submit"] {
    grid-column: auto;
}

.automation-card {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
}

.automation-card span {
    display: block;
    margin-top: 4px;
    color: #747d71;
    font-size: 0.86rem;
}

.automation-card small {
    display: block;
    margin-top: 8px;
    color: #61705f;
    line-height: 1.35;
}

.automation-status {
    display: inline-flex;
    width: fit-content;
    margin-top: 10px;
    padding: 5px 9px;
    border: 1px solid #ded8c9;
    border-radius: 999px;
    background: #fffdf9;
    color: #61705f;
    font-size: 0.78rem;
}

.automation-status.is-active {
    border-color: #c8ddc5;
    background: #e5eedf;
    color: #315333;
}

.automation-card button:disabled {
    cursor: default;
    opacity: 0.7;
}

.empty-state {
    grid-column: 1 / -1;
    padding: 24px;
    border: 1px dashed #d8d0c0;
    border-radius: 10px;
    color: #747d71;
    text-align: center;
}

.pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 22px;
}

.pagination-summary {
    color: #61705f;
    font-size: 0.92rem;
    font-weight: 700;
}

.pagination-links {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.pagination-links a,
.pagination-links span {
    min-width: 38px;
    padding: 8px 11px;
    border: 1px solid #ded8c9;
    border-radius: 8px;
    background: #fffdf9;
    color: #416743;
    font-weight: 850;
    text-align: center;
    text-decoration: none;
}

.pagination-links span.active {
    background: #416743;
    color: #fffdf9;
}

.pagination-links span.disabled {
    color: #9b9f94;
    cursor: not-allowed;
}

.login-page {
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 24px;
}

.login-card {
    width: min(430px, 100%);
    padding: 34px;
    border: 1px solid #e0d8ca;
    border-radius: 12px;
    background: rgba(255, 253, 249, 0.94);
    box-shadow: 0 28px 70px rgba(56, 70, 54, 0.12);
}

.login-brand {
    margin-bottom: 22px;
}

.login-card h1 {
    margin: 0;
}

.login-card p {
    color: #747d71;
}

.form-stack {
    display: grid;
    gap: 16px;
}

.user-toolbar {
    grid-template-columns: repeat(5, minmax(0, 1fr));
}

.package-toolbar {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.user-row {
    grid-template-columns: 1.1fr 1.4fr 1fr 110px 92px auto;
    padding: 12px 0;
    border-top: 1px solid #eee7da;
}

.package-row {
    grid-template-columns: 0.8fr 1fr 1.4fr 110px 110px 90px 110px 90px auto;
}

.check {
    display: flex;
    align-items: center;
    gap: 8px;
}

.check input {
    width: auto;
    min-height: auto;
}

/* Keep dark mode overrides late in the file so component rules cannot turn cards white again. */
body.theme-dark {
    background: #141b17;
    color: #edf3e8;
}

body.theme-dark .crm-sidebar,
body.theme-dark .panel,
body.theme-dark .company-card,
body.theme-dark .kpi-grid article,
body.theme-dark .team-card,
body.theme-dark .automation-card,
body.theme-dark .crm-user-card,
body.theme-dark .language-switcher,
body.theme-dark .theme-toggle,
body.theme-dark .activity-reminder,
body.theme-dark .lead-card,
body.theme-dark .pipeline-column,
body.theme-dark .package-option,
body.theme-dark .finance-package-card,
body.theme-dark .finance-package-mini,
body.theme-dark .finance-kpi-card,
body.theme-dark .finance-mini-metrics,
body.theme-dark .finance-bottom-strip,
body.theme-dark .finance-invoice-form,
body.theme-dark .calendar-day,
body.theme-dark .compact-edit-form,
body.theme-dark .company-contact-card,
body.theme-dark .company-insight-card,
body.theme-dark .company-history-preview div,
body.theme-dark .company-popover-form,
body.theme-dark .company-action-menu-content,
body.theme-dark .company-quick-info,
body.theme-dark .company-metric-list,
body.theme-dark .login-card,
body.theme-dark .finance-table,
body.theme-dark .finance-table-head,
body.theme-dark .finance-table-row,
body.theme-dark .package-edit-modal {
    border-color: #334235;
    background: #1d271f;
    color: #edf3e8;
}

body.theme-dark .pipeline-column,
body.theme-dark .compact-edit-form,
body.theme-dark .finance-mini-metrics {
    background: #18241c;
}

body.theme-dark input,
body.theme-dark select,
body.theme-dark textarea,
body.theme-dark .toolbar .secondary-link,
body.theme-dark .secondary-link,
body.theme-dark button.secondary,
body.theme-dark .secondary,
body.theme-dark .finance-period,
body.theme-dark .finance-invoice-action summary,
body.theme-dark .company-contact-actions summary,
body.theme-dark .company-full-width-details summary,
body.theme-dark .pagination-links a,
body.theme-dark .pagination-links span,
body.theme-dark .status-pill {
    border-color: #425345;
    background: #141b17;
    color: #edf3e8;
}

body.theme-dark .primary-link,
body.theme-dark button,
body.theme-dark .card-action-button.primary,
body.theme-dark .package-edit-panel summary {
    color: #fffdf9;
}

body.theme-dark .crm-nav a,
body.theme-dark .settings-link,
body.theme-dark .pipeline-title,
body.theme-dark .panel-header a,
body.theme-dark .side-card-link,
body.theme-dark .pipeline-deal-quick summary,
body.theme-dark .inline-edit summary,
body.theme-dark .activity-type-chip,
body.theme-dark .badge,
body.theme-dark .probability-badge,
body.theme-dark .calendar-day-items a,
body.theme-dark .calendar-day-items span {
    color: #8fbd86;
}

body.theme-dark .crm-nav a:hover,
body.theme-dark .settings-link:hover,
body.theme-dark .crm-nav a.active,
body.theme-dark .settings-link.active,
body.theme-dark .language-switcher button.active,
body.theme-dark .badge,
body.theme-dark .activity-type-chip,
body.theme-dark .probability-badge,
body.theme-dark .calendar-day-items a,
body.theme-dark .calendar-day-items span,
body.theme-dark .side-status-button {
    border-color: #3d563e;
    background: #263626;
}

body.theme-dark .language-switcher button,
body.theme-dark .theme-toggle,
body.theme-dark .bulk-select-all,
body.theme-dark .company-select-control {
    color: #b7d1b0;
}

body.theme-dark .page-header p,
body.theme-dark .muted,
body.theme-dark .crm-user-card span,
body.theme-dark .lead-card span,
body.theme-dark .lead-card small,
body.theme-dark .list-row span,
body.theme-dark .side-row span,
body.theme-dark .kpi-grid span,
body.theme-dark .bar-row span,
body.theme-dark .team-card dt,
body.theme-dark .finance-kpi-card span,
body.theme-dark .finance-kpi-card small,
body.theme-dark .finance-legend,
body.theme-dark .finance-month-bar small,
body.theme-dark .finance-card-footer,
body.theme-dark .finance-card-footer span,
body.theme-dark .finance-category-list small,
body.theme-dark .finance-mini-metrics span,
body.theme-dark .finance-mini-metrics small,
body.theme-dark .finance-package-mini dt,
body.theme-dark .finance-package-card dt,
body.theme-dark .finance-package-card span,
body.theme-dark .finance-bottom-strip span,
body.theme-dark .finance-bottom-strip small,
body.theme-dark .package-edit-form label span,
body.theme-dark .package-edit-modal-header span,
body.theme-dark .activity-list-content p,
body.theme-dark .activity-meta dt,
body.theme-dark .automation-card span,
body.theme-dark .automation-card small,
body.theme-dark .company-insight-grid p,
body.theme-dark .company-card p,
body.theme-dark .pagination-summary {
    color: #b7c6b2;
}

body.theme-dark .eyebrow {
    color: #8fbd86 !important;
}

body.theme-dark .finance-kpi-card strong,
body.theme-dark .finance-package-mini dd,
body.theme-dark .finance-package-mini strong,
body.theme-dark .finance-compact-list a strong,
body.theme-dark .finance-bottom-strip strong,
body.theme-dark .team-card dd,
body.theme-dark .bulk-owner-summary strong,
body.theme-dark .company-card h2,
body.theme-dark .company-contact-card strong,
body.theme-dark .company-contact-card span,
body.theme-dark .company-insight-grid strong,
body.theme-dark .activity-list-heading strong {
    color: #f4f8f0;
}

body.theme-dark .finance-donut {
    background: #263626;
}

body.theme-dark .finance-donut > div {
    background: #1d271f;
    color: #edf3e8;
}

body.theme-dark .bar-meter,
body.theme-dark .finance-line-chart,
body.theme-dark .lead-card-placeholder {
    background: #263626;
}

body.theme-dark .show-all-stage,
body.theme-dark .card-action-button,
body.theme-dark .company-select-control,
body.theme-dark .automation-status,
body.theme-dark .automation-status.is-active {
    border-color: #425345;
    background: #141b17;
    color: #edf3e8;
}

body.theme-dark .package-edit-trigger {
    border-color: #425345;
    background: #141b17;
    color: #edf3e8;
}

body.theme-dark .package-edit-modal-header {
    border-color: #334235;
}

body.theme-dark .finance-package-mini dl {
    border-color: #334235;
}

body.theme-dark .avatar,
body.theme-dark .side-card-header span {
    border: 1px solid #3d563e;
    background: #263626;
    color: #dcebd6;
}

body.theme-dark .card-action-button.primary {
    border-color: #416743;
    background: #416743;
    color: #fffdf9;
}

body.theme-dark .bulk-owner-summary,
body.theme-dark .bulk-owner-summary span,
body.theme-dark .calendar-row time,
body.theme-dark .finance-donut strong,
body.theme-dark .finance-donut span,
body.theme-dark .finance-card-footer strong,
body.theme-dark .company-registration-hero h1,
body.theme-dark .company-registration-hero p,
body.theme-dark .company-registration-intro p:not(.eyebrow),
body.theme-dark .company-registration-form .form-section-title,
body.theme-dark .form-section-title {
    color: #edf3e8;
}

body.theme-dark .company-registration-hero h1,
body.theme-dark .company-registration-form .form-section-title,
body.theme-dark .form-section-title {
    color: #f4f8f0;
}

body.theme-dark .theme-switch {
    background: #2b402d;
}

body.theme-dark .theme-switch span {
    background: #edf3e8;
}

body.theme-dark .finance-table-head,
body.theme-dark .finance-table-row,
body.theme-dark .side-row,
body.theme-dark .side-card-link,
body.theme-dark .company-history-preview div,
body.theme-dark .finance-compact-list a,
body.theme-dark .finance-bottom-strip article {
    border-color: #334235;
}

body.theme-dark .pipeline-column.is-drop-target {
    border-color: rgba(143, 189, 134, 0.7);
    background: #213221;
}

body.theme-dark .crm-toast,
body.theme-dark .won-overlay div {
    border-color: #425345;
    background: #1d271f;
    color: #edf3e8;
}

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

    .toolbar.dashboard-toolbar {
        grid-template-columns: minmax(220px, 1fr) auto auto;
    }

    .dashboard-layout {
        grid-template-columns: minmax(0, 1fr) 280px;
    }

    .company-overview-layout {
        grid-template-columns: minmax(0, 1fr) 330px;
    }

    .company-insight-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

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

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

    .finance-package-strip {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .finance-revenue-card,
    .finance-opportunities {
        grid-column: 1 / -1;
    }

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

@media (max-width: 1180px) {
    .kpi-grid,
    .finance-kpi-grid,
    .finance-form-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .dashboard-grid,
    .dashboard-layout,
    .dashboard-secondary-grid,
    .company-overview-layout,
    .company-value-columns,
    .detail-grid,
    .tabs-grid,
    .calendar-shell,
    .finance-main-grid,
    .finance-detail-grid,
    .finance-bottom-strip {
        grid-template-columns: 1fr;
    }

    .dashboard-side {
        position: static;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .finance-package-strip {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .company-overview-side {
        position: static;
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

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

    .company-value-columns > div + div {
        padding-left: 0;
        border-left: 0;
    }

    .toolbar,
    .dashboard-toolbar,
    .bulk-owner-panel,
    .invoice-form,
    .user-toolbar,
    .package-toolbar,
    .package-row,
    .user-row,
    .bar-row,
    .finance-mini-metrics {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

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

    .finance-table-head,
    .finance-table-row {
        min-width: 780px;
    }
}

@media (max-width: 820px) {
    .crm-shell {
        grid-template-columns: 1fr;
    }

    .crm-sidebar {
        position: static;
        height: auto;
    }

    .crm-main {
        padding: 22px 16px 34px;
    }

    .page-header,
    .header-actions,
    .with-action {
        align-items: stretch;
        flex-direction: column;
    }

    .kpi-grid,
    .finance-kpi-grid,
    .form-grid,
    .meta-grid,
    .toolbar,
    .dashboard-toolbar,
    .mini-form,
    .finance-form-grid,
    .invoice-form,
    .user-toolbar,
    .package-toolbar,
    .package-row,
    .user-row,
    .bar-row,
    .finance-invoice-form,
    .finance-mini-metrics,
    .finance-category-layout,
    .finance-package-mini dl,
    .finance-bottom-strip,
    .dashboard-side,
    .company-overview-side,
    .company-info-grid,
    .company-insight-grid,
    .company-popover-form,
    .company-section-title {
        grid-template-columns: 1fr;
    }

    .company-hero-actions {
        justify-content: stretch;
        width: 100%;
    }

    .company-hero-actions > *,
    .company-action-menu summary,
    .company-hero-actions .secondary-link {
        width: 100%;
    }

    .company-popover-form {
        left: 0;
        right: auto;
        width: min(420px, calc(100vw - 32px));
    }

    .company-info-grid div,
    .company-metric-list div,
    .company-quick-info div {
        grid-template-columns: 1fr;
        gap: 4px;
    }

    .company-history-preview div {
        align-items: flex-start;
        flex-direction: column;
    }

    .company-registration-page {
        width: 100%;
    }

    .company-registration-hero {
        margin-bottom: 14px;
    }

    .company-registration-hero::before {
        width: 18px;
        height: 56px;
    }

    .company-registration-hero h1 {
        font-size: 2.25rem;
        line-height: 1;
    }

    .company-registration-form {
        padding: 22px;
        border-radius: 16px;
    }

    .company-registration-form .form-actions {
        align-items: stretch;
        flex-direction: column-reverse;
    }

    .activity-list-row {
        grid-template-columns: 1fr;
        align-items: stretch;
    }

    .activity-list-actions {
        justify-items: stretch;
    }

    .activity-list-actions form,
    .activity-list-actions button {
        width: 100%;
    }

    .finance-bar-chart {
        overflow-x: auto;
        grid-template-columns: repeat(12, minmax(62px, 1fr));
    }

    .finance-invoice-form {
        left: 0;
        right: auto;
        width: min(520px, calc(100vw - 32px));
    }

    .package-edit-modal-header {
        align-items: stretch;
        flex-direction: column;
    }

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

    .finance-bottom-strip article {
        padding-bottom: 12px;
        border-right: 0;
        border-bottom: 1px solid #eee7da;
    }

    .finance-bottom-strip article:last-child {
        padding-bottom: 0;
        border-bottom: 0;
    }

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

    .toolbar input[type="search"],
    .span-2 {
        grid-column: auto;
    }
}

@media (max-width: 560px) {
    .finance-package-strip {
        grid-template-columns: 1fr;
    }
}
