/* ============================================
   Base Resets
   ============================================ */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: #f1f5f9; }
::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

body:not(.app-ready) #app { visibility: hidden; }

body.workbench-theme {
    background: #f8fafc;
    overflow: hidden;
}
body.workbench-theme.workbench-flow-page {
    overflow-x: hidden;
    overflow-y: auto;
}

[hidden] { display: none !important; }

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; outline: none; }
button { cursor: pointer; background: none; }
input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-decoration { display: none; }

/* ============================================
   Workbench Root & Layout
   ============================================ */
.workbench-root {
    width: 100vw !important;
    max-width: none !important;
    margin: 0 !important;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.workbench-body {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: 228px minmax(0, 1fr);
    background: #f8fafc;
}

.workbench-body-full {
    grid-template-columns: minmax(0, 1fr);
}

.workbench-main {
    min-width: 0;
    min-height: 0;
    background: #f8fafc;
}

.workbench-scroll {
    height: 100%;
    overflow: auto;
    padding: 16px;
    background: transparent;
}

.workbench-scroll-tight {
    overflow: hidden;
    padding: 12px;
}

/* ---- Flow Page Overrides ---- */
.workbench-root.workbench-flow-page .workbench-body {
    flex: 0 0 auto;
    min-height: auto;
}

.workbench-root.workbench-flow-page .workbench-main {
    min-height: auto;
}

.workbench-root.workbench-flow-page .workbench-scroll {
    height: auto;
    overflow: visible;
    padding: 0;
}

.workbench-root.workbench-flow-page .property-editor {
    position: static;
    max-height: none;
}

.editor-two-pane {
    gap: 0;
    align-items: stretch;
    min-height: calc(100vh - 48px);
    background: #ffffff;
}

.editor-content-pane {
    min-width: 0;
    padding: 0;
}

.editor-content-pane-inner {
    display: flex;
    flex-direction: column;
    min-height: 100%;
}

.editor-section {
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
    overflow: visible;
}

.editor-section + .editor-section {
    border-top: 1px solid #e2e8f0;
}

.editor-section-header {
    padding: 14px 18px 8px 18px;
    border-bottom: none;
}

.editor-section-body {
    padding: 0 18px 14px 18px;
}

.editor-inspector-pane {
    min-width: 0;
    padding: 16px 14px 16px 18px;
    border-left: 1px solid #e2e8f0;
    background: rgba(255, 255, 255, 0.94);
}

.editor-inspector-pane .property-editor {
    height: 100%;
    border: none;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
}

/* ============================================
   Toolrail
   ============================================ */
.toolrail {
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: 14px 0;
    background: #ffffff;
    border-right: 1px solid #e2e8f0;
}

.toolrail-section {
    padding: 0;
}

.toolrail-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.toolrail-link {
    position: relative;
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: 48px;
    padding: 0 18px 0 20px;
    color: #64748b;
    text-decoration: none;
    transition: background-color 120ms ease, color 120ms ease;
}

.toolrail-link:hover {
    background: #f8fafc;
    color: #0f172a;
}

.toolrail-link.is-active {
    color: #0f172a;
    background: linear-gradient(90deg, rgba(255, 247, 237, 0.92) 0%, rgba(255, 255, 255, 1) 78%);
}

.toolrail-link-marker {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    background: transparent;
    transition: background-color 120ms ease;
}

.toolrail-link.is-active .toolrail-link-marker {
    background: #f97316;
}

.toolrail-link-icon {
    display: inline-flex;
    width: 20px;
    height: 20px;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    color: currentColor;
}

.toolrail-link-icon svg {
    width: 20px;
    height: 20px;
    display: block;
}

.toolrail-link-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0.01em;
}

.toolrail-link.is-active .toolrail-link-label {
    font-weight: 600;
}

/* ============================================
   User Menu — Transitions & Arrow
   ============================================ */
.user-menu-trigger {
    transition: background 120ms, border-color 120ms;
}

.user-menu-arrow {
    transition: transform 150ms;
}

.user-menu-trigger.user-menu-open .user-menu-arrow {
    transform: rotate(180deg);
}

/* ============================================
   Modal
   ============================================ */
.modal-open { overflow: hidden; }

.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(15, 23, 42, 0.34);
    display: grid;
    place-items: center;
    padding: 24px;
    backdrop-filter: blur(10px);
}

.modal-overlay[hidden] { display: none; }

/* ============================================
   Table Canvas & Loading
   ============================================ */
.workbench-root.workbench-page-table .workbench-main {
    background: #ffffff;
}

.workbench-root.workbench-page-table .workbench-scroll {
    height: 100%;
    overflow: hidden;
    padding: 0;
    background: #ffffff;
}

.table-workbench {
    gap: 0;
    align-items: stretch;
    min-height: calc(100vh - 56px);
    height: calc(100vh - 56px);
    background: #ffffff;
}

.table-stage-pane {
    min-width: 0;
    min-height: 0;
    padding: 0;
    background: #ffffff;
}

.table-inspector-pane {
    min-width: 0;
    min-height: 0;
    padding: 16px 14px 16px 18px;
    border-left: 1px solid #e2e8f0;
    background: rgba(255, 255, 255, 0.94);
}

.table-inspector-shell {
    display: flex;
    flex-direction: column;
    min-height: 100%;
    height: 100%;
}

.table-inspector-tabs {
    position: sticky;
    top: 0;
    z-index: 2;
    display: flex;
    gap: 0;
    padding: 0;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: none;
    border-bottom: 1px solid #e2e8f0;
}

.table-inspector-tab {
    position: relative;
    min-width: 0;
    height: 40px;
    min-height: 40px;
    padding: 0 8px;
    border: none;
    border-radius: 0;
    background: transparent;
    color: #64748b;
    transition: background-color 120ms ease, color 120ms ease;
}

.table-inspector-tab::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: -1px;
    height: 2px;
    background: transparent;
    transition: background-color 120ms ease;
}

.table-inspector-scroll {
    flex: 1;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.table-inspector-panel {
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding: 14px 0 0;
}

.table-inspector-section {
    padding-bottom: 18px;
    border-bottom: 1px solid #e2e8f0;
}

.table-scene-header {
    margin-bottom: 8px;
}

.table-scene-block {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-top: 14px;
    border-top: 1px solid #f1f5f9;
}

.table-scene-block:first-of-type {
    padding-top: 0;
    border-top: none;
}

.table-scene-block-label {
    font-size: 11px;
    line-height: 1.2;
    font-weight: 600;
    letter-spacing: 0.03em;
    color: #94a3b8;
}

.table-scene-camera-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.table-scene-action {
    width: 100%;
    justify-content: center;
    min-height: 30px;
}

.table-scene-camera-grid .table-scene-action:first-child {
    grid-column: 1 / -1;
}

.table-scene-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.table-scene-legend-item {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 0 9px;
    font-size: 11px;
    line-height: 1;
    font-weight: 500;
    border: 1px solid #e2e8f0;
    background: #ffffff;
    color: #475569;
    border-radius: 999px;
}

.table-scene-legend-item.is-cyan {
    color: #0f766e;
    border-color: #a5f3fc;
    background: #ecfeff;
}

.table-scene-legend-item.is-purple {
    color: #7c3aed;
    border-color: #ddd6fe;
    background: #f5f3ff;
}

.table-scene-legend-item.is-teal {
    color: #0f766e;
    border-color: #99f6e4;
    background: #f0fdfa;
}

.table-scene-legend-item.is-pink {
    color: #be185d;
    border-color: #fbcfe8;
    background: #fdf2f8;
}

.table-inspector-section-plain:last-child,
.table-inspector-section:last-child {
    padding-bottom: 0;
    border-bottom: none;
}

.table-canvas-wrap {
    position: relative;
    min-height: 100%;
    height: 100%;
    overflow: hidden;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    border: none;
    border-radius: 0;
    box-shadow: none;
}

.table-canvas {
    width: 100%;
    height: 100%;
}

.table-canvas-wrap.is-loading .table-canvas,
.table-canvas-wrap.is-loading .hud,
.table-canvas-wrap.is-loading .stack-hover-tooltip,
.table-canvas-wrap.is-loading .marquee-select-box {
    opacity: 0;
    visibility: hidden;
}

.table-loading-overlay {
    position: absolute;
    inset: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.96) 0%, rgba(248, 250, 252, 0.98) 100%);
    transition: opacity 180ms ease, visibility 180ms ease;
}

.table-loading-overlay.is-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.table-inspector-tab:hover {
    color: #0f172a;
    background: #f8fafc;
}

.table-inspector-tab.active {
    color: #0f172a;
    background: linear-gradient(180deg, rgba(255, 247, 237, 0.78) 0%, rgba(255, 255, 255, 0.96) 100%);
    box-shadow: none;
}

.table-inspector-tab.active::after {
    background: #f97316;
}

.table-panel-highlight {
    padding: 14px 16px;
    border-radius: 12px;
    border: 1px solid rgba(253, 186, 116, 0.35);
    background: linear-gradient(180deg, rgba(255, 247, 237, 0.78) 0%, rgba(255, 255, 255, 0.96) 100%);
}

.table-panel-list {
    display: flex;
    flex-direction: column;
}

.table-panel-item {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 14px 0;
    border-bottom: 1px solid rgba(226, 232, 240, 0.85);
}

.table-panel-item:first-child {
    padding-top: 0;
}

.table-panel-item:last-child {
    padding-bottom: 0;
    border-bottom: none;
}

.table-panel-item.is-selected {
    margin: 0 -10px;
    padding: 14px 10px;
    border-bottom-color: transparent;
    border-radius: 12px;
    background: rgba(255, 247, 237, 0.82);
    box-shadow: inset 2px 0 0 #f97316;
}

.table-panel-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.table-panel-title-wrap {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.table-panel-kicker {
    font-size: 11px;
    line-height: 1.2;
    font-weight: 600;
    color: #94a3b8;
}

.table-panel-title {
    font-size: 14px;
    line-height: 1.45;
    font-weight: 600;
    color: #0f172a;
    word-break: break-word;
}

.table-panel-subtitle {
    font-size: 12px;
    line-height: 1.6;
    color: #64748b;
}

.table-panel-badges {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.table-inline-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 22px;
    padding: 0 8px;
    font-size: 11px;
    line-height: 1;
    font-weight: 500;
    color: #475569;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    border-radius: 999px;
}

.table-inline-badge.is-accent {
    color: #c2410c;
    border-color: #fed7aa;
    background: #fff7ed;
}

.table-inline-badge.is-soft {
    color: #64748b;
    background: #ffffff;
}

.table-panel-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.table-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    padding: 0 10px;
    font-size: 12px;
    line-height: 1;
    font-weight: 500;
    color: #475569;
    border: 1px solid #e2e8f0;
    background: #ffffff;
    border-radius: 8px;
    transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease;
}

.table-action-btn:hover {
    color: #0f172a;
    background: #f8fafc;
}

.table-action-btn-danger {
    color: #ef4444;
    border-color: #fecaca;
    background: #ffffff;
}

.table-action-btn-danger:hover {
    background: #fef2f2;
}

.table-action-btn-primary {
    color: #ffffff;
    border-color: #f97316;
    background: #f97316;
}

.table-action-btn-primary:hover {
    background: #ea580c;
    border-color: #ea580c;
    color: #ffffff;
}

.table-panel-stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.table-zone-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.table-zone-card {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #fbfdff;
}

.table-zone-card-head {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.table-zone-dot {
    width: 8px;
    height: 8px;
    flex: 0 0 auto;
    border-radius: 999px;
    background: #cbd5e1;
}

.table-zone-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 11px;
    line-height: 1.2;
    font-weight: 600;
    color: #64748b;
}

.table-zone-count {
    font-size: 18px;
    line-height: 1;
    font-weight: 700;
    color: #0f172a;
}

.table-zone-meta {
    font-size: 11px;
    line-height: 1.2;
    color: #94a3b8;
}

.table-zone-card.is-cyan .table-zone-dot {
    background: #06b6d4;
}

.table-zone-card.is-purple .table-zone-dot {
    background: #8b5cf6;
}

.table-zone-card.is-teal .table-zone-dot {
    background: #14b8a6;
}

.table-zone-card.is-pink .table-zone-dot {
    background: #ec4899;
}

.table-panel-stat {
    min-width: 0;
    padding: 10px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #fbfdff;
}

.table-selected-panel {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.table-selected-summary {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.table-selected-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.table-selected-empty {
    padding: 8px 0;
    text-align: left;
    font-size: 14px;
    line-height: 1.7;
    color: #94a3b8;
}

.table-selected-group {
    padding-top: 12px;
    border-top: 1px solid rgba(226, 232, 240, 0.9);
}

.table-selected-group:first-child {
    padding-top: 0;
    border-top: none;
}

.table-selected-group-label {
    margin-bottom: 8px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.03em;
    color: #94a3b8;
}

.table-selected-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.table-loading-spinner {
    width: 28px;
    height: 28px;
    border: 2px solid rgba(249, 115, 22, 0.18);
    border-top-color: #f97316;
    border-right-color: rgba(249, 115, 22, 0.42);
    border-radius: 50%;
    animation: table-loading-spin 840ms linear infinite;
}

@keyframes table-loading-spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

/* ============================================
   HUD
   ============================================ */
.hud {
    position: absolute;
    right: 12px;
    top: 12px;
    display: flex;
    gap: 8px;
    pointer-events: none;
}

.hud-card {
    pointer-events: auto;
    min-width: 180px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(12px);
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.08);
}

.hud-card h3 {
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 2px;
}

.hud-card p {
    font-size: 12px;
    color: #94a3b8;
}

/* ============================================
   Stack Hover Tooltip
   ============================================ */
.stack-hover-tooltip {
    position: absolute;
    left: 0;
    top: 0;
    z-index: 12;
    min-width: 100px;
    padding: 6px 8px;
    background: rgba(255, 255, 255, 0.98);
    color: #475569;
    font-size: 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.12), 0 8px 10px -6px rgba(0, 0, 0, 0.08);
    pointer-events: none;
    opacity: 0;
    transform: translate3d(8px, 8px, 0) scale(.96);
    transition: opacity 100ms, transform 100ms;
}

.stack-hover-tooltip.visible {
    opacity: 1;
    transform: translate3d(12px, 12px, 0) scale(1);
}

.stack-hover-tooltip strong {
    display: block;
    font-size: 12px;
    color: #f97316;
    margin-bottom: 1px;
}

.stack-hover-tooltip span {
    display: block;
    color: #475569;
}

/* ============================================
   Marquee Select Box
   ============================================ */
.marquee-select-box {
    position: absolute;
    left: 0;
    top: 0;
    z-index: 11;
    border: 1px solid #f97316;
    background: rgba(249, 115, 22, 0.10);
    pointer-events: none;
    opacity: 0;
}

/* ============================================
   Toast
   ============================================ */
.toast-stack {
    position: fixed;
    right: 14px;
    top: 50px;
    z-index: 9999;
    display: grid;
    gap: 6px;
}

.toast {
    min-width: 220px;
    max-width: 320px;
    padding: 8px 12px;
    background: #ffffff;
    font-size: 13px;
    color: #1e293b;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.10), 0 8px 10px -6px rgba(0, 0, 0, 0.08);
}

.toast.success { border-left: 2px solid #4ade80; }
.toast.warn    { border-left: 2px solid #f59e0b; }
.toast.error   { border-left: 2px solid #f87171; }

/* ============================================
   Stage Objects & Scenes
   ============================================ */
.live-stage {
    width: 100%;
    min-height: 340px;
    border: 1px solid rgba(226, 232, 240, 0.85);
    border-radius: 10px;
    background: #fbfdff;
}

.token-stage-scene,
.dice-stage-scene,
.card-stage-scene {
    display: grid;
    place-items: center;
    min-height: 240px;
    padding: 16px;
    background: transparent;
}

.card-stage-scene {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    align-items: center;
}

.token-stage-object {
    overflow: hidden;
    border-radius: 14px;
    box-shadow: 0 8px 18px -10px rgba(15, 23, 42, 0.24);
}

.token-stage-object.circle { border-radius: 50%; }

.token-stage-object img,
.card-stage-object img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.card-stage-object {
    overflow: hidden;
    background: #ffffff;
    border-radius: 14px;
    border: 1px solid rgba(226, 232, 240, 0.92);
    box-shadow: 0 8px 18px -10px rgba(15, 23, 42, 0.24);
}

.card-stage-object.card-back {
    background: linear-gradient(180deg, #fff7ed 0%, #ffedd5 100%);
}

.card-stage-placeholder {
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
    color: #94a3b8;
    font-size: 14px;
    font-weight: 600;
}

.dice-stage-object {
    display: grid;
    place-items: center;
    border-radius: 16px;
    border: 1px solid #dbe4ee;
    box-shadow: 0 8px 18px -10px rgba(15, 23, 42, 0.24);
    transform: rotate(-12deg);
}

.dice-stage-object span {
    color: #1e293b;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 0.02em;
}

/* ============================================
   Property Editor
   ============================================ */
.property-editor {
    position: sticky;
    top: 16px;
    align-self: stretch;
    max-height: calc(100vh - 32px);
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    border: none;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
}

.property-editor > div,
.property-editor form,
.property-editor section {
    width: 100%;
}

.property-editor-header {
    padding: 10px 0 12px;
    border-bottom: 1px solid rgba(226, 232, 240, 0.92);
}

.property-editor-body {
    min-height: 0;
    padding: 12px 0 0;
    overflow-y: auto;
}

.property-editor-form {
    display: grid;
    gap: 16px;
}

.property-editor-group {
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(226, 232, 240, 0.72);
}

.property-editor-group:last-of-type {
    padding-bottom: 0;
    border-bottom: none;
}

.property-editor-group-head {
    margin-bottom: 10px;
}

.property-editor-sticky-actions {
    position: sticky;
    bottom: 0;
    z-index: 10;
    margin-top: 2px;
    padding: 12px 0 0;
    border-top: 1px solid rgba(226, 232, 240, 0.92);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.94) 18%, rgba(255, 255, 255, 0.98) 100%);
    backdrop-filter: blur(10px);
}

.property-editor-sticky-actions > div {
    gap: 8px;
}

.property-editor input:not([type="color"]):not([type="file"]),
.property-editor select,
.property-editor textarea {
    width: 100%;
}

.overview-shell {
    display: flex;
    flex-direction: column;
    min-height: 100%;
    background: linear-gradient(180deg, #fcfdff 0%, #f8fafc 100%);
}

.dashboard-shell {
    display: flex;
    flex-direction: column;
    min-height: 100%;
    background: linear-gradient(180deg, #fcfdff 0%, #f8fafc 100%);
}

.dashboard-section {
    background: rgba(255, 255, 255, 0.74);
    border: none;
    border-radius: 0;
    box-shadow: none;
    overflow: visible;
}

.dashboard-section-header {
    padding: 14px 18px 10px 18px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.dashboard-section-body {
    padding: 0 18px 16px 18px;
}

.dashboard-section-heading {
    min-width: 0;
}

.dashboard-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: nowrap;
    flex: 0 0 auto;
}

.dashboard-search-wrap {
    width: 320px;
    min-width: 320px;
    flex: 0 1 320px;
}

.dashboard-toolbar > .dashboard-primary-btn {
    flex: 0 0 auto;
    white-space: nowrap;
}

.dashboard-search-input {
    width: 100%;
    height: 36px;
    padding: 0 12px;
    font-size: 14px;
    color: #0f172a;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #ffffff;
    transition: border-color 120ms ease, box-shadow 120ms ease;
}

.dashboard-search-input::placeholder {
    color: #94a3b8;
}

.dashboard-search-input:focus {
    border-color: #f97316;
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.12);
}

.dashboard-primary-btn,
.dashboard-secondary-btn,
.dashboard-danger-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    line-height: 1;
    transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease;
}

.dashboard-primary-btn {
    color: #ffffff;
    background: #f97316;
    border-color: #f97316;
}

.dashboard-primary-btn:hover {
    background: #ea580c;
    border-color: #ea580c;
}

.dashboard-secondary-btn {
    color: #475569;
    background: #ffffff;
}

.dashboard-secondary-btn:hover {
    color: #0f172a;
    background: #f8fafc;
}

.dashboard-danger-btn {
    color: #ef4444;
    background: #ffffff;
    border-color: #fecaca;
}

.dashboard-danger-btn:hover {
    background: #fef2f2;
}

.dashboard-summary-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.dashboard-summary-chip {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 0 9px;
    font-size: 11px;
    line-height: 1;
    font-weight: 500;
    color: #64748b;
    border: 1px solid #e2e8f0;
    background: #ffffff;
    border-radius: 999px;
}

.dashboard-summary-chip.is-accent {
    color: #c2410c;
    border-color: #fed7aa;
    background: #fff7ed;
}

.dashboard-project-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.dashboard-project-grid.is-empty .empty-state {
    grid-column: 1 / -1;
}

.dashboard-project-card {
    display: flex;
    flex-direction: column;
    min-width: 0;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.72);
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
    transition: border-color 120ms ease, background-color 120ms ease, box-shadow 120ms ease;
    overflow: hidden;
}

.dashboard-project-card:hover {
    border-color: #cbd5e1;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 10px 24px -18px rgba(15, 23, 42, 0.28);
}

.dashboard-project-card-main {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 14px;
    flex: 1;
}

.dashboard-project-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}

.dashboard-project-card-title-wrap {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.dashboard-project-card-kicker {
    font-size: 11px;
    line-height: 1.2;
    font-weight: 600;
    color: #94a3b8;
}

.dashboard-project-card-title {
    margin: 0;
    font-size: 15px;
    line-height: 1.45;
    font-weight: 600;
    color: #0f172a;
    word-break: break-word;
}

.dashboard-project-card-time {
    flex-shrink: 0;
    font-size: 12px;
    color: #94a3b8;
}

.dashboard-project-card-note {
    margin: 0;
    font-size: 13px;
    line-height: 1.65;
    color: #64748b;
    min-height: 43px;
}

.dashboard-project-metrics {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.dashboard-project-metric {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    padding: 0 8px;
    font-size: 11px;
    line-height: 1;
    font-weight: 500;
    color: #475569;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    border-radius: 999px;
}

.dashboard-project-card-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding: 12px 14px 14px;
    border-top: 1px solid #e2e8f0;
}

.dashboard-pagination {
    padding-top: 14px;
}

.dashboard-pagination-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.dashboard-pagination-status {
    font-size: 12px;
    color: #94a3b8;
}

.dashboard-pagination-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.dashboard-page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 30px;
    height: 30px;
    padding: 0 10px;
    font-size: 12px;
    line-height: 1;
    font-weight: 500;
    color: #475569;
    border: 1px solid #e2e8f0;
    background: #ffffff;
    border-radius: 8px;
    transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease;
}

.dashboard-page-btn:hover:not(:disabled) {
    color: #0f172a;
    background: #f8fafc;
}

.dashboard-page-btn.is-active {
    color: #ffffff;
    background: #f97316;
    border-color: #f97316;
}

.dashboard-page-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.dashboard-modal {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    box-shadow: 0 24px 40px -30px rgba(15, 23, 42, 0.4);
}

.dashboard-modal-header {
    padding: 16px 18px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    border-bottom: 1px solid #e2e8f0;
}

.dashboard-modal-body {
    padding: 16px 18px 18px;
}

.overview-section {
    background: rgba(255, 255, 255, 0.72);
    border: none;
    border-radius: 0;
    box-shadow: none;
    overflow: visible;
}

.overview-section + .overview-section {
    border-top: 1px solid #e2e8f0;
}

.overview-section-header {
    padding: 14px 18px 8px 18px;
}

.overview-section-body {
    padding: 0 18px 16px 18px;
}

.overview-stat-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    border-top: 1px solid rgba(226, 232, 240, 0.82);
    border-bottom: 1px solid rgba(226, 232, 240, 0.82);
    background: rgba(255, 255, 255, 0.66);
}

.overview-stat-item {
    padding: 14px 12px;
    text-align: center;
}

.overview-stat-item + .overview-stat-item {
    border-left: 1px solid rgba(226, 232, 240, 0.82);
}

.overview-stage-block {
    padding-top: 14px;
    border-top: 1px solid rgba(226, 232, 240, 0.82);
}

.overview-stage-panel {
    padding: 4px 0 0;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.4) 0%, rgba(248, 250, 252, 0.46) 100%);
}

.overview-chip {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 0 10px;
    font-size: 12px;
    font-weight: 500;
    border: 1px solid rgba(226, 232, 240, 0.88);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.82);
    color: #64748b;
}

.overview-chip-accent {
    border-color: rgba(253, 186, 116, 0.9);
    background: rgba(255, 247, 237, 0.92);
    color: #ea580c;
}

.overview-step-index {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 8px;
    background: rgba(255, 247, 237, 0.92);
    color: #ea580c;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
    margin-top: 2px;
}

.overview-action-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 34px;
    padding: 0 14px;
    font-size: 14px;
    font-weight: 500;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    color: #475569;
    background: rgba(255, 255, 255, 0.84);
    text-decoration: none;
    transition: background 120ms, color 120ms, border-color 120ms;
}

.overview-action-link:hover {
    background: #f8fafc;
    color: #1e293b;
}

.overview-action-link.is-primary {
    color: #ffffff;
    background: #f97316;
    border-color: #f97316;
}

.overview-action-link.is-primary:hover {
    filter: brightness(1.05);
}

.asset-library-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
}

.asset-library-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 12px;
    border: 1px solid rgba(226, 232, 240, 0.84);
    background: rgba(255, 255, 255, 0.72);
    transition: border-color 120ms, background 120ms, box-shadow 120ms;
}

.asset-library-card:hover {
    border-color: #cbd5e1;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 10px 24px -18px rgba(15, 23, 42, 0.28);
}

.asset-library-card.asset-card-editing {
    border-color: rgba(249, 115, 22, 0.4);
    background: rgba(255, 247, 237, 0.76);
}

.asset-library-preview {
    width: 100%;
    height: 84px;
    min-height: 84px;
    display: grid;
    place-items: center;
    overflow: hidden;
    border: 1px solid rgba(226, 232, 240, 0.86);
    border-radius: 10px;
    background: #fbfdff;
}

.asset-library-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.asset-library-body {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.asset-row-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.asset-row-head h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
}

.asset-row-time {
    flex-shrink: 0;
    font-size: 12px;
    color: #94a3b8;
}

.asset-row-sub {
    margin: 0;
    font-size: 13px;
    line-height: 1.6;
    color: #64748b;
}

.asset-row-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.recent-asset-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 12px;
    border: 1px solid rgba(226, 232, 240, 0.78);
    background: rgba(255, 255, 255, 0.7);
}

.recent-assets-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 12px;
}

.recent-assets-grid .empty-state {
    grid-column: 1 / -1;
}

.recent-asset-preview {
    width: 100%;
    height: 76px;
    min-height: 76px;
    max-height: 76px;
    display: grid;
    place-items: center;
    overflow: hidden;
    border: 1px solid rgba(226, 232, 240, 0.86);
    border-radius: 10px;
    background: #fbfdff;
}

.recent-asset-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.recent-asset-card-face,
.recent-asset-dice {
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
}

.recent-asset-card-face {
    background: linear-gradient(180deg, #fff7ed 0%, #ffedd5 100%);
    color: #c2410c;
    font-size: 12px;
    font-weight: 700;
}

.recent-asset-dice {
    border-radius: 10px;
    color: #1e293b;
    font-size: 14px;
    font-weight: 700;
}

.recent-asset-body {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.recent-asset-head,
.recent-asset-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}

.recent-asset-head strong {
    font-size: 14px;
    color: #1e293b;
}

.recent-asset-desc {
    margin: 0;
    font-size: 13px;
    line-height: 1.6;
    color: #64748b;
}

.recent-asset-metrics {
    margin-left: 0 !important;
}

.recent-asset-time {
    font-size: 12px;
    color: #94a3b8;
}

/* ============================================
   Utility Classes
   ============================================ */
.shell {
    width: 100%;
    max-width: 100%;
    margin: 0;
}

.color-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.empty-state {
    padding: 16px;
    text-align: center;
    font-size: 13px;
    color: #94a3b8;
    line-height: 1.6;
}

.preview-token.circle { border-radius: 50%; }

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 1280px) {
    .dashboard-project-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .property-editor { position: static; max-height: none; }
    .card-stage-scene { grid-template-columns: 1fr; }
    .editor-two-pane { min-height: auto; }
    .workbench-root.workbench-page-table .workbench-scroll {
        height: auto;
        overflow: visible;
    }
    .table-workbench {
        min-height: auto;
        height: auto;
    }
    .table-stage-pane {
        min-height: 520px;
    }
    .table-inspector-pane {
        padding: 12px;
        border-left: none;
        border-top: 1px solid #e2e8f0;
    }
    .table-inspector-tabs {
        padding-bottom: 10px;
    }
    .editor-content-pane,
    .editor-inspector-pane {
        padding: 12px;
    }
    .editor-content-pane-inner {
        gap: 12px;
    }
    .editor-section + .editor-section {
        border-top: none;
    }
    .editor-section {
        border: 1px solid #e2e8f0;
        border-radius: 12px;
        background: #ffffff;
        overflow: hidden;
    }
    .editor-section-header {
        padding: 14px 14px 10px 14px;
    }
    .editor-section-body {
        padding: 0 14px 14px 14px;
    }
    .editor-inspector-pane {
        border-left: none;
        border-top: 1px solid #e2e8f0;
    }
    .property-editor-header {
        padding: 0 0 10px;
    }
    .property-editor-body {
        padding-top: 10px;
        overflow: visible;
    }
    .property-editor-form {
        gap: 14px;
    }
    .property-editor-group {
        padding-bottom: 14px;
    }
    .property-editor-sticky-actions {
        position: static;
        padding-top: 10px;
        background: transparent;
        backdrop-filter: none;
    }
    .overview-section {
        border: 1px solid #e2e8f0;
        border-radius: 12px;
        background: #ffffff;
        overflow: hidden;
    }
    .overview-section + .overview-section {
        border-top: 1px solid #e2e8f0;
    }
    .overview-section-header {
        padding: 14px 14px 10px 14px;
    }
    .overview-section-body {
        padding: 0 14px 14px 14px;
    }
    .overview-stat-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .overview-stage-block {
        padding-top: 12px;
    }
    .asset-library-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .recent-assets-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .overview-action-link {
        width: 100%;
    }
}

@media (max-width: 720px) {
    .dashboard-section-header,
    .dashboard-section-body,
    .dashboard-modal-header,
    .dashboard-modal-body {
        padding-left: 14px;
        padding-right: 14px;
    }
    .dashboard-toolbar,
    .dashboard-pagination-bar {
        align-items: stretch;
    }
    .dashboard-toolbar {
        flex-wrap: wrap;
    }
    .dashboard-search-wrap {
        min-width: 0;
        flex-basis: 100%;
        width: 100%;
    }
    .dashboard-project-grid {
        grid-template-columns: 1fr;
    }
    .dashboard-pagination-actions {
        width: 100%;
    }
    .table-scene-camera-grid {
        grid-template-columns: 1fr;
    }
    .table-scene-camera-grid .table-scene-action:first-child {
        grid-column: auto;
    }
    .table-zone-grid {
        grid-template-columns: 1fr;
    }
    .asset-library-grid {
        grid-template-columns: 1fr;
    }
    .recent-assets-grid {
        grid-template-columns: 1fr;
    }
}

@media (min-width: 1280px) {
    .workbench-root.workbench-flow-page .property-editor {
        position: sticky;
        top: 12px;
        max-height: calc(100vh - 24px);
    }

    .workbench-root.workbench-flow-page .property-editor > div:last-child {
        overflow-y: auto;
    }
}

@media (max-width: 720px) {
    .workbench-body { grid-template-columns: 1fr; }
    .toolrail { display: none; }
    .topbar-workbench { height: auto; min-height: 0; padding: 8px 10px; flex-wrap: wrap; gap: 6px; }
    .workbench-scroll-tight { overflow: auto; padding: 10px; }
}
