:root {
    --color-primary-base: #ffffff;
    --color-primary-dark: #e4e4e4;
    --color-bg-primary: var(--color-primary-base);
    --color-bg-secondary: var(--color-primary-dark);
    --color-bg-card: rgba(255, 255, 255, 0.2);
    --color-bg-modal: rgb(236, 236, 236);
    --color-bg-input: rgb(255, 255, 255, 0.8);
    --color-text-default: #000000;
    --color-text-secondary: rgba(0, 0, 0, 0.985);
    --color-text-placeholder: rgba(0, 0, 0, 0.45);
    --color-text-opposite: #ffffff;
    --color-input-focus: rgba(132, 132, 132, 1);
    --color-button-primary: rgb(64, 64, 64);
    --color-button-hover: rgb(159, 159, 159);
    
    --font-family-base: 'Roboto', sans-serif;
    --font-weight-bold: 700;
    --space-l: 40px;
    --space-m: 20px;
    --space-s: 8px;
    --radius-m: 16px;
}

body {
    margin: 0;
    font-family: var(--font-family-base);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--color-bg-primary), var(--color-bg-secondary));
    overflow-x: hidden;
}

#loginForm {
    background: var(--color-bg-card);
    border-radius: var(--radius-m);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
    padding: var(--space-l);
    width: 350px;
    color: var(--color-text-default); 
    display: flex;
    flex-direction: column;
    gap: var(--space-m);
}

h2 {
    text-align: center;
    font-size: 1.8em;
    margin-top: 0;
    margin-bottom: var(--space-m);
    font-weight: var(--font-weight-bold);
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--color-text-secondary); 
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-s);
}

.form-group label {
    font-size: 0.9em;
    font-weight: 500;
    padding-top: 10px;
    color: var(--color-text-secondary); 
}

.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="date"],
.form-group input[type="number"],
.form-group input[type="text"] {
    width: 100%;
    padding: 12px 15px;
    border: none;
    border-radius: var(--space-s);
    background: var(--color-bg-input); 
    color: var(--color-text-default); 
    font-size: 1em;
    outline: none;
    box-sizing: border-box;
}

.form-group input::placeholder {
    color: var(--color-text-placeholder);
}

.form-group input:focus {
    box-shadow: 0 0 0 2px var(--color-input-focus); 
}

.btn.btn-primary {
    width: 100%;
    padding: 15px;
    border: none;
    border-radius: var(--space-s);
    background: var(--color-button-primary); 
    color: var(--color-text-opposite);
    font-size: 1.1em;
    font-weight: var(--font-weight-bold);
    transition: 0.3s ease;
    letter-spacing: 3px;
    margin-top: 10px;
    cursor: pointer;
}

.btn.btn-primary:hover {
    background: var(--color-button-hover);
    transform: translateY(-2px);
}

.error-message {
    color: #cc4444; 
    font-size: 0.9em;
    text-align: center;
}

#transactionTable {
    display: none;
    width: 95%;
    max-width: 1400px;
    margin: var(--space-l) auto;
    padding: var(--space-l);
}

#transactionTable h1 {
    text-align: center;
    font-size: 2em;
    margin-bottom: var(--space-l);
    font-weight: var(--font-weight-bold);
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--color-text-secondary);
}

.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-l);
}

.table-header h1 {
    margin: 0;
    line-height: 1;
}

.button-group {
    display: flex;
    gap: 10px;
    align-items: center;
}

#addTransactionBtn,
#logoutBtn {
    width: auto;
    padding: 12px 24px;
    font-size: 1em;
    letter-spacing: 1px;
    border: none;
    border-radius: var(--space-s);
    font-weight: var(--font-weight-bold);
    transition: 0.3s ease;
    cursor: pointer;
}

#addTransactionBtn {
    background: var(--color-button-primary);
    color: var(--color-text-opposite);
}

#addTransactionBtn:hover {
    background: var(--color-button-hover);
    transform: translateY(-2px);
}

#logoutBtn {
    background: var(--color-bg-secondary);
    color: var(--color-text-default);
    border: 1px solid var(--color-button-primary);
}

#logoutBtn:hover {
    background: var(--color-button-primary);
    color: var(--color-text-opposite);
    transform: translateY(-2px);
}

.table-container {
    background: var(--color-bg-card);
    border-radius: var(--radius-m);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.table-wrapper {
    overflow-x: auto;
    max-height: 70vh;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    table-layout: fixed;
}

thead th:nth-child(1) { width: 12%; }
thead th:nth-child(2) { width: 8%; }
thead th:nth-child(3) { width: 12%; }
thead th:nth-child(4) { width: 18%; }
thead th:nth-child(5) { width: 50%; }

thead {
    position: sticky;
    top: 0;
    background: var(--color-button-primary);
    z-index: 10;
}

thead th {
    padding: 15px 20px;
    text-align: left;
    font-weight: var(--font-weight-bold);
    letter-spacing: 1px;
    text-transform: uppercase;
    font-size: 0.85em;
    color: var(--color-text-opposite);
    border-bottom: 2px solid var(--color-button-hover);
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
    transition: background-color 0.2s ease;
}

thead th:hover {
    background: var(--color-button-hover);
}

thead th:active {
    background: #505050;
}

tbody tr {
    transition: background-color 0.2s ease;
    border-bottom: 1px solid var(--color-bg-secondary);
}

tbody tr:hover {
    background-color: var(--color-bg-secondary);
}

tbody tr:last-child {
    border-bottom: none;
}

tbody td {
    padding: 15px 20px;
    color: var(--color-text-default);
    font-size: 0.95em;
    background: white;
    overflow: hidden;
    text-overflow: ellipsis;
}

tbody td:first-child {
    font-weight: 500;
}

tbody td:nth-child(3) {
    font-weight: var(--font-weight-bold);
    color: var(--color-button-primary);
}

.transaction-message {
    text-align: center;
    padding: 40px 20px;
    color: #666;
}

.transaction-message.error {
    color: #d32f2f;
}

.loading-spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #404040;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

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

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    justify-content: center;
    align-items: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: var(--color-bg-modal);
    border-radius: var(--radius-m);
    padding: var(--space-l);
    width: 90%;
    max-width: 500px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
    flex-direction: column;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-m);
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5em;
}

.close-btn {
    background: none;
    border: none;
    font-size: 2em;
    cursor: pointer;
    color: var(--color-text-secondary);
    line-height: 1;
    padding: 0;
    width: 30px;
    height: 30px;
}

.close-btn:hover {
    color: var(--color-button-primary);
}

.toast-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    background: white;
    padding: 16px 20px;
    border-radius: var(--space-s);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
    max-width: 500px;
    opacity: 0;
    transform: translateY(-20px);
    transition: all 0.3s ease;
    pointer-events: auto;
    border-left: 4px solid;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.toast.hide {
    opacity: 0;
    transform: translateY(-20px);
}

.toast-error {
    border-left-color: #d32f2f;
    background: #ffebee;
}

.toast-success {
    border-left-color: #2e7d32;
    background: #e8f5e9;
}

.toast-info {
    border-left-color: #1976d2;
    background: #e3f2fd;
}

.toast-message {
    flex: 1;
    color: var(--color-text-default);
    font-size: 0.95em;
    line-height: 1.4;
}

.toast-close {
    background: none;
    border: none;
    font-size: 1.5em;
    cursor: pointer;
    color: var(--color-text-secondary);
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
    line-height: 1;
}

.toast-close:hover {
    color: var(--color-text-default);
}
