:root {
    --primary: #91B082;
    --primary-dark: #5d7058;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --bg: #f0f2f5;
    /* Soft lavender-grey background */
    --surface: #fafbfc;
    /* Dim white card surface */
    --text: #111827;
    --text-secondary: #6b7280;
    --border: #e5e7eb;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --radius: 16px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    scrollbar-gutter: stable;
}

.container {
    max-width: 1500px;
    margin: 0 auto;
    padding: 1.5rem;
}

header {
    background: #91B082;
    /* Sage Green (User Requested) */
    box-shadow: var(--shadow);
    padding: 1.5rem;
    margin: -1.5rem -1.5rem 2rem;
    border-radius: 0 0 var(--radius) var(--radius);
}

header h1,
.header-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: black;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    line-height: 1.2;
}

.nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    gap: 1rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.nav-link {
    padding: 0.5rem 1rem;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 8px;
    text-decoration: none;
    color: white;
    font-weight: 500;
    transition: all 0.2s;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border-color: transparent;
}

.nav-link.active {
    background: #5d7058;
    color: white;
    border-color: transparent;
    font-weight: 700;
}

.btn-nav {
    padding: 0.5rem 1rem;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 8px;
    color: white;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    font-size: 14px;
}

.btn-nav:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.btn-reset {
    padding: 0.5rem 1rem;
    background: var(--danger);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    font-size: 14px;
    box-shadow: none;
    /* Override default button shadow */
}

.btn-reset:hover {
    background: #dc2626;
    /* Darker red */
}

.card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

.btn-secondary {
    background: white;
    color: var(--text);
    border: 1px solid var(--border);
    box-shadow: none;
}

.btn-secondary:hover {
    background: #f9fafb;
    transform: none;
    box-shadow: none;
}

.btn-warning {
    background: var(--warning);
    color: white;
}

.btn-warning:hover {
    background: #d97706;
}

/* Standardized Modal Button Classes */
.btn-modal-primary {
    background: var(--primary) !important;
    color: white !important;
    border: none !important;
    padding: 0.75rem 1.5rem !important;
    font-weight: 600 !important;
    border-radius: 8px !important;
    cursor: pointer !important;
    transition: all 0.2s !important;
    box-shadow: var(--shadow) !important;
}

.btn-modal-primary:hover {
    background: var(--primary-dark) !important;
    transform: translateY(-1px) !important;
    box-shadow: var(--shadow-lg) !important;
}

.btn-modal-secondary {
    background: white !important;
    color: var(--text-secondary) !important;
    border: 1px solid var(--border) !important;
    padding: 0.75rem 1.5rem !important;
    font-weight: 600 !important;
    border-radius: 8px !important;
    cursor: pointer !important;
    transition: all 0.2s !important;
}

.btn-modal-secondary:hover {
    background: var(--bg) !important;
    color: var(--text) !important;
    border-color: var(--text-secondary) !important;
}

.btn-modal-danger {
    background: var(--danger) !important;
    color: white !important;
    border: none !important;
    padding: 0.75rem 1.5rem !important;
    font-weight: 600 !important;
    border-radius: 8px !important;
    cursor: pointer !important;
    transition: all 0.2s !important;
    box-shadow: var(--shadow) !important;
}

.btn-modal-danger:hover {
    background: #dc2626 !important;
    transform: translateY(-1px) !important;
    box-shadow: var(--shadow-lg) !important;
}

button {
    background: #91B082;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: var(--shadow);
}

button:hover {
    background: #5d7058;
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

/* Calendar Navigation Specifics */
.timeframe-container {
    background: #91B082;
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 1rem;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 1rem;
}

@media screen and (max-width: 1024px) {
    .timeframe-container {
        display: flex;
        flex-direction: column;
        gap: 1rem;
    }
}

.current-period {
    font-size: 1.1rem;
    font-weight: 700;
    min-width: 180px;
    text-align: center;
    color: white;
}

.timeframe-nav {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.nav-arrow,
.btn-today {
    background: rgba(0, 0, 0, 0.1);
    color: white;
    border: 1px solid transparent;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.timeframe-btn {
    background: transparent;
    color: white;
    border: 1px solid transparent;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-arrow {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
}

.nav-arrow:hover,
.btn-today:hover,
.timeframe-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.timeframe-btn.active {
    background: #5d7058;
    color: white;
    font-weight: 700;
}

.btn-toggle-group {
    display: flex;
    background: rgba(0, 0, 0, 0.1);
    padding: 0.25rem;
    border-radius: 0.75rem;
}

button:active {
    transform: translateY(0);
}

button:disabled {
    background: var(--border);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

button.secondary {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
}

button.secondary:hover {
    background: var(--bg);
}

button.success {
    background: var(--success);
}

button.danger {
    background: var(--danger);
}

input,
select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border);
    border-radius: 12px;
    font-size: 1rem;
    transition: all 0.2s;
    background: white;
}

input:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.alert {
    padding: 1rem 1.25rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 500;
}

.alert-success {
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #6ee7b7;
}

.alert-error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

footer {
    margin-top: 3rem;
    padding: 2rem;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.875rem;
    border-top: 1px solid var(--border);
}

/* Common Table Styles */
.table-container {
    background: var(--surface);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    background: var(--bg);
    padding: 1rem;
    text-align: left;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border);
}

td {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background: rgba(99, 102, 241, 0.02);
}

/* Responsive Design */
@media screen and (max-width: 768px) {
    .container {
        padding: 1rem;
    }

    .card {
        padding: 1.5rem;
    }
}

@media screen and (max-width: 640px) {
    .nav {
        gap: 0.5rem;
    }

    .nav-link {
        padding: 0.4rem 0.75rem;
        font-size: 0.8125rem;
    }
}

/* Transaction Parsing Layout & Styles */
.txn-row-top {
    display: flex;
    align-items: center;
    gap: 1rem;
    width: 100%;
    flex-wrap: nowrap;
    /* Prevent wrapping to keep inline */
    overflow: hidden;
}

.txn-edit-input {
    background: white;
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.25rem 0.5rem;
    font-size: inherit;
    font-family: inherit;
    color: inherit;
    flex: 1;
    width: auto;
    min-width: 0;
}

.txn-edit-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(145, 176, 130, 0.2);
}

.amount-input {
    flex: 0 0 100px;
    text-align: right;
}

.date-input {
    flex: 0 0 130px;
    /* Fixed width for date input */
}

.txn-row-bottom {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.5rem;
    flex-wrap: nowrap;
    /* Force single line */
    font-size: 0.875rem;
    color: var(--text-secondary);
    width: 100%;
}

/* Make dropdowns share space evenly */
.txn-row-bottom select {
    flex: 1;
    min-width: 0;
    /* Allow shrinking below content size if needed */
    width: auto;
}

/* Ensure labels don't wrap */
.txn-row-bottom .sd-label {
    white-space: nowrap;
    flex-shrink: 0;
}

.balance-amount {
    font-weight: 700;
    font-size: 1rem;
}

.balance-amount.positive {
    color: var(--success);
}

.balance-amount.negative {
    color: var(--danger);
}

.txn-amount {
    font-weight: 700;
    font-size: 1.125rem;
    white-space: nowrap;
}

.txn-amount.positive {
    color: var(--success);
}

.txn-amount.negative {
    color: var(--danger);
}

.txn-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.sd-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.sd-select {
    padding: 0.375rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 0.375rem;
    font-size: 0.875rem;
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    transition: border-color 0.2s;
    min-width: 180px;
}

.sd-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}


.category-select {
    padding: 0.375rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 0.375rem;
    font-size: 0.875rem;
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    transition: border-color 0.2s;
}

.category-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.category-select:hover {
    border-color: var(--primary);
}

.category-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-right: 0.5rem;
}

.category-groceries {
    background: #dcfce7;
    color: #166534;
}

.category-transport {
    background: #dbeafe;
    color: #1e40af;
}

.category-entertainment {
    background: #fce7f3;
    color: #9f1239;
}

.category-salary {
    background: #d1fae5;
    color: #065f46;
}

.category-transfer {
    background: #e0e7ff;
    color: #3730a3;
}

.category-rent {
    background: #fef3c7;
    color: #92400e;
}

.duplicate-badge {
    background: var(--danger);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    display: inline-flex;
    align-items: center;
    width: fit-content;
    white-space: nowrap;
}

.possible-duplicate-badge {
    background: var(--warning);
    color: #78350f;
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    border: 1px solid #fbbf24;
    display: inline-flex;
    align-items: center;
    width: fit-content;
    white-space: nowrap;
}

/* Import UI Consolidation Styles */
.account-selector {
    background: linear-gradient(135deg, #91B082 0%, #5d7058 100%);
    padding: 1.25rem 1.5rem;
    border-radius: 1rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.account-selector .field-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
    min-width: 300px;
}

.account-selector label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    color: white;
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
    margin-bottom: 0;
}

.account-selector select {
    flex: 1;
    max-width: 400px;
    padding: 0.625rem 1rem;
    border: none;
    border-radius: 0.5rem;
    font-size: 0.9375rem;
    background: rgba(255, 255, 255, 0.95);
    color: var(--text);
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    font-weight: 500;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%234b5563'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1rem;
}

.account-selector select:hover {
    background-color: white;
}

.import-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.file-input-wrapper {
    position: relative;
    display: inline-block;
    cursor: pointer;
}

#file {
    display: none;
}

.file-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 0.5rem;
    color: white;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
}

.file-label:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.6);
}

.file-label.has-file {
    background: #ffffff;
    color: #5d7058;
    border-color: #ffffff;
}

.file-icon {
    font-size: 1rem;
}

#parse {
    background: white;
    color: #5d7058;
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 700;
    border-radius: 0.5rem;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    white-space: nowrap;
}

#parse:hover:not(:disabled) {
    background: #91B082;
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

#parse:disabled {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.5);
    cursor: not-allowed;
    box-shadow: none;
}

/* --- Transaction List Grid (view.html) --- */
.transactions-list {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.transaction-header {
    display: grid;
    grid-template-columns: 7% 12% 7% 8% 20% 8% 12% 7% 8% 4%;
    align-items: center;
    column-gap: 0.45rem;
    padding: 0.85rem 0.75rem;
    background: var(--primary);
    border-bottom: none;
    font-weight: 700;
    font-size: 0.75rem;
    color: black;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    word-break: break-word;
    white-space: normal;
    border-radius: 8px 8px 0 0;
}

.transaction-header>div {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    width: 100%;
    height: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.transaction-item {
    display: grid;
    grid-template-columns: 7% 12% 7% 8% 20% 8% 12% 7% 8% 4%;
    align-items: center;
    column-gap: 0.45rem;
    padding: 0.75rem 0.75rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    transition: all 0.2s;
    background: #f0f7f6;
}

.transaction-item:nth-child(even) {
    background: #cbdcd9;
}

.transaction-item:last-child {
    border-bottom: none;
    border-radius: 0 0 8px 8px;
}

.transaction-item:hover {
    background: #f1f5f9;
    transform: scale(1.002);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    z-index: 1;
}

.transaction-item.initial-row {
    background: #f3e8ff !important;
}

.transaction-item .txn-date {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    font-size: 0.76rem;
    color: var(--text-secondary);
}

.transaction-item .txn-account {
    font-size: 0.78rem;
    color: var(--text);
    font-weight: 500;
    overflow-wrap: anywhere;
    text-align: center;
}

.transaction-item .txn-description {
    font-weight: 500;
    font-size: 0.78rem;
    overflow-wrap: anywhere;
}

.transaction-item .txn-category {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    background: var(--bg);
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-weight: 500;
    font-size: 0.64rem;
    justify-self: center;
}

.transaction-item .txn-change,
.transaction-item .txn-balance {
    text-align: center;
    font-size: 0.78rem;
}

.edit-btn {
    padding: 0.25rem 0.5rem;
    background: #f3f4f6;
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 0.25rem;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
}

.edit-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* Account Filter Button (Sidebar) */
.account-filter-btn {
    width: 100%;
    text-align: left;
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: 0.25rem;
    font-size: inherit;
    font-weight: inherit;
    color: inherit;
    background: white;
    box-sizing: border-box;
    min-height: 1.5rem;
    cursor: pointer;
    position: relative;
    transition: all 0.2s;
}

.account-filter-btn:hover {
    background: #f9fafb;
}

.account-filter-btn.active {
    border-color: var(--primary);
    background: #f0fdf4;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.account-filter-btn.archived {
    opacity: 0.7;
    background: #f3f4f6;
}

/* Investment Account Balance Update Button */
.investment-update-btn {
    background: rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 0.5rem;
    padding: 0.25rem 0.5rem;
    font-size: 1rem;
    cursor: pointer;
    opacity: 0.7;
    transition: all 0.2s;
    z-index: 10;
}

.investment-update-btn:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.9) !important;
    border-color: rgba(0, 0, 0, 0.2) !important;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    transform: translateY(-1px) scale(1.1);
}

/* Modal Styles */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal-content-sm {
    background: white;
    padding: 2rem;
    border-radius: 1rem;
    max-width: 450px;
    width: 90%;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.account-info-box {
    margin-bottom: 1rem;
    padding: 0.75rem;
    background: #f3f4f6;
    border-radius: 0.5rem;
}

.preview-box {
    display: none;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: #f9fafb;
    border-radius: 0.5rem;
    border: 1px solid #e5e7eb;
}

.input-full-width {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    font-size: 1rem;
}

.modal-title {
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
}

.label-sm {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: #4b5563;
    margin-bottom: 0.5rem;
}

.text-muted-sm {
    font-size: 0.75rem;
    color: #6b7280;
    margin-bottom: 0.25rem;
}

/* Highlighting Animations */
@keyframes highlight-pulse {
    0% {
        background-color: rgba(255, 140, 0, 0.5);
    }

    100% {
        background-color: transparent;
    }
}

.highlight-row {
    animation: highlight-pulse 4s ease-out forwards;
    font-weight: 700 !important;
}

.highlight-filter {
    animation: highlight-pulse 4s ease-out forwards;
    transition: border-color 0.3s;
    border: 2px solid var(--warning) !important;
}

/* Context Banner Styles */
.active-context-banner {
    display: none;
    background: #4B5563;
    color: white;
    text-align: center;
    padding: 0.6rem;
    font-size: 0.875rem;
    font-weight: 500;
    position: sticky;
    top: 0;
    z-index: 1000;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.active-context-banner .btn-switch-context {
    background: white;
    color: #4B5563;
    border: none;
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: none;
}

.active-context-banner .btn-switch-context:hover {
    background: #F3F4F6;
    transform: none;
}

/* ===== Autocomplete Dropdown ===== */
.description-autocomplete-dropdown {
    position: absolute;
    z-index: 9999;
    background: white;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    list-style: none;
    margin: 2px 0 0;
    padding: 0.25rem 0;
    max-height: 260px;
    overflow-y: auto;
    min-width: 100%;
    width: max-content;
    max-width: min(400px, 90vw);
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.2) transparent;
}

.description-autocomplete-dropdown::-webkit-scrollbar {
    width: 4px;
}

.description-autocomplete-dropdown::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 4px;
}

.description-autocomplete-dropdown li {
    padding: 0.45rem 0.85rem;
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: background 0.12s;
}

.description-autocomplete-dropdown li:hover,
.description-autocomplete-dropdown li.active {
    background: #f0f7f6;
    color: var(--primary-dark, #5d7058);
    font-weight: 500;
}

@media (max-width: 640px) {
    .description-autocomplete-dropdown {
        max-width: 92vw;
        font-size: 1rem;
    }

    .description-autocomplete-dropdown li {
        padding: 0.65rem 0.85rem;
    }
}