:root {
    --primary: #007bff;
    --primary-dark: #0056b3;
    --success: #28a745;
    --danger: #dc3545;
    --warning: #ffc107;
    --info: #17a2b8;
    --secondary: #6c757d;
    --bg: #f4f6f9;
    --white: #ffffff;
    --text: #333333;
    --border: #dddddd;
    --special-border: #ff9800;
    --special-bg: #fffaf0;
}


/* GENERAL STYLES */
body { 
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; 
    background-color: #f4f4f9; 
    margin: 0; 
    padding: 0; 
    font-size: 16px; /* Base font size for readability */
}

.container { 
    width: 95%; /* Wider on small screens */
    max-width: 1000px; 
    margin: 20px auto; 
    background: #fff; 
    padding: 20px; 
    box-shadow: 0 0 10px rgba(0,0,0,0.1); 
    border-radius: 8px; 
    box-sizing: border-box; /* Ensures padding doesn't break width */
}

h2, h3 { 
    color: #333; 
    border-bottom: 2px solid #eee; 
    padding-bottom: 10px; 
}

/* RESPONSIVE NAVIGATION */
nav { 
    background: #333; 
    padding: 10px 0; 
    margin-bottom: 20px; 
    display: flex;
    flex-wrap: wrap; /* Allows links to wrap on mobile */
    justify-content: center;
    gap: 10px;
}

nav a { 
    color: #fff; 
    text-decoration: none; 
    padding: 8px 15px; /* Bigger touch target */
    font-weight: bold; 
    border-radius: 4px;
    transition: background 0.3s;
}

nav a:hover { 
    background-color: #555; 
    color: #fff;
}

.pos { color: #28a745; font-weight: bold; }
.neg { color: #dc3545; font-weight: bold; }

/* RESPONSIVE TABLES */
table { 
    width: 100%; 
    border-collapse: collapse; 
    margin-top: 20px; 
    min-width: 600px; /* Forces table to keep shape */
}

/* Wrapper to make table scrollable on mobile */
.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Logic: If you didn't wrap table in div, this makes the table element itself scroll */
@media (max-width: 768px) {
    table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
    
    /* Adjust padding for mobile tables */
    table th, table td {
        padding: 8px 5px;
        font-size: 14px;
    }
}

table th, table td { 
    border: 1px solid #ddd; 
    padding: 10px; 
    text-align: left; 
}

table th { 
    background-color: #007bff; 
    color: white; 
}

/* FORMS */
form { 
	margin-top: 20px; 
}
.form-group { 
	margin-bottom: 15px; 
}
label { 
	display: block; 
	margin-bottom: 5px; 
	font-weight: bold; 
}
input, select, textarea { 
    width: 100%; 
    padding: 10px; /* Larger padding for touch */
    box-sizing: border-box; 
    border: 1px solid #ccc; 
    border-radius: 4px; 
    font-size: 16px; /* Prevents zoom on iPhone inputs */
}

.alert { 
    padding: 15px; 
    background-color: #d4edda; 
    color: #155724; 
    margin-bottom: 15px; 
    border-radius: 4px; 
    word-wrap: break-word;
}

ul li {
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
    flex-wrap: wrap; /* Allows content to wrap */
}
.text-right {
    text-align: right !important;
}

/* ================= BUTTONS ================= */
button, .btn {
    display: inline-block;
    padding: 10px 15px;
    font-size: 14px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    text-align: center;
    color: white;
    transition: opacity 0.2s;
}

.btn-delete {
    background-color: #dc3545;
    padding: 5px 10px;
    font-size: 12px;
    margin-left: 0; /* Reset margin for mobile lists */
}

button:hover, .btn:hover { opacity: 0.9; }

/* Button Colors */
.btn-primary { background: var(--primary); width: 100%; font-size: 16px; margin-top: 10px; }
.btn-success { background: var(--success); }
.btn-danger { background: var(--danger); }
.btn-warning { background: var(--warning); color: #000; }
.btn-info { background: var(--info); }
.btn-secondary { background: var(--secondary); }
.btn-block { 
	display: block; 
	width: 100%; 
	margin-top: 10px; 
}

/* --- MOBILE SPECIFIC OVERRIDES --- */
@media (max-width: 768px) {
    
    /* Force inline flex containers (like Date/Currency row) to stack vertically */
    div[style*="display:flex"] {
        flex-direction: column !important;
        gap: 0 !important;
    }
    
    /* Fix margins on the now-stacked form items */
    div[style*="display:flex"] .form-group {
        margin-bottom: 15px !important;
    }

    /* Fix Report 2 Summary Boxes (Grid) */
    div[style*="display:grid"] {
        grid-template-columns: 1fr !important; /* Stack boxes vertically */
    }

    /* Adjust heading sizes */
    h2 { font-size: 1.5em; }
    h3 { font-size: 1.2em; }
    
    /* Login Box Fix */
    .login-box { width: 100%; margin: 50px auto; }
}