/* ===== Sales Module Styles ===== */

/* -- Sales List: table layout -- */
.sales-list-table {
    table-layout: fixed;
    width: 100%;
}

.sales-list-table .sales-col-date     { width: 10%; white-space: nowrap; }
.sales-list-table .sales-col-customer { width: 12%; }
.sales-list-table .sales-col-opp      { width: 22%; }
.sales-list-table .sales-col-loc      { width: 12%; }
.sales-list-table .sales-col-amount   { width: 12%; white-space: nowrap; }
.sales-list-table .sales-col-stage    { width: 16%; }
.sales-list-table .sales-col-actions  { width: 16%; white-space: nowrap; text-align: center; }

.sales-list-table thead th {
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.02em;
    color: var(--text-secondary, #64748b);
    padding: 0;
}
.sales-list-table thead th:not(:has(.btn-link)) {
    padding: 8px 16px;
}
.sales-list-table thead th .btn-link {
    padding: 10px 16px;
}

.sales-list-table tbody td {
    padding: 10px 16px;
    font-size: 13px;
    vertical-align: middle;
}

/* -- Pipeline Stage Cards -- */
.pipeline-stage-cards {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
}

.pipeline-stage-card {
    background: var(--card-bg, #fff);
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 8px;
    padding: 12px 16px;
}

.pipeline-stage-card-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary, #64748b);
    margin-bottom: 6px;
}

.pipeline-stage-bar-wrap {
    background: var(--bg-muted, #f1f5f9);
    border-radius: 4px;
    height: 10px;
    overflow: hidden;
    margin-bottom: 6px;
}

.pipeline-stage-bar {
    height: 100%;
    border-radius: 4px;
    transition: width 0.4s ease;
    min-width: 4px;
}

.pipeline-stage-card-meta {
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* -- Win-Loss Section -- */
.win-loss-section {
    padding: 0;
}

.sales-pipeline-summary {
    display: grid;
    gap: 18px;
}

.sales-pipeline-summary > .u-mb-16 {
    margin-bottom: 0 !important;
    background: #fff;
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 18px;
    padding: 18px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
}

.sales-pipeline-summary > .u-mb-16 .stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}

.sales-pipeline-summary > .sales-stage-card {
    display: none;
}

.sales-pipeline-summary .stat-card {
    min-height: 132px;
}

.sales-pipeline-summary .stat-card .stat-label {
    min-height: 36px;
}

.sales-pipeline-summary .u-flex-gap-8-wrap {
    gap: 6px;
}

/* stat-card color variants for win-loss */
.stat-card.green {
    border-left: 4px solid #10b981;
}

.stat-card.green .stat-value {
    color: #10b981;
}

.stat-card.red {
    border-left: 4px solid #ef4444;
}

.stat-card.red .stat-value {
    color: #ef4444;
}

.stat-card.blue {
    border-left: 4px solid #3b82f6;
}

.stat-card.blue .stat-value {
    color: #3b82f6;
}

.stat-card.orange {
    border-left: 4px solid #f59e0b;
}

.stat-card.orange .stat-value {
    color: #f59e0b;
}

/* -- Invoice Detail: info bar -- */
.inv-detail-info {
    background: #fff;
    padding: 14px 18px;
    border-radius: 10px;
    border: 1px solid var(--border-color, #e2e8f0);
    margin-top: 14px;
    margin-bottom: 4px;
}

.inv-detail-info-main {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
}

.inv-detail-info-no {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary, #1e293b);
}

.inv-detail-info-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 0;
    font-size: 13px;
    color: var(--text-primary, #1e293b);
    line-height: 1.6;
}

.inv-detail-info-label {
    color: var(--text-secondary, #94a3b8);
    margin-right: 4px;
}

.inv-detail-info-item {
    white-space: nowrap;
}

.inv-detail-info-sep {
    display: inline-block;
    width: 1px;
    height: 12px;
    background: var(--border-color, #e2e8f0);
    margin: 0 10px;
}

/* -- Invoice Detail: table column sizing -- */
.inv-detail-table {
    table-layout: fixed;
    width: 100%;
}

.inv-detail-table .inv-dt-type { width: 120px; }
.inv-detail-table .inv-dt-desc { /* flex remainder */ }
.inv-detail-table .inv-dt-unit { width: 70px; }
.inv-detail-table .inv-dt-num  { width: 120px; }

.inv-detail-table thead th {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary, #64748b);
    padding: 8px 12px;
    white-space: nowrap;
    vertical-align: middle;
}

.inv-detail-table tbody td {
    padding: 8px 12px;
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: middle;
}

.invoice-section-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary, #64748b);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* -- Invoice Totals (e-fatura style) -- */
.invoice-totals {
    display: flex;
    justify-content: flex-end;
    margin-top: 8px;
    padding: 4px 0;
}

.invoice-totals-table {
    width: 340px;
    border-collapse: collapse;
}

.invoice-totals-table td {
    padding: 6px 12px;
    font-size: 13px;
    color: var(--text-primary, #1e293b);
}

.invoice-totals-label {
    text-align: right;
    color: var(--text-secondary, #64748b);
    font-weight: 400;
}

.invoice-totals-value {
    text-align: right;
    font-variant-numeric: tabular-nums;
    min-width: 120px;
}

.invoice-totals-row-bold td {
    border-bottom: 1px solid var(--border-color, #e2e8f0);
    padding-bottom: 8px;
    font-weight: 500;
}

.invoice-totals-row-grand td {
    border-top: 1px solid var(--border-color, #e2e8f0);
    padding-top: 10px;
    font-weight: 600;
    font-size: 14px;
}

.invoice-totals-row-remaining td {
    color: var(--danger-color, #ef4444);
    font-weight: 500;
}


/* -- Invoice Detail: section spacing -- */
#invoiceDetail-page .table-container {
    background: transparent;
    padding: 0;
}

/* -- Invoice Detail: lighter table sections -- */
#invoiceDetail-page .data-table {
    box-shadow: none;
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 8px;
}

#invoiceDetail-page .data-table thead th {
    font-weight: 500;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-secondary, #64748b);
    background: var(--bg-secondary, #f8fafc);
    border-bottom: 1px solid var(--border-color, #e2e8f0);
    padding: 10px 16px;
}

#invoiceDetail-page .data-table tbody td {
    font-size: 13px;
    padding: 10px 16px;
    font-weight: 400;
}

#invoiceDetail-page .detail-text-panel {
    font-size: 13px;
    font-weight: 400;
    color: var(--text-primary, #1e293b);
    background: var(--bg-secondary, #f8fafc);
    border-radius: 8px;
    border: 1px solid var(--border-color, #e2e8f0);
    padding: 14px 16px;
}

/* -- Invoice Detail: Fatura Hareketleri sidebar -- */
#invoiceDetail-page .detail-log-sidebar,
.invoice-detail-shell .detail-log-sidebar {
    margin-top: 6px;
}

#invoiceDetail-page .detail-log-sidebar .invoice-section-title,
.invoice-detail-shell .detail-log-sidebar .invoice-section-title {
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--text-secondary, #94a3b8);
    margin-bottom: 10px;
}

#invoiceDetail-page .detail-log-sidebar .detail-log-list,
.invoice-detail-shell .detail-log-sidebar .detail-log-list {
    gap: 0;
}

#invoiceDetail-page .detail-log-item,
.invoice-detail-shell .detail-log-item {
    border-radius: 0;
    background: transparent;
    border: none;
    border-left: 2px solid var(--border-color, #e2e8f0);
    padding: 8px 14px;
    position: relative;
}

#invoiceDetail-page .detail-log-item::before,
.invoice-detail-shell .detail-log-item::before {
    content: '';
    position: absolute;
    left: -4px;
    top: 14px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--border-color, #cbd5e1);
}

#invoiceDetail-page .detail-log-item:last-child,
.invoice-detail-shell .detail-log-item:last-child {
    border-left-color: transparent;
}

#invoiceDetail-page .detail-log-item-title,
.invoice-detail-shell .detail-log-item-title {
    font-weight: 400;
    font-size: 12px;
    color: var(--text-secondary, #64748b);
}

#invoiceDetail-page .detail-log-item-meta,
.invoice-detail-shell .detail-log-item-meta {
    font-size: 11px;
    margin-top: 2px;
    color: var(--text-secondary, #94a3b8);
}

/* -- Invoice Detail: notes/comments -- */
.inv-note-section {
    margin-bottom: 0;
    display: flex;
    flex-direction: column;
    max-height: 540px;
    min-height: 140px;
}

.inv-note-section-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary, #1e293b);
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 10px;
    flex-shrink: 0;
}

.inv-note-section-title i {
    color: var(--primary-color, #3b82f6);
    font-size: 13px;
}

/* -- Composer -- */
.inv-note-composer {
    background: #fff;
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 8px;
    overflow: hidden;
    transition: border-color 0.15s;
    flex-shrink: 0;
}

.inv-note-composer:focus-within {
    border-color: var(--primary-color, #3b82f6);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.08);
}

.inv-note-input {
    width: 100%;
    box-sizing: border-box;
    resize: none;
    font-size: 12px;
    padding: 10px 12px 6px;
    border: none;
    background: transparent;
    color: var(--text-primary, #1e293b);
    line-height: 1.5;
    font-family: inherit;
    min-height: 44px;
}

.inv-note-input:focus {
    outline: none;
}

.inv-note-input::placeholder {
    color: var(--text-secondary, #94a3b8);
}

.inv-note-composer-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 8px 6px 12px;
    border-top: 1px solid var(--border-color, #f1f5f9);
    background: var(--bg-secondary, #f8fafc);
}

.inv-note-hint {
    font-size: 10px;
    color: var(--text-secondary, #94a3b8);
}

.inv-note-send {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 500;
    padding: 4px 12px;
    border-radius: 6px;
    border: none;
    background: var(--primary-color, #3b82f6);
    color: #fff;
    cursor: pointer;
    transition: background 0.15s;
}

.inv-note-send:hover {
    background: #2563eb;
}

.inv-note-send i {
    font-size: 10px;
}

/* -- Note list -- */
.inv-note-list {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin-top: 8px;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--border-color, #cbd5e1) transparent;
}
.inv-note-list::-webkit-scrollbar { width: 4px; }
.inv-note-list::-webkit-scrollbar-track { background: transparent; }
.inv-note-list::-webkit-scrollbar-thumb {
    background: var(--border-color, #cbd5e1);
    border-radius: 4px;
}

.inv-note-count {
    font-size: 11px;
    font-weight: 400;
    color: var(--text-secondary, #94a3b8);
    margin-left: 4px;
}

.inv-note-item {
    display: flex;
    gap: 8px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color, #f1f5f9);
    position: relative;
}

.inv-note-item:last-child {
    border-bottom: none;
}

.inv-note-avatar {
    flex-shrink: 0;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1 0%, #3b82f6 100%);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 1px;
}

.inv-note-body {
    flex: 1;
    min-width: 0;
}

.inv-note-header {
    display: flex;
    align-items: baseline;
    gap: 6px;
    margin-bottom: 2px;
}

.inv-note-author {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary, #1e293b);
}

.inv-note-time {
    font-size: 10px;
    color: var(--text-secondary, #94a3b8);
}

.inv-note-text {
    font-size: 12px;
    color: var(--text-primary, #334155);
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
}

.inv-note-delete {
    position: absolute;
    top: 10px;
    right: 0;
    background: none;
    border: none;
    color: transparent;
    cursor: pointer;
    padding: 3px 5px;
    font-size: 10px;
    line-height: 1;
    border-radius: 4px;
    transition: color 0.15s, background 0.15s;
}

.inv-note-item:hover .inv-note-delete {
    color: var(--text-secondary, #94a3b8);
}

.inv-note-delete:hover {
    color: var(--danger-color, #ef4444);
    background: rgba(239, 68, 68, 0.06);
}

.inv-note-empty {
    font-size: 11px;
    color: var(--text-secondary, #94a3b8);
    text-align: center;
    padding: 12px 0;
    font-style: italic;
}

.inv-history-divider {
    height: 1px;
    background: var(--border-color, #e2e8f0);
    margin: 20px 0 14px;
}

/* -- Invoice List: table layout -- */
.inv-list-table {
    table-layout: fixed;
    width: 100%;
}

.inv-list-table .inv-col-no      { width: 40%; }
.inv-list-table .inv-col-date    { width: 15%; white-space: nowrap; }
.inv-list-table .inv-col-amount  { width: 20%; white-space: nowrap; text-align: right; }
.inv-list-table .inv-col-actions { width: 10%; white-space: nowrap; text-align: center; }

.inv-list-table thead th {
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.02em;
    color: var(--text-secondary, #64748b);
    padding: 0;
}
.inv-list-table thead th:not(:has(.btn-link)) {
    padding: 8px 16px;
}
.inv-list-table thead th .btn-link {
    padding: 10px 16px;
}

/* Kalan header button: inherit right-align from column */
.inv-list-table thead th.inv-col-amount .btn-link {
    justify-content: flex-end;
    text-align: right;
    width: 100%;
}

.inv-list-table tbody td {
    padding: 10px 16px;
    font-size: 13px;
    vertical-align: middle;
}

.inv-row { cursor: pointer; }
.inv-row:hover { background: rgba(59, 130, 246, 0.04); }

/* -- Invoice List: cell typography -- */
.inv-cell-primary {
    font-weight: 500;
    font-size: 13px;
    color: var(--text-primary, #1e293b);
    line-height: 1.4;
}

.inv-cell-secondary {
    font-size: 12px;
    color: var(--text-secondary, #94a3b8);
    line-height: 1.4;
    margin-top: 1px;
}

.inv-cell-overdue {
    font-size: 11px;
    font-weight: 500;
    color: var(--danger-color, #ef4444);
    margin-top: 1px;
}

.inv-cell-danger {
    color: var(--danger-color, #ef4444);
    font-weight: 500;
}

.inv-cell-status-label {
    font-size: 12px;
    font-weight: 500;
    line-height: 1.4;
}

.inv-cell-cancelled {
    color: var(--text-secondary, #94a3b8);
}

.inv-cell-returned {
    color: var(--warning-color, #f59e0b);
}

/* -- Invoices page: fixed layout (no page-level scroll) -- */
#invoices-page.page.active {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* -- Invoices toolbar (search + filters + new button in one row) -- */
.inv-toolbar {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding: 8px 0;
    margin-bottom: 8px;
    border-bottom: 1px solid var(--border-color, #e2e8f0);
}

.inv-toolbar-search {
    flex: 1;
    min-width: 0;
    max-width: 320px;
}

.inv-toolbar-select {
    width: auto;
    min-width: 120px;
    max-width: 180px;
}

.inv-toolbar-new {
    margin-left: auto;
    white-space: nowrap;
}

.inv-toolbar-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

#invoices-page .bulk-toolbar {
    flex-shrink: 0;
}

#invoices-page #invoiceSummaryCards {
    flex-shrink: 0;
}

#invoices-page #invoicesList {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

/* -- Invoice collection row: hover-visible delete button -- */
.inv-collection-action-cell {
    width: 36px;
    text-align: center;
    padding: 4px 2px !important;
}

.inv-collection-delete-btn {
    display: none;
}

.inv-collection-delete-btn.icon-action-btn {
    width: 28px;
    height: 28px;
    min-width: 28px;
    border: none;
    background: transparent;
    color: var(--danger-color, #ef4444);
}

.inv-collection-delete-btn.icon-action-btn:hover {
    background: rgba(239, 68, 68, 0.08);
}

.inv-collection-row:hover .inv-collection-delete-btn {
    display: inline-flex;
}

/* ===== Inline Category Field (Madde 1 & 2) ===== */
.inline-category-field {
    display: flex;
    gap: 6px;
    align-items: center;
}

.inline-category-add {
    display: flex;
    gap: 6px;
    align-items: center;
}

.inline-category-input {
    font-size: 13px;
}

/* ===== Quote Editor Totals (Madde 13) ===== */
.quote-editor-totals-wrap {
    display: flex;
    justify-content: flex-end;
    margin-top: 8px;
    padding: 0 16px;
}

.quote-editor-totals-side {
    min-width: 280px;
    max-width: 380px;
    width: 100%;
}
