/* ==========================================================================
   1. GRUNDINSTÄLLNINGAR & TYPOGRAFI
   ========================================================================== */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

html, body {
    overflow-x: hidden;
    width: 100%;
}

body {
    background-color: #f4f7f6;
    color: #333;
    line-height: 1.6;
}

.text-center {
    text-align: center;
    margin-top: 1rem;
}

.text-positive,
.text-negative,
.amount {
    white-space: nowrap;
}

.text-positive {
    color: #27ae60;
}

.text-negative {
    color: #c0392b;
}

.hidden-btn {
    display: none;
}

/* ==========================================================================
   2. LAYOUT & NAVIGATION
   ========================================================================== */

.container {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
}

.filter-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 2rem;
    width: 100%;
}

/* Navbar */
.navbar {
    background-color: #2c3e50;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.nav-brand a {
    color: white;
    text-decoration: none;
    font-size: 1.2rem;
    font-weight: bold;
    letter-spacing: 1px;
}

.nav-links {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.nav-links a {
    color: #ecf0f1;
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    transition: color 0.3s;
}

.nav-links a:hover {
    color: #3498db;
    text-decoration: underline;
}

.menu-toggle { display: none; }
.hamburger {
    display: none;
    color: white;
    font-size: 1.8rem;
    cursor: pointer;
    user-select: none;
}

/* ==========================================================================
   3. KOMPONENTER (Kort, Listor, Meddelanden)
   ========================================================================== */

.result-card, .list-card, .form-container {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.result-card {
    padding: 2rem;
    text-align: center;
    margin-bottom: 2rem;
}

.result-card h3 { margin-bottom: 0.5rem; color: #555; }
.result-card .amount { font-size: 2.5rem; font-weight: bold; }

.list-card {
    padding: 1.5rem;
}

.list-card h4 {
    border-bottom: 2px solid #eee;
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
}

.list-item {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid #f9f9f9;
}

.list-item:last-child { border-bottom: none; }

.empty-state-text {
    text-align: center;
    color: #999;
    margin-top: 2rem;
}

.empty-state-actions {
    text-align: center;
    margin-top: 1rem;
}

.alert {
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 4px;
    font-weight: bold;
}
.alert-success { background-color: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.alert-danger { background-color: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.alert-warning { background-color: #fff3cd; color: #856404; border: 1px solid #ffeeba; }
.alert-info { background-color: #d1ecf1; color: #0c5460; border: 1px solid #bee5eb; }

/* ==========================================================================
   4. FORMULÄR & KNAPPAR
   ========================================================================== */

.form-container {
    padding: 2rem;
    max-width: 400px;
    margin: auto;
}

.form-group { margin-bottom: 1.5rem; }
.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.form-group input,
.form-control,
input[type="text"],
input[type="number"],
input[type="email"],
input[type="password"],
select {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.95rem;
    font-family: inherit;
    background-color: #fff;
    color: #333;
    transition: all 0.2s ease;
}

input:focus,
select:focus,
.form-control:focus {
    outline: none;
    border-color: #5a8baf !important;
    box-shadow: 0 0 5px rgba(90, 139, 175, 0.3) !important;
}

input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
input[type=number] { -moz-appearance: textfield; }

select {
    appearance: none !important;
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23b0a4c0%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
    background-repeat: no-repeat;
    background-position: right 0.7rem top 50%;
    background-size: 0.65rem auto;
    padding-right: 2.5rem !important;
    cursor: pointer;
}

.btn {
    display: inline-block;
    background-color: #5a8baf;
    color: #fff;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    width: 100%;
    text-align: center;
    font-weight: bold;
    text-decoration: none;
    transition: background-color 0.2s ease;
}
.btn:hover { background-color: #477291; }

.btn-secondary {
    display: inline-block;
    background-color: #e0e0e0;
    color: #333;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    width: 100%;
    text-align: center;
    font-weight: bold;
    text-decoration: none;
    transition: background-color 0.2s ease;
}
.btn-secondary:hover { background-color: #d5d5d5; }

.btn-warning {
    display: inline-block;
    background-color: #cd8e54;
    color: #fff;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    width: 100%;
    text-align: center;
    font-weight: bold;
    text-decoration: none;
    transition: background-color 0.2s ease;
}
.btn-warning:hover { background-color: #ad7542; }

.btn-danger {
    display: inline-block;
    background-color: #c26b64;
    color: #fff;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    width: 100%;
    text-align: center;
    font-weight: bold;
    text-decoration: none;
    transition: background-color 0.2s ease;
}
.btn-danger:hover { background-color: #a3554e; }

.btn-slim {
    width: auto !important;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 1.2rem !important;
    font-size: 0.95rem !important;
    margin: 0 !important;
    white-space: nowrap;
}

.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

.form-actions-centered {
    margin-top: 2rem;
    justify-content: center;
}

/* ==========================================================================
   5. UNIFORMA FILTER & KNAPPAR (Huvudsidan & Transaktioner)
   ========================================================================== */
.filter-form {
    display: flex;
    flex-wrap: nowrap;
    justify-content: center;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    max-width: 800px;
}

.filter-uniform {
    flex: 1;
    height: 42px;
    min-width: 120px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 1rem;
    margin: 0;
}

/* ==========================================================================
   6. DASHBOARD & TRANSAKTIONSLISTOR
   ========================================================================== */

.dashboard-header {
    text-align: center;
    margin: 0 auto 2rem auto;
}

.dashboard-header-compact {
    margin-bottom: 0.5rem;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

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

.dashboard-grid-margin {
    margin-bottom: 2rem;
}

.result-card-compact {
    margin-bottom: 0;
}

.variance-text {
    margin-top: 0.75rem;
    font-size: 0.95rem;
    font-weight: 500;
}

.transaction-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding-bottom: 1rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid #eee;
}

.transaction-row:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.transaction-row .t-input {
    flex: 1;
    min-width: 130px;
}

.transaction-row .t-input-wide {
    flex: 2;
    min-width: 150px;
}

.t-amount-wrap {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
}

.t-amount {
    width: 100px !important;
    text-align: right;
}

.currency-label {
    color: #888;
}

/* Kommentarer (Dashboard) */
.comment-card {
    margin-bottom: 2rem;
    cursor: pointer;
}

.comment-summary {
    font-weight: bold;
    font-size: 1.1rem;
    outline: none;
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

details > summary::-webkit-details-marker {
    display: none;
}

.comment-hint {
    font-size: 0.8rem;
    font-weight: normal;
    color: #888;
}

.comment-content {
    margin-top: 1rem;
    cursor: default;
}

.comment-textarea {
    width: 100%;
    resize: vertical;
    padding: 0.75rem;
    border-radius: 6px;
    box-sizing: border-box;
}

.comment-actions {
    text-align: right;
    margin-top: 0.75rem;
}

.list-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #ddd;
}

.flex-2 { flex: 2; }
.flex-1 { flex: 1; }
.text-right { text-align: right; }
.font-500 { font-weight: 500; }
.font-bold { font-weight: bold; }
.flex-between-center { display: flex; justify-content: space-between; align-items: center; }

.empty-state-text-small {
    color: #999;
    font-style: italic;
    margin-top: 1rem;
}

/* ==========================================================================
   7. KATEGORIER (categories/manage.html)
   ========================================================================== */

.category-add-card {
    margin-bottom: 2rem;
}

.category-add-header {
    margin-bottom: 1.5rem;
}

.category-add-form {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: flex-end;
}

.category-add-name {
    flex: 2;
    min-width: 200px;
}

.category-add-type {
    flex: 1;
    min-width: 120px;
}

.category-add-action {
    margin-bottom: 2px;
}

.font-600 {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.list-section-header {
    margin-bottom: 1rem;
}

.category-list-header {
    display: flex;
    gap: 0.5rem;
    font-weight: bold;
    font-size: 0.85rem;
    margin-bottom: 1rem;
    padding: 0 0.5rem;
}

.col-spacer { width: 30px; }
.col-name { flex: 2; min-width: 140px; }
.col-type { flex: 1; min-width: 90px; }
.col-action { width: 80px; text-align: center; }

.sortable-list-margin {
    margin-bottom: 1rem;
}

.category-row {
    margin-bottom: 0.75rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    cursor: grab;
}

.inactive-item {
    opacity: 0.4;
}

.drag-handle {
    color: #888;
    font-size: 1.2rem;
    user-select: none;
    width: 30px;
}

.drag-item:active {
    cursor: grabbing !important;
}

.btn-tiny {
    padding: 0.3rem 0.6rem;
    font-size: 0.8rem;
}

/* Ny wrapper för att hålla ordning på drag-handtaget vs inmatning */
.category-inputs-wrapper {
    display: flex;
    flex: 1; /* Ta upp resten av utrymmet på raden */
    gap: 0.5rem;
    align-items: center;
}

/* ==========================================================================
   8. BUDGET (budget/manage.html)
   ========================================================================== */
.page-subtitle {
    text-align: center;
    color: #666;
    margin-bottom: 2rem;
}

.budget-alert {
    text-align: center;
    max-width: 600px;
    margin: 0 auto 2rem auto;
}

.budget-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.budget-label {
    margin: 0;
    min-width: 120px;
    font-weight: 600;
}

.budget-input-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    justify-content: flex-end;
}

.budget-input {
    margin: 0;
    width: 100%;
    max-width: 200px;
    text-align: right;
}

/* ==========================================================================
   9. PROJEKT (projects/index.html)
   ========================================================================== */

.project-header-wrapper {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    margin-bottom: 1rem;
}

.project-header-title {
    margin: 0;
}

.project-toggle-label {
    cursor: pointer;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    justify-self: end;
}

.project-toggle-checkbox {
    width: auto !important;
}

.project-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.project-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 500;
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.project-status {
    font-size: 0.8rem;
    font-weight: normal;
    margin-left: 0.5rem;
}

.project-status-inactive {
    font-size: 0.8rem;
    font-weight: normal;
    margin-left: 0.5rem;
    color: #888;
}

.project-categories {
    padding-left: 1rem;
    border-left: 2px solid rgba(128, 128, 128, 0.2);
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.project-category-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.95rem;
    color: #aaa;
}

.empty-state-text-italic {
    text-align: center;
    color: #888;
    font-style: italic;
}

/* ==========================================================================
   10. MIN PROFIL (profile/index.html)
   ========================================================================== */

.profile-section-title {
    margin-bottom: 1.5rem;
}

.profile-desc {
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.profile-form-actions {
    margin-top: 2rem;
}

.profile-danger-zone {
    margin-top: 2rem;
}

.profile-divider {
    margin: 2rem 0;
    border: 0;
    border-top: 1px solid #eee;
}

/* MFA-Sektionen */
.mfa-status {
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.mfa-status-icon {
    font-size: 1.2rem;
}

.mfa-qr-wrapper {
    text-align: center;
    margin-bottom: 1.5rem;
}

.mfa-qr-box {
    background-color: white;
    padding: 1rem;
    border-radius: 8px;
    display: inline-block;
}

.mfa-qr-img {
    max-width: 200px;
    height: auto;
    display: block;
}

.mfa-form {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
}

.mfa-input-group {
    flex: 2;
    margin-bottom: 0;
}

.mfa-action-group {
    flex: 1;
}

.mfa-code-input {
    letter-spacing: 2px;
    font-weight: bold;
    text-align: center;
}

/* Hantera konto-knappar */
.account-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.account-actions form {
    flex: 1;
    min-width: 250px;
}

/* ==========================================================================
   11. ALLA MOBILANPASSNINGAR (@media max-width: 768px)
   ========================================================================== */
@media (max-width: 768px) {
    /* Navbar */
    .navbar { padding: 1rem; flex-wrap: wrap; }
    .hamburger { display: block; }
    .nav-links {
        display: none;
        flex-direction: column;
        width: 100%;
        gap: 1rem;
        margin-top: 1rem;
        padding-top: 1rem;
        border-top: 1px solid #34495e;
    }
    .menu-toggle:checked ~ .nav-links { display: flex; }
    .nav-links a { display: block; width: 100%; text-align: center; padding: 0.5rem 0; }

    .container { padding-bottom: 5rem; }

    /* Uniforma Filter */
    .filter-form {
        flex-direction: column;
        flex-wrap: nowrap;
        width: 100%;
        max-width: 100%;
    }
    .filter-uniform {
        width: 100% !important;
        max-width: 100%;
        margin-bottom: 0.5rem;
    }

    /* List Item Generisk */
    .list-item { flex-wrap: wrap; gap: 0.5rem; }

    /* Transaktionsrader */
    .transaction-row {
        flex-direction: column;
        align-items: stretch;
        background: rgba(0, 0, 0, 0.02);
        padding: 1rem;
        border-radius: 8px;
        border-bottom: none;
        margin-bottom: 1.5rem;
    }
    .transaction-row .t-input,
    .transaction-row .t-input-wide,
    .t-amount-wrap,
    .t-amount,
    .transaction-row .t-btn {
        width: 100% !important;
        margin-bottom: 0.5rem;
    }
    .t-amount { text-align: left !important; }

    /* Kategorier: Skapa ny */
    .category-add-form {
        flex-direction: column;
        align-items: stretch;
    }
    .category-add-name,
    .category-add-type,
    .category-add-action {
        width: 100% !important;
        min-width: 100% !important;
        margin-bottom: 0.5rem;
    }
    .category-add-action .btn { margin-top: 0.5rem; }

    /* Kategorier: Listor */
    .category-list-header { display: none; }

    .category-row {
        background: rgba(0, 0, 0, 0.02);
        padding: 0.75rem;
        border-radius: 6px;
        align-items: flex-start;
        position: relative;
        display: flex;
        flex-direction: row;
        gap: 0.5rem;
    }

    .category-inputs-wrapper {
        display: flex;
        flex-direction: column;
        width: 100%;
    }

    .category-inputs-wrapper .col-name,
    .category-inputs-wrapper .col-type,
    .category-inputs-wrapper .col-action {
        width: 100% !important;
        min-width: 100% !important;
        margin-bottom: 0.5rem;
        text-align: left;
    }

    .category-inputs-wrapper .col-action .btn-tiny {
        width: 100%;
        padding: 0.75rem;
        font-size: 1rem;
    }

    .drag-handle {
        width: auto;
        text-align: left;
        margin-bottom: 0;
        padding-bottom: 0;
        border-bottom: none;
        transform: none;
        padding-top: 0.5rem;
    }

    /* Budget */
    .budget-input { max-width: 100%; }

    /* Projekt */
    .project-header-wrapper {
        grid-template-columns: 1fr;
        gap: 1rem;
        text-align: center;
    }
    .project-toggle-label { justify-self: center !important; }

    /* Profil */
    .mfa-form { flex-direction: column; align-items: stretch; }
    .mfa-input-group, .mfa-action-group { width: 100%; }
    .account-actions { flex-direction: column; }
    .account-actions form { min-width: 100%; }
}

/* ==========================================================================
   12. DARK MODE (Deep Midnight Plum Theme)
   ========================================================================== */

body.dark-mode {
    background-color: #0a060f;
    color: #dcdcdc;
}

body.dark-mode .list-card,
body.dark-mode .form-container,
body.dark-mode .result-card,
body.dark-mode .kpi-card {
    background-color: #120a1a !important;
    border: 1px solid #281a3b !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.6);
}

body.dark-mode .navbar {
    background-color: #0d0714;
    border-bottom: 1px solid #281a3b;
}

body.dark-mode .nav-links a { color: #a095ad; }
body.dark-mode .nav-links a:hover { color: #b5a3cc; }

body.dark-mode h1,
body.dark-mode h2,
body.dark-mode h3,
body.dark-mode h4,
body.dark-mode label,
body.dark-mode .budget-label {
    color: #e2dbea !important;
}

body.dark-mode input[type="text"],
body.dark-mode input[type="number"],
body.dark-mode input[type="email"],
body.dark-mode input[type="password"],
body.dark-mode select,
body.dark-mode select option,
body.dark-mode .form-control {
    background-color: #170d22 !important;
    color: #f5f5f5 !important;
    border: 1px solid #362452 !important;
}

body.dark-mode select { color-scheme: dark; }
body.dark-mode input[type="checkbox"] { accent-color: #53367d !important; }

body.dark-mode select:focus,
body.dark-mode input:focus {
    border-color: #6a479e !important;
    box-shadow: 0 0 6px rgba(106, 71, 158, 0.4) !important;
    outline: none;
}

body.dark-mode input:disabled {
    background-color: #100917 !important;
    color: #5c5266 !important;
    border-color: #20142e !important;
}

body.dark-mode .btn {
    background-color: #382459 !important;
    color: #dfd5ed !important;
    border: 1px solid #4a3075 !important;
}
body.dark-mode .btn:hover {
    background-color: #4a3075 !important;
    border-color: #5d3d91 !important;
}

body.dark-mode .btn-secondary,
body.dark-mode a.btn-secondary {
    background-color: #160e21 !important;
    color: #847596 !important;
    border: 1px solid #2d1e40 !important;
}
body.dark-mode .btn-secondary:hover,
body.dark-mode a.btn-secondary:hover {
    background-color: #1f132e !important;
    color: #9d8db3 !important;
}

/* Lila Varningsknappar (Både Danger och Warning) & Logga Ut */
body.dark-mode .btn-danger,
body.dark-mode .btn-warning,
body.dark-mode button[name="action"][value^="delete_"],
body.dark-mode .nav-links a[href*="logout"] {
    background-color: #1a0f26 !important;
    color: #9d8db3 !important;
    border: 1px solid #362452 !important;
}

body.dark-mode .btn-danger:hover,
body.dark-mode .btn-warning:hover,
body.dark-mode button[name="action"][value^="delete_"]:hover,
body.dark-mode .nav-links a[href*="logout"]:hover {
    background-color: #241633 !important;
    color: #c9badd !important;
    border-color: #4a3075 !important;
}

body.dark-mode .navbar a[href*="logout"] {
    background-color: transparent !important;
    border: none !important;
    padding: 0 !important;
    color: #a095ad !important;
}

body.dark-mode .alert { border: 1px solid transparent !important; }
body.dark-mode .alert-success { background-color: #0f1d15 !important; color: #7dcea0 !important; border-color: #234833 !important; }
body.dark-mode .alert-danger { background-color: #1d0f11 !important; color: #e74c3c !important; border-color: #4a1d21 !important; }
body.dark-mode .alert-warning { background-color: #1d190f !important; color: #f1c40f !important; border-color: #483d1c !important; }
body.dark-mode .alert-info { background-color: #0f1821 !important; color: #5dade2 !important; border-color: #1d3345 !important; }

body.dark-mode hr { border-top: 1px solid #281a3b !important; }
body.dark-mode div[style*="border-bottom: 1px solid #eee;"] { border-bottom-color: #281a3b !important; }
body.dark-mode .list-header { border-bottom-color: #281a3b; color: #a095ad; }
body.dark-mode .text-positive { color: #ffffff !important; font-weight: 600; }
body.dark-mode .text-negative { color: #7b718a !important; }
body.dark-mode .sortable-ghost { background-color: #1c1129 !important; opacity: 0.7; }

/* Dark mode overrides för specifika rader */
body.dark-mode .transaction-row { border-bottom-color: #281a3b; }
body.dark-mode .profile-divider { border-top-color: #281a3b; }
body.dark-mode .page-subtitle { color: #a095ad; }

/* Dark mode för mobil vyer */
@media (max-width: 768px) {
    body.dark-mode .transaction-row { background: rgba(255, 255, 255, 0.02); }
    body.dark-mode .category-row { background: rgba(255, 255, 255, 0.02); }
    body.dark-mode .drag-handle { border-bottom-color: rgba(255,255,255,0.1); }
}

/* ==========================================================================
   13. LOGOTYP & NAVIGERING (CLEEDLE LOGO)
   ========================================================================== */

:root {
    --logo-ink: #0E7C86;
}

body.dark-mode {
    --logo-ink: #17a2b8;
}

.logo-link {
    text-decoration: none;
    display: inline-block;
}

.logo-wrap {
    position: relative;
    display: inline-block;
    line-height: 1;
}

.logo-tail {
    position: relative;
    z-index: 2;
    font-family: 'Fredoka', sans-serif;
    font-weight: 700;
    font-size: 28px;
    line-height: 1;
    color: var(--logo-ink);
    white-space: nowrap;
    -webkit-font-smoothing: antialiased;
    transition: color 0.3s ease;
}

.logo-mark {
    position: absolute;
    inset: 0;
    z-index: 1;
    overflow: visible;
    pointer-events: none;
}

.btn-login {
    background-color: #2e7d32;
    color: white !important;
    padding: 0.5rem 1.5rem;
    border-radius: 6px;
    font-weight: bold;
    text-decoration: none;
}

.btn-login:hover {
    background-color: #1b5e20;
}

.nav-logout {
    color: #e74c3c !important;
}

/* ==========================================================================
   14. GLOBAL BEKRÄFTELSE-MODAL
   ========================================================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(3px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-box {
    width: 100%;
    max-width: 400px;
    margin: 1rem;
    transform: translateY(-20px);
    transition: transform 0.2s ease;
}

.modal-overlay.active .modal-box {
    transform: translateY(0);
}

.modal-title {
    margin-top: 0;
    margin-bottom: 0.5rem;
}

.modal-message-text {
    color: #555;
    margin-bottom: 2rem;
    line-height: 1.5;
}

body.dark-mode .modal-message-text {
    color: #bbb;
}

.modal-actions {
    display: flex;
    gap: 1rem;
    margin-top: 0;
}

.modal-btn {
    flex: 1;
    margin: 0;
    text-align: center;
}

.inactive-project {
    display: none;
    opacity: 0.5;
    transition: opacity 0.3s ease;
}
.inactive-project:hover {
    opacity: 0.8;
}

/* Nytt för MFA manuell setup */
.mfa-manual-setup {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: rgba(0,0,0,0.03);
    border-radius: 6px;
}

body.dark-mode .mfa-manual-setup {
    background: rgba(255,255,255,0.05);
}

.mfa-secret-code {
    font-family: 'Courier New', Courier, monospace;
    font-weight: bold;
    word-break: break-all;
    background: #fff;
    padding: 0.5rem;
    border: 1px dashed #ccc;
    margin: 0.5rem 0;
    color: #333 !important;
}

body.dark-mode .mfa-secret-code {
    background: #120a1a;
    border-color: #362452;
    color: #e2dbea !important;
}

.mfa-hint {
    font-size: 0.85rem;
    color: #666;
}

body.dark-mode .mfa-hint {
    color: #a095ad !important;
}

/* ==========================================================================
   15. SWITCHKNAPP FÖR MÅNAD/YTD & FILTERRAD (DESKTOP)
   ========================================================================== */

/* Grundinställning (Ljust läge) - Matchar dina inputs och .btn */
.toggle-container {
    display: inline-flex;
    align-items: center;
    background-color: #fff;
    padding: 4px;
    border-radius: 6px;
    border: 1px solid #ccc;
    width: auto;
    flex-shrink: 0;
}

.toggle-label {
    cursor: pointer;
    margin: 0;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.toggle-label input[type="radio"] {
    display: none;
}

.toggle-label span {
    display: inline-block;
    padding: 6px 16px;
    border-radius: 4px;
    font-weight: bold;
    font-size: 0.95rem;
    color: #555;
    white-space: nowrap;
    transition: background-color 0.2s ease, color 0.2s ease;
}

/* När knappen är vald (Ljust läge) */
.toggle-label input[type="radio"]:checked + span {
    background-color: #5a8baf;
    color: #ffffff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* --- DARK MODE OVERRIDES (Deep Midnight Plum) --- */
body.dark-mode .toggle-container {
    background-color: #170d22;
    border-color: #362452;
}

body.dark-mode .toggle-label span {
    color: #a095ad;
}

body.dark-mode .toggle-label input[type="radio"]:checked + span {
    background-color: #382459;
    color: #dfd5ed;
    border: 1px solid #4a3075;
    box-shadow: 0 2px 4px rgba(0,0,0,0.4);
}

/* Ersätter inline styles för budgetraden i result-card */
.budget-subtext {
    font-size: 1.05em;
    margin-top: 8px;
    margin-bottom: 2px;
}

/* Ersätter inline styles för kommentar-summary */
.comment-summary {
    gap: 1rem;
}

.comment-title {
    line-height: 1.3;
}

.comment-hint {
    white-space: nowrap;
}

/* Ersätter inline styles för långa kategorinamn i list-item */
.text-truncate {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-right: 0.5rem;
}

/* Se till att filterområdet har samma fulla bredd som resultat-sektionen under */
.filter-wrapper {
    width: 100%;
    margin-bottom: 1.5rem;
}

/* Desktop: Tvinga formuläret att nyttja 100% av bredden med elementen på en rad */
.filter-form {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: none !important;
    gap: 12px;
}

/* Vänstra sidan: Alla rullgardinsmenyer och knappar på en rad */
.filter-controls-left {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

/* Högra sidan: Åtgärdsknappen längst ut till höger */
.filter-controls-right {
    display: flex;
    align-items: center;
    margin-left: auto;
}

/* Förhindrar att "Ny Transaktion"-knappen sträcks ut till 100 % bredd på PC */
.filter-controls-right .btn {
    width: auto !important;
    white-space: nowrap;
}

/* Kompakta dropdowns som inte tar onödig plats på PC */
.filter-select-compact {
    width: auto;
    min-width: 100px;
    padding: 8px 12px;
    cursor: pointer;
}

/* ==========================================================================
   16. MOBILANPASSNING FÖR FILTERRADEN PÅ STARTSIDAN (<= 768px)
   ========================================================================== */
@media (max-width: 768px) {
    .filter-form {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .filter-controls-left {
        display: flex;
        flex-wrap: wrap;
        gap: 10px;
        width: 100%;
    }

    /* Rad 1: År och Månad delar 50/50 på bredden */
    .filter-controls-left .filter-select-compact {
        flex: 1 1 calc(50% - 10px);
        width: auto;
        min-width: 0;
    }

    /* Rad 2 & 3: Varje växel-grupp tar upp 100% av raden */
    .filter-controls-left .toggle-container {
        flex: 1 1 100%;
        width: 100% !important;
        display: flex;
    }

    /* De två valen inuti varje växel delar 50/50 på utrymmet */
    .filter-controls-left .toggle-label {
        flex: 1;
        padding: 0;
    }

    .filter-controls-left .toggle-label span {
        width: 100%;
        text-align: center;
    }

    /* Rad 4: "Ny Transaktion" fyller hela bredden längst ner */
    .filter-controls-right {
        width: 100%;
        margin-left: 0;
    }

    .filter-controls-right .btn {
        width: 100% !important;
        text-align: center;
    }
}