:root {
    --sp-bg: #f1f5f9;
    --sp-surface: #ffffff;
    --sp-border: #e2e8f0;
    --sp-text: #0f172a;
    --sp-muted: #64748b;
    --sp-primary: #2563eb;
    --sp-primary-hover: #1d4ed8;
    --sp-radius: 14px;
    --sp-radius-sm: 10px;
    --sp-shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
    --sp-shadow: 0 4px 20px rgba(15, 23, 42, 0.06);
    --sp-shadow-hover: 0 12px 32px rgba(15, 23, 42, 0.1);
}

* { box-sizing: border-box; }

body.sp-body {
    margin: 0;
    font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
    background: var(--sp-bg);
    background-image:
        radial-gradient(ellipse 80% 50% at 50% -20%, rgba(37, 99, 235, 0.08), transparent),
        linear-gradient(180deg, var(--sp-bg) 0%, #eef2f7 100%);
    color: var(--sp-text);
    -webkit-font-smoothing: antialiased;
}

.sp-header {
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--sp-border);
    box-shadow: var(--sp-shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
}

.sp-header-inner {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0.75rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.sp-brand {
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.sp-brand-title { font-weight: 700; font-size: 1.1rem; }
.sp-brand-sub { font-size: 0.75rem; color: var(--sp-muted); }

.sp-nav {
    display: flex;
    gap: 0.25rem;
    flex-wrap: wrap;
    flex: 1;
}

.sp-nav-link {
    text-decoration: none;
    color: var(--sp-muted);
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
}

.sp-nav-link.is-active,
.sp-nav-link:hover {
    color: var(--sp-primary);
    background: #eff6ff;
}

.sp-header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sp-user { font-size: 0.875rem; color: var(--sp-muted); }

.sp-main {
    max-width: 1280px;
    margin: 0 auto;
    padding: 1.5rem 1.25rem 3rem;
}

.sp-main-auth {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sp-auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--sp-surface);
    border: 1px solid var(--sp-border);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 4px 24px rgba(15, 23, 42, 0.06);
}

.sp-auth-logo { width: 10rem; margin-bottom: 1rem; }
.sp-auth-header h1 { margin: 0 0 0.5rem; font-size: 1.5rem; }
.sp-muted { color: var(--sp-muted); margin: 0; }
.sp-auth-footer { text-align: center; margin-top: 1.5rem; font-size: 0.875rem; }
.sp-auth-footer a { color: var(--sp-primary); }

.sp-alert {
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    border-radius: 8px;
    font-size: 0.875rem;
    line-height: 1.45;
    border: 1px solid transparent;
}

.sp-alert-success {
    color: #166534;
    background: #f0fdf4;
    border-color: #bbf7d0;
}

.sp-alert-danger {
    color: #991b1b;
    background: #fef2f2;
    border-color: #fecaca;
}

.sp-alert-warning {
    color: #92400e;
    background: #fffbeb;
    border-color: #fde68a;
}

.sp-alert-info {
    color: #1e40af;
    background: #eff6ff;
    border-color: #bfdbfe;
}

.sp-form { margin-top: 1.5rem; }
.sp-label { display: block; font-size: 0.875rem; margin-bottom: 0.35rem; }
.sp-input {
    width: 100%;
    padding: 0.65rem 0.85rem;
    border: 1px solid var(--sp-border);
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 1rem;
}

.sp-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
    font-size: 0.875rem;
}

.sp-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.55rem 1rem;
    border-radius: 8px;
    font-size: 0.875rem;
    text-decoration: none;
    border: 1px solid transparent;
    cursor: pointer;
}

.sp-btn-primary {
    background: var(--sp-primary);
    color: #fff;
}

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

.sp-btn-ghost {
    background: transparent;
    border-color: var(--sp-border);
    color: var(--sp-text);
}

.sp-btn-block { width: 100%; }

.sp-page-header h1 { margin: 0 0 0.25rem; }

/* Legacy stat blocks (other pages) */
.sp-stats {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
}

.sp-stat-card {
    background: var(--sp-surface);
    border: 1px solid var(--sp-border);
    border-radius: var(--sp-radius);
    padding: 1.25rem;
    box-shadow: var(--sp-shadow-sm);
}

.sp-stat-label { display: block; font-size: 0.875rem; color: var(--sp-muted); }
.sp-stat-value { display: block; font-size: 2rem; font-weight: 700; margin: 0.35rem 0; }
.sp-stat-link { font-size: 0.875rem; color: var(--sp-primary); text-decoration: none; }

.sp-panel-table .dataTables_wrapper {
    margin-top: 0.5rem;
}

.sp-panel-table .table-rfqs {
    width: 100% !important;
}

.sp-panel {
    margin-top: 2rem;
    background: var(--sp-surface);
    border: 1px solid var(--sp-border);
    border-radius: var(--sp-radius);
    padding: 1.25rem;
    box-shadow: var(--sp-shadow-sm);
}

.sp-panel h2 { margin: 0 0 1rem; font-size: 1.1rem; }
.sp-activity-list { list-style: none; margin: 0; padding: 0; }
.sp-activity-list li {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--sp-border);
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    font-size: 0.875rem;
}

.sp-activity-list li:last-child { border-bottom: none; }
.sp-activity-date { color: var(--sp-muted); white-space: nowrap; }

/* ——— Dashboard ——— */
.sp-dashboard {
    display: flex;
    flex-direction: column;
    gap: 1.75rem;
}

.sp-dashboard-hero {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1.25rem;
}

.sp-dashboard-eyebrow {
    margin: 0 0 0.35rem;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--sp-primary);
}

.sp-dashboard-title {
    margin: 0;
    font-size: clamp(1.5rem, 3vw, 1.875rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.sp-dashboard-subtitle {
    margin: 0.5rem 0 0;
    max-width: 36rem;
    font-size: 0.9375rem;
    line-height: 1.5;
    color: var(--sp-muted);
}

.sp-dashboard-hero-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.5rem;
}

.sp-dashboard-date {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.85rem;
    font-size: 0.8125rem;
    color: var(--sp-muted);
    background: var(--sp-surface);
    border: 1px solid var(--sp-border);
    border-radius: 999px;
    box-shadow: var(--sp-shadow-sm);
}

.sp-dashboard-badge {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
}

.sp-dashboard-badge.is-on {
    color: #166534;
    background: #dcfce7;
}

.sp-dashboard-badge.is-off {
    color: #991b1b;
    background: #fee2e2;
}

.sp-metrics {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

@media (max-width: 1024px) {
    .sp-metrics { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
    .sp-metrics { grid-template-columns: 1fr; }
    .sp-dashboard-hero-meta { align-items: flex-start; }
}

.sp-metric {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.15rem 1.25rem;
    text-decoration: none;
    color: inherit;
    background: var(--sp-surface);
    border: 1px solid var(--sp-border);
    border-radius: var(--sp-radius);
    box-shadow: var(--sp-shadow-sm);
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}

.sp-metric:hover {
    border-color: #cbd5e1;
    box-shadow: var(--sp-shadow-hover);
    transform: translateY(-2px);
}

.sp-metric-icon {
    flex-shrink: 0;
    width: 2.75rem;
    height: 2.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--sp-radius-sm);
    font-size: 1.1rem;
}

.sp-metric--blue .sp-metric-icon { color: #1d4ed8; background: #dbeafe; }
.sp-metric--emerald .sp-metric-icon { color: #047857; background: #d1fae5; }
.sp-metric--amber .sp-metric-icon { color: #b45309; background: #fef3c7; }
.sp-metric--violet .sp-metric-icon { color: #6d28d9; background: #ede9fe; }

.sp-metric-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.sp-metric-value {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1;
}

.sp-metric-label {
    font-size: 0.8125rem;
    color: var(--sp-muted);
}

.sp-metric-chevron {
    flex-shrink: 0;
    width: 1.75rem;
    height: 1.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    color: var(--sp-muted);
    background: #f8fafc;
    border-radius: 50%;
    transition: background 0.2s, color 0.2s;
}

.sp-metric:hover .sp-metric-chevron {
    color: var(--sp-primary);
    background: #eff6ff;
}

.sp-dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 1.25rem;
    align-items: start;
}

@media (max-width: 900px) {
    .sp-dashboard-grid { grid-template-columns: 1fr; }
}

.sp-card {
    background: var(--sp-surface);
    border: 1px solid var(--sp-border);
    border-radius: var(--sp-radius);
    box-shadow: var(--sp-shadow-sm);
    overflow: hidden;
}

.sp-card-header {
    padding: 1.25rem 1.35rem 0;
}

.sp-card-title {
    margin: 0;
    font-size: 1.0625rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.sp-card-desc {
    margin: 0.25rem 0 0;
    font-size: 0.8125rem;
    color: var(--sp-muted);
}

.sp-card--activity .sp-timeline,
.sp-card--activity .sp-empty {
    padding: 1rem 1.35rem 1.35rem;
}

.sp-timeline {
    list-style: none;
    margin: 0;
    padding: 0;
}

.sp-timeline-item {
    position: relative;
    display: flex;
    gap: 0.85rem;
    padding: 0.85rem 0;
}

.sp-timeline-item:not(:last-child) {
    border-bottom: 1px solid #f1f5f9;
}

.sp-timeline-dot {
    flex-shrink: 0;
    width: 0.5rem;
    height: 0.5rem;
    margin-top: 0.45rem;
    border-radius: 50%;
    background: var(--sp-primary);
    box-shadow: 0 0 0 3px #dbeafe;
}

.sp-timeline-text {
    margin: 0;
    font-size: 0.875rem;
    line-height: 1.45;
    color: var(--sp-text);
}

.sp-timeline-time {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.75rem;
    color: var(--sp-muted);
}

.sp-empty {
    text-align: center;
    padding: 2.5rem 1.5rem !important;
}

.sp-empty-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3rem;
    height: 3rem;
    margin-bottom: 0.75rem;
    font-size: 1.25rem;
    color: var(--sp-muted);
    background: #f8fafc;
    border-radius: 50%;
}

.sp-empty-title {
    margin: 0 0 0.35rem;
    font-size: 0.9375rem;
    font-weight: 600;
}

.sp-empty-text {
    margin: 0 auto;
    max-width: 22rem;
    font-size: 0.8125rem;
    line-height: 1.5;
    color: var(--sp-muted);
}

.sp-quick-links {
    display: flex;
    flex-direction: column;
    padding: 0.65rem 0.85rem 1rem;
}

.sp-quick-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 0.65rem;
    text-decoration: none;
    color: var(--sp-text);
    border-radius: var(--sp-radius-sm);
    font-size: 0.875rem;
    transition: background 0.15s;
}

.sp-quick-link:hover {
    background: #f8fafc;
}

.sp-quick-link-icon {
    flex-shrink: 0;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    color: var(--sp-primary);
    background: #eff6ff;
    border-radius: 8px;
}

.sp-quick-link-label { flex: 1; font-weight: 500; }

.sp-quick-link-arrow {
    font-size: 0.65rem;
    color: #94a3b8;
}
