/* KLEB Company Dashboard - Green Theme */

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: Arial, sans-serif; background: #f5f7f4; color: #1a3a1f; line-height: 1.5; font-size: 13px; }
a { color: #2d8f3f; text-decoration: none; }
a:hover { color: #1a6b2e; }

/* HEADER */
.kleb-header { background: linear-gradient(135deg, #1a6b2e 0%, #2d8f3f 100%); color: white; padding: 8px 16px; }
.header-inner { max-width: 1400px; margin: 0 auto; display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.brand-title { font-size: 14px; font-weight: 500; letter-spacing: 0.8px; }
.brand-tagline { font-size: 9px; color: #c9e5cf; margin-top: 1px; font-style: italic; letter-spacing: 0.2px; }
.user-info { display: flex; align-items: center; gap: 8px; font-size: 11px; }
.user-info svg { color: white; }
.user-role { background: rgba(255,255,255,0.2); padding: 2px 6px; border-radius: 8px; font-size: 9px; text-transform: uppercase; font-weight: 500; letter-spacing: 0.3px; }
.btn-logout { background: #c43a2f; color: white; padding: 3px 8px; border-radius: 3px; font-size: 10px; display: inline-flex; align-items: center; gap: 3px; transition: background 0.2s; }
.btn-logout:hover { background: #a62b22; color: white; }

/* NAV */
.kleb-nav { background: white; border-bottom: 1px solid #e0e5ea; }
.nav-inner { max-width: 1400px; margin: 0 auto; padding: 0 16px; display: flex; gap: 0; overflow-x: auto; }
.nav-inner a { padding: 9px 14px; color: #5a6c82; font-size: 11px; font-weight: 500; border-bottom: 3px solid transparent; cursor: pointer; display: flex; align-items: center; gap: 5px; text-transform: uppercase; letter-spacing: 0.3px; white-space: nowrap; transition: all 0.15s; }
.nav-inner a:hover { color: #1a6b2e; background: #f5f7f4; }
.nav-inner a.active { color: #1a6b2e; border-bottom-color: #2d8f3f; }

/* MAIN */
.main-content { max-width: 1400px; margin: 0 auto; padding: 12px 16px; min-height: calc(100vh - 130px); }
.kleb-title-row { display: flex; justify-content: space-between; align-items: end; margin-bottom: 12px; border-bottom: 2px solid #2d8f3f; padding-bottom: 5px; flex-wrap: wrap; gap: 8px; }
.kleb-title { font-size: 16px; color: #1a3a1f; margin: 0; font-weight: 500; }
.kleb-subtitle { color: #7a8a7c; font-size: 11px; margin: 2px 0 0; }
.kleb-meta { font-size: 10px; color: #7a8a7c; }

/* KPI cards */
.kleb-kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; margin-bottom: 12px; }
.kleb-kpi { background: white; padding: 10px 12px; border-radius: 4px; border-left: 3px solid #2d8f3f; }
.kleb-kpi.amber { border-left-color: #d68a1e; }
.kleb-kpi.red { border-left-color: #c43a2f; }
.kleb-kpi.gray { border-left-color: #8b9398; }
.kleb-kpi.dark { border-left-color: #1a3a1f; }
.kleb-kpi.purple { border-left-color: #7030a0; }
.kleb-kpi-val { font-size: 19px; font-weight: 500; color: #1a3a1f; line-height: 1.1; letter-spacing: -0.3px; font-variant-numeric: tabular-nums; }
.kleb-kpi-lbl { font-size: 9px; color: #7a8a7c; text-transform: uppercase; letter-spacing: 0.3px; margin-top: 2px; font-weight: 500; }
.kleb-kpi-sub { font-size: 9px; color: #5a6c82; margin-top: 2px; }

/* Clickable KPI cards */
.kpi-link { text-decoration: none; color: inherit; display: block; }
.kpi-link .kleb-kpi { transition: all 0.15s ease; cursor: pointer; }
.kpi-link:hover .kleb-kpi { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(26, 107, 46, 0.15); border-left-width: 5px; }
.kpi-link:hover .kleb-kpi-val { color: #1a6b2e; }

/* Sections */
.kleb-section { background: white; border-radius: 4px; padding: 12px 14px; margin-bottom: 10px; border: 1px solid #e0e5ea; }
.kleb-section-title { font-size: 11px; font-weight: 500; color: #1a3a1f; margin: 0 0 8px; padding-bottom: 6px; border-bottom: 1px solid #e0e5ea; text-transform: uppercase; letter-spacing: 0.5px; display: flex; align-items: center; gap: 5px; justify-content: space-between; }
.kleb-section-title svg { width: 13px; height: 13px; color: #2d8f3f; }
.section-title-left { display: flex; align-items: center; gap: 5px; }

/* Tables */
.data-table { width: 100%; border-collapse: collapse; font-size: 11px; }
.data-table thead { background: #1a6b2e; color: white; }
.data-table th { padding: 6px 8px; text-align: left; font-weight: 500; font-size: 10px; text-transform: uppercase; letter-spacing: 0.3px; }
.data-table th.num { text-align: right; }
.data-table td { padding: 5px 8px; border-bottom: 1px solid #eef1ee; }
.data-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.data-table tbody tr:nth-child(even) { background: #f9faf9; }
.data-table tbody tr:hover { background: #eef5ee; }
.data-table .total-row { background: #1a3a1f !important; color: white; font-weight: 500; }
.data-table .total-row td { border-bottom: none; color: white; }

/* Status pills */
.status { display: inline-block; padding: 2px 7px; border-radius: 3px; font-size: 9px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.3px; }
.s-active { background: #d4edda; color: #1a6b2e; }
.s-no-driver { background: #fce8cc; color: #8a5a12; }
.s-accident { background: #f5d5d2; color: #8a2720; }
.s-inactive { background: #e0dce4; color: #4a3a5a; }
.s-service { background: #d5dee8; color: #2a4a6a; }
.s-sold { background: #e0e0e0; color: #555; }

/* Phase pill */
.phase-pill { display: inline-block; background: #1a6b2e; color: white; padding: 1px 6px; border-radius: 3px; font-size: 9px; font-weight: 500; }

/* Type pills */
.type-pill { display: inline-block; padding: 2px 7px; border-radius: 3px; font-size: 9px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.3px; }
.t-mileage { background: #d4edda; color: #1a6b2e; }
.t-gate { background: #d5dee8; color: #2a4a6a; }
.t-overstay { background: #fce8cc; color: #8a5a12; }
.t-council { background: #f5d5d2; color: #8a2720; }
.t-parking { background: #ecd9f0; color: #4a3a5a; }
.t-carbon { background: #fff4cc; color: #6a5a12; }
.t-bonus { background: #d4edda; color: #1a6b2e; }
.t-road { background: #ffe0c4; color: #8a4a12; }
.t-bulk { background: #1a3a1f; color: white; }
.t-other { background: #e0e0e0; color: #555; }
.bulk-tag { background: #d68a1e; color: white; padding: 2px 7px; border-radius: 3px; font-size: 9px; font-weight: 500; margin-left: 6px; }

/* Buttons */
.view-btn { display: inline-block; background: #2d8f3f; color: white; padding: 3px 10px; border-radius: 3px; font-size: 9px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.3px; cursor: pointer; border: none; transition: background 0.15s; }
.view-btn:hover { background: #1a6b2e; color: white; }
.back-btn { display: inline-flex; align-items: center; gap: 4px; color: #2d8f3f; font-size: 11px; padding: 4px 0; margin-bottom: 8px; font-weight: 500; }
.back-btn:hover { color: #1a6b2e; }

/* Search bar */
.search-bar { display: flex; gap: 6px; align-items: center; background: white; padding: 7px 10px; border-radius: 4px; border: 1px solid #c4cdc4; margin-bottom: 10px; }
.search-bar svg { width: 13px; height: 13px; color: #7a8a7c; flex-shrink: 0; }
.search-bar input, .search-bar select { flex: 1; border: none; outline: none; font-size: 12px; font-family: inherit; padding: 3px 4px; background: transparent; min-width: 80px; }
.search-bar button, .search-bar .clear-btn { padding: 5px 12px; background: #2d8f3f; color: white; border: none; border-radius: 3px; font-size: 10px; cursor: pointer; font-weight: 500; text-transform: uppercase; letter-spacing: 0.5px; }
.search-bar button:hover { background: #1a6b2e; }
.search-bar .clear-btn { background: #8b9398; }
.search-bar .clear-btn:hover { background: #5a6c82; }

.search-row { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr auto auto; gap: 6px; margin-bottom: 10px; align-items: stretch; }
.search-row .search-bar { margin-bottom: 0; }
.search-row > button { padding: 5px 14px; background: #2d8f3f; color: white; border: none; border-radius: 3px; font-size: 10px; cursor: pointer; font-weight: 500; text-transform: uppercase; letter-spacing: 0.5px; }
.search-row > .clear-btn { background: #8b9398; }
.search-row > button:hover { background: #1a6b2e; }
.search-row > .clear-btn:hover { background: #5a6c82; }

/* Detail cards */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }
.detail-card { background: white; border-radius: 4px; padding: 12px 14px; border: 1px solid #e0e5ea; }
.detail-card h4 { font-size: 11px; font-weight: 500; color: #1a3a1f; margin: 0 0 8px; padding-bottom: 6px; border-bottom: 1px solid #e0e5ea; text-transform: uppercase; letter-spacing: 0.5px; }
.detail-row { display: flex; justify-content: space-between; padding: 4px 0; font-size: 12px; }
.detail-row .lbl { color: #7a8a7c; font-weight: 500; }
.detail-row .val { color: #1a3a1f; font-weight: 500; }

/* Locations grid */
.location-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 6px; }
.loc-item { background: #f5f7f4; padding: 7px 11px; border-radius: 3px; border-left: 3px solid #2d8f3f; font-size: 11px; display: flex; justify-content: space-between; }
.loc-item .lname { font-weight: 500; color: #1a3a1f; }
.loc-item .lcount { color: #7a8a7c; font-size: 10px; }
.loc-clickable { cursor: pointer; transition: all 0.15s ease; }
.loc-clickable:hover { background: #e3f0d8; transform: translateX(2px); border-left-width: 5px; }

/* Day groups (expenses) */
.day-group { background: white; border: 1px solid #e0e5ea; border-radius: 4px; margin-bottom: 6px; overflow: hidden; }
.day-header { background: #1a3a1f; color: white; padding: 8px 12px; display: flex; justify-content: space-between; align-items: center; cursor: pointer; user-select: none; flex-wrap: wrap; gap: 8px; }
.day-header:hover { background: #1a6b2e; }
.day-header .left { display: flex; align-items: center; gap: 10px; }
.day-header .chevron { display: inline-block; transition: transform 0.2s; font-size: 11px; }
.day-group.expanded .chevron { transform: rotate(90deg); }
.day-header .date { font-size: 12px; font-weight: 500; letter-spacing: 0.5px; }
.day-header .day-name { font-size: 10px; color: #c9e5cf; }
.day-header .right { display: flex; align-items: center; gap: 12px; font-size: 11px; }
.day-header .right .stat { color: #c9e5cf; font-size: 10px; }
.day-header .total { font-weight: 500; font-size: 13px; font-variant-numeric: tabular-nums; }
.day-content { display: none; }
.day-group.expanded .day-content { display: block; }

/* Pagination */
.pagination { text-align: center; margin-top: 12px; font-size: 11px; color: #7a8a7c; }
.pagination a { color: #2d8f3f; padding: 0 6px; }

/* Login page */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #1a6b2e 0%, #2d8f3f 100%); padding: 20px; }
.login-box { background: white; padding: 32px; border-radius: 6px; box-shadow: 0 12px 32px rgba(0,0,0,0.2); width: 100%; max-width: 360px; }
.login-title { text-align: center; color: #1a3a1f; font-size: 22px; font-weight: 500; margin: 0 0 4px; letter-spacing: 2px; }
.login-sub { text-align: center; color: #7a8a7c; font-size: 10px; margin: 0 0 22px; font-style: italic; letter-spacing: 0.5px; }
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 10px; color: #1a3a1f; margin-bottom: 4px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.3px; }
.form-group input { width: 100%; padding: 8px 11px; border: 1px solid #c4cdc4; border-radius: 4px; font-size: 13px; font-family: inherit; }
.form-group input:focus { outline: none; border-color: #2d8f3f; box-shadow: 0 0 0 3px rgba(45,143,63,0.15); }
.btn-primary { width: 100%; padding: 10px; background: #2d8f3f; color: white; border: none; border-radius: 4px; font-size: 11px; font-weight: 500; cursor: pointer; text-transform: uppercase; letter-spacing: 1px; }
.btn-primary:hover { background: #1a6b2e; }

/* Alerts */
.alert { padding: 10px 14px; border-radius: 4px; font-size: 12px; margin-bottom: 14px; }
.alert-error { background: #f5d5d2; color: #8a2720; border: 1px solid #e0a8a3; }
.alert-info { background: #d5dee8; color: #2a4a6a; border: 1px solid #b3c5e0; }

/* Empty states */
.empty-state { text-align: center; padding: 50px 20px; color: #7a8a7c; }
.empty-state h3 { color: #1a3a1f; font-size: 15px; margin-bottom: 8px; }

/* Footer */
.kleb-footer { background: #1a3a1f; color: #a0c4a8; padding: 12px 16px; text-align: center; font-size: 11px; margin-top: 30px; }
.footer-inner { max-width: 1400px; margin: 0 auto; }

/* Responsive */
@media (max-width: 768px) {
    .main-content { padding: 10px; }
    .nav-inner { padding: 0 10px; }
    .nav-inner a { padding: 8px 8px; font-size: 10px; }
    .detail-grid { grid-template-columns: 1fr; }
    .search-row { grid-template-columns: 1fr; }
    .header-inner { flex-direction: column; align-items: flex-start; gap: 6px; }
    .day-header { flex-direction: column; align-items: flex-start; }
    .day-header .right { width: 100%; justify-content: space-between; }
}
