/* Shared tile + editor styling used by Websites, Connectors, Widgets and Skills. */

.tiles {
    --tl-accent: #365FD9;
    --tl-text: #212121;
    --tl-secondary: #424242;
    --tl-muted: #595959;
    --tl-border: #E3E3E3;
    --tl-border-strong: #CDCDCD;
    --tl-soft: #F7F6F4;
    --tl-tint: #EEF2FC;
    display: flex;
    flex-direction: column;
    gap: 16px;
    color: var(--tl-text);
}

.tiles-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.tiles-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    line-height: 24px;
}

.tiles-subtitle {
    margin: 2px 0 0;
    color: var(--tl-muted);
    font-size: 14px;
    line-height: 20px;
}

.tiles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}

.tile {
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-width: 0;
    padding: 16px;
    border: 1px solid var(--tl-border);
    border-radius: 12px;
    background: #FFFFFF;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

    .tile:hover {
        border-color: var(--tl-border-strong);
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
    }

.tile-head {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.tile-avatar {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--tl-tint);
    color: var(--tl-accent);
    font-size: 18px;
    font-weight: 700;
}

.tile-id {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-width: 0;
}

.tile-host {
    overflow: hidden;
    font-size: 16px;
    font-weight: 600;
    line-height: 22px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tile-url {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
    max-width: 100%;
    color: var(--tl-muted);
    font-size: 12px;
    line-height: 18px;
    text-decoration: none;
}

    .tile-url span {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .tile-url .mud-icon-root {
        flex: 0 0 auto;
        font-size: 14px;
    }

    .tile-url:hover {
        color: var(--tl-accent);
    }

.tile-head .tile-more {
    flex: 0 0 auto;
    margin: -6px -6px 0 0;
}

.tile-head .tile-more .mud-icon-button {
    border-radius: 8px;
    color: var(--tl-muted);
}

.tile-status {
    display: inline-flex;
    align-items: center;
    align-self: flex-start;
    gap: 8px;
    padding: 3px 10px;
    border: 0;
    border-radius: 9999px;
    background: var(--tl-soft);
    color: var(--tl-secondary);
    font: inherit;
    font-size: 12px;
    font-weight: 600;
    line-height: 18px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

    .tile-status:hover {
        background: #EFEDE9;
    }

.tile-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #9E9E9E;
}

.tile-status.ok .tile-status-dot {
    background: #16A34A;
}

.tile-status.warn .tile-status-dot {
    background: #D97706;
}

.tile-status.busy {
    background: var(--tl-tint);
    color: #1D4ED8;
}

    .tile-status.busy .tile-status-dot {
        background: var(--tl-accent);
        animation: tile-pulse 1.4s ease-in-out infinite;
    }

@keyframes tile-pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(54, 95, 217, 0.45);
    }

    50% {
        box-shadow: 0 0 0 5px rgba(54, 95, 217, 0);
    }
}

.tile-pages {
    display: flex;
    align-items: baseline;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 8px;
    background: var(--tl-soft);
    color: var(--tl-text);
    text-decoration: none;
    transition: background-color 0.3s ease;
}

    .tile-pages:hover {
        background: #EFEDE9;
    }

.tile-pages-count {
    font-size: 24px;
    font-weight: 600;
    line-height: 28px;
}

.tile-pages-label {
    color: var(--tl-muted);
    font-size: 14px;
}

.tile-pages .tile-pages-chevron {
    align-self: center;
    margin-left: auto;
    color: var(--tl-muted);
}

.tile-facts {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
}

    .tile-facts li {
        padding: 2px 10px;
        border: 1px solid var(--tl-border);
        border-radius: 9999px;
        color: var(--tl-secondary);
        font-size: 12px;
        line-height: 18px;
    }

.tile-actions {
    display: flex;
    gap: 8px;
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid var(--tl-border);
}

.tile-add {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 220px;
    padding: 24px;
    border: 1.5px dashed var(--tl-border-strong);
    border-radius: 12px;
    background: transparent;
    color: var(--tl-text);
    font: inherit;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.3s ease, background-color 0.3s ease;
}

    .tile-add:hover,
    .tile-add:focus-visible {
        border-color: var(--tl-accent);
        background: var(--tl-soft);
        outline: none;
    }

.tile-add-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    margin-bottom: 4px;
    border-radius: 50%;
    background: var(--tl-tint);
    color: var(--tl-accent);
}

.tile-add-title {
    font-size: 16px;
    font-weight: 600;
}

.tile-add-text {
    max-width: 240px;
    color: var(--tl-muted);
    font-size: 12px;
    line-height: 18px;
}

.tile :focus-visible,
.tile-status:focus-visible {
    outline: 2px solid rgba(59, 130, 246, 0.5);
    outline-offset: 2px;
}

/* Clickable title, error line, back link and detail wrapper. */
.tile-name {
    display: block;
    max-width: 100%;
    padding: 0;
    border: 0;
    background: none;
    color: inherit;
    font-family: inherit;
    text-align: left;
    cursor: pointer;
    transition: color 0.3s ease;
}

    .tile-name:hover {
        color: var(--tl-accent);
    }

.tile-pages {
    width: 100%;
    border: 0;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.tile-status.err .tile-status-dot {
    background: #DC2626;
}

.tile-status.err {
    background: #FDECEC;
    color: #B91C1C;
}

.tile-error {
    display: -webkit-box;
    margin: -4px 0 0;
    overflow: hidden;
    color: #B91C1C;
    font-size: 12px;
    line-height: 18px;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.tile-facts li.tile-fact-warn {
    border-color: #F5D0A9;
    background: #FFF7ED;
    color: #9A3412;
}

.tile-detail {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.tile-back {
    display: inline-flex;
    align-items: center;
    align-self: flex-start;
    gap: 6px;
    padding: 6px 12px 6px 8px;
    border: 0;
    border-radius: 50px;
    background: transparent;
    color: #365FD9;
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

    .tile-back:hover,
    .tile-back:focus-visible {
        background: #EEF2FC;
        outline: none;
    }

/* ---------- Page toolbar (MudAppBar rendered in the PageToolbar section) ---------- */
.page-toolbar + .mud-container {
    padding-top: 24px;
}

.page-toolbar .mud-toolbar {
    gap: 8px;
    width: 100%;
}

.page-toolbar-title {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

    .page-toolbar-title h1 {
        margin: 0;
        overflow: hidden;
        color: #212121;
        font-size: 20px;
        font-weight: 600;
        line-height: 28px;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

.page-toolbar-crumb {
    color: #595959;
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    transition: color 0.3s ease;
}

    .page-toolbar-crumb:hover {
        color: #365FD9;
    }

.page-toolbar-sep {
    color: #9E9E9E;
}

.page-toolbar-unsaved {
    margin-left: 8px;
    color: var(--mud-palette-warning);
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
}

.page-toolbar-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
}
/* ---------- Filter bar and segmented control ---------- */
.tiles-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}

.tiles-search {
    display: flex;
    flex: 0 1 360px;
    align-items: center;
    gap: 8px;
    height: 40px;
    padding: 0 14px;
    border: 1px solid var(--tl-border);
    border-radius: 50px;
    background: #FFFFFF;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

    .tiles-search:focus-within {
        border-color: var(--tl-accent);
        box-shadow: 0 0 0 3px rgba(54, 95, 217, 0.15);
    }

    .tiles-search .mud-icon-root {
        flex: 0 0 auto;
        color: var(--tl-muted);
        font-size: 20px;
    }

    .tiles-search input {
        flex: 1 1 auto;
        min-width: 0;
        border: 0;
        outline: 0;
        background: transparent;
        color: inherit;
        font: inherit;
        font-size: 14px;
    }

.seg {
    display: inline-flex;
    flex-wrap: wrap;
    padding: 2px;
    border-radius: 8px;
    background: #EBE8E3;
}

.seg-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: #595959;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    line-height: 22px;
    cursor: pointer;
    transition: background-color 0.3s ease, color 0.3s ease;
}

    .seg-btn:hover {
        color: #212121;
    }

    .seg-btn.active {
        background: #FFFFFF;
        color: #212121;
        box-shadow: 0 1px 2px rgba(36, 36, 36, 0.1);
    }

    .seg-btn .mud-icon-root {
        font-size: 18px;
    }

    .seg-btn:focus-visible {
        outline: 2px solid #365FD9;
        outline-offset: 1px;
    }

.seg-count {
    min-width: 20px;
    padding: 0 6px;
    border-radius: 9999px;
    background: rgba(0, 0, 0, 0.06);
    font-size: 11px;
    line-height: 18px;
    text-align: center;
}

.seg-btn.active .seg-count {
    background: #EEF2FC;
    color: #1D4ED8;
}
/* ---------- Tile extras: description, thumbnail, archived, empty states ---------- */
.tile-desc {
    display: -webkit-box;
    min-height: 60px;
    margin: 0;
    overflow: hidden;
    color: var(--tl-secondary);
    font-size: 14px;
    line-height: 20px;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
}

    .tile-desc.empty {
        color: var(--tl-muted);
        font-style: italic;
    }

.tile.archived {
    background: var(--tl-soft);
}

    .tile.archived .tile-avatar {
        background: #EBE8E3;
        color: var(--tl-muted);
    }

.tile-thumb {
    display: block;
    width: 100%;
    padding: 10px;
    border: 0;
    border-radius: 8px;
    background: var(--tl-soft);
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

    .tile-thumb:hover {
        background: #EFEDE9;
    }

.tile-thumb-grid {
    display: grid;
    grid-auto-rows: 22px;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 4px;
    height: 100px;
    overflow: hidden;
}

.tile-thumb-cell {
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
    padding: 0 6px;
    overflow: hidden;
    border: 1px solid var(--tl-border);
    border-radius: 4px;
    background: #FFFFFF;
    color: var(--tl-muted);
    font-size: 11px;
    line-height: 14px;
    white-space: nowrap;
}

    .tile-thumb-cell .mud-icon-root {
        flex: 0 0 auto;
        color: var(--tl-accent);
        font-size: 13px;
    }

    .tile-thumb-cell span {
        overflow: hidden;
        text-overflow: ellipsis;
    }

.tile-thumb-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100px;
    color: var(--tl-muted);
    font-size: 12px;
}

.tiles-empty {
    padding: 40px 24px;
    border: 1.5px dashed var(--tl-border-strong);
    border-radius: 12px;
    color: var(--tl-muted);
    font-size: 14px;
    text-align: center;
}
/* ---------- Editors (detail view behind a tile) ---------- */
.editor-card {
    border: 1px solid var(--tl-border);
    border-radius: 12px;
    background: #FFFFFF;
}

.editor-identity {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 16px 20px;
}

    .editor-identity .tile-avatar {
        width: 48px;
        height: 48px;
        margin-top: 4px;
        border-radius: 12px;
    }

.editor-fields {
    display: grid;
    flex: 1 1 auto;
    grid-template-columns: minmax(200px, 1fr) minmax(0, 2fr);
    gap: 16px;
    min-width: 0;
}

    .editor-fields textarea {
        field-sizing: content;
        min-height: calc(3lh + 2px);
        max-height: 12lh;
        resize: vertical;
    }

.editor-section-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.editor-section-title {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    line-height: 22px;
}

.editor-hint {
    margin: 2px 0 0;
    color: var(--tl-muted);
    font-size: 13px;
    line-height: 18px;
}

.editor-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 8px;
    background: var(--tl-tint);
    color: #1D4ED8;
    font-size: 13px;
    line-height: 18px;
}

    .editor-banner.warn {
        background: #FFF7ED;
        color: #9A3412;
    }

    .editor-banner.err {
        background: #FDECEC;
        color: #B91C1C;
    }

    .editor-banner .mud-icon-root {
        flex: 0 0 auto;
        font-size: 20px;
    }

    .editor-banner > span {
        flex: 1 1 auto;
    }

.editor-layout {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}

.editor-side {
    position: sticky;
    top: 16px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.editor-side-head {
    padding: 14px 16px 10px;
    border-bottom: 1px solid var(--tl-border);
}

.editor-main {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 0;
}

.editor-text-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border: 0;
    border-radius: 50px;
    background: transparent;
    color: #365FD9;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

    .editor-text-btn:hover,
    .editor-text-btn:focus-visible {
        background: #EEF2FC;
        outline: none;
    }

    .editor-text-btn .mud-icon-root {
        font-size: 18px;
    }

/* Side list (package files, data fields, ...) */
.side-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin: 0;
    padding: 8px;
    list-style: none;
}

.side-item {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    width: 100%;
    padding: 8px 10px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--tl-text);
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

    .side-item:hover {
        background: var(--tl-soft);
    }

    .side-item.active {
        background: var(--tl-tint);
    }

    .side-item:focus-visible {
        outline: 2px solid #365FD9;
        outline-offset: -2px;
    }

.side-item-icon {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--tl-soft);
    color: var(--tl-muted);
}

.side-item.active .side-item-icon {
    background: #FFFFFF;
    color: var(--tl-accent);
}

.side-item-icon .mud-icon-root {
    font-size: 18px;
}

.side-item-text {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-width: 0;
}

.side-item-name {
    overflow: hidden;
    font-size: 14px;
    font-weight: 600;
    line-height: 20px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.side-item.active .side-item-name {
    color: #1D4ED8;
}

.side-item-meta {
    overflow: hidden;
    color: var(--tl-muted);
    font-size: 12px;
    line-height: 16px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.side-item-dot {
    flex: 0 0 auto;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #D97706;
}

    .side-item-dot.err {
        background: #DC2626;
    }

.side-list-foot {
    padding: 4px 8px 10px;
}

@media (max-width: 960px) {
    .editor-layout {
        grid-template-columns: minmax(0, 1fr);
    }

    .editor-side {
        position: static;
    }

    .editor-fields {
        grid-template-columns: minmax(0, 1fr);
    }
}
/* ---------- Skills ---------- */
.skill-version-item {
    display: flex;
    flex-direction: column;
    line-height: 18px;
}

    .skill-version-item strong {
        font-size: 14px;
        font-weight: 600;
    }

    .skill-version-item span {
        color: #595959;
        font-size: 12px;
    }

.skill-file-head {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 16px 4px;
}

    .skill-file-head .side-item-icon {
        margin-top: 10px;
    }

    .skill-file-head .mud-button-root {
        margin-top: 10px;
    }

.skill-code-card {
    overflow: hidden;
}

.skill-code {
    height: clamp(380px, 60vh, 860px);
}
a.tile-name,
a.tile-thumb,
a.tile-add {
    color: var(--tl-text);
    text-decoration: none;
}

    a.tile-name:hover {
        color: var(--tl-accent);
    }