* { box-sizing: border-box; }
:root {
    --bg: #eef8ff;
    --card: #ffffff;
    --text: #0f2336;
    --muted: #66788a;
    --primary: #00a8e8;
    --primary-dark: #0077c8;
    --success: #13a66f;
    --danger: #e44c4c;
    --gold: #ffc933;
    --line: #dbeaf5;
    --shadow: 0 18px 55px rgba(14, 70, 120, .14);
    --radius: 24px;
}
html, body { margin: 0; min-height: 100%; background: linear-gradient(180deg, #dff5ff 0%, var(--bg) 34%, #f8fbff 100%); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif; }
body { padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom); }
a { color: inherit; text-decoration: none; }
.app-shell { width: min(100%, 620px); margin: 0 auto; min-height: 100vh; }
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; backdrop-filter: blur(16px); background: rgba(238, 248, 255, .84); border-bottom: 1px solid rgba(255,255,255,.72); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: -.02em; }
.brand img { border-radius: 12px; box-shadow: 0 8px 20px rgba(0, 131, 204, .18); }
.top-actions { display: flex; gap: 8px; align-items: center; font-size: 14px; }
.top-actions a { padding: 8px 10px; border-radius: 999px; background: rgba(255,255,255,.75); color: var(--primary-dark); font-weight: 700; }
.content { padding: 16px 14px 36px; }
h1, h2, p { margin-top: 0; }
h1 { font-size: clamp(28px, 7vw, 42px); margin-bottom: 6px; letter-spacing: -.04em; }
h2 { font-size: 19px; margin-bottom: 12px; letter-spacing: -.025em; }
.muted { color: var(--muted); }
.notice { padding: 12px 14px; border-radius: 16px; margin-bottom: 12px; font-weight: 700; background: #eaf9f2; color: #0a6c45; border: 1px solid #c9efdc; }
.notice.error { background: #fff0f0; color: #a52828; border-color: #ffd1d1; }
.hero-card, .card, .child-card, .account-hero { background: rgba(255,255,255,.92); border: 1px solid rgba(255,255,255,.9); box-shadow: var(--shadow); border-radius: var(--radius); }
.login-card { margin-top: 18px; padding: 26px 20px; text-align: center; overflow: hidden; position: relative; }
.login-card:before { content: ""; position: absolute; inset: -100px -90px auto auto; width: 220px; height: 220px; background: radial-gradient(circle, rgba(255,201,51,.42), transparent 65%); }
.login-logo { width: 118px; height: 118px; border-radius: 28px; box-shadow: 0 20px 46px rgba(0,128,220,.25); margin-bottom: 14px; }
.form-stack { display: grid; gap: 12px; text-align: left; }
.form-stack.compact { gap: 10px; }
label { display: grid; gap: 6px; min-width: 0; color: #365169; font-size: 14px; font-weight: 800; }
input, select { width: 100%; min-width: 0; max-width: 100%; display: block; border: 1px solid var(--line); border-radius: 16px; padding: 13px 13px; font-size: 16px; background: #fbfdff; color: var(--text); outline: none; }
input:focus, select:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(0,168,232,.12); }
.form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; align-items: start; }
.checkline { display: flex; align-items: center; gap: 10px; font-size: 15px; }
.checkline input { width: 20px; height: 20px; }
.btn { border: 0; border-radius: 17px; padding: 14px 16px; font-size: 16px; font-weight: 900; cursor: pointer; color: white; background: var(--primary); box-shadow: 0 10px 24px rgba(0, 131, 204, .19); }
.btn.primary { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); }
.btn.secondary { background: #173e63; }
.btn.success { background: var(--success); }
.btn.danger { background: var(--danger); }
.btn.outline { background: transparent; color: var(--danger); border: 1px solid #ffd1d1; box-shadow: none; }
.button-row { display: grid; gap: 10px; }
.button-row.two { grid-template-columns: 1fr 1fr; }
.page-title { padding: 10px 2px 6px; }
.page-title p { color: var(--muted); margin-bottom: 8px; }
.children-grid { display: grid; gap: 13px; }
.child-card { display: block; padding: 18px; transition: transform .16s ease, box-shadow .16s ease; }
.child-card:active { transform: scale(.985); }
.child-card-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.avatar { width: 48px; height: 48px; display: inline-grid; place-items: center; border-radius: 18px; background: linear-gradient(135deg, #00c2ff, #006de8); color: white; font-weight: 900; font-size: 24px; box-shadow: 0 10px 25px rgba(0,130,215,.2); }
.child-card h2 { margin: 0; }
.balance { font-weight: 950; letter-spacing: -.05em; }
.balance.big { font-size: 36px; margin: 6px 0 10px; }
.balance.huge { font-size: clamp(34px, 11vw, 56px); color: white; text-shadow: 0 4px 20px rgba(0,0,0,.17); }
.last-booking { margin: 0 0 12px; font-size: 14px; }
.pill { display: inline-flex; width: fit-content; align-items: center; border-radius: 999px; padding: 7px 10px; background: #fff5cf; color: #805a00; font-size: 13px; font-weight: 800; }
.muted-pill { background: #edf3f8; color: var(--muted); }
.account-hero { padding: 20px; margin-bottom: 14px; background: radial-gradient(circle at 10% 0%, rgba(255,201,51,.4), transparent 34%), linear-gradient(135deg, #00b7ef, #006de8); color: white; overflow: hidden; }
.account-hero p { margin-bottom: 12px; opacity: .9; font-weight: 700; }
.back-link { display: inline-flex; margin-bottom: 10px; color: rgba(255,255,255,.9); font-weight: 800; }
.card { padding: 17px; margin-bottom: 14px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.section-head h2 { margin: 0; }
.section-head span { color: var(--muted); font-size: 13px; font-weight: 800; }
.chart-card canvas { width: 100%; height: 180px; display: block; }
.transactions { display: grid; gap: 10px; }
.tx-item { display: grid; grid-template-columns: 1fr auto; gap: 12px; padding: 13px; border-radius: 18px; background: #f8fbff; border: 1px solid var(--line); }
.tx-date { color: var(--muted); font-size: 12px; font-weight: 800; margin-bottom: 4px; }
.tx-main strong { display: block; margin-bottom: 4px; }
.tx-side { display: grid; align-content: start; justify-items: end; gap: 8px; }
.tx-amount { font-weight: 950; font-size: 17px; white-space: nowrap; }
.tx-amount.positive { color: var(--success); }
.tx-amount.negative { color: var(--danger); }
.tx-actions { display: flex; gap: 8px; }
.tx-actions form { margin: 0; }
.link-btn { appearance: none; border: 0; background: transparent; color: var(--primary-dark); font-weight: 900; padding: 0; font-size: 12px; cursor: pointer; }
.danger-link { color: var(--danger); }
.user-list { display: grid; gap: 14px; }
.user-edit { display: grid; gap: 10px; padding: 14px; border: 1px solid var(--line); border-radius: 18px; background: #f8fbff; }
@media (max-width: 560px) {
    .form-row { grid-template-columns: 1fr; }
}
@media (max-width: 420px) {
    .content { padding-left: 12px; padding-right: 12px; }
    .button-row.two { grid-template-columns: 1fr; }
    .top-actions a { padding: 7px 8px; font-size: 13px; }
    .tx-item { grid-template-columns: 1fr; }
    .tx-side { justify-items: start; }
}


/* v1.4: iOS/Safari-Fix für Formularfelder.
   Das native date-input kann auf iPhones eine eigene Mindestbreite erzwingen.
   Deshalb wird das Buchungsformular explizit als einspaltiges Formular gesetzt
   und das Date-Feld optisch als normales Textfeld gerendert. */
.booking-form,
.allowance-form,
.booking-form *,
.allowance-form * {
    min-width: 0;
    max-width: 100%;
}
.booking-form .form-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 12px;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
}
.booking-form label,
.allowance-form label {
    width: 100%;
    max-width: 100%;
    overflow: hidden;
}
.booking-form input,
.allowance-form input,
.allowance-form select {
    width: 100% !important;
    inline-size: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    max-inline-size: 100% !important;
    box-sizing: border-box !important;
}
.booking-form input[type="date"] {
    -webkit-appearance: none;
    appearance: none;
    display: block;
    width: 100% !important;
    inline-size: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    max-inline-size: 100% !important;
    text-align: left;
    line-height: normal;
}
.booking-form input[type="date"]::-webkit-date-and-time-value {
    text-align: left;
    min-width: 0;
    max-width: 100%;
    margin: 0;
}
@media (max-width: 760px) {
    .card { overflow: hidden; }
    .booking-form .form-row { display: block !important; }
    .booking-form .form-row > label { display: grid; margin-bottom: 12px; }
    .booking-form .form-row > label:last-child { margin-bottom: 0; }
}
