:root {
    --bg: #f6f7f9;
    --panel: #ffffff;
    --text: #1d2330;
    --muted: #6b7280;
    --border: #e3e6eb;
    --accent: #2563eb;
    --danger: #dc2626;
    --ok-bg: #e7f6ec;
    --err-bg: #fdecec;
}
@media (prefers-color-scheme: dark) {
    :root {
        --bg: #12151b;
        --panel: #1b1f27;
        --text: #e6e8ec;
        --muted: #9aa1ad;
        --border: #2a303b;
        --accent: #60a5fa;
        --danger: #f87171;
        --ok-bg: #173323;
        --err-bg: #3a1a1a;
    }
}

* { box-sizing: border-box; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { max-width: 900px; margin: 0 auto; padding: 32px 16px; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.top h1 { margin: 0; font-size: 1.6rem; }
.top nav { display: flex; align-items: center; gap: 12px; }
.muted { color: var(--muted); }
.empty { color: var(--muted); text-align: center; padding: 48px 0; }

.grid { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.card {
    display: flex; flex-direction: column; gap: 4px; height: 100%;
    padding: 16px; background: var(--panel); border: 1px solid var(--border); border-radius: 10px;
    color: var(--text); transition: border-color .15s, transform .15s;
}
.card:hover { border-color: var(--accent); transform: translateY(-2px); text-decoration: none; }
.card .host { color: var(--accent); font-size: .9rem; word-break: break-all; }
.card .desc { color: var(--muted); font-size: .9rem; }

.box { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 20px; margin-bottom: 16px; }
.box h2 { margin: 0 0 12px; font-size: 1.1rem; }
.narrow { max-width: 380px; margin: 40px auto; }
summary { cursor: pointer; font-weight: 600; }
details[open] summary { margin-bottom: 12px; }

label { display: block; margin-bottom: 12px; font-size: .9rem; color: var(--muted); }
input {
    display: block; width: 100%; margin-top: 4px; padding: 9px 11px;
    background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: 7px; font: inherit;
}
input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.row { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
@media (max-width: 600px) { .row { grid-template-columns: 1fr; } }
.actions { display: flex; align-items: center; gap: 12px; }

button, .btn {
    padding: 9px 16px; border: 1px solid var(--accent); border-radius: 7px;
    background: var(--accent); color: #fff; font: inherit; cursor: pointer;
}
button:disabled { opacity: .35; cursor: default; }
.small { padding: 5px 10px; font-size: .85rem; }
.ghost { background: transparent; color: var(--text); border-color: var(--border); }
.danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn:hover { text-decoration: none; }

table { width: 100%; border-collapse: collapse; }
td { padding: 10px 0; border-top: 1px solid var(--border); vertical-align: middle; word-break: break-all; }
td.btns { white-space: nowrap; text-align: right; word-break: normal; }
td.btns form, form.inline { display: inline; }
td.btns > * { margin-left: 4px; }

/* Admin layout with left sidebar */
.admin { display: flex; min-height: 100vh; }
.sidebar {
    position: sticky; top: 0; height: 100vh; flex: 0 0 220px;
    display: flex; flex-direction: column; gap: 16px; padding: 20px 12px;
    background: var(--panel); border-right: 1px solid var(--border);
}
.brand-logo { height: 40px; width: auto; color: var(--text); }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 12px 12px; font-weight: 700; font-size: 1.1rem; color: var(--text); }
.brand:hover { text-decoration: none; }
.menu { display: flex; flex-direction: column; gap: 2px; }
.menu-bottom { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--border); }
.menu a, .menu-link {
    display: block; width: 100%; padding: 9px 12px; border: 0; border-radius: 7px;
    background: transparent; color: var(--muted); font: inherit; text-align: left; cursor: pointer;
}
.menu a:hover, .menu-link:hover { background: var(--bg); color: var(--text); text-decoration: none; }
.menu a.active { background: var(--accent); color: #fff; }
.content { flex: 1; min-width: 0; max-width: 900px; padding: 32px; }
.content h1 { margin: 0 0 24px; font-size: 1.6rem; }
.box-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.box-head h2 { margin: 0; }

/* Design picker */
.themes { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); margin-bottom: 16px; }
.theme-option {
    position: relative; display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 12px;
    border: 2px solid var(--border); border-radius: 10px; color: var(--text); cursor: pointer;
}
.theme-option:has(input:checked) { border-color: var(--accent); }
.theme-option input { position: absolute; top: 20px; right: 20px; width: auto; margin: 0; accent-color: var(--accent); }
.theme-option em { font-weight: 400; font-style: normal; color: var(--accent); font-size: .85rem; }
.theme-option .muted { font-size: .85rem; }
.theme-option a { font-size: .85rem; margin-top: auto; }
.theme-swatch { display: flex; flex-direction: column; justify-content: center; gap: 6px; height: 90px; padding: 0 14px; border-radius: 7px; }
.theme-swatch i { display: block; height: 12px; border-radius: 4px; }
.swatch-kartice { background: #f6f7f9; }
.swatch-kartice i { background: #fff; border: 1px solid #e3e6eb; border-left: 12px solid #2563eb; height: 18px; }
.swatch-minimal { background: #fafaf9; align-items: center; }
.swatch-minimal { background: #0c0c0d; }
.swatch-minimal i { width: 40%; height: 5px; background: #fff; border-radius: 2px; }
.swatch-terminal { background: #0a0e0a; }
.swatch-terminal i { height: 2px; border-bottom: 1px dashed #1f8f4e; background: linear-gradient(90deg, #39ff88 40%, transparent 40%); }
.swatch-gradient { background: linear-gradient(135deg, #4f46e5, #9333ea 45%, #ec4899); }
.swatch-gradient i { height: 18px; background: rgba(255,255,255,.25); border: 1px solid rgba(255,255,255,.4); }
.swatch-editorial { background: #f4efe6; border-top: 4px solid #1a1714; }
.swatch-editorial i { height: 1px; background: #1a1714; opacity: .35; box-shadow: -10px -6px 0 -0px #b4321f; }

/* Hover animation previews — dark tile like the Minimal design */
.hover-preview {
    --text: #fff; display: grid; place-items: center; height: 90px; border-radius: 7px;
    background: #0c0c0d; color: #fff; font: 600 1rem Urbanist, system-ui, sans-serif; cursor: pointer;
}
/* Let the whole tile trigger the hover, not just the word. */
.hover-preview .hv { display: grid; place-items: center; width: 100%; height: 100%; }

/* Small radio choices (link style) */
.option-label { margin: 16px 0 8px; font-size: .9rem; color: var(--muted); }
.choices { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.choice {
    display: flex; align-items: center; gap: 8px; margin: 0; padding: 8px 14px;
    border: 2px solid var(--border); border-radius: 8px; color: var(--text); cursor: pointer;
}
.choice:has(input:checked) { border-color: var(--accent); }
.choice input { width: auto; margin: 0; accent-color: var(--accent); }
.box .actions { margin-top: 16px; }

@media (max-width: 700px) {
    .admin { flex-direction: column; }
    .sidebar {
        position: static; height: auto; flex: none; flex-direction: row; flex-wrap: wrap; align-items: center;
        gap: 4px; padding: 10px 12px; border-right: 0; border-bottom: 1px solid var(--border);
    }
    .brand { width: 100%; padding: 4px 8px 8px; }
    .menu, .menu-bottom { flex-direction: row; flex-wrap: wrap; margin: 0; padding: 0; border: 0; }
    .menu a, .menu-link { width: auto; padding: 7px 10px; }
    .content { padding: 20px 16px; }
}

.alert { padding: 10px 14px; border-radius: 7px; margin: 0 0 16px; }
.alert.ok { background: var(--ok-bg); }
.alert.err { background: var(--err-bg); color: var(--danger); }
