* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Georgia', 'Times New Roman', serif;
    background: linear-gradient(135deg, #f5f0e6 0%, #e8e0d0 100%);
    min-height: 100vh;
    padding: 20px;
}

.ledger-container {
    max-width: 1200px;
    margin: 0 auto;
    background: #fffef5;
    border: 3px solid #8b4513;
    box-shadow: 0 0 20px rgba(0,0,0,0.3), inset 0 0 50px rgba(139,69,19,0.1);
    padding: 30px;
}

.ledger-title {
    text-align: center;
    font-size: 2.5rem;
    color: #8b4513;
    border-bottom: 3px double #8b4513;
    padding-bottom: 15px;
    margin-bottom: 25px;
    text-transform: uppercase;
    letter-spacing: 5px;
    font-weight: bold;
}

/* Opening Balance Section */
.opening-balance-section {
    background: #f9f5e9;
    border: 2px solid #d4a574;
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 5px;
}

.opening-form {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.opening-note {
    text-align: center;
    margin-top: 10px;
    color: #856404;
    font-size: 0.9rem;
    font-style: italic;
}

.opening-form label {
    font-weight: bold;
    color: #5c3d2e;
    font-size: 1.1rem;
}

.opening-form input {
    padding: 8px 12px;
    border: 2px solid #8b4513;
    font-size: 1rem;
    width: 150px;
    background: #fff;
}

.opening-form button {
    padding: 8px 20px;
    background: #8b4513;
    color: white;
    border: none;
    cursor: pointer;
    font-weight: bold;
}

.opening-form button:hover {
    background: #a0522d;
}

/* Add Transaction Section */
.add-transaction-section {
    background: #f0ebe0;
    border: 2px solid #c9a66b;
    padding: 20px;
    margin-bottom: 25px;
    border-radius: 5px;
}

.add-transaction-section h3 {
    color: #5c3d2e;
    margin-bottom: 15px;
    text-align: center;
}

.transaction-form {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
}

.transaction-form input,
.transaction-form select {
    padding: 10px;
    border: 2px solid #8b4513;
    font-size: 1rem;
    background: #fff;
}

.transaction-form input[type="date"] { width: 150px; }
.transaction-form input[type="text"] { width: 250px; }
.transaction-form select { width: 150px; }
.transaction-form input[type="number"] { width: 120px; }

.transaction-form button {
    padding: 10px 25px;
    background: #228b22;
    color: white;
    border: none;
    cursor: pointer;
    font-weight: bold;
    font-size: 1rem;
}

.transaction-form button:hover {
    background: #2e8b2e;
}

/* Ledger Book Table */
.ledger-book {
    overflow-x: auto;
    margin-bottom: 25px;
}

.ledger-table {
    width: 100%;
    border-collapse: collapse;
    background: #fffef8;
    font-size: 0.95rem;
}

.ledger-table th,
.ledger-table td {
    border: 1px solid #8b4513;
    padding: 10px 8px;
    text-align: left;
}

.debit-header {
    background: linear-gradient(180deg, #90ee90 0%, #7ccd7c 100%);
    color: #1a3d1a;
    text-align: center;
    font-size: 1.2rem;
}

.credit-header {
    background: linear-gradient(180deg, #ffb6c1 0%, #e89ca7 100%);
    color: #5c1a1a;
    text-align: center;
    font-size: 1.2rem;
}

.ledger-table thead tr:nth-child(2) th {
    background: #f5ead6;
    font-weight: bold;
    color: #5c3d2e;
}

.ledger-table thead tr:nth-child(2) th:nth-child(-n+4) {
    background: #e8f5e8;
}

.ledger-table thead tr:nth-child(2) th:nth-child(n+5) {
    background: #fce8ec;
}

.ledger-table tbody tr:nth-child(even) {
    background: #faf8f0;
}

.ledger-table tbody tr:hover {
    background: #f0ebe0;
}

.opening-row {
    background: #fff9c4 !important;
    font-style: italic;
}

.amount {
    text-align: right;
    font-family: 'Courier New', monospace;
    font-weight: bold;
}

.total-row {
    background: #e8e0c8 !important;
    border-top: 2px solid #8b4513;
}

.balance-row {
    background: #d4edda !important;
}

.grand-total-row {
    background: #c9b896 !important;
    border-top: 3px double #8b4513;
    font-size: 1.05rem;
}

.action-cell {
    white-space: nowrap;
}

.edit-btn, .delete-btn {
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 0.9rem;
    margin: 0 2px;
    transition: transform 0.2s;
}

.edit-btn {
    background: #ffc107;
    color: #333;
}

.edit-btn:hover {
    background: #e0a800;
    transform: scale(1.1);
}

.delete-btn {
    background: #dc3545;
    color: white;
}

.delete-btn:hover {
    background: #c82333;
    transform: scale(1.1);
}

/* Error Message */
.error-message {
    background: #f8d7da;
    color: #721c24;
    padding: 15px;
    border: 2px solid #f5c6cb;
    border-radius: 5px;
    margin-bottom: 20px;
    text-align: center;
    font-weight: bold;
}

/* Edit Transaction Section */
.edit-transaction-section {
    background: #fff3cd;
    border: 2px solid #ffc107;
    padding: 20px;
    margin-bottom: 25px;
    border-radius: 5px;
}

.edit-transaction-section h3 {
    color: #856404;
    margin-bottom: 15px;
    text-align: center;
}

.update-btn {
    padding: 10px 25px;
    background: #ffc107;
    color: #333;
    border: none;
    cursor: pointer;
    font-weight: bold;
    font-size: 1rem;
}

.update-btn:hover {
    background: #e0a800;
}

.cancel-btn {
    padding: 10px 25px;
    background: #6c757d;
    color: white;
    text-decoration: none;
    font-weight: bold;
    font-size: 1rem;
    display: inline-block;
}

.cancel-btn:hover {
    background: #5a6268;
}

/* Summary Section */
.summary-section {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(180deg, #f5ead6 0%, #e8dcc8 100%);
    border: 2px solid #8b4513;
    border-radius: 5px;
}

.summary-box {
    background: #fff;
    border: 2px solid #8b4513;
    padding: 15px 25px;
    min-width: 200px;
    text-align: center;
    border-radius: 5px;
    box-shadow: 2px 2px 5px rgba(0,0,0,0.1);
}

.summary-box .label {
    display: block;
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 5px;
}

.summary-box .value {
    display: block;
    font-size: 1.4rem;
    font-weight: bold;
    color: #333;
    font-family: 'Courier New', monospace;
}

.summary-box.received {
    border-color: #228b22;
    background: #e8f5e9;
}

.summary-box.received .value {
    color: #228b22;
}

.summary-box.expense {
    border-color: #dc3545;
    background: #ffebee;
}

.summary-box.expense .value {
    color: #dc3545;
}

.summary-box.net {
    border-width: 3px;
}

.summary-box.net.positive {
    border-color: #228b22;
    background: #c8e6c9;
}

.summary-box.net.positive .value {
    color: #1b5e20;
}

.summary-box.net.negative {
    border-color: #dc3545;
    background: #ffcdd2;
}

.summary-box.net.negative .value {
    color: #b71c1c;
}

/* Responsive Design */
@media (max-width: 768px) {
    .transaction-form {
        flex-direction: column;
    }

    .transaction-form input,
    .transaction-form select {
        width: 100% !important;
    }

    .ledger-title {
        font-size: 1.5rem;
        letter-spacing: 2px;
    }

    .summary-box {
        min-width: 150px;
        padding: 10px 15px;
    }
}

/* Password Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.6);
    backdrop-filter: blur(3px);
}

.modal-content {
    background: linear-gradient(180deg, #fffef5 0%, #f5ead6 100%);
    margin: 15% auto;
    padding: 30px;
    border: 3px solid #8b4513;
    width: 90%;
    max-width: 400px;
    border-radius: 10px;
    box-shadow: 0 5px 30px rgba(0,0,0,0.3);
    position: relative;
}

.modal-close {
    position: absolute;
    right: 15px;
    top: 10px;
    font-size: 28px;
    font-weight: bold;
    color: #8b4513;
    cursor: pointer;
}

.modal-close:hover {
    color: #dc3545;
}

.modal-content h3 {
    color: #5c3d2e;
    margin-bottom: 20px;
    text-align: center;
    font-size: 1.3rem;
}

.password-field {
    margin-bottom: 20px;
}

.password-field label {
    display: block;
    margin-bottom: 8px;
    color: #5c3d2e;
    font-weight: bold;
}

.password-field input {
    width: 100%;
    padding: 12px;
    border: 2px solid #8b4513;
    font-size: 1rem;
    border-radius: 5px;
}

.password-field input:focus {
    outline: none;
    border-color: #a0522d;
    box-shadow: 0 0 5px rgba(139, 69, 19, 0.3);
}

.modal-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.confirm-btn {
    padding: 12px 30px;
    background: #228b22;
    color: white;
    border: none;
    cursor: pointer;
    font-weight: bold;
    font-size: 1rem;
    border-radius: 5px;
}

.confirm-btn:hover {
    background: #1e7b1e;
}

.cancel-modal-btn {
    padding: 12px 30px;
    background: #6c757d;
    color: white;
    border: none;
    cursor: pointer;
    font-weight: bold;
    font-size: 1rem;
    border-radius: 5px;
}

.cancel-modal-btn:hover {
    background: #5a6268;
}