* {
    box-sizing: border-box;
}

html {
    overflow-y: scroll;
    scrollbar-gutter: stable;
}

:root {
    --sticky-check: 56px;
    --sticky-no: 70px;
    --sticky-settlement: 130px;
    --sticky-name: 190px;
}

body {
    margin: 0;
    padding: 24px;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif;
    background:
        radial-gradient(circle at top left, rgba(255,255,255,0.92), rgba(240,244,255,0.88) 35%, rgba(224,232,255,0.72) 60%, rgba(210,220,245,0.68) 100%),
        linear-gradient(180deg, #eef3ff 0%, #e9eefb 100%);
    min-height: 100vh;
    color: #111827;
}

.container {
    width: 100%;
    max-width: 1800px;
    margin: 0 auto;
}

h1 {
    font-size: 40px;
    font-weight: 700;
    margin: 0 0 24px;
    letter-spacing: -0.03em;
    color: #0f172a;
}

h2 {
    font-size: 22px;
    font-weight: 700;
    margin: 0;
    color: #1e293b;
}

h3 {
    margin: 0;
    font-size: 22px;
    color: #111827;
}

h4 {
    margin: 0;
    font-size: 18px;
    color: #111827;
}

.top-action-bar {
    display: flex;
    justify-content: flex-start;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

.top-menu {
    display: flex;
    gap: 8px;
    margin: 6px 0 18px;
    padding: 6px;
    width: fit-content;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(226, 232, 240, 0.92);
    box-shadow:
        0 10px 24px rgba(15, 23, 42, 0.06),
        inset 0 1px 0 rgba(255,255,255,0.82);
}

.menu-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: transparent;
    color: #334155;
    box-shadow: none;
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 700;
}

.menu-btn.active {
    background: linear-gradient(180deg, #ffffff 0%, #f1f5f9 100%);
    color: #0f172a;
    box-shadow:
        0 8px 18px rgba(15, 23, 42, 0.14),
        inset 0 1px 0 rgba(255,255,255,0.9);
}

.menu-btn.active::after {
    content: "";
    position: absolute;
    left: 16px;
    right: 16px;
    bottom: 6px;
    height: 3px;
    border-radius: 99px;
    background: linear-gradient(90deg, #2563eb, #60a5fa);
}

.menu-btn-hubspot {
    width: auto;
    min-width: 0;
    padding: 10px 10px;
}

.menu-btn-logo {
    display: block;
    width: auto;
    height: auto;
    object-fit: contain;
    pointer-events: none;
}

.hubspot-menu-logo {
    width: 62px;
    max-width: none;
    max-height: 18px;
}

.card {
    position: relative;
    width: 100%;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(226, 232, 240, 0.88);
    border-radius: 28px;
    padding: 26px;
    margin-bottom: 24px;
    box-shadow:
        0 10px 26px rgba(15, 23, 42, 0.06),
        inset 0 1px 0 rgba(255,255,255,0.92);
}

.card::before {
    display: none;
}

.section-header,
.table-wrap {
    position: relative;
    z-index: 1;
}

#salesCrmView,
#salesStatusView,
#aiWorkspaceView,
#businessStatusView,
#invoiceRequestView,
.sales-layout,
.invoice-layout {
    width: 100%;
}

#aiWorkspaceView {
    display: grid;
    gap: 18px;
}

.ai-workspace-hero {
    overflow: hidden;
    background:
        radial-gradient(circle at top right, rgba(37, 99, 235, 0.20), transparent 28%),
        radial-gradient(circle at left center, rgba(14, 165, 233, 0.14), transparent 34%),
        linear-gradient(135deg, rgba(255,255,255,0.94) 0%, rgba(239,246,255,0.92) 48%, rgba(224,231,255,0.94) 100%);
}

.ai-workspace-hero-header,
.ai-command-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 18px;
    flex-wrap: wrap;
}

.ai-workspace-heading {
    max-width: 760px;
}

.ai-workspace-eyebrow {
    display: none;
    align-items: center;
    min-height: 28px;
    padding: 6px 12px;
    border-radius: 999px;
    margin-bottom: 12px;
    background: rgba(15, 23, 42, 0.08);
    color: #1d4ed8;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.08em;
}

.ai-workspace-hero-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.ai-workspace-mode-pill,
.ai-workspace-status-pill {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    padding: 8px 14px;
    border-radius: 999px;
    background: rgba(255,255,255,0.82);
    border: 1px solid rgba(191, 219, 254, 0.92);
    color: #0f172a;
    font-size: 13px;
    font-weight: 700;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.92);
}

.ai-workspace-status-pills {
    position: relative;
    z-index: 1;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 22px;
}

.ai-command-shell,
.ai-interpretation-grid,
.ai-recommendation-grid,
.ai-log-list,
.ai-result-grid {
    position: relative;
    z-index: 1;
}

.ai-command-shell {
    display: grid;
    gap: 12px;
}

.ai-quick-todo-card {
    display: grid;
    gap: 16px;
}

.ai-quick-todo-compose {
    display: grid;
    gap: 12px;
}

.ai-quick-todo-input {
    min-height: 88px;
}

.ai-quick-todo-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.ai-quick-todo-list {
    display: grid;
    gap: 10px;
}

.ai-quick-todo-item {
    display: grid;
    gap: 8px;
    padding: 16px 18px;
    border: 1px solid rgba(148, 163, 184, 0.24);
    border-radius: 16px;
    background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(248,250,252,0.96));
}

.ai-quick-todo-item.is-done {
    opacity: 0.7;
}

.ai-quick-todo-item-top {
    display: flex;
    gap: 12px;
    justify-content: space-between;
    align-items: flex-start;
}

.ai-quick-todo-item-main {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    min-width: 0;
}

.ai-quick-todo-item-main input[type="checkbox"] {
    margin-top: 3px;
}

.ai-quick-todo-title {
    font-size: 15px;
    font-weight: 700;
    color: #0f172a;
    word-break: break-word;
}

.ai-quick-todo-item.is-done .ai-quick-todo-title {
    text-decoration: line-through;
}

.ai-quick-todo-meta-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    color: #64748b;
    font-size: 12px;
}

.ai-quick-todo-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: 999px;
    background: #e2e8f0;
    color: #334155;
    font-size: 12px;
    font-weight: 700;
}

.ai-quick-todo-badge.is-high {
    background: #fee2e2;
    color: #b91c1c;
}

.ai-quick-todo-badge.is-medium {
    background: #fef3c7;
    color: #b45309;
}

.ai-quick-todo-badge.is-low {
    background: #dcfce7;
    color: #15803d;
}

.ai-quick-todo-empty {
    padding: 20px;
    border: 1px dashed rgba(148, 163, 184, 0.36);
    border-radius: 16px;
    color: #64748b;
    text-align: center;
    background: rgba(248, 250, 252, 0.8);
}

.ai-command-label {
    font-size: 13px;
    font-weight: 700;
    color: #334155;
}

.ai-command-input {
    width: 100%;
    border: 1px solid rgba(148, 163, 184, 0.32);
    border-radius: 22px;
    background: rgba(255,255,255,0.92);
    padding: 18px 20px;
    resize: vertical;
    min-height: 132px;
    font: inherit;
    line-height: 1.6;
    color: #0f172a;
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.92),
        0 10px 24px rgba(15, 23, 42, 0.05);
}

.ai-command-input:focus {
    outline: none;
    border-color: rgba(37, 99, 235, 0.48);
    box-shadow:
        0 0 0 4px rgba(59, 130, 246, 0.12),
        0 12px 28px rgba(37, 99, 235, 0.10);
}

.ai-command-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.ai-workspace-run-meta {
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 10px;
}

.ai-run-meta-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 38px;
    padding: 8px 14px;
    border-radius: 999px;
    background: rgba(248, 250, 252, 0.94);
    border: 1px solid rgba(226, 232, 240, 0.96);
    color: #475569;
    font-size: 13px;
    font-weight: 700;
}

.ai-interpretation-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-top: 18px;
}

.ai-interpretation-card,
.ai-recommendation-item,
.ai-result-item {
    padding: 18px;
    border-radius: 22px;
    background: linear-gradient(180deg, rgba(255,255,255,0.98) 0%, rgba(248,250,252,0.96) 100%);
    border: 1px solid rgba(226, 232, 240, 0.92);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.92),
        0 14px 24px rgba(15, 23, 42, 0.05);
}

.ai-interpretation-label,
.ai-recommendation-meta,
.ai-result-label {
    display: block;
    margin-bottom: 10px;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.06em;
    color: #64748b;
    text-transform: uppercase;
}

.ai-interpretation-value,
.ai-result-title {
    display: block;
    font-size: 18px;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 6px;
}

.ai-interpretation-note,
.ai-recommendation-desc,
.ai-result-desc {
    margin: 0;
    color: #475569;
    font-size: 14px;
    line-height: 1.6;
}

.ai-workspace-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(340px, 0.8fr);
    gap: 24px;
}

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

.ai-recommendation-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.ai-recommendation-title strong {
    font-size: 17px;
    color: #0f172a;
}

.ai-recommendation-badge,
.ai-log-badge {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
}

.ai-recommendation-badge.is-focus,
.ai-log-badge.is-complete {
    background: rgba(220, 252, 231, 0.92);
    color: #166534;
}

.ai-recommendation-badge.is-watch,
.ai-log-badge.is-running {
    background: rgba(219, 234, 254, 0.94);
    color: #1d4ed8;
}

.ai-recommendation-badge.is-risk,
.ai-log-badge.is-pending {
    background: rgba(254, 243, 199, 0.96);
    color: #92400e;
}

.ai-recommendation-badge.is-queue {
    background: rgba(237, 233, 254, 0.96);
    color: #6d28d9;
}

.ai-recommendation-footer,
.ai-result-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid rgba(226, 232, 240, 0.9);
    color: #475569;
    font-size: 13px;
    font-weight: 700;
}

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

.ai-log-item {
    display: grid;
    grid-template-columns: 88px minmax(0, 1fr);
    gap: 14px;
    padding: 16px 18px;
    border-radius: 22px;
    background: linear-gradient(180deg, rgba(255,255,255,0.98) 0%, rgba(248,250,252,0.96) 100%);
    border: 1px solid rgba(226, 232, 240, 0.92);
}

.ai-log-time {
    font-size: 12px;
    font-weight: 800;
    color: #64748b;
    padding-top: 2px;
}

.ai-log-title-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 8px;
}

.ai-log-title-row strong {
    color: #0f172a;
    font-size: 15px;
}

.ai-log-desc {
    margin: 0;
    color: #475569;
    font-size: 14px;
    line-height: 1.6;
}

.ai-empty-state {
    padding: 18px;
    border-radius: 20px;
    background: rgba(248, 250, 252, 0.92);
    border: 1px dashed rgba(148, 163, 184, 0.42);
    color: #64748b;
    font-size: 14px;
}

.ai-chat-card {
    min-height: min(520px, calc(100vh - 170px));
    display: grid;
    grid-template-rows: auto minmax(260px, 1fr) auto;
    gap: 18px;
}

.ai-todo-card {
    display: grid;
    gap: 18px;
}

.ai-chat-toolbar,
.ai-chat-input-row,
.ai-chat-messages,
.ai-chat-action {
    position: relative;
    z-index: 1;
}

.ai-chat-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    flex-wrap: wrap;
}

.ai-chat-title {
    display: grid;
    gap: 4px;
}

.ai-chat-messages {
    min-height: 260px;
    max-height: 420px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 18px;
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid rgba(226, 232, 240, 0.92);
}

.ai-chat-row {
    display: flex;
    width: 100%;
}

.ai-chat-row.user {
    justify-content: flex-end;
}

.ai-chat-row.ai {
    justify-content: flex-start;
}

.ai-chat-bubble {
    max-width: min(760px, 82%);
    padding: 14px 16px;
    border-radius: 18px;
    line-height: 1.65;
    font-size: 15px;
    white-space: normal;
    word-break: break-word;
    box-shadow: 0 10px 20px rgba(15, 23, 42, 0.06);
}

.ai-chat-bubble.user {
    border-bottom-right-radius: 8px;
    background: #1d4ed8;
    color: #ffffff;
}

.ai-chat-bubble.ai {
    border-bottom-left-radius: 8px;
    background: #ffffff;
    color: #111827;
    border: 1px solid rgba(226, 232, 240, 0.94);
}

.ai-chat-action {
    align-self: flex-start;
    width: min(760px, 88%);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    padding: 16px;
    margin-left: 4px;
    border-radius: 16px;
    background: #ffffff;
    border: 1px solid rgba(37, 99, 235, 0.24);
    box-shadow: 0 12px 24px rgba(37, 99, 235, 0.08);
}

.ai-chat-action.is-blocked {
    border-color: rgba(245, 158, 11, 0.36);
    background: linear-gradient(180deg, #ffffff 0%, #fffbeb 100%);
}

.ai-chat-action-main {
    flex: 1;
    min-width: 0;
}

.ai-chat-action-kicker {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.ai-chat-action-kicker span,
.ai-chat-action-kicker em {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-style: normal;
    font-weight: 900;
    line-height: 1.2;
}

.ai-chat-action-kicker span {
    color: #1d4ed8;
    background: rgba(219, 234, 254, 0.92);
}

.ai-chat-action-kicker em {
    color: #475569;
    background: rgba(241, 245, 249, 0.96);
}

.ai-chat-action strong {
    display: block;
    margin-bottom: 6px;
    color: #0f172a;
    font-size: 15px;
}

.ai-chat-action p {
    margin: 0;
    color: #64748b;
    font-size: 13px;
    line-height: 1.5;
}

.ai-chat-action-details {
    display: grid;
    gap: 8px;
    margin: 12px 0 0;
}

.ai-chat-action-details div {
    display: grid;
    grid-template-columns: 88px minmax(0, 1fr);
    gap: 10px;
    padding: 8px 10px;
    border-radius: 10px;
    background: rgba(248, 250, 252, 0.9);
    border: 1px solid rgba(226, 232, 240, 0.84);
}

.ai-chat-action-details dt,
.ai-chat-action-details dd {
    margin: 0;
    line-height: 1.45;
    word-break: break-word;
}

.ai-chat-action-details dt {
    color: #64748b;
    font-size: 12px;
    font-weight: 900;
}

.ai-chat-action-details dd {
    color: #111827;
    font-size: 13px;
    font-weight: 800;
}

.ai-chat-action-warning {
    margin-top: 12px;
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(254, 243, 199, 0.92);
    border: 1px solid rgba(245, 158, 11, 0.32);
    color: #92400e;
    font-size: 13px;
    font-weight: 800;
    line-height: 1.5;
}

.ai-chat-action-buttons {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
    flex-wrap: wrap;
    justify-content: flex-end;
}

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

.ai-chat-input {
    width: 100%;
    min-height: 48px;
    border: 1px solid rgba(148, 163, 184, 0.32);
    border-radius: 16px;
    background: rgba(255,255,255,0.96);
    padding: 0 16px;
    font: inherit;
    color: #0f172a;
}

.ai-chat-input:focus {
    outline: none;
    border-color: rgba(37, 99, 235, 0.48);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.12);
}

.ai-chat-send-btn {
    min-height: 48px;
    min-width: 86px;
    border-radius: 16px;
}

.ai-chat-empty {
    margin: auto;
    max-width: 520px;
    padding: 22px;
    border-radius: 18px;
    background: #ffffff;
    border: 1px dashed rgba(148, 163, 184, 0.48);
    color: #64748b;
    text-align: center;
    line-height: 1.6;
}

@media (max-width: 1180px) {
    .ai-interpretation-grid,
    .ai-recommendation-grid,
    .ai-result-grid,
    .ai-workspace-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 720px) {
    body {
        padding-bottom: calc(132px + env(safe-area-inset-bottom, 0px));
    }

    .top-menu {
        position: fixed;
        left: clamp(20px, 4.6vw, 28px);
        right: clamp(20px, 4.6vw, 28px);
        bottom: calc(env(safe-area-inset-bottom, 0px) + 14px);
        z-index: 1200;
        width: auto;
        margin: 0;
        padding: 8px;
        gap: 4px;
        border-radius: 999px;
        background:
            linear-gradient(180deg, rgba(255, 255, 255, 0.94) 0%, rgba(246, 248, 252, 0.9) 100%);
        border: 1px solid rgba(255, 255, 255, 0.96);
        box-shadow:
            0 18px 38px rgba(15, 23, 42, 0.12),
            0 6px 16px rgba(148, 163, 184, 0.1),
            inset 0 1px 0 rgba(255,255,255,0.96),
            inset 0 -1px 0 rgba(226, 232, 240, 0.66);
        backdrop-filter: blur(20px) saturate(145%);
        -webkit-backdrop-filter: blur(20px) saturate(145%);
    }

    .menu-btn {
        flex: 1 1 0;
        min-width: 0;
        min-height: 58px;
        padding: 10px 6px 12px;
        border-radius: 999px;
        font-size: 11px;
        line-height: 1.2;
        white-space: normal;
        text-align: center;
        word-break: keep-all;
        letter-spacing: -0.02em;
    }

    .menu-btn.active {
        background: linear-gradient(180deg, rgba(240, 242, 246, 0.98) 0%, rgba(232, 235, 240, 0.94) 100%);
        box-shadow:
            inset 0 1px 0 rgba(255,255,255,0.98),
            0 4px 10px rgba(148, 163, 184, 0.12);
    }

    .menu-btn.active::after {
        left: 14px;
        right: 14px;
        bottom: 7px;
        height: 2px;
    }

    .menu-btn-hubspot {
        padding: 10px 4px 12px;
    }

    .hubspot-menu-logo {
        width: 50px;
    }

    .crm-table.crm-table-business {
        min-width: 0;
        border-spacing: 0;
        background: transparent;
    }

    .crm-table.crm-table-business thead {
        display: none;
    }

    .crm-table.crm-table-business tbody,
    .crm-table.crm-table-business tr,
    .crm-table.crm-table-business td {
        display: block;
        width: 100%;
    }

    .crm-table.crm-table-business tbody tr {
        margin-bottom: 14px;
        padding: 16px;
        border-radius: 24px;
        background: linear-gradient(180deg, rgba(255,255,255,0.96) 0%, rgba(248,250,252,0.92) 100%);
        border: 1px solid rgba(226, 232, 240, 0.92);
        box-shadow:
            inset 0 1px 0 rgba(255,255,255,0.96),
            0 14px 28px rgba(15, 23, 42, 0.06);
    }

    .crm-table.crm-table-business tbody tr:last-child {
        margin-bottom: 0;
    }

    .crm-table.crm-table-business tbody td {
        display: grid;
        grid-template-columns: minmax(78px, 92px) minmax(0, 1fr);
        align-items: center;
        gap: 10px;
        padding: 9px 0;
        border: 0;
        background: transparent;
        white-space: normal;
        text-align: left;
    }

    .crm-table.crm-table-business tbody td::before {
        content: attr(data-label);
        color: #64748b;
        font-size: 12px;
        font-weight: 800;
        letter-spacing: -0.01em;
    }

    .crm-table.crm-table-business .center-cell,
    .crm-table.crm-table-business .number-cell,
    .crm-table.crm-table-business .crm-memo-cell {
        text-align: left;
    }

    .crm-table.crm-table-business .crm-name-cell {
        width: 100%;
        max-width: none;
        padding-left: 0;
        padding-right: 0;
        padding-top: 0;
        margin-bottom: 4px;
        grid-template-columns: 1fr;
    }

    .crm-table.crm-table-business .crm-name-cell::before {
        display: none;
    }

    .crm-table.crm-table-business .crm-name-link {
        white-space: normal;
        overflow: visible;
        text-overflow: initial;
        font-size: 19px;
        line-height: 1.35;
    }

    .crm-table.crm-table-business .crm-progress-cell {
        min-width: 0;
    }

    .crm-table.crm-table-business .crm-progress-meter {
        display: flex;
        width: 100%;
        justify-content: flex-start;
        gap: 12px;
    }

    .crm-table.crm-table-business .crm-progress-bar-track {
        flex: 1 1 auto;
        width: auto;
        min-width: 0;
        max-width: 180px;
    }

    .crm-table.crm-table-business .crm-progress-value {
        min-width: 40px;
        text-align: right;
    }

    .ai-command-input {
        min-height: 152px;
    }

    .ai-log-item {
        grid-template-columns: 1fr;
    }

    .ai-chat-card {
        min-height: 480px;
        grid-template-rows: auto minmax(260px, 1fr) auto;
    }

    .ai-chat-messages {
        min-height: 260px;
        max-height: 360px;
        padding: 12px;
    }

    .ai-chat-bubble,
    .ai-chat-action {
        max-width: 100%;
        width: 100%;
    }

    .ai-chat-action,
    .ai-chat-input-row {
        grid-template-columns: 1fr;
    }

    .ai-chat-action {
        flex-direction: column;
    }

    .ai-chat-action-details div {
        grid-template-columns: 1fr;
        gap: 4px;
    }

    .ai-chat-action-buttons {
        width: 100%;
        justify-content: flex-start;
    }
}

.business-allocation-overview {
    position: relative;
    z-index: 1;
    margin-bottom: 20px;
}

.business-allocation-overview-shell {
    display: grid;
    gap: 18px;
    padding: 20px;
    border-radius: 24px;
    background:
        radial-gradient(circle at top right, rgba(79, 70, 229, 0.14), transparent 28%),
        radial-gradient(circle at top left, rgba(14, 165, 233, 0.12), transparent 28%),
        linear-gradient(180deg, rgba(255,255,255,0.98) 0%, rgba(248,250,252,0.96) 100%);
    border: 1px solid rgba(226, 232, 240, 0.96);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.92),
        0 18px 34px rgba(15, 23, 42, 0.06);
}

.business-allocation-overview-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 16px;
    flex-wrap: wrap;
}

.business-allocation-overview-top strong {
    display: block;
    font-size: 20px;
    color: #0f172a;
    margin-bottom: 6px;
}

.business-allocation-overview-top span {
    font-size: 14px;
    color: #64748b;
}

.business-overview-pill {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    padding: 8px 14px;
    border-radius: 999px;
    background: linear-gradient(180deg, rgba(239,246,255,0.98) 0%, rgba(224,231,255,0.96) 100%);
    color: #3730a3;
    font-size: 13px;
    font-weight: 800;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.84);
}

.business-overview-filter {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 16px;
    background: rgba(255,255,255,0.78);
    border: 1px solid rgba(226, 232, 240, 0.95);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.92);
}

.business-overview-filter-label {
    font-size: 12px;
    font-weight: 800;
    color: #475569;
    white-space: nowrap;
}

.business-overview-filter-select {
    min-width: 100px;
    padding: 8px 12px;
    border-radius: 12px;
    border: 1px solid rgba(191, 219, 254, 0.95);
    background: linear-gradient(180deg, rgba(239, 246, 255, 0.98) 0%, rgba(219, 234, 254, 0.92) 100%);
    color: #1d4ed8;
    font-size: 13px;
    font-weight: 700;
}

.business-allocation-overview-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.8fr) minmax(280px, 0.72fr);
    gap: 18px;
    align-items: stretch;
}

.business-overview-chart-card,
.business-overview-side-panel {
    display: grid;
    gap: 16px;
    padding: 18px;
    border-radius: 22px;
    background: linear-gradient(180deg, rgba(255,255,255,0.96) 0%, rgba(241,245,249,0.94) 100%);
    border: 1px solid rgba(226, 232, 240, 0.95);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.88),
        0 14px 24px rgba(15, 23, 42, 0.04);
}

.business-overview-chart-header,
.business-overview-side-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

.business-overview-chart-header strong,
.business-overview-side-header strong {
    display: block;
    font-size: 18px;
    color: #0f172a;
    margin-bottom: 4px;
}

.business-overview-chart-header span,
.business-overview-side-header span {
    font-size: 13px;
    color: #64748b;
}

.business-overview-side-copy {
    margin: -6px 0 2px;
    font-size: 13px;
    line-height: 1.6;
    color: #64748b;
}

.business-visual-badge {
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(248, 250, 252, 0.98);
    color: #334155;
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
    border: 1px solid rgba(226, 232, 240, 0.95);
}

.business-chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    align-items: center;
    color: #475569;
    font-size: 13px;
    font-weight: 700;
}

.business-chart-legend span {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.business-legend-swatch {
    display: inline-flex;
    width: 16px;
    height: 16px;
    border-radius: 999px;
}

.business-legend-swatch.is-revenue {
    background: linear-gradient(180deg, #8b5cf6 0%, #4f46e5 100%);
}

.business-legend-swatch.is-headcount {
    width: 18px;
    height: 3px;
    border-radius: 999px;
    background: #0f766e;
}

.business-combined-chart {
    display: block;
    width: 100%;
    height: auto;
    padding: 14px 14px 6px;
    border-radius: 20px;
    background: linear-gradient(180deg, rgba(248,250,252,0.98) 0%, rgba(241,245,249,0.94) 100%);
    border: 1px solid rgba(226, 232, 240, 0.95);
    overflow: visible;
}

.business-combined-chart-scroll {
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}

.business-combined-chart-scroll::-webkit-scrollbar {
    height: 8px;
}

.business-combined-chart-scroll::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.42);
    border-radius: 999px;
}

.business-chart-mobile-hint {
    display: none;
    margin-top: -4px;
    font-size: 12px;
    color: #64748b;
}

.business-chart-value {
    font-size: 11px;
    font-weight: 800;
}

.business-chart-value-revenue {
    fill: #ffffff;
    paint-order: stroke fill;
    stroke: rgba(79, 70, 229, 0.42);
    stroke-width: 2px;
}

.business-chart-value-headcount {
    fill: #0f766e;
}

.business-axis-revenue {
    fill: #6d28d9;
}

.business-axis-headcount {
    fill: #0f766e;
}

.business-visual-caption {
    font-size: 12px;
    color: #64748b;
}

.business-headcount-kpi-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.business-headcount-kpi-card {
    padding: 16px;
    border-radius: 18px;
    background: rgba(255,255,255,0.86);
    border: 1px solid rgba(226, 232, 240, 0.9);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.9);
}

.business-headcount-kpi-card.is-headcount {
    background:
        linear-gradient(180deg, rgba(240, 253, 250, 0.98) 0%, rgba(236, 253, 245, 0.95) 100%);
    border-color: rgba(94, 234, 212, 0.55);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.94),
        0 10px 20px rgba(15, 118, 110, 0.05);
}

.business-headcount-kpi-card.is-revenue {
    background:
        linear-gradient(180deg, rgba(245, 243, 255, 0.98) 0%, rgba(238, 242, 255, 0.95) 100%);
    border-color: rgba(167, 139, 250, 0.5);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.94),
        0 10px 20px rgba(99, 102, 241, 0.06);
}

.business-headcount-kpi-card.is-metric {
    background:
        linear-gradient(180deg, rgba(248, 250, 252, 0.98) 0%, rgba(241, 245, 249, 0.95) 100%);
    border-color: rgba(203, 213, 225, 0.72);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.94),
        0 10px 20px rgba(51, 65, 85, 0.04);
}

.business-headcount-kpi-card span {
    display: block;
    font-size: 14px;
    font-weight: 800;
    color: #334155;
    margin-bottom: 10px;
}

.business-headcount-kpi-card strong {
    font-size: 22px;
    color: #0f172a;
}

.business-headcount-kpi-card.is-headcount strong {
    color: #0f766e;
}

.business-headcount-kpi-card.is-revenue strong {
    color: #6d28d9;
}

.business-headcount-kpi-card.is-metric strong {
    color: #334155;
}

.business-headcount-kpi-card b {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    font-weight: 700;
    color: #94a3b8;
}

.business-headcount-kpi-card.is-headcount b {
    color: #0f766e;
}

.business-headcount-kpi-card.is-revenue b {
    color: #7c3aed;
}

.business-headcount-kpi-card.is-metric b {
    color: #475569;
}

.business-side-summary-list {
    display: grid;
    gap: 10px;
}

.business-side-summary-item {
    display: grid;
    gap: 4px;
    padding: 14px 16px;
    border-radius: 18px;
    background: rgba(248, 250, 252, 0.98);
    border: 1px solid rgba(226, 232, 240, 0.92);
}

.business-side-summary-item span {
    font-size: 12px;
    color: #64748b;
}

.business-side-summary-item strong {
    font-size: 16px;
    color: #0f172a;
}

.business-side-summary-item b {
    font-size: 13px;
    color: #475569;
}

.business-overview-empty {
    min-height: 220px;
}

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

.section-title-group {
    display: flex;
    align-items: center;
    gap: 16px;
    min-width: 0;
}

.section-title-group h2 {
    margin: 0;
    flex-shrink: 0;
}

.business-view-toggle {
    display: inline-flex;
    align-items: center;
    padding: 4px;
    border-radius: 18px;
    background: rgba(226, 232, 240, 0.85);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.72);
}

.view-toggle-btn {
    min-height: 38px;
    padding: 10px 16px;
    border-radius: 14px;
    background: transparent;
    color: #475569;
    box-shadow: none;
    font-size: 14px;
    font-weight: 800;
}

.view-toggle-btn.active {
    background: linear-gradient(180deg, #eff6ff 0%, #dbeafe 100%);
    color: #1d4ed8;
    box-shadow:
        0 8px 16px rgba(37, 99, 235, 0.12),
        inset 0 1px 0 rgba(255,255,255,0.72);
}

.toolbar {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
    margin-left: auto;
}

.business-search-box {
    width: 220px;
    min-width: 220px;
    flex: 0 0 220px;
    margin-right: 4px;
}

.business-search-field {
    position: relative;
}

.business-search-input {
    width: 100%;
    min-height: 48px;
    padding-right: 44px;
    border-radius: 16px;
    background: linear-gradient(180deg, rgba(255,255,255,0.94) 0%, rgba(240,246,255,0.92) 100%);
    border: 1px solid rgba(148, 163, 184, 0.28);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.92),
        0 8px 16px rgba(15, 23, 42, 0.05);
}

.business-search-icon {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 18px;
    line-height: 1;
    opacity: 0.72;
    pointer-events: none;
}

button {
    border: none;
    border-radius: 18px;
    padding: 14px 20px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    color: white;
    transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

button:hover {
    transform: translateY(-1px);
}

button:active {
    transform: scale(0.98);
}

.primary-btn {
    background: linear-gradient(180deg, #4f8cff 0%, #2563eb 100%);
    box-shadow:
        0 8px 20px rgba(37, 99, 235, 0.22),
        inset 0 1px 0 rgba(255,255,255,0.35);
}

.danger-btn {
    background: linear-gradient(180deg, #ff7b7b 0%, #ef4444 100%);
    box-shadow:
        0 8px 20px rgba(239, 68, 68, 0.20),
        inset 0 1px 0 rgba(255,255,255,0.35);
}

.secondary-btn {
    background: linear-gradient(180deg, #94a3b8 0%, #64748b 100%);
    box-shadow:
        0 8px 20px rgba(100, 116, 139, 0.20),
        inset 0 1px 0 rgba(255,255,255,0.25);
}

.bulk-download-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.hidden-file-input {
    display: none;
}

.small-btn {
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 13px;
}

.table-wrap {
    overflow-x: auto;
    width: 100%;
}

table {
    width: 100%;
    min-width: 1200px;
    border-collapse: separate;
    border-spacing: 0;
    border-radius: 22px;
    background: rgba(255,255,255,0.42);
}

.raw-table {
    min-width: 3300px;
}

thead th {
    text-align: center;
    font-size: 13px;
    font-weight: 700;
    color: #334155;
    padding: 14px 14px;
    background: rgba(255,255,255,0.85);
    border-bottom: 1px solid rgba(148,163,184,0.18);
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 5;
}

tbody td {
    padding: 12px 14px;
    font-size: 13px;
    color: #0f172a;
    border-bottom: 1px solid rgba(148,163,184,0.12);
    background: rgba(255,255,255,0.42);
    vertical-align: middle;
    white-space: nowrap;
    text-align: center;
}

tbody tr:last-child td {
    border-bottom: none;
}

tbody tr:hover td {
    background: rgba(255,255,255,0.62);
}

.check-col {
    width: var(--sticky-check);
    min-width: var(--sticky-check);
    text-align: center;
}

.check-cell {
    text-align: center;
}

.sticky-col {
    position: sticky;
    z-index: 3;
    background: #f4f7ff !important;
    box-shadow: 1px 0 0 rgba(203, 213, 225, 0.45);
}

thead th.sticky-col {
    z-index: 9;
    background: #eef2ff !important;
}

.sticky-check { left: 0; }
.sticky-no { left: var(--sticky-check); min-width: var(--sticky-no); width: var(--sticky-no); }
.sticky-settlement { left: calc(var(--sticky-check) + var(--sticky-no)); min-width: var(--sticky-settlement); width: var(--sticky-settlement); }
.sticky-name { left: calc(var(--sticky-check) + var(--sticky-no) + var(--sticky-settlement)); min-width: var(--sticky-name); width: var(--sticky-name); }

.business-sort-header {
    cursor: pointer;
    user-select: none;
    transition: background-color 0.18s ease, color 0.18s ease;
}

.business-sort-header:hover {
    background: rgba(219, 234, 254, 0.96);
    color: #1d4ed8;
}

thead th.sticky-col.business-sort-header:hover {
    background: #dbeafe !important;
}

.business-sort-header::after {
    content: "↕";
    display: inline-block;
    margin-left: 6px;
    font-size: 11px;
    color: #94a3b8;
    opacity: 0.9;
}

.business-sort-header[data-sort-dir="asc"]::after {
    content: "↑";
    color: #2563eb;
}

.business-sort-header[data-sort-dir="desc"]::after {
    content: "↓";
    color: #2563eb;
}

.business-sort-header[data-filter-active="true"] {
    background: rgba(220, 252, 231, 0.92);
    color: #047857;
}

.business-column-filter-bar {
    display: grid;
    grid-template-columns: minmax(320px, 0.74fr) minmax(0, 1.26fr);
    gap: 14px;
    margin: 0 0 14px;
    padding: 14px;
    border-radius: 22px;
    background:
        radial-gradient(circle at top right, rgba(59, 130, 246, 0.12), transparent 32%),
        linear-gradient(180deg, rgba(248,250,252,0.96) 0%, rgba(241,245,249,0.92) 100%);
    border: 1px solid rgba(226, 232, 240, 0.92);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.86);
}

.business-filter-source,
.business-filter-dropzone {
    display: grid;
    gap: 10px;
    min-width: 0;
}

.business-filter-label,
.business-filter-dropzone-title {
    color: #475569;
    font-size: 12px;
    font-weight: 900;
}

.business-filter-dropzone-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.business-filter-chip-row,
.business-filter-active-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.business-filter-chip {
    min-height: 34px;
    padding: 8px 12px;
    border-radius: 999px;
    border: 1px solid rgba(191, 219, 254, 0.86);
    background: rgba(239, 246, 255, 0.94);
    color: #1d4ed8;
    font-size: 12px;
    font-weight: 900;
    box-shadow: none;
    cursor: grab;
}

.business-filter-chip.is-active {
    background: rgba(220, 252, 231, 0.96);
    border-color: rgba(134, 239, 172, 0.9);
    color: #047857;
}

.business-filter-dropzone {
    min-height: 76px;
    padding: 12px;
    border-radius: 18px;
    border: 1px dashed rgba(59, 130, 246, 0.42);
    background: rgba(255,255,255,0.76);
}

.business-filter-drop-empty {
    color: #94a3b8;
    font-size: 13px;
    font-weight: 800;
}

.business-column-filter-control {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 40px;
    padding: 6px 8px 6px 12px;
    border-radius: 16px;
    background: #ffffff;
    border: 1px solid rgba(203, 213, 225, 0.86);
    box-shadow: 0 10px 18px rgba(15, 23, 42, 0.04);
}

.business-column-filter-control span {
    color: #0f172a;
    font-size: 12px;
    font-weight: 900;
    white-space: nowrap;
}

.business-column-filter-input {
    min-height: 30px;
    max-width: 150px;
    padding: 5px 8px;
    border-radius: 10px;
    border: 1px solid rgba(203, 213, 225, 0.9);
    background: rgba(248,250,252,0.98);
    color: #0f172a;
    font-size: 12px;
    font-weight: 800;
}

.business-column-filter-remove,
.business-filter-clear-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    border-radius: 999px;
    border: 0;
    box-shadow: none;
}

.business-column-filter-remove {
    width: 28px;
    padding: 0;
    background: rgba(254, 226, 226, 0.9);
    color: #dc2626;
    font-size: 16px;
    font-weight: 900;
}

.business-filter-clear-btn {
    padding: 5px 10px;
    background: rgba(241, 245, 249, 0.96);
    color: #64748b;
    font-size: 12px;
    font-weight: 900;
}

.business-sort-header[data-filterable="true"] {
    color: #1e40af;
}

.business-sort-header[data-filterable="true"]::before {
    content: "필터";
    display: inline-flex;
    align-items: center;
    min-height: 18px;
    padding: 2px 6px;
    margin-right: 6px;
    border-radius: 999px;
    background: rgba(219, 234, 254, 0.9);
    color: #2563eb;
    font-size: 10px;
    font-weight: 900;
    vertical-align: 1px;
}

.business-header-filter-menu {
    position: fixed;
    z-index: 1000;
    width: 280px;
    display: grid;
    gap: 12px;
    padding: 14px;
    border-radius: 18px;
    background: rgba(255,255,255,0.98);
    border: 1px solid rgba(203, 213, 225, 0.96);
    box-shadow: 0 22px 48px rgba(15, 23, 42, 0.18);
}

.business-header-filter-title {
    color: #0f172a;
    font-size: 14px;
    font-weight: 900;
}

.business-header-filter-actions,
.business-header-filter-footer {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.business-header-filter-actions button,
.business-header-filter-footer button {
    min-height: 34px;
    padding: 7px 9px;
    border-radius: 12px;
    border: 1px solid rgba(203, 213, 225, 0.9);
    background: rgba(248,250,252,0.98);
    color: #334155;
    font-size: 12px;
    font-weight: 900;
    box-shadow: none;
}

.business-header-filter-actions button:hover,
.business-header-filter-footer button:hover {
    background: rgba(239, 246, 255, 0.98);
    color: #1d4ed8;
}

.business-header-filter-field {
    display: grid;
    gap: 6px;
    padding: 10px;
    border-radius: 14px;
    background: rgba(241, 245, 249, 0.72);
}

.business-header-filter-field span {
    color: #64748b;
    font-size: 12px;
    font-weight: 900;
}

.business-header-filter-field .business-column-filter-input {
    width: 100%;
    max-width: none;
}

.edit-link {
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
    color: #2563eb;
    cursor: pointer;
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.action-link {
    color: #7c3aed;
    cursor: pointer;
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.number-cell {
    text-align: right;
}

.center-cell {
    text-align: center;
}

.month-hit {
    background: #fff176 !important;
    font-weight: 700;
    text-align: center;
}

.month-empty {
    color: #cbd5e1;
    text-align: center;
}

.business-name-cell {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
}

.business-toggle-btn {
    width: 24px;
    height: 24px;
    padding: 0;
    border-radius: 999px;
    background: rgba(37, 99, 235, 0.12);
    color: #1d4ed8;
    box-shadow: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.business-toggle-btn:hover {
    background: rgba(37, 99, 235, 0.18);
}

.business-toggle-icon {
    font-size: 12px;
    line-height: 1;
    transition: transform 0.18s ease;
}

.business-toggle-btn.is-expanded .business-toggle-icon {
    transform: rotate(90deg);
}

.summary-row td {
    background: rgba(239, 246, 255, 0.92);
    font-weight: 600;
}

tbody tr.summary-row:hover td {
    background: rgba(219, 234, 254, 0.94);
}

.detail-row td {
    background: rgba(255,255,255,0.68);
}

tbody tr.detail-row.is-globally-open td {
    background: rgba(248, 250, 252, 0.92);
}

.detail-label {
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    gap: 6px;
    color: #475569;
}

.sticky-name {
    text-align: left !important;
}

thead th.sticky-name {
    text-align: center !important;
}

.detail-label::before {
    content: attr(data-round-label);
    min-width: 42px;
    height: 24px;
    padding: 0 10px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, #eff6ff 0%, #dbeafe 100%);
    border: 1px solid rgba(96, 165, 250, 0.48);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.9),
        0 4px 10px rgba(37, 99, 235, 0.08);
    flex-shrink: 0;
    color: #1d4ed8;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
}

.detail-label.no-prefix::before {
    display: none;
}

.detail-link {
    color: #0f172a;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}

.detail-name-text {
    color: #475569;
    font-weight: 500;
}

.detail-link:hover {
    color: #1d4ed8;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(15, 23, 42, 0.35);
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.modal-content.large {
    width: min(1600px, 97vw);
    max-height: 94vh;
    overflow-y: auto;
    background: #ffffff;
    border: 1px solid rgba(226, 232, 240, 0.92);
    border-radius: 28px;
    padding: 24px;
    box-shadow:
        0 20px 48px rgba(15, 23, 42, 0.12),
        inset 0 1px 0 rgba(255,255,255,0.72);
    overscroll-behavior: contain;
}

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

.close-btn {
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: 50%;
    font-size: 24px;
    line-height: 1;
    background: linear-gradient(180deg, #94a3b8 0%, #64748b 100%);
}

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

.field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.field-span-2 {
    grid-column: span 2;
}

.field-span-3 {
    grid-column: span 3;
}

.field-span-4 {
    grid-column: span 4;
}

.required-mark {
    color: #dc2626;
}

label {
    font-size: 13px;
    font-weight: 700;
    color: #475569;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid rgba(255,255,255,0.7);
    background: #ffffff;
    color: #0f172a;
    border-radius: 18px;
    padding: 14px 16px;
    font-size: 15px;
    outline: none;
    box-shadow:
        inset 0 1px 1px rgba(255,255,255,0.65),
        0 3px 10px rgba(15, 23, 42, 0.04);
    transition: all 0.2s ease;
}

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

.form-select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    padding-right: 46px;
    background-image:
        linear-gradient(45deg, transparent 50%, #475569 50%),
        linear-gradient(135deg, #475569 50%, transparent 50%);
    background-position:
        calc(100% - 22px) calc(50% - 3px),
        calc(100% - 16px) calc(50% - 3px);
    background-size: 6px 6px, 6px 6px;
    background-repeat: no-repeat;
}

input::placeholder {
    color: #6b7280;
}

input:focus,
select:focus,
textarea:focus {
    border-color: rgba(59,130,246,0.35);
    box-shadow:
        0 0 0 4px rgba(59,130,246,0.10),
        inset 0 1px 1px rgba(255,255,255,0.7),
        0 6px 16px rgba(59,130,246,0.08);
    background: rgba(255,255,255,0.86);
}

.allocation-section {
    margin-top: 24px;
    border: 1px solid rgba(203, 213, 225, 0.7);
    border-radius: 24px;
    overflow: hidden;
    background: rgba(248, 250, 252, 0.7);
}

.business-info-panel {
    margin-top: 4px;
    padding: 22px 24px;
    border: 1px solid rgba(203, 213, 225, 0.72);
    border-radius: 24px;
    background: rgba(248, 250, 252, 0.72);
}

.business-info-panel h4 {
    margin-bottom: 16px;
}

.allocation-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    padding: 18px 18px 14px;
    border-bottom: 1px solid rgba(203, 213, 225, 0.7);
    background: rgba(255,255,255,0.5);
}

.allocation-header p {
    margin: 6px 0 0;
    font-size: 13px;
    color: #64748b;
}

.allocation-wrap {
    overflow-x: auto;
    contain: layout paint;
}

.allocation-input-table {
    min-width: 1800px;
    border-collapse: separate;
    border-spacing: 0;
    border-radius: 0;
    background: transparent;
}

.allocation-input-table thead th {
    top: 0;
    position: static;
    background: rgba(241, 245, 249, 0.95);
    font-size: 12px;
    padding: 12px 10px;
}

.allocation-input-table tbody td {
    background: rgba(255,255,255,0.68);
    padding: 10px;
}

.allocation-input-table input,
.allocation-input-table select {
    padding: 10px 12px;
    border-radius: 12px;
    font-size: 13px;
    background: linear-gradient(180deg, #f8fbff 0%, #eef4ff 100%);
    border: 1px solid rgba(148, 163, 184, 0.34);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.92),
        0 2px 8px rgba(15, 23, 42, 0.05);
}

.allocation-input-table input:focus,
.allocation-input-table select:focus {
    background: linear-gradient(180deg, #ffffff 0%, #f3f7ff 100%);
    border-color: rgba(59,130,246,0.45);
    box-shadow:
        0 0 0 4px rgba(59,130,246,0.12),
        inset 0 1px 0 rgba(255,255,255,0.95),
        0 8px 18px rgba(59,130,246,0.10);
}

.inline-input {
    min-width: 90px;
}

.alloc-flag,
.alloc-coupon-type {
    min-width: 110px;
}

.alloc-mseq {
    min-width: 110px;
}

.alloc-supply-price {
    min-width: 110px;
}

.inline-select {
    min-width: 88px;
}

.remove-row-btn {
    padding: 8px 12px;
    border-radius: 12px;
    background: linear-gradient(180deg, #fda4af 0%, #ef4444 100%);
    font-size: 12px;
}

.copy-row-btn {
    padding: 8px 12px;
    border-radius: 12px;
    background: linear-gradient(180deg, #c4b5fd 0%, #8b5cf6 100%);
    font-size: 12px;
}

.add-child-row-btn {
    padding: 8px 12px;
    border-radius: 12px;
    background: linear-gradient(180deg, #86efac 0%, #22c55e 100%);
    font-size: 12px;
}

.allocation-row-regular td:first-child {
    font-weight: 700;
}

.allocation-row-extra td {
    background: rgba(248, 250, 252, 0.96);
}

.allocation-row-extra .row-round {
    color: #2563eb;
}

.preview-month-hit {
    background: #fff176 !important;
    font-weight: 700;
    text-align: center;
}

.preview-month-empty {
    color: #cbd5e1;
    text-align: center;
}

.allocation-summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    padding: 16px 18px 18px;
}

.summary-box {
    background: rgba(255,255,255,0.74);
    border: 1px solid rgba(226, 232, 240, 0.8);
    border-radius: 18px;
    padding: 16px 18px;
}

.summary-box span {
    display: block;
    font-size: 13px;
    color: #64748b;
    margin-bottom: 6px;
}

.summary-box strong {
    font-size: 22px;
    color: #0f172a;
}

.allocation-chart-panel {
    margin: 0 18px 18px;
    padding: 20px;
    border-radius: 24px;
    background:
        radial-gradient(circle at top right, rgba(59, 130, 246, 0.10), transparent 30%),
        linear-gradient(180deg, rgba(255,255,255,0.96) 0%, rgba(248,250,252,0.94) 100%);
    color: #0f172a;
    border: 1px solid rgba(226, 232, 240, 0.95);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.96),
        0 16px 28px rgba(15, 23, 42, 0.06);
    contain: layout paint;
}

.allocation-chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}

.allocation-chart-header h4 {
    color: #0f172a;
}

.allocation-chart-header p {
    margin: 6px 0 0;
    color: #64748b;
    font-size: 13px;
}

.allocation-trend-chart {
    min-height: 250px;
    contain: layout paint;
}

.chart-empty-state {
    display: grid;
    place-items: center;
    min-height: 260px;
    border: 1px dashed rgba(148, 163, 184, 0.35);
    border-radius: 20px;
    color: #64748b;
    background: rgba(255,255,255,0.52);
    text-align: center;
    padding: 24px;
}

.light-chart-shell {
    display: grid;
    gap: 18px;
}

.light-chart-header {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-end;
}

.light-chart-header strong {
    display: block;
    font-size: 16px;
    color: #0f172a;
    margin-bottom: 4px;
}

.light-chart-header span {
    font-size: 13px;
    color: #64748b;
}

.light-chart-peak {
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(239, 246, 255, 0.95);
    color: #2563eb;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.light-trend-svg {
    display: block;
    width: auto;
    min-width: 100%;
    height: auto;
    padding: 14px 14px 4px;
    border-radius: 20px;
    background: linear-gradient(180deg, rgba(248,250,252,0.96) 0%, rgba(241,245,249,0.92) 100%);
    border: 1px solid rgba(226, 232, 240, 0.95);
    overflow: visible;
}

.chart-grid-line-light {
    stroke: rgba(148, 163, 184, 0.22);
    stroke-width: 1;
}

.chart-axis-text-light {
    font-size: 11px;
    fill: #64748b;
}

.chart-area-fill-light {
    fill: url(#lightTrendAreaGradient);
}

.chart-line-light {
    fill: none;
    stroke: #2563eb;
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.chart-point-light {
    fill: #ffffff;
    stroke: #2563eb;
    stroke-width: 3;
}

.chart-range-pill-light {
    fill: url(#lightTrendRangeGradient);
    opacity: 0.9;
}

.chart-range-tail-light {
    fill: none;
    stroke: rgba(37, 99, 235, 0.65);
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.chart-range-label-light {
    font-size: 11px;
    font-weight: 700;
    fill: #ffffff;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 20px;
}

.crm-hero-card {
    background:
        radial-gradient(circle at top right, rgba(37, 99, 235, 0.18), transparent 30%),
        radial-gradient(circle at top left, rgba(16, 185, 129, 0.12), transparent 28%),
        rgba(255,255,255,0.58);
}

.crm-table {
    min-width: 860px;
    border-spacing: 0 8px;
    background: transparent;
}

.crm-table.crm-table-business {
    width: 100%;
    table-layout: fixed;
}

.crm-list-title-row {
    display: inline-flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    min-height: 46px;
    overflow: visible;
}

.crm-section-header {
    align-items: center;
    z-index: 12;
}

.crm-business-filter-group {
    display: inline-flex;
    align-items: center;
    position: relative;
    z-index: 24;
}

.crm-status-toggle-group {
    gap: 8px;
}

.crm-status-toggle-btn {
    min-width: 84px;
}

.crm-status-toggle-btn.active {
    border-color: rgba(37, 99, 235, 0.22);
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.12), rgba(59, 130, 246, 0.08));
    color: #1d4ed8;
}

.crm-status-toggle-sales.active {
    border-color: rgba(37, 99, 235, 0.26);
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.16), rgba(125, 211, 252, 0.12));
    color: #1d4ed8;
}

.crm-status-toggle-progress.active {
    border-color: rgba(124, 58, 237, 0.28);
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.18), rgba(124, 58, 237, 0.1));
    color: #7c3aed;
}

.crm-status-toggle-done.active {
    border-color: rgba(5, 150, 105, 0.28);
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.18), rgba(5, 150, 105, 0.1));
    color: #047857;
}

.crm-filter-search-field {
    gap: 8px;
}

.crm-filter-select {
    width: 78px;
    min-width: 78px;
    height: 100%;
    border: 0;
    border-right: 1px solid rgba(203, 213, 225, 0.82);
    background: transparent;
    color: #334155;
    font-size: 13px;
    font-weight: 800;
    outline: none;
}

.crm-table thead th {
    font-size: 14px;
    padding: 16px 14px;
}

.crm-table tbody td {
    font-size: 14px;
    line-height: 1.55;
}

.crm-view-toolbar {
    align-items: center;
    gap: 12px;
    flex-wrap: nowrap;
    min-height: 46px;
}

.crm-journal-action-group {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    flex-wrap: nowrap;
}

#crmBusinessSearchBox {
    width: 220px;
    min-width: 220px;
}

#crmJournalSearchBox {
    width: 360px;
    min-width: 360px;
}

#crmJournalSearchBox .business-search-field {
    display: flex;
    align-items: center;
    min-height: 48px;
    border-radius: 16px;
    background: linear-gradient(180deg, rgba(255,255,255,0.94) 0%, rgba(240,246,255,0.92) 100%);
    border: 1px solid rgba(148, 163, 184, 0.28);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.92),
        0 8px 16px rgba(15, 23, 42, 0.05);
    overflow: hidden;
}

#crmJournalSearchBox .sales-search-input {
    min-height: 46px;
    padding-right: 42px;
    border: 0;
    background: transparent;
    box-shadow: none;
}

#crmJournalSearchBox .business-search-icon {
    right: 14px;
}

.crm-name-cell {
    font-weight: 800;
    text-align: left;
    width: 238px;
    max-width: 238px;
    padding-left: 72px;
    padding-right: 12px;
}

.crm-name-link {
    display: block;
    padding: 0;
    margin: 0;
    border: 0;
    border-radius: 0;
    appearance: none;
    -webkit-appearance: none;
    background: transparent;
    box-shadow: none;
    outline: none;
    transform: none !important;
    transition: color 0.15s ease;
    color: #0f172a;
    font-family: "Pretendard Variable", "Pretendard", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 15px;
    font-weight: 900;
    line-height: 1.25;
    text-decoration: none;
    text-shadow: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.crm-name-link:hover {
    color: #7c3aed;
    text-decoration: underline;
}

.crm-table.crm-table-business .crm-col-name {
    width: 238px;
}

.crm-memo-cell {
    max-width: 520px;
    white-space: normal;
    text-align: left;
    line-height: 1.45;
}

.crm-memo-cell.center-cell {
    text-align: center;
}

.crm-status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 7px 12px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 800;
    line-height: 1;
    white-space: nowrap;
}

.crm-progress-cell {
    min-width: 148px;
}

.crm-progress-meter {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.crm-progress-bar-track {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    width: 84px;
    height: 14px;
    padding: 3px;
    border-radius: 999px;
    background:
        linear-gradient(180deg, rgba(226, 232, 240, 0.72) 0%, rgba(241, 245, 249, 0.92) 100%);
    border: 1px solid rgba(191, 219, 254, 0.85);
    box-shadow:
        inset 0 1px 2px rgba(255,255,255,0.95),
        0 8px 16px rgba(148, 163, 184, 0.08);
    overflow: hidden;
}

.crm-progress-bar-fill {
    display: block;
    width: 0;
    height: 100%;
    min-width: 8px;
    border-radius: 999px;
    background:
        linear-gradient(
            90deg,
            hsl(calc(210 - (var(--progress-rate) * 0.35)) 92% 76%) 0%,
            hsl(calc(224 - (var(--progress-rate) * 0.6)) 82% 56%) 48%,
            hsl(calc(197 - (var(--progress-rate) * 0.42)) 76% 46%) 100%
        );
    box-shadow:
        0 0 16px hsla(calc(214 - (var(--progress-rate) * 0.38)) 88% 58% / 0.28),
        inset 0 1px 0 rgba(255,255,255,0.42);
    transition: width 0.22s ease, background 0.22s ease, box-shadow 0.22s ease;
}

.crm-progress-value {
    min-width: 42px;
    text-align: left;
    font-size: 13px;
    font-weight: 800;
    color: #2563eb;
    letter-spacing: -0.01em;
}

.crm-priority-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    padding: 7px 10px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 800;
    line-height: 1;
    white-space: nowrap;
}

.crm-priority-badge-high {
    background: linear-gradient(135deg, rgba(71, 85, 105, 0.92), rgba(51, 65, 85, 0.86));
    color: #f8fafc;
}

.crm-priority-badge-medium {
    background: linear-gradient(135deg, rgba(226, 232, 240, 0.96), rgba(203, 213, 225, 0.94));
    color: #334155;
}

.crm-priority-badge-low {
    background: linear-gradient(135deg, rgba(248, 250, 252, 0.98), rgba(241, 245, 249, 0.96));
    color: #64748b;
    border: 1px solid rgba(226, 232, 240, 0.96);
}

.crm-status-sales {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.18), rgba(37, 99, 235, 0.1));
    color: #1d4ed8;
}

.crm-status-hold {
    background: linear-gradient(135deg, rgba(148, 163, 184, 0.24), rgba(100, 116, 139, 0.12));
    color: #475569;
}

.crm-status-progress {
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.18), rgba(124, 58, 237, 0.1));
    color: #7c3aed;
}

.crm-status-done {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.18), rgba(5, 150, 105, 0.1));
    color: #047857;
}

.crm-journal-row td {
    vertical-align: top;
    padding: 16px;
    background: rgba(255, 255, 255, 0.78);
    border-top: 1px solid rgba(226, 232, 240, 0.82);
    border-bottom: 1px solid rgba(226, 232, 240, 0.82);
}

.crm-journal-row td:first-child {
    border-left: 1px solid rgba(226, 232, 240, 0.82);
    border-radius: 18px 0 0 18px;
}

.crm-journal-row td:last-child {
    border-right: 1px solid rgba(226, 232, 240, 0.82);
    border-radius: 0 18px 18px 0;
}

.crm-journal-row:hover td {
    background: rgba(248, 250, 252, 0.96);
}

.crm-journal-business-cell {
    text-align: center;
    width: 240px;
    min-width: 210px;
    border-right: 1px solid rgba(226, 232, 240, 0.9);
    vertical-align: middle !important;
}

.crm-journal-business-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    max-width: 100%;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
    white-space: normal;
    text-align: center;
    line-height: 1.5;
    color: #1e293b;
    font-size: 15px;
    font-weight: 900;
    text-decoration: none;
    word-break: keep-all;
    overflow-wrap: anywhere;
}

.crm-journal-business-link:hover {
    color: #7c3aed;
    text-decoration: underline;
}

.crm-journal-memo-cell {
    min-width: 420px;
    text-align: left;
    white-space: normal;
}

.crm-journal-memo-block {
    display: block;
    width: 100%;
    min-height: 28px;
    color: #0f172a;
    font-size: 14px;
    line-height: 1.75;
    white-space: pre-wrap;
    word-break: keep-all;
    overflow-wrap: anywhere;
}

.crm-search-highlight {
    display: inline;
    padding: 0 3px;
    border-radius: 4px;
    background: #fef08a;
    color: #713f12;
    font-weight: 900;
}

.crm-journal-pagination {
    justify-content: flex-end;
    margin-top: 14px;
}

.crm-journal-pagination:empty {
    display: none;
}

.crm-journal-date-cell {
    width: 132px;
    min-width: 120px;
    text-align: center;
    vertical-align: middle !important;
}

.crm-journal-edit-cell {
    width: 124px;
    min-width: 110px;
    text-align: center;
    vertical-align: middle !important;
}

.crm-journal-action-buttons {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.crm-journal-date {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(239, 246, 255, 0.92);
    color: #2563eb;
    font-size: 13px;
    font-weight: 800;
}

.crm-journal-action-btn {
    min-height: 28px;
    padding: 4px 9px;
    border-radius: 10px;
    border: 1px solid rgba(203, 213, 225, 0.95);
    background: rgba(255, 255, 255, 0.96);
    box-shadow: none;
    color: #475569;
    font-size: 12px;
    font-weight: 800;
    line-height: 1;
}

.crm-journal-edit-link,
.crm-history-edit {
    color: #475569;
}

.crm-journal-edit-link:hover,
.crm-history-edit:hover {
    color: #2563eb;
    border-color: rgba(147, 197, 253, 0.95);
    background: rgba(239, 246, 255, 0.96);
}

.crm-journal-delete-link,
.crm-history-delete {
    color: #dc2626;
}

.crm-journal-delete-link:hover,
.crm-history-delete:hover {
    color: #b91c1c;
    border-color: rgba(252, 165, 165, 0.95);
    background: rgba(254, 242, 242, 0.96);
}

.crm-modal-content {
    width: min(1380px, 96vw);
    max-height: 94vh;
    overflow-y: auto;
    background: #ffffff;
    border-radius: 28px;
    padding: 30px;
    box-shadow: 0 30px 70px rgba(15,23,42,0.24);
}

.crm-modal-top-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(360px, 0.65fr);
    gap: 18px;
    align-items: stretch;
}

.crm-modal-left-stack {
    display: grid;
    grid-template-rows: auto auto;
    gap: 18px;
    align-content: start;
    margin-top: 4px;
}

.crm-info-panel {
    display: flex;
    flex-direction: column;
    height: auto;
    padding: 20px 22px;
    border: 1px solid rgba(203, 213, 225, 0.72);
    border-radius: 22px;
    background:
        radial-gradient(circle at top left, rgba(255,255,255,0.96), rgba(248, 250, 252, 0.9) 48%, rgba(241, 245, 249, 0.88) 100%);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.88),
        0 16px 28px rgba(15, 23, 42, 0.06);
}

.crm-info-panel h4 {
    margin-bottom: 14px;
}

.crm-info-form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px 16px;
    align-content: start;
}

.crm-info-field {
    display: grid;
    gap: 8px;
}

.crm-info-field label {
    font-size: 13px;
    font-weight: 800;
    color: #475569;
}

.crm-info-field input,
.crm-info-field select {
    min-height: 52px;
    border-radius: 18px;
    border: 1px solid rgba(226, 232, 240, 0.95);
    background: rgba(255, 255, 255, 0.92);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.92),
        0 10px 20px rgba(148, 163, 184, 0.08);
    padding: 0 16px;
}

.crm-info-subsection {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid rgba(226, 232, 240, 0.92);
}

.crm-info-subsection-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.crm-info-subsection-header h5 {
    margin: 0;
    font-size: 15px;
    color: #1e293b;
}

.crm-info-subsection-header span {
    font-size: 12px;
    font-weight: 700;
    color: #94a3b8;
}

.crm-status-section {
    display: grid;
    gap: 12px;
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid rgba(226, 232, 240, 0.92);
}

.crm-status-label {
    font-size: 13px;
    font-weight: 700;
    color: #475569;
}

.crm-status-button-group {
    display: contents;
}

.crm-status-row {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 10px;
    align-items: stretch;
}

.crm-status-btn {
    min-width: 0;
    width: 100%;
    border-radius: 999px;
    padding: 10px 16px;
    background: rgba(255, 255, 255, 0.92);
    color: #475569;
    border: 1px solid rgba(203, 213, 225, 0.9);
    box-shadow: none;
    font-size: 14px;
    font-weight: 700;
}

.crm-status-btn.active {
    border-color: rgba(124, 58, 237, 0.18);
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.12), rgba(59, 130, 246, 0.1));
    color: #6d28d9;
}

.crm-subscription-open-btn {
    min-width: 0;
    width: 100%;
    min-height: 0;
    padding: 10px 16px;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 700;
    white-space: nowrap;
    align-self: auto;
    background: rgba(255, 255, 255, 0.92);
    color: #475569;
    border: 1px solid rgba(203, 213, 225, 0.9);
    box-shadow: none;
}

.crm-priority-section {
    margin-top: 14px;
}

.crm-priority-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.crm-priority-btn {
    min-width: 0;
    width: 100%;
    border-radius: 999px;
    padding: 10px 16px;
    background: rgba(255, 255, 255, 0.92);
    color: #475569;
    border: 1px solid rgba(203, 213, 225, 0.9);
    box-shadow: none;
    font-size: 14px;
    font-weight: 700;
}

.crm-priority-high.active {
    border-color: rgba(71, 85, 105, 0.34);
    background: linear-gradient(135deg, rgba(71, 85, 105, 0.96), rgba(51, 65, 85, 0.9));
    color: #f8fafc;
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.16),
        0 10px 18px rgba(51, 65, 85, 0.14);
}

.crm-priority-medium.active {
    border-color: rgba(148, 163, 184, 0.32);
    background: linear-gradient(135deg, rgba(226, 232, 240, 0.98), rgba(203, 213, 225, 0.94));
    color: #334155;
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.62),
        0 10px 18px rgba(148, 163, 184, 0.12);
}

.crm-priority-low.active {
    border-color: rgba(203, 213, 225, 0.3);
    background: linear-gradient(135deg, rgba(248, 250, 252, 0.98), rgba(241, 245, 249, 0.96));
    color: #64748b;
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.8),
        0 10px 18px rgba(226, 232, 240, 0.12);
}

.crm-sales-status-card {
    display: grid;
    gap: 14px;
    padding: 16px;
    border-radius: 20px;
    border: 1px solid rgba(203, 213, 225, 0.82);
    background:
        radial-gradient(circle at top left, rgba(219, 234, 254, 0.42), transparent 34%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.88) 0%, rgba(248, 250, 252, 0.92) 100%);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.92),
        0 12px 24px rgba(148, 163, 184, 0.08);
}

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

.crm-sales-status-card-header h5 {
    margin: 0;
    color: #0f172a;
    font-size: 16px;
    font-weight: 900;
}

.crm-sales-status-card-header span {
    color: #94a3b8;
    font-size: 12px;
    font-weight: 800;
}

.crm-sales-status-card .crm-status-section {
    margin-top: 0;
    padding-top: 14px;
    border-top: 1px solid rgba(226, 232, 240, 0.88);
}

.crm-sales-status-card-header + .crm-status-section {
    padding-top: 0;
    border-top: 0;
}

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

.crm-contract-panel {
    height: 100%;
    margin-top: 4px;
    padding: 18px 22px;
    border: 1px solid rgba(191, 219, 254, 0.88);
    border-radius: 22px;
    background:
        radial-gradient(circle at top right, rgba(59, 130, 246, 0.12), transparent 32%),
        linear-gradient(180deg, rgba(239, 246, 255, 0.92) 0%, rgba(248, 250, 252, 0.92) 100%);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.9),
        0 12px 30px rgba(37, 99, 235, 0.08);
}

.crm-contract-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.crm-contract-header h4 {
    font-size: 17px;
    line-height: 1.2;
    white-space: nowrap;
}

.crm-contract-header-actions {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    flex-wrap: nowrap;
}

.crm-contract-bulk-btn {
    min-height: 34px;
    padding: 7px 11px;
    border-radius: 999px;
    border: 1px solid rgba(147, 197, 253, 0.88);
    background: linear-gradient(180deg, rgba(255,255,255,0.96) 0%, rgba(239, 246, 255, 0.96) 100%);
    color: #1d4ed8;
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.92),
        0 8px 14px rgba(59, 130, 246, 0.08);
}

.crm-contract-bulk-btn:hover {
    border-color: rgba(96, 165, 250, 0.96);
    background: linear-gradient(180deg, rgba(255,255,255,0.98) 0%, rgba(219, 234, 254, 0.92) 100%);
    color: #1e40af;
}

.crm-contract-progress-group {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-wrap: nowrap;
    justify-content: flex-end;
}

.crm-contract-progress-summary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 74px;
    min-height: 34px;
    padding: 7px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.88);
    border: 1px solid rgba(147, 197, 253, 0.92);
    color: #1d4ed8;
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}

.crm-contract-progress-rate {
    min-width: 64px;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.96), rgba(59, 130, 246, 0.84));
    border-color: rgba(37, 99, 235, 0.82);
    color: #ffffff;
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.22),
        0 10px 18px rgba(37, 99, 235, 0.2);
}

.crm-contract-process-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.crm-contract-memo-section {
    display: grid;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(191, 219, 254, 0.72);
}

.crm-contract-memo-label {
    font-size: 13px;
    font-weight: 800;
    color: #475569;
}

.crm-contract-memo-section textarea {
    width: 100%;
    min-height: 148px;
    resize: vertical;
    border-radius: 18px;
    border: 1px solid rgba(191, 219, 254, 0.92);
    background: rgba(255, 255, 255, 0.94);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.94),
        0 12px 20px rgba(148, 163, 184, 0.08);
    padding: 14px 16px;
    font-size: 14px;
    line-height: 1.7;
    color: #1e293b;
}

.crm-modal-middle-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 18px;
    margin-top: 18px;
}

.crm-business-todo-panel,
.crm-recent-mail-panel {
    padding: 20px 22px;
    border: 1px solid rgba(191, 219, 254, 0.82);
    border-radius: 22px;
    background:
        radial-gradient(circle at top left, rgba(125, 211, 252, 0.16), transparent 30%),
        linear-gradient(180deg, rgba(248, 250, 252, 0.96) 0%, rgba(255, 255, 255, 0.96) 100%);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.92),
        0 14px 28px rgba(148, 163, 184, 0.08);
}

.crm-business-todo-panel {
    border-color: rgba(186, 230, 253, 0.9);
    background:
        radial-gradient(circle at top right, rgba(14, 165, 233, 0.14), transparent 32%),
        linear-gradient(180deg, rgba(240, 249, 255, 0.96) 0%, rgba(255, 255, 255, 0.96) 100%);
}

.crm-business-todo-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.crm-business-todo-header h4 {
    margin-bottom: 6px;
}

.crm-business-todo-pagination {
    gap: 6px;
    flex-shrink: 0;
}

.crm-business-todo-actions {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

.crm-business-todo-pagination:empty {
    display: none;
}

.crm-business-todo-pagination .sales-page-btn {
    min-width: 34px;
    padding: 7px 11px;
}

.crm-business-todo-list {
    display: grid;
    gap: 10px;
    margin-top: 14px;
}

.crm-business-todo-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    min-height: 62px;
    padding: 12px 14px;
    border-radius: 18px;
    border: 1px solid rgba(186, 230, 253, 0.94);
    background: rgba(255, 255, 255, 0.96);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.96),
        0 10px 20px rgba(14, 165, 233, 0.07);
    cursor: pointer;
    transition: box-shadow 0.15s ease, background 0.15s ease;
}

.crm-business-todo-item:hover {
    background: rgba(240, 249, 255, 0.98);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.96),
        0 12px 24px rgba(14, 165, 233, 0.13);
}

.crm-business-todo-item.is-done {
    background: rgba(248, 250, 252, 0.9);
    border-color: rgba(226, 232, 240, 0.94);
}

.crm-business-todo-main {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 10px;
    align-items: start;
    min-width: 0;
}

.crm-business-todo-checkbox {
    width: 20px;
    height: 20px;
    margin-top: 2px;
    border-radius: 8px;
    accent-color: #0ea5e9;
    cursor: pointer;
}

.crm-business-todo-status-dot {
    width: 10px;
    height: 10px;
    margin-top: 7px;
    border-radius: 999px;
    background: #0ea5e9;
    box-shadow: 0 0 0 4px rgba(14, 165, 233, 0.1);
}

.crm-business-todo-item.is-done .crm-business-todo-status-dot {
    background: #94a3b8;
    box-shadow: 0 0 0 4px rgba(148, 163, 184, 0.12);
}

.crm-business-todo-title {
    margin: 0;
    color: #0f172a;
    font-size: 14px;
    font-weight: 850;
    line-height: 1.45;
    word-break: keep-all;
    overflow-wrap: anywhere;
}

.crm-business-todo-title .ai-todo-inline-mention {
    min-height: 26px;
    padding: 3px 10px;
    font-size: 14px;
}

.crm-business-todo-item.is-done .crm-business-todo-title {
    color: #64748b;
    text-decoration: line-through;
}

.crm-business-todo-meta {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 5px;
    color: #64748b;
    font-size: 12px;
    font-weight: 700;
}

.crm-business-todo-badges {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    flex-wrap: wrap;
}

.crm-business-todo-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 26px;
    padding: 5px 9px;
    border-radius: 999px;
    border: 1px solid rgba(203, 213, 225, 0.9);
    background: rgba(248, 250, 252, 0.96);
    color: #475569;
    font-size: 12px;
    font-weight: 900;
    white-space: nowrap;
}

.crm-business-todo-badge.is-high {
    border-color: rgba(251, 191, 36, 0.5);
    background: rgba(255, 251, 235, 0.96);
    color: #b45309;
}

.crm-business-todo-badge.is-medium {
    border-color: rgba(147, 197, 253, 0.75);
    background: rgba(239, 246, 255, 0.96);
    color: #1d4ed8;
}

.crm-business-todo-badge.is-low {
    border-color: rgba(203, 213, 225, 0.9);
    background: rgba(248, 250, 252, 0.96);
    color: #64748b;
}

.crm-business-todo-badge.is-status {
    border-color: rgba(186, 230, 253, 0.9);
    background: rgba(240, 249, 255, 0.96);
    color: #0369a1;
}

.crm-business-todo-delete-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    min-width: 28px;
    height: 28px;
    min-height: 28px;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: rgba(100, 116, 139, 0.42);
    font-size: 21px;
    font-weight: 900;
    line-height: 1;
    box-shadow: none;
    cursor: pointer;
    transition: color 0.16s ease, background 0.16s ease, transform 0.16s ease;
}

.crm-business-todo-delete-btn:hover {
    background: rgba(254, 242, 242, 0.94);
    color: #dc2626;
    transform: scale(1.04);
}

.crm-business-todo-empty {
    padding: 18px 20px;
    border-radius: 18px;
    border: 1px dashed rgba(125, 211, 252, 0.95);
    background: rgba(255, 255, 255, 0.88);
    color: #64748b;
    font-size: 14px;
    line-height: 1.7;
}

.crm-business-todo-empty strong {
    color: #0369a1;
}

.crm-recent-mail-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.crm-recent-mail-header h4 {
    margin-bottom: 6px;
}

.crm-recent-mail-actions {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.crm-recent-mail-list {
    display: grid;
    gap: 12px;
    margin-top: 14px;
}

.crm-recent-mail-empty {
    padding: 18px 20px;
    border-radius: 18px;
    border: 1px dashed rgba(191, 219, 254, 0.9);
    background: rgba(255, 255, 255, 0.88);
    color: #64748b;
    font-size: 14px;
    line-height: 1.7;
}

.crm-recent-mail-item {
    display: grid;
    gap: 8px;
    border-radius: 18px;
    border: 1px solid rgba(191, 219, 254, 0.9);
    background: rgba(255, 255, 255, 0.96);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.96),
        0 10px 20px rgba(148, 163, 184, 0.08);
    transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
    overflow: hidden;
}

.crm-recent-mail-item:hover {
    transform: translateY(-1px);
    border-color: rgba(96, 165, 250, 0.96);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.96),
        0 14px 24px rgba(59, 130, 246, 0.12);
}

.crm-recent-mail-item.is-expanded {
    border-color: rgba(96, 165, 250, 0.96);
}

.crm-recent-mail-trigger {
    display: grid;
    gap: 8px;
    width: 100%;
    padding: 16px 18px;
    border: 0;
    background: transparent;
    color: inherit;
    text-align: left;
    box-shadow: none;
}

.crm-recent-mail-top {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.crm-recent-mail-direction-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    padding: 5px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 900;
    letter-spacing: -0.01em;
    white-space: nowrap;
    border: 1px solid rgba(191, 219, 254, 0.96);
}

.crm-recent-mail-direction-badge.is-received {
    background: rgba(239, 246, 255, 0.98);
    color: #1d4ed8;
}

.crm-recent-mail-direction-badge.is-sent {
    background: rgba(237, 233, 254, 0.96);
    color: #7c3aed;
    border-color: rgba(196, 181, 253, 0.9);
}

.crm-recent-mail-subject {
    font-size: 15px;
    font-weight: 800;
    line-height: 1.5;
    color: #0f172a;
    word-break: keep-all;
    overflow-wrap: anywhere;
}

.crm-recent-mail-meta {
    font-size: 13px;
    color: #64748b;
}

.crm-recent-mail-meta-label {
    font-weight: 800;
    color: #475569;
}

.crm-recent-mail-detail {
    display: grid;
    gap: 12px;
    padding: 0 18px 18px;
    border-top: 1px solid rgba(219, 234, 254, 0.92);
}

.crm-recent-mail-detail-meta {
    display: grid;
    gap: 6px;
    margin-top: 14px;
    color: #475569;
    font-size: 13px;
    line-height: 1.5;
}

.crm-recent-mail-detail-meta strong {
    color: #0f172a;
    margin-right: 6px;
}

.crm-recent-mail-detail-body,
.crm-recent-mail-detail-empty {
    padding: 14px 16px;
    border-radius: 16px;
    background: rgba(248, 250, 252, 0.92);
    border: 1px solid rgba(226, 232, 240, 0.92);
    color: #1e293b;
    font-size: 14px;
    line-height: 1.75;
    white-space: normal;
    word-break: keep-all;
    overflow-wrap: anywhere;
}

.crm-recent-mail-detail-empty {
    color: #64748b;
}

.crm-recent-mail-detail-actions {
    display: flex;
    justify-content: flex-end;
}

.crm-outlook-auth-box {
    display: grid;
    gap: 8px;
    margin-top: 14px;
    padding: 14px 16px;
    border-radius: 18px;
    border: 1px solid rgba(191, 219, 254, 0.92);
    background: linear-gradient(180deg, rgba(239, 246, 255, 0.82) 0%, rgba(255, 255, 255, 0.96) 100%);
}

.crm-outlook-auth-code-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.crm-outlook-auth-code-label {
    font-size: 12px;
    font-weight: 800;
    color: #475569;
}

.crm-recent-mail-actions #crmOutlookAuthBtn {
    min-width: 96px;
}

.crm-recent-mail-pagination {
    gap: 6px;
}

.crm-recent-mail-pagination:empty {
    display: none;
}

.crm-recent-mail-pagination .sales-page-btn {
    min-width: 34px;
    padding: 7px 11px;
}

.crm-outlook-auth-code-row strong {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 0 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid rgba(147, 197, 253, 0.96);
    color: #1d4ed8;
    font-size: 14px;
    font-weight: 900;
    letter-spacing: 0.08em;
}

.crm-outlook-auth-copy-btn,
.crm-outlook-auth-code-row a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 32px;
    padding: 0 12px;
    border-radius: 999px;
    border: 1px solid rgba(191, 219, 254, 0.92);
    background: rgba(255, 255, 255, 0.96);
    color: #1d4ed8;
    font-size: 12px;
    font-weight: 800;
    text-decoration: none;
}

.crm-outlook-auth-copy-btn:hover,
.crm-outlook-auth-code-row a:hover {
    border-color: rgba(96, 165, 250, 0.96);
    background: rgba(239, 246, 255, 0.96);
}

.crm-outlook-auth-message {
    margin: 0;
    font-size: 13px;
    line-height: 1.6;
    color: #475569;
}

.crm-contract-step {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    width: 100%;
    min-height: 46px;
    padding: 7px 10px;
    border-radius: 14px;
    border: 1px solid rgba(191, 219, 254, 0.98);
    background:
        linear-gradient(180deg, rgba(255,255,255,0.98) 0%, rgba(247, 250, 255, 0.94) 100%);
    color: #334155;
    text-align: left;
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.96),
        0 8px 18px rgba(148, 163, 184, 0.08);
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background 0.18s ease, color 0.18s ease;
}

.crm-contract-step:hover {
    transform: translateY(-1px);
    border-color: rgba(96, 165, 250, 0.96);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.95),
        0 12px 22px rgba(59, 130, 246, 0.12);
}

.crm-contract-step.active {
    border-color: rgba(37, 99, 235, 0.92);
    background:
        linear-gradient(145deg, rgba(37, 99, 235, 0.96), rgba(56, 189, 248, 0.88));
    color: #eff6ff;
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.24),
        0 18px 30px rgba(37, 99, 235, 0.24);
}

.crm-contract-step-order {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 30px;
    padding: 0 7px;
    border-radius: 11px;
    background: rgba(219, 234, 254, 0.96);
    color: #1d4ed8;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.04em;
}

.crm-contract-step.active .crm-contract-step-order {
    background: rgba(255, 255, 255, 0.18);
    color: #ffffff;
}

.crm-contract-step-label {
    font-size: 11.5px;
    font-weight: 800;
    line-height: 1.28;
    word-break: keep-all;
    overflow-wrap: anywhere;
}

.crm-history-panel {
    margin-top: 20px;
    padding: 20px 22px;
    border: 1px solid rgba(203, 213, 225, 0.7);
    border-radius: 20px;
    background: rgba(248, 250, 252, 0.78);
    min-height: 320px;
}

.crm-history-list {
    display: grid;
    gap: 14px;
    margin-top: 12px;
    color: #64748b;
    font-size: 15px;
    align-content: start;
}

.crm-history-item {
    display: grid;
    grid-template-columns: 128px minmax(0, 1fr) auto;
    gap: 16px;
    align-items: start;
    padding: 18px 16px;
    border-radius: 18px;
    background: rgba(255,255,255,0.88);
    border: 1px solid rgba(219, 234, 254, 0.96);
    color: #0f172a;
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.92),
        0 12px 24px rgba(148, 163, 184, 0.08);
}

.crm-history-item strong {
    color: #2563eb;
    font-size: 15px;
    line-height: 1.7;
}

.crm-history-item-memo {
    white-space: pre-wrap;
    word-break: keep-all;
    overflow-wrap: anywhere;
    font-size: 16px;
    line-height: 1.8;
}

.crm-history-action-row {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.crm-history-add-btn {
    min-height: 42px;
    padding-inline: 18px;
    border-radius: 999px;
    background: linear-gradient(180deg, #8fa1bb 0%, #6e7f98 100%);
    color: #ffffff;
    border-color: rgba(125, 143, 170, 0.9);
    box-shadow: 0 14px 24px rgba(100, 116, 139, 0.22);
}

.crm-history-add-btn:hover {
    background: linear-gradient(180deg, #7f92af 0%, #64748b 100%);
    color: #ffffff;
}

.crm-child-modal {
    z-index: 10050;
}

.crm-contact-modal-content {
    width: min(1120px, 96vw);
}

.crm-contact-modal-content textarea,
.crm-contact-modal-content input,
#crmJournalCreateMemo,
#crmJournalCreateDate {
    font-family: "Malgun Gothic", "맑은 고딕", "Segoe UI", sans-serif;
}

.crm-contact-modal-content textarea,
#crmJournalCreateMemo {
    font-size: 16px;
    line-height: 1.8;
    min-height: 320px;
}

.crm-modal-actions {
    justify-content: space-between;
    align-items: center;
}

.crm-modal-action-group {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.crm-hubspot-link-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.crm-hubspot-link-btn:not(:disabled) {
    background: #ff7a59;
    border-color: #ff7a59;
    color: #ffffff;
}

.crm-hubspot-link-btn:not(:disabled):hover {
    background: #f25f3a;
    border-color: #f25f3a;
    color: #ffffff;
}

#crmDeleteBtn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.search-modal-content {
    max-width: 1100px;
}

.search-panel {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 14px;
    border: 1px solid rgba(203, 213, 225, 0.7);
    border-radius: 16px;
    background: rgba(248, 250, 252, 0.72);
    margin-bottom: 14px;
}

.search-row {
    display: grid;
    grid-template-columns: 180px 1fr;
    align-items: center;
    gap: 10px;
}

.search-input-inline {
    display: flex;
    gap: 10px;
}

.search-input-inline input {
    flex: 1;
}

.search-input-inline button {
    white-space: nowrap;
}

.search-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.search-hint {
    margin: 0;
    color: #64748b;
    font-size: 12px;
}

.hidden {
    display: none !important;
}

.search-result {
    border: 1px solid rgba(203, 213, 225, 0.7);
    border-radius: 16px;
    background: rgba(255,255,255,0.72);
    min-height: 280px;
    max-height: 52vh;
    overflow-y: auto;
    padding: 16px;
    line-height: 1.6;
    color: #0f172a;
    font-size: 14px;
}

.search-answer a {
    color: #2563eb;
}

.search-summary {
    display: grid;
    gap: 14px;
}

.search-company-name {
    margin: 0;
    font-size: 24px;
    font-weight: 800;
    color: #0f172a;
    letter-spacing: -0.02em;
}

.search-card-grid {
    display: grid;
    gap: 12px;
}

.search-info-card {
    padding: 16px 18px;
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(248,250,252,0.95) 0%, rgba(241,245,249,0.92) 100%);
    border: 1px solid rgba(226, 232, 240, 0.98);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.85),
        0 8px 18px rgba(15, 23, 42, 0.05);
}

.search-info-card-strong {
    background: linear-gradient(180deg, rgba(239,246,255,0.98) 0%, rgba(219,234,254,0.95) 100%);
    border-color: rgba(147, 197, 253, 0.95);
}

.search-card-label {
    font-size: 13px;
    font-weight: 700;
    color: #475569;
    margin-bottom: 8px;
}

.search-card-value {
    font-size: 26px;
    font-weight: 800;
    color: #0f172a;
    letter-spacing: -0.03em;
    word-break: keep-all;
}

.search-paragraph {
    margin: 0 0 12px;
    color: #334155;
}

.search-model {
    display: inline-block;
    margin-bottom: 10px;
    padding: 4px 8px;
    border-radius: 8px;
    font-size: 12px;
    color: #334155;
    background: #e2e8f0;
}

.search-loading,
.search-error {
    color: #334155;
    font-weight: 600;
}

.sales-hero-card {
    overflow: hidden;
    background:
        radial-gradient(circle at top right, rgba(96, 165, 250, 0.22), transparent 28%),
        radial-gradient(circle at top left, rgba(251, 191, 36, 0.16), transparent 26%),
        rgba(255, 255, 255, 0.62);
}

.sales-header {
    align-items: flex-start;
}

.sales-subtitle {
    margin: 8px 0 0;
    color: #475569;
    font-size: 14px;
}

.sales-toolbar {
    display: flex;
    gap: 10px;
}

.sales-filter-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: nowrap;
}

.sales-pipeline-select {
    width: 180px;
    min-width: 180px;
    max-width: 180px;
    height: 40px;
    padding: 0 12px;
    border-radius: 12px;
    border: 1px solid rgba(191, 219, 254, 0.9);
    background: rgba(255, 255, 255, 0.92);
    color: #334155;
    font-size: 13px;
    font-weight: 600;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.05);
}

.sales-search-box {
    width: 180px;
    min-width: 180px;
    max-width: 180px;
}

.sales-table-search-box {
    width: 220px;
    min-width: 220px;
    max-width: 220px;
}

.sales-search-input {
    width: 100%;
    height: 40px;
    padding: 0 38px 0 12px;
    border-radius: 12px;
    border: 1px solid rgba(191, 219, 254, 0.9);
    background: rgba(255, 255, 255, 0.92);
    color: #334155;
    font-size: 13px;
    font-weight: 600;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.05);
}

.sales-collapse-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 74px;
    height: 40px;
    padding: 0 12px;
    border-radius: 12px;
    border: 1px solid rgba(191, 219, 254, 0.9);
    background: linear-gradient(180deg, rgba(255,255,255,0.96) 0%, rgba(239,246,255,0.92) 100%);
    color: #2563eb;
    font-size: 13px;
    font-weight: 800;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.05);
}

.sales-collapse-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 12px;
    color: #1d4ed8;
    font-size: 12px;
    line-height: 1;
}

.sales-sync-banner {
    position: relative;
    z-index: 1;
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
    padding: 16px 18px;
    border: 1px solid rgba(191, 219, 254, 0.9);
    border-radius: 20px;
    background: rgba(239, 246, 255, 0.72);
    margin-bottom: 18px;
}

.sales-sync-copy {
    display: grid;
    gap: 4px;
}

.sales-sync-copy.is-loading strong {
    color: #1d4ed8;
}

.sales-sync-copy.is-connected strong {
    color: #065f46;
}

.sales-sync-copy.is-waiting strong {
    color: #9a3412;
}

.sales-sync-copy strong {
    font-size: 16px;
    color: #0f172a;
}

.sales-sync-copy span {
    color: #475569;
    font-size: 13px;
}

.sales-sync-meta {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.sales-sync-pill {
    display: inline-flex;
    align-items: center;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.82);
    color: #1d4ed8;
    font-size: 12px;
    font-weight: 700;
}

.sales-kpi-grid {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.sales-kpi-card {
    padding: 18px 20px;
    border-radius: 22px;
    background: rgba(255,255,255,0.8);
    border: 1px solid rgba(255,255,255,0.7);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.88),
        0 10px 22px rgba(15, 23, 42, 0.06);
}

.sales-kpi-label {
    font-size: 13px;
    color: #64748b;
    margin-bottom: 8px;
}

.sales-kpi-value {
    font-size: 28px;
    font-weight: 800;
    color: #0f172a;
    letter-spacing: -0.03em;
}

.sales-kpi-note {
    margin-top: 6px;
    font-size: 12px;
    color: #475569;
}

.sales-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.95fr) minmax(460px, 1fr);
    gap: 24px;
    align-items: stretch;
}

.sales-main-card,
.sales-side-card,
.sales-table-wrap {
    position: relative;
    z-index: 1;
}

.sales-main-card,
.sales-side-card {
    display: flex;
    flex-direction: column;
    height: clamp(760px, 80vh, 1180px);
    overflow: hidden;
}

.sales-main-card.is-sales-collapsed,
.sales-side-card.is-sales-collapsed {
    height: auto;
    min-height: 0;
}

.sales-pipeline-board {
    display: grid;
    gap: 18px;
    flex: 1;
    min-height: 0;
    overflow: auto;
    padding-right: 8px;
    padding-bottom: 8px;
}

.sales-pipeline-board::-webkit-scrollbar,
.sales-action-list::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

.sales-pipeline-group {
    display: grid;
    gap: 12px;
}

.sales-pipeline-group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 0 2px;
}

.sales-pipeline-group-header h4 {
    margin: 0;
    font-size: 16px;
    color: #0f172a;
}

.sales-pipeline-group-header span {
    font-size: 12px;
    font-weight: 700;
    color: #475569;
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(226, 232, 240, 0.88);
    border-radius: 999px;
    padding: 7px 10px;
}

.sales-pipeline-stage-row {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(240px, 1fr);
    gap: 14px;
    overflow-x: auto;
    padding-bottom: 4px;
}

.sales-column {
    min-width: 0;
    border-radius: 24px;
    padding: 14px;
    border: 1px solid rgba(226, 232, 240, 0.88);
    background: rgba(248, 250, 252, 0.75);
}

.sales-tone-amber { background: linear-gradient(180deg, rgba(255,251,235,0.95) 0%, rgba(255,247,237,0.92) 100%); }
.sales-tone-blue { background: linear-gradient(180deg, rgba(239,246,255,0.96) 0%, rgba(224,242,254,0.92) 100%); }
.sales-tone-violet { background: linear-gradient(180deg, rgba(245,243,255,0.96) 0%, rgba(237,233,254,0.92) 100%); }
.sales-tone-emerald { background: linear-gradient(180deg, rgba(236,253,245,0.96) 0%, rgba(220,252,231,0.92) 100%); }
.sales-tone-slate { background: linear-gradient(180deg, rgba(248,250,252,0.96) 0%, rgba(226,232,240,0.92) 100%); }

.sales-column-header {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
    margin-bottom: 14px;
}

.sales-column-header h4 {
    margin-bottom: 4px;
}

.sales-column-header p,
.sales-column-header strong {
    margin: 0;
    font-size: 12px;
    color: #475569;
}

.sales-column-header strong {
    font-size: 13px;
    font-weight: 800;
    color: #0f172a;
}

.sales-column-body {
    display: grid;
    gap: 10px;
}

.sales-deal-card,
.sales-action-card {
    padding: 14px;
    border-radius: 18px;
    background: rgba(255,255,255,0.86);
    border: 1px solid rgba(255,255,255,0.92);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.92),
        0 8px 18px rgba(15, 23, 42, 0.05);
}

.sales-deal-top,
.sales-action-top {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: center;
    margin-bottom: 6px;
}

.sales-deal-top strong,
.sales-action-top strong {
    font-size: 14px;
    color: #0f172a;
}

.sales-company-link {
    color: #0f172a;
    text-decoration: none;
    border-bottom: 1px solid rgba(37, 99, 235, 0.24);
}

.sales-company-link:hover {
    color: #2563eb;
    border-bottom-color: rgba(37, 99, 235, 0.64);
}


.sales-deal-top span,
.sales-action-top span {
    font-size: 12px;
    font-weight: 700;
    color: #2563eb;
}

.sales-deal-company,
.sales-action-meta {
    color: #475569;
    font-size: 12px;
    margin-bottom: 6px;
}

.sales-deal-stage {
    font-size: 13px;
    font-weight: 700;
    color: #111827;
    margin-bottom: 10px;
}

.sales-deal-metrics,
.sales-deal-dates,
.sales-deal-footer {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    font-size: 12px;
    color: #475569;
}

.sales-deal-dates {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(148, 163, 184, 0.2);
}

.sales-action-list {
    display: grid;
    gap: 12px;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding-right: 8px;
    padding-bottom: 8px;
}

.sales-pipeline-board::-webkit-scrollbar-thumb,
.sales-action-list::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.55);
    border-radius: 999px;
    border: 2px solid rgba(255, 255, 255, 0.65);
}

.sales-pipeline-board::-webkit-scrollbar-track,
.sales-action-list::-webkit-scrollbar-track {
    background: rgba(241, 245, 249, 0.7);
    border-radius: 999px;
}

.sales-action-card p {
    margin: 0;
    color: #0f172a;
    font-size: 13px;
}

.sales-action-card.is-overdue {
    border-color: rgba(252, 165, 165, 0.95);
    background: linear-gradient(180deg, rgba(254,242,242,0.96) 0%, rgba(255,255,255,0.92) 100%);
}

.sales-empty-card {
    padding: 16px;
    border-radius: 16px;
    border: 1px dashed rgba(148, 163, 184, 0.5);
    color: #64748b;
    background: rgba(255,255,255,0.45);
    font-size: 13px;
    text-align: center;
}

.sales-table-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.sales-table-filter-group,
.sales-table-pagination {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.sales-sort-th {
    white-space: nowrap;
}

.sales-sort-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 0;
    background: transparent;
    padding: 0;
    color: inherit;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
}

.sales-sort-th.is-active .sales-sort-btn {
    color: #2563eb;
}

.sales-sort-indicator {
    font-size: 11px;
    color: #94a3b8;
}

.sales-sort-th.is-active .sales-sort-indicator {
    color: #2563eb;
}

.sales-page-btn {
    min-height: 34px;
    padding: 7px 12px;
    border-radius: 999px;
    border: 1px solid rgba(191, 219, 254, 0.9);
    background: rgba(255, 255, 255, 0.92);
    color: #475569;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
}

.sales-page-btn.is-active {
    background: #2563eb;
    border-color: #2563eb;
    color: #ffffff;
}

.sales-page-btn:disabled {
    opacity: 0.45;
    cursor: default;
}

.sales-table-page-status {
    color: #64748b;
    font-size: 13px;
    font-weight: 700;
}

.sales-table {
    min-width: 1100px;
}

.sales-table-empty {
    padding: 28px 14px;
    text-align: center;
    color: #64748b;
}

.invoice-hero-card {
    overflow: hidden;
}

.invoice-hero-card::after {
    content: "";
    position: absolute;
    inset: auto -120px -140px auto;
    width: 320px;
    height: 320px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(59,130,246,0.24) 0%, rgba(191,219,254,0.06) 62%, transparent 72%);
    pointer-events: none;
}

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

.invoice-hero-badges {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.invoice-badge {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    padding: 0 14px;
    border-radius: 999px;
    background: rgba(255,255,255,0.78);
    border: 1px solid rgba(148, 163, 184, 0.24);
    color: #334155;
    font-size: 13px;
    font-weight: 700;
    box-shadow: 0 10px 18px rgba(15, 23, 42, 0.06);
}

.invoice-badge-accent {
    background: linear-gradient(180deg, rgba(219,234,254,0.95) 0%, rgba(191,219,254,0.72) 100%);
    color: #1d4ed8;
}

.invoice-kpi-grid {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.invoice-sync-status {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 4px 0 18px;
    padding: 14px 16px;
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(255,255,255,0.84) 0%, rgba(239,246,255,0.72) 100%);
    border: 1px solid rgba(191, 219, 254, 0.8);
    color: #1e3a8a;
    font-size: 13px;
    font-weight: 700;
}

.invoice-kpi-card {
    background: linear-gradient(180deg, rgba(255,255,255,0.92) 0%, rgba(239,246,255,0.84) 100%);
}

.invoice-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(340px, 0.95fr);
    gap: 24px;
    align-items: start;
}

.invoice-side-stack {
    display: grid;
    gap: 24px;
    align-self: stretch;
}

.invoice-form-grid {
    position: relative;
    z-index: 1;
}

.invoice-form-card textarea {
    min-height: 92px;
}

.invoice-form-actions {
    position: relative;
    z-index: 1;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 20px;
}

.invoice-summary-grid {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.invoice-metric {
    padding: 18px;
    border-radius: 22px;
    background: linear-gradient(180deg, rgba(255,255,255,0.92) 0%, rgba(248,250,252,0.86) 100%);
    border: 1px solid rgba(226, 232, 240, 0.95);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.84);
}

.invoice-metric span {
    display: block;
    margin-bottom: 8px;
    font-size: 12px;
    font-weight: 700;
    color: #64748b;
}

.invoice-metric strong {
    display: block;
    font-size: 20px;
    color: #0f172a;
    word-break: break-word;
}

.invoice-metric small {
    display: block;
    margin-top: 8px;
    font-size: 12px;
    color: #64748b;
}

.invoice-preview-grid {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.invoice-preview-chip {
    display: grid;
    grid-template-columns: 112px minmax(0, 1fr);
    align-items: start;
    gap: 14px;
    min-height: 76px;
    padding: 16px 18px;
    border-radius: 20px;
    background: rgba(255,255,255,0.78);
    border: 1px solid rgba(226, 232, 240, 0.88);
}

.invoice-preview-chip span {
    font-size: 12px;
    font-weight: 700;
    color: #64748b;
    line-height: 1.5;
}

.invoice-preview-chip strong {
    display: block;
    font-size: 14px;
    color: #0f172a;
    word-break: break-word;
    line-height: 1.55;
}

.invoice-history-table {
    min-width: 1320px;
}

.invoice-viewer-card {
    margin-top: 24px;
}

.invoice-viewer-toolbar {
    margin-left: auto;
}

.invoice-viewer-toolbar .business-search-box {
    width: auto;
    min-width: 0;
    flex: 0 1 auto;
    margin-right: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.invoice-viewer-toolbar .business-search-box input {
    width: 320px;
    min-height: 44px;
    padding: 0 16px;
    border-radius: 14px;
}

.invoice-viewer-toolbar .business-search-box button {
    min-height: 44px;
    padding: 0 18px;
    border-radius: 14px;
}

.invoice-viewer-table {
    min-width: 1680px;
}

.invoice-viewer-table th,
.invoice-viewer-table td {
    white-space: nowrap;
}

.invoice-viewer-table td:nth-child(6),
.invoice-viewer-table td:nth-child(7),
.invoice-viewer-table td:nth-child(13),
.invoice-viewer-table td:nth-child(15) {
    white-space: normal;
    min-width: 180px;
}

.invoice-inline-edit-row td {
    background: rgba(239, 246, 255, 0.72);
    vertical-align: middle;
}

.invoice-inline-input {
    width: 100%;
    min-width: 96px;
    min-height: 34px;
    padding: 7px 9px;
    border-radius: 10px;
    border: 1px solid rgba(147, 197, 253, 0.95);
    background: rgba(255, 255, 255, 0.96);
    color: #0f172a;
    font-size: 12px;
    font-weight: 700;
    box-shadow: none;
}

.invoice-inline-select {
    appearance: auto;
    -webkit-appearance: auto;
    -moz-appearance: auto;
    padding-right: 8px;
}

.invoice-inline-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.invoice-inline-save,
.invoice-inline-cancel {
    min-height: 34px;
    padding: 0 10px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}

.invoice-inline-save {
    background: linear-gradient(180deg, #60a5fa 0%, #2563eb 100%);
    color: #ffffff;
}

.invoice-inline-cancel {
    border: 1px solid rgba(203, 213, 225, 0.95);
    background: rgba(255, 255, 255, 0.92);
    color: #475569;
}

.invoice-viewer-pagination {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 14px;
}

.invoice-viewer-pagination:empty {
    display: none;
}

.invoice-history-empty {
    text-align: center;
    color: #64748b;
    padding: 32px 20px;
}

.invoice-edit-link {
    border: 0;
    background: transparent;
    padding: 0;
    color: #64748b;
    font-size: 13px;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
}

.invoice-edit-link:hover {
    color: #1d4ed8;
}

.invoice-status-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 30px;
    padding: 0 12px;
    border-radius: 999px;
    background: rgba(219, 234, 254, 0.9);
    color: #1d4ed8;
    font-size: 12px;
    font-weight: 700;
}

.auth-modal-content {
    width: min(520px, 94vw);
    max-height: 90vh;
    overflow-y: auto;
    background: rgba(255,255,255,0.92);
    border: 1px solid rgba(255,255,255,0.75);
    border-radius: 22px;
    padding: 20px;
}

.auth-modal-body {
    display: grid;
    gap: 10px;
}

.auth-modal-content.crm-contact-modal-content {
    width: min(1380px, 98vw);
    max-width: 98vw;
    padding: 24px;
}

button:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    transform: none;
}

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

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

    .sales-layout {
        grid-template-columns: 1fr;
    }

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

    .invoice-layout {
        grid-template-columns: 1fr;
    }

    .invoice-preview-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 900px) {
    .section-header {
        flex-wrap: wrap;
        align-items: flex-start;
    }

    .toolbar {
        flex-wrap: wrap;
        width: 100%;
        justify-content: flex-start;
        margin-left: 0;
    }

    .business-search-box {
        width: 100%;
        min-width: 0;
        flex: 1 1 100%;
    }

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

    .field-span-2,
    .field-span-3 {
        grid-column: span 2;
    }

    .field-span-4 {
        grid-column: span 2;
    }

    .allocation-summary {
        grid-template-columns: 1fr;
    }

    .allocation-chart-panel {
        margin: 0 18px 18px;
    }

    .business-allocation-overview-layout {
        grid-template-columns: 1fr;
    }

    .business-combined-chart-scroll {
        margin: 0 -4px;
        padding: 0 4px 8px;
    }

    .business-combined-chart {
        min-width: 920px;
    }

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

    .search-input-inline {
        flex-direction: column;
    }

    .sales-sync-banner {
        flex-direction: column;
        align-items: flex-start;
    }

    .sales-sync-meta {
        justify-content: flex-start;
    }

    .sales-filter-bar {
        width: 100%;
        flex-wrap: wrap;
        justify-content: flex-start;
    }

    .sales-pipeline-select,
    .sales-search-box,
    .sales-table-search-box {
        width: auto;
        min-width: 180px;
        max-width: none;
        flex: 1 1 180px;
    }

    .sales-collapse-btn {
        flex: 0 0 auto;
    }

    .allocation-trend-chart {
        overflow-x: auto;
    }

    .light-trend-svg {
        min-width: 100%;
    }

    .invoice-hero-header {
        flex-wrap: wrap;
    }

    .invoice-hero-badges {
        justify-content: flex-start;
    }

    .invoice-sync-status {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 640px) {
    body {
        padding: 14px;
        padding-bottom: calc(132px + env(safe-area-inset-bottom, 0px));
    }

    .container {
        max-width: 100%;
    }

    h1 {
        font-size: 30px;
    }

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

    .field-span-2,
    .field-span-3 {
        grid-column: span 1;
    }

    .field-span-4 {
        grid-column: span 1;
    }

    .card,
    .modal-content.large,
    .crm-modal-content {
        padding: 18px;
        border-radius: 22px;
    }

    .business-allocation-overview-shell,
    .business-overview-chart-card,
    .business-overview-side-panel {
        padding: 16px;
    }

    .business-overview-chart-header,
    .business-overview-side-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .business-combined-chart-scroll {
        margin: 0 -2px;
        padding: 0 2px 10px;
    }

    .business-combined-chart {
        min-width: 960px;
        padding: 12px 12px 4px;
    }

    .business-chart-mobile-hint {
        display: block;
    }

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

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

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

    .crm-modal-top-grid,
    .crm-contract-process-grid,
    .crm-info-form-grid {
        grid-template-columns: 1fr;
    }

    .crm-status-row {
        display: grid;
        grid-template-columns: 1fr;
    }

    .crm-contract-header {
        grid-template-columns: 1fr;
        align-items: flex-start;
    }

    .crm-contract-header h4 {
        white-space: normal;
    }

    .crm-contract-header-actions {
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
    }

    .crm-business-todo-header,
    .crm-recent-mail-header {
        flex-direction: column;
        align-items: stretch;
    }

    .crm-business-todo-actions {
        justify-content: flex-start;
    }

    .crm-business-todo-item {
        grid-template-columns: 1fr;
    }

    .crm-business-todo-badges {
        justify-content: flex-start;
    }

    .crm-recent-mail-actions {
        justify-content: flex-start;
        flex-wrap: wrap;
    }

    .crm-recent-mail-pagination {
        width: 100%;
        justify-content: flex-start;
    }

    .invoice-form-actions {
        flex-direction: column-reverse;
    }

    .invoice-preview-chip {
        grid-template-columns: 1fr;
        min-width: 100%;
    }
}
