/* Theme: Seer - Clean & Professional */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
        --sidebar-width: 340px;
        --topbar-height: 56px;
        
        /* Clean Color Palette */
        --bg: #0e1117;
        --bg-elevated: #161b22;
        --panel: #1c2128;
        --panel-alt: #21262d;
        --panel-hover: #292e36;
        
        /* Text Colors */
        --fg: #e6edf3;
        --fg-secondary: #8b949e;
        --muted: #6e7681;
        
        /* Accent Colors */
        --primary: #4493f8;
        --primary-hover: #58a6ff;
        --accent: #3fb950;
        
        /* Semantic Colors */
        --success: #3fb950;
        --warning: #d29922;
        --error: #f85149;
        --info: #4493f8;
        
        /* Borders & Effects */
        --border: rgba(240, 246, 252, 0.1);
        --border-active: rgba(68, 147, 248, 0.4);
        --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
        --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.25);
        --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.3);
        
        --ring: rgba(68, 147, 248, 0.3);
        --link: var(--primary);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
        margin: 0;
        background: var(--bg);
        color: var(--fg);
        font-family: 'Inter', system-ui, -apple-system, sans-serif;
        font-size: 14px;
        line-height: 1.5;
        -webkit-font-smoothing: antialiased;
}

[hidden] { display: none !important; }

.page { background: var(--bg); }

.page--center {
        display: grid;
        place-items: center;
        padding: 24px;
        min-height: 100vh;
}

/* Cards */
.card {
        background: var(--panel);
        border: 1px solid var(--border);
        border-radius: 12px;
        box-shadow: var(--shadow-md);
        padding: 32px;
        max-width: 420px;
        width: 100%;
}

.card--prompt { 
        background: var(--bg);
        border: none;
        box-shadow: none;
        text-align: left;
        padding: 0;
        max-width: 700px;
}

.title--prompt {
        margin-bottom: 0;
        text-align: center;
        max-width: 700px;
        width: 100%;
}

.title { 
        margin: 0 0 8px; 
        font-size: 24px; 
        font-weight: 600;
        letter-spacing: -0.01em;
        color: var(--fg);
}

.subtitle { 
        margin: 0 0 24px; 
        color: var(--fg-secondary);
        font-size: 14px;
}

.form { 
        display: grid; 
        gap: 16px;
        border: 1px solid var(--border);
        border-radius: 6px;
        padding: 16px 16px 3px 16px;
}

.form__actions {
        display: flex;
        justify-content: flex-end;
        align-items: center;
        gap: 12px;
}

.input {
        width: 100%;
        background: var(--bg);
        color: var(--fg);
        border: none;
        border-radius: 6px;
        padding: 10px 12px;
        font-size: 14px;
        font-family: inherit;
        outline: none;
        transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.input::placeholder {
        color: var(--muted);
}

.input:hover {
        /* No border to change on hover */
}

.input:focus {
        outline: none;
        box-shadow: none;
}

.input--textarea { 
        resize: vertical; 
        min-height: 120px;
}

.input--select {
        width: auto;
        min-width: 110px;
        padding: 8px 12px;
        cursor: pointer;
        border: 1px solid var(--border);
        font-size: 13px;
        line-height: 1.2;
        margin-top: 12px;
        box-sizing: border-box;
        appearance: none;
        -webkit-appearance: none;
        -moz-appearance: none;
        height: 34px;
}

/* Buttons */
.btn {
        appearance: none;
        border: none;
        border-radius: 6px;
        cursor: pointer;
        padding: 10px 16px;
        font-size: 14px;
        font-weight: 500;
        font-family: inherit;
        transition: background-color 0.15s ease;
}

.btn:active { 
        transform: translateY(1px);
}

.btn--primary {
        background: var(--primary);
        color: #fff;
}

.btn--primary:hover { 
        background: var(--primary-hover);
}

.btn--analyze {
        background: var(--panel-alt);
        color: var(--fg);
        border: 1px solid var(--border);
        padding: 8px 14px;
        font-size: 13px;
        display: inline-flex;
        align-items: center;
        gap: 6px;
        margin-top: 12px;
        height: 34px;
        box-sizing: border-box;
}

.btn--analyze:hover {
        background: var(--panel-hover);
        border-color: rgba(240, 246, 252, 0.15);
}

.btn__arrow {
        font-size: 14px;
        line-height: 1;
}

.btn--secondary {
        background: var(--panel-alt);
        color: var(--fg);
        border: 1px solid var(--border);
}

.btn--secondary:hover {
        background: var(--panel-hover);
}

.btn--success {
        background: var(--success);
        color: #fff;
}

.btn--success:hover {
        background: #46c258;
}

.error { color: var(--error); margin-top: 8px; font-size: 13px; }
.success { color: var(--success); margin-top: 8px; font-size: 13px; }

.form__label {
        display: block;
        margin-bottom: 6px;
        font-size: 13px;
        font-weight: 500;
        color: var(--fg-secondary);
}

/* Links */
.link { 
        color: var(--link); 
        text-decoration: none;
        font-weight: 500;
}
.link:hover { 
        text-decoration: underline;
}

/* Workspace Layout */
.workspace {
        display: grid;
        grid-template-columns: var(--sidebar-width) 1fr;
        min-height: 100vh;
}

/* Topbar */
.topbar {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        width: auto;
        z-index: 1100;
        height: var(--topbar-height);
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 0 16px;
        background: var(--panel);
        border-bottom: 1px solid var(--border);
}

.page--workspace .topbar {
        right: auto;
        width: var(--sidebar-width);
}

.brand { 
	font-weight: 600; 
	font-size: 16px;
	color: var(--fg);
	display: flex;
	align-items: center;
}

.brand__logo {
	height: 48px;
	width: auto;
}

.brand__accent { 
	color: var(--primary);
}

.page--workspace:not(.page--start) {
        --topbar-height: 0px;
}

/* Tokens Badge */
.topbar__tokens {
        display: flex;
        align-items: center;
        gap: 8px;
        padding: 6px 12px;
        background: var(--panel-alt);
        border: 1px solid var(--border);
        border-radius: 6px;
}

.tokens__label {
        font-size: 12px;
        font-weight: 500;
        color: var(--fg-secondary);
}

.tokens__count {
        background: var(--primary);
        border-radius: 4px;
        padding: 2px 8px;
        font-weight: 600;
        font-size: 12px;
        color: #fff;
}

/* Sidebar */
.sidebar {
        position: sticky;
        top: var(--topbar-height);
        align-self: start;
        height: calc(100vh - var(--topbar-height));
        overflow: hidden;
        background: var(--panel);
        border-right: 1px solid var(--border);
        display: flex;
        flex-direction: column;
}

/* Chat */
.chat { display: flex; flex-direction: column; height: 100%; }

.chat__header {
	padding: 16px 20px;
	border-bottom: 1px solid var(--border);
	display: flex;
	flex-direction: column;
	gap: 12px;
	background: var(--panel);
	position: relative;
}

.chat__header .brand {
	margin-bottom: 4px;
}

.chat__header-title {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	position: relative;
	width: 100%;
}

.chat__header-actions {
	display: flex;
	align-items: center;
	gap: 4px;
	margin-left: auto;
}

.chat__header h2 {
	margin: 0;
	font-size: 14px;
	font-weight: 600;
	color: var(--fg);
	display: flex;
	align-items: center;
	gap: 8px;
}

.chat__new-btn,
.chat__history-btn {
	background: transparent;
	border: 1px solid var(--border);
	border-radius: 6px;
	padding: 4px 6px;
	cursor: pointer;
	display: none;
	align-items: center;
	justify-content: center;
	color: var(--fg-secondary);
	transition: all 0.15s ease;
}

.chat__new-btn:hover,
.chat__history-btn:hover {
	background: var(--panel-hover);
	color: var(--fg);
	border-color: var(--border-active);
}

.chat__new-btn[aria-expanded="true"],
.chat__history-btn[aria-expanded="true"] {
	background: var(--panel-hover);
	color: var(--primary);
	border-color: var(--primary);
}

.chat__history-btn:hover {
	background: var(--panel-hover);
	color: var(--fg);
	border-color: var(--border-active);
}

.chat__history-btn[aria-expanded="true"] {
	background: var(--panel-hover);
	color: var(--primary);
	border-color: var(--primary);
}

.chat__history-dropdown {
	position: absolute;
	top: calc(100% + 8px);
	left: 0;
	right: 0;
	background: var(--panel);
	border: 1px solid var(--border);
	border-radius: 8px;
	box-shadow: var(--shadow-lg);
	z-index: 1000;
	max-height: 400px;
	display: flex;
	flex-direction: column;
	overflow: hidden;
}

.chat__history-header {
	padding: 12px 16px;
	border-bottom: 1px solid var(--border);
	font-weight: 600;
	font-size: 13px;
	color: var(--fg);
	background: var(--panel-alt);
}

.chat__history-list {
	flex: 1;
	overflow-y: auto;
	max-height: 350px;
}

.chat__history-empty {
	padding: 24px 16px;
	text-align: center;
	color: var(--muted);
	font-size: 13px;
}

.chat__history-item {
	padding: 12px 16px;
	border-bottom: 1px solid var(--border);
	cursor: pointer;
	transition: background-color 0.15s ease;
}

.chat__history-item:hover {
	background: var(--panel-hover);
}

.chat__history-item:last-child {
	border-bottom: none;
}

.chat__history-item-name {
	font-weight: 500;
	font-size: 13px;
	color: var(--fg);
	margin-bottom: 4px;
}

.chat__history-item-meta {
	font-size: 11px;
	color: var(--muted);
	display: flex;
	align-items: center;
	gap: 8px;
}

.chat__header h2::before {
        content: '';
        display: block;
        width: 8px;
        height: 8px;
        background: var(--success);
        border-radius: 50%;
        animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
        0%, 100% { opacity: 1; }
        50% { opacity: 0.5; }
}

.chat__log {
        flex: 1;
        overflow-y: auto;
        overflow-x: hidden;
        padding: 20px 16px;
        display: flex;
        flex-direction: column;
        gap: 16px;
        background: var(--bg);
}

.chat__log::-webkit-scrollbar {
        width: 6px;
}

.chat__log::-webkit-scrollbar-track {
        background: transparent;
}

.chat__log::-webkit-scrollbar-thumb {
        background: var(--border);
        border-radius: 3px;
}

.chat__log::-webkit-scrollbar-thumb:hover {
        background: rgba(240, 246, 252, 0.2);
}

.chat__msg {
        display: flex;
        align-items: flex-start;
        gap: 10px;
        max-width: 85%;
        animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
        from {
                opacity: 0;
                transform: translateY(10px);
        }
        to {
                opacity: 1;
                transform: translateY(0);
        }
}

.chat__msg--user {
        align-self: flex-end;
        flex-direction: row-reverse;
}

.chat__msg--assistant {
        align-self: flex-start;
}

.chat__msg-avatar {
        width: 32px;
        height: 32px;
        border-radius: 50%;
        flex-shrink: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 16px;
        font-weight: 600;
        background: var(--primary);
        color: #fff;
        box-shadow: var(--shadow-sm);
}

.chat__msg--user .chat__msg-avatar {
        background: var(--panel-alt);
        color: var(--fg);
        border: 1px solid var(--border);
}

.chat__msg-content {
        background: var(--panel-alt);
        padding: 10px 14px;
        border-radius: 12px;
        border: 1px solid var(--border);
        white-space: pre-wrap;
        font-size: 14px;
        line-height: 1.6;
        color: var(--fg);
        word-wrap: break-word;
        box-shadow: var(--shadow-sm);
        position: relative;
}

.chat__msg--user .chat__msg-content {
        background: var(--primary);
        color: #fff;
        border-color: var(--primary);
}

.chat__msg--user .chat__msg-content::after {
        content: '';
        position: absolute;
        right: -6px;
        top: 12px;
        width: 0;
        height: 0;
        border-top: 6px solid transparent;
        border-bottom: 6px solid transparent;
        border-left: 6px solid var(--primary);
}

.chat__msg--assistant .chat__msg-content::before {
        content: '';
        position: absolute;
        left: -6px;
        top: 12px;
        width: 0;
        height: 0;
        border-top: 6px solid transparent;
        border-bottom: 6px solid transparent;
        border-right: 6px solid var(--panel-alt);
}

.chat__msg--bg {
        position: relative;
        overflow: hidden;
}

.chat__msg--bg .chat__msg-content::after {
        content: "";
        position: absolute;
        inset: 0;
        background-image: var(--bg-url);
        background-size: cover;
        background-position: center;
        opacity: 0.1;
        border-radius: inherit;
        pointer-events: none;
        z-index: 0;
}

.chat__msg-content pre {
        background: rgba(0, 0, 0, 0.2);
        border: 1px solid rgba(255, 255, 255, 0.1);
        padding: 12px;
        border-radius: 6px;
        overflow: auto;
        font-size: 13px;
        margin: 8px 0;
        position: relative;
        z-index: 1;
}

.chat__msg--user .chat__msg-content pre {
        background: rgba(255, 255, 255, 0.15);
        border-color: rgba(255, 255, 255, 0.2);
}

.chat__msg-content code {
        background: rgba(0, 0, 0, 0.2);
        padding: 2px 6px;
        border-radius: 4px;
        font-size: 13px;
        position: relative;
        z-index: 1;
}

.chat__msg--user .chat__msg-content code {
        background: rgba(255, 255, 255, 0.15);
}

.chat__msg-content pre code {
        background: transparent;
        padding: 0;
}

.chat__msg-content ul, 
.chat__msg-content ol { 
        padding-left: 20px; 
        margin: 8px 0; 
        position: relative;
        z-index: 1;
}

.chat__msg-content blockquote { 
        margin: 8px 0; 
        padding-left: 12px; 
        border-left: 3px solid rgba(255, 255, 255, 0.3);
        color: rgba(255, 255, 255, 0.9);
        position: relative;
        z-index: 1;
}

.chat__msg--user .chat__msg-content blockquote {
        border-left-color: rgba(255, 255, 255, 0.4);
}

.chat__msg-content p {
        margin: 0 0 8px 0;
        position: relative;
        z-index: 1;
}

.chat__msg-content p:last-child {
        margin-bottom: 0;
}

.chat__msg-content h1,
.chat__msg-content h2,
.chat__msg-content h3,
.chat__msg-content h4,
.chat__msg-content h5,
.chat__msg-content h6 {
        margin: 12px 0 8px 0;
        font-weight: 600;
        position: relative;
        z-index: 1;
}

.chat__msg-content h1:first-child,
.chat__msg-content h2:first-child,
.chat__msg-content h3:first-child,
.chat__msg-content h4:first-child,
.chat__msg-content h5:first-child,
.chat__msg-content h6:first-child {
        margin-top: 0;
}

.chat__form {
        display: flex;
        gap: 8px;
        padding: 16px;
        padding-right: 50px;
        border: 1px solid var(--border);
        background: var(--bg);
        align-items: flex-end;
        position: relative;
}

.chat__input-wrapper {
        flex: 1;
        position: relative;
}

.chat__input {
        width: 100%;
        background: var(--bg);
        color: var(--fg);
        border: none;
        border-radius: 20px;
        padding: 10px 16px;
        font-size: 14px;
        font-family: inherit;
        outline: none;
        transition: box-shadow 0.15s ease;
        resize: none;
        min-height: 40px;
        max-height: 120px;
        line-height: 1.5;
}

.chat__input::placeholder {
        color: var(--muted);
}

.chat__input:focus {
        outline: none;
        box-shadow: none;
}

.chat__send-btn {
        width: 28px;
        height: 28px;
        border-radius: 6px;
        background: #2563eb;
        color: white;
        border: 1px solid #2563eb;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 14px;
        transition: background-color 0.15s ease, transform 0.15s ease;
        flex-shrink: 0;
        box-shadow: var(--shadow-sm);
        position: absolute;
        bottom: 12px;
        right: 12px;
}

.chat__send-btn:hover {
        background: #1d4ed8;
        border-color: #1d4ed8;
        transform: scale(1.05);
}

.chat__send-btn:active {
        transform: scale(0.95);
}

.chat__send-btn:disabled {
        opacity: 0.4;
        cursor: not-allowed;
        transform: none;
        background: #94a3b8;
        border-color: #94a3b8;
}

.chat__typing-indicator {
        display: flex;
        align-items: center;
        gap: 6px;
        padding: 10px 14px;
        background: var(--panel-alt);
        border-radius: 12px;
        border: 1px solid var(--border);
        max-width: 60px;
        margin-left: 42px;
}

.chat__typing-indicator span {
        width: 6px;
        height: 6px;
        background: var(--muted);
        border-radius: 50%;
        animation: typing 1.4s infinite ease-in-out;
}

.chat__typing-indicator span:nth-child(1) {
        animation-delay: 0s;
}

.chat__typing-indicator span:nth-child(2) {
        animation-delay: 0.2s;
}

.chat__typing-indicator span:nth-child(3) {
        animation-delay: 0.4s;
}

@keyframes typing {
        0%, 60%, 100% {
                transform: translateY(0);
                opacity: 0.5;
        }
        30% {
                transform: translateY(-8px);
                opacity: 1;
        }
}

/* Main Content */
.main { display: flex; flex-direction: column; background: var(--bg); }

/* Summary Bar */
.summary { 
        display: grid; 
        grid-template-columns: repeat(3, minmax(0,1fr)); 
        gap: 12px; 
        padding: 12px 16px; 
        border-bottom: 1px solid var(--border); 
        background: var(--panel);
        position: sticky;
        top: var(--topbar-height);
        z-index: 200;
}

.summary__item { 
        background: var(--panel-alt);
        border: 1px solid var(--border); 
        border-radius: 8px; 
        padding: 12px 14px;
}

.summary__item:only-child { grid-column: 1 / -1; }

.summary__label { 
        font-size: 11px; 
        font-weight: 500;
        color: var(--muted); 
        margin-bottom: 4px;
        text-transform: uppercase;
        letter-spacing: 0.04em;
}

.summary__value { 
        color: var(--fg); 
        font-weight: 500;
        white-space: nowrap; 
        overflow: hidden; 
        text-overflow: ellipsis;
}

.badge { 
        font-size: 11px; 
        font-weight: 500;
        color: var(--primary);
        background: rgba(68, 147, 248, 0.15);
        padding: 3px 8px;
        border-radius: 4px;
}

.muted { color: var(--fg-secondary); max-width: 720px; }

/* Tabs - Clean rectangular style */
.tabs { 
        display: flex; 
        gap: 0; 
        padding: 0 16px; 
        border-bottom: 1px solid var(--border);
        background: var(--panel);
        position: sticky;
        top: 0;
        z-index: 10;
}

.tab {
        background: transparent;
        color: var(--fg-secondary);
        border: none;
        border-bottom: 2px solid transparent;
        padding: 12px 16px;
        cursor: pointer;
        font-size: 13px;
        font-weight: 500;
        font-family: inherit;
        transition: color 0.15s ease, border-color 0.15s ease;
        margin-bottom: -1px;
}

.tab:hover {
        color: var(--fg);
}

.tab--active {
        color: var(--fg);
        border-bottom-color: var(--primary);
}

.tab-panel { display: none; padding: 20px; }
.tab-panel--active { display: block; }

.tabs__actions {
        display: flex;
        align-items: center;
        gap: 8px;
        margin-left: auto;
}

.invite-btn {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        padding: 6px 12px;
        font-size: 13px;
}

.invite-btn:disabled {
        opacity: 0.5;
        cursor: not-allowed;
}

.invite-btn__icon {
        font-size: 14px;
        line-height: 1;
}

.invite-btn__text {
        display: inline-block;
}

/* Profile Dropdown */
.profile {
        position: relative;
}

.profile__btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 32px;
        height: 32px;
        border-radius: 6px;
        background: var(--panel-alt);
        border: 1px solid var(--border);
        cursor: pointer;
        transition: background-color 0.15s ease;
}

.profile__btn:hover { 
        background: var(--panel-hover);
}

.profile__avatar { font-size: 16px; line-height: 1; }

.profile__menu {
        position: absolute;
        right: 0;
        top: calc(100% + 8px);
        min-width: 200px;
        background: var(--panel);
        border: 1px solid var(--border);
        border-radius: 8px;
        box-shadow: var(--shadow-lg);
        padding: 8px;
        display: grid;
        gap: 6px;
        z-index: 1200;
}

.profile__tokens { display: inline-flex; align-items: center; gap: 8px; }

.profile__settings {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        background: var(--panel-alt);
        color: var(--fg-secondary);
        border: 1px solid var(--border);
        border-radius: 6px;
        padding: 8px 12px;
        cursor: pointer;
        font-family: inherit;
        font-size: 13px;
        text-decoration: none;
        transition: background-color 0.15s ease, color 0.15s ease;
}

.profile__settings:hover {
        background: var(--panel-hover);
        color: var(--fg);
}

.profile__settings[disabled] { opacity: 0.6; cursor: not-allowed; }
.profile__gear { font-size: 14px; line-height: 1; }

/* Diagram */
.diagram {
        position: relative;
        height: 520px;
        max-width: 100%;
        border: 1px solid var(--border);
        border-radius: 8px;
        background: var(--panel);
}

.diagram__svg {
        position: absolute;
        inset: 0;
        z-index: 0;
        pointer-events: none;
}

.diagram__nodes {
        position: absolute;
        inset: 0;
        z-index: 1;
}

.diagram__link {
        stroke: var(--border);
        stroke-width: 2;
        fill: none;
}

/* Step Nodes */
.step {
        position: absolute;
        display: grid;
        grid-template-columns: auto 1fr;
        align-items: center;
        gap: 10px;
        background: var(--panel-alt);
        border: 1px solid var(--border);
        padding: 10px 14px;
        border-radius: 8px;
        cursor: pointer;
        transition: background-color 0.15s ease, border-color 0.15s ease;
        min-width: 80px;
        max-width: 120px;
        overflow: hidden;
        box-sizing: border-box;
}

.step:hover { 
        background: var(--panel-hover);
        border-color: rgba(240, 246, 252, 0.15);
}

.step--human { 
        border-left: 3px solid var(--primary);
}

.step--ai { 
        border-left: 3px solid var(--accent);
}

.step__label { 
        font-weight: 500; 
        font-size: 13px;
        color: var(--fg);
}

.step__icon { 
        width: 24px; 
        height: 24px; 
        display: block; 
        object-fit: contain;
}

.step__type { 
        font-size: 11px; 
        font-weight: 500;
        color: var(--muted);
        text-transform: uppercase;
        letter-spacing: 0.03em;
}

.step--dragging {
        cursor: grabbing;
        box-shadow: var(--shadow-lg);
}

.step--selected {
        background: rgba(68, 147, 248, 0.2);
        border-color: var(--primary);
        border-width: 1px;
        box-shadow: 0 0 0 2px rgba(68, 147, 248, 0.25), var(--shadow-md);
}

.step--selected:hover {
        background: rgba(68, 147, 248, 0.25);
        border-color: var(--primary-hover);
}

.step--completed {
        background: rgba(63, 185, 80, 0.15);
        border-color: var(--success);
        border-width: 1px;
        opacity: 0.85;
}

.step--completed:hover {
        background: rgba(63, 185, 80, 0.2);
        opacity: 1;
}

.step--completed.step--selected {
        background: rgba(63, 185, 80, 0.25);
        border-color: var(--success);
        border-width: 1px;
        box-shadow: 0 0 0 2px rgba(63, 185, 80, 0.25), var(--shadow-md);
}

/* Detail Panel */
.detail {
        position: fixed;
        right: 16px;
        top: 80px;
        bottom: 16px;
        width: min(400px, 90vw);
        background: var(--panel);
        border: 1px solid var(--border);
        border-radius: 12px;
        box-shadow: var(--shadow-lg);
        z-index: 1000;
        overflow: hidden;
}

.detail__close {
        position: absolute;
        top: 12px;
        right: 12px;
        width: 28px;
        height: 28px;
        display: flex;
        align-items: center;
        justify-content: center;
        background: var(--panel-alt);
        color: var(--fg);
        border: 1px solid var(--border);
        border-radius: 6px;
        font-size: 16px;
        cursor: pointer;
        transition: background-color 0.15s ease;
}

.detail__close:hover {
        background: var(--panel-hover);
}

.detail__content { 
        padding: 20px; 
        overflow: auto; 
        height: 100%;
}

.detail__content h3 {
        margin: 0 0 12px;
        font-size: 16px;
        font-weight: 600;
        padding-right: 36px;
}

.code {
        background: var(--bg);
        border: 1px solid var(--border);
        padding: 12px;
        border-radius: 6px;
        color: var(--fg);
        white-space: pre-wrap;
        font-size: 13px;
        font-family: 'Monaco', 'Menlo', monospace;
}

.detail__files { margin-top: 12px; }

.detail__section {
        margin-top: 16px;
}

.detail__section:first-child {
        margin-top: 0;
}

.detail__subtitle {
        font-size: 14px;
        font-weight: 600;
        margin-bottom: 8px;
        color: var(--fg);
}

.detail__row {
        display: grid;
        grid-template-columns: 120px 1fr;
        gap: 12px;
        padding: 6px 0;
        border-bottom: 1px solid var(--border);
}

.detail__row:last-child {
        border-bottom: none;
}

.detail__label {
        font-size: 13px;
        color: var(--fg-secondary);
        font-weight: 500;
}

.detail__value {
        font-size: 13px;
        color: var(--fg);
}

.detail__meta {
        display: flex;
        flex-direction: column;
        gap: 4px;
}

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

.detail__resource-card {
        background: var(--panel-alt);
        border: 1px solid var(--border);
        border-radius: 8px;
        padding: 12px 16px;
        transition: border-color 0.15s ease;
}

.detail__resource-card:hover {
        border-color: rgba(240, 246, 252, 0.15);
}

.detail__resource-header {
        display: flex;
        align-items: center;
        gap: 8px;
        margin-bottom: 8px;
}

.detail__resource-type {
        font-size: 11px;
        font-weight: 600;
        text-transform: uppercase;
        color: var(--fg-secondary);
        background: var(--bg);
        padding: 2px 8px;
        border-radius: 4px;
        border: 1px solid var(--border);
}

.detail__resource-name {
        font-size: 14px;
        font-weight: 600;
        color: var(--fg);
}

.detail__resource-description {
        font-size: 13px;
        color: var(--fg-secondary);
        margin-bottom: 8px;
        line-height: 1.5;
}

.detail__resource-suggestions-label {
        font-size: 12px;
        font-weight: 600;
        color: var(--fg-secondary);
        margin-bottom: 4px;
        margin-top: 8px;
}

.detail__resource-suggestions {
        margin-top: 4px;
        padding-left: 18px;
}

.detail__resource-suggestion-link {
        color: var(--accent, #58a6ff);
        text-decoration: none;
        transition: color 0.15s ease, text-decoration 0.15s ease;
}

.detail__resource-suggestion-link:hover {
        color: var(--accent-hover, #79c0ff);
        text-decoration: underline;
}

.detail__resource-suggestions li {
        padding: 2px 0;
}

/* Market Cards */
.market { display: grid; gap: 12px; max-width: 900px; }

.market__card {
        background: var(--panel-alt);
        border: 1px solid var(--border);
        border-radius: 8px;
        padding: 16px 20px;
        transition: border-color 0.15s ease;
}

.market__card:hover { 
        border-color: rgba(240, 246, 252, 0.15);
}

.market__title { 
        margin: 0 0 10px; 
        font-size: 15px;
        font-weight: 600;
}

.list { 
        margin: 0; 
        padding-left: 18px;
        color: var(--fg-secondary);
}

.list li {
        padding: 3px 0;
}

/* Product Image */
.market__image {
        width: 100%;
        max-width: 640px;
        height: auto;
        display: block;
        border-radius: 8px;
        border: 1px solid var(--border);
}

/* Modal */
.modal {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.6);
        display: grid;
        place-items: center;
        z-index: 2000;
}

.modal[hidden] { display: none; }

.modal__dialog {
        background: var(--panel);
        border: 1px solid var(--border);
        border-radius: 12px;
        box-shadow: var(--shadow-lg);
        width: min(640px, 92vw);
        max-height: 80vh;
        display: grid;
        grid-template-rows: auto 1fr auto;
}

.modal__header {
        display: grid;
        grid-template-columns: 1fr auto;
        align-items: center;
        padding: 14px 20px;
        border-bottom: 1px solid var(--border);
}

.modal__header h3 {
        margin: 0;
        font-size: 16px;
        font-weight: 600;
}

.modal__header .detail__close {
        position: static;
}

.modal__body {
        padding: 20px;
        overflow: auto;
        white-space: pre-wrap;
        line-height: 1.6;
}

.modal__footer {
        display: flex;
        justify-content: flex-end;
        gap: 8px;
        padding: 14px 20px;
        border-top: 1px solid var(--border);
}

/* Landing Page */
.page--start .workspace { grid-template-columns: 340px 1fr; }
.page--start .sidebar { display: flex; }
.page--start .main {
        min-height: calc(100vh - var(--topbar-height));
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding: 20px;
        gap: 24px;
}
.page--start { --topbar-height: 56px; }
.page--start .topbar { 
        display: flex !important; 
        justify-content: flex-end;
        right: 0;
        width: 100%;
        padding-top: 10px;
        padding-bottom: 10px;
}

/* Docked Detail Panel */
.tab-panel--active.tab-panel--has-detail {
        display: grid;
        grid-template-columns: 1fr minmax(320px, 400px);
        gap: 16px;
        align-items: stretch;
        min-height: calc(100vh - var(--topbar-height) - 24px);
}

.tab-panel--has-detail .detail {
        position: sticky;
        top: calc(var(--topbar-height) + 12px);
        height: calc(100vh - var(--topbar-height) - 32px);
        right: auto;
        bottom: auto;
        width: auto;
        box-shadow: none;
        z-index: 2;
}

.tab-panel--has-detail .diagram {
        height: calc(100vh - var(--topbar-height) - 32px);
}

.tab-panel--has-detail .detail__content {
        height: 100%;
        overflow: auto;
}

/* Responsive */
@media (max-width: 900px) {
        .workspace { grid-template-columns: 1fr; }
        .sidebar { height: 50vh; }
        .summary { grid-template-columns: 1fr; }
        .page--workspace .topbar { right: 0; width: 100%; }
        .card { padding: 24px; }
}

/* Scrollbars */
::-webkit-scrollbar {
        width: 8px;
        height: 8px;
}

::-webkit-scrollbar-track {
        background: var(--bg);
}

::-webkit-scrollbar-thumb {
        background: rgba(240, 246, 252, 0.1);
        border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
        background: rgba(240, 246, 252, 0.15);
}

::selection {
        background: rgba(68, 147, 248, 0.3);
}

/* Step completion checkbox */
.detail__files input[type="checkbox"] {
        width: 16px;
        height: 16px;
        cursor: pointer;
        accent-color: var(--success);
}

.detail__files label {
        font-size: 14px;
        color: var(--fg);
        cursor: pointer;
}

/* Profile Page Styles */
.page--profile {
        display: block;
        padding: 20px;
        min-height: 100vh;
}

.profile-container {
        max-width: 1200px;
        width: 95%;
        margin: 0 auto;
}

.profile-header {
	display: flex;
	align-items: center;
	gap: 24px;
	margin-bottom: 32px;
}

.profile-header .brand {
	margin-right: auto;
}

.profile-back {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        padding: 0;
        font-size: 18px;
        text-decoration: none;
}

.profile-title {
        margin: 0;
        font-size: 24px;
        font-weight: 600;
}

.profile-layout {
        display: flex;
        gap: 24px;
        align-items: flex-start;
        height: calc(100vh - 100px);
        min-height: 750px;
}

.profile-content {
        flex: 1;
        position: relative;
        min-height: 0;
        height: 100%;
        min-width: 0;
        width: 100%;
}

.profile-tabs {
        display: flex;
        flex-direction: column;
        gap: 4px;
        min-width: 160px;
}

.profile-tab {
        background: transparent;
        color: var(--fg-secondary);
        border: none;
        border-radius: 6px;
        padding: 12px 16px;
        cursor: pointer;
        font-size: 14px;
        font-weight: 500;
        font-family: inherit;
        text-align: left;
        transition: background-color 0.15s ease, color 0.15s ease;
}

.profile-tab:hover {
        background: var(--panel-alt);
        color: var(--fg);
}

.profile-tab--active {
        background: var(--panel);
        color: var(--primary);
        border-left: 3px solid var(--primary);
}

.profile-panel {
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: var(--panel);
        border: 1px solid var(--border);
        border-radius: 12px;
        padding: 32px;
        width: 100%;
        height: 100%;
        overflow-y: auto;
        overflow-x: hidden;
        box-sizing: border-box;
        visibility: hidden;
        opacity: 0;
        transition: opacity 0.2s ease, visibility 0.2s ease;
}

.profile-panel--active {
        visibility: visible;
        opacity: 1;
}

.profile-panel h2 {
        margin: 0 0 24px;
        font-size: 20px;
        font-weight: 600;
}

.profile-panel h3 {
        margin: 32px 0 16px;
        font-size: 16px;
        font-weight: 600;
}

.profile-image-section {
        display: flex;
        align-items: center;
        gap: 20px;
        margin-bottom: 24px;
}

.profile-image-preview {
        width: 80px;
        height: 80px;
        border-radius: 50%;
        background: var(--panel-alt);
        border: 2px solid var(--border);
        display: flex;
        align-items: center;
        justify-content: center;
        overflow: hidden;
}

.profile-image-preview img {
        width: 100%;
        height: 100%;
        object-fit: cover;
}

.profile-image-placeholder {
        font-size: 32px;
}

.profile-image-upload {
        display: flex;
        flex-direction: column;
        gap: 8px;
}

/* Plans Tab */
.current-plan {
        background: var(--panel-alt);
        border: 1px solid var(--border);
        border-radius: 8px;
        padding: 20px;
        display: flex;
        align-items: center;
        gap: 24px;
}

.plan-badge {
        display: flex;
        align-items: center;
        gap: 8px;
}

.plan-name {
        font-size: 18px;
        font-weight: 600;
        color: var(--primary);
}

.plan-tokens {
        display: flex;
        align-items: center;
        gap: 12px;
        margin-left: auto;
}

.plans-grid {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
        gap: 16px;
}

.plan-card {
        background: var(--panel-alt);
        border: 1px solid var(--border);
        border-radius: 8px;
        padding: 24px;
        position: relative;
}

.plan-card--featured {
        border-color: var(--primary);
        box-shadow: 0 0 0 1px var(--primary);
}

.plan-popular {
        position: absolute;
        top: -10px;
        right: 16px;
        background: var(--primary);
        color: #fff;
        font-size: 11px;
        font-weight: 600;
        padding: 4px 12px;
        border-radius: 12px;
}

.plan-card h4 {
        margin: 0 0 12px;
        font-size: 18px;
        font-weight: 600;
}

.plan-price {
        font-size: 32px;
        font-weight: 700;
        color: var(--fg);
        margin-bottom: 16px;
}

.plan-price span {
        font-size: 14px;
        font-weight: 400;
        color: var(--fg-secondary);
}

.plan-features {
        list-style: none;
        padding: 0;
        margin: 0 0 20px;
}

.plan-features li {
        padding: 6px 0;
        color: var(--fg-secondary);
        font-size: 14px;
}

.plan-features li::before {
        content: "✓";
        color: var(--success);
        margin-right: 8px;
}

/* Integrations Tab */
.integrations-list {
        display: grid;
        gap: 16px;
}

.integration-card {
        background: var(--panel-alt);
        border: 1px solid var(--border);
        border-radius: 8px;
        padding: 20px;
        display: flex;
        align-items: center;
        gap: 16px;
}

.integration-icon {
        width: 48px;
        height: 48px;
        display: flex;
        align-items: center;
        justify-content: center;
        background: var(--panel);
        border-radius: 8px;
        color: var(--fg);
}

.integration-info {
        flex: 1;
}

.integration-info h4 {
        margin: 0 0 4px;
        font-size: 16px;
        font-weight: 600;
}

.integration-info p {
        margin: 0;
        font-size: 13px;
}

.integration-btn {
        white-space: nowrap;
}

/* Index page profile button */
.topbar__profile {
        position: relative;
}

.topbar__profile-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 36px;
        height: 36px;
        border-radius: 6px;
        background: var(--panel-alt);
        border: 1px solid var(--border);
        cursor: pointer;
        transition: background-color 0.15s ease;
        text-decoration: none;
        color: var(--fg);
}

.topbar__profile-btn:hover {
        background: var(--panel-hover);
}

@media (max-width: 768px) {
        .profile-layout {
                flex-direction: column-reverse;
                height: calc(100vh - 100px);
                min-height: 600px;
        }
        
        .profile-content {
                min-height: 500px;
        }
        
        .profile-tabs {
                flex-direction: row;
                min-width: 100%;
                overflow-x: auto;
        }
        
        .profile-tab {
                text-align: center;
                border-left: none;
                border-bottom: 2px solid transparent;
        }
        
        .profile-tab--active {
                border-left: none;
                border-bottom-color: var(--primary);
        }
        
        .plans-grid {
                grid-template-columns: 1fr;
        }
}
