/* ----------------------------------------------------------
   0. ROOT VARIABLES (COLOR SYSTEM)
   ---------------------------------------------------------- */

:root {
    /* New global palette (“modern home”) */
    --color-bg-main:   #F4F4F2;
    --color-bg-soft:   #F9F9F8;
    --color-bg-stone:  #E1E1DD;

    --color-primary:       #1F3A5F;  /* Deep navy */
    --color-primary-dark:  #2A4C77;
    --color-text-main:     #2D2D2F;
    --color-text-muted:    #575757;

    --color-accent-teal:   #1CA68D;
    --color-accent-gold:   #D8B75A;
    --color-accent-steel:  #3F5E7B;
    --color-accent-mint:   #DFF5EE;
    --color-accent-rose:   #D8C0B2;

    --color-panel-warm:    #F1F0E4;
    --ttk-gold-accent:    #D6A756; /* warm gold accent */

    --shadow-soft: 0 18px 40px rgba(0, 0, 0, 0.05);
    --radius-card: 1rem;

    /* Your original ttk variables (kept for compatibility) */
    --ttk-navy:#0B1C36;      /* trust */
    --ttk-teal:#00BFA6;      /* growth */
    --ttk-ink:#111827;       /* headings */
    --ttk-slate:#6B7280;     /* secondary text */
    --ttk-bg:#F3F5F7;        /* light bg */
    --dashboard-sticky-offset: 8rem;
    /* Allow the commission table to grow taller before scrolling */
    /* --commission-table-max-height: calc(84vh - 5rem); */
}

/* ----------------------------------------------------------
   1. GLOBAL BASE STYLES
   ---------------------------------------------------------- */

html, body {
    height: 100%;
}

body {
    margin: 0;
    background-color: var(--color-bg-main);
    color: var(--color-text-main);
    font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
    font-size: 1rem;
    line-height: 1.5;
}

.text-muted-custom {
    color: var(--color-text-muted) !important;
}

.text-primary-navy {
    color: var(--color-primary) !important;
}

.no-focus-outline:focus,
.no-focus-outline:focus-visible {
    outline: none !important;
    box-shadow: none !important;
    border-color: #ced4da !important;
    cursor: default;
}

/* ----------------------------------------------------------
   2. LAYOUT / NAVBAR
   ---------------------------------------------------------- */

/* Sticky nav: keep your sticky behavior + shadow, but background is controlled by .navbar-main */
.navbar-sticky {
    position: sticky;
    top: 0;
    z-index: 1030;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
}

/* Main navbar using new palette */
.navbar-main {
    background-color: var(--color-primary);
    box-shadow: var(--shadow-soft);
}

/* Brand */
.navbar-main .navbar-brand {
    font-weight: 700;
    letter-spacing: 0.03em;
    color: #ffffff;
}

.navbar-main .navbar-brand:hover,
.navbar-main .navbar-brand:focus {
    color: #ffffff;
    text-decoration: none;
}

/* Nav links */
.navbar-main .nav-link {
    color: rgba(255, 255, 255, 0.8);
    font-weight: 500;
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
    margin-right: 0.25rem;
    margin-left: 0.25rem;
}

.navbar-main .nav-link:hover,
.navbar-main .nav-link:focus {
    color: #ffffff;
}

/* Active nav link */
.navbar-main .nav-link.active {
    color: #ffffff;
    position: relative;
}

.navbar-main .nav-link.active::after {
    content: "";
    position: absolute;
    left: 0.5rem;
    right: 0.5rem;
    bottom: -0.35rem;
    height: 3px;
    border-radius: 999px;
    background-color: var(--color-accent-teal);
}

/* “Hello, Name” */
.navbar-main .navbar-text {
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.95rem;
}

/* Toggler */
.navbar-main .navbar-toggler {
    border-color: rgba(255, 255, 255, 0.4);
}
.navbar-main .navbar-toggler-icon {
    filter: invert(1);
}

/* Old .nav-item.active (kept but mostly redundant now) */
.nav-item.active {
    background-color: var(--ttk-teal);
    border-color: var(--ttk-teal);
    border-radius: 0.5rem;
}

/* Optional content max width */
.main-container {
    max-width: 1200px;
    margin: 0 auto;
}

/* Generic section helper */
.section {
    padding: 3rem 1rem;
}

/* ----------------------------------------------------------
   3. HERO SECTION (HOME/PRICING ETC.)
   ---------------------------------------------------------- */

.hero {
    position: relative;
    background: radial-gradient(1200px 600px at 10% -20%, rgba(0,191,166,.18), transparent 50%),
                radial-gradient(1000px 600px at 110% 0%, rgba(11,28,54,.22), transparent 35%),
                linear-gradient(180deg, #ffffff 0%, #f7fafc 100%);
    overflow: hidden;
}

.hero .brand-badge {
    font-weight:700;
    letter-spacing:.4px;
    color: var(--ttk-navy);
}

.hero h1 {
    font-weight:800;
    color: var(--ttk-ink);
}

.hero .lead {
    color: var(--ttk-slate);
}

.btn-ttk {
    --bs-btn-bg: var(--ttk-teal);
    --bs-btn-border-color: var(--ttk-teal);
    --bs-btn-hover-bg: #07a792;
    --bs-btn-hover-border-color:#07a792;
    --bs-btn-focus-shadow-rgb: 0,191,166;
    color:#041316;
    font-weight:600;
}

.tagline-chip {
    display:inline-block;
    border-radius:999px;
    padding:.4rem .75rem;
    font-size:.85rem;
    background:#E6FFFA;
    color:#065F46;
    border:1px solid rgba(0,191,166,.35);
}

.hero-card {
    background:#fff;
    border:1px solid #e8edf3;
    box-shadow: 0 10px 25px rgba(17,24,39,.07);
}

/* Optional new hero-section helper (used on other pages) */
.hero-section {
    background: radial-gradient(
        circle at top left,
        #FFFFFF 0,
        var(--color-bg-main) 45%,
        var(--color-bg-stone) 100%
    );
    padding: 3rem 1rem;
}
.hero-section .hero-title { color: var(--color-primary); }
.hero-section .hero-subtitle { color: var(--color-text-muted); }

/* ----------------------------------------------------------
   4. CARDS & COMMON COMPONENTS
   ---------------------------------------------------------- */

.card-elevated {
    border: none;
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-soft);
    background-color: #ffffff;
}

.badge-soft-gold {
    background-color: var(--color-accent-gold);
    color: var(--color-text-main);
}

.bg-panel-warm {
    background-color: var(--color-panel-warm) !important;
}

.section-card-bg {
    background-color: #ffffff;
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-soft);
}

/* Dashboard “room” accents */
.card-dashboard-accent {
    border-left: 5px solid var(--color-accent-teal);
}

.card-commissions-accent {
    border-top: 4px solid var(--color-accent-steel);
}

.card-uploads-accent {
    border-left: 4px solid var(--color-accent-teal);
    background-color: var(--color-accent-mint);
}

.card-profile-accent {
    border-top: 4px solid var(--color-accent-rose);
}


/* Equal height helper for landing cards */
.card-equal {
    min-height: 200px;
}

/* ----------------------------------------------------------
   5. DASHBOARD HERO CARD / GUIDE SCROLL
   ---------------------------------------------------------- */

/* Dashboard hero image inside dark card */
.card-hero { 
    position: relative;
    transition: background-color .15s ease, box-shadow .15s ease;
    overflow: visible;
    z-index: 1;
}
.card-hero .card-hero-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 1;
  pointer-events: none;
  user-select: none;
  filter: none;
  z-index: -1;
  border-radius: inherit;
}
.card-hero:hover {
  background-color: rgba(var(--bs-primary-rgb, 13, 110, 253), 0.25);
}

/* Raise card when dropdown open */
.card-hero:has(.dropdown-menu.show) { z-index: 1025; }

/* Keep card visible while scroll */
.card-commission--fixed {
  position: sticky;
  top: 213px;
}

/* Guide scroll (if used anywhere) */
.guide-scroll {
  max-height: 60vh;
  overflow-y: scroll;
  overscroll-behavior: contain;
}

@media (max-width: 576px) {
  .card-hero .card-hero-img {
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
  }
}

/* ----------------------------------------------------------
   6. COMMISSION TABLE / SCROLL / HEADERS
   ---------------------------------------------------------- */

#commission_table {
    table-layout: fixed;
    width: 100%;
}

/* Column widths – keep your original exact widths */
#commission_table .col-cur        { width: 50px; }
#commission_table .col-invoice    { width: 130px; }
#commission_table .col-sale       { width: 90px; }
#commission_table .col-date       { width: 110px; }
#commission_table .col-vendor     { width: 155px; }
#commission_table .col-client     { width: 155px; }
#commission_table .col-gross      { width: 90px; }
#commission_table .col-net        { width: 90px; }
#commission_table .col-balance    { width: 90px; }
#commission_table .col-amt-owing  { width: 90px; }
#commission_table .col-amt-paid   { width: 80px; }
#commission_table .col-status     { width: 80px; }
#commission_table .col-actions    { width: 55px; }

/* Alternative generic width classes (if you want to use them outside #commission_table too) */
.col-cur      { width: 4%;  }
.col-invoice  { width: 9%;  }
.col-sale     { width: 8%;  }
.col-date     { width: 8%;  }
.col-vendor   { width: 12%; }
.col-client   { width: 14%; }
.col-gross    { width: 7%;  }
.col-net      { width: 7%;  }
.col-balance  { width: 8%;  }
.col-amt-owing{ width: 8%;  }
.col-amt-paid { width: 8%;  }
.col-status   { width: 7%;  }
.col-actions  { width: 5%;  }

/* Scroll container */
.commission-table-scroll {
  /* Respect the CSS variable; fallback matches the default so tweaking the var takes effect */
  max-height: var(--commission-table-max-height, calc(84vh - 5rem));
  min-height: 400px;
  overflow-y: auto !important;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch; /* momentum scrolling on iOS */
  overscroll-behavior: contain;
  position: relative;
  display: block;
}
.commission-table-scroll table {
  margin-bottom: 0;
}
.commission-table-scroll thead th {
  position: sticky;
  z-index: 5;
  background-color: white;
}

/* Per-table override for header row 1 height */
.commission-table-scroll {
  --commission-header-row1-height: 34.5px; /* tweak this value */
}

/* Primary header row sticks to top */
.commission-header-band th { 
  position: sticky;
  top:0;
  z-index: 6;
}

/* Secondary header row just below */
.commission-header-columns th {
  position: sticky;
  top: var(--commission-header-row1-height, 30px);
  z-index: 7;
}

/* Visually nicer header band cards */
.commission-header-band th > .card {
    background-color:white;
    border-color: black;
    box-shadow: none;
}

.commission-header-columns {
    background-color: #f1f3f5;
}

/* Smaller body rows */
#commission_table tbody tr {
    font-size: 0.8rem;
}

/* Shared styling to keep display/edit similar */
#commission_table td .js-display,
#commission_table td .js-edit-input {
    font-size: 0.8rem;
    line-height: 1.0;
}

/* Tight inputs */
#commission_table td .js-edit-input.form-control-sm {
    padding-top: 0.1rem;
    padding-bottom: 0.1rem;
    margin: 0;
    border-color: var(--bs-primary);
    box-shadow: 0 0 0 0.1rem rgba(13, 110, 253, 0.15);
}

/* Cells */
#commission_table td {
    white-space: nowrap;
    vertical-align: middle;
    padding: 0.05rem 0.1rem;
}

/* Numeric cells easier to scan */
#commission_table td.text-center .js-edit-input {
    text-align: center;
}

/* Compact alerts */
#commission_alert,
#add_commission_alert {
    padding: 0.4rem 0.6rem;
    font-size: 12px;
}

/* Empty row */
#commission_empty_row {
    background-color: #ffffff;
}

/* Status / history button hover */
#commission_table .btn.js-status-history {
    filter: brightness(1.0);
    transition: filter 0.15s ease, opacity 0.15s ease;
}
#commission_table .btn.js-status-history:hover,
#commission_table .btn.js-status-history:focus {
    filter: brightness(0.93);
    color: inherit;
}

/* ----------------------------------------------------------
   7. DASHBOARD SUMMARY / PANELS / MODALS
   ---------------------------------------------------------- */

/* --- Dashboard summary cards (left column) --- */

.dashboard-summary-card {
  background-color: var(--color-panel-warm);
  border-radius: 0.75rem;

  /* Base neutral border on all sides */
  border: 1px solid rgba(0, 0, 0, 0.04);

  /* Strong gold “L” shape: left + bottom */
  border-left-width: 6px;
  border-left-color: var(--color-accent-gold);

  border-bottom-width: 4px;              /* a bit thinner looks good */
  border-bottom-color: var(--color-accent-gold);

  /* Depth */
  box-shadow: 0 14px 28px rgba(15, 23, 42, 0.10);

}
/* Paid card: edge in green instead of gold */
.dashboard-summary-card.paid {
  border-left-color: var(--color-accent-teal);
  border-bottom-color: var(--color-accent-teal);
}

/* Outstanding card: edge in red instead of gold */
.dashboard-summary-card.outstanding {
  border-left-color: #b91c1c;
  border-bottom-color: #b91c1c;
}

/* Label (top line) */
.dashboard-summary-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-weight: 600;
  color: var(--color-text-muted);
  margin-bottom: 0.12rem;
}

/* Main value */
.dashboard-summary-value {
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--color-text-main);
}

/* Hint under the value */
.dashboard-summary-hint {
  margin-top: 0.2rem;
  font-size: 0.72rem;
  line-height: 1.3;
  color: rgba(87, 87, 87, 0.95);
}

/* Semantic variants */
.dashboard-summary-value-positive {
  color: var(--color-accent-teal);                  /* paid = good */
}

.dashboard-summary-value-negative {
  color: #b91c1c;                                   /* outstanding = strong warning */
}


/* Filters card */
.dashboard-filters-card {
    border: none;
    box-shadow: var(--shadow-soft);
    border-radius: 0.75rem;
}

/* Commission list main card */
.dashboard-commission-card {
    border: none;
    box-shadow: var(--shadow-soft);
}

/* Full-screen overlay for Add/Recover/Payment panels – as you had originally */
.add-commission-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1060;
    overflow: auto;
    background: rgba(0, 0, 0, 0.35);
    padding: 1.5rem 0.75rem;
}

/* Prevent layout shift when overlays toggle on desktop only */
body.overlay-open {
    overflow: hidden;
    padding-right: var(--scrollbar-width, 0px);
}
@media (max-width: 991.98px) {
    body.overlay-open {
        padding-right: 0;
    }
}

/* Panel inside overlay */
.add-commission-panel {
    max-width: 1100px;
    margin: 0 auto;
    border-radius: var(--radius-card);
    border: none;
    box-shadow: var(--shadow-soft);
}

/* Warm panel bodies */
.add-commission-panel .card-body,
#recover_commission_collapse .card-body,
#payment_history_collapse .card-body {
    /* Give overlay forms a subtle warm tint so inputs pop against the dashboard background */
    background-color: #f7f4ec;
    max-height: none;
    overflow-y: visible;
}

/* Explicit class hook for the main Add Commission body */
.add-commission-body {
    background-color: #E1E1DD;
}

/* Contrast card for the right-hand section of Add Commission */
.add-commission-card-contrast {
    background-color: #d0ceca;
}

/* Payment history title */
.payment-history-title {
    color: var(--color-primary);
}

/* Recover & payment tables */
#recover_commission_collapse .table,
#payment_history_collapse .table {
    font-size: 0.85rem;
}
#payment_history_collapse .table-responsive {
    max-height: 75vh;
    overflow-y: auto;
}
#payment_history_collapse .card-body {
    max-height: none;
    overflow: visible;
}

#payment_history_collapse thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #fff;
    box-shadow: 0 2px 3px rgba(0, 0, 0, 0.06);
}

.note-popover.popover .popover-body {
    padding: 8px 12px;
    font-size: 10px;
}
.note-popover.popover .popover-header {
    font-size: 12px;
    padding: 6px 8px;
}

.recycle-bold {
  font-weight: bold;
  -webkit-text-stroke: .7px;
}

/* Guided steps in Add Commission */
.step-badge {
  display:inline-block;
  min-width:1.25em;
  padding:0 .35em;
  margin-right:.35rem;
  border-radius:999px;
  font-size:.75em;
  font-weight:700;
  line-height:1.4;
  color:#0B1C36;
  background:#B2D8CE;
  border:1px solid rgba(0,0,0,.08);
}
.step-field {
  position:relative;
  transition: box-shadow .15s ease, border-color .15s ease, background-color .15s ease;
  border:1px dashed transparent;
  border-radius:.25rem;
  padding:.25rem .35rem;
}
.step-field.current {
  border-color: var(--ttk-teal, #00BFA6);
  box-shadow: 0 0 0 2px rgba(0,191,166,.2);
  background: rgba(0,191,166,.06);
}
button.step-save-current {
  outline: none !important;
  box-shadow: 0 0 0 3px rgba(0,191,166,.35);
}

/* Flash areas in header */
#profile_errors,
#profile_success {
    min-height: 1.75rem;
}

.alert {
    font-size:12px;
}

/* Dashboard H1 + flash overlay helper (if you want to use it) */
.dashboard-title-wrap {
    position: relative;
}
.dashboard-title-wrap .flash-overlay {
    position: absolute;
    top: 0;
    left: 110px;
    right: 0;
    max-width: 420px;
}

/* ----------------------------------------------------------
   8. STATUS BUTTONS
   ---------------------------------------------------------- */

.bg-paid {
    background-color: #10f31f;
}
.btn.bg-paid {
    background-color: #10f31f;
    border-color: #10f31f;
    color: #0b1f12;
}
.btn.bg-paid:hover,
.btn.bg-paid:focus,
.bg-paid:hover,
.bg-paid:focus {
    background-color: #bdf5c2;
    border-color: #bdf5c2;
    color: #0b1f12;
}

.status-btn {
    border: none;
    width:60px;

    font-size: 0.75rem;
    line-height: 1.1;
    padding: 0.15rem 0.6rem;
}
.status-btn:disabled {
    opacity: 0.8;
    pointer-events: none;
}

/* Now themed using your palette */
.status-btn-paid,
.status-btn-paid:disabled {
    background-color: var(--color-accent-teal);
    color: #fff !important;
}
.status-btn-partial,
.status-btn-partial:disabled {
    background-color: #fdc727;
    color: #684f04 !important;
}
.status-btn-unpaid,
.status-btn-unpaid:disabled {
    background-color: var(--color-accent-gold);
    color: #212529 !important;
}

/* Edit/pay/cancel/save/delete button sizing */
.js-edit-row,
.js-cancel-row,
.js-pay-row,
.js-save-row,
.js-delete-row {
    font-size: 0.8rem;
}

/* ----------------------------------------------------------
   9. MISC / UTILITIES
   ---------------------------------------------------------- */

/* Outline variant consistency */
.btn-outline-secondary { border-color: #ced4da; }

/* Fade-out helper for alerts / lockout box */
.fade-out {
  opacity: 0;
  transition: opacity 0.6s ease-out;
}

/* Search inputs */
#commission_search,
#payment_history_search {
    background-color: var(--bs-primary-bg-subtle, #e7f1ff);
}

/* ----------------------------------------------------------
   10. RESPONSIVE TWEAKS
   ---------------------------------------------------------- */

@media (max-width: 991.98px) {
    .navbar-main .nav-link {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
    .navbar-main .nav-link.active::after {
        left: 0.75rem;
        right: 0.75rem;
    }
    .commission-table-scroll {
        /* Keep scrolling on mobile so content isn't cut off */
        max-height: calc(60vh - 10rem);
        min-height: 50vh;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;
    }
}

@media (max-width: 767.98px) {
    .dashboard-summary-card {
        margin-bottom: 0.5rem;
    }
}

/* -------- Landing page stats -------- */

.home-stat-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-weight: 600;
    color: var(--color-text-muted);
}

.home-stat-value {
    font-size: 1.3rem;
    font-weight: 700;
    line-height: 1.2;
}

/* Neutral numbers (Sales) */
.home-stat-value-neutral {
    color: var(--color-text-main);
}

/* Earned in gold */
.home-stat-value-gold {
    color: var(--color-accent-gold);
}

/* Paid in teal */
.home-stat-value-positive {
    color: var(--color-accent-teal);
}

/* Outstanding in red */
.home-stat-value-negative {
    color: #b91c1c;
}

.home-stat-hint {
    font-size: 0.75rem;
    margin-top: 0.15rem;
}

.home-stat-hint-muted {
    color: var(--color-text-muted);
}

.home-stat-hint-success {
    color: var(--color-accent-teal);
}

.home-stat-hint-warning {
    color: #b45309;
}
.auth-badge {
    /* Stronger background so it pops on white */
    background-color: var(--color-guest-rose, #D8C0B2);
    color: var(--color-brand-navy, #1F3A5F);
    font-weight: 500;
    font-size: 0.8rem;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}
