/* -------------------------------------------------------------
 * Theme: ร้านข้าวชาวนา (Farmer's Rice Shop) Bookkeeping Mobile Web App
 * Style Guideline: Pastel Greens, Warm Cream/Yellow Accent, Rounded Cards,
 * Cute Chibi Mascot details, and smooth micro-interactions.
 * ------------------------------------------------------------- */

/* CSS Variables */
:root {
    --primary: #4E7A5A;         /* Deep Sage Green */
    --primary-light: #EBF3ED;   /* Soft Sage BG */
    --primary-dark: #32533C;    /* Muted dark green for headings */
    --accent: #E8BA5A;          /* Warm Honey Yellow */
    --accent-light: #FFF8E7;    /* Cream Yellow BG */
    --background: #F4F7F5;      /* Main background */
    --card-bg: #FFFFFF;         /* Pure white for cards */
    --text-main: #2C3E31;       /* Dark Greenish Charcoal */
    --text-light: #738A7A;      /* Medium Muted Sage */
    --border-color: #E2ECE5;    /* Light Sage borders */
    --success: #5EA37B;         /* Bright Pastel Green (e.g. Paid) */
    --success-light: #E8F5EE;
    --warning: #E89E5A;         /* Warm Orange (e.g. Unpaid) */
    --warning-light: #FFF3E6;
    --danger: #E07A5F;          /* Terracotta Red */
    --danger-light: #FDF0EC;
    --radius-lg: 20px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --shadow-sm: 0 4px 10px rgba(78, 122, 90, 0.04);
    --shadow-md: 0 10px 25px rgba(78, 122, 90, 0.07);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset and Global Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Prompt', 'Mitr', sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: #D3DDD6; /* Desktop background environment */
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    color: var(--text-main);
    overflow-x: hidden;
}

/* Scrollbar customization */
::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 10px;
}

/* Main Mobile Simulator Frame */
.phone-container {
    width: 100%;
    max-width: 480px;
    height: 100vh;
    max-height: 950px;
    background-color: var(--background);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.15);
    border-radius: 28px;
    border: 8px solid #2B382F; /* Outer phone bezel */
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

/* Adjust for pure mobile devices (remove phone border) */
@media (max-width: 480px) {
    body {
        background-color: var(--background);
    }
    .phone-container {
        max-height: 100vh;
        border-radius: 0;
        border: none;
    }
}

/* App Header styling */
.app-header {
    background: linear-gradient(135deg, #A8C9B1 0%, #D4E6D9 100%);
    padding: 20px 20px 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom-left-radius: 24px;
    border-bottom-right-radius: 24px;
    box-shadow: 0 4px 15px rgba(78, 122, 90, 0.08);
    position: relative;
    z-index: 10;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 12px;
}

.app-logo {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 50%;
    background-color: white;
    border: 2px solid white;
    box-shadow: var(--shadow-sm);
}

.title-group h1 {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--primary-dark);
    line-height: 1.2;
}

.title-group p {
    font-size: 0.75rem;
    color: var(--text-light);
    font-weight: 500;
}

.header-decor {
    display: flex;
    gap: 5px;
}

.decor-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--primary);
    opacity: 0.5;
}

.decor-dot:last-child {
    background-color: var(--accent);
    opacity: 0.8;
}

/* Live Grand Summary Card */
.live-summary-card {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    margin: 15px;
    padding: 18px 20px;
    border-radius: 24px;
    color: white;
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
}

.live-summary-card::after {
    content: '';
    position: absolute;
    top: -50px;
    right: -50px;
    width: 120px;
    height: 120px;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    border-radius: 50%;
}

.summary-title {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.85);
    font-weight: 500;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.grand-total-amount {
    font-size: 2.2rem;
    font-weight: 700;
    margin: 4px 0 10px 0;
    font-family: 'Prompt', sans-serif;
    color: var(--accent);
}

.summary-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    padding-top: 10px;
}

.summary-item {
    display: flex;
    flex-direction: column;
}

.summary-item .item-label {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.7);
}

.summary-item .item-val {
    font-size: 0.95rem;
    font-weight: 600;
    margin-top: 2px;
}

.summary-item.income .item-val {
    color: #A7D49B;
}

.summary-item.expense .item-val {
    color: #F8B4B4;
}

.summary-progress-container {
    height: 6px;
    background-color: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
    margin-top: 12px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background-color: var(--accent);
    border-radius: 3px;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.outstanding-label {
    display: flex;
    align-items: center;
    gap: 6px;
    background-color: rgba(232, 158, 90, 0.25);
    border-radius: 12px;
    padding: 6px 12px;
    margin-top: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    color: #FFD2A8;
}

.warning-icon {
    font-size: 0.85rem;
}

/* App Main Content Area */
.app-content {
    flex: 1;
    overflow-y: auto;
    padding: 5px 15px 85px 15px; /* bottom padding makes space for bottom navbar */
}

/* Tab panes styling */
.tab-pane {
    display: none;
    animation: fadeInUp 0.35s ease;
}

.tab-pane.active {
    display: block;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Card layout for forms and sections */
.form-card {
    background-color: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 16px;
    margin-bottom: 15px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

.form-card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
    border-bottom: 1px dashed var(--border-color);
    padding-bottom: 10px;
    position: relative;
}

.card-icon {
    font-size: 1.25rem;
}

.card-header h2 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--primary-dark);
}

.badge {
    position: absolute;
    right: 0;
    background-color: var(--danger-light);
    color: var(--danger);
    font-size: 0.8rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 20px;
}

.badge.badge-income {
    background-color: var(--success-light);
    color: var(--success);
}

/* Input elements styling */
.form-group {
    margin-bottom: 14px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.form-group label {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-light);
}

.form-group input[type="date"],
.form-group select {
    width: 100%;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    border: 1.5px solid var(--border-color);
    background-color: #FCFDFD;
    font-size: 0.9rem;
    color: var(--text-main);
    outline: none;
    transition: var(--transition);
}

.form-group input[type="date"]:focus,
.form-group select:focus {
    border-color: var(--primary);
    background-color: white;
    box-shadow: 0 0 0 3px rgba(78, 122, 90, 0.1);
}

/* Segmented Control for Morning / Evening */
.segmented-control {
    display: flex;
    background-color: var(--primary-light);
    padding: 4px;
    border-radius: var(--radius-md);
    margin-top: 4px;
}

.segmented-control input[type="radio"] {
    display: none;
}

.segmented-control label {
    flex: 1;
    text-align: center;
    padding: 8px 0;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.segmented-control input[type="radio"]:checked + label {
    background-color: var(--primary);
    color: white;
    box-shadow: var(--shadow-sm);
}

/* Switches Status (Open/Closed) styling */
.status-switches {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 15px;
    background-color: #FAFBF9;
    padding: 12px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.status-switch-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.session-lbl {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-main);
}

.switch-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

.switch-text {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--success);
    min-width: 40px;
    text-align: right;
}

.switch-text.closed {
    color: var(--danger);
}

/* The toggle switch slider */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 46px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #E27E6A; /* Closed state color */
    transition: .3s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

input:checked + .slider {
    background-color: var(--success);
}

input:focus + .slider {
    box-shadow: 0 0 1px var(--success);
}

input:checked + .slider:before {
    transform: translateX(22px);
}

/* Input Prefix / Suffix Groups */
.input-prefix-group,
.input-suffix-group {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.currency-symbol {
    position: absolute;
    left: 12px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-light);
}

.input-prefix-group input {
    width: 100%;
    padding: 9px 12px 9px 28px;
    border-radius: var(--radius-md);
    border: 1.5px solid var(--border-color);
    background-color: #FCFDFD;
    font-size: 0.9rem;
    outline: none;
    transition: var(--transition);
}

.input-prefix-group.size-lg input {
    padding: 12px 12px 12px 35px;
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--primary-dark);
}

.input-prefix-group.size-lg .currency-symbol {
    font-size: 1.1rem;
    left: 15px;
}

.input-prefix-group input:focus,
.input-suffix-group input:focus {
    border-color: var(--primary);
    background-color: white;
    box-shadow: 0 0 0 3px rgba(78, 122, 90, 0.08);
}

.input-suffix-group input {
    width: 100%;
    padding: 9px 50px 9px 12px;
    border-radius: var(--radius-md);
    border: 1.5px solid var(--border-color);
    background-color: #FCFDFD;
    font-size: 0.9rem;
    outline: none;
    transition: var(--transition);
}

.unit-label {
    position: absolute;
    right: 12px;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-light);
}

/* Dynamic Rows and Lists */
.dynamic-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}

.dynamic-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    animation: slideDown 0.25s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dynamic-row .row-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-main);
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dynamic-row-inputs {
    display: flex;
    flex: 2;
    gap: 6px;
    align-items: center;
}

.dynamic-row-inputs > input,
.dynamic-row-inputs input.other-expense-title,
.dynamic-row-inputs input.gov-scheme-title {
    padding: 7px 10px;
    border-radius: var(--radius-md);
    border: 1.5px solid var(--border-color);
    font-size: 0.85rem;
    outline: none;
}

.btn-remove {
    background: none;
    border: none;
    color: var(--danger);
    cursor: pointer;
    font-size: 1.1rem;
    padding: 4px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    transition: var(--transition);
}

.btn-remove:hover {
    background-color: var(--danger-light);
}

/* Form Group Row Layout */
.form-group-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    margin-bottom: 10px;
}

.form-group-row label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-main);
    min-width: 80px;
}

.form-group-row .input-prefix-group,
.form-group-row .input-suffix-group {
    max-width: 160px;
}

/* Buttons style */
.btn-primary {
    background-color: var(--primary);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(78, 122, 90, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: var(--transition);
    width: 100%;
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 6px 15px rgba(78, 122, 90, 0.25);
}

.btn-primary:active {
    transform: translateY(1px);
}

.btn-secondary {
    background-color: var(--primary-light);
    color: var(--primary);
    border: 1.5px dashed rgba(78, 122, 90, 0.3);
    padding: 8px 16px;
    border-radius: var(--radius-md);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    margin-top: 5px;
    transition: var(--transition);
}

.btn-secondary:hover {
    background-color: #DFECDF;
    border-color: var(--primary);
}

.btn-secondary-solid {
    background-color: #E2ECE5;
    color: var(--primary-dark);
    border: none;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-secondary-solid:hover {
    background-color: var(--border-color);
}

.btn-danger-outline {
    background: none;
    border: 1.5px solid var(--danger);
    color: var(--danger);
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    transition: var(--transition);
}

.btn-danger-outline:hover {
    background-color: var(--danger-light);
}

.action-buttons-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 20px;
    margin-bottom: 20px;
}

/* Order rows specific details styling */
.order-row-item {
    background-color: #F8FAF7;
    border-radius: var(--radius-md);
    padding: 10px;
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 8px;
    animation: slideDown 0.25s ease-out;
}

.order-row-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.order-row-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.order-input-small {
    width: 100%;
    padding: 6px 8px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    font-size: 0.75rem;
    outline: none;
}

/* Toggle Pill for Order Payment status */
.pill-toggle {
    display: flex;
    background-color: #EBEBEB;
    border-radius: 20px;
    padding: 2px;
    width: 110px;
}

.pill-toggle label {
    flex: 1;
    font-size: 0.65rem;
    font-weight: 600;
    text-align: center;
    padding: 3px 0;
    border-radius: 18px;
    cursor: pointer;
    color: #777777;
    transition: var(--transition);
}

.pill-toggle input[type="radio"] {
    display: none;
}

.pill-toggle input[type="radio"]:checked + label {
    background-color: var(--success);
    color: white;
}

.pill-toggle input[type="radio"].unpaid-radio:checked + label {
    background-color: var(--warning);
    color: white;
}

/* Nested calculation card (for gas / water cylinder breakdown) */
.nested-expense-card {
    background-color: #FAFBF9;
    border-radius: var(--radius-md);
    padding: 10px 12px;
    margin-bottom: 12px;
    border: 1px solid var(--border-color);
}

.nested-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--primary-dark);
}

.nested-calc-total {
    color: var(--danger);
    font-weight: 700;
}

.nested-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.nested-row .col {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nested-row label {
    font-size: 0.7rem;
    color: var(--text-light);
    font-weight: 500;
}

.nested-row input {
    width: 100%;
    padding: 6px 8px;
    border-radius: var(--radius-sm);
    border: 1.5px solid var(--border-color);
    font-size: 0.8rem;
    outline: none;
}

/* BOTTOM NAVIGATION BAR */
.bottom-nav {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 70px;
    background-color: white;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding-bottom: env(safe-area-inset-bottom);
    z-index: 100;
    box-shadow: 0 -4px 15px rgba(0,0,0,0.03);
    border-bottom-left-radius: 20px;
    border-bottom-right-radius: 20px;
}

/* Fix border-radius overlapping on desktop simulator frame */
@media (max-width: 480px) {
    .bottom-nav {
        border-bottom-left-radius: 0;
        border-bottom-right-radius: 0;
    }
}

.nav-tab {
    flex: 1;
    background: none;
    border: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    color: var(--text-light);
    cursor: pointer;
    padding: 8px 0;
    transition: var(--transition);
    height: 100%;
}

.nav-icon {
    width: 22px;
    height: 22px;
    transition: var(--transition);
}

.nav-label {
    font-size: 0.7rem;
    font-weight: 500;
    transition: var(--transition);
}

.nav-tab.active {
    color: var(--primary);
}

.nav-tab.active .nav-icon {
    transform: scale(1.1);
    stroke-width: 2.5;
}

.nav-tab.active .nav-label {
    font-weight: 600;
}

/* TAB 2: HISTORY LOGS LAYOUT */
.history-filter-card {
    background-color: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 15px;
    margin-bottom: 15px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.filter-row {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.filter-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.filter-col label {
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--text-light);
}

.filter-col input[type="date"],
.filter-col select {
    padding: 8px;
    border-radius: var(--radius-sm);
    border: 1.5px solid var(--border-color);
    font-size: 0.8rem;
    outline: none;
    background-color: #FAFBF9;
}

.export-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
    border-top: 1px dashed var(--border-color);
    padding-top: 12px;
}

.btn-sm {
    padding: 6px 10px;
    font-size: 0.72rem;
    flex: 1;
    min-width: 90px;
}

.history-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding: 0 4px;
}

.history-list-header h3 {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary-dark);
}

.history-list-header span {
    font-size: 0.75rem;
    color: var(--text-light);
    font-weight: 500;
}

.history-logs-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-bottom: 20px;
}

/* Individual Log Card */
.log-card {
    background-color: white;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    padding: 14px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.log-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #FAFBF9;
    padding-bottom: 8px;
}

.log-date-session {
    display: flex;
    align-items: center;
    gap: 8px;
}

.log-date {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-main);
}

.log-session {
    font-size: 0.7rem;
    font-weight: 600;
    background-color: var(--primary-light);
    color: var(--primary);
    padding: 2px 8px;
    border-radius: 12px;
}

.log-session.session-evening {
    background-color: var(--accent-light);
    color: #B48D2A;
}

.log-status-tag {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 12px;
}

.log-status-tag.open {
    background-color: var(--success-light);
    color: var(--success);
}

.log-status-tag.closed {
    background-color: var(--danger-light);
    color: var(--danger);
}

.log-card-summary {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
    margin-top: 10px;
}

.summary-val-box {
    display: flex;
    flex-direction: column;
}

.summary-val-box .lbl {
    font-size: 0.65rem;
    color: var(--text-light);
}

.summary-val-box .val {
    font-size: 0.85rem;
    font-weight: 600;
}

.summary-val-box.net-profit .val {
    color: var(--primary);
}

.summary-val-box.net-profit .val.negative {
    color: var(--danger);
}

/* Log Card Collapsible details */
.log-card-details {
    display: none;
    border-top: 1px dashed var(--border-color);
    padding-top: 10px;
    margin-top: 10px;
    font-size: 0.78rem;
    animation: fadeIn 0.25s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.log-detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.log-detail-section {
    margin-bottom: 8px;
}

.log-detail-section h4 {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-light);
    margin-bottom: 4px;
    border-bottom: 1px solid #F0F4F1;
    padding-bottom: 2px;
}

.detail-item {
    display: flex;
    justify-content: space-between;
    padding: 2px 0;
}

.detail-item .name {
    color: #555555;
}

.detail-item .val {
    font-weight: 500;
}

.log-card-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 10px;
    border-top: 1px solid #FAFBF9;
    padding-top: 8px;
}

.btn-action-icon {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 6px;
    transition: var(--transition);
}

.btn-action-icon.edit {
    background-color: var(--primary-light);
    color: var(--primary);
}

.btn-action-icon.edit:hover {
    background-color: #DDECE0;
}

.btn-action-icon.delete {
    background-color: var(--danger-light);
    color: var(--danger);
}

.btn-action-icon.delete:hover {
    background-color: #F8E3DD;
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
}

.empty-icon {
    font-size: 2.5rem;
    margin-bottom: 10px;
    opacity: 0.6;
}

.empty-state p {
    font-size: 0.8rem;
    color: var(--text-light);
}

/* TAB 3: DASHBOARD STATS LAYOUT */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 15px;
}

.stat-box {
    background-color: white;
    border-radius: var(--radius-md);
    padding: 14px 12px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.stat-icon {
    position: absolute;
    right: 8px;
    top: 8px;
    font-size: 1.25rem;
    opacity: 0.15;
}

.stat-lbl {
    font-size: 0.68rem;
    color: var(--text-light);
    font-weight: 500;
}

.stat-val {
    font-size: 1.05rem;
    font-weight: 700;
    margin-top: 4px;
}

.stat-box.income .stat-val {
    color: var(--primary);
}

.stat-box.expense .stat-val {
    color: var(--danger);
}

.stat-box.profit .stat-val {
    color: #2F6A38;
}

.stat-box.secondary .stat-val {
    color: var(--accent);
}

.dashboard-card {
    background-color: white;
    border-radius: var(--radius-lg);
    padding: 16px;
    margin-bottom: 15px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.chart-container {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 15px;
    padding: 10px 0;
}

/* SVG Donut Chart styling */
.pie-chart-wrapper {
    position: relative;
    width: 180px;
    height: 180px;
}

.donut-chart {
    transform: rotate(-90deg);
}

.donut-segment {
    transition: stroke-dasharray 0.5s ease-out;
}

.donut-center-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.donut-center-text .label {
    font-size: 0.65rem;
    color: var(--text-light);
    font-weight: 500;
}

.donut-center-text .val {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--primary-dark);
}

.chart-legend {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    width: 100%;
}

.legend-item {
    font-size: 0.72rem;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 6px;
}

.legend-color {
    width: 10px;
    height: 10px;
    border-radius: 2px;
}

.color-basket { background-color: #4E7A5A; }
.color-transfer { background-color: #E8BA5A; }
.color-gov { background-color: #A7D49B; }
.color-order { background-color: #5EA37B; }

/* CSS Bar Chart for Dashboard */
.bar-chart {
    display: flex;
    justify-content: space-around;
    align-items: flex-end;
    height: 150px;
    width: 100%;
    padding: 10px 0;
    border-bottom: 2px solid var(--border-color);
}

.bar-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    height: 100%;
    justify-content: flex-end;
    flex: 1;
}

.bar-pillar-group {
    display: flex;
    gap: 2px;
    height: 100%;
    align-items: flex-end;
    width: 70%;
    justify-content: center;
}

.bar-pillar {
    width: 14px;
    border-top-left-radius: 3px;
    border-top-right-radius: 3px;
    transition: height 0.4s ease;
    cursor: pointer;
    position: relative;
}

.bar-pillar:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    top: -24px;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--text-main);
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.65rem;
    white-space: nowrap;
    z-index: 10;
}

.bar-pillar.income {
    background-color: var(--success);
}

.bar-pillar.expense {
    background-color: var(--danger);
}

.bar-date {
    font-size: 0.65rem;
    color: var(--text-light);
    font-weight: 500;
}

.dashboard-tip-card {
    background-color: var(--accent-light);
    border: 1.5px solid #F6E2BC;
    border-radius: var(--radius-md);
    padding: 12px 14px;
    display: flex;
    gap: 10px;
    align-items: flex-start;
    margin-bottom: 20px;
}

.tip-icon {
    font-size: 1.2rem;
}

.tip-content {
    font-size: 0.75rem;
    color: #8C6A18;
    line-height: 1.4;
}

/* Toast Notifications styling */
.toast {
    position: absolute;
    bottom: -60px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(44, 62, 49, 0.95);
    color: white;
    padding: 10px 24px;
    border-radius: 30px;
    font-size: 0.8rem;
    font-weight: 500;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    z-index: 1000;
    transition: bottom 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    white-space: nowrap;
}

.toast.show {
    bottom: 85px;
}

/* Cloud Sync & Settings Styling */
.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-settings-gear {
    background: none;
    border: none;
    font-size: 1.15rem;
    cursor: pointer;
    padding: 6px;
    border-radius: 50%;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-dark);
}

.btn-settings-gear:hover {
    background-color: var(--bg-color);
    transform: rotate(45deg);
}

.sync-status-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    background-color: rgba(78, 122, 90, 0.08);
    border: 1px solid var(--border-color);
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.65rem;
    font-weight: 600;
    transition: var(--transition);
    color: var(--text-light);
}

.sync-status-indicator.synced {
    background-color: #EAF6EE;
    border-color: #B2D8C3;
    color: #2F6A44;
}

.sync-status-indicator.error {
    background-color: #FDF2F2;
    border-color: #F8B4B4;
    color: #C81E1E;
}

.sync-status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: var(--text-light);
}

.sync-status-indicator.synced .sync-status-dot {
    background-color: var(--success);
    box-shadow: 0 0 0 2px rgba(99, 178, 129, 0.3);
}

.sync-status-indicator.error .sync-status-dot {
    background-color: var(--danger);
}

/* Modal Overlay & Card */
.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.4);
    z-index: 1001;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
    padding: 16px;
}

.modal-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.modal-card {
    background-color: white;
    width: 100%;
    max-width: 340px;
    border-radius: var(--radius-lg);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    transform: translateY(20px);
    transition: transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.15);
}

.modal-overlay.open .modal-card {
    transform: translateY(0);
}

.modal-header {
    background-color: #F3F6F2;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1.5px solid var(--border-color);
}

.modal-header h3 {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--primary-dark);
    margin: 0;
}

.btn-close-modal {
    background: none;
    border: none;
    font-size: 1rem;
    color: var(--text-light);
    cursor: pointer;
    font-weight: bold;
    padding: 4px;
    border-radius: 4px;
    transition: var(--transition);
}

.btn-close-modal:hover {
    color: var(--danger);
    background-color: rgba(248, 180, 180, 0.15);
}

.modal-body {
    padding: 16px;
}
