/* HQ Bonus Calculator - Global Styles */
/* Brand: builtbyhq.com | Aesthetic: Stripe-inspired */

@import url('https://fonts.googleapis.com/css2?family=Instrument+Sans:wght@400;500;600;700&family=Inter:wght@400;500;600;700&display=swap');

:root {
    /* HQ Brand Colors */
    --color-brand-dark: #153439;
    --color-brand-teal: #84d7dc;
    --color-brand-warm: #ffb584;

    /* Stripe-inspired Neutrals */
    --color-bg: #f6f8fa;
    --color-surface: #ffffff;
    --color-border: #e3e8ee;
    --color-border-light: #f0f2f5;
    --color-text: #1a1f36;
    --color-text-secondary: #697386;
    --color-text-tertiary: #8792a2;

    /* Semantic */
    --color-primary: #153439;
    --color-primary-hover: #1c464d;
    --color-accent: #84d7dc;
    --color-accent-subtle: rgba(132, 215, 220, 0.12);
    --color-warm: #ffb584;
    --color-warm-subtle: rgba(255, 181, 132, 0.12);
    --color-success: #0d7d4d;
    --color-success-bg: #e6f7ee;
    --color-danger: #cd3d64;
    --color-danger-bg: #fce8ef;
    --color-warning: #d97917;
    --color-warning-bg: #fef3e2;
    --color-negative: #cd3d64;

    /* Spacing (Stripe-tight) */
    --sp-1: 4px;
    --sp-2: 8px;
    --sp-3: 12px;
    --sp-4: 16px;
    --sp-5: 20px;
    --sp-6: 24px;
    --sp-8: 32px;
    --sp-10: 40px;
    --sp-12: 48px;

    /* Typography */
    --font-family: 'Instrument Sans', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'SF Mono', 'Fira Code', 'Fira Mono', monospace;
    --fs-xs: 0.75rem;
    --fs-sm: 0.8125rem;
    --fs-base: 0.875rem;
    --fs-md: 1rem;
    --fs-lg: 1.125rem;
    --fs-xl: 1.25rem;
    --fs-2xl: 1.5rem;
    --lh-tight: 1.25;
    --lh-normal: 1.5;

    /* Borders */
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 10px;

    /* Shadows (Stripe-subtle) */
    --shadow-xs: 0 1px 1px rgba(0, 0, 0, 0.03);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.02);
    --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.04), 0 1px 3px rgba(0, 0, 0, 0.03);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.06), 0 2px 6px rgba(0, 0, 0, 0.03);

    /* Transitions */
    --transition: 150ms ease;
}

/* Reset */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-family);
    font-size: var(--fs-base);
    color: var(--color-text);
    background-color: var(--color-bg);
    line-height: var(--lh-normal);
}

/* ============================================
   Layout
   ============================================ */

.container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ============================================
   Header
   ============================================ */

.app-header {
    background-color: var(--color-brand-dark);
    color: #ffffff;
    padding: var(--sp-3) var(--sp-8);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.header-content {
    max-width: 1120px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: var(--sp-4);
}

.header-logo {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    text-decoration: none;
    transition: opacity var(--transition);
}

.header-logo:hover {
    opacity: 0.85;
}

.header-logo svg {
    width: 32px;
    height: 32px;
}

.header-text {
    display: flex;
    align-items: baseline;
    gap: var(--sp-3);
}

.app-title {
    font-size: var(--fs-md);
    font-weight: 600;
    letter-spacing: -0.01em;
}

.app-subtitle {
    font-size: var(--fs-xs);
    opacity: 0.5;
    font-weight: 400;
}

/* ============================================
   Navigation
   ============================================ */

.main-nav {
    background-color: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-menu {
    list-style: none;
    display: flex;
    max-width: 1120px;
    margin: 0 auto;
    padding: 0;
    gap: 0;
}

.nav-link {
    display: block;
    padding: var(--sp-3) var(--sp-4);
    text-decoration: none;
    color: var(--color-text-secondary);
    font-size: var(--fs-sm);
    font-weight: 500;
    border-bottom: 2px solid transparent;
    transition: color var(--transition), border-color var(--transition);
}

.nav-link:hover {
    color: var(--color-text);
    background: none;
}

.nav-link.active {
    color: var(--color-brand-dark);
    border-bottom-color: var(--color-brand-dark);
}

/* ============================================
   Main Content
   ============================================ */

.main-content {
    flex: 1;
    max-width: 1120px;
    margin: 0 auto;
    width: 100%;
    padding: var(--sp-8) var(--sp-8);
}

/* ============================================
   Footer
   ============================================ */

.app-footer {
    background-color: var(--color-surface);
    border-top: 1px solid var(--color-border);
    padding: var(--sp-6);
    text-align: center;
    margin-top: auto;
}

.disclaimer {
    font-size: var(--fs-xs);
    color: var(--color-text-secondary);
    margin-bottom: var(--sp-3);
    background-color: var(--color-warning-bg);
    border-left: 3px solid var(--color-warning);
    padding: var(--sp-3) var(--sp-4);
    border-radius: var(--radius-sm);
    text-align: left;
    max-width: 1120px;
    margin-left: auto;
    margin-right: auto;
}

.copyright {
    font-size: var(--fs-xs);
    color: var(--color-text-tertiary);
}

/* ============================================
   Buttons
   ============================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--sp-2);
    padding: var(--sp-2) var(--sp-4);
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-family: var(--font-family);
    font-size: var(--fs-sm);
    font-weight: 500;
    line-height: var(--lh-tight);
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    white-space: nowrap;
    height: 32px;
}

.btn-primary {
    background-color: var(--color-brand-dark);
    color: #ffffff;
    border-color: var(--color-brand-dark);
}

.btn-primary:hover {
    background-color: var(--color-primary-hover);
    border-color: var(--color-primary-hover);
    box-shadow: var(--shadow-sm);
}

.btn-secondary {
    background-color: var(--color-surface);
    color: var(--color-text);
    border-color: var(--color-border);
}

.btn-secondary:hover {
    background-color: var(--color-bg);
    border-color: #c4cdd5;
}

.btn-danger {
    background-color: var(--color-danger);
    color: #ffffff;
    border-color: var(--color-danger);
}

.btn-danger:hover {
    background-color: #b8345a;
    border-color: #b8345a;
}

.btn-sm {
    padding: var(--sp-1) var(--sp-3);
    font-size: var(--fs-xs);
    height: 28px;
}

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

/* ============================================
   Forms
   ============================================ */

.form-group {
    margin-bottom: var(--sp-5);
}

.form-group label {
    display: block;
    margin-bottom: var(--sp-2);
    font-size: var(--fs-sm);
    font-weight: 500;
    color: var(--color-text);
}

.form-input,
.form-textarea {
    width: 100%;
    padding: var(--sp-2) var(--sp-3);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-family: var(--font-family);
    font-size: var(--fs-base);
    color: var(--color-text);
    background-color: var(--color-surface);
    transition: border-color var(--transition), box-shadow var(--transition);
    height: 36px;
}

.form-input:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px var(--color-accent-subtle);
}

.form-textarea {
    min-height: 88px;
    height: auto;
    resize: vertical;
}

.form-help {
    font-size: var(--fs-xs);
    color: var(--color-text-tertiary);
    margin-top: var(--sp-1);
}

.form-help a {
    color: var(--color-brand-dark);
    text-decoration: none;
}

.form-help a:hover {
    text-decoration: underline;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--sp-5);
}

.form-status {
    margin-top: var(--sp-4);
    padding: var(--sp-3) var(--sp-4);
    border-radius: var(--radius-sm);
    font-size: var(--fs-sm);
    display: none;
}

.form-status.show {
    display: block;
}

.success {
    background-color: var(--color-success-bg);
    color: var(--color-success);
    border: 1px solid rgba(13, 125, 77, 0.15);
    padding: var(--sp-3) var(--sp-4);
    border-radius: var(--radius-sm);
}

.error {
    background-color: var(--color-danger-bg);
    color: var(--color-danger);
    border: 1px solid rgba(205, 61, 100, 0.15);
    padding: var(--sp-3) var(--sp-4);
    border-radius: var(--radius-sm);
}

/* ============================================
   Dashboard
   ============================================ */

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--sp-6);
    flex-wrap: wrap;
    gap: var(--sp-4);
}

.dashboard-header h2 {
    font-size: var(--fs-xl);
    font-weight: 600;
    letter-spacing: -0.01em;
}

.period-selector {
    display: flex;
    gap: var(--sp-2);
    align-items: center;
    margin-bottom: var(--sp-6);
}

.period-selector select,
.select-input {
    padding: var(--sp-1) var(--sp-3);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-family: var(--font-family);
    font-size: var(--fs-sm);
    color: var(--color-text);
    background-color: var(--color-surface);
    height: 28px;
    cursor: pointer;
}

.period-selector select:focus,
.select-input:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px var(--color-accent-subtle);
}

/* Partner Cards */
.partners-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--sp-6);
    margin-bottom: var(--sp-8);
}

@media (max-width: 1024px) {
    .partners-grid {
        grid-template-columns: 1fr;
    }
}

.partner-card {
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--sp-6);
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition);
}

.partner-card:hover {
    box-shadow: var(--shadow-md);
}

.partner-header {
    border-bottom: 1px solid var(--color-border-light);
    padding-bottom: var(--sp-4);
    margin-bottom: var(--sp-4);
}

.partner-name {
    font-size: var(--fs-md);
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: var(--sp-1);
}

.partner-department {
    font-size: var(--fs-xs);
    color: var(--color-text-tertiary);
}

.partner-metrics {
    display: flex;
    flex-direction: column;
    gap: var(--sp-1);
}

.metric {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--sp-2) 0;
}

.metric-label {
    font-size: var(--fs-sm);
    font-weight: 500;
    color: var(--color-text-secondary);
}

.metric-value {
    text-align: right;
    font-size: var(--fs-base);
    font-weight: 600;
    color: var(--color-text);
    font-variant-numeric: tabular-nums;
}

.metric-value.negative {
    color: var(--color-negative);
}

.metric-value-large {
    font-size: var(--fs-lg);
}

.metric-highlight {
    background-color: var(--color-accent-subtle);
    padding: var(--sp-3) var(--sp-4);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--color-accent);
}

.metric-divider {
    border: none;
    border-top: 1px solid var(--color-border-light);
    margin: var(--sp-2) 0;
}

.dashboard-actions {
    display: flex;
    gap: var(--sp-3);
    justify-content: center;
    flex-wrap: wrap;
}

/* ============================================
   Next Month Card (Dashboard Checklist)
   ============================================ */

.next-month-card {
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--sp-6);
    box-shadow: var(--shadow-sm);
    margin-bottom: var(--sp-8);
}

.next-month-card h2 {
    font-size: var(--fs-xl);
    font-weight: 600;
    margin-bottom: var(--sp-5);
    letter-spacing: -0.01em;
    color: var(--color-text);
}

.checklist {
    display: flex;
    flex-direction: column;
    gap: var(--sp-2);
}

.checklist-item {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    padding: var(--sp-3) var(--sp-4);
    border-radius: var(--radius-sm);
    background-color: var(--color-bg);
    border: 1px solid var(--color-border-light);
    font-size: var(--fs-sm);
    transition: background-color var(--transition);
}

.checklist-item.done {
    background-color: var(--color-success-bg);
    border-color: rgba(13, 125, 77, 0.12);
}

.checklist-item .check {
    font-size: var(--fs-base);
    font-weight: 600;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
    color: var(--color-text-tertiary);
}

.checklist-item.done .check {
    color: var(--color-success);
}

.checklist-item .btn {
    margin-left: auto;
}

.view-link {
    margin-top: var(--sp-5);
    text-align: center;
}

/* ============================================
   History Table
   ============================================ */

.history-header {
    font-size: var(--fs-md);
    font-weight: 600;
    margin-bottom: var(--sp-3);
    color: var(--color-text);
}

.history-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xs);
    overflow: hidden;
}

.history-table th,
.history-table td {
    padding: var(--sp-3) var(--sp-4);
    text-align: left;
    border-bottom: 1px solid var(--color-border-light);
    font-size: var(--fs-sm);
}

.history-table th {
    background-color: var(--color-bg);
    font-weight: 500;
    font-size: var(--fs-xs);
    color: var(--color-text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.history-table tr:last-child td {
    border-bottom: none;
}

.history-table tbody tr {
    transition: background-color var(--transition);
}

.history-table tbody tr:hover {
    background-color: var(--color-bg);
}

.status-yes {
    color: var(--color-success);
    font-weight: 600;
}

.status-no {
    color: var(--color-text-tertiary);
}

/* ============================================
   Import Page
   ============================================ */

.import-page {
    max-width: 680px;
    margin: 0 auto;
}

.import-header {
    margin-bottom: var(--sp-6);
}

.import-header h2 {
    font-size: var(--fs-xl);
    font-weight: 600;
    margin-bottom: var(--sp-2);
}

.import-header p {
    color: var(--color-text-secondary);
    font-size: var(--fs-base);
}

.import-container {
    background-color: var(--color-surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    margin-bottom: var(--sp-8);
}

.import-section {
    padding: var(--sp-6);
    border-bottom: 1px solid var(--color-border-light);
}

.import-section:last-child {
    border-bottom: none;
}

.section-header h3 {
    font-size: var(--fs-md);
    font-weight: 600;
    margin-bottom: var(--sp-1);
}

.section-description {
    color: var(--color-text-secondary);
    font-size: var(--fs-sm);
    margin-bottom: var(--sp-4);
}

.import-form {
    display: flex;
    flex-direction: column;
    gap: var(--sp-4);
}

.file-input-label {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--sp-6);
    border: 1px dashed var(--color-border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition);
    background-color: var(--color-bg);
}

.file-input-label:hover {
    border-color: var(--color-accent);
    background-color: var(--color-accent-subtle);
}

.file-input-label input[type="file"] {
    display: none;
}

.file-input-icon {
    font-size: var(--fs-2xl);
    margin-right: var(--sp-3);
}

.file-input-text {
    font-weight: 500;
    font-size: var(--fs-sm);
    color: var(--color-text);
}

.import-divider {
    height: 1px;
    background-color: var(--color-border-light);
}

.import-info {
    background-color: var(--color-accent-subtle);
    border-left: 3px solid var(--color-accent);
    padding: var(--sp-4);
    border-radius: var(--radius-sm);
    margin-bottom: var(--sp-8);
}

.import-info h4 {
    font-size: var(--fs-sm);
    font-weight: 600;
    margin-bottom: var(--sp-3);
    color: var(--color-brand-dark);
}

.import-info ol {
    margin-left: var(--sp-5);
    color: var(--color-text-secondary);
    font-size: var(--fs-sm);
}

.import-info li {
    margin-bottom: var(--sp-1);
}

.import-actions {
    display: flex;
    justify-content: center;
    gap: var(--sp-3);
}

/* Import - API Method */
.import-method {
    margin-bottom: var(--sp-3);
}

.import-or {
    text-align: center;
    padding: var(--sp-3) 0;
    color: var(--color-text-tertiary);
    font-size: var(--fs-xs);
    position: relative;
}

.import-or::before,
.import-or::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 40%;
    height: 1px;
    background-color: var(--color-border-light);
}

.import-or::before { left: 0; }
.import-or::after { right: 0; }

.import-or span {
    background-color: var(--color-surface);
    padding: 0 var(--sp-3);
    position: relative;
}

/* ============================================
   Breakdown / Month Detail Page
   ============================================ */

.breakdown-page {
    max-width: 880px;
    margin: 0 auto;
}

.breakdown-header {
    margin-bottom: var(--sp-6);
}

.breakdown-header h2 {
    font-size: var(--fs-2xl);
    font-weight: 600;
    letter-spacing: -0.02em;
    margin-bottom: var(--sp-1);
}

.breakdown-period {
    font-size: var(--fs-sm);
    margin-bottom: var(--sp-2);
}

.breakdown-period a {
    color: var(--color-text-secondary);
    text-decoration: none;
    transition: color var(--transition);
}

.breakdown-period a:hover {
    color: var(--color-brand-dark);
}

.breakdown-description {
    color: var(--color-text-secondary);
    font-size: var(--fs-sm);
    max-width: 560px;
}

.breakdown-container {
    display: flex;
    flex-direction: column;
    gap: var(--sp-6);
    margin-bottom: var(--sp-8);
}

/* Data Sources */
.data-sources {
    display: flex;
    flex-direction: column;
    gap: var(--sp-4);
}

.data-sources .calculation-step {
    margin-top: 0 !important;
}

/* Calculation Steps */
.calculation-step {
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-xs);
}

.step-header {
    background-color: var(--color-bg);
    padding: var(--sp-4) var(--sp-5);
    display: flex;
    align-items: center;
    gap: var(--sp-4);
    border-bottom: 1px solid var(--color-border-light);
}

.step-number {
    background-color: var(--color-brand-dark);
    color: #ffffff;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-weight: 600;
    font-size: var(--fs-sm);
    flex-shrink: 0;
}

.step-title-section {
    flex: 1;
    min-width: 0;
}

.step-title {
    font-size: var(--fs-md);
    font-weight: 600;
    margin-bottom: 0;
    line-height: var(--lh-tight);
}

.step-description {
    font-size: var(--fs-xs);
    color: var(--color-text-tertiary);
    margin-top: var(--sp-1);
}

.step-content {
    padding: var(--sp-5);
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--sp-6);
}

.step-content h4 {
    font-size: var(--fs-sm);
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: var(--sp-3);
    padding-bottom: var(--sp-2);
    border-bottom: 1px solid var(--color-border-light);
}

@media (max-width: 768px) {
    .step-content {
        grid-template-columns: 1fr;
    }
}

/* Formula Styles */
.formulas-section,
.values-section {
    display: flex;
    flex-direction: column;
}

.formulas-section h4,
.values-section h4 {
    font-size: var(--fs-sm);
    margin-bottom: var(--sp-3);
    color: var(--color-text);
    font-weight: 600;
}

.formula-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: var(--sp-2);
}

.formula-item {
    background-color: var(--color-bg);
    padding: var(--sp-2) var(--sp-3);
    border-radius: var(--radius-sm);
    border-left: 2px solid var(--color-accent);
    font-family: var(--font-mono);
    font-size: var(--fs-xs);
    color: var(--color-text);
}

/* Values Table */
.values-table {
    width: 100%;
    border-collapse: collapse;
}

.value-row {
    border-bottom: 1px solid var(--color-border-light);
}

.value-row:last-child {
    border-bottom: none;
}

.value-row.highlight-row {
    background-color: var(--color-accent-subtle);
}

.value-label {
    padding: var(--sp-2) var(--sp-3);
    font-size: var(--fs-sm);
    font-weight: 400;
    color: var(--color-text-secondary);
    text-align: left;
    width: 60%;
}

.value-label strong {
    color: var(--color-text);
    font-weight: 600;
}

.value-amount {
    padding: var(--sp-2) var(--sp-3);
    text-align: right;
    font-weight: 600;
    font-size: var(--fs-sm);
    color: var(--color-text);
    font-variant-numeric: tabular-nums;
}

.value-amount strong {
    color: var(--color-brand-dark);
}

.value-spacer {
    height: var(--sp-4);
}

/* Breakdown Summary */
.breakdown-summary {
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-left: 3px solid var(--color-brand-dark);
    padding: var(--sp-5);
    border-radius: var(--radius-sm);
    margin-bottom: var(--sp-8);
}

.breakdown-summary h3 {
    margin-bottom: var(--sp-3);
    font-size: var(--fs-md);
    font-weight: 600;
    color: var(--color-text);
}

.summary-list {
    list-style: none;
    margin-left: 0;
}

.summary-list li {
    margin-bottom: var(--sp-3);
    color: var(--color-text);
    font-size: var(--fs-sm);
}

.breakdown-actions {
    display: flex;
    justify-content: center;
    gap: var(--sp-3);
    flex-wrap: wrap;
    margin-top: var(--sp-6);
}

/* Single-column step content */
.step-content-single {
    padding: var(--sp-5);
    display: flex;
    flex-direction: column;
    gap: var(--sp-4);
}

/* ============================================
   Bonus Hero (Month Detail Top)
   ============================================ */

.bonus-hero {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--sp-4);
    margin-bottom: var(--sp-6);
}

.bonus-hero-card {
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--sp-6);
    text-align: center;
    box-shadow: var(--shadow-sm);
}

.bonus-hero-label {
    font-size: var(--fs-sm);
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: var(--sp-2);
}

.bonus-hero-label .text-tertiary {
    font-weight: 400;
}

.bonus-hero-amount {
    font-size: 2rem;
    font-weight: 700;
    color: var(--color-brand-dark);
    letter-spacing: -0.02em;
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
    margin-bottom: var(--sp-2);
}

.bonus-hero-detail {
    font-size: var(--fs-xs);
    color: var(--color-text-tertiary);
}

@media (max-width: 600px) {
    .bonus-hero {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   Task Groups (Harvest Breakdown)
   ============================================ */

.task-group {
    margin-top: var(--sp-3);
}

.task-group:first-child {
    margin-top: var(--sp-2);
}

.task-group-header {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    padding: var(--sp-2) var(--sp-3);
    margin-bottom: var(--sp-1);
    font-size: var(--fs-xs);
}

/* ============================================
   Audit History
   ============================================ */

.audit-history {
    margin-top: var(--sp-8);
}

.audit-label {
    vertical-align: top;
}

.audit-detail {
    vertical-align: top;
    white-space: normal;
}

/* ============================================
   Settings Page
   ============================================ */

.settings-page {
    max-width: 680px;
    margin: 0 auto;
}

.settings-header {
    margin-bottom: var(--sp-6);
}

.settings-header h2 {
    font-size: var(--fs-xl);
    font-weight: 600;
    margin-bottom: var(--sp-2);
}

.settings-header p {
    color: var(--color-text-secondary);
    font-size: var(--fs-sm);
}

.settings-container {
    background-color: var(--color-surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-sm);
    padding: var(--sp-6);
    margin-bottom: var(--sp-8);
}

.settings-section {
    margin-bottom: var(--sp-6);
}

.section-title {
    font-size: var(--fs-md);
    font-weight: 600;
    margin-bottom: var(--sp-1);
    color: var(--color-text);
}

.settings-divider {
    height: 1px;
    background-color: var(--color-border-light);
    margin: var(--sp-6) 0;
}

.input-with-suffix {
    position: relative;
    display: flex;
    align-items: center;
}

.input-with-suffix .form-input {
    padding-right: 44px;
}

.input-suffix {
    position: absolute;
    right: var(--sp-3);
    font-weight: 500;
    font-size: var(--fs-sm);
    color: var(--color-text-tertiary);
}

.form-actions {
    display: flex;
    gap: var(--sp-3);
    margin-top: var(--sp-6);
}

.settings-info {
    background-color: var(--color-accent-subtle);
    border-left: 3px solid var(--color-accent);
    padding: var(--sp-4);
    border-radius: var(--radius-sm);
}

.settings-info h4 {
    margin-bottom: var(--sp-3);
    font-size: var(--fs-sm);
    font-weight: 600;
    color: var(--color-brand-dark);
}

.settings-info ul {
    list-style: none;
    margin-left: 0;
}

.settings-info li {
    margin-bottom: var(--sp-2);
    padding-left: var(--sp-5);
    font-size: var(--fs-sm);
    color: var(--color-text-secondary);
    position: relative;
}

.settings-info li:before {
    content: '\2713';
    position: absolute;
    left: 0;
    color: var(--color-success);
    font-weight: 600;
}

.settings-info strong {
    color: var(--color-text);
}

/* Connection Status */
.connection-status {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    margin-bottom: var(--sp-4);
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-2);
    padding: var(--sp-1) var(--sp-3);
    border-radius: 100px;
    font-weight: 500;
    font-size: var(--fs-xs);
}

.status-badge.connected {
    background-color: var(--color-success-bg);
    color: var(--color-success);
}

.status-badge.disconnected {
    background-color: var(--color-danger-bg);
    color: var(--color-danger);
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    display: inline-block;
}

.connected .status-dot {
    background-color: var(--color-success);
}

.disconnected .status-dot {
    background-color: var(--color-danger);
}

.status-detail {
    font-weight: 400;
    font-size: var(--fs-xs);
    color: var(--color-text-tertiary);
}

.inline-form {
    margin-top: var(--sp-3);
}

/* ============================================
   Report Page
   ============================================ */

.report-page {
    max-width: 880px;
    margin: 0 auto;
}

.report-header {
    margin-bottom: var(--sp-6);
}

.report-header h2 {
    font-size: var(--fs-xl);
    font-weight: 600;
    margin-bottom: var(--sp-1);
}

.report-header p {
    color: var(--color-text-secondary);
    font-size: var(--fs-sm);
}

.data-status-bar {
    display: flex;
    gap: var(--sp-4);
    margin-bottom: var(--sp-6);
    padding: var(--sp-3) var(--sp-4);
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xs);
}

.data-status-item {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    font-size: var(--fs-sm);
    font-weight: 500;
}

.data-status-item.available .status-icon {
    color: var(--color-success);
}

.data-status-item.missing .status-icon {
    color: var(--color-warning);
}

.harvest-summary {
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--sp-5);
    box-shadow: var(--shadow-xs);
    margin-bottom: var(--sp-6);
}

.harvest-summary h3 {
    font-size: var(--fs-md);
    font-weight: 600;
    margin-bottom: var(--sp-4);
}

.qbo-upload-prompt {
    background-color: var(--color-warning-bg);
    border: 1px solid rgba(217, 121, 23, 0.15);
    border-left: 3px solid var(--color-warning);
    border-radius: var(--radius-sm);
    padding: var(--sp-4);
    margin-bottom: var(--sp-6);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--sp-3);
}

.qbo-upload-prompt p {
    font-weight: 500;
    font-size: var(--fs-sm);
    color: var(--color-text);
    margin: 0;
}

.no-data-message {
    text-align: center;
    padding: var(--sp-12);
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xs);
}

.no-data-message h3 {
    margin-bottom: var(--sp-2);
    font-size: var(--fs-md);
    font-weight: 600;
    color: var(--color-text-secondary);
}

.no-data-message p {
    color: var(--color-text-tertiary);
    font-size: var(--fs-sm);
    margin-bottom: var(--sp-5);
}

.report-actions {
    display: flex;
    justify-content: center;
    gap: var(--sp-3);
    margin-top: var(--sp-8);
}

/* ============================================
   Department Badges
   ============================================ */

.dept-badge {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.dept-design {
    background-color: var(--color-accent-subtle);
    color: #0e6e73;
}

.dept-development {
    background-color: var(--color-warm-subtle);
    color: #9a5b2e;
}

/* ============================================
   Details / Expandable
   ============================================ */

details summary {
    cursor: pointer;
    font-weight: 500;
    font-size: var(--fs-sm);
    color: var(--color-text-secondary);
    padding: var(--sp-2) 0;
    transition: color var(--transition);
}

details summary:hover {
    color: var(--color-text);
}

details[open] summary {
    margin-bottom: var(--sp-2);
}

/* ============================================
   Utility Classes
   ============================================ */

.text-tertiary {
    color: var(--color-text-tertiary);
    font-weight: 400;
}

/* ============================================
   Period Navigation (Dashboard + Month Detail)
   ============================================ */

.period-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--sp-4);
    margin-bottom: var(--sp-6);
}

.period-nav h2 {
    font-size: var(--fs-xl);
    font-weight: 600;
    letter-spacing: -0.01em;
    margin: 0;
    min-width: 180px;
    text-align: center;
}

.period-arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: all var(--transition);
    font-size: var(--fs-sm);
    text-decoration: none;
    line-height: 1;
}

.period-arrow:hover {
    background: var(--color-bg);
    border-color: #c4cdd5;
    color: var(--color-text);
}

.period-arrow.disabled {
    opacity: 0.3;
    pointer-events: none;
}

.period-latest {
    font-size: var(--fs-xs);
    font-weight: 500;
    padding: var(--sp-1) var(--sp-3);
    border-radius: 100px;
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
}

.period-latest:hover {
    background: var(--color-bg);
    color: var(--color-text);
}

/* ============================================
   Breadcrumb (Month Detail)
   ============================================ */

.breadcrumb {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    font-size: var(--fs-sm);
    margin-bottom: var(--sp-4);
}

.breadcrumb a {
    color: var(--color-text-secondary);
    text-decoration: none;
    transition: color var(--transition);
}

.breadcrumb a:hover {
    color: var(--color-brand-dark);
}

.breadcrumb-sep {
    color: var(--color-text-tertiary);
}

.breadcrumb-current {
    color: var(--color-text);
    font-weight: 500;
}

.breakdown-top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--sp-5);
}

.breakdown-top-bar .period-nav {
    margin-bottom: 0;
    gap: var(--sp-3);
}

.breakdown-top-bar .period-nav h2 {
    min-width: 0;
    font-size: var(--fs-2xl);
}

/* ============================================
   Button Enhancements
   ============================================ */

.btn-ghost {
    background: none;
    border: none;
    color: var(--color-text-secondary);
    padding: var(--sp-1) var(--sp-2);
    font-size: var(--fs-sm);
    font-weight: 500;
    cursor: pointer;
    transition: color var(--transition);
    text-decoration: none;
    height: auto;
}

.btn-ghost:hover {
    color: var(--color-brand-dark);
    text-decoration: underline;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.btn.loading {
    pointer-events: none;
    opacity: 0.7;
    position: relative;
}

.btn.loading::after {
    content: '';
    width: 14px;
    height: 14px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    margin-left: var(--sp-2);
}

/* ============================================
   Revenue Split Bar
   ============================================ */

.split-bar {
    display: flex;
    height: 28px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    margin: var(--sp-3) 0;
    border: 1px solid var(--color-border-light);
}

.split-segment {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--fs-xs);
    font-weight: 600;
    transition: width 0.3s ease;
    min-width: 40px;
}

.split-segment.design {
    background-color: var(--color-accent-subtle);
    color: #0e6e73;
    border-right: 1px solid var(--color-border-light);
}

.split-segment.development {
    background-color: var(--color-warm-subtle);
    color: #9a5b2e;
}

/* ============================================
   Metrics Bar (Compact Data Summary)
   ============================================ */

.metrics-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: var(--sp-3);
    padding: var(--sp-4) var(--sp-5);
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xs);
    margin-bottom: var(--sp-5);
}

.metrics-bar-item {
    display: flex;
    flex-direction: column;
    gap: var(--sp-1);
}

.metrics-bar-label {
    font-size: var(--fs-xs);
    color: var(--color-text-tertiary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.metrics-bar-value {
    font-size: var(--fs-base);
    font-weight: 600;
    color: var(--color-text);
    font-variant-numeric: tabular-nums;
}

/* ============================================
   Bonus Hero Enhancements
   ============================================ */

.bonus-hero-card.dept-design-accent {
    border-top: 3px solid var(--color-accent);
}

.bonus-hero-card.dept-dev-accent {
    border-top: 3px solid var(--color-warm);
}

.bonus-hero-amount.negative {
    color: var(--color-negative);
}

.bonus-hero-cf-note {
    font-size: var(--fs-xs);
    color: var(--color-negative);
    font-weight: 500;
    margin-top: var(--sp-1);
}

.bonus-hero-link {
    display: inline-block;
    margin-top: var(--sp-3);
    font-size: var(--fs-xs);
    color: var(--color-text-secondary);
    text-decoration: none;
    transition: color var(--transition);
}

.bonus-hero-link:hover {
    color: var(--color-brand-dark);
    text-decoration: underline;
}

/* Dashboard bonus summary (inline) */
.bonus-summary-grid {
    margin-top: var(--sp-5);
    padding: var(--sp-5);
    border-radius: var(--radius-md);
    background: var(--color-bg);
}

.bonus-summary-grid .bonus-hero {
    margin-bottom: var(--sp-3);
}

.bonus-summary-grid .bonus-hero-card {
    padding: var(--sp-4);
    box-shadow: none;
    border: 1px solid var(--color-border-light);
}

.bonus-summary-grid .bonus-hero-amount {
    font-size: var(--fs-2xl);
}

/* ============================================
   Collapsible Calculation Steps
   ============================================ */

.steps-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--sp-4);
    margin-top: var(--sp-6);
}

.steps-section-header h3 {
    font-size: var(--fs-md);
    font-weight: 600;
    color: var(--color-text);
}

.toggle-all-btn {
    font-size: var(--fs-xs);
    color: var(--color-text-secondary);
    background: none;
    border: none;
    cursor: pointer;
    font-weight: 500;
    font-family: var(--font-family);
    transition: color var(--transition);
}

.toggle-all-btn:hover {
    color: var(--color-brand-dark);
}

details.step-collapsible {
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-xs);
    transition: box-shadow var(--transition);
}

details.step-collapsible:hover {
    box-shadow: var(--shadow-sm);
}

details.step-collapsible > summary {
    list-style: none;
    padding: 0;
    font-size: inherit;
    color: inherit;
}

details.step-collapsible > summary::-webkit-details-marker {
    display: none;
}

details.step-collapsible > summary .step-header {
    cursor: pointer;
    user-select: none;
    transition: background-color var(--transition);
}

details.step-collapsible > summary .step-header:hover {
    background-color: #eef1f4;
}

details.step-collapsible > summary .step-expand-icon {
    margin-left: auto;
    color: var(--color-text-tertiary);
    font-size: var(--fs-sm);
    transition: transform var(--transition);
    flex-shrink: 0;
}

details.step-collapsible[open] > summary .step-expand-icon {
    transform: rotate(90deg);
}

details.step-collapsible[open] > summary {
    margin-bottom: 0;
}

/* ============================================
   Sticky Context Bar (Month Detail)
   ============================================ */

.sticky-context-bar {
    position: sticky;
    top: 41px; /* below main nav */
    z-index: 90;
    background-color: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    padding: var(--sp-2) var(--sp-5);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--sp-6);
    font-size: var(--fs-sm);
    transform: translateY(-100%);
    opacity: 0;
    transition: transform 0.2s ease, opacity 0.2s ease;
    pointer-events: none;
}

.sticky-context-bar.visible {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
}

.sticky-context-period {
    font-weight: 600;
    color: var(--color-text);
}

.sticky-context-bonus {
    display: flex;
    gap: var(--sp-4);
    font-variant-numeric: tabular-nums;
}

.sticky-context-bonus span {
    color: var(--color-text-secondary);
}

.sticky-context-bonus strong {
    color: var(--color-text);
    margin-left: var(--sp-1);
}

/* ============================================
   History Table Bonus Columns
   ============================================ */

.history-table .bonus-col {
    text-align: right;
    font-variant-numeric: tabular-nums;
    font-weight: 600;
}

.history-table .bonus-col.negative {
    color: var(--color-negative);
}

/* ============================================
   Animations
   ============================================ */

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

.fade-slide-in {
    animation: fadeSlideIn 0.3s ease forwards;
}

/* ============================================
   P&L Statement Layout
   ============================================ */

.pnl-statement {
    display: flex;
    flex-direction: column;
    gap: var(--sp-4);
    padding-top: var(--sp-2);
}

.pnl-section {
    border-bottom: 1px solid var(--color-border-light);
    padding-bottom: var(--sp-3);
}

.pnl-section:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.pnl-section-header {
    font-size: var(--fs-sm);
    font-weight: 600;
    color: var(--color-text);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: var(--sp-2) var(--sp-3);
    margin-bottom: var(--sp-1);
    border-bottom: 2px solid var(--color-border);
}

/* ============================================
   Carry-Forward Alert
   ============================================ */

.cf-alert {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    padding: var(--sp-3) var(--sp-4);
    background-color: var(--color-warning-bg);
    border: 1px solid rgba(217, 121, 23, 0.15);
    border-left: 3px solid var(--color-warning);
    border-radius: var(--radius-sm);
    font-size: var(--fs-sm);
    color: var(--color-text);
    margin-bottom: var(--sp-5);
}

/* ============================================
   Step Sub-sections & Formula Display
   ============================================ */

.step-substep {
    font-size: var(--fs-sm);
    font-weight: 600;
    color: var(--color-brand-dark);
    margin-bottom: var(--sp-3);
    padding-left: var(--sp-3);
    border-left: 3px solid var(--color-accent);
}

.formula-display {
    font-family: var(--font-mono);
    font-size: var(--fs-xs);
    line-height: 1.7;
    background-color: var(--color-bg);
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-sm);
    padding: var(--sp-3) var(--sp-4);
    white-space: pre-wrap;
    color: var(--color-text);
    font-variant-numeric: tabular-nums;
}

.step-note {
    font-size: var(--fs-xs);
    font-weight: 500;
    padding: var(--sp-1) var(--sp-3);
    margin-top: var(--sp-2);
}

.step-note.positive {
    color: var(--color-success);
}

.step-note.negative {
    color: var(--color-negative);
}

.cf-result {
    font-size: var(--fs-sm);
    font-weight: 600;
    color: var(--color-negative);
    padding: var(--sp-2) var(--sp-3);
    background-color: var(--color-danger-bg);
    border-radius: var(--radius-sm);
    margin-top: var(--sp-2);
}

.clamping-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--sp-2) var(--sp-3);
    font-size: var(--fs-sm);
    border-bottom: 1px solid var(--color-border-light);
    font-variant-numeric: tabular-nums;
}

.clamping-row:last-child {
    border-bottom: none;
}

.clamping-arrow {
    color: var(--color-text-tertiary);
    margin: 0 var(--sp-2);
}

.step-content-full {
    padding: var(--sp-5);
    display: flex;
    flex-direction: column;
    gap: var(--sp-5);
}

.step-subsection {
    display: flex;
    flex-direction: column;
    gap: var(--sp-3);
}

.step-subsection-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--sp-5);
}

@media (max-width: 600px) {
    .step-subsection-split {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   Print Styles
   ============================================ */

@media print {
    body {
        background-color: white;
        font-size: 12px;
    }

    .app-header,
    .main-nav,
    .app-footer,
    .dashboard-actions,
    .import-actions,
    .breakdown-actions,
    .report-actions,
    .data-status-bar,
    .qbo-upload-prompt,
    .form-actions {
        display: none;
    }

    .main-content {
        padding: 0;
        max-width: none;
    }

    .partner-card,
    .calculation-step {
        box-shadow: none;
        border: 1px solid #ddd;
        page-break-inside: avoid;
    }

    .btn {
        display: none;
    }
}

/* ============================================
   Responsive
   ============================================ */

@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr;
    }

    .dashboard-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .period-selector {
        flex-wrap: wrap;
    }

    .step-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .nav-menu {
        flex-wrap: wrap;
    }

    .main-content {
        padding: var(--sp-5) var(--sp-4);
    }

    .metrics-bar {
        grid-template-columns: repeat(2, 1fr);
    }

    .breakdown-top-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--sp-3);
    }
}

@media (max-width: 480px) {
    .app-header {
        padding: var(--sp-4) var(--sp-4);
    }

    .dashboard-actions {
        flex-direction: column;
    }

    .dashboard-actions .btn {
        width: 100%;
    }

    .period-selector {
        width: 100%;
        flex-direction: column;
    }

    .period-selector select {
        width: 100%;
    }

    .metric {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--sp-1);
    }

    .metric-value {
        width: 100%;
    }
}
