/* ==========================================================================
   /import page

   Reuses the shared components from week.css (week-summary, progress,
   week-section-head, quick-add, day, expense, week-empty). Only what is
   specific to the import inbox lives here.
   ========================================================================== */

.import {
    --week-ok: #6096ba;
    --week-warn: #e0a100;
    --week-over: #CD0A0A;
    --week-good: #30AD23;
    --week-ink: #232f3e;
    --week-muted: #777;
    --week-line: #e6e6e6;
    --week-soft: #f6f7f9;
    color: var(--week-ink);
}

.import [hidden] {
    display: none !important;
}

.import section {
    margin-bottom: 1.5rem;
}

.import-other-years {
    margin: -.25rem 0 1rem;
    color: #8a6500;
    font-size: .875rem;
}

.import-other-years a {
    margin-left: .35rem;
    font-weight: 600;
}

.import-other-years a span {
    font-weight: normal;
    color: var(--week-muted);
}

/* A stacked bar that is entirely "ignored" still needs a rounded right edge */
.import .progress__fixed:last-child {
    border-radius: 6px;
}

/* ── Upload ───────────────────────────────────────────────────────────── */

.import-upload {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: .5rem;
    align-items: end;
}

.import-upload input[type="file"] {
    padding: .3rem;
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 4px;
    color: var(--week-muted);
    font-size: .875rem;
}

.import-upload input[type="file"]::file-selector-button {
    margin-right: .75rem;
    padding: .35em .9em;
    background: var(--week-soft);
    border: 1px solid #ccc;
    border-radius: 4px;
    color: var(--week-ink);
    font: inherit;
    cursor: pointer;
}

.import-upload input[type="file"]::file-selector-button:hover {
    background: #e9edf1;
}

.import-upload__tip {
    color: var(--week-muted);
}

/* ── Rows ─────────────────────────────────────────────────────────────── */

/* Rows aren't clickable like week/reserve rows, so don't signal that they are */
.import .expense {
    cursor: default;
}

.import-row .expense__vendor:hover {
    text-decoration: none;
}

.import .expense__actions {
    justify-content: flex-end;
    min-width: 8.5rem;
}

.import-row__date {
    color: var(--week-muted);
    white-space: nowrap;
}

.import-row__create {
    padding: .3em .75em;
    font-size: .8rem;
    white-space: nowrap;
}

.import-inline {
    display: inline;
    margin: 0;
}

/* ── Notes ────────────────────────────────────────────────────────────── */

.import-row__note {
    display: block;
    margin-top: .1rem;
    font-size: .8rem;
    overflow-wrap: anywhere;
}

.import-row__note .fa {
    color: var(--week-warn);
}

.import-note-menu {
    position: relative;
    display: inline-block;
}

.import-note-menu > summary {
    list-style: none;
}

.import-note-menu > summary::-webkit-details-marker {
    display: none;
}

.import-note-menu[open] > summary {
    background: #e6e6e6;
    color: var(--week-ink);
}

.import-note-menu__button--filled {
    color: var(--week-warn);
}

.import-note-menu__form {
    position: absolute;
    top: calc(100% + .25rem);
    right: 0;
    z-index: 20;
    box-sizing: border-box;
    width: min(18rem, 80vw);
    padding: .75rem;
    background: #fff;
    border: 1px solid var(--week-line);
    border-radius: 8px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, .12);
    text-align: left;
}

.import-note-menu__form label {
    display: block;
    margin-bottom: .2rem;
    color: var(--week-muted);
    font-size: .75rem;
    font-weight: 600;
}

.import-note-menu__form textarea {
    display: block;
    width: 100%;
    box-sizing: border-box;
    resize: vertical;
}

.import-note-menu__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    margin-top: .5rem;
    color: var(--week-muted);
    font-size: .75rem;
}

/* ── Suggestions ──────────────────────────────────────────────────────── */

.import-suggestion {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .25rem .6rem;
    padding: .45rem .5rem .45rem 1.1rem;
    background: #fffbe6;
    border-bottom: 1px solid var(--week-line);
    border-left: 3px solid var(--week-warn);
    font-size: .85rem;
}

.import-suggestion > .fa {
    color: var(--week-warn);
}

.import-suggestion--exact {
    background: #eef4f9;
    border-left-color: var(--week-ok);
}

.import-suggestion--exact > .fa {
    color: var(--week-ok);
}

.import-suggestion__text {
    flex: 1;
    min-width: 0;
}

.import-suggestion__text a {
    font-weight: 600;
}

.import-suggestion__meta {
    margin-left: .4rem;
    color: var(--week-muted);
    font-variant-numeric: tabular-nums;
}

.import-suggestion__action {
    padding: .3em .75em;
    font-size: .8rem;
    white-space: nowrap;
}

/* ── Collapsed groups (linked / ignored) ──────────────────────────────── */

.import-fold > details {
    background: #fff;
    border: 1px solid var(--week-line);
    border-radius: 8px;
}

.import-fold > details > summary {
    display: flex;
    justify-content: space-between;
    padding: .8rem 1rem;
    cursor: pointer;
    font-weight: 600;
}

.import-fold__total {
    margin-left: auto;
    padding-left: 1rem;
    font-variant-numeric: tabular-nums;
}

.import-fold .expense-list {
    border-top: 1px solid var(--week-line);
}

.import-fold .expense:last-child {
    border-bottom: 0;
}

/* ── Ignore rules ─────────────────────────────────────────────────────── */

.import-fold__hint {
    margin-left: auto;
    padding-left: 1rem;
    color: var(--week-muted);
    font-size: .8rem;
    font-weight: normal;
}

.import-rules__body {
    padding: 0 1rem 1rem;
    border-top: 1px solid var(--week-line);
}

.import-rules__help {
    margin: .75rem 0;
    color: var(--week-muted);
    font-size: .85rem;
}

.import-rules__label {
    display: block;
    margin-bottom: .2rem;
    color: var(--week-muted);
    font-size: .75rem;
    font-weight: 600;
}

.import-rules__fields {
    display: flex;
    gap: .5rem;
}

.import-rules__fields input {
    flex: 1;
    min-width: 0;
    box-sizing: border-box;
}

.import-rules__list {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
    margin: 1rem 0 0;
    padding: 0;
    list-style: none;
}

.import-rule {
    display: inline-flex;
    align-items: center;
    gap: .2rem;
    padding: .15rem .25rem .15rem .7rem;
    background: #eef1f4;
    border-radius: 999px;
    font-size: .85rem;
}

.import-rule__pattern {
    overflow-wrap: anywhere;
}

.import-rules__empty {
    margin: 1rem 0 0;
    color: var(--week-muted);
    font-size: .875rem;
}

/* ── Small screens ────────────────────────────────────────────────────── */

@media screen and (max-width: 35.5em) {
    .import-upload {
        grid-template-columns: 1fr;
    }

    .import-fold__hint {
        display: none;
    }

    .import-rules__fields {
        flex-direction: column;
    }

    .import-rules__fields .pure-button {
        width: 100%;
        padding: .6em;
    }

    .import-upload .qa-field--submit .pure-button {
        width: 100%;
        padding: .6em;
    }

    /* Icon-only buttons need less room than on desktop */
    .import .expense__actions {
        min-width: 6.5rem;
    }

    /* The create button drops its label */
    .import-row__create {
        font-size: 0;
        padding: .45rem .6rem;
    }

    .import-row__create .fa {
        font-size: .9rem;
    }
}
