/* =============================================
   PENNYKIT – Stylesheet (Portal + Admin)
   Schlicht, hell, Akzentfarbe pro Marke.
   Stilregel: nirgends font-style italic.
   ============================================= */

:root {
    --accent: #92c412;
    --ink: #111111;
    --ink-soft: #555555;
    --line: #e5e5e5;
    --bg: #ffffff;
    --bg-soft: #f7f7f7;
    --radius: 10px;
    --sidebar-w: 230px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--ink);
    background: var(--bg);
    line-height: 1.55;
}

h1, h2, h3 { line-height: 1.2; font-weight: 700; }
a { color: var(--ink); }

/* ---------- Portal-Layout ---------- */

body.portal { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w);
    flex-shrink: 0;
    border-right: 1px solid var(--line);
    padding: 28px 20px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-brand { margin-bottom: 28px; }
.sidebar-logo { max-width: 150px; max-height: 64px; display: block; }
.sidebar-name { font-weight: 700; font-size: 18px; }

.sidebar-nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar-nav a {
    text-decoration: none;
    color: var(--ink-soft);
    padding: 7px 10px;
    border-radius: 6px;
    font-size: 15px;
}
.sidebar-nav a:hover { background: var(--bg-soft); color: var(--ink); }
.sidebar-nav a.active { background: var(--bg-soft); color: var(--ink); box-shadow: inset 3px 0 0 var(--accent); }

.content { flex: 1; padding: 40px 48px 80px; max-width: 1080px; }

.portal-head h1 { margin: 0 0 4px; font-size: 34px; }
.portal-head .claim { margin: 0; color: var(--ink-soft); font-size: 17px; }

section.block { margin-top: 56px; scroll-margin-top: 24px; }
section.block > h2 {
    font-size: 22px;
    margin: 0 0 18px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--accent);
    display: inline-block;
}

.group-title { font-size: 15px; color: var(--ink-soft); margin: 26px 0 12px; text-transform: uppercase; letter-spacing: 0.06em; }

.textbody { max-width: 680px; font-size: 16px; }
.textbody h3, .textbody h4 { margin: 22px 0 6px; }

.portal-foot { margin-top: 80px; color: var(--ink-soft); font-size: 13px; border-top: 1px solid var(--line); padding-top: 16px; }

/* ---------- Farben ---------- */

.color-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 14px;
}
.color-tile {
    border-radius: var(--radius);
    padding: 18px 14px 14px;
    min-height: 130px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    border: 1px solid rgba(0,0,0,0.08);
}
.color-name { font-weight: 700; font-size: 15px; }
.color-values { display: flex; flex-direction: column; gap: 2px; align-items: flex-start; }
.color-tile .copy {
    background: none; border: none; padding: 1px 0; cursor: pointer;
    color: inherit; font: inherit; font-size: 13px; opacity: 0.92;
    border-bottom: 1px dashed transparent;
}
.color-tile .copy:hover { border-bottom-color: currentColor; }
.color-note { font-size: 12px; opacity: 0.8; }

/* Verlaufs-Kachel: volle Zeilenbreite, Stufen nebeneinander kopierbar */
.color-tile-gradient { grid-column: 1 / -1; }
.color-tile-gradient .color-values { flex-direction: row; flex-wrap: wrap; column-gap: 14px; }

/* ---------- Fonts ---------- */

.font-preview-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.font-preview-bar label { font-size: 13px; color: var(--ink-soft); }
.font-preview-bar input {
    flex: 1; max-width: 460px;
    padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px;
}

.font-family-block { margin-bottom: 8px; }
.font-cut { border-bottom: 1px solid var(--line); padding: 14px 0; }
.font-cut-meta { display: flex; align-items: center; gap: 14px; margin-bottom: 6px; }
.font-cut-name { font-size: 13px; color: var(--ink-soft); }
.font-license { font-size: 12px; color: var(--ink-soft); }
.font-sample { margin: 0; font-size: 30px; overflow-wrap: anywhere; }

/* ---------- Assets ---------- */

.asset-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}
.asset-card {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: visible;
    display: flex;
    flex-direction: column;
    background: #fff;
}
.asset-preview {
    background: var(--bg-soft) url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20"><rect width="10" height="10" fill="%23ececec"/><rect x="10" y="10" width="10" height="10" fill="%23ececec"/></svg>');
    height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius) var(--radius) 0 0;
    overflow: hidden;
}
.asset-preview img { max-width: 86%; max-height: 86%; object-fit: contain; }

/* PDF-Vorschau: Canvas erscheint erst nach erfolgreichem Rendern,
   bis dahin (oder bei Fehler) zeigt das Badge dahinter den Typ */
canvas.pdf-thumb { display: none; }
canvas.pdf-thumb.ready { display: inline-block; }
canvas.pdf-thumb.ready + .pdf-fallback { display: none; }
.asset-preview canvas.pdf-thumb { max-width: 86%; max-height: 86%; background: #fff; box-shadow: 0 1px 6px rgba(0,0,0,0.12); }
.file-icon {
    font-weight: 700; font-size: 15px; color: var(--ink-soft);
    border: 2px solid var(--line); border-radius: 8px; padding: 14px 18px; background: #fff;
}
.asset-meta { padding: 10px 12px 4px; display: flex; flex-direction: column; gap: 2px; }
.asset-title { font-weight: 600; font-size: 14px; }
.asset-info { font-size: 12px; color: var(--ink-soft); }
.asset-actions { display: flex; gap: 6px; padding: 8px 12px 12px; position: relative; }

/* ---------- Buttons + Dropdown ---------- */

.btn {
    display: inline-block;
    background: var(--accent);
    color: #fff;
    border: none;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    padding: 7px 13px;
    border-radius: 8px;
    cursor: pointer;
}
.btn:hover { filter: brightness(0.93); }
.btn-small { font-size: 12px; padding: 4px 10px; background: var(--accent); color: #fff; border-radius: 6px; text-decoration: none; font-weight: 600; }
.btn-drop { padding: 7px 9px; }

.btn-small-ghost { background: #fff; color: var(--ink); border: 1px solid var(--line); }

/* Format-Panel (eigene Maße, Format, Hintergrund) */
.format-panel {
    display: none;
    border-top: 1px solid var(--line);
    padding: 10px 12px 12px;
    background: var(--bg-soft);
    border-radius: 0 0 var(--radius) var(--radius);
}
.format-panel.open { display: block; }
.format-row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 8px; }
.format-row label { display: flex; flex-direction: column; gap: 3px; font-size: 11px; color: var(--ink-soft); }
.format-row input[type="number"] { width: 78px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; font-size: 13px; }
.format-row select { padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; font-size: 13px; background: #fff; }
.format-check { flex-direction: row !important; align-items: center; gap: 6px !important; font-size: 12px !important; color: var(--ink) !important; }
.format-hint { margin: 0; font-size: 12px; color: #b91c1c; min-height: 0; }

/* ---------- Toast ---------- */

.toast {
    position: fixed;
    bottom: 26px;
    left: 50%;
    transform: translateX(-50%) translateY(16px);
    background: var(--ink);
    color: #fff;
    padding: 10px 18px;
    border-radius: 99px;
    font-size: 14px;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s, transform .2s;
    z-index: 99;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- Brand-Index + 404 ---------- */

body.portal-index { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: var(--bg-soft); }
.index-wrap { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 40px 48px; min-width: 320px; }
.index-wrap h1 { margin: 0 0 2px; }
.index-sub { color: var(--ink-soft); margin: 0 0 20px; }
.index-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.index-list a { display: flex; align-items: center; gap: 10px; text-decoration: none; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; font-weight: 600; }
.index-list a:hover { border-color: var(--accent); }
.index-list .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--accent); }

/* ---------- Mobil ---------- */

@media (max-width: 760px) {
    body.portal { flex-direction: column; }
    .sidebar {
        width: 100%; height: auto; position: sticky; top: 0;
        background: #fff; z-index: 50;
        border-right: none; border-bottom: 1px solid var(--line);
        padding: 12px 16px;
    }
    .sidebar-brand { margin-bottom: 8px; }
    .sidebar-logo { max-height: 36px; }
    .sidebar-nav { flex-direction: row; overflow-x: auto; gap: 4px; }
    .sidebar-nav a { white-space: nowrap; font-size: 14px; background: var(--bg-soft); }
    .sidebar-nav a.active { box-shadow: inset 0 -3px 0 var(--accent); }
    .content { padding: 24px 18px 60px; }
}

/* =============================================
   Admin
   ============================================= */

body.admin { background: var(--bg-soft); }

.admin-shell { max-width: 980px; margin: 0 auto; padding: 28px 20px 80px; }

.admin-top {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 26px; gap: 12px; flex-wrap: wrap;
}
.admin-top h1 { margin: 0; font-size: 24px; }
.admin-top .crumbs { font-size: 13px; color: var(--ink-soft); margin-bottom: 10px; }
.admin-top .crumbs a { color: var(--ink-soft); }

.panel {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 18px;
}
.panel h2 { margin: 0 0 14px; font-size: 17px; }

.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-soft); padding: 6px 8px; border-bottom: 1px solid var(--line); }
.admin-table td { padding: 9px 8px; border-bottom: 1px solid var(--line); font-size: 14px; vertical-align: middle; }
.admin-table tr:last-child td { border-bottom: none; }

.form-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.form-field { display: flex; flex-direction: column; gap: 4px; }
.form-field label { font-size: 12px; color: var(--ink-soft); }
.form-field input[type="text"], .form-field input[type="number"], .form-field select, textarea {
    padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; font-family: inherit;
}
textarea { width: 100%; min-height: 180px; resize: vertical; }
.form-field input[type="color"] { width: 46px; height: 36px; padding: 2px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }

.btn-ghost {
    background: none; border: 1px solid var(--line); color: var(--ink);
    font-size: 13px; padding: 6px 11px; border-radius: 8px; cursor: pointer; text-decoration: none; display: inline-block;
}
.btn-ghost:hover { border-color: var(--ink-soft); }
.btn-danger { background: none; border: 1px solid #e5b5b5; color: #b91c1c; font-size: 13px; padding: 6px 11px; border-radius: 8px; cursor: pointer; }
.btn-danger:hover { background: #fef2f2; }
.btn-danger.armed { background: #b91c1c; border-color: #b91c1c; color: #fff; }
.btn-danger:disabled { opacity: 0.45; cursor: not-allowed; }
.drag-handle { cursor: grab; color: var(--ink-soft); font-size: 15px; padding: 2px 6px; user-select: none; }
.drag-handle:active { cursor: grabbing; }
.dragging { opacity: 0.45; }

.msg-ok { background: #f0fbd5; border: 1px solid #d3ecab; color: #3f6212; padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; }
.msg-err { background: #fef2f2; border: 1px solid #fecaca; color: #b91c1c; padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; }

.dropzone {
    border: 2px dashed var(--line);
    border-radius: var(--radius);
    padding: 26px;
    text-align: center;
    color: var(--ink-soft);
    font-size: 14px;
    cursor: pointer;
    transition: border-color .15s, background .15s;
}
.dropzone.dragover { border-color: var(--accent); background: #fbfff0; }
.upload-status { font-size: 13px; margin-top: 10px; display: flex; flex-direction: column; gap: 3px; }
.upload-status .ok { color: #3f6212; }
.upload-status .err { color: #b91c1c; }

.thumb { width: 52px; height: 40px; object-fit: contain; background: var(--bg-soft); border-radius: 6px; border: 1px solid var(--line); }
.inline-edit { border: 1px solid transparent; border-radius: 6px; padding: 3px 6px; font-size: 14px; width: 100%; background: transparent; font-family: inherit; }
.inline-edit:hover { border-color: var(--line); }
.inline-edit:focus { border-color: var(--accent); outline: none; background: #fff; }

.color-row { display: flex; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.color-row:last-child { border-bottom: none; }
.color-swatch-mini { width: 26px; height: 26px; border-radius: 6px; border: 1px solid rgba(0,0,0,0.12); flex-shrink: 0; }
.color-swatch-wide { width: 90px; display: inline-block; background: #eee; }

/* Google-Fonts-Suche */
.gf-results { display: flex; flex-direction: column; gap: 4px; margin-top: 4px; }
.gf-hit {
    text-align: left; background: var(--bg-soft); border: 1px solid var(--line);
    border-radius: 8px; padding: 8px 12px; cursor: pointer; font-size: 14px; font-family: inherit;
}
.gf-hit:hover { border-color: var(--accent); }
.gf-hit span { color: var(--ink-soft); font-size: 12px; margin-left: 6px; }
.gf-chosen { font-weight: 600; font-size: 14px; margin: 12px 0 6px; }
.gf-weight { display: flex; align-items: center; gap: 6px; font-size: 13px; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; }
.gf-variants { margin-top: 4px; }
.gf-variants .btn { margin-top: 10px; }

/* Login */
body.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: var(--bg-soft); }
.login-box { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 36px 40px; width: 340px; }
.login-box h1 { margin: 0 0 18px; font-size: 22px; }
.login-box input[type="password"] { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 15px; margin-bottom: 14px; }
.login-box .btn { width: 100%; text-align: center; }
