.theme-me-layout {
    min-height: calc(100dvh - 180px);
    color: var(--color-ink);
}

.theme-me-panel {
    display: grid;
    min-width: 0;
    gap: 16px;
}

.theme-me-eyebrow {
    margin: 0 0 6px;
    color: var(--color-muted);
    font-size: 12px;
    font-weight: 500;
    line-height: 1;
}

.theme-me-profile h2,
.theme-me-overview-table h3,
.theme-me-tip p {
    margin: 0;
}

.theme-me-hero {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 18px;
    min-height: 108px;
    border: 1px solid var(--color-hairline);
    border-radius: var(--radius-lg);
    background: var(--color-surface);
    padding: 20px;
}

html[data-color-scheme="ink"] .theme-me-hero {
    border-color: var(--panel-border);
}

.theme-me-avatar {
    display: inline-flex;
    width: 76px;
    height: 76px;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 1px solid var(--color-hairline);
    border-radius: 50%;
    background: var(--color-surface-strong);
    color: var(--color-ink);
}

.theme-me-avatar-media {
    display: inline-flex;
    width: 100%;
    height: 100%;
    align-items: center;
    justify-content: center;
    border-radius: inherit;
    color: var(--color-ink);
    font-size: 26px;
    font-weight: 500;
    object-fit: cover;
}

.theme-me-profile {
    min-width: 0;
}

.theme-me-profile h2 {
    overflow: hidden;
    color: var(--color-ink);
    font-size: clamp(28px, 3vw, 38px);
    font-weight: 300;
    line-height: 1.14;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.theme-me-profile p:not(.theme-me-eyebrow) {
    margin: 12px 0 0;
    color: var(--color-body);
    font-size: 14px;
}

.theme-me-filter {
    display: flex;
    gap: 6px;
    min-width: 0;
    overflow-x: auto;
    border-bottom: 0;
    padding: 0 0 8px;
    scrollbar-width: none;
}

.theme-me-filter::-webkit-scrollbar {
    display: none;
}

html[data-color-scheme="ink"] .theme-me-filter {
    border-color: var(--panel-border);
}

.theme-me-filter-item {
    position: relative;
    display: inline-flex;
    flex: 0 0 auto;
    min-height: 32px;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-button);
    background: var(--color-canvas-soft);
    color: var(--color-muted);
    cursor: pointer;
    padding: 0 12px;
    font-size: 13px;
    font-weight: 500;
    line-height: 1;
    user-select: none;
    transition:
        background-color 160ms ease,
        color 160ms ease;
}

.theme-me-filter-item input {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
}

.theme-me-filter-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.theme-me-filter-item:hover,
.theme-me-filter-item:has(input:checked) {
    background: var(--control-bg-active);
    color: var(--control-text-active);
}

.theme-me-filter-item:has(input:focus-visible) {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

.theme-me-overview {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
    gap: 10px;
}

.theme-me-overview-table {
    display: grid;
    min-height: 140px;
    align-content: start;
    gap: 12px;
    overflow: hidden;
    border: 1px solid var(--color-hairline);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    color: var(--color-body);
    padding: 16px;
}

html[data-color-scheme="ink"] .theme-me-overview-table {
    border-color: var(--panel-border);
}

.theme-me-overview-table h3 {
    color: var(--color-ink);
    font-size: 15px;
    font-weight: 400;
    line-height: 1.3;
}

.theme-me-overview-rows {
    display: grid;
    gap: 1px;
}

.theme-me-overview-rows.is-scrollable {
    max-height: 176px;
    overflow: auto;
    overscroll-behavior: contain;
    padding-right: 4px;
    scrollbar-width: thin;
}

.theme-me-overview-rows.is-scrollable::-webkit-scrollbar {
    width: 6px;
}

.theme-me-overview-rows.is-scrollable::-webkit-scrollbar-thumb {
    border-radius: var(--radius-pill);
    background: var(--color-hairline-strong);
}

.theme-me-overview-row {
    display: grid;
    grid-template-columns: minmax(40px, 0.8fr) minmax(72px, 0.45fr) minmax(0, 1.25fr);
    align-items: center;
    gap: 8px;
    min-height: 28px;
}

.theme-me-overview-row + .theme-me-overview-row {
    border-top: 1px solid var(--color-hairline);
    padding-top: 1px;
}

html[data-color-scheme="ink"] .theme-me-overview-row + .theme-me-overview-row {
    border-top-color: var(--panel-border);
}

.theme-me-overview-row span,
.theme-me-overview-row small {
    overflow: hidden;
    color: var(--color-muted);
    font-size: 12px;
    line-height: 1.4;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.theme-me-overview-row strong {
    overflow: hidden;
    color: var(--color-ink);
    font-size: 16px;
    font-weight: 300;
    line-height: 1;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0;
    text-align: right;
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow-wrap: anywhere;
}

.theme-me-entry-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 10px;
}

.theme-me-plugin-zone {
    display: contents;
}

.theme-me-action-grid {
    display: contents;
}

.theme-me-layout:has(.theme-me-filter-all input:checked) .theme-me-action-grid,
.theme-me-layout:has(.theme-me-filter-all input:checked) .theme-me-plugin-zone,
.theme-me-layout:has(.theme-me-filter-account input:checked) .theme-me-overview {
    display: none;
}

.theme-me-plugin-zone:empty {
    display: none;
}

.theme-me-action-card,
.theme-me-plugin-zone > .dashboard-card {
    display: grid;
    min-height: 68px;
    align-content: space-between;
    overflow: hidden;
    border: 1px solid var(--color-hairline);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    color: var(--color-body);
    padding: 12px;
    text-decoration: none;
    transition:
        border-color 160ms ease,
        background-color 160ms ease;
}

html[data-color-scheme="ink"] :is(.theme-me-action-card, .theme-me-plugin-zone > .dashboard-card) {
    border-color: var(--panel-border);
}

.theme-me-action-card:hover,
.theme-me-plugin-zone > .dashboard-card:hover {
    border-color: var(--color-hairline-strong);
    background: var(--color-canvas-soft);
}

.theme-me-action-card small,
.theme-me-plugin-zone > .dashboard-card span,
.theme-me-plugin-zone > .dashboard-card small {
    color: var(--color-muted);
    font-size: 12px;
    line-height: 1.4;
}

.theme-me-action-card strong,
.theme-me-plugin-zone > .dashboard-card h3 {
    margin: 0;
    color: var(--color-ink);
    font-size: 15px;
    font-weight: 400;
    line-height: 1.3;
}

.theme-me-plugin-zone > .dashboard-card strong {
    color: var(--color-ink);
    font-size: 18px;
    font-weight: 300;
    line-height: 1;
    overflow-wrap: anywhere;
}

.theme-me-tip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    min-height: 44px;
    border-top: 1px solid var(--color-hairline);
    color: var(--color-body);
    padding: 10px 0 0;
}

html[data-color-scheme="ink"] .theme-me-tip {
    border-top-color: var(--panel-border);
}

.theme-me-tip span {
    color: var(--color-ink);
    font-size: 14px;
    white-space: nowrap;
}

.theme-me-tip p {
    color: var(--color-body);
    font-size: 14px;
    line-height: 1.6;
}

@media (max-width: 1100px) {
    .theme-me-entry-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (max-width: 820px) {
    .theme-me-entry-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .theme-me-overview {
        grid-template-columns: 1fr;
    }

    .theme-me-overview-table {
        min-height: 128px;
    }
}

@media (max-width: 560px) {
    .theme-me-hero {
        padding: 16px;
    }

    .theme-me-filter {
        margin-right: -4px;
        margin-left: -4px;
        padding-right: 4px;
        padding-left: 4px;
    }

    .theme-me-filter-item {
        min-height: 34px;
        padding: 0 10px;
    }

    .theme-me-hero {
        grid-template-columns: 1fr;
        min-height: 0;
    }

    .theme-me-avatar {
        width: 68px;
        height: 68px;
    }

    .theme-me-profile h2 {
        white-space: normal;
    }

    .theme-me-entry-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .theme-me-overview {
        grid-template-columns: 1fr;
    }

    .theme-me-overview-table {
        min-height: 0;
    }

    .theme-me-action-card,
    .theme-me-plugin-zone > .dashboard-card {
        min-height: 68px;
    }

    .theme-me-tip {
        align-items: flex-start;
        flex-direction: column;
    }
}
