/* Top navigation bar */
.topnav {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
    padding: 0.75rem 1.5rem;
    background: var(--pico-card-background-color);
    border-bottom: 1px solid var(--pico-muted-border-color);
    position: sticky;
    top: 0;
    z-index: 10;
}

.topnav .brand {
    font-weight: bold;
    margin-right: 0.5rem;
}

.topnav a {
    text-decoration: none;
    color: var(--pico-color);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    white-space: nowrap;
}

.topnav a:hover {
    background: var(--pico-muted-background-color);
}

/* Sidebar layout */
.app-layout {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 0;
    min-height: calc(100vh - 3.5rem);
}

.sidebar {
    padding: 1rem;
    border-right: 1px solid var(--pico-muted-border-color);
    background: var(--pico-card-background-color);
    position: sticky;
    top: 3.5rem;
    height: calc(100vh - 3.5rem);
    overflow-y: auto;
}

.sidebar-account {
    padding: 0.4rem 0;
    border-bottom: 1px solid var(--pico-muted-border-color);
}

.sidebar-account:last-child {
    border-bottom: none;
}

@media (max-width: 768px) {
    .app-layout {
        grid-template-columns: 1fr;
    }
    .sidebar {
        display: none;
    }
}

.content {
    padding: 2rem;
}

.table-wrap {
    overflow-x: auto;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    align-items: start;
}

@media (max-width: 768px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

.summary-bar {
    display: flex;
    gap: 2rem;
    margin-bottom: 2rem;
    padding: 1rem;
    background: var(--pico-card-background-color);
    border-radius: 8px;
}

.summary-bar .stat {
    text-align: center;
}

.summary-bar .stat div:first-child {
    font-size: 0.85rem;
    color: var(--pico-muted-color);
}

.summary-bar .stat div:last-child {
    font-size: 1.25rem;
    font-weight: bold;
}

.positive { color: #16a34a; }
.negative { color: #dc2626; }

.badge {
    display: inline-block;
    background: #dc2626;
    color: white;
    border-radius: 9999px;
    padding: 0 0.5rem;
    font-size: 0.75rem;
    font-weight: bold;
}

.page-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.page-header h1 {
    margin: 0;
}

.tag-pill {
    display: inline-block;
    color: white;
    border-radius: 9999px;
    padding: 0.1rem 0.6rem;
    font-size: 0.75rem;
    font-weight: 500;
    margin: 0.1rem 0.15rem;
    white-space: nowrap;
}

/* Transaction filter bar */
.filter-bar {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
    align-items: end;
    margin-bottom: 1rem;
}

.filter-bar button {
    align-self: end;
}

@media (max-width: 768px) {
    .filter-bar {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 480px) {
    .filter-bar {
        grid-template-columns: 1fr;
    }
}

/* Multi-tag editor */
.multi-tag-editor {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: wrap;
}

.multi-tag-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.2rem;
    align-items: center;
}

.multi-tag-empty {
    color: var(--pico-muted-color);
    font-size: 0.8rem;
    font-style: italic;
}

.tag-pill-removable {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    padding-right: 0.25rem;
}

.tag-remove {
    all: unset;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: rgba(255,255,255,0.3);
    color: white;
    font-size: 0.65rem;
    line-height: 1;
    font-weight: bold;
}

.tag-remove:hover {
    background: rgba(255,255,255,0.6);
}

.tag-amount {
    font-size: 0.65rem;
    opacity: 0.8;
    margin-left: 0.2rem;
}

.tag-add-form {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin: 0;
}

.tag-add-select {
    margin: 0;
    padding: 0.15rem 0.4rem;
    font-size: 0.75rem;
    width: auto;
    min-width: 7rem;
    height: auto;
    border-radius: 4px;
}

.tag-amount-input {
    margin: 0;
    padding: 0.15rem 0.3rem;
    font-size: 0.75rem;
    width: 4.5rem;
    height: auto;
    border-radius: 4px;
}

/* Budget progress bars */
.budget-bar {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.budget-bar-track {
    height: 8px;
    background: var(--pico-muted-border-color);
    border-radius: 4px;
    overflow: hidden;
}

.budget-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s ease;
}

.budget-ok .budget-bar-fill {
    background: #16a34a;
}

.budget-warning .budget-bar-fill {
    background: #ca8a04;
}

.budget-over .budget-bar-fill {
    background: #dc2626;
}

.budget-bar-label {
    font-size: 0.7rem;
    color: var(--pico-muted-color);
}

.budget-over .budget-bar-label {
    color: #dc2626;
    font-weight: 600;
}

/* Child tag rows */
.child-tag-row td {
    padding-top: 0.2rem;
    padding-bottom: 0.2rem;
    font-size: 0.9em;
    border-bottom: none;
}

/* Bulk action toolbar */
.bulk-toolbar {
    position: sticky;
    top: 3.5rem;
    z-index: 5;
    background: var(--pico-card-background-color);
    border: 1px solid var(--pico-primary);
    border-radius: 8px;
    padding: 0.5rem 1rem;
    margin-bottom: 0.75rem;
}
.bulk-toolbar form {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 0;
    flex-wrap: wrap;
}
.bulk-toolbar select, .bulk-toolbar button {
    margin: 0;
    padding: 0.3rem 0.6rem;
    font-size: 0.85rem;
}
