/* Detergentinfo – Pernauer Chemiewerke */
:root {
    --green: #a4b11e;
    --green-dark: #84900f;
    --green-soft: #f3f6dc;
    --grey: #a8a9ad;
    --ink: #2b2f36;
    --ink-2: #4a505a;
    --muted: #7a808a;
    --line: #e3e5e8;
    --bg: #f5f6f4;
    --header: rgba(43, 47, 54, .96);
    --blue: #5b93c9;
    --danger: #c0392b;
    --radius: 14px;
    --shadow: 0 1px 2px rgba(20, 24, 30, .06), 0 8px 28px rgba(20, 24, 30, .08);
    --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
    font-family: var(--font);
    color: var(--ink);
    background: var(--bg);
    line-height: 1.55;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
}
main { flex: 1; }
a { color: var(--green-dark); }
a:hover { color: var(--ink); }
h1, h2 { line-height: 1.2; margin: 0 0 .4em; }
h1 { font-size: clamp(1.6rem, 3vw, 2.1rem); font-weight: 700; }
h2 { font-size: 1.2rem; }
.wrap { width: min(1180px, 100% - 2.5rem); margin-inline: auto; }
.narrow { width: min(460px, 100% - 2.5rem); }
.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mono, .chip-ufi { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; }

/* ---------- Header ---------- */
.site-header {
    background: var(--header);
    position: sticky; top: 0; z-index: 10;
    backdrop-filter: blur(6px);
    box-shadow: 0 1px 0 rgba(255,255,255,.06);
}
.header-inner { display: flex; align-items: center; justify-content: center; gap: 1rem; min-height: 76px; }
.brand img { height: 58px; width: auto; display: block; }
.main-nav { display: flex; align-items: center; gap: .25rem; flex-wrap: wrap; justify-content: center; }
.main-nav a, .nav-btn {
    color: #e9ecc8; text-decoration: none; font-size: .95rem;
    padding: .5rem .8rem; border-radius: 8px; background: none; border: 0; cursor: pointer; font: inherit;
}
.main-nav a:hover, .nav-btn:hover { color: #fff; background: rgba(255,255,255,.08); }
.main-nav a.active { color: var(--green); box-shadow: inset 0 -2px 0 var(--green); border-radius: 0; }
.inline { display: inline; margin: 0; }
.badge { display: inline-block; min-width: 1.3em; padding: 0 .4em; border-radius: 99px; background: var(--green); color: #1d2008; font-size: .75rem; font-weight: 700; text-align: center; }

/* ---------- Hero / Suche ---------- */
.page-home main { display: flex; flex-direction: column; }
.page-home .hero { flex: 1; display: flex; align-items: center; }
.hero {
    position: relative; overflow: hidden;
    background:
        radial-gradient(1200px 500px at 85% -10%, rgba(164,177,30,.55), transparent 60%),
        radial-gradient(900px 500px at -10% 110%, rgba(164,177,30,.35), transparent 60%),
        linear-gradient(160deg, #39404a 0%, #2b2f36 60%, #262a30 100%);
    color: #fff;
    padding: clamp(2.5rem, 7vw, 5.5rem) 0 clamp(3rem, 8vw, 6rem);
}
.hero-inner { position: relative; max-width: 780px; }
.eyebrow { text-transform: uppercase; letter-spacing: .14em; font-size: .78rem; color: var(--green); font-weight: 700; margin: 0 0 .6rem; }
.hero h1 { font-size: clamp(2rem, 5vw, 3.2rem); margin-bottom: 1.2rem; }
.intro { font-size: 1.06rem; color: #dfe2e6; max-width: 70ch; }
.intro p { margin: 0 0 .9rem; }
.intro .inci { color: inherit; }
.intro .inci a { color: #fff; word-break: break-all; }

.search-card {
    margin-top: 2rem;
    background: #fff; color: var(--ink);
    border-radius: var(--radius); box-shadow: 0 20px 60px rgba(0,0,0,.3);
    padding: 1.4rem;
}
.seg { border: 0; padding: 4px; margin: 0 0 1rem; display: inline-flex; background: #eef0f2; border-radius: 10px; }
.seg label { cursor: pointer; }
.seg input { position: absolute; opacity: 0; }
.seg span { display: block; padding: .45rem 1.1rem; border-radius: 7px; font-weight: 600; color: var(--ink-2); font-size: .95rem; transition: .15s; }
.seg input:checked + span { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.seg input:focus-visible + span { outline: 2px solid var(--green); }
.search-row { display: flex; gap: .7rem; }
.search-row input {
    flex: 1; min-width: 0; font-size: 1.2rem; letter-spacing: .03em;
    padding: .85rem 1rem; border: 2px solid var(--line); border-radius: 10px; outline: none;
    font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
}
.search-row input:focus { border-color: var(--green); box-shadow: 0 0 0 4px rgba(164,177,30,.18); }
.btn-search { font-size: 1.05rem; padding-inline: 1.5rem; }
.search-error { margin: .8rem 0 0; color: var(--danger); font-weight: 600; }
.hint { margin: .8rem 0 0; color: var(--muted); font-size: .9rem; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
    font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
    padding: .7rem 1.2rem; border-radius: 10px; border: 1.5px solid transparent;
    transition: background .15s, border-color .15s, color .15s, transform .05s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--green); color: #fff; }
.btn-primary:hover { background: var(--green-dark); color: #fff; }
.btn-ghost { background: #fff; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--green); color: var(--ink); }
.btn-danger { background: #fff; color: var(--danger); border-color: #f0d0cc; }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-small { padding: .4rem .75rem; font-size: .85rem; border-radius: 8px; }
.btn-block { width: 100%; }

/* ---------- Ergebnis / PDF ---------- */
.page-result main { display: flex; flex-direction: column; padding-bottom: 1.5rem; }
.result-bar { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; padding: 1.5rem 0 1rem; }
.result-bar h1 { font-size: clamp(1.3rem, 2.5vw, 1.8rem); margin: .3rem 0 .4rem; }
.back { text-decoration: none; font-weight: 600; font-size: .9rem; }
.result-actions { display: flex; gap: .6rem; flex-wrap: wrap; }
.codes { display: flex; flex-wrap: wrap; gap: .35rem; margin: 0; }
.chip { font-size: .78rem; background: var(--green-soft); color: #5b6410; border-radius: 99px; padding: .15rem .6rem; font-weight: 600; white-space: nowrap; }
.pdf-frame-wrap { flex: 1; display: flex; flex-direction: column; }
.pdf-frame { flex: 1; width: 100%; min-height: 75vh; border: 0; border-radius: var(--radius); background: #525659; box-shadow: var(--shadow); }
.pdf-fallback { color: var(--muted); font-size: .85rem; margin: .6rem 0 0; }

/* ---------- Karten & Formulare ---------- */
.card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.6rem; }
.auth-card { margin: 3rem 0; }
.form { display: grid; gap: 1rem; }
.form label { display: grid; gap: .35rem; font-weight: 600; font-size: .92rem; color: var(--ink-2); }
.form label small { font-weight: 400; color: var(--muted); }
.form input[type=text], .form input[type=email], .form input[type=password], .form textarea, .filter input {
    font: inherit; font-weight: 400; color: var(--ink);
    padding: .65rem .8rem; border: 1.5px solid var(--line); border-radius: 9px; background: #fff; width: 100%;
}
.form textarea { resize: vertical; }
.form input:focus, .form textarea:focus, .filter input:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 4px rgba(164,177,30,.15); }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.field-note { margin: -.4rem 0 0; color: var(--muted); font-size: .85rem; }
.form-actions { display: flex; gap: .6rem; flex-wrap: wrap; }
.auth-switch { text-align: center; margin: 1.2rem 0 0; color: var(--muted); }

.dropzone { position: relative; }
.dropzone input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.dropzone label {
    display: flex !important; flex-direction: column; align-items: center; gap: .3rem; text-align: center;
    border: 2px dashed #cfd3c0; border-radius: 12px; padding: 1.4rem 1rem; color: var(--ink-2) !important;
    background: #fafbf6; transition: .15s;
}
.dropzone svg { color: var(--green); }
.dropzone.is-over label, .dropzone:hover label { border-color: var(--green); background: var(--green-soft); }
.dropzone.has-file label { border-style: solid; border-color: var(--green); background: var(--green-soft); }

.alert { padding: .75rem 1rem; border-radius: 10px; margin-bottom: .8rem; font-size: .95rem; border: 1px solid; }
.alert-error { background: #fdf0ee; border-color: #f4cfc9; color: #8f2a1f; }
.alert-success { background: #f3f7dd; border-color: #dbe4a4; color: #4d5509; }
.alert-info { background: #eef4fa; border-color: #cfe0f0; color: #2c5379; }
.flashes { padding-top: 1rem; }
.flashes .alert { margin: 0 0 .5rem; }

.success-state { text-align: center; }
.success-icon { width: 64px; height: 64px; margin: 0 auto 1rem; border-radius: 50%; background: var(--green); color: #fff; display: grid; place-items: center; font-size: 2rem; }

/* ---------- Dashboard ---------- */
.dash { padding: 2rem 0 3rem; }
.dash-head { margin-bottom: 1.5rem; }
.dash-head p { margin: 0; }
.dash-grid { display: grid; grid-template-columns: minmax(320px, 440px) 1fr; gap: 1.5rem; align-items: start; }
.dash-grid > .card:first-child { position: sticky; top: 96px; }
.list-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.list-head h2 { margin: 0; }
.count { font-size: .8rem; background: #eef0f2; color: var(--ink-2); border-radius: 99px; padding: .1rem .55rem; vertical-align: middle; }
.filter input { width: 260px; max-width: 100%; }
.list-tools { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.btn-export { white-space: nowrap; }
.btn-export svg { color: var(--green-dark); }
.plist { list-style: none; margin: 0; padding: 0; }
.plist li { display: flex; justify-content: space-between; gap: 1rem; padding: 1rem 0; border-top: 1px solid var(--line); align-items: center; }
.plist li.is-editing { background: var(--green-soft); margin: 0 -1rem; padding-inline: 1rem; border-radius: 10px; }
.pmain { display: grid; gap: .35rem; min-width: 0; }
.pname { font-weight: 700; color: var(--ink); text-decoration: none; }
.pname:hover { color: var(--green-dark); text-decoration: underline; }
.code-cols { display: grid; grid-template-columns: minmax(9.5rem, max-content) minmax(13rem, max-content); gap: .3rem 1.5rem; margin: .15rem 0 .1rem; }
.code-col { display: flex; flex-direction: column; align-items: flex-start; gap: .3rem; }
.code-col-head { font-size: .7rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.code-col .chip { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: .8rem; }
.pactions { display: flex; gap: .4rem; flex-shrink: 0; }
.pactions form, .actions form { margin: 0; }
.form label > small { display: inline; }
.empty { color: var(--muted); padding: 2rem 0; text-align: center; }

.table-wrap { overflow-x: auto; }
.utable { width: 100%; border-collapse: collapse; font-size: .93rem; }
.utable th { text-align: left; font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: .6rem .7rem; border-bottom: 1.5px solid var(--line); }
.utable td { padding: .8rem .7rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.utable .right { text-align: right; }
.utable .actions > div { display: flex; gap: .35rem; justify-content: flex-end; flex-wrap: wrap; }
.row-pending { background: #fffbea; }
.status { font-size: .78rem; font-weight: 700; padding: .2rem .6rem; border-radius: 99px; white-space: nowrap; }
.status-pending { background: #fff1c2; color: #7a5b00; }
.status-approved { background: var(--green-soft); color: #5b6410; }
.status-blocked { background: #fbe3e0; color: #8f2a1f; }

.search-label { margin: 0 0 .7rem; font-weight: 700; color: var(--ink-2); font-size: .95rem; }
.settings-card { margin-bottom: 1.5rem; }
.dash .card h2 { margin-bottom: 1rem; }
.setting-row { margin: 0; }
.setting-row + .setting-row { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.switch { display: flex; align-items: center; gap: .9rem; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.slider { flex-shrink: 0; width: 46px; height: 26px; border-radius: 99px; background: #cfd3d8; position: relative; transition: background .15s; }
.slider::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .15s; }
.switch input:checked + .slider { background: var(--green); }
.switch input:checked + .slider::after { transform: translateX(20px); }
.switch input:focus-visible + .slider { outline: 2px solid var(--green-dark); outline-offset: 2px; }
.switch-text { display: grid; gap: .1rem; }
.switch-text small { color: var(--muted); }

.pw-row td { background: var(--green-soft); border-bottom: 1px solid var(--line); }
.pw-form { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin: 0; }
.pw-title { margin-right: .4rem; }
.pw-form input[type=password] { font: inherit; padding: .45rem .7rem; border: 1.5px solid var(--line); border-radius: 8px; width: 240px; max-width: 100%; }
.pw-form input[type=password]:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px rgba(164,177,30,.18); }

/* ---------- Footer ---------- */
.site-footer { background: #23272d; color: #9aa0a8; font-size: .85rem; margin-top: auto; }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: center; text-align: center; gap: .5rem; padding: 1.2rem 0; }
.site-footer a { color: #c9d06a; text-decoration: none; }
.site-footer a:hover { color: #fff; }
.sep { opacity: .4; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
    .dash-grid { grid-template-columns: 1fr; }
    .dash-grid > .card:first-child { position: static; }
}
@media (max-width: 640px) {
    .header-inner { padding: .5rem 0; min-height: 60px; }
    .search-row { flex-direction: column; }
    .two-col { grid-template-columns: 1fr; }
    .code-cols { grid-template-columns: 1fr 1fr; }
    .plist li { flex-direction: column; align-items: flex-start; }
    .pdf-frame { min-height: 65vh; }
}
