/* ==========================================================================
   SalesPulse 365 — Compact Density Theme
   Global density + typography layer. Keeps existing teal/green theme intact;
   only reduces font sizes, row heights, card padding, and applies Inter.
   ========================================================================== */

:root {
    --sp-font-base:        13px;
    --sp-font-sm:          12px;
    --sp-font-xs:          11px;
    --sp-font-lg:          14.5px;
    --sp-line:             1.45;

    --sp-table-y:          0.28rem;
    --sp-table-x:          0.6rem;
    --sp-card-pad:         0.7rem;
    --sp-card-header-pad:  0.5rem 0.85rem;
    --sp-btn-pad-y:        0.26rem;
    --sp-btn-pad-x:        0.65rem;
    --sp-input-pad-y:      0.32rem;
    --sp-input-pad-x:      0.55rem;
    --sp-radius:           6px;
    --sp-radius-lg:        8px;

    --sp-muted:            #6b7280;
    --sp-border:           #e5e7eb;
    --sp-head-bg:          #f8fafc;
}

/* --- Typography ---------------------------------------------------------- */
html, body {
    font-family: 'Inter', 'Quicksand', -apple-system, BlinkMacSystemFont,
                 "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
    font-size: var(--sp-font-base);
    line-height: var(--sp-line);
    letter-spacing: -0.005em;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, .h1 { font-size: 1.45rem; font-weight: 600; letter-spacing: -0.015em; }
h2, .h2 { font-size: 1.25rem; font-weight: 600; letter-spacing: -0.012em; }
h3, .h3 { font-size: 1.1rem;  font-weight: 600; }
h4, .h4 { font-size: 1rem;    font-weight: 600; }
h5, .h5 { font-size: 0.9rem;  font-weight: 600; }
h6, .h6 { font-size: 0.8rem;  font-weight: 600; }

.small, small { font-size: var(--sp-font-xs); }
.text-muted { color: var(--sp-muted) !important; }

/* Numeric / data emphasis — tabular figures */
.sp-num, .stat-value, .kpi-value, .data-number,
.table td[data-type="number"], .table td.numeric {
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum";
    font-weight: 600;
    letter-spacing: -0.015em;
}

/* --- Tables -------------------------------------------------------------- */
.table {
    font-size: 0.8rem;
    margin-bottom: 0.5rem;
    line-height: 1.3;
}
.table > :not(caption) > * > * {
    padding: var(--sp-table-y) var(--sp-table-x) !important;
    vertical-align: middle;
    line-height: 1.3;
}
.table tbody tr { height: auto; }
.table td .btn, .table td .btn-sm {
    padding: 0.15rem 0.45rem;
    font-size: 0.7rem;
    line-height: 1.2;
}
.table td img, .table td .avatar { max-height: 22px; }
.table thead th,
.table > thead > tr > th {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 600;
    color: var(--sp-muted);
    background: var(--sp-head-bg);
    border-bottom: 1px solid var(--sp-border);
}
.table tbody tr { border-color: var(--sp-border); }
.table-hover tbody tr:hover { background: rgba(13, 148, 136, 0.04); }

/* DataTables controls */
.dataTables_filter input,
.dataTables_length select {
    font-size: 0.78rem !important;
    padding: 0.3rem 0.55rem !important;
    border-radius: var(--sp-radius) !important;
}
.dataTables_info, .dataTables_paginate { font-size: 0.78rem; }

/* --- Cards --------------------------------------------------------------- */
.card {
    border-radius: var(--sp-radius-lg);
    border: 1px solid var(--sp-border);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.card-body   { padding: var(--sp-card-pad); }
.card-header { padding: var(--sp-card-header-pad); font-size: 0.88rem; font-weight: 600; }
.card-title  { font-size: 0.95rem; font-weight: 600; margin-bottom: 0.4rem; }
.card-subtitle { font-size: 0.75rem; color: var(--sp-muted); }

/* KPI / stat cards — reduce vertical waste */
.stat-card, .kpi-card, .dashboard-card, .summary-card {
    padding: 0.75rem 1rem !important;
}

/* --- Buttons ------------------------------------------------------------- */
.btn {
    font-size: 0.8rem;
    padding: var(--sp-btn-pad-y) var(--sp-btn-pad-x);
    border-radius: var(--sp-radius);
    font-weight: 500;
    letter-spacing: 0.005em;
}
.btn-sm { font-size: 0.72rem; padding: 0.22rem 0.55rem; }
.btn-lg { font-size: 0.92rem; padding: 0.5rem 1rem; }
.btn i, .btn .fa, .btn .fas, .btn .far { font-size: 0.8em; }

/* --- Forms --------------------------------------------------------------- */
.form-control, .form-select, .input-group-text {
    font-size: 0.82rem;
    padding: var(--sp-input-pad-y) var(--sp-input-pad-x);
    border-radius: var(--sp-radius);
}
.form-control-sm, .form-select-sm { font-size: 0.75rem; padding: 0.25rem 0.5rem; }
.form-label {
    font-size: 0.76rem;
    font-weight: 500;
    margin-bottom: 0.25rem;
    color: #374151;
}

/* --- Badges -------------------------------------------------------------- */
.badge {
    font-size: 0.68rem;
    padding: 0.28em 0.55em;
    font-weight: 500;
    border-radius: 4px;
}

/* --- Modals -------------------------------------------------------------- */
.modal-header  { padding: 0.65rem 1rem; }
.modal-body    { padding: 0.95rem 1rem; }
.modal-footer  { padding: 0.55rem 1rem; }
.modal-title   { font-size: 0.98rem; font-weight: 600; }
.modal-content { border-radius: var(--sp-radius-lg); }

/* --- Nav / Topbar -------------------------------------------------------- */
.navbar { min-height: 52px; padding: 0.3rem 1rem; }
.navbar-brand { font-size: 0.95rem; font-weight: 600; }

/* --- Pagination ---------------------------------------------------------- */
.pagination .page-link {
    padding: 0.28rem 0.55rem;
    font-size: 0.78rem;
    min-width: 28px;
    text-align: center;
}

/* --- Alerts / toasts ----------------------------------------------------- */
.alert { font-size: 0.82rem; padding: 0.55rem 0.8rem; border-radius: var(--sp-radius); }
.toast-body { font-size: 0.82rem; }

/* --- Tooltips ------------------------------------------------------------ */
.tooltip { font-size: 0.7rem; }

/* --- Page headers & titles ---------------------------------------------- */
.page-header, .page-title, .section-title {
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}
.page-subtitle, .section-subtitle {
    font-size: 0.76rem;
    color: var(--sp-muted);
}

/* --- Skeleton loader (reusable) ----------------------------------------- */
.sp-skeleton {
    display: inline-block;
    background: linear-gradient(90deg, #eef2f7 25%, #f7fafc 50%, #eef2f7 75%);
    background-size: 200% 100%;
    animation: sp-shimmer 1.1s infinite linear;
    border-radius: 4px;
    min-height: 0.9em;
    width: 100%;
}
.sp-skeleton-line { height: 12px; margin: 4px 0; }
.sp-skeleton-row  { height: 32px; margin: 6px 0; }
@keyframes sp-shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* --- Inline spinner ----------------------------------------------------- */
.sp-spin {
    display: inline-block;
    width: 0.85em; height: 0.85em;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: sp-rot 0.6s linear infinite;
    vertical-align: -0.15em;
}
@keyframes sp-rot { to { transform: rotate(360deg); } }

/* --- Density utility classes -------------------------------------------- */
.sp-dense .card-body { padding: 0.65rem 0.85rem; }
.sp-dense .table > :not(caption) > * > * { padding: 0.32rem 0.55rem; }

/* --- Scrollbars (subtle) ------------------------------------------------ */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }
::-webkit-scrollbar-track { background: transparent; }

/* --- Print safety ------------------------------------------------------- */
@media print {
    .card, .table { box-shadow: none !important; }
}
