/* Licht olijfgroen ontwerp — pas de kleuren eenvoudig aan via :root. */
:root {
    color-scheme: light;
    --page-bg: #e9eadf;
    --panel-bg: #f8f8f1;
    --panel-alt: #f1f2e7;
    --olive-dark: #4f5b3a;
    --olive: #586641;
    --olive-medium: #606b55;
    --olive-light: #aeb995;
    --olive-pale: #dde2cf;
    --text-main: #25291f;
    --text-soft: #555d4a;
    --text-light: #616a53;
    --border: #cfd3c2;
    --delete: #945346;
    --delete-hover: #763e33;
    --white: #fff;
    --shadow: rgba(56, 63, 43, 0.10);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    padding: 28px 20px 50px;
    font: 16px/1.5 Arial, Helvetica, sans-serif;
    color: var(--text-main);
    background: var(--page-bg);
}

button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .47; }
input, select { min-width: 0; }

:where(button, a, input, select):focus-visible {
    outline: 3px solid #8ea66b;
    outline-offset: 3px;
}

.container { max-width: 850px; margin: 0 auto; }

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    margin: 8px 0 19px;
}

.eyebrow, .section-kicker {
    color: var(--olive);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .16em;
    margin: 0 0 7px;
}

h1, h2, h3, p { overflow-wrap: anywhere; }
h1 { font-size: clamp(29px, 5vw, 41px); line-height: 1.12; margin: 0; letter-spacing: -.035em; }
h2 { font-size: clamp(23px, 4vw, 27px); line-height: 1.3; margin: 0; letter-spacing: -.02em; }
.page-subtitle { color: var(--text-soft); font-size: 14px; margin: 9px 0 0; }

.shortcut-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 13px;
    min-height: 46px;
    padding: 10px 17px;
    border-radius: 10px;
    background: var(--olive-dark);
    color: var(--white);
    font-weight: 700;
    text-decoration: none;
    transition: background .15s, transform .15s;
}
.shortcut-link:hover { background: #404c30; }
.shortcut-link:active { transform: scale(.98); }

.backup-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}
.backup-description { color: var(--text-soft); font-size: 13px; }
.toolbar-actions, .section-actions, .dialog-actions {
    display: flex;
    gap: 9px;
    flex-wrap: wrap;
}

/* Lijst overzetten / WhatsApp: los van een volledige back-up. */
.transfer-panel {
    padding: 18px;
    margin: -4px 0 22px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--panel-alt);
}
.transfer-heading h3 {
    margin: 0 0 6px;
    color: var(--olive-dark);
    font-size: 17px;
}
.transfer-description, .transfer-hint {
    margin: 0;
    color: var(--text-soft);
    font-size: 13px;
}
.transfer-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
    margin: 14px 0 10px;
}
.transfer-actions .button { flex: 1 1 170px; }
.transfer-hint { line-height: 1.55; }

.section {
    padding: 26px;
    background: var(--panel-bg);
    border: 1px solid var(--border);
    border-top: 5px solid var(--olive-dark);
    border-radius: 14px;
    margin-bottom: 22px;
    box-shadow: 0 3px 10px var(--shadow);
}
.completed-section { border-top-color: #667d50; }
.saved-section { border-top-color: var(--olive-medium); }
.section-heading { margin-bottom: 20px; }
.count-chip {
    display: inline-grid;
    place-items: center;
    min-width: 28px;
    height: 28px;
    padding: 0 7px;
    vertical-align: middle;
    border-radius: 8px;
    background: var(--olive-pale);
    color: var(--olive-dark);
    font-size: 14px;
    font-weight: 800;
    letter-spacing: 0;
}

.button {
    min-height: 44px;
    padding: 10px 16px;
    border: 1px solid transparent;
    border-radius: 9px;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.3;
    transition: background .15s, transform .15s;
}
.button:not(:disabled):active { transform: scale(.985); }
.button-primary { background: var(--olive-dark); color: var(--white); }
.button-primary:hover:not(:disabled) { background: #414c31; }
.button-subtle { background: var(--olive-medium); color: var(--white); }
.button-subtle:hover:not(:disabled) { background: var(--olive); }
.button-secondary {
    background: var(--olive-pale);
    color: var(--olive-dark);
    border-color: var(--border);
}
.button-secondary:hover:not(:disabled) { background: #cdd7bb; }
.button-ghost {
    background: var(--white);
    border-color: var(--border);
    color: var(--olive-dark);
}
.button-ghost:hover:not(:disabled) { background: var(--olive-pale); }
.button-ghost-danger {
    background: #fff8f5;
    border-color: #e6c8be;
    color: var(--delete);
}
.button-ghost-danger:hover:not(:disabled) { background: #f8e7e0; }
.button-small { min-height: 46px; padding: 10px 12px; }

input:not([type="file"]), select {
    min-height: 48px;
    width: 100%;
    padding: 10px 13px;
    background: var(--white);
    color: var(--text-main);
    border: 1px solid #b9c2ac;
    border-radius: 9px;
    font-size: 16px;
}
input::placeholder { color: #697460; opacity: 1; }
label:not(.sr-only) {
    display: block;
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 7px;
    color: var(--text-soft);
}
.category-creator {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    margin-bottom: 18px;
}
.category-select-area { margin-bottom: 16px; }
.category-controls {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 9px;
}
.add-section {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 86px auto;
    gap: 10px;
    margin-bottom: 24px;
}
.add-section > .button { min-width: 136px; }
.section-actions { margin: -3px 0 22px; }
.saved-tools {
    display: grid;
    grid-template-columns: 1fr 1.3fr;
    gap: 12px;
    margin-bottom: 10px;
}
.results-caption {
    margin: 10px 0 18px;
    color: var(--text-light);
    font-size: 13px;
}

.group-stack { display: grid; gap: 20px; }
.category-group { min-width: 0; }
.category-title {
    margin: 0 0 11px;
    padding: 10px 13px;
    border-left: 5px solid var(--olive-dark);
    border-radius: 8px;
    color: var(--olive-dark);
    background: var(--olive-pale);
    font-size: 17px;
    font-weight: 700;
}
.saved-section .category-title { border-left-color: var(--olive-medium); background: #e6eadb; }
.item-list {
    display: grid;
    gap: 9px;
    margin: 0;
    padding: 0;
    list-style: none;
}
.item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    min-width: 0;
    min-height: 66px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--white);
    box-shadow: 0 1px 3px rgba(56, 63, 43, .04);
}
.item-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    flex: 1;
}
.item-info {
    display: flex;
    align-items: baseline;
    gap: 11px;
    min-width: 0;
}
.item-amount {
    flex: none;
    min-width: 35px;
    font-size: 16px;
    font-weight: 800;
    color: var(--olive-dark);
}
.item-name {
    min-width: 0;
    font-weight: 600;
    font-size: 17px;
    line-height: 1.3;
    overflow-wrap: anywhere;
}
.item-buttons { display: flex; gap: 7px; flex-shrink: 0; }
.item-button {
    display: inline-grid;
    place-items: center;
    flex: 0 0 42px;
    width: 42px;
    height: 42px;
    padding: 0;
    border: 0;
    border-radius: 9px;
    font-size: 21px;
    font-weight: 700;
    line-height: 1;
    transition: background .15s;
}
.save-button { color: var(--white); background: var(--olive-medium); font-size: 25px; }
.save-button:hover { background: var(--olive); }
.add-saved-button { color: var(--white); background: var(--olive-dark); }
.add-saved-button:hover { background: #414c31; }
.edit-button { color: var(--olive-dark); background: #e5eadb; }
.edit-button:hover { background: #d3ddc5; }
.complete-button { color: var(--white); background: #667d50; }
.complete-button:hover { background: #536940; }
.delete-button { color: var(--white); background: var(--delete); font-size: 25px; }
.delete-button:hover { background: var(--delete-hover); }
.is-completed { background: var(--panel-alt); }
.is-completed .item-name { color: var(--text-soft); text-decoration: line-through; }
.is-completed .item-amount { color: var(--text-light); }

.empty-message {
    margin: 0;
    padding: 18px;
    color: var(--text-soft);
    background: var(--panel-alt);
    border: 1px dashed var(--border);
    border-radius: 9px;
    font-size: 14px;
}
.warning {
    margin: 0 0 16px;
    padding: 14px;
    border-radius: 9px;
    background: #fff0dc;
    border: 1px solid #d5ad7d;
    color: #6d4019;
    font-size: 14px;
}
.warning[hidden] { display: none; }
.status-message {
    position: fixed;
    left: 50%;
    bottom: 15px;
    transform: translateX(-50%);
    z-index: 10;
    width: max-content;
    max-width: min(90vw, 500px);
    padding: 11px 16px;
    border-radius: 10px;
    background: var(--olive-dark);
    color: var(--white);
    box-shadow: 0 6px 24px var(--shadow);
    text-align: center;
    font-size: 14px;
}
.status-message:empty { display: none; }

.edit-dialog {
    width: min(92vw, 440px);
    max-height: min(90vh, 680px);
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 16px;
    color: var(--text-main);
    background: var(--panel-bg);
    box-shadow: 0 18px 50px rgba(26, 33, 18, .25);
}
.edit-dialog::backdrop { background: rgba(30, 39, 23, .52); }
.edit-form { display: grid; gap: 9px; padding: 25px; }
.dialog-heading { margin-bottom: 9px; }
.dialog-actions { justify-content: flex-end; margin-top: 16px; }

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (max-width: 650px) {
    body { padding: 13px 10px 35px; }
    .page-header { padding: 5px 5px 0; }
    .shortcut-link { width: 100%; }
    .backup-toolbar { padding: 0 5px; }
    .toolbar-actions { width: 100%; }
    .toolbar-actions .button { flex: 1 1 auto; }
    .section { padding: 18px 14px; border-radius: 12px; margin-bottom: 16px; }
    .transfer-panel { padding: 13px; }
    .transfer-actions { flex-direction: column; }
    .transfer-actions .button { width: 100%; flex: 0 0 auto; }

    .category-creator { grid-template-columns: minmax(0, 1fr); }
    .category-controls { grid-template-columns: 1fr 1fr; }
    .category-controls select { grid-column: 1 / -1; }
    .add-section { grid-template-columns: minmax(0, 1fr) 80px; }
    .add-section > .button { grid-column: 1 / -1; }
    .saved-tools { grid-template-columns: 1fr; }
    .section-actions .button { flex: 1 1 150px; }
    .item { gap: 8px; padding: 9px 8px; }
    .item-left { gap: 8px; }
    .item-info { gap: 7px; }
    .item-amount { min-width: 28px; font-size: 14px; }
    .item-name { font-size: 15px; }
    .item-buttons { gap: 5px; }
    .item-button { width: 38px; height: 40px; flex-basis: 38px; font-size: 20px; }
}

@media (max-width: 385px) {
    .item { flex-wrap: wrap; }
    .item-left { min-width: 100%; }
    .item-buttons { margin-left: auto; }
    .item { padding: 9px; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { transition: none !important; }
}
