:root {
    --bg: #f4f6fb;
    --card: #ffffff;
    --text: #131a2a;
    --muted: #5f6b85;
    --accent: #1f4fd8;
    --accent-soft: #e8efff;
    --accent-hover: #1a3fb0;
    --danger: #c02626;
    --danger-soft: #fdecec;
    --ok: #0f7a52;
    --ok-soft: #e6f6ef;
    --warn: #8a5a00;
    --warn-soft: #fdf3dc;
    --border: #dfe4ef;
    --border-strong: #c8d1e4;
    --radius: 14px;
    --shadow: 0 1px 2px rgba(19, 26, 42, 0.04), 0 8px 24px rgba(19, 26, 42, 0.06);
}

* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

html,
body {
    height: 100%;
}

body {
    margin: 0;
    display: flex;
    flex-direction: column;
    background:
        radial-gradient(1100px 460px at 15% -10%, #e7edff 0%, transparent 60%),
        radial-gradient(900px 400px at 100% 0%, #eafaf4 0%, transparent 55%), var(--bg);
    color: var(--text);
    font-family:
        "Inter",
        system-ui,
        -apple-system,
        "Segoe UI",
        sans-serif;
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3 {
    line-height: 1.25;
    letter-spacing: -0.01em;
}

code,
pre,
.mono {
    font-family: ui-monospace, "SFMono-Regular", "JetBrains Mono", Consolas, monospace;
}

/* --- Header ------------------------------------------------------------- */

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 28px;
    background: linear-gradient(100deg, #101a33 0%, #1b2c58 55%, #123a55 100%);
    color: #f8fafc;
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06) inset;
}

.brand {
    display: flex;
    align-items: baseline;
    gap: 10px;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}

.brand:hover .brand-mark {
    color: #fff;
}

.brand:hover .brand-sub {
    color: #c7d5ec;
}

.brand-mark {
    font-weight: 700;
    font-size: 1.15rem;
    letter-spacing: -0.01em;
}

.brand-sub {
    color: #a9bad6;
    font-size: 0.95rem;
}

/* Navigation between the two content kinds of the repository (skills/workflows). */
.main-nav {
    display: flex;
    gap: 6px;
    margin-right: auto;
}

.main-nav a {
    color: #c7d5ec;
    font-size: 0.95rem;
    padding: 6px 12px;
    border-radius: 8px;
    text-decoration: none;
}

.main-nav a:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.main-nav a.active {
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
}

.user-box {
    display: flex;
    align-items: center;
    gap: 14px;
}

.user-name {
    color: #cbd7ea;
    font-size: 0.85rem;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 999px;
    padding: 4px 12px;
}

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

.content {
    width: 100%;
    max-width: 940px;
    margin: 0 auto;
    padding: 32px 24px 8px;
    flex: 1 0 auto;
}

.page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 22px;
}

.page-head h1 {
    margin: 0;
    font-size: 1.6rem;
}

.page-head-actions {
    display: flex;
    gap: 8px;
}

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px 24px;
    margin-bottom: 18px;
    box-shadow: var(--shadow);
}

.section {
    font-size: 1rem;
    margin: 26px 0 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.section:first-of-type {
    margin-top: 4px;
}

.muted {
    color: var(--muted);
    font-size: 0.88rem;
}

.meta {
    color: var(--muted);
    font-size: 0.82rem;
}

.empty {
    text-align: center;
    color: var(--muted);
    padding: 18px 8px;
}

/* --- Skill list --------------------------------------------------------- */

.search-form {
    display: flex;
    gap: 8px;
    margin-bottom: 18px;
    flex-wrap: wrap;
    align-items: flex-end;
}

.search-form input[type="search"],
.sort-control select,
.search-form .btn {
    height: 42px;
}

.search-form .btn {
    display: inline-flex;
    align-items: center;
}

.sort-control {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 0.78rem;
    color: var(--muted);
}

.sort-control select {
    padding: 0 10px;
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    background: #fcfdff;
    color: var(--text);
    font-family: inherit;
    font-size: 0.88rem;
}

.vote-chip {
    display: inline-flex;
    gap: 6px;
}

.vote-up {
    color: #1a7f37;
    font-weight: 600;
}

.vote-down {
    color: var(--danger);
    font-weight: 600;
}

.search-form input[type="search"] {
    flex: 1;
    min-width: 0;
    padding: 10px 14px;
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    font-size: 0.92rem;
    font-family: inherit;
    background: #fcfdff;
    color: var(--text);
    transition:
        border-color 0.15s ease,
        box-shadow 0.15s ease;
}

.search-form input[type="search"]:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(31, 79, 216, 0.14);
    background: #fff;
}

.search-hint {
    margin: -8px 0 14px;
}

.empty-actions {
    margin-top: 12px;
}

.skill-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    padding: 16px 20px;
    margin-bottom: 12px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--card);
    box-shadow: 0 1px 2px rgba(19, 26, 42, 0.04);
    transition:
        border-color 0.15s ease,
        transform 0.15s ease,
        box-shadow 0.15s ease;
}

.skill-row:hover {
    border-color: var(--border-strong);
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.skill-main {
    min-width: 0;
}

.skill-title {
    font-size: 1.08rem;
    font-weight: 650;
    color: var(--text);
    text-decoration: none;
}

.skill-title:hover {
    color: var(--accent);
}

.skill-id {
    margin-left: 8px;
    font-size: 0.8rem;
    color: var(--accent);
    background: var(--accent-soft);
    border-radius: 6px;
    padding: 2px 7px;
}

.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.chip {
    font-size: 0.75rem;
    color: var(--muted);
    background: #f2f5fa;
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 2px 10px;
}

.skill-actions {
    display: flex;
    gap: 8px;
    flex: 0 0 auto;
}

/* --- Pagination --------------------------------------------------------- */

.pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin: 20px 0 8px;
}

.page-link {
    display: inline-block;
    min-width: 36px;
    text-align: center;
    padding: 6px 10px;
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    background: #fff;
    color: #2c3854;
    font-size: 0.82rem;
    font-weight: 600;
    text-decoration: none;
    transition:
        border-color 0.15s ease,
        color 0.15s ease,
        background 0.15s ease;
}

.page-link:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.page-link.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.page-link.disabled {
    opacity: 0.5;
    cursor: default;
}

.page-ellipsis {
    color: var(--muted);
    padding: 0 4px;
}

/* --- Forms -------------------------------------------------------------- */

.form label {
    display: block;
    margin: 16px 0 6px;
    font-weight: 600;
    font-size: 0.85rem;
    color: #2c3854;
}

.form input[type="text"],
.form input[type="password"],
.form input[type="file"],
.form textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    font-size: 0.92rem;
    font-family: inherit;
    background: #fcfdff;
    color: var(--text);
    transition:
        border-color 0.15s ease,
        box-shadow 0.15s ease;
}

/* Schreibgeschützte Ansicht (fremde Skills, REQ-BE-61) */
.form input[readonly],
.form textarea[readonly] {
    background: #f4f5f7;
    color: #4b5563;
    cursor: default;
}

.form input:focus,
.form textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(31, 79, 216, 0.14);
    background: #fff;
}

.form textarea {
    resize: vertical;
    line-height: 1.5;
}

.form-row {
    display: flex;
    gap: 16px;
    align-items: flex-end;
}

.form-row > div {
    flex: 1;
}

.form-actions {
    margin-top: 22px;
    display: flex;
    gap: 10px;
}

.checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 400;
}

.checkbox input {
    width: auto;
}

.btn {
    display: inline-block;
    background: var(--accent);
    color: #fff;
    border: 1px solid transparent;
    border-radius: 9px;
    padding: 9px 16px;
    font-size: 0.88rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
    transition:
        background 0.15s ease,
        border-color 0.15s ease,
        color 0.15s ease,
        transform 0.1s ease;
}

.btn:hover {
    background: var(--accent-hover);
}

.btn:active {
    transform: translateY(1px);
}

.btn-small {
    padding: 6px 12px;
    font-size: 0.8rem;
}

.btn-secondary {
    background: #fff;
    color: #2c3854;
    border-color: var(--border-strong);
}

.btn-secondary:hover {
    background: #f5f7fc;
    color: var(--text);
}

.reload-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.reload-btn.has-updates {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-soft);
    font-weight: 650;
    box-shadow: 0 0 0 3px rgba(31, 79, 216, 0.15);
}

.reload-btn.has-updates:hover {
    background: #dbe6fe;
    color: var(--accent-hover);
    border-color: var(--accent-hover);
}

.reload-badge {
    display: none;
    align-items: center;
    gap: 4px;
    padding: 2px 7px;
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1;
    border-radius: 999px;
    background: var(--accent);
    color: #fff;
}

.reload-btn.has-updates .reload-badge {
    display: inline-flex;
}

.reload-badge::before {
    content: "";
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #4ade80;
    box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.7);
    animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.7);
    }
    70% {
        transform: scale(1);
        box-shadow: 0 0 0 6px rgba(74, 222, 128, 0);
    }
    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(74, 222, 128, 0);
    }
}

.btn-danger {
    background: var(--danger);
}

.btn-danger:hover {
    background: #a01e1e;
}

.btn-ghost-danger {
    background: var(--danger-soft);
    color: var(--danger);
    border-color: #f3c9c9;
}

.btn-ghost-danger:hover {
    background: #fbdcdc;
    color: #9c1c1c;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    background: #fff;
    color: #4b5563;
    cursor: pointer;
    text-decoration: none;
    transition:
        background 0.15s ease,
        border-color 0.15s ease,
        color 0.15s ease,
        transform 0.1s ease,
        box-shadow 0.15s ease;
}

.btn-icon:hover {
    background: var(--accent-soft);
    border-color: var(--accent);
    color: var(--accent);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(19, 26, 42, 0.08);
}

.btn-icon:active {
    transform: translateY(0);
}

.btn-icon-danger {
    color: var(--muted);
}

.btn-icon-danger:hover {
    background: var(--danger-soft);
    border-color: #f3c9c9;
    color: var(--danger);
    box-shadow: 0 2px 4px rgba(192, 38, 38, 0.08);
}

.btn-icon svg {
    display: block;
    flex-shrink: 0;
}

/* --- Alerts ------------------------------------------------------------- */

.alert {
    border-radius: 10px;
    padding: 12px 16px;
    margin-bottom: 16px;
    font-size: 0.88rem;
    border: 1px solid transparent;
}

.alert-error {
    background: var(--danger-soft);
    border-color: #f3c9c9;
    color: var(--danger);
}

.alert-warn {
    background: var(--warn-soft);
    border-color: #f0dcae;
    color: var(--warn);
}

.alert-ok {
    background: var(--ok-soft);
    border-color: #bfe6d5;
    color: var(--ok);
}

.alert-info {
    background: var(--accent-soft);
    border-color: #c6d6f8;
    color: var(--accent);
}

.alert ul {
    margin: 6px 0 0;
    padding-left: 18px;
}

/* Definition of a workflow on its detail page (pretty printed JSON). */
.definition {
    background: #0f172a;
    color: #e2e8f0;
    border-radius: 10px;
    font-size: 0.85rem;
    line-height: 1.5;
    margin: 0;
    max-height: 32rem;
    overflow: auto;
    padding: 14px 16px;
    white-space: pre-wrap;
    word-break: break-word;
}

/* --- Files -------------------------------------------------------------- */

.file-row,
.file-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 10px 0;
    border-bottom: 1px solid #eef1f7;
}

.file-row:last-child {
    border-bottom: none;
}

.file-row code {
    color: #2c3854;
}

.file-block {
    margin-bottom: 16px;
}

.file-list {
    margin: 0 0 14px;
    padding: 0;
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.file-list li code {
    background: #f2f5fa;
    border: 1px solid var(--border);
    border-radius: 7px;
    padding: 3px 9px;
    font-size: 0.8rem;
}

.code {
    white-space: pre-wrap;
    background: #f7f9fc;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px;
    font-size: 0.82rem;
    overflow-x: auto;
    margin: 8px 0 0;
}

details {
    margin-top: 10px;
}

summary {
    cursor: pointer;
    font-size: 0.88rem;
    font-weight: 600;
    color: #2c3854;
}

/* --- Detail ------------------------------------------------------------- */

.meta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 16px 24px;
}

.meta-grid > div {
    min-width: 0;
}

.meta-grid code {
    word-break: break-all;
}

.label {
    display: block;
    color: var(--muted);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 2px;
}

/* --- Dropzone ----------------------------------------------------------- */

.dropzone {
    position: relative;
    border: 2px dashed var(--border-strong);
    border-radius: var(--radius);
    padding: 36px 20px;
    text-align: center;
    color: var(--muted);
    background: #fafcff;
    cursor: pointer;
    transition:
        border-color 0.15s ease,
        background 0.15s ease,
        box-shadow 0.15s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 160px;
}

.dropzone:hover,
.dropzone.active {
    border-color: var(--accent);
    background: var(--accent-soft);
    box-shadow: 0 0 0 3px rgba(31, 79, 216, 0.12);
}

.dropzone-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.dropzone-icon {
    color: var(--accent);
    margin-bottom: 2px;
    transition: transform 0.15s ease;
}

.dropzone:hover .dropzone-icon,
.dropzone.active .dropzone-icon {
    transform: translateY(-2px);
}

.dropzone-main-text {
    font-size: 0.96rem;
    color: var(--text);
}

.dropzone-browse {
    color: var(--accent);
    font-weight: 600;
    text-decoration: underline;
}

.dropzone-sub-text {
    font-size: 0.8rem;
    color: var(--muted);
}

.dropzone-filename {
    margin-top: 6px;
    padding: 5px 14px;
    background: #fff;
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--accent);
    word-break: break-all;
}

.dropzone-actions {
    margin-top: 8px;
    pointer-events: auto;
}

.dropzone-actions button {
    position: relative;
    z-index: 3;
    cursor: pointer;
}

/* --- Login -------------------------------------------------------------- */

.login-card {
    max-width: 420px;
    margin: 56px auto;
}

.login-card h1 {
    font-size: 1.4rem;
    margin: 0 0 6px;
}

.login-card .btn {
    margin-top: 20px;
}

/* --- Footer ------------------------------------------------------------- */

.footer {
    width: 100%;
    max-width: 940px;
    margin: 0 auto;
    padding: 18px 24px 32px;
    color: var(--muted);
    font-size: 0.78rem;
    flex-shrink: 0;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    text-align: left;
    padding: 8px 10px;
    border-bottom: 1px solid var(--border);
}

.data-table th {
    font-weight: 600;
    color: var(--text);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.user-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.user-actions form {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.user-actions .checkbox {
    font-size: 0.82rem;
    gap: 5px;
    white-space: nowrap;
    color: var(--muted);
}

.user-actions .btn {
    white-space: nowrap;
}

.status-suspended {
    color: var(--danger);
    font-weight: 600;
}

.vote-block {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.vote-btn {
    min-width: 64px;
}

.vote-btn.is-active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.vote-hint {
    color: var(--muted);
    font-size: 0.85rem;
}

.comment-list {
    list-style: none;
    margin: 0 0 16px;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.comment {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 12px;
}

.comment-head {
    display: flex;
    align-items: center;
    gap: 10px;
}

.comment-head form {
    margin-left: auto;
}

.comment-body {
    margin: 6px 0 0;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.confirm-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(19, 26, 42, 0.45);
}

.confirm-dialog {
    width: 100%;
    max-width: 420px;
    padding: 20px 22px;
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.confirm-message {
    margin: 0 0 18px;
    color: var(--text);
}

.confirm-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.admin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
}

.admin-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
}

@media (max-width: 640px) {
    .topbar {
        padding: 12px 16px;
    }

    .content {
        padding: 20px 14px 8px;
    }

    .skill-row,
    .form-row {
        flex-direction: column;
        align-items: stretch;
    }

    .search-form {
        flex-wrap: wrap;
    }

    .search-form input[type="search"] {
        flex: 1 1 100%;
    }

    .page-head {
        flex-direction: column;
        align-items: flex-start;
    }
}
