/* DEDON Prism Admin – schlicht, hell, viel Weißraum */
:root {
    --bg: #f6f5f2;
    --panel: #ffffff;
    --ink: #1f1f1d;
    --muted: #77736b;
    --line: #e4e1da;
    --accent: #1f1f1d;
    --accent-ink: #ffffff;
    --warn-bg: #fff6e0;
    --warn-line: #e8c76a;
    --error-bg: #fdecea;
    --error-line: #e2a39b;
    --ok-bg: #e9f5ec;
    --ok-line: #9ccaa8;
    --radius: 6px;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    font-size: 14px;
    color: var(--ink);
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); }
h1 { font-size: 1.6rem; font-weight: 500; margin: 0.2rem 0 0.4rem; }
h1:focus { outline: none; }
h2 { font-size: 1.1rem; font-weight: 600; margin: 0 0 0.8rem; }
h3 { font-size: 0.95rem; font-weight: 600; margin: 1.2rem 0 0.6rem; }
a { color: inherit; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.9em; background: #f0eee9; padding: 0 0.25em; border-radius: 3px; }
.muted, .sub { color: var(--muted); }
.sub { font-size: 0.85em; }
.error-text { color: #b3261e; }
.ok-text { color: #2e7d46; margin-left: 0.6rem; }
.hint { color: var(--muted); font-size: 0.9em; }

/* Layout */
.shell { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.sidebar { background: #1f1f1d; color: #e9e6df; padding: 1.4rem 1rem; display: flex; flex-direction: column; gap: 1.6rem; position: sticky; top: 0; height: 100vh; }
.brand { text-decoration: none; font-size: 1.15rem; letter-spacing: 0.04em; }
.brand span { display: block; font-size: 0.75rem; letter-spacing: 0.2em; text-transform: uppercase; color: #a8a398; margin-top: 0.2rem; }
.sidebar nav { display: flex; flex-direction: column; gap: 0.15rem; }
.sidebar nav a { text-decoration: none; padding: 0.5rem 0.7rem; border-radius: var(--radius); color: #d6d2c9; }
.sidebar nav a:hover { background: #2d2d2a; }
.sidebar nav a.active { background: #3a3a36; color: #fff; }
.user { margin-top: auto; font-size: 0.85rem; display: flex; justify-content: space-between; gap: 0.5rem; color: #a8a398; }
.content { padding: 1.6rem 2rem 4rem; max-width: 1400px; }

.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: 0.8rem; }
.page-head .actions, .row { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.row { margin-top: 0.8rem; }
.back { text-decoration: none; color: var(--muted); font-size: 0.85rem; }
.badge { font-size: 0.7rem; vertical-align: middle; background: var(--warn-bg); border: 1px solid var(--warn-line); padding: 0.1rem 0.45rem; border-radius: 999px; }

/* Controls */
input, select, textarea { font: inherit; color: inherit; border: 1px solid var(--line); border-radius: var(--radius); padding: 0.4rem 0.55rem; background: #fff; }
input:focus, select:focus, textarea:focus { outline: 2px solid #c9c4b8; outline-offset: 0; }
input.short { width: 8rem; }
input.comment { width: 22rem; max-width: 100%; }
.btn { font: inherit; border: 1px solid var(--line); background: #fff; border-radius: var(--radius); padding: 0.42rem 0.9rem; cursor: pointer; text-decoration: none; display: inline-block; }
.btn:hover:not(:disabled) { border-color: #bdb8ad; }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn-danger { color: #b3261e; border-color: var(--error-line); }
.btn-ghost { background: transparent; }
.btn-small { padding: 0.2rem 0.55rem; font-size: 0.85em; }
label.check { display: inline-flex; gap: 0.35rem; align-items: center; }

.filters { display: flex; gap: 0.6rem; align-items: center; margin: 0.6rem 0 1rem; flex-wrap: wrap; }
.filters input:not([type=checkbox]) { width: 22rem; max-width: 100%; }

/* Panels, forms */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 1.1rem 1.2rem; margin-bottom: 1rem; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0.8rem 1rem; }
.form-grid label, .preview-form label { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.85rem; color: var(--muted); }
.form-grid label input, .form-grid label select { color: var(--ink); }
.form-grid .wide { grid-column: span 2; }
.preview-form label.check { flex-direction: row; color: var(--ink); font-size: 0.9rem; }

.tabs { display: flex; gap: 0.2rem; border-bottom: 1px solid var(--line); margin-bottom: 1rem; }
.tabs button { font: inherit; background: none; border: none; padding: 0.55rem 0.9rem; cursor: pointer; color: var(--muted); border-bottom: 2px solid transparent; }
.tabs button.active { color: var(--ink); border-bottom-color: var(--ink); }

/* Tables */
table.grid { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.grid th, .grid td { text-align: left; padding: 0.5rem 0.7rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.grid th { font-weight: 500; color: var(--muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; background: #faf9f6; }
.grid tbody tr:hover { background: #faf9f6; cursor: pointer; }
.grid tr.warn td:first-child { box-shadow: inset 3px 0 0 var(--warn-line); }
.grid .num { text-align: right; }
.grid.compact td { padding: 0.3rem 0.5rem; }
.grid.compact input:not([type=checkbox]) { width: 100%; }
.grid.compact input.short { width: 6rem; }
.actions-cell { white-space: nowrap; text-align: right; }

/* Alerts */
.alert { border: 1px solid; border-radius: var(--radius); padding: 0.6rem 0.8rem; margin-bottom: 0.8rem; white-space: pre-wrap; }
.alert-error { background: var(--error-bg); border-color: var(--error-line); }
.alert-warning { background: var(--warn-bg); border-color: var(--warn-line); }
.alert-success { background: var(--ok-bg); border-color: var(--ok-line); }
.alert-info { background: #eef3f8; border-color: #b6c9dc; }

/* Home */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; margin: 1rem 0 2rem; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 1rem 1.2rem; text-decoration: none; display: flex; flex-direction: column; gap: 0.3rem; }
.card .num { font-size: 2rem; font-weight: 300; }
.card .num.small { font-size: 1.3rem; padding-top: 0.6rem; }

/* JSON */
textarea.json, pre.json { width: 100%; min-height: 60vh; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; line-height: 1.45; tab-size: 2; }
pre.json { background: #faf9f6; border: 1px solid var(--line); border-radius: var(--radius); padding: 0.8rem; overflow: auto; max-height: 60vh; min-height: 0; }

/* Preview */
.preview { display: grid; grid-template-columns: 300px 1fr; gap: 1.5rem; align-items: start; }
.preview-form { display: flex; flex-direction: column; gap: 0.7rem; }
.preview-images { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 1rem; }
.preview-images figure { margin: 0; background: #fff; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.preview-images img { width: 100%; display: block; background: repeating-conic-gradient(#f1efea 0% 25%, #fff 0% 50%) 50% / 20px 20px; }
.preview-images figcaption { padding: 0.4rem 0.6rem; font-size: 0.8rem; color: var(--muted); }

/* Fabric selection */
.fabric-group { border-top: 1px solid var(--line); padding: 0.7rem 0; }
.fabric-group-head { display: flex; gap: 0.6rem; align-items: center; margin-bottom: 0.4rem; }
.fabric-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 0.25rem 0.8rem; }
.fabric { display: flex; gap: 0.4rem; align-items: center; padding: 0.2rem 0.35rem; border-radius: 4px; cursor: pointer; }
.fabric.on { background: #f1efe9; }
.fabric .code { font-family: ui-monospace, Menlo, monospace; font-size: 0.85em; color: var(--muted); min-width: 2.6rem; }

/* Login */
.login { min-height: 100vh; display: grid; place-items: center; background: var(--bg); }
.login form { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 2rem; width: 340px; display: flex; flex-direction: column; gap: 0.9rem; }
.login label { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.85rem; color: var(--muted); }

#blazor-error-ui { background: #fff4d6; bottom: 0; box-shadow: 0 -1px 2px rgba(0,0,0,.2); display: none; left: 0; padding: 0.6rem 1.25rem 0.7rem; position: fixed; width: 100%; z-index: 1000; }
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 0.75rem; top: 0.5rem; }
.blazor-error-boundary { background: #b32121; padding: 1rem; color: white; }
.blazor-error-boundary::after { content: "Es ist ein Fehler aufgetreten."; }

@media (max-width: 900px) {
    .shell { grid-template-columns: 1fr; }
    .sidebar { position: static; height: auto; }
    .preview { grid-template-columns: 1fr; }
    .content { padding: 1rem; }
}
