body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f4f6f9;
}

/* App Layout */
.app-layout {
    min-height: 100vh;
}

/* Login Page */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-card {
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    padding: 40px;
    width: 100%;
    max-width: 450px;
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-logo {
    width: 120px;
    height: 120px;
    margin-bottom: 20px;
    border-radius: 50%;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.login-header h2 {
    color: #333;
    font-weight: 600;
    margin-bottom: 10px;
}

.login-header p {
    color: #666;
    font-size: 14px;
}

.form-control:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
}

.btn-login {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    padding: 12px;
    font-weight: 600;
    transition: transform 0.2s;
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

/* Sidebar */
.sidebar {
    min-height: 100vh;
    background: linear-gradient(180deg, #2c3e50 0%, #34495e 100%);
    padding: 0;
    position: fixed;
    width: 250px;
    z-index: 100;
    overflow-y: auto;
    transition: all 0.3s ease-in-out;
    left: 0;
}

/* Sidebar Collapsed State */
body.sidebar-collapsed .sidebar {
    left: -250px;
}

body.sidebar-collapsed .main-content {
    margin-left: 0;
    width: 100%;
}

.sidebar-header {
    padding: 20px;
    background: rgba(0, 0, 0, 0.2);
    text-align: center;
}

.sidebar-header h3 {
    color: white;
    margin: 0;
    font-size: 20px;
    font-weight: 600;
}

.sidebar-menu {
    list-style: none;
    padding: 0;
    margin: 20px 0;
}

.sidebar-menu li {
    margin: 0;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    color: #ecf0f1;
    text-decoration: none;
    transition: all 0.3s;
}

.sidebar-menu a:hover,
.sidebar-menu a.active {
    background: rgba(255, 255, 255, 0.1);
    border-left: 4px solid #667eea;
    padding-left: 16px;
}

.sidebar-menu i {
    margin-right: 10px;
    width: 20px;
    text-align: center;
}

/* Submenu styling */
.sidebar-menu .submenu {
    list-style: none;
    padding: 0;
    margin: 0 0 6px 0;
    max-height: 300px;
    overflow-y: auto;
    /* Tambahkan scroll untuk submenu panjang */
}

.sidebar-menu .submenu-section {
    padding: 8px 20px;
    color: #bdc3c7;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sidebar-menu .submenu li a {
    display: block;
    padding: 8px 20px 8px 36px;
    color: #dfe6e9;
    text-decoration: none;
    transition: all 0.3s;
    font-size: 13px;
}

.sidebar-menu .submenu li a:hover {
    background: rgba(255, 255, 255, 0.08);
    border-left: 4px solid transparent;
}

/* Nested dropdowns inside submenu */
.submenu .section-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 20px 8px 36px;
    color: #dfe6e9;
    text-decoration: none;
    border-radius: 4px;
}

.submenu .section-toggle .ms-auto {
    margin-left: auto;
}

.submenu .nested {
    list-style: none;
    padding-left: 12px;
    margin-left: 24px;
    border-left: 2px dashed rgba(255, 255, 255, 0.08);
}

.submenu .nested li a {
    padding: 6px 20px 6px 44px;
    font-size: 13px;
}

.submenu .section-toggle:hover,
.submenu .nested li a:hover {
    background-color: rgba(255, 255, 255, 0.08);
}

/* Main Content */
.main-content {
    margin-left: 250px;
    width: calc(100% - 250px);
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease-in-out;
}

.top-navbar {
    background: #fff;
    padding: 16px 24px;
    margin: -20px -20px 20px -20px;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.04);
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.top-navbar h4 {
    margin: 0;
    font-weight: 600;
    letter-spacing: 0.2px;
}

/* Dashboard header layout */
.header-left {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.company-meta {
    color: #555;
    font-size: 14px;
}

.company-submeta {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 2px;
    font-size: 13px;
    color: #666;
}

.company-submeta .code {
    color: #888;
}

.company-submeta .separator {
    color: #bbb;
}

.expired-badge {
    color: #d9534f;
    font-weight: 600;
}

.normal-badge {
    color: #666;
}

/* Datepicker custom display */
.custom-date-wrapper {
    position: relative;
    width: 230px;
}

.date-display {
    font-size: 13px;
    cursor: pointer;
    padding: 6px 28px 6px 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #fff;
}

.date-icon {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    color: #888;
    pointer-events: none;
}

.native-date-input {
    position: absolute;
    inset: 0;
    opacity: 0;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-info .stack {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
}

.user-info .welcome {
    display: flex;
    align-items: center;
    gap: 8px;
}

.logout-inline {
    color: #d9534f;
    font-weight: 600;
    text-decoration: none;
    font-size: 0.9em;
}

.badge-normal {
    background: #f0f0f0;
    color: #333;
}

.badge-expiring {
    background: #ff4444;
    color: white;
    font-weight: bold;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
}

/* Dashboard Cards */
.stat-card {
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
}

.stat-card-new {
    background: white;
    border-radius: 12px;
    padding: 20px 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    text-align: center;
    transition: all 0.3s ease;
    border: 1px solid #f0f0f0;
    height: 100%;
    min-height: 110px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.stat-card-new+.stat-card-new {
    /* ensure spacing consistency when stacked */
    margin-top: 0;
}

.stat-card-new:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.15);
    border-color: #667eea;
}

.stat-label-top {
    font-size: 14px;
    color: #7f8c8d;
    font-weight: 500;
    margin-bottom: 10px;
    text-transform: none;
    letter-spacing: 0.3px;
}

.stat-value-new {
    font-size: 24px;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.carousel-control-prev,
.carousel-control-next {
    width: 40px;
    height: 40px;
    background: white;
    border-radius: 50%;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0.9;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.carousel-control-prev {
    left: -20px;
}

.carousel-control-next {
    right: -20px;
}

.carousel-control-prev:hover,
.carousel-control-next:hover {
    opacity: 1;
}

/* Stats loading indicator */
.stats-loading {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #666;
    font-size: 13px;
    margin-bottom: 10px;
}

.stats-loading i {
    color: #667eea;
}

.carousel-control-prev-icon,
.carousel-control-next-icon {
    filter: invert(1);
    background-size: 20px;
}

/* Chart Navigation */
.chart-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    border-top: 1px solid #f0f0f0;
}

.chart-nav-btn {
    font-size: 13px;
    padding: 6px 12px;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.chart-nav-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.2);
}

.chart-nav-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.period-label {
    font-size: 14px;
    font-weight: 600;
    color: #667eea;
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: white;
    margin-bottom: 15px;
}

.stat-icon.blue {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.stat-icon.green {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
}

.stat-icon.orange {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.stat-icon.purple {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 5px;
}

.stat-label {
    color: #7f8c8d;
    font-size: 14px;
}

/* Tables */
.data-table {
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.table {
    margin-bottom: 0;
}

/* Full width tidy tables for master data lists */
.table.full-width {
    width: 100%;
    table-layout: fixed;
    /* force columns to distribute evenly */
}

.table.full-width th,
.table.full-width td {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Responsif untuk tabel Data Akun */
.table.full-width.akun-table col.col-code {
    width: 14%;
}

.table.full-width.akun-table col.col-name {
    width: 26%;
}

.table.full-width.akun-table col.col-group {
    width: 22%;
}

.table.full-width.akun-table col.col-dept {
    width: 20%;
}

.table.full-width.akun-table col.col-level {
    width: 8%;
}

.table.full-width.akun-table col.col-actions {
    width: 10%;
}

@media (max-width: 991.98px) {
    .table.full-width.akun-table col.col-code {
        width: 16%;
    }

    .table.full-width.akun-table col.col-name {
        width: 28%;
    }

    .table.full-width.akun-table col.col-group {
        width: 20%;
    }

    .table.full-width.akun-table col.col-dept {
        width: 18%;
    }

    .table.full-width.akun-table col.col-level {
        width: 8%;
    }

    .table.full-width.akun-table col.col-actions {
        width: 10%;
    }
}

@media (max-width: 767.98px) {
    .table.full-width.akun-table col.col-code {
        width: 18%;
    }

    .table.full-width.akun-table col.col-name {
        width: 30%;
    }

    .table.full-width.akun-table col.col-group {
        width: 20%;
    }

    .table.full-width.akun-table col.col-dept {
        width: 16%;
    }

    .table.full-width.akun-table col.col-level {
        width: 6%;
    }

    .table.full-width.akun-table col.col-actions {
        width: 10%;
    }
}

/* Responsif untuk tabel Kas & Bank */
.table.full-width.cashbank-table col.col-code {
    width: 14%;
}

.table.full-width.cashbank-table col.col-name {
    width: 26%;
}

.table.full-width.cashbank-table col.col-accno {
    width: 20%;
}

.table.full-width.cashbank-table col.col-holder {
    width: 18%;
}

.table.full-width.cashbank-table col.col-balance {
    width: 12%;
}

.table.full-width.cashbank-table col.col-actions {
    width: 10%;
}

@media (max-width: 991.98px) {
    .table.full-width.cashbank-table col.col-code {
        width: 16%;
    }

    .table.full-width.cashbank-table col.col-name {
        width: 28%;
    }

    .table.full-width.cashbank-table col.col-accno {
        width: 20%;
    }

    .table.full-width.cashbank-table col.col-holder {
        width: 16%;
    }

    .table.full-width.cashbank-table col.col-balance {
        width: 12%;
    }

    .table.full-width.cashbank-table col.col-actions {
        width: 8%;
    }
}

@media (max-width: 767.98px) {
    .table.full-width.cashbank-table col.col-code {
        width: 18%;
    }

    .table.full-width.cashbank-table col.col-name {
        width: 30%;
    }

    .table.full-width.cashbank-table col.col-accno {
        width: 18%;
    }

    .table.full-width.cashbank-table col.col-holder {
        width: 14%;
    }

    .table.full-width.cashbank-table col.col-balance {
        width: 12%;
    }

    .table.full-width.cashbank-table col.col-actions {
        width: 8%;
    }
}

.table thead th {
    border-bottom: 2px solid #667eea;
    color: #2c3e50;
    font-weight: 600;
}

/* Zebra striping untuk baris ganjil/genap pada tabel */
.table tr.row-even {
    background-color: #f9fbfd;
}

.table tr.row-odd {
    background-color: #ffffff;
}

.table tr.row-even:hover,
.table tr.row-odd:hover {
    background-color: #eef3f9;
}

/* Highlight baris pada popup akun */
.row-highlight {
    background-color: #fff8db;
    /* soft yellow highlight */
}

/* Buttons */
.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}

.btn-success {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    border: none;
}

.btn-danger {
    background: linear-gradient(135deg, #eb3349 0%, #f45c43 100%);
    border: none;
}

/* Charts */
.chart-container {
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

/* Charts row fixed height for consistent alignment */
.charts-row .chart-container {
    height: 360px;
    display: flex;
    flex-direction: column;
}

.chart-canvas {
    flex: 1;
}

/* Chart navigation: keep compact so chart area is taller */
.chart-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 10px;
    border-top: 1px solid #f0f0f0;
}

.chart-nav-btn {
    font-size: 12px;
    padding: 4px 8px;
}


.page-title {
    color: #2c3e50;
    font-weight: 600;
    margin-bottom: 20px;
}

/* Alert */
.alert {
    border-radius: 8px;
}

/* Loading */
.loading {
    text-align: center;
    padding: 40px;
    color: #667eea;
}

.loading i {
    font-size: 48px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.sidebar::-webkit-scrollbar {
    width: 8px;
}

.sidebar::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.25);
    border-radius: 4px;
}

.sidebar-collapsed .sidebar {
    width: 64px;
    overflow-x: hidden;
}

.sidebar-collapsed .main-content {
    margin-left: 64px;
    width: calc(100% - 64px);
}

.sidebar-collapsed .sidebar-header h3 {
    display: none;
}

.sidebar-collapsed .sidebar-header img {
    width: 40px;
    height: 40px;
}

.sidebar-collapsed .sidebar-menu a {
    justify-content: center;
    padding: 12px;
}

.sidebar-collapsed .sidebar-menu a .ms-auto,
.sidebar-collapsed .submenu,
.sidebar-collapsed .submenu-section {
    display: none !important;
}

/* (Reverted) remove forced collapse and view animations to restore smoother default behavior */

/* Smooth collapsible panel for inline forms (Data Bank) */
.collapse-panel {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.3s ease, opacity 0.3s ease;
}

.collapse-panel.show {
    max-height: 1000px;
    /* large enough to reveal content */
    opacity: 1;
}

.collapse-panel:not(.show) {
    pointer-events: none;
}

/* Pagination bar spacing */
.pagination-bar {
    margin-top: 12px;
}

/* Fixed height for tab content across all customer tabs */
.tab-content-fixed {
    height: 300px;
    min-height: 300px;
    overflow-y: auto;
    /* tampilkan scroll jika konten lebih panjang */
}



/* Pagination bar spacing */
.pagination-bar {
    margin: 2px;
    /* dirapatkan sedikit lagi */
}

/* Responsive Chart Height */
.chart-fixed-height {
    height: 300px;
    position: relative;
    overflow: auto;
}



.sidebar-toggle-btn {
    display: none;
    /* Hide on desktop */
    font-size: 1.2rem;
    color: #333;
    padding: 0;
    border: none;
    background: none;
}

/* Scroll container dinamis untuk tab Data Nama */
.tab-scroll {
    height: calc(65vh - 5px);
    overflow-y: auto;
    border: 1px solid #eee;
    border-radius: 6px;
    padding: 1px 2px;
    /* sedikit lebih rapat */
    margin: 0;
}

/* Konsistensi jarak antar input pada konten tab form */
.tab-content-fixed.row.g-3 {
    --bs-gutter-y: 0;
    /* hilangkan jarak vertikal antar kolom input */
}

.tab-content-fixed .form-label {
    margin-bottom: 0;
    /* rapatkan jarak label ke input */
}

@media (max-width: 768px) {
    .tab-scroll {
        height: calc(60vh - 5px);
    }
}