:root {
    --bg: #f4f7f5;
    --card: #ffffff;
    --text: #1a2722;
    --muted: #546560;
    --accent: #197a57;
    --accent-strong: #0f6144;
    --danger: #a5312c;
    --border: #d5dfda;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: "Segoe UI", Tahoma, sans-serif;
    color: var(--text);
    background: radial-gradient(circle at top right, #d7ebe3, var(--bg) 35%);
}
.container { width: min(1000px, 94vw); margin: 1rem auto 2rem; }
.trip-container { width: min(760px, 96vw); }
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}
.view-nav { display: flex; gap: 0.5rem; margin-top: 0.8rem; flex-wrap: wrap; }
h1, h2 { margin: 0 0 0.8rem; }
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 1rem;
    margin-top: 1rem;
    box-shadow: 0 6px 20px rgba(27, 56, 44, 0.05);
}
.grid { display: grid; gap: 0.8rem; }
.add-form, .filter-form { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); align-items: end; }
.shopping-add-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: end;
}
.shopping-add-form > label {
    min-width: 0;
    width: 100%;
}
.shopping-add-form input,
.shopping-add-form select {
    width: 100%;
    min-width: 0;
}
.shopping-add-form > button {
    grid-column: 1 / -1;
}
label { font-size: 0.92rem; display: grid; gap: 0.3rem; }
.suggestions {
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 10px 24px rgba(27, 56, 44, 0.08);
    overflow: hidden;
}
.suggestion-item {
    width: 100%;
    text-align: left;
    border: 0;
    border-bottom: 1px solid #edf2ef;
    background: #fff;
    color: var(--text);
    padding: 0.7rem;
    display: block;
}
.suggestion-item:last-child {
    border-bottom: 0;
}
input, select, button {
    border-radius: 10px;
    border: 1px solid var(--border);
    padding: 0.65rem 0.7rem;
    font-size: 0.98rem;
}
button, .btn {
    cursor: pointer;
    background: var(--accent);
    color: #fff;
    text-decoration: none;
    border: 1px solid var(--accent);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
}
button:hover, .btn:hover { background: var(--accent-strong); }
.btn-secondary, .btn-current {
    background: #fff;
    color: var(--accent-strong);
    border-color: var(--accent);
}
.btn-current { background: #ddf4ea; }
.btn-danger { background: #fff; color: var(--danger); border-color: var(--danger); }
.alert { margin-top: 1rem; padding: 0.8rem; border-radius: 10px; }
.alert-error { background: #fde8e8; color: #7f1d1d; }
.alert-success { background: #e7f9ee; color: #0e5738; }
.list, .trip-list { display: grid; gap: 0.8rem; }
.list-item {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.8rem;
    display: grid;
    gap: 0.6rem;
    background: #fff;
}
.list-item.dragging { opacity: 0.6; }
.drag-handle {
    display: inline-block;
    margin-right: 0.5rem;
    font-weight: 700;
    color: var(--muted);
    cursor: grab;
}
.list-item.status-open { border-left: 5px solid #9bc7b4; }
.list-item.status-purchased { border-left: 5px solid #73a18e; }
.list-item.status-archived { border-left: 5px solid #c7d1cc; }
.meta, .trip-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 0.8rem;
    color: var(--muted);
    font-size: 0.86rem;
}
.actions, .inline-form, .trip-price-form, .trip-filters, .trip-complete-form {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.pill {
    background: #ddf4ea;
    color: #165b42;
    border-radius: 999px;
    padding: 0.2rem 0.55rem;
    font-size: 0.8rem;
}
.muted { color: var(--muted); }
.totals, .trip-total { margin: 0 0 0.8rem; }
.section-title-row, .trip-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}
.admin-row {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    align-items: center;
}
.admin-filter-input {
    min-width: min(320px, 100%);
}
.admin-create-row {
    border-style: dashed;
}
.checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}
.trip-filter-toggle {
    width: 2.7rem;
    height: 2.7rem;
    padding: 0;
    font-size: 1.15rem;
}
.trip-filter-panel {
    margin-top: 0.5rem;
}
.trip-filter-panel summary {
    list-style: none;
}
.trip-filter-panel summary::-webkit-details-marker {
    display: none;
}
.trip-card { padding: 0.9rem; }
.trip-item { gap: 0.5rem; }
.trip-main {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.8rem;
}
.trip-item-checked {
    background: #f5faf7;
    border-left: 5px solid #73a18e;
}
.trip-line-total {
    align-self: center;
    color: var(--accent-strong);
    font-weight: 700;
}
.trip-price-form input {
    width: 6.5rem;
    flex: 0 0 6.5rem;
}
.checked-card { margin-bottom: 2rem; }

@media (max-width: 640px) {
    .container { width: 95vw; }
    .topbar { flex-direction: column; align-items: flex-start; }
    .topbar-actions { width: 100%; display: flex; justify-content: space-between; align-items: center; }
    .actions form, .trip-check-form { flex: 1 1 48%; }
    .actions button, .trip-check-form button { width: 100%; }
    .trip-main { flex-direction: column; }
    .trip-price-form input { flex: 1 1 140px; }
}
