html {
    font-size: 14px;
    scroll-behavior: smooth;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

#scrollTopBtn {
    position: fixed;
    opacity: 0;
    pointer-events: none;
    bottom: 20px;
    right: 20px;
    z-index: 999;
    background: #0d6efd;
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 45px;
    height: 45px;
    font-size: 18px;
    cursor: pointer;
    display: none; /* hidden initially */

    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    transition: all 0.3s ease;
}

    /* Hover effect */
    #scrollTopBtn:hover {
        background: #0b5ed7;
        transform: translateY(-2px);
    }

    #scrollTopBtn.show {
        opacity: 1;
        pointer-events: auto;
    }

@media (max-width: 768px) {
    #scrollTopBtn {
        bottom: 70px;
    }
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

.form-label {
    font-weight: 500;
}

html {
  position: relative;
  min-height: 100%;
}

body {
    margin-bottom: 60px;
    background: #f7f9fc;
    background: linear-gradient(135deg, #eef5ff, #ffffff);
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
  color: var(--bs-secondary-color);
  text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
  text-align: start;
}

.card-modern {
    border: none;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.05);
}

.page-title {
    font-size: 2rem;
    font-weight: 500;
    line-height: 1.2;
}

.btn-soft {
    border-radius: 10px;
    padding: 6px 14px;
    font-size: 0.9rem;
}

.table {
    font-size: 13px;
}

.table-modern {
    border-radius: 12px;
    overflow: hidden;
}

    .table-modern tbody tr:hover {
        background: #f8f9fa;
    }

.sidebar {
    width: 240px;
    min-height: 100vh;
    transition: all 0.3s ease;
}

/* Mobile */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -260px;
        top: 0;
        height: 100%;
        width: 260px;
        z-index: 1050;
        transition: 0.3s;
    }

        .sidebar.active {
            left: 0;
        }

    #overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0,0,0,0.4);
        display: none;
        z-index: 1040;
    }

        #overlay.active {
            display: block;
        }
}

@media (max-width: 768px) {
        .sidebar.show {
            left: 0;
        }
}

    .sidebar .nav-link {
        border-radius: 8px;
        margin-bottom: 5px;
        transition: 0.2s;
    }

        .sidebar .nav-link:hover {
            background: rgba(255,255,255,0.1);
        }

        .sidebar .nav-link.active {
            /*background: #0d6efd;*/
            background: rgba(255,255,255,0.15);
            border-radius: 6px;
        }

    /* COLLAPSE */
    .sidebar.collapsed {
        margin-left: -250px;
        padding-left: 10px;
    }

.sidebar-section {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    margin-top: 15px;
}

.sidebar-toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    margin-top: 10px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.5px;
    color: #9ca3af; /* soft gray */
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none !important;
}

    .sidebar-toggle:hover {
        background: rgba(255, 255, 255, 0.05);
        color: #ffffff;
        text-decoration: none !important;
    }

    .sidebar-toggle::after {
        content: "▸";
        float: right;
        transition: 0.2s;
    }

    /* Active (expanded) */
    .sidebar-toggle.active {
        background: rgba(13, 110, 253, 0.15);
        color: #4dabf7;
        text-decoration: none !important;
    }

    .sidebar-toggle.active::after {
        transform: rotate(90deg);
    }

/* Arrow */
.menu-arrow {
    font-size: 14px;
    transition: transform 0.2s ease;
}

/* Rotate arrow when open */
.sidebar-toggle.active .menu-arrow {
    transform: rotate(90deg);
}

.setup-card {
    border-radius: 12px;
    transition: 0.2s;
}

    .setup-card:hover {
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    }

    .setup-card.disabled {
        opacity: 0.5;
        pointer-events: none;
        filter: grayscale(30%);
    }

    .setup-card.completed {
        opacity: 0.85;
        background: #f8f9fa;
    }

@keyframes popIn {
    0% {
        transform: scale(0.95);
        opacity: 0;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.setup-complete-card {
    animation: popIn 0.4s ease;
}

.card-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

    .card-link:hover {
        text-decoration: none;
        color: inherit;
    }

    .card-link .setup-card {
        transition: 0.2s;
    }

    .card-link:hover .setup-card {
        transform: translateY(-3px);
        box-shadow: 0 6px 16px rgba(0,0,0,0.08);
    }

.hover-card {
    transition: all 0.2s ease;
    cursor: pointer;
}

    .hover-card:hover {
        transform: translateY(-3px);
        box-shadow: 0 10px 20px rgba(0,0,0,0.08);
    }

.dashboard-section {
    margin-bottom: 20px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(0,0,0,0.05);
}

.dashboard-header a:hover .alert {
    transform: scale(1.01);
    transition: 0.2s ease;
}

.dashboard-card {
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    border-radius: 12px;
    margin-bottom: 12px;
}

    .dashboard-card:hover {
        transform: translateY(-3px);
        transition: transform 0.15s ease, box-shadow 0.15s ease;
    }

.dashboard-icon {
    font-size: 1.4rem;
    background: rgba(13, 110, 253, 0.1);
    padding: 6px;
    border-radius: 8px;
}

.dashboard-widget {
    cursor: pointer;
    transition: all 0.2s ease;
}

    .dashboard-widget:hover {
        transform: translateY(-2px);
        box-shadow: 0 10px 20px rgba(0,0,0,0.08);
    }

@media (max-width: 768px) {
    .dashboard-card {
        margin-bottom: 12px;
    }

    .dashboard-header {
        padding: 15px;
    }

    .alert {
        font-size: 0.9rem;
    }

    .dashboard-widget {
        margin-bottom: 10px;
    }
}

.alert {
    border-radius: 10px;
}

.card-header {
    font-weight: 500;
}

canvas {
    width: 100% !important;
    height: 300px !important;
}

@media (max-width: 768px) {
    canvas {
        max-height: 220px !important;
    }
}

.navbar {
    border-bottom: 2px solid #0d6efd;
}

@media (max-width: 768px) {
    .navbar span {
        font-size: 14px;
    }
}

#overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.4);
    display: none;
    z-index: 1040;
}

    #overlay.show {
        display: block;
    }

main {
    padding-top: 10px !important;
    padding-bottom: 80px;
}

    main > div:first-child {
        margin-bottom: 20px;
    }

.footer {
    font-size: 13px;
    padding: 10px 0;
    background: #f8f9fa;
    text-align: center;
    border-top: none;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.05);
}

@media (max-width: 768px) {
    .quick-actions {
        position: sticky;
        bottom: 0;
        background: #fff;
        padding: 10px;
        z-index: 1000;
        box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    }
}

.amount {
    white-space: nowrap;
    font-weight: 600;
}

.app-title {
    font-weight: 600;
    font-size: 15px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.branch {
    font-size: 11px;
    background: #f1f3f5;
    padding: 2px 6px;
    border-radius: 6px;
    color: #555;
}

.tooltip-inner {
    font-size: 13px;
    padding: 6px 10px;
    border-radius: 6px;
}

.idle-modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.idle-content {
    background: #fff;
    padding: 20px;
    border-radius: 12px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.activity-container {
    padding: 20px;
}

.activity-card {
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 15px;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.activity-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    margin-bottom: 5px;
}

.activity-description {
    font-weight: 500;
    margin-bottom: 10px;
}

.hidden {
    display: none;
}

.change-list {
    list-style: none;
    padding-left: 0;
    margin: 0;
}

    .change-list li {
        font-size: 0.9rem;
        padding: 3px 0;
    }

.old-value {
    color: #dc3545;
    text-decoration: line-through;
}

.new-value {
    color: #28a745;
    font-weight: 600;
}

.table-hover tbody tr:hover {
    background-color: rgba(0, 123, 255, 0.05);
}

.timeline {
    position: relative;
    max-width: 700px;
    margin: auto;
    padding-left: 40px;
}

    /* STRONGER LINE */
    .timeline::before {
        content: "";
        position: absolute;
        left: 18px;
        top: 0;
        width: 3px;
        height: 100%;
        background: linear-gradient(to bottom, rgba(13,110,253,0.4), #e5e7eb);
    }

.timeline-alt {
    position: relative;
    max-width: 900px;
    margin: auto;
}

    /* CENTER LINE */
    .timeline-alt::before {
        content: "";
        position: absolute;
        left: 50%;
        width: 4px;
        height: 100%;
        background: linear-gradient(to bottom, #0d6efd, #ccc);
        transform: translateX(-50%);
    }

/* DETAILS */
.timeline-details {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed #e5e7eb;
    /*max-height: 200px;*/
    overflow: hidden;
    transition: max-height 0.3s ease;
}

    .timeline-details.show {
        max-height: 500px;
    }

/* ITEM BASE */
.timeline-item {
    position: relative;
    width: 50%;
    padding: 20px 30px;
    opacity: 0;
    transform: translateY(30px);
    animation: slideUp 0.5s ease forwards;
}
    .timeline-item.left {
        animation-name: slideLeft;
        left: 0;
        text-align: right;
        padding-right: 60px;
    }

    .timeline-item.right {
        animation-name: slideRight;
        left: 50%;
        text-align: left;
        padding-left: 60px;
    }

@keyframes slideLeft {
    from {
        opacity: 0;
        transform: translateX(-40px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideRight {
    from {
        opacity: 0;
        transform: translateX(40px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

    /* CONNECTOR LINES */
    .timeline-item.left .timeline-card::after {
        content: "";
        position: absolute;
        top: 22px;
        right: -60px;
        width: 60px;
        height: 2px;
        background: #d1d5db;
    }

    .timeline-item.right .timeline-card::after {
        content: "";
        position: absolute;
        top: 22px;
        left: -60px;
        width: 60px;
        height: 2px;
        background: #d1d5db;
    }

/* DOT */
.timeline-dot {
    position: absolute;
    top: 12px;
    left: 50%;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    transform: translateX(-50%);
    border: 4px solid #fff;
    box-shadow: 0 0 0 3px #d1d5db;
    z-index: 3;
}

    /* COLORS BY ACTION*/
    .timeline-dot.added {
        background: #28a745;
        box-shadow: 0 0 0 3px #d1d5db, 0 0 8px rgba(40,167,69,0.4);
    }

    .timeline-dot.modified {
        background: #ffc107;
    }

    .timeline-dot.deleted {
        background: #dc3545;
    }

/* CARD */
.timeline-card {
    background: #fff;
    padding: 15px;
    border-radius: 12px;
    box-shadow: 0 6px 18px rgba(0,0,0,0.06);
    position: relative;
    max-width: 360px;
    margin: auto;
    transition: all 0.25s ease;
    border: 1px solid #f1f3f5;
}

    /* HOVER EFFECT 🔥 */
    .timeline-card:hover {
        transform: translateY(-4px) scale(1.01);
        box-shadow: 0 14px 30px rgba(0,0,0,0.1);
    }

/* META */
.timeline-meta {
    display: flex;
    gap: 10px;
    font-size: 0.8rem;
    color: #777;
    flex-wrap: wrap;
}

/* TITLE */
.timeline-title {
    font-weight: 600;
    margin: 8px 0;
}

/* BADGES */
.badge.added {
    background: #e6f9ed;
    color: #28a745;
}

.badge.modified {
    background: #fff3cd;
    color: #856404;
}

.badge.deleted {
    background: #fdecea;
    color: #dc3545;
}

/* BUTTON */
.toggle-btn {
    background: #f1f5ff;
    border: none;
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: 0.2s;
    font-weight: 500;
    letter-spacing: 0.3px;
}

    .toggle-btn:hover {
        background: #007bff;
        color: #fff;
    }

@keyframes fadeIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 768px) {

    .timeline-alt::before {
        left: 20px;
    }

    .timeline-item {
        width: 100%;
        left: 0 !important;
        padding-left: 50px;
        text-align: left !important;
    }

    .timeline-card::after {
        display: none;
    }
}

.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
    margin-top: 12px;
}

    /*.detail-grid span {*/
/*        font-size: 0.75rem;
        color: #6b7280;*/
    /*}*/

    .detail-grid strong {
        display: block;
/*        font-size: 0.95rem;
        color: #111827;
*/    }

.detail-item {
    display: flex;
    flex-direction: column;
}

    .detail-item .label {
        font-size: 0.75rem;
        color: #6b7280;
    }

    .detail-item .value {
        font-size: 0.95rem;
        font-weight: 600;
        color: #111827;
        display: block;
    }

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.password-toggle {
    position: absolute;
    right: 12px;
    top: 38px;
    transform: translateY(-50%);
    cursor: pointer;
    transform: translateY(-50%);
    /*font-size: 16px;*/
}

    .password-toggle:hover {
        opacity: 1;
    }

@media (max-width: 768px) {
    .card-modern {
        margin: 10px;
    }
}

.card {
    border-radius: 18px;
    border: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.04);
    transition: all 0.2s ease;
}

    .card:hover {
        transform: translateY(-3px);
        box-shadow: 0 12px 28px rgba(0,0,0,0.08);
    }

    .card .btn {
        padding: 10px;
        font-size: 14px;
    }

    .card strong {
        font-size: 16px;
    }

    .card small {
        font-size: 12px;
    }

.kpi-value {
    font-size: 30px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.kpi-card {
    cursor: pointer;
    transition: all 0.15s ease;
}

    .kpi-card h6 {
        font-size: 1rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .kpi-card:hover {
        transform: translateY(-2px);
    }

.insight-item {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    font-size: 14px;
    padding: 6px 0;
    transition: transform 0.1s ease;
}

    .insight-item:hover {
        transform: translateX(4px);
    }

    .insight-item span:first-child {
        font-size: 18px;
    }

.insight-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.card-danger {
    border-left: 4px solid #dc3545;
    border: 1px solid #f8d7da;
    background: #fff5f5;
}

.btn {
    transition: all 0.2s ease;
    border-radius: 10px;
}

    .btn:hover {
        transform: scale(1.02);
    }

.row > div {
    margin-bottom: 16px;
}

thead th {
    position: sticky;
    top: 0;
    z-index: 2;
}

@keyframes pulseSoft {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.01);
    }

    100% {
        transform: scale(1);
    }
}

.alert-warning {
    animation: pulseSoft 2.5s infinite;
}

#saleSummary {
    position: sticky;
    bottom: 0;
    background: white;
    padding: 10px;
    border-top: 1px solid #eee;
}

.progress-bar {
    transition: width 0.6s ease;
}

.btn-primary {
    font-weight: 600;
    border-radius: 12px;
}

.sale-summary-bar {
    position: sticky;
    bottom: 0;
    background: #fff;
    border-top: 1px solid #eee;
    padding: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    z-index: 10;
}

    .sale-summary-bar .btn {
        flex-shrink: 0;
        padding: 12px 16px;
        border-radius: 10px;
    }

#totalAmount {
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    font-size: clamp(1rem, 2.5vw, 1.4rem);
}

.product-card {
    border-radius: 12px;
    transition: all 0.2s ease;
}

    .product-card:active {
        transform: scale(0.98);
    }

.highlight {
    background-color: #ffe08a;
    padding: 0 2px;
    border-radius: 3px;
    transition: background 0.2s ease;
}

.required::after {
    content: " *";
    color: #dc3545;
    font-weight: bold;
}

/* Desktop sidebar spacing */
@media (min-width: 768px) {
    #sidebar {
        width: 240px;
    }

    #mainContent {
        margin-left: 240px;
    }
}

@media (max-width: 768px) {

    #sidebar {
        position: fixed;
        left: -260px;
        top: 0;
        width: 260px;
        height: 100%;
        z-index: 1050;
        transition: 0.3s ease;
    }

        #sidebar.active {
            left: 0;
        }

    #mainContent {
        margin-left: 0 !important;
    }

    #overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0,0,0,0.4);
        z-index: 1040;
    }

        #overlay.active {
            display: block;
        }
}

@keyframes shake {
    0% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-4px);
    }

    50% {
        transform: translateX(4px);
    }

    75% {
        transform: translateX(-4px);
    }

    100% {
        transform: translateX(0);
    }
}

.error-shake {
    animation: shake 0.3s;
}