:root {
    --black: #f7f9fc;
    --soft-black: #eef3fb;
    --panel: #ffffff;
    --card: #f8fbff;
    --border: #d9e2ef;
    --text: #1f2933;
    --muted: #60708a;
    --gold: #4a6fbf;
    --orange: #6fa8ff;
    --shadow: 0 12px 30px rgba(15, 23, 42, 0.12);
    --radius: 16px;
    --sidebar-width: 260px;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--black);
    color: var(--text);
    line-height: 1.6;
    --shell-offset: var(--sidebar-width);
}
body:not(.sidebar-open) {
    --shell-offset: 0px;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; border: none; }

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar-width);
    background: linear-gradient(180deg, #eef3fb, #e2ebfb 70%, #dbe5f7);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 16px 12px;
    gap: 12px;
    box-shadow: var(--shadow);
    z-index: 10;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
}
body.sidebar-open .sidebar {
    transform: translateX(0);
}
.sidebar__logo {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 0;
    margin: 10px 0 -4px -20px;
}
.sidebar__logo img {
    max-width: 160px;
    height: auto;
    display: block;
    transform: translateY(1px);
}
.sidebar__footer {
    margin-top: auto;
    padding-bottom: 6px;
}
.sidebar__brand {
    width: 100%;
    border-radius: 14px;
    border: 1px solid var(--border);
    padding: 10px 12px;
    background: #f9fbff;
    display: flex;
    flex-direction: column;
    gap: 6px;
    color: #0f172a;
}
.sidebar__brand-email {
    font-weight: 700;
    font-size: 14px;
    line-height: 1.3;
    word-break: break-word;
}
.sidebar__logout {
    align-self: flex-start;
    padding: 6px 10px;
    border-radius: 10px;
    font-size: 12px;
    border: 1px solid var(--line);
}
.sidebar nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    margin-top: 8px;
}
.sidebar__item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 12px;
    color: var(--text);
    background: rgba(74,111,191,0.06);
    border: 1px solid transparent;
    transition: all 0.2s ease;
    position: relative;
    white-space: nowrap;
    overflow: hidden;
}
.sidebar__item .icon { color: #4b5f82; filter: none; }
.sidebar__label {
    flex: 1;
    text-overflow: ellipsis;
    overflow: hidden;
}
.sidebar__item:hover { background: rgba(74,111,191,0.12); box-shadow: 0 8px 24px rgba(15,23,42,0.08); }
.sidebar__item.active {
    border-color: var(--gold);
}
.sidebar__item.active::before {
    content: '';
    position: absolute;
    left: -12px;
    top: 10px;
    bottom: 10px;
    width: 3px;
    border-radius: 99px;
    background: linear-gradient(180deg, var(--gold), var(--orange));
}
.shell {
    margin-left: var(--shell-offset);
    padding: 24px 32px 40px;
    transition: margin-left 0.3s ease, padding 0.3s ease;
    min-height: 100vh;
}
.view { display: none; }
.view.view--active { display: block; }
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}
.topbar__actions { display: flex; gap: 10px; }
.topbar__left {
    display: flex;
    align-items: center;
    gap: 14px;
}
.icon-button {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    font-size: 20px;
    padding: 0;
    position: relative;
    top: -8px;
}
.icon-button span { display: block; line-height: 1; }

.eyebrow { text-transform: uppercase; letter-spacing: 0.08em; font-size: 12px; color: var(--muted); margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.helper-text {
    font-size: 12px;
    margin-top: 4px;
}

.primary {
    background: #e7ebf3;
    color: #1f2933;
    padding: 12px 16px;
    border-radius: 12px;
    box-shadow: 0 12px 30px rgba(31, 41, 51, 0.12);
    font-weight: 700;
    border: 1px solid #d5dbe5;
}
.secondary {
    background: #eef3fb;
    color: var(--text);
    padding: 10px 14px;
    border-radius: 12px;
    border: 1px solid var(--border);
}
.ghost {
    background: transparent;
    color: var(--text);
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid var(--border);
}

.dashboard {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 14px;
    margin-top: 8px;
}
.objects-panel {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    margin-bottom: 18px;
    box-shadow: var(--shadow);
}
.objects-panel__header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 12px;
}
.objects-panel__actions {
    display: flex;
    gap: 10px;
    align-items: center;
}
.objects-panel__actions input {
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: #f7f9fe;
    color: var(--text);
    min-width: 220px;
}
.object-list {
    margin-top: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-right: 6px;
}
.object-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
    text-align: left;
    color: var(--text);
    transition: border 0.2s ease, transform 0.2s ease;
    align-items: flex-start;
}
.object-card__header {
    display: flex;
    gap: 10px;
    width: 100%;
}
.object-card__thumb {
    width: 64px;
    height: 64px;
    border-radius: 14px;
    background: #e0e6f3;
    border: 1px solid rgba(0, 0, 0, 0.06);
    background-size: cover;
    background-position: center;
    flex-shrink: 0;
}
.object-card__body {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    flex: 1;
}
.object-card.active {
    border-color: var(--gold);
    box-shadow: 0 12px 32px rgba(74,111,191,0.18);
}
.object-card:hover { transform: translateY(-1px); border-color: rgba(74,111,191,0.3); }
.object-card__title {
    font-weight: 600;
    font-size: 15px;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}
.object-card__meta,
.object-card__status {
    color: var(--muted);
    font-size: 13px;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}
.object-card__actions {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-top: 6px;
}
.object-card__actions .edit-btn {
    background: #e7ebf3;
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 8px 12px;
    box-shadow: 0 6px 18px rgba(31, 41, 51, 0.08);
}
.object-card__actions .edit-btn:hover {
    border-color: #cfd6e2;
    background: #dde2ec;
}
.object-card__actions .ghost {
    padding: 6px 10px;
}
.empty-state {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
}

.stat-card {
    background: linear-gradient(180deg, #f9fbff 0%, #f2f6ff 100%);
    border: 1px solid #e1e8f5;
    border-radius: 18px;
    padding: 18px 20px;
    box-shadow: 0 16px 40px rgba(74, 111, 191, 0.14);
    min-height: 150px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.stat-card h3 { margin: 2px 0 4px; font-size: 32px; letter-spacing: -0.02em; }
.stat-card__label { margin: 0; text-transform: uppercase; letter-spacing: 0.08em; font-size: 12px; color: var(--muted); }
.stat-card .muted { margin-top: auto; }
.quick-actions { display: flex; gap: 10px; align-items: center; }
.stat-section { margin-bottom: 22px; }
.stat-section > .eyebrow { margin-bottom: 8px; display: inline-block; }
.stats-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
    background: linear-gradient(135deg, #f7f9ff 0%, #eef3fb 100%);
}
.stats-hero h2 {
    margin: 6px 0 4px;
    font-size: 32px;
}
.stats-hero__actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}
.auth-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(7, 9, 16, 0.65);
    backdrop-filter: blur(8px);
    z-index: 40;
}
.auth-overlay.hidden { display: none; }
.auth-card {
    width: min(440px, 92vw);
    background: #0f1119;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 18px 18px 22px;
    box-shadow: 0 22px 60px rgba(0, 0, 0, 0.4);
}
.auth-switch {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-bottom: 10px;
}
.auth-switch__tab {
    border: 1px solid var(--line);
    background: #161a28;
    color: #f7f9ff;
    border-radius: 10px;
    padding: 10px 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}
.auth-switch__tab.active {
    background: linear-gradient(120deg, var(--gold), var(--orange));
    color: #0d0f17;
    border-color: transparent;
    box-shadow: 0 10px 30px rgba(255, 193, 94, 0.25);
}
.auth-form { display: flex; flex-direction: column; gap: 12px; margin-top: 6px; }
.auth-form.hidden { display: none; }
.auth-error {
    background: rgba(255, 99, 99, 0.12);
    border: 1px solid rgba(255, 99, 99, 0.45);
    color: #ffb4b4;
    padding: 8px 10px;
    border-radius: 8px;
    margin-bottom: 6px;
}
.full-width { width: 100%; }

.modal {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.35);
    display: grid;
    place-items: center;
    z-index: 30;
    padding: 16px;
}
.modal.hidden { display: none; }
.modal__content {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    max-width: 880px;
    width: min(880px, 100%);
    box-shadow: var(--shadow);
}
.modal__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}
.modal__body {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0;
    max-height: 640px;
    overflow: hidden;
}
.modal__body textarea {
    width: 100%;
    height: 100%;
    min-height: 400px;
    border: none;
    padding: 16px;
    background: transparent;
    color: var(--text);
    font: inherit;
    line-height: 1.6;
    resize: vertical;
}
.modal__actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-bottom: 10px;
}
.modal__actions .secondary {
    background: #d5d8e0;
    border-color: #c1c6cf;
    color: #111827;
}
.modal__actions .secondary:hover {
    background: #c8ccd5;
}
.modal__actions .secondary.copied {
    background: #b5bac6;
    color: #0b1220;
    border-color: #9fa5b2;
}

.workspace {
    display: grid;
    grid-template-columns: 360px minmax(0,1fr) 280px;
    gap: 14px;
    align-items: start;
}
.panel {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: var(--shadow);
}
.panel h2 { margin: 4px 0 8px; }

.input-panel { display: flex; flex-direction: column; gap: 12px; }
.minimal-form { display: flex; flex-direction: column; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { color: #3b4a63; font-size: 14px; display: block; }
.field input, .field select {
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: #f0f4fb;
    color: var(--text);
}
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; align-items: center; }
.checkbox { display: flex; align-items: center; gap: 8px; color: #e1e1e8; }
.optional label { color: var(--muted); }
.actions { display: flex; align-items: center; gap: 10px; }

.upload-block {
    background: #f1f5fc;
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    padding: 14px;
}
.upload-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.dropzone {
    border: 1px dashed var(--border);
    border-radius: 12px;
    padding: 16px;
    text-align: center;
    color: var(--muted);
    background: #f7f9fe;
    cursor: pointer;
}
.dropzone.dragging { border-color: var(--gold); color: var(--gold); }
.upload-icons { display: flex; justify-content: center; gap: 10px; font-size: 18px; margin-top: 8px; }
.upload-list { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.upload-item { display: flex; justify-content: space-between; align-items: center; background: #f0f5fe; border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; }
.upload-item__status { color: var(--gold); font-size: 13px; }

.editor { min-height: 560px; display: flex; flex-direction: column; gap: 12px; }
.editor__header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.editor__actions { display: flex; gap: 8px; }
.editor__body { position: relative; }
.full-editor {
    width: 100%;
    min-height: 460px;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: #f7f9fe;
    color: var(--text);
    padding: 16px;
    font-size: 15px;
    line-height: 1.7;
    box-shadow: 0 12px 32px rgba(74,111,191,0.12);
}
.ai-status {
    position: absolute;
    right: 14px;
    bottom: 14px;
    background: rgba(74,111,191,0.12);
    color: var(--text);
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    font-size: 13px;
}
.pulse { animation: pulse 1.1s ease-in-out infinite; }
@keyframes pulse {
    0% { opacity: 0.85; transform: translateY(0); }
    50% { opacity: 1; transform: translateY(-1px); }
    100% { opacity: 0.85; transform: translateY(0); }
}
.vision-insights {
    margin-top: 18px;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 14px;
    background: #eef3fb;
    box-shadow: 0 10px 25px rgba(74,111,191,0.12);
}
.vision-insights__header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}
.vision-insights__header h3 {
    margin: 4px 0 0;
}
.vision-insights__style {
    font-size: 11px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--gold);
    background: rgba(74,111,191,0.15);
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid rgba(74,111,191,0.25);
}
.vision-insights__summary {
    margin: 6px 0 10px;
}
.vision-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.vision-badge {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 12px;
    color: var(--muted);
}
.vision-panel__header {
    margin-bottom: 18px;
}
.vision-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 18px;
}
.vision-card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    background: var(--panel);
    display: flex;
    flex-direction: column;
    gap: 10px;
    box-shadow: var(--shadow);
}
.vision-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.vision-form input,
.vision-form textarea {
    border-radius: 12px;
    border: 1px solid var(--border);
    padding: 10px 12px;
    font: inherit;
    background: #f7f9fe;
    color: var(--text);
}
.vision-status {
    min-height: 18px;
    color: var(--muted);
}
.vision-status.error { color: #c0392b; }
.vision-result {
    border: 1px dashed var(--border);
    border-radius: 12px;
    padding: 12px;
    background: #f7f9ff;
}
.vision-result.small {
    font-size: 14px;
    background: #fbfcff;
}
.vision-result h4 {
    margin-top: 0;
}
.vision-result__label {
    font-weight: 600;
    margin: 8px 0 0;
}
.vision-result ul {
    margin: 6px 0;
    padding-left: 16px;
}
.vision-remix-grid {
    display: flex;
    gap: 18px;
    flex-wrap: wrap;
}
.vision-remix-pane {
    flex: 1;
    min-width: 260px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.remix-upload {
    border: 1px dashed var(--border);
    border-radius: 16px;
    padding: 16px;
    background: #f6f7fb;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 10px;
    text-align: center;
}
.remix-upload button {
    align-self: center;
}
.remix-preview {
    min-height: 180px;
    border-radius: 12px;
    background: #e9ecf5;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    font-size: 14px;
    padding: 12px;
    overflow: hidden;
}
.remix-preview.dragging {
    outline: 2px dashed var(--gold);
    color: var(--dark);
}
.remix-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 10px;
}
.vision-remix-card textarea {
    resize: vertical;
}
.detail-cover {
    margin-bottom: 12px;
    border-radius: 18px;
    overflow: hidden;
    border: 1px solid var(--border);
    background: #f3f5fb;
}
.detail-cover img {
    width: 100%;
    display: block;
}
.detail-gallery {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}
.detail-gallery img {
    width: 78px;
    height: 78px;
    object-fit: cover;
    border-radius: 12px;
    border: 1px solid var(--border);
}
.vision-render {
    margin-top: 12px;
    border: 1px dashed var(--border);
    border-radius: 16px;
    padding: 14px;
    background: #fdfdff;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.vision-render__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}
.vision-render-output {
    border-radius: 12px;
    background: #f0f4ff;
    min-height: 220px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.vision-render-output img {
    width: 100%;
    border-radius: 10px;
    display: block;
}
.vision-render__attach {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.profile-list {
    margin-top: 24px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
}
.profile-card {
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 16px;
    background: #fff;
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.08);
}
.profile-card__header {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
}
.profile-card__desc {
    margin: 8px 0;
}
.profile-card__examples {
    font-size: 0.9rem;
    color: var(--muted);
    margin: 6px 0 0;
}
.profile-card__actions {
    margin-top: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.hidden { display: none; }

.tools { display: flex; flex-direction: column; gap: 12px; }
.tool-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
    background: #eef3fb;
    color: var(--text);
    padding: 8px 10px;
    border-radius: 999px;
    border: 1px solid var(--border);
    transition: border 0.2s ease, transform 0.1s ease;
}
.chip:hover { border-color: var(--gold); transform: translateY(-1px); }

.versions { margin-top: 12px; border-top: 1px solid var(--border); padding-top: 10px; }
.versions__header { display: flex; justify-content: space-between; align-items: center; }
.version-list { display: flex; flex-direction: column; gap: 8px; }
.version-item {
    background: #f7f9fe;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 10px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.version-item button { background: transparent; color: var(--gold); border: 1px solid var(--border); padding: 6px 8px; border-radius: 10px; }

@media (max-width: 1400px) {
    .workspace {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 900px) {
    :root { --sidebar-width: 220px; }
    body { --shell-offset: 0; }
    .shell { padding: 20px; }
    .topbar {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    .topbar__actions { flex-wrap: wrap; justify-content: flex-start; }
    .objects-panel__header { flex-direction: column; align-items: flex-start; }
    .objects-panel__actions { width: 100%; }
    .objects-panel__actions input { flex: 1; min-width: 0; width: 100%; }
    .object-list { max-height: none; }
    .workspace { grid-template-columns: 1fr; }
    .stats-hero { flex-direction: column; align-items: flex-start; }
    .stats-hero__actions { justify-content: flex-start; }
}

@media (max-width: 720px) {
    .grid-2 { grid-template-columns: 1fr; }
    .quick-actions { flex-direction: column; align-items: stretch; }
    .panel { padding: 16px; }
    .topbar__left { width: 100%; }
}

@media (max-width: 540px) {
    .objects-panel__actions { flex-direction: column; align-items: stretch; }
    .objects-panel__actions button { width: 100%; }
    .editor__header, .topbar__actions { flex-direction: column; align-items: stretch; }
}
