complete admin CSS refactor: delete utilities.css, add layout primitives

- Delete utilities.css (701 lines / 24 KB of Tailwind utility clones)
- Add layout.css with admin-stack, admin-row, admin-cluster, admin-grid
  primitives and gap variants (sm, md, lg, xl)
- Add transitions.css import and layout.css import to admin.css entry point
- Replace all Tailwind utility classes across 26 admin templates with
  semantic admin-*/theme-*/page-specific CSS classes
- Replace all non-dynamic inline styles with semantic classes
- Add ~100 new semantic classes to components.css (analytics, dashboard,
  order detail, settings, theme editor, generic utilities)
- Fix stray text-error → admin-text-error in media.ex
- Add missing .truncate definition to admin CSS
- Only remaining inline styles are dynamic data values (progress bars,
  chart dimensions) and one JS.toggle target

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
jamey
2026-03-01 21:40:21 +00:00
parent 22d3e36ed5
commit ae6cf209aa
26 changed files with 1343 additions and 1247 deletions

View File

@@ -252,6 +252,37 @@
flex: none;
}
/* ── Filter / tab row (below page header) ── */
.admin-filter-row {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 0.5rem;
margin-top: 1.5rem;
margin-bottom: 1rem;
}
.admin-filter-row-end {
display: flex;
flex-wrap: wrap;
align-items: flex-end;
gap: 0.5rem;
margin-top: 1.5rem;
margin-bottom: 1rem;
}
/* ── Back link (breadcrumb-style return link) ── */
.admin-back-link {
font-size: 0.875rem;
line-height: 1.25rem;
font-weight: 400;
color: color-mix(in oklch, var(--t-text-primary) 60%, transparent);
&:hover { text-decoration: underline; }
}
/* ── Cards ── */
.admin-card {
@@ -619,6 +650,14 @@
border: 1px solid color-mix(in oklch, var(--t-status-error) 25%, var(--t-surface-base));
}
.admin-alert-close {
align-self: flex-start;
cursor: pointer;
opacity: 0.4;
&:hover { opacity: 0.7; }
}
.admin-banner-warning {
display: flex;
align-items: center;
@@ -2699,6 +2738,10 @@
opacity: 0.7;
}
.media-card-size {
font-size: 0.75rem;
}
.media-card-no-alt {
display: flex;
align-items: center;
@@ -3081,6 +3124,114 @@
color: color-mix(in oklch, var(--t-text-primary) 50%, transparent);
}
/* ── Product thumbnail ── */
.admin-thumbnail {
width: 2.5rem;
height: 2.5rem;
border-radius: 0.25rem;
background-color: var(--t-surface-sunken);
overflow: hidden;
flex-shrink: 0;
}
.admin-thumbnail img {
width: 100%;
height: 100%;
object-fit: cover;
}
.admin-thumbnail-placeholder {
display: flex;
align-items: center;
justify-content: center;
width: 100%;
height: 100%;
}
/* ── Provider badge (small metadata pill) ── */
.admin-provider-badge {
display: inline-flex;
align-items: center;
border-radius: 9999px;
background-color: var(--t-surface-sunken);
padding: 0.125rem 0.375rem;
font-size: 0.75rem;
color: color-mix(in oklch, var(--t-text-primary) 60%, transparent);
margin-top: 0.125rem;
}
/* ── Sale tag ── */
.admin-sale-tag {
color: #dc2626;
font-size: 0.75rem;
font-weight: 500;
margin-inline-end: 0.25rem;
}
/* ── Product show layout ── */
.admin-product-grid {
display: grid;
gap: 1.5rem;
margin-top: 1.5rem;
@media (min-width: 1024px) { grid-template-columns: 2fr 1fr; }
}
.admin-product-image-grid {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 0.5rem;
@media (min-width: 640px) { grid-template-columns: repeat(4, 1fr); }
}
.admin-product-image-tile {
aspect-ratio: 1;
border-radius: 0.25rem;
background-color: var(--t-surface-sunken);
overflow: hidden;
& img {
width: 100%;
height: 100%;
object-fit: cover;
}
}
/* ── Provider status indicator ── */
.admin-provider-dot {
display: inline-flex;
width: 0.75rem;
height: 0.75rem;
border-radius: 9999px;
}
.admin-provider-dot-idle { background: color-mix(in oklch, var(--t-text-primary) 30%, transparent); }
.admin-provider-dot-syncing { background: var(--t-status-warning); animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite; }
.admin-provider-dot-ok { background: var(--t-status-success); }
.admin-provider-dot-error { background: var(--t-status-error); }
@keyframes pulse {
50% { opacity: 0.5; }
}
/* ── Nav editor section heading ── */
.admin-nav-section-heading {
font-size: 0.875rem;
line-height: 1.25rem;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.05em;
color: color-mix(in oklch, var(--t-text-primary) 50%, transparent);
margin-bottom: 0.75rem;
}
/* -- Activity feed -- */
.admin-activity-row {
@@ -3100,6 +3251,10 @@
margin-top: 0.125rem;
}
.admin-activity-icon-error { color: #ef4444; }
.admin-activity-icon-warning { color: #f59e0b; }
.admin-activity-icon-ok { color: #22c55e; }
.admin-activity-body {
flex: 1;
min-width: 0;
@@ -3125,6 +3280,29 @@
white-space: nowrap;
}
.admin-activity-link {
font-size: 0.75rem;
line-height: 1rem;
color: var(--t-accent);
margin-inline-start: 0.25rem;
&:hover { text-decoration: underline; }
}
/* Stream empty state (works with only:block pattern) */
.admin-stream-empty {
display: none;
text-align: center;
padding-block: 2rem;
font-size: 0.875rem;
line-height: 1.25rem;
color: color-mix(in oklch, var(--t-text-primary) 60%, transparent);
}
.admin-stream-empty:only-child {
display: block;
}
/* ── Generic admin helpers ── */
/* Main content area with responsive padding */
@@ -3150,6 +3328,8 @@
.admin-sidebar-header {
padding: 1rem;
border-bottom: 1px solid var(--t-border-default);
& .admin-text-secondary { margin-top: 0.125rem; }
}
/* Sidebar footer (view shop, log out) */
@@ -3843,4 +4023,713 @@
color: var(--t-text-primary);
}
/* Section-level spacing (lighter alternative to theme-panel — no background) */
.theme-section { margin-bottom: 1.5rem; }
/* Block-level label (theme-slider-label inline by default, sometimes needs block) */
.theme-block-label { display: block; margin-bottom: 0.5rem; }
/* Small text for checkbox/toggle labels in the sidebar */
.theme-check-text {
font-size: 0.875rem;
color: color-mix(in oklch, var(--t-text-primary) 80%, transparent);
}
/* Spacing between sub-controls within a panel */
.theme-subfield { margin-top: 0.75rem; }
.theme-subfield-sm { margin-top: 0.5rem; }
/* Customise accordion inner padding */
.theme-customise-body { padding-top: 1rem; }
/* Collapse button pulled flush to sidebar edge inside header */
.theme-header .theme-collapse-btn { margin: -0.25rem -0.5rem 0 0; }
/* Last group in a customise section (no border, tighter margin than theme-group) */
.theme-group-flush { margin-bottom: 1rem; }
/* ── Content width containers ── */
.admin-content-narrow { max-width: 32rem; }
.admin-content-medium { max-width: 42rem; }
/* ── Badge count (inline in tab/filter buttons) ── */
.admin-badge-count { margin-inline-start: 0.25rem; }
/* ── Help and warning text ── */
.admin-help-text {
font-size: 0.875rem;
color: color-mix(in oklch, var(--t-text-primary) 60%, transparent);
}
.admin-warning-text {
display: flex;
align-items: center;
gap: 0.5rem;
font-size: 0.875rem;
color: #b45309;
}
/* ── Callout warning (amber env-locked) ── */
.admin-callout-warning {
margin-top: 1.5rem;
border-radius: 0.375rem;
background: #fffbeb;
padding: 1rem;
box-shadow: inset 0 0 0 1px rgb(217 119 6 / 0.1);
}
.admin-callout-warning-body {
display: flex;
gap: 0.75rem;
}
.admin-callout-warning-icon {
color: #d97706;
flex-shrink: 0;
margin-top: 0.125rem;
}
.admin-callout-warning-title {
font-size: 0.875rem;
font-weight: 500;
color: #92400e;
}
.admin-callout-warning-desc {
margin-top: 0.25rem;
font-size: 0.875rem;
color: #b45309;
}
/* ── Section heading variants ── */
.admin-section-heading {
font-size: 1.125rem;
font-weight: 600;
}
.admin-section-subheading {
font-size: 1rem;
font-weight: 600;
}
/* ── Section with border separator ── */
.admin-section-bordered {
margin-top: 2rem;
border-top: 1px solid var(--t-surface-sunken);
padding-top: 1.5rem;
}
/* ── Email adapter config ── */
.admin-adapter-config {
margin-top: 1.5rem;
display: flex;
flex-direction: column;
gap: 1rem;
}
.admin-adapter-link {
font-weight: 400;
}
/* ── Campaign form ── */
.admin-campaign-actions {
display: flex;
align-items: center;
gap: 0.75rem;
padding-top: 1rem;
border-top: 1px solid var(--t-surface-sunken);
}
.admin-btn-success {
background-color: var(--color-green-600);
}
.admin-preview-summary {
font-size: 0.875rem;
font-weight: 500;
cursor: pointer;
}
.admin-preview-body {
margin-top: 0.5rem;
padding: 1rem;
background: var(--t-surface-sunken);
border-radius: 0.5rem;
font-size: 0.875rem;
white-space: pre-wrap;
overflow: auto;
max-height: 16rem;
}
/* ── Navigation editor ── */
.admin-nav-layout {
margin-top: 1.5rem;
max-width: 40rem;
display: flex;
flex-direction: column;
gap: 2rem;
}
.admin-nav-empty {
font-size: 0.875rem;
color: color-mix(in oklch, var(--t-text-primary) 50%, transparent);
padding: 1rem 0;
}
.admin-nav-actions {
margin-top: 0.75rem;
display: flex;
gap: 0.5rem;
}
.nav-editor-dropdown-wrap {
position: relative;
}
.nav-editor-dropdown-slug {
font-size: 0.75rem;
color: color-mix(in oklch, var(--t-text-primary) 40%, transparent);
}
/* ── Page editor ── */
.admin-editor-badges {
margin-top: 1rem;
display: flex;
gap: 0.5rem;
flex-wrap: wrap;
}
/* ── Product show ── */
.admin-product-header {
display: flex;
align-items: center;
gap: 0.75rem;
margin-top: 0.25rem;
}
.admin-product-title {
font-size: 1.5rem;
font-weight: 700;
}
.admin-card-spaced {
margin-top: 1.5rem;
}
/* ── Products table ── */
.admin-product-name {
font-weight: 500;
}
/* ── Visibility / availability icon colours ── */
.admin-icon-positive { color: #16a34a; }
.admin-icon-muted {
color: color-mix(in oklch, var(--t-text-primary) 30%, transparent);
}
/* ── Filter select label & wrapper ── */
.admin-filter-label {
font-size: 0.75rem;
margin-bottom: 0.125rem;
display: block;
}
.admin-filter-select {
width: auto;
}
.admin-filter-select-wide {
width: auto;
flex: 1;
min-width: 12rem;
}
/* ── Table row clickable ── */
.admin-table-row-clickable { cursor: pointer; }
/* ── Tab actions bar (right-aligned above table) ── */
.admin-tab-actions {
display: flex;
justify-content: flex-end;
margin-bottom: 1rem;
}
/* ── Filter row with space-between ── */
.admin-filter-row-between {
justify-content: space-between;
}
/* ── Form layout ── */
.admin-form-stack {
display: flex;
flex-direction: column;
gap: 1.5rem;
max-width: 32rem;
}
.admin-form-sub {
display: flex;
flex-direction: column;
gap: 1rem;
padding-inline-start: 1.5rem;
}
/* ── Inline input that fills remaining space ── */
.admin-input-fill { flex: 1; }
/* ── Source list (dead links) ── */
.admin-source-list {
list-style: none;
padding: 0;
margin: 0;
& li + li { margin-top: 0.25rem; }
}
/* ── Truncated cell ── */
.admin-cell-truncate { max-width: 20rem; }
/* ── Text weight modifier ── */
.admin-text-medium { font-weight: 500; }
/* ── Read-only actions (campaign form) ── */
.admin-readonly-actions {
padding-top: 1rem;
border-top: 1px solid var(--t-surface-sunken);
}
/* ── Row modifiers ── */
.admin-row-between { justify-content: space-between; }
.admin-row-sm { --admin-row-gap: 0.25rem; }
.admin-row-xl { --admin-row-gap: 1rem; }
/* ── Bold text weight ── */
.admin-text-bold { font-weight: 700; }
/* ── Semantic colour text ── */
.admin-text-warning { color: var(--t-status-warning, #d97706); }
.admin-text-error { color: var(--t-status-error, #ef4444); }
/* ── Right-aligned table cells ── */
.admin-cell-end { text-align: end; }
.admin-cell-numeric { text-align: end; font-variant-numeric: tabular-nums; }
/* ── Small inline code ── */
.admin-code-sm { font-size: 0.75rem; }
.admin-code-break { font-size: 0.75rem; word-break: break-all; }
/* ── Section body flush (no top margin) ── */
.admin-section-desc-flush { margin-top: 0; }
/* ── Separator (border-top with compact padding) ── */
.admin-separator {
border-top: 1px solid var(--t-surface-sunken);
padding-top: 0.75rem;
}
.admin-separator-lg {
border-top: 1px solid var(--t-surface-sunken);
padding-top: 1rem;
}
.admin-separator-xl {
border-top: 1px solid var(--t-surface-sunken);
padding-top: 1.5rem;
}
/* ── Button body (compact top margin for form buttons) ── */
.admin-form-actions-sm { margin-top: 0.75rem; }
/* ── Flex fill (take remaining space) ── */
.admin-fill { flex: 1; }
/* ── Larger input (prominent fields like shop name) ── */
.admin-input-lg { padding: 0.75rem 1rem; font-size: 1rem; }
/* ═══════════════════════════════════════════════════════════════════
Analytics
═══════════════════════════════════════════════════════════════════ */
.analytics-periods {
display: flex;
gap: 0.25rem;
margin-top: 1rem;
align-items: center;
}
.analytics-export { margin-left: auto; }
.analytics-filters {
display: flex;
gap: 0.5rem;
flex-wrap: wrap;
align-items: center;
margin-top: 1rem;
}
.analytics-filter-chip {
display: inline-flex;
align-items: center;
gap: 0.25rem;
padding: 0.25rem 0.5rem;
font-size: 0.75rem;
background: var(--color-base-200, #e5e5e5);
border-radius: 0.25rem;
}
.analytics-filter-remove {
cursor: pointer;
opacity: 0.6;
line-height: 1;
}
.analytics-tab-heading {
font-size: 0.875rem;
font-weight: 600;
margin-bottom: 0.75rem;
}
.analytics-tab-heading-spaced {
font-size: 0.875rem;
font-weight: 600;
margin: 1.5rem 0 0.75rem;
}
.analytics-chart-card { padding: 1rem; }
.analytics-tab-bar {
display: flex;
gap: 0.25rem;
margin-top: 1.5rem;
flex-wrap: wrap;
}
.analytics-tab-panel {
margin-top: 0.75rem;
padding: 1rem;
}
.analytics-empty {
text-align: center;
padding: 1.5rem;
color: color-mix(in oklch, var(--color-base-content) 40%, transparent);
}
/* Chart layout */
.analytics-chart-grid {
display: grid;
grid-template-columns: auto 1fr;
gap: 0 0.5rem;
position: relative;
}
.analytics-tooltip {
display: none;
position: absolute;
top: -1.75rem;
z-index: 10;
padding: 0.25rem 0.5rem;
font-size: 0.75rem;
font-weight: 500;
white-space: nowrap;
background: var(--color-base-content, #1e1e1e);
color: var(--color-base-100, #fff);
border-radius: 0.25rem;
pointer-events: none;
font-variant-numeric: tabular-nums;
}
.analytics-y-labels {
display: flex;
flex-direction: column;
justify-content: space-between;
align-items: flex-end;
height: 8rem;
font-size: 0.75rem;
color: color-mix(in oklch, var(--color-base-content) 50%, transparent);
}
.analytics-chart-area {
position: relative;
height: 8rem;
}
.analytics-gridline-mid {
position: absolute;
top: 50%;
left: 0;
right: 0;
border-top: 1px dashed color-mix(in oklch, var(--color-base-content) 12%, transparent);
}
.analytics-gridline-bottom {
position: absolute;
bottom: 0;
left: 0;
right: 0;
border-top: 1px solid color-mix(in oklch, var(--color-base-content) 15%, transparent);
}
.analytics-bars {
display: flex;
align-items: flex-end;
height: 100%;
}
.analytics-bar {
flex: 1;
background: var(--color-primary, #4f46e5);
opacity: 0.8;
border-radius: 1px 1px 0 0;
min-width: 0;
}
.analytics-x-labels {
display: flex;
justify-content: space-between;
padding-top: 0.25rem;
font-size: 0.75rem;
color: color-mix(in oklch, var(--color-base-content) 50%, transparent);
}
.analytics-delta {
font-size: 0.75rem;
font-weight: 500;
white-space: nowrap;
}
/* Funnel */
.analytics-funnel {
display: flex;
flex-direction: column;
gap: 0.5rem;
}
.analytics-funnel-step {
display: flex;
align-items: center;
gap: 0.75rem;
}
.analytics-funnel-label {
width: 7rem;
font-size: 0.8125rem;
text-align: right;
flex-shrink: 0;
}
.analytics-funnel-bar {
height: 2rem;
background: var(--color-primary, #4f46e5);
border-radius: 0.25rem;
display: flex;
align-items: center;
padding-left: 0.5rem;
}
.analytics-funnel-value {
font-size: 0.75rem;
font-weight: 600;
color: white;
}
.analytics-funnel-rate {
font-size: 0.8125rem;
font-weight: 600;
}
.analytics-funnel-summary {
margin-top: 0.75rem;
font-size: 0.875rem;
display: flex;
gap: 0.5rem;
flex-wrap: wrap;
}
/* ── Stat card (icon + value + label) ── */
.admin-stat-card-body {
display: flex;
align-items: center;
gap: 0.75rem;
padding: 1rem;
}
.admin-stat-icon {
background: var(--color-base-200, #e5e5e5);
border-radius: 0.5rem;
padding: 0.5rem;
flex-shrink: 0;
}
.admin-stat-value-row {
display: flex;
align-items: baseline;
gap: 0.5rem;
}
/* ═══════════════════════════════════════════════════════════════════
Dashboard
═══════════════════════════════════════════════════════════════════ */
.dashboard-section { margin-top: 2rem; }
.dashboard-section-header {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 1rem;
}
.dashboard-view-all {
font-size: 0.875rem;
color: color-mix(in oklch, var(--color-base-content) 60%, transparent);
}
.dashboard-recent-orders { overflow-x: auto; }
.dashboard-stat-link {
display: block;
text-decoration: none;
color: inherit;
}
.setup-complete-actions {
display: flex;
gap: 0.5rem;
justify-content: center;
flex-wrap: wrap;
}
.dashboard-empty-orders {
border: 1px solid var(--color-base-200, #e5e5e5);
border-radius: 0.5rem;
padding: 2rem;
text-align: center;
color: color-mix(in oklch, var(--color-base-content) 60%, transparent);
}
.dashboard-empty-icon {
margin: 0 auto 0.75rem;
width: 2.5rem;
opacity: 0.3;
}
/* ═══════════════════════════════════════════════════════════════════
Order show
═══════════════════════════════════════════════════════════════════ */
.order-detail-grid {
margin-top: 1.5rem;
&.admin-grid {
--admin-grid-min: 20rem;
--admin-grid-gap: 1.5rem;
}
}
.order-timeline-actions {
margin-top: 0.5rem;
margin-bottom: 1rem;
}
.order-tracking {
margin-bottom: 1rem;
font-size: 0.875rem;
}
.order-timeline-empty {
padding-block: 1rem;
margin-top: 0;
}
.order-total-row { font-size: 1.125rem; }
/* ── Foundational utilities ── */
/* Classes that can't be replaced with inline styles because they're
passed via class attributes to components like <.icon> */
.size-3 { width: 0.75rem; height: 0.75rem; }
.size-4 { width: 1rem; height: 1rem; }
.size-5 { width: 1.25rem; height: 1.25rem; }
.size-6 { width: 1.5rem; height: 1.5rem; }
.size-8 { width: 2rem; height: 2rem; }
.size-10 { width: 2.5rem; height: 2.5rem; }
.size-12 { width: 3rem; height: 3rem; }
.shrink-0 { flex-shrink: 0; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ml-1 { margin-inline-start: 0.25rem; }
.sr-only {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
clip: rect(0, 0, 0, 0);
white-space: nowrap;
border-width: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }
.animate-spin { animation: spin 1s linear infinite; }
@media (prefers-reduced-motion: reduce) { .animate-spin { animation: none; } }
@media (prefers-reduced-motion: no-preference) {
.motion-safe\:animate-spin { animation: spin 1s linear infinite; }
}
/* Phoenix LiveView JS transition utilities */
.transition-all { transition-property: all; }
.ease-out { transition-timing-function: cubic-bezier(0, 0, 0.2, 1); }
.ease-in { transition-timing-function: cubic-bezier(0.4, 0, 1, 1); }
.duration-200 { transition-duration: 200ms; }
.duration-300 { transition-duration: 300ms; }
.opacity-0 { opacity: 0; }
.opacity-100 { opacity: 1; }
.translate-y-0 { translate: 0 0; }
.translate-y-4 { translate: 0 1rem; }
@media (min-width: 640px) {
.sm\:translate-y-0 { translate: 0 0; }
.sm\:scale-95 { scale: 0.95; }
.sm\:scale-100 { scale: 1; }
}
} /* @layer admin */