* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: #e0e0e0;
    background: #121212;
    padding: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

/* Navigation */
nav {
    display: flex;
    align-items: stretch;
    margin-bottom: 2rem;
    border-bottom: 1px solid #333;
}

.nav-links {
    display: flex;
    align-items: center;
    padding: 0.75rem 0;
}

nav a {
    color: #e0e0e0;
    text-decoration: none;
    margin-right: 1.5rem;
    font-weight: 500;
}

nav a:hover {
    color: #fff;
}

.instance-name {
    display: flex;
    align-items: center;
    background: #2d4a3e;
    color: #4ade80;
    font-weight: 600;
    font-size: 0.85rem;
    padding: 0.75rem 1.25rem;
    margin-right: 1.5rem;
    cursor: default;
    position: relative;
    overflow: hidden;
}

.instance-name::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at var(--mouse-x, 50%) var(--mouse-y, 50%), rgba(74, 222, 128, 0.4) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none;
}

.instance-name:hover::before {
    opacity: 1;
}

/* Typography */
h1 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: #fff;
}

h2 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: #ccc;
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 2rem;
    background: #1e1e1e;
}

th, td {
    text-align: left;
    padding: 0.6rem 0.8rem;
    border-bottom: 1px solid #2a2a2a;
}

th {
    font-weight: 500;
    color: #888;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

tr:hover {
    background: #252525;
}

/* Amounts */
.amount {
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.amount-out {
    color: #f87171;
}

.amount-in {
    color: #4ade80;
}

/* Layout */
.grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

@media (max-width: 800px) {
    .grid {
        grid-template-columns: 1fr;
    }
}

.section {
    background: #1e1e1e;
    padding: 1.5rem;
    border-radius: 4px;
}

.total-row {
    font-weight: 600;
    border-top: 2px solid #333;
}

/* Forms */
form {
    margin-bottom: 1.5rem;
}

input, select, button {
    font-family: inherit;
    font-size: inherit;
    padding: 0.5rem 0.75rem;
    border: 1px solid #444;
    border-radius: 3px;
    background: #2a2a2a;
    color: #e0e0e0;
}

input:focus, select:focus {
    outline: none;
    border-color: #666;
}

input::placeholder {
    color: #666;
}

button {
    background: #3a3a3a;
    color: #fff;
    border: 1px solid #444;
    cursor: pointer;
    font-weight: 500;
}

button:hover {
    background: #4a4a4a;
}

.btn-delete {
    background: transparent;
    color: #666;
    padding: 0.25rem 0.5rem;
    font-size: 0.85rem;
    border: none;
}

.btn-delete:hover {
    color: #f87171;
    background: transparent;
}

/* Components */
.label {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    background: #333;
    border-radius: 3px;
    font-size: 0.85rem;
    color: #ccc;
}

.description {
    font-family: "SF Mono", Consolas, monospace;
    font-size: 0.85rem;
}

.muted {
    color: #666;
}

.inline-form {
    display: inline;
}

.filter-form {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.filter-form label {
    color: #888;
    font-size: 0.85rem;
}

/* Links */
a {
    color: #e0e0e0;
    text-decoration: none;
}

a:hover {
    color: #fff;
    text-decoration: underline;
}

.cat-link {
    color: #888;
}

.cat-link:hover {
    color: #fff;
}

/* Utilities */
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

/* Compact inline forms (for row-level actions) */
.compact-form {
    display: flex;
    gap: 0.25rem;
    align-items: center;
    margin: 0;
}

.compact-form select {
    font-size: 0.75rem;
    padding: 0.2rem 0.4rem;
    width: 110px;
}

.compact-form button {
    font-size: 0.75rem;
    padding: 0.2rem 0.5rem;
}

/* Clickable labels */
.label.clickable {
    cursor: pointer;
}

.label.clickable:hover {
    background: #444;
}

/* Manual override indicator */
.label.manual {
    border-left: 3px solid #4ade80;
    padding-left: 0.4rem;
}

/* Inline category select */
.category-cell {
    position: relative;
}

.category-select-form {
    position: absolute;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.category-select-form select {
    font-size: 0.85rem;
    padding: 0.15rem 0.4rem;
}

.cancel-btn {
    cursor: pointer;
    color: #666;
    font-size: 1rem;
    line-height: 1;
    padding: 0 0.25rem;
}

.cancel-btn:hover {
    color: #f87171;
}

/* Highlight row */
tr.highlight {
    background: #2a2a2a;
}
tr.highlight td {
    font-weight: 600;
}
