:root {
  --bg: #0b0f14;
  --panel: #121822;
  --text: #e8eef6;
  --muted: #a7b0be;
  --accent: #2e86ff;
  --accent-2: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --border: #223045;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif; }

.container { max-width: 1100px; margin: 0 auto; padding: 16px; }

.navbar { background: var(--panel); border-bottom: 1px solid var(--border); }
.nav-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.nav-left, .nav-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.brand { color: var(--text); text-decoration: none; font-weight: 600; margin-right: 8px; }
.badge.beta { background: var(--accent); color: #fff; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; margin-left: 6px; }
.nav-right .note { margin: 0 4px; }

h1, h2, h3 { margin: 12px 0; }

.btn { display: inline-block; padding: 8px 12px; background: var(--accent); color: #fff; text-decoration: none; border: none; border-radius: 6px; cursor: pointer; font-weight: 600; }
.btn:hover { opacity: 0.95; }
.btn-secondary { background: #2d3748; }
.btn-danger { background: var(--danger); }

.table-responsive { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--border); }
.table th, .table td { padding: 10px; border-bottom: 1px solid var(--border); text-align: left; }
.table th { background: #0f1720; position: sticky; top: 0; }
.table th a { color: var(--text); text-decoration: none; }
.table th a:hover { color: var(--accent); }
.sort-indicator { font-size: 12px; margin-left: 4px; }

.actions { display: flex; gap: 8px; align-items: center; }
.actions form { display: inline; margin: 0; }

.badge { padding: 4px 8px; border-radius: 999px; background: #374151; color: #fff; font-size: 12px; }
.badge-success { background: var(--accent-2); }
.badge-danger { background: var(--danger); }

.alert { padding: 10px 12px; border-radius: 8px; margin: 12px 0; border: 1px solid var(--border); }
.alert-danger { background: #3b1f23; border-color: #7f1d1d; }
.alert-warning { background: #3b2b1b; border-color: #92400e; }

.form .grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
.form label { display: flex; flex-direction: column; gap: 6px; background: var(--panel); padding: 10px; border: 1px solid var(--border); border-radius: 8px; }
.form input, .form textarea { padding: 8px; background: #0f1620; color: var(--text); border: 1px solid var(--border); border-radius: 6px; }
.form-actions { margin-top: 12px; display: flex; gap: 8px; }
.form-section { margin-bottom: 20px; padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.form-section:last-of-type { border-bottom: none; padding-bottom: 0; }
.form-section h2 { margin: 0 0 12px; font-size: 16px; color: #cbd5f5; letter-spacing: 0.04em; text-transform: uppercase; }


.tag-input { position: relative; }
.tag-input input { margin-bottom: 6px; }
.tag-suggestions { display: flex; flex-direction: column; gap: 8px; }
.tag-suggestions-group strong { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.tag-chip-row, .tags { display: flex; gap: 6px; flex-wrap: wrap; }
.tag-chip { display: inline-flex; align-items: center; gap: 4px; border-radius: 999px; padding: 4px 10px; font-size: 13px; background: #1c2533; color: var(--text); border: 1px solid var(--border); }
.tag-chip small { color: var(--muted); font-size: 11px; }
.tag-chip.tag-income { border-color: rgba(16, 185, 129, 0.4); color: #d1fae5; background: rgba(16, 185, 129, 0.15); }
.tag-chip.tag-expense { border-color: rgba(46, 134, 255, 0.4); color: #dbeafe; background: rgba(46, 134, 255, 0.15); }
.tag-chip-row button.tag-chip { cursor: pointer; transition: transform 0.1s ease, background 0.1s ease; }
.tag-chip-row button.tag-chip:hover { transform: translateY(-1px); background: var(--accent); color: #fff; border-color: var(--accent); }
.tag-chip-row button.tag-chip:hover small { color: #e0f2fe; }

.kv { list-style: none; padding: 0; margin: 0; }
.kv li { margin: 6px 0; }

.note { color: var(--muted); }

.footer { color: var(--muted); padding-bottom: 24px; }

.detail { gap: 16px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.tag-groups { display: flex; flex-direction: column; gap: 12px; }
.tag-group { display: flex; flex-direction: column; gap: 6px; }
.tag-group strong { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
