/* ========================================
   Daily Business Tracker — Custom Styles
   Design: Modern Clean Executive aesthetic —
   warm amber/saffron + slate palette,
   Plus Jakarta Sans / Inter body.
   ======================================== */

/* ---------- Design Tokens ---------- */
:root {
    --saffron:        #f59e0b;
    --saffron-dark:   #d97706;
    --saffron-light:  #fef3c7;

    --charcoal:       #0f172a;
    --charcoal-mid:   #1e293b;
    --charcoal-light: #334155;

    --slate:          #64748b;
    --slate-light:    #f8fafc;

    --success:        #22c55e;
    --danger:         #ef4444;
    --info:           #3b82f6;

    --sidebar-width:  260px;
    --topbar-h:       60px;
    --radius:         16px;

    --shadow-sm:      0 1px 3px rgba(0,0,0,.05),
                      0 1px 2px rgba(0,0,0,.10);

    --shadow-md:      0 10px 25px -5px rgba(0,0,0,.08);

    --shadow-lg:      0 20px 40px -15px rgba(0,0,0,.15);

    --font-display:   'Space Grotesk', sans-serif;
    --font-body:      'Inter', sans-serif;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    font-family: var(--font-body);
    background: var(--slate-light);
    color: var(--charcoal);
    margin: 0;
    min-height: 100vh;
}

/* ---------- Sidebar (Desktop) ---------- */
.sidebar {
    position: fixed;
    top: 0; left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--charcoal);
    z-index: 1000;
    flex-direction: column;
    overflow-y: auto;
    scrollbar-width: none;
    border-right: 1px solid rgba(255, 255, 255, 0.05);
}
.sidebar::-webkit-scrollbar { display: none; }

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: 1.5rem 1.25rem 1.25rem;
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: -.01em;
    border-bottom: 1px solid rgba(255,255,255,.06);
}
.sidebar-brand i { 
    font-size: 1.4rem; 
    color: var(--saffron);
}

.sidebar-nav { padding: 1.25rem 0; }

.nav-list {
    list-style: none;
    margin: 0; padding: 0;
}

.nav-link-item {
    display: flex;
    align-items: center;
    gap: .85rem;
    padding: .75rem 1.25rem;
    color: #94a3b8;
    text-decoration: none;
    font-size: .9rem;
    font-weight: 500;
    border-radius: 0;
    margin: 0.15rem 0.75rem;
    border-radius: 10px;
    transition: color .15s, background .15s;
    cursor: pointer;
}
.nav-link-item i { font-size: 1.15rem; width: 1.25rem; flex-shrink: 0; }
.nav-link-item:hover {
    color: #ffffff;
    background: rgba(255,255,255,.05);
}
.nav-link-item.active {
    color: #ffffff;
    background: var(--saffron);
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}
.nav-link-item.active i { color: #ffffff; }

.sidebar-footer {
    padding: 1.25rem;
    border-top: 1px solid rgba(255,255,255,.06);
}
.user-badge {
    display: flex;
    align-items: center;
    gap: .6rem;
    color: #cbd5e1;
    font-size: .85rem;
    font-weight: 500;
    margin-bottom: .85rem;
}
.user-badge i { font-size: 1.2rem; color: var(--saffron); }

.btn-logout {
    display: flex;
    align-items: center;
    gap: .6rem;
    color: #94a3b8;
    font-size: .85rem;
    text-decoration: none;
    transition: color .15s;
}
.btn-logout:hover { color: var(--danger); }

/* ---------- Offcanvas Sidebar (Mobile) ---------- */
.sidebar-offcanvas {
    background: var(--charcoal) !important;
    width: 280px !important;
}
.sidebar-offcanvas .sidebar-brand {
    color: #ffffff;
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: .75rem;
}
.sidebar-offcanvas .nav-list { padding: 1.25rem 0; }

/* ---------- Mobile Top Bar ---------- */
.mobile-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--charcoal);
    padding: 0 1.25rem;
    height: var(--topbar-h);
    position: sticky;
    top: 0; z-index: 900;
    border-bottom: 1px solid rgba(255,255,255,.06);
}
.topbar-title {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 600;
    color: #ffffff;
}

/* ---------- Main Wrapper ---------- */
.main-wrapper {
    margin-left: 0;
    min-height: 100vh;
}
@media (min-width: 992px) {
    .main-wrapper { margin-left: var(--sidebar-width); }
}

/* ---------- Page Content ---------- */
.page-content {
    padding: 1.5rem 1.25rem;
    max-width: 1320px;
    margin: 0 auto;
}
@media (min-width: 768px) {
    .page-content { padding: 2rem 1.75rem; }
}
@media (min-width: 992px) {
    .page-content { padding: 2.25rem 2.5rem; }
}

/* ---------- Page Header ---------- */
.page-header {
    margin-bottom: 2rem;
}
.page-header h1 {
    font-family: var(--font-display);
    font-size: 1.65rem;
    font-weight: 700;
    color: var(--charcoal);
    margin: 0 0 .25rem;
}
@media (min-width: 768px) {
    .page-header h1 { font-size: 1.85rem; }
}
.page-header p {
    color: var(--slate);
    font-size: .9rem;
    margin: 0;
}

/* ---------- Stat Cards ---------- */
.stat-card {
    background: #fff;
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(226, 232, 240, 0.8);
    position: relative;
    overflow: hidden;
    transition: transform .2s ease, box-shadow .2s ease;
}
.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}
.stat-card .stat-icon {
    width: 48px; height: 48px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.35rem;
    margin-bottom: 1rem;
    flex-shrink: 0;
}
.stat-card .stat-label {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--slate);
    margin-bottom: .35rem;
}
.stat-card .stat-value {
    font-family: var(--font-display);
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--charcoal);
    line-height: 1;
}
@media (min-width: 768px) {
    .stat-card .stat-value { font-size: 2rem; }
}
.stat-card .stat-sub {
    font-size: .8rem;
    color: var(--slate);
    margin-top: .4rem;
}

/* Card accent variants */
.stat-card.accent-saffron .stat-icon { background: var(--saffron-light); color: var(--saffron-dark); }
.stat-card.accent-green    .stat-icon { background: #dcfce7; color: #15803d; }
.stat-card.accent-red      .stat-icon { background: #fee2e2; color: #b91c1c; }
.stat-card.accent-blue     .stat-icon { background: #dbeafe; color: #1d4ed8; }
.stat-card.accent-purple   .stat-icon { background: #ede9fe; color: #6d28d9; }

/* ---------- Section Card ---------- */
.section-card {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(226, 232, 240, 0.8);
    overflow: hidden;
    margin-bottom: 1.75rem;
}
.section-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #f1f5f9;
    flex-wrap: wrap;
    gap: .75rem;
}
.section-card-header h5 {
    font-family: var(--font-display);
    font-size: 1.05rem;
    font-weight: 600;
    margin: 0;
    color: var(--charcoal);
}
.section-card-body { padding: 1.5rem; }

/* ---------- Tables ---------- */
.table-responsive { border-radius: 0 0 var(--radius) var(--radius); }
.table { margin-bottom: 0; font-size: .9rem; }
.table thead th {
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--slate);
    background: #f8fafc;
    border-bottom: 2px solid #e2e8f0;
    white-space: nowrap;
    padding: 0.85rem 1.25rem;
}
.table tbody td {
    padding: 0.95rem 1.25rem;
    vertical-align: middle;
    border-color: #f1f5f9;
    color: var(--charcoal);
}
.table tbody tr:hover { background: #f8fafc; }
.table tbody tr:last-child td { border-bottom: none; }

/* ---------- Amount formatting ---------- */
.amount-positive { color: var(--success); font-weight: 600; }
.amount-negative { color: var(--danger);  font-weight: 600; }
.amount-neutral  { color: var(--charcoal); font-weight: 600; }

/* ---------- Category badge ---------- */
.badge-category {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .35rem .75rem;
    border-radius: 999px;
    font-size: .75rem;
    font-weight: 600;
    white-space: nowrap;
}
.badge-raw-material   { background: #fef3c7; color: #b45309; }
.badge-fuel           { background: #dbeafe; color: #1e40af; }
.badge-other          { background: #f1f5f9; color: #475569; }
.badge-partner        { background: #ede9fe; color: #6d28d9; }

/* ---------- Filter Bar ---------- */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: .6rem;
    align-items: center;
    padding: 1.15rem 1.5rem;
    background: #f8fafc;
    border-bottom: 1px solid #f1f5f9;
}
.filter-btn {
    padding: .4rem 1rem;
    border-radius: 999px;
    border: 1.5px solid #e2e8f0;
    background: #fff;
    color: var(--slate);
    font-size: .85rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all .2s;
}
.filter-btn:hover, .filter-btn.active {
    border-color: var(--saffron);
    background: var(--saffron);
    color: #fff;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.2);
}

/* ---------- Forms ---------- */
.form-label {
    font-size: .85rem;
    font-weight: 600;
    color: var(--charcoal);
    margin-bottom: .4rem;
}
.form-control, .form-select {
    border: 1.5px solid #cbd5e1;
    border-radius: 12px;
    font-size: .925rem;
    padding: .65rem 1rem;
    transition: border-color .2s, box-shadow .2s;
}
.form-control:focus, .form-select:focus {
    border-color: var(--saffron);
    box-shadow: 0 0 0 4px rgba(245,158,11,.15);
}
.form-control.is-invalid { border-color: var(--danger); }

/* ---------- Buttons ---------- */
.btn-saffron {
    background: var(--saffron);
    border-color: var(--saffron);
    color: #ffffff;
    font-weight: 600;
    font-size: .925rem;
    padding: .65rem 1.5rem;
    border-radius: 12px;
    transition: all .2s;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.25);
}
.btn-saffron:hover {
    background: var(--saffron-dark);
    border-color: var(--saffron-dark);
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(245, 158, 11, 0.35);
}

/* ---------- Chart Container ---------- */
.chart-container {
    position: relative;
    height: 260px;
    padding: .5rem 0;
}
@media (min-width: 768px) {
    .chart-container { height: 300px; }
}

/* ---------- Empty State ---------- */
.empty-state {
    text-align: center;
    padding: 3.5rem 1.5rem;
    color: var(--slate);
}
.empty-state i { font-size: 3rem; opacity: .3; margin-bottom: 1rem; display: block; }
.empty-state p { margin: 0; font-size: .95rem; }

/* ---------- Flash Alert ---------- */
.flash-alert {
    border-radius: var(--radius);
    font-size: .9rem;
    margin-bottom: 1.75rem;
    border: none;
    box-shadow: var(--shadow-sm);
}

/* ---------- Action Buttons in Table ---------- */
.btn-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px; height: 34px;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    font-size: .9rem;
    transition: all .2s;
}
.btn-action-edit  { background: #eff6ff; color: var(--info); }
.btn-action-edit:hover  { background: var(--info); color: #fff; }
.btn-action-delete { background: #fef2f2; color: var(--danger); }
.btn-action-delete:hover { background: var(--danger); color: #fff; }

/* ---------- Partner Badge ---------- */
.partner-pratham   { background: #fef3c7; color: #b45309; }
.partner-kushagra { background: #dcfce7; color: #15803d; }
.partner-ritham   { background: #dbeafe; color: #1d4ed8; }

/* ---------- Responsive Adjustments ---------- */
@media (max-width: 575px) {
    .stat-card .stat-value { font-size: 1.5rem; }
    .section-card-header { flex-direction: column; align-items: flex-start; }
}