.ai-mobile-tabs {
    display: none;
}

.ai-mobile-tab-btn {
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: var(--color-text-subtle);
    min-height: 42px;
    padding: 0 14px;
    font-size: 14px;
    font-weight: 800;
    cursor: pointer;
}

.ai-mobile-tab-btn.active {
    background: var(--color-card-bg);
    color: var(--color-heading);
    box-shadow: var(--shadow-control);
}

.card {
    position: relative;
    width: 100%;
    background: var(--color-card-bg);
    border: 1px solid var(--color-card-border);
    border-radius: 16px;
    padding: 20px 24px;
    margin-bottom: 20px;
    color: var(--color-body-text);
    box-shadow: var(--shadow-card);
}

.card::before {
    display: none;
}

@media (min-width: 901px) {
    .card.page-surface {
        padding: 0;
        border: 0;
        border-radius: 0;
        background: transparent;
        box-shadow: none;
        overflow: visible;
    }
}

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

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

.atip-header {
    font-weight: 600;
    font-size: 11px;
    margin-bottom: 3px;
    color: #cbd5e1;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    padding-bottom: 3px;
}

.atip-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    line-height: 1.6;
}

.atip-label {
    color: #94a3b8;
}

.atip-value {
    font-weight: 500;
    text-align: right;
}

.atip-forecast {
    color: #6ee7b7;
}

.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;
}

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

.view-toggle-btn.active {
    background: var(--color-accent-muted);
    color: var(--color-info-text);
    box-shadow: var(--shadow-control);
}

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

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

a.primary-btn,
a.secondary-btn,
a.danger-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 18px;
    padding: 14px 20px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    color: var(--color-on-accent);
    line-height: normal;
    text-decoration: none;
    transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

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

a.primary-btn:hover,
a.secondary-btn:hover,
a.danger-btn:hover {
    transform: translateY(-1px);
}

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

a.primary-btn:active,
a.secondary-btn:active,
a.danger-btn:active {
    transform: scale(0.98);
}

.primary-btn {
    background: var(--color-accent);
    color: var(--color-on-accent);
    box-shadow: var(--shadow-accent);
}

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

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

.secondary-btn {
    background: var(--color-control-bg);
    color: var(--color-control-text);
    border: 1px solid var(--color-control-border);
    box-shadow: none;
}

.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;
}

a.primary-btn.small-btn,
a.secondary-btn.small-btn,
a.danger-btn.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: var(--color-table-bg);
}

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

thead th {
    text-align: center;
    font-size: 13px;
    font-weight: 700;
    color: var(--color-table-header-text);
    padding: 14px 14px;
    background: var(--color-table-header-bg);
    border-bottom: 1px solid var(--color-table-border);
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 5;
}

tbody td {
    padding: 12px 14px;
    font-size: 13px;
    color: var(--color-table-text);
    border-bottom: 1px solid var(--color-table-border);
    background: var(--color-table-bg);
    vertical-align: middle;
    white-space: nowrap;
    text-align: center;
}

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

tbody tr:hover td {
    background: var(--color-table-row-hover);
}

.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: var(--color-table-header-bg);
    box-shadow: 1px 0 0 var(--color-table-border);
}

thead th.sticky-col {
    z-index: 9;
    background: var(--color-table-header-bg);
}

.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); }

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

.action-link {
    color: var(--color-action-link);
    cursor: pointer;
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 3px;
}

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

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

.month-empty {
    color: var(--color-text-placeholder);
    text-align: center;
}

.detail-label {
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    gap: 6px;
    color: var(--color-text-subtle);
}

.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: var(--color-body-text);
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}

.detail-name-text {
    color: var(--color-text-subtle);
    font-weight: 500;
}

.detail-link:hover {
    color: var(--color-link-hover);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.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: var(--color-danger-action);
}

label {
    font-size: 13px;
    font-weight: 700;
    color: var(--color-text-subtle);
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--color-control-border);
    background: var(--color-control-bg);
    color: var(--color-control-text);
    border-radius: 18px;
    padding: 14px 16px;
    font-size: 15px;
    outline: none;
    box-shadow: var(--shadow-control);
    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: var(--color-text-placeholder);
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px var(--color-focus-ring);
    background: var(--color-control-bg);
}

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

.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;
}

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

.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;
}

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

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

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

.crm-history-search-box {
    flex: 1 1 240px;
    width: min(320px, 100%);
    min-width: 0;
    max-width: 320px;
}

.crm-history-search-box .business-search-field {
    width: 100%;
    min-width: 0;
}

.crm-history-search-box .sales-search-input {
    min-width: 0;
}

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

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

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

.unmatched-call-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 12px 0 14px;
    padding: 12px 14px;
    border: 1px solid rgba(245, 158, 11, 0.34);
    border-radius: 8px;
    background: #fffbeb;
    color: #92400e;
    font-size: 14px;
    font-weight: 800;
}

.unmatched-call-modal-content {
    width: min(720px, 94vw);
    max-height: 86vh;
    overflow-y: auto;
}

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

.unmatched-call-item {
    display: grid;
    gap: 10px;
    padding: 14px;
    border: 1px solid rgba(203, 213, 225, 0.78);
    border-radius: 8px;
    background: #ffffff;
}

.unmatched-call-header,
.unmatched-call-actions,
.unmatched-call-link-panel {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.unmatched-call-header span {
    color: #64748b;
    font-size: 13px;
    font-weight: 700;
}

.unmatched-call-summary {
    white-space: pre-wrap;
    color: #334155;
    font-size: 14px;
    line-height: 1.7;
}

.unmatched-call-link-panel {
    padding-top: 8px;
    border-top: 1px solid rgba(226, 232, 240, 0.9);
}

.unmatched-call-link-panel input {
    min-width: 180px;
    flex: 1 1 180px;
}

.unmatched-call-link-panel select {
    min-width: 220px;
    flex: 1 1 220px;
}

#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;
}

.hidden {
    display: none !important;
}

@keyframes viewFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

#aiWorkspaceView:not(.hidden),
#aiTodoView:not(.hidden),
#salesCrmView:not(.hidden),
#salesStatusView:not(.hidden),
#businessStatusView:not(.hidden),
#invoiceRequestView:not(.hidden) {
    animation: viewFadeIn 0.18s ease;
}

.checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    color: #334155;
}

.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-search-box {
    width: 180px;
    min-width: 180px;
    max-width: 180px;
}

.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);
}

@keyframes salesLineDraw {
    to { stroke-dashoffset: 0; }
}

@keyframes salesChartFade {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes salesChartRise {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes salesChartSkeleton {
    from { background-position: 100% 0; }
    to { background-position: -100% 0; }
}

.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;
}

.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;
}
