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

html {
    overflow-x: hidden;
}

body {
    font-family: Georgia, 'Times New Roman', serif;
    background: #f5f5f5;
    min-height: 100vh;
    padding: 20px 15px;
    color: #333;
    line-height: 1.6;
    overflow-x: hidden;
    max-width: 100vw;
}

.container {
    max-width: 700px;
    margin: 0 auto;
    width: 100%;
    overflow-x: hidden;
}

h1 {
    font-size: 1.8em;
    margin-bottom: 5px;
    font-weight: normal;
}

.subtitle {
    color: #666;
    margin-bottom: 30px;
    font-size: 0.9em;
}

.total-display {
    border-top: 2px solid #333;
    border-bottom: 2px solid #333;
    padding: 20px 0;
    margin-bottom: 30px;
}

.total-label {
    font-size: 0.9em;
    color: #666;
    margin-bottom: 5px;
}

.total-value {
    font-size: 2em;
    font-weight: normal;
    word-break: break-all;
}

.controls {
    margin-bottom: 40px;
}

input[type="number"],
.note-input {
    width: 100%;
    padding: 8px 4px;
    border: none;
    border-bottom: 1px solid #ccc;
    font-size: 1em;
    font-family: Georgia, 'Times New Roman', serif;
    background: transparent;
    margin-bottom: 10px;
}

input[type="number"]:focus,
.note-input:focus {
    outline: none;
    border-bottom: 1px solid #333;
}

.button-group {
    margin-top: 15px;
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

button,
.btn-add,
.btn-subtract,
.refresh-btn,
.btn-home {
    background: none;
    border: none;
    color: #333;
    text-decoration: underline;
    cursor: pointer;
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 1em;
    padding: 0;
    white-space: nowrap;
}

button:hover,
.btn-add:hover,
.btn-subtract:hover,
.refresh-btn:hover,
.btn-home:hover {
    color: #000;
}

.events-section {
    margin-top: 40px;
}

.events-title {
    font-size: 1.2em;
    margin-bottom: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #ccc;
    padding-bottom: 10px;
    flex-wrap: wrap;
    gap: 10px;
}

.events-list {
    max-height: none;
}

.event-item {
    padding: 15px 0;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 10px;
}

.event-item:hover {
    background: #fafafa;
}

.event-manual,
.event-recurring {
    border-left: none;
    background: none;
}

.event-details {
    flex: 1;
    min-width: 0;
    overflow-wrap: break-word;
}

.event-time {
    font-size: 0.85em;
    color: #999;
}

.event-note {
    font-size: 1em;
    color: #333;
    margin-top: 3px;
    word-break: break-word;
}

.event-value {
    font-size: 1.1em;
    white-space: nowrap;
}

.event-value.positive {
    color: #333;
}

.event-value.negative {
    color: #333;
}

.loading {
    text-align: center;
    color: #999;
    padding: 20px 0;
    font-style: italic;
}

.btn-delete {
    background: none;
    color: #999;
    text-decoration: underline;
    border: none;
    font-size: 0.85em;
    cursor: pointer;
    padding: 0;
    margin: 0;
    font-family: Georgia, 'Times New Roman', serif;
    white-space: nowrap;
}

.btn-delete:hover {
    color: #333;
}

.error-code {
    font-size: 3em;
    font-weight: normal;
    margin-bottom: 20px;
}

.btn-home {
    display: inline-block;
    margin-top: 20px;
}

@media (min-width: 768px) {
    body {
        padding: 40px 20px;
    }
    
    h1 {
        font-size: 2em;
    }
    
    .total-value {
        font-size: 2.5em;
    }
    
    .error-code {
        font-size: 4em;
    }
}
