/* ============================================================
   yavem — Design-System (customizable via Settings)
   Inspiriert vom Linol-/Stempel-Logo: Korallrot, Petrol, Off-White
   Schrift: Raleway
   ============================================================ */

:root {
    --c-coral:     #E94E2B;
    --c-coral-dk:  #C73F1F;
    --c-petrol:    #2E6E78;
    --c-petrol-dk: #1F4F57;
    --c-sand:      #F4C95D;
    --c-cream:     #FAF5EE;
    --c-cream-dk:  #F0E8DA;
    --c-ink:       #1E2B2E;
    --c-ink-soft:  #4A5A5E;
    --c-line:      rgba(30, 43, 46, 0.12);

    --radius:      14px;
    --radius-lg:   22px;
    --shadow-sm:   0 2px 0 0 var(--c-ink);
    --shadow-md:   0 4px 0 0 var(--c-ink);
    --shadow-lg:   0 6px 0 0 var(--c-ink);

    --font-body:   'Raleway', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
img { max-width: 100%; display: block; }
a { color: var(--c-coral-dk); text-decoration: none; }
a:hover { color: var(--c-coral); text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; }

body {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: 17px;
    line-height: 1.55;
    color: var(--c-ink);
    background: var(--c-cream);
    background-image:
        radial-gradient(circle at 12% 18%, rgba(233, 78, 43, 0.06) 0%, transparent 28%),
        radial-gradient(circle at 88% 82%, rgba(46, 110, 120, 0.06) 0%, transparent 28%);
    min-height: 100vh;
}

h1, h2, h3, h4 {
    font-weight: 800;
    color: var(--c-petrol-dk);
    letter-spacing: -0.01em;
    line-height: 1.15;
    margin: 0 0 0.5em;
}
h1 { font-size: clamp(2rem, 4.5vw, 3.2rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2.1rem); margin-top: 1.6em; }
h3 { font-size: 1.25rem; margin-top: 1.3em; color: var(--c-coral-dk); }

p { margin: 0 0 1em; }

/* ---- Layout ---- */
.container {
    /* Fluid bis 2000px, immer 24px Rand pro Seite. Auf schmalen
       Screens = 100vw - 48px, auf 4K = bis 2000px. */
    max-width: min(2000px, calc(100vw - 48px));
    margin: 0 auto;
    padding: 0 24px;
}

/* ---- Header ---- */
.site-header {
    padding: 22px 0;
    border-bottom: 2px solid var(--c-line);
    background: var(--c-cream);
    position: sticky;
    top: 0;
    z-index: 50;
}
.site-header .container {
    display: flex;
    align-items: center;
    gap: 24px;
    flex-wrap: wrap;
}
.brand {
    display: flex;
    align-items: center;
    gap: 14px;
    text-decoration: none;
    color: var(--c-ink);
}
.brand:hover { text-decoration: none; }
.brand img {
    width: 56px; height: 56px;
    border-radius: 50%;
    border: 2px solid var(--c-ink);
    background: white;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-title {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--c-petrol-dk);
    letter-spacing: -0.01em;
}
.brand-subtitle {
    font-size: 0.82rem;
    color: var(--c-ink-soft);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
}

.nav-burger {
    display: none;
    margin-left: auto;
    background: transparent;
    border: 2px solid var(--c-ink);
    border-radius: 10px;
    padding: 8px 10px;
    cursor: pointer;
    box-shadow: 2px 2px 0 0 var(--c-ink);
}
.nav-burger span {
    display: block;
    width: 22px; height: 3px;
    background: var(--c-ink);
    margin: 4px 0;
    border-radius: 2px;
    transition: transform 0.2s, opacity 0.2s;
}
.nav.open ~ .nav-burger span:nth-child(1),
.nav-burger[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-burger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-burger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
.nav { margin-left: auto; display: flex; gap: 2px; flex-wrap: wrap; align-items: center; min-height: 40px; }
.nav a {
    padding: 7px 13px;
    border-radius: 999px;
    color: var(--c-ink);
    font-weight: 600;
    font-size: 0.95rem;
    line-height: 1.35;
    border: 2px solid transparent;
    box-sizing: border-box;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
}
.nav a:hover { background: var(--c-cream-dk); text-decoration: none; }
.nav a.active {
    background: var(--c-petrol);
    color: white;
    border-color: var(--c-ink);
}
.nav-sep {
    display: inline-block;
    width: 1px;
    height: 22px;
    background: var(--c-line);
    margin: 0 8px;
}
.nav-user {
    background: var(--c-cream-dk);
    font-size: 0.85rem !important;
    color: var(--c-ink-soft) !important;
}
.nav-dropdown { position: relative; display: inline-block; }
.nav-dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 6px); right: 0;
    background: white;
    border: 2px solid var(--c-ink);
    border-radius: 12px;
    box-shadow: 0 4px 0 0 var(--c-ink);
    min-width: 200px;
    padding: 6px;
    z-index: 60;
}
.nav-dropdown.open .nav-dropdown-menu { display: block; }
.nav-dropdown-menu a {
    display: block;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 0.9rem;
    color: var(--c-ink);
}
.nav-dropdown-menu a:hover { background: var(--c-cream); }

/* ---- Hero ---- */
.hero {
    padding: 64px 0 48px;
    text-align: center;
    position: relative;
}
.hero .stamp {
    width: 140px; height: 140px;
    margin: 0 auto 24px;
    border-radius: 50%;
    border: 3px solid var(--c-ink);
    background: white;
    box-shadow: var(--shadow-md);
    overflow: hidden;
    transform: rotate(-3deg);
    transition: transform 0.4s ease;
}
.hero .stamp:hover { transform: rotate(2deg) scale(1.04); }
.hero .stamp img { width: 100%; height: 100%; object-fit: cover; }
.hero h1 { margin-bottom: 12px; }
.hero .lead {
    font-size: 1.15rem;
    color: var(--c-ink-soft);
    max-width: 620px;
    margin: 0 auto 32px;
}

/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 26px;
    background: var(--c-coral);
    color: white !important;
    border: 2px solid var(--c-ink);
    border-radius: var(--radius);
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: transform 0.1s ease, box-shadow 0.1s ease;
    text-decoration: none !important;
    font-family: inherit;
}
.btn:hover { background: var(--c-coral-dk); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.btn:active { transform: translateY(1px); box-shadow: 0 1px 0 0 var(--c-ink); }
.btn.btn-secondary { background: var(--c-petrol); }
.btn.btn-secondary:hover { background: var(--c-petrol-dk); }
.btn.btn-ghost { background: transparent; color: var(--c-ink) !important; }
.btn.btn-ghost:hover { background: var(--c-cream-dk); }

/* ---- Cards / Tiles ---- */
.tiles {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 22px;
    margin: 32px 0;
}
.tile {
    background: white;
    border: 2px solid var(--c-ink);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-md);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    text-decoration: none;
    color: var(--c-ink);
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.tile:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); text-decoration: none; }
.tile .icon {
    width: 48px; height: 48px;
    border-radius: 12px;
    background: var(--c-cream-dk);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.5rem;
}
.tile h3 { margin: 0; color: var(--c-petrol-dk); }
.tile p { color: var(--c-ink-soft); margin: 0; font-size: 0.95rem; }

/* ---- Section / Card ---- */
.section { padding: 32px 0; }
.card {
    background: white;
    border: 2px solid var(--c-ink);
    border-radius: var(--radius-lg);
    padding: 28px 30px;
    box-shadow: var(--shadow-md);
    margin: 24px 0;
}

/* ---- Tabelle ---- */
table.data {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
    background: white;
    border: 2px solid var(--c-ink);
    border-radius: var(--radius);
    overflow: hidden;
}
table.data th, table.data td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--c-line); overflow-wrap: anywhere; word-break: break-word; }
table.data th {
    background: var(--c-petrol);
    color: white;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.78rem;
    letter-spacing: 0.06em;
}
table.data tr:last-child td { border-bottom: none; }
table.data tr:hover td { background: var(--c-cream); }
.amount { font-variant-numeric: tabular-nums; text-align: right; font-weight: 600; }
.amount.positive { color: var(--c-petrol-dk); }
.amount.negative { color: var(--c-coral-dk); }

/* ---- Empty State ---- */
.empty-state {
    text-align: center;
    padding: 36px 20px;
    color: var(--c-ink-soft);
}
.empty-state .icon { font-size: 2.4rem; opacity: 0.6; margin-bottom: 10px; }
.empty-state h3 { color: var(--c-petrol-dk); margin: 0 0 6px; }
.empty-state p { margin: 0 0 12px; }

/* ---- Inline-Kategorie-Dropdown in Tabellen ---- */
.kat-select {
    appearance: none;
    -webkit-appearance: none;
    min-width: 150px;
    padding: 6px 28px 6px 12px;
    border: 1.5px solid var(--c-line);
    border-radius: 999px;
    background: white;
    color: var(--c-ink);
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path d='M1 1l4 4 4-4' stroke='%232E6E78' stroke-width='1.6' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>");
    background-repeat: no-repeat;
    background-position: right 12px center;
}
.kat-select:hover { border-color: var(--c-petrol); }
.kat-select:focus { outline: none; border-color: var(--c-petrol); box-shadow: 0 0 0 3px rgba(46,110,120,0.15); }

/* ---- Forms ---- */
form .field { margin-bottom: 18px; }
form label { display: block; font-weight: 600; margin-bottom: 6px; color: var(--c-petrol-dk); }
form input[type="text"], form input[type="email"], form input[type="file"], form input[type="number"], form input[type="date"], form input[type="password"], form input[type="tel"], form input[type="search"], form input[type="url"], form textarea, form select {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid var(--c-ink);
    border-radius: var(--radius);
    background: white;
    font-family: inherit;
    font-size: 1rem;
    color: var(--c-ink);
    box-sizing: border-box;
}
form select {
    appearance: none;
    -webkit-appearance: none;
    padding-right: 38px;
    cursor: pointer;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path d='M1 1l5 5 5-5' stroke='%231E2B2E' stroke-width='2' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>");
    background-repeat: no-repeat;
    background-position: right 14px center;
}
form input:focus, form textarea:focus, form select:focus {
    outline: none;
    box-shadow: 0 0 0 4px rgba(46, 110, 120, 0.2);
}

/* ---- Alerts ---- */
.alert {
    padding: 14px 18px;
    border: 2px solid var(--c-ink);
    border-radius: var(--radius);
    background: var(--c-sand);
    font-weight: 600;
    box-shadow: var(--shadow-sm);
    margin: 16px 0;
}
.alert.info { background: #BFE3E8; }
.alert.success { background: #C7E6B5; }
.alert.warn { background: var(--c-sand); }

/* ---- Badges ---- */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    border: 2px solid var(--c-ink);
    background: white;
}
.badge.coral { background: var(--c-coral); color: white; }
.badge.petrol { background: var(--c-petrol); color: white; }
.badge.sand { background: var(--c-sand); }

/* ---- Footer ---- */
.site-footer {
    border-top: 2px dashed var(--c-line);
    padding: 32px 0;
    margin-top: 80px;
    text-align: center;
    color: var(--c-ink-soft);
    font-size: 0.9rem;
}
.site-footer a { color: var(--c-petrol-dk); }

/* ---- Help-Page TOC ---- */
.toc {
    background: var(--c-cream-dk);
    border: 2px solid var(--c-ink);
    border-radius: var(--radius);
    padding: 18px 22px;
    margin: 24px 0 32px;
}
.toc h4 { margin: 0 0 10px; color: var(--c-petrol-dk); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.08em; }
.toc ul { margin: 0; padding-left: 20px; }
.toc li { margin: 4px 0; }

code, pre {
    font-family: 'JetBrains Mono', 'SF Mono', Menlo, monospace;
    background: var(--c-cream-dk);
    padding: 2px 6px;
    border-radius: 6px;
    font-size: 0.9em;
}
pre { padding: 16px; overflow-x: auto; border: 2px solid var(--c-line); }

/* ---- Stamp/Texture-Effekt ---- */
.stamp-frame {
    border: 3px solid var(--c-coral);
    border-radius: 50%;
    padding: 4px;
    background: white;
    display: inline-block;
}

/* ---- Mitglied-werden Form Grid ---- */
.mw-row-3 { display: grid; gap: 14px; grid-template-columns: 120px 1fr 1fr; }
.mw-row-2 { display: grid; gap: 14px; grid-template-columns: 1fr 1fr; }
.mw-row-narrow { display: grid; gap: 14px; grid-template-columns: 120px 1fr; }
.mw-row-money { display: grid; gap: 14px; grid-template-columns: 200px 1fr; }
/* Default min-width: auto bei Grid-Children laesst Inputs (besonders <input type=date>)
   ueber die Track-Breite hinauswachsen. min-width:0 erlaubt korrektes Schrumpfen. */
.mw-row-3 > *, .mw-row-2 > *, .mw-row-narrow > *, .mw-row-money > * { min-width: 0; max-width: 100%; }

/* iOS Safari: <input type=date> hat eigene intrinsic Mindestbreite, ignoriert
   width:100%. Mit -webkit-appearance:none + explizit min-width:0 wird das
   Native-Control auf flexible Box reduziert. */
input[type="date"], input[type="time"], input[type="datetime-local"] {
    -webkit-appearance: none;
    -moz-appearance: textfield;
    appearance: none;
    min-width: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
}
.mw-headline { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-bottom: 6px; flex-wrap: wrap; }

@media (max-width: 640px) {
    .mw-row-3, .mw-row-2, .mw-row-narrow, .mw-row-money { grid-template-columns: 1fr; }
    .mw-headline h1 { font-size: 1.6rem; line-height: 1.1; }
}

/* Responsive */
@media (max-width: 760px) {
    .site-header .container { padding: 12px 16px; flex-wrap: wrap; }
    .brand img { width: 44px; height: 44px; }
    .brand-title { font-size: 1rem; }
    .brand-subtitle { font-size: 0.7rem; }
    .hero { padding: 40px 0 32px; }
    .hero .stamp { width: 110px; height: 110px; }

    .nav-burger { display: block; }
    .nav {
        display: none;
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
        width: 100%;
        margin: 14px 0 0;
        padding: 14px;
        background: var(--c-cream);
        border: 2px solid var(--c-ink);
        border-radius: 14px;
        box-shadow: 3px 3px 0 0 var(--c-ink);
    }
    .nav.open { display: flex; }
    .nav a { padding: 10px 14px; font-size: 1rem; text-align: left; }
    .nav-sep { display: none; }
    .nav-dropdown { width: 100%; }
    .nav-dropdown > a { display: flex; justify-content: space-between; align-items: center; }
    .nav-dropdown-menu {
        position: static !important;
        margin: 6px 0 0 12px !important;
        box-shadow: none !important;
        border: 1px dashed var(--c-line) !important;
        min-width: 0 !important;
    }
}
