/* =====================================================================
   Tijden — zacht, vrolijk, een klein beetje bloemig
   ===================================================================== */

:root {
    --ink: #4a3f4c;
    --ink-soft: #8a7d8f;
    --paper: #fdf7f9;
    --card: #ffffff;
    --line: #f0e3ea;

    --accent: #d86e9a;
    --accent-2: #a98ad8;
    --accent-soft: #fbe6ef;

    --radius: 18px;
    --shadow: 0 6px 20px rgba(120, 70, 100, .08);
    --shadow-hover: 0 12px 28px rgba(120, 70, 100, .14);

    --tile: var(--accent);
}

/* ---------- tile-kleuren ---------- */
.tile-coral    { --tile: #ef7a8f; }
.tile-peach    { --tile: #f2a07b; }
.tile-lemon    { --tile: #d9b33c; }
.tile-lime     { --tile: #97be6a; }
.tile-mint     { --tile: #63c1a4; }
.tile-teal     { --tile: #4fb0b8; }
.tile-sky      { --tile: #6aaee0; }
.tile-indigo   { --tile: #7f86d9; }
.tile-lavender { --tile: #a98ad8; }
.tile-rose     { --tile: #d97bb2; }

/* ---------- basis ---------- */
html { -webkit-text-size-adjust: 100%; }

body {
    font-family: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
    color: var(--ink);
    background: var(--paper);
    min-height: 100vh;
    position: relative;
    z-index: 0; /* eigen stacking context: .bg-flowers (z-index -1) valt onder de content */
}

.app-main { max-width: 960px; padding-bottom: 5rem !important; }

.app-title {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-weight: 600;
    font-size: 1.6rem;
    letter-spacing: .01em;
    color: var(--ink);
}

.section-title {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-weight: 600;
    font-size: 1.25rem;
    color: var(--ink-soft);
    margin-bottom: .5rem;
}

.text-accent { color: var(--accent) !important; }
.border-accent { border-color: var(--accent) !important; }
.min-w-0 { min-width: 0; }

/* ---------- vage bloemen in de hoek ---------- */
.bg-flowers {
    position: fixed;
    right: -40px;
    bottom: -40px;
    width: 320px;
    height: 320px;
    pointer-events: none;
    opacity: .16;
    z-index: -1;
    background-repeat: no-repeat;
    background-size: contain;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 320 320'%3E%3Cg fill='%23d86e9a'%3E%3Ccircle cx='230' cy='190' r='26'/%3E%3Ccircle cx='270' cy='230' r='26'/%3E%3Ccircle cx='230' cy='270' r='26'/%3E%3Ccircle cx='190' cy='230' r='26'/%3E%3C/g%3E%3Ccircle cx='230' cy='230' r='18' fill='%23f3c14b'/%3E%3Cg fill='%23a98ad8'%3E%3Ccircle cx='110' cy='250' r='14'/%3E%3Ccircle cx='132' cy='272' r='14'/%3E%3Ccircle cx='110' cy='294' r='14'/%3E%3Ccircle cx='88' cy='272' r='14'/%3E%3C/g%3E%3Ccircle cx='110' cy='272' r='9' fill='%23fff1c9'/%3E%3Cpath d='M150 300 C 170 240, 200 230, 230 250' stroke='%2397be6a' stroke-width='4' fill='none' stroke-linecap='round'/%3E%3Cpath d='M180 262 c -14 -6 -22 -2 -26 8 c 12 4 22 2 26 -8z' fill='%2397be6a'/%3E%3C/svg%3E");
}
@media (max-width: 575px) {
    .bg-flowers { width: 220px; height: 220px; right: -30px; bottom: -30px; }
}

/* ---------- navbar ---------- */
.app-nav {
    background: linear-gradient(100deg, #e98bb1 0%, #c78fd0 60%, #a98ad8 100%);
    box-shadow: 0 4px 18px rgba(170, 100, 150, .22);
    padding-top: calc(.5rem + env(safe-area-inset-top));
}
.app-brand {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-weight: 600;
    font-size: 1.5rem;
    letter-spacing: .02em;
}
.brand-mark { display: inline-flex; line-height: 0; filter: drop-shadow(0 1px 2px rgba(0,0,0,.12)); }
.btn-nav {
    color: #fff;
    background: rgba(255,255,255,.16);
    border: 1px solid rgba(255,255,255,.35);
    border-radius: 999px;
    width: 34px; height: 34px;
    display: inline-flex; align-items: center; justify-content: center;
    padding: 0;
}
.btn-nav:hover { background: rgba(255,255,255,.3); color: #fff; }

/* ---------- tabs ---------- */
.app-tabs {
    gap: .25rem;
    background: var(--card);
    padding: .3rem;
    border-radius: 999px;
    box-shadow: var(--shadow);
    width: fit-content;
    max-width: 100%;
    flex-wrap: nowrap;
}
.app-tabs .nav-link {
    border-radius: 999px;
    color: var(--ink-soft);
    font-weight: 700;
    padding: .45rem 1rem;
    white-space: nowrap;
}
.app-tabs .nav-link.active {
    background: linear-gradient(100deg, #f7c6da, #dcc9f2);
    color: var(--ink);
}

/* ---------- page head ---------- */
.page-head {
    display: flex;
    align-items: center;
    gap: .75rem;
    margin-bottom: 1rem;
}
.back-link {
    width: 38px; height: 38px;
    border-radius: 999px;
    display: inline-flex; align-items: center; justify-content: center;
    color: var(--ink-soft);
    background: var(--card);
    box-shadow: var(--shadow);
    text-decoration: none;
    flex: 0 0 auto;
}
.back-link:hover { color: var(--accent); }

/* ---------- "tijd schrijven" knop ---------- */
.write-cta {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-radius: 22px;
    text-decoration: none;
    color: #fff;
    background: linear-gradient(110deg, #e58ab0 0%, #c490d6 70%, #a98ad8 100%);
    box-shadow: 0 10px 26px rgba(200, 110, 160, .32);
    transition: transform .12s ease, box-shadow .12s ease;
}
.write-cta:hover { color: #fff; transform: translateY(-2px); box-shadow: 0 14px 30px rgba(200, 110, 160, .4); }
.write-cta-icon {
    width: 52px; height: 52px;
    border-radius: 999px;
    background: rgba(255,255,255,.22);
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 1.35rem;
    flex: 0 0 auto;
}
.write-cta-text { display: flex; flex-direction: column; line-height: 1.2; }
.write-cta-title { font-weight: 800; font-size: 1.2rem; }
.write-cta-sub { opacity: .9; font-size: .9rem; }

/* ---------- tiles ---------- */
.tile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: .85rem;
}
.tile-grid-pick { grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: .6rem; }

@media (max-width: 420px) {
    .tile-grid { grid-template-columns: repeat(2, 1fr); gap: .65rem; }
    .tile-grid-pick { grid-template-columns: repeat(3, 1fr); gap: .5rem; }
}

.tile {
    position: relative;
    aspect-ratio: 1 / 1;
    border-radius: var(--radius);
    background: var(--card);
    box-shadow: var(--shadow);
    border: 1px solid transparent;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .25rem;
    padding: .75rem;
    text-decoration: none;
    color: var(--ink);
    text-align: center;
    cursor: pointer;
    transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
    -webkit-tap-highlight-color: transparent;
    font-family: inherit;
}
.tile:hover, .tile:focus-visible { transform: translateY(-2px); box-shadow: var(--shadow-hover); color: var(--ink); outline: none; }
.tile:active { transform: translateY(0) scale(.98); }

.tile-icon {
    width: 52px; height: 52px;
    border-radius: 999px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 1.35rem;
    color: var(--tile);
    background: color-mix(in srgb, var(--tile) 16%, white);
}
.tile-label {
    font-weight: 700;
    line-height: 1.2;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    max-width: 100%;
    word-break: break-word;
}
.tile-meta { font-size: .72rem; color: var(--ink-soft); min-height: 1em; }

.tile-cat {
    background: linear-gradient(160deg, color-mix(in srgb, var(--tile) 20%, white), color-mix(in srgb, var(--tile) 8%, white));
    border-color: color-mix(in srgb, var(--tile) 28%, white);
}
.tile-cat .tile-icon { background: #fff; }

.tile-add {
    background: transparent;
    border: 2px dashed color-mix(in srgb, var(--accent) 45%, white);
    box-shadow: none;
    color: var(--accent);
}
.tile-add:hover { background: var(--accent-soft); box-shadow: none; color: var(--accent); }
.tile-add .tile-icon { background: var(--accent-soft); color: var(--accent); }
.tile-add .tile-label { color: var(--accent); }

/* picker-tile */
.tile-pick { padding: .5rem; }
.tile-pick .tile-icon { width: 42px; height: 42px; font-size: 1.1rem; }
.tile-pick .tile-label { font-size: .85rem; }
.tile-check {
    position: absolute;
    top: .4rem; right: .4rem;
    width: 22px; height: 22px;
    border-radius: 999px;
    background: var(--tile);
    color: #fff;
    font-size: .7rem;
    display: none;
    align-items: center; justify-content: center;
}
.tile-pick.is-picked {
    background: color-mix(in srgb, var(--tile) 18%, white);
    border-color: var(--tile);
}
.tile-pick.is-picked .tile-icon { background: #fff; }
.tile-pick.is-picked .tile-check { display: inline-flex; }

/* dag-tile */
.tile-day { gap: .1rem; }
.tile-day-label { font-weight: 800; font-size: 1.05rem; }
.tile-day-date { font-size: .8rem; color: var(--ink-soft); }
.tile-day-total { margin-top: .35rem; font-size: 1.5rem; font-weight: 800; color: var(--accent); line-height: 1; }
.tile-day .tile-meta { margin-top: .35rem; }

/* ---------- zoekbalk ---------- */
.search-wrap { position: relative; }
.search-icon {
    position: absolute;
    left: 1rem; top: 50%;
    transform: translateY(-50%);
    color: var(--ink-soft);
    pointer-events: none;
}
.search-input {
    padding: .7rem 1rem .7rem 2.6rem;
    border-radius: 999px;
    background: var(--card);
    box-shadow: var(--shadow);
    border: 1px solid var(--line);
    font-size: 1rem;
}

/* ---------- tijdlijn (blokken) ---------- */
.timeline { list-style: none; margin: 0; padding: 0; }
.tl-block { display: flex; gap: .75rem; margin-bottom: .75rem; }
.tl-time {
    flex: 0 0 3.2rem;
    display: flex; flex-direction: column; justify-content: space-between;
    font-variant-numeric: tabular-nums;
    font-weight: 700;
    font-size: .85rem;
    padding: .3rem 0;
    position: relative;
}
.tl-time::after {
    content: '';
    position: absolute;
    right: -.4rem; top: .9rem; bottom: .9rem;
    width: 2px;
    border-radius: 2px;
    background: linear-gradient(#f2b6cf, #cdb8ec);
}
.tl-start { color: var(--ink); }
.tl-end { color: var(--ink-soft); }
.tl-card {
    flex: 1 1 auto;
    min-width: 0;
    display: block;
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: .75rem .9rem;
    text-decoration: none;
    color: var(--ink);
    transition: box-shadow .12s ease, transform .12s ease;
}
.tl-card:hover { color: var(--ink); box-shadow: var(--shadow-hover); transform: translateY(-1px); }
.tl-head { display: flex; align-items: center; gap: .5rem; margin-bottom: .45rem; min-width: 0; }
.tl-dur { font-weight: 800; color: var(--accent); }
.tl-note { color: var(--ink-soft); font-size: .85rem; min-width: 0; }
.tl-edit { color: var(--line); font-size: .8rem; transition: color .12s; }
.tl-card:hover .tl-edit { color: var(--accent); }
.tl-bar { display: flex; gap: 3px; height: 6px; border-radius: 999px; overflow: hidden; margin-bottom: .5rem; }
.tl-bar > span { background: var(--tile); min-width: 4px; }
.tl-cats { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .35rem .9rem; }
.tl-cats li { display: inline-flex; align-items: center; gap: .35rem; font-size: .88rem; min-width: 0; max-width: 100%; }
.tl-cats li i { color: var(--tile); }
.tl-cat-min { color: var(--ink-soft); font-variant-numeric: tabular-nums; }

/* ---------- dagoverzicht ---------- */
.day-group { margin-bottom: .75rem; }
.day-group:last-child { margin-bottom: 0; }
.day-group-head { display: flex; align-items: center; gap: .6rem; margin-bottom: .5rem; }
.day-group-icon {
    width: 34px; height: 34px;
    border-radius: 11px;
    display: inline-flex; align-items: center; justify-content: center;
    color: var(--tile);
    background: color-mix(in srgb, var(--tile) 16%, white);
    flex: 0 0 auto;
}
.day-group-name { font-weight: 800; color: var(--ink); flex: 0 1 auto; max-width: 40%; }
.day-group-bar {
    flex: 1 1 auto;
    height: 6px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--tile) 14%, white);
    overflow: hidden;
    min-width: 40px;
}
.day-group-bar > span { display: block; height: 100%; background: var(--tile); border-radius: 999px; }
.day-group-total { font-weight: 800; color: var(--tile); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ---------- schrijfscherm ---------- */
.time-input { font-variant-numeric: tabular-nums; font-weight: 700; }
.btn-now { border-radius: 0 12px 12px 0 !important; padding: .375rem .6rem !important; font-size: .85rem; }
.span-total { font-weight: 800; font-size: 1.15rem; color: var(--accent); padding-bottom: .4rem; white-space: nowrap; }

.remain-pill {
    font-size: .8rem;
    border-radius: 999px;
    padding: .2rem .7rem;
    border: 1px solid var(--line);
    color: var(--ink-soft);
}
.remain-pill.is-warn { border-color: #ecc97f; color: #b9801a; }
.remain-pill.is-danger { border-color: #eaa1ae; color: #c84a63; }

.picked-list { list-style: none; margin: 0; padding: 0; }
.picked {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border-left: 4px solid var(--tile);
    padding: .6rem .75rem .7rem;
    margin-bottom: .6rem;
}
.picked-head { display: flex; align-items: center; gap: .6rem; margin-bottom: .5rem; min-width: 0; }
.picked-icon {
    width: 32px; height: 32px;
    border-radius: 10px;
    display: inline-flex; align-items: center; justify-content: center;
    color: var(--tile);
    background: color-mix(in srgb, var(--tile) 16%, white);
    flex: 0 0 auto;
}
.picked-name { font-weight: 800; min-width: 0; }
.picked-min { margin-left: auto; font-weight: 800; color: var(--tile); font-variant-numeric: tabular-nums; white-space: nowrap; }
.picked-remove { color: var(--ink-soft); }

.chips { display: flex; flex-wrap: wrap; gap: .35rem; }
.chip {
    border: 1px solid color-mix(in srgb, var(--tile) 35%, white);
    background: #fff;
    color: var(--ink);
    border-radius: 999px;
    padding: .28rem .7rem;
    font-size: .85rem;
    font-weight: 700;
    min-width: 2.6rem;
    font-variant-numeric: tabular-nums;
    transition: background .1s, color .1s;
}
.chip:hover { background: color-mix(in srgb, var(--tile) 12%, white); }
.chip.is-on { background: var(--tile); border-color: var(--tile); color: #fff; }
.chip-removable {
    display: inline-flex; align-items: center; gap: .3rem;
    --tile: var(--accent);
    padding-right: .3rem;
    cursor: default;
}
.chip-x {
    border: 0; background: transparent; color: var(--ink-soft);
    width: 20px; height: 20px; border-radius: 999px; padding: 0;
    display: inline-flex; align-items: center; justify-content: center; font-size: .7rem;
}
.chip-x:hover { background: var(--accent-soft); color: var(--accent); }

.save-bar {
    position: sticky;
    bottom: 0;
    z-index: 5;
    display: flex;
    gap: .5rem;
    margin: 1.25rem -.75rem 0;
    padding: .75rem .75rem calc(.75rem + env(safe-area-inset-bottom));
    background: linear-gradient(rgba(253, 247, 249, 0), var(--paper) 35%);
}
.save-bar .btn { padding-top: .7rem; padding-bottom: .7rem; }

/* ---------- kaarten / modals / knoppen ---------- */
.soft-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem 1.1rem; }
.soft-modal { border: 0; border-radius: var(--radius); box-shadow: 0 20px 50px rgba(90, 50, 80, .22); }
.soft-modal .modal-header, .soft-modal .modal-footer { border-color: var(--line); }
.soft-alert { border: 0; border-radius: 14px; box-shadow: var(--shadow); }

.btn-accent {
    background: linear-gradient(100deg, #e07ca6, #b98ad8);
    color: #fff;
    border: 0;
    border-radius: 999px;
    font-weight: 700;
    padding: .5rem 1.2rem;
    box-shadow: 0 6px 16px rgba(216, 110, 154, .3);
}
.btn-accent:hover, .btn-accent:focus, .btn-accent:active { color: #fff !important; filter: brightness(1.05); box-shadow: 0 8px 20px rgba(216, 110, 154, .38); }
.btn-soft {
    background: var(--accent-soft);
    color: var(--accent);
    border: 0;
    border-radius: 999px;
    font-weight: 700;
    padding: .5rem 1rem;
}
.btn-soft:hover, .btn-soft:active { background: #f6d5e2 !important; color: var(--accent) !important; }
.btn-sm.btn-soft, .btn-sm.btn-accent { padding: .3rem .7rem; }
.btn-icon { border: 0; background: transparent; padding: .2rem .45rem; border-radius: 999px; }
.btn-icon:hover { background: var(--accent-soft); color: var(--accent) !important; }

.btn-option {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: .65rem .9rem;
    font-weight: 700;
    color: var(--ink);
    display: flex;
    align-items: center;
    gap: .25rem;
}
.btn-option:hover { border-color: var(--accent); background: var(--accent-soft); color: var(--ink); }
.btn-option:disabled { opacity: .45; }
.btn-option .opt-time { margin-left: auto; font-weight: 600; color: var(--ink-soft); font-variant-numeric: tabular-nums; white-space: nowrap; }
.btn-option-muted { color: var(--ink-soft); }

.conflict-list { list-style: none; padding: 0; margin: 0 0 1rem; }
.conflict-list li {
    display: flex; align-items: center; gap: .5rem;
    padding: .45rem .7rem;
    border-radius: 12px;
    background: color-mix(in srgb, var(--tile) 12%, white);
    margin-bottom: .35rem;
    font-size: .9rem;
}
.conflict-dot { width: 10px; height: 10px; border-radius: 999px; background: var(--tile); flex: 0 0 auto; }

/* ---------- toast ---------- */
.app-toast {
    position: fixed;
    left: 50%;
    bottom: calc(5.5rem + env(safe-area-inset-bottom));
    transform: translate(-50%, 1rem);
    background: var(--ink);
    color: #fff;
    padding: .6rem 1.1rem;
    border-radius: 999px;
    font-weight: 600;
    font-size: .9rem;
    box-shadow: 0 10px 30px rgba(0,0,0,.2);
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s, transform .2s;
    z-index: 2000;
    max-width: calc(100% - 2rem);
    text-align: center;
}
.app-toast.is-show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- formulieren ---------- */
.form-control { border-radius: 12px; border-color: var(--line); }
.form-control:focus { border-color: var(--accent-2); box-shadow: 0 0 0 .2rem rgba(169, 138, 216, .2); }
.form-label { font-weight: 700; font-size: .85rem; color: var(--ink-soft); margin-bottom: .3rem; }
.input-group > .form-control.time-input { border-top-right-radius: 0; border-bottom-right-radius: 0; }

.color-picker, .icon-picker { display: flex; flex-wrap: wrap; gap: .45rem; }
.color-swatch input, .icon-swatch input { position: absolute; opacity: 0; width: 0; height: 0; }
.color-swatch { position: relative; cursor: pointer; }
.color-swatch span {
    display: block;
    width: 32px; height: 32px;
    border-radius: 999px;
    background: var(--tile);
    border: 3px solid #fff;
    box-shadow: 0 0 0 1px var(--line);
    transition: transform .1s;
}
.color-swatch input:checked + span { transform: scale(1.15); box-shadow: 0 0 0 2px var(--tile); }
.icon-swatch { position: relative; cursor: pointer; }
.icon-swatch span {
    width: 40px; height: 40px;
    border-radius: 12px;
    display: inline-flex; align-items: center; justify-content: center;
    background: #fff;
    border: 1px solid var(--line);
    color: var(--ink-soft);
}
.icon-swatch input:checked + span { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }

/* ---------- login ---------- */
.login-wrap { min-height: calc(100vh - 3rem); display: flex; align-items: center; justify-content: center; }
.login-card {
    width: 100%;
    max-width: 400px;
    background: var(--card);
    border-radius: 24px;
    padding: 2rem 1.75rem;
    box-shadow: 0 16px 40px rgba(120, 70, 100, .14);
}
.login-logo { width: 72px; height: 72px; border-radius: 20px; box-shadow: 0 8px 22px rgba(200, 110, 160, .3); }

/* ---------- wachtwoordveld met knoppen (admin) ---------- */
.pw-group .pw-input { font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace; letter-spacing: .02em; }
.pw-group .pw-btn { border-radius: 0 !important; padding: .375rem .65rem; font-size: .9rem; }
.pw-group .pw-btn:last-child { border-radius: 0 12px 12px 0 !important; }
.pw-group > .form-control.pw-input { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.pw-group .pw-generate { background: linear-gradient(100deg, #f7c6da, #dcc9f2); color: var(--ink); }
.pw-group .pw-generate:hover { filter: brightness(1.03); color: var(--ink) !important; }

/* ---------- tabel (admin) ---------- */
.user-table thead th { border-bottom: 1px solid var(--line); padding: .8rem 1rem; }
.user-table td { padding: .7rem 1rem; border-top: 1px solid var(--line); }
