*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
#app-root { min-height: 100vh; display: flex; flex-direction: column; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
.muted { color: var(--muted); }
.small, .tiny { font-size: 0.8125rem; }
.eyebrow { text-transform: uppercase; letter-spacing: 0.12em; font-size: 0.72rem; }
.surface { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 1rem 1.1rem; }
.shadowed { box-shadow: var(--glow); }
.split { display: flex; gap: 0.85rem; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; }

.btn { cursor: pointer; border-radius: 10px; font-weight: 600; padding: 0.5rem 0.95rem; border: 1px solid transparent; background: transparent; font-family: inherit; color: var(--text); }
.btn.primary { background: linear-gradient(120deg, var(--accent), var(--accent-strong)); color: #fff; border: none; }
.btn.ghost { border-color: var(--border); background: transparent; }
.btn.stretch { width: 100%; justify-content: center; }
.icon-btn { width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-elev); color: inherit; cursor: pointer; }
.tiny.small { transform: translateY(-0px); font-size: 0.75rem; padding: 0.35rem 0.62rem !important; }

/* Auth */
.auth-screen { display: grid; grid-template-columns: minmax(0, 460px) 1fr; min-height: 100vh; }
.auth-card { padding: clamp(1.75rem, 4vw, 2.55rem); border-radius: 24px; border: 1px solid var(--border); margin: 2rem auto; max-width: 520px; }
.auth-brand { display: flex; gap: 1rem; align-items: center; margin-bottom: 1.25rem; }
.logo-orbit { width: 48px; height: 48px; border-radius: 14px; background: radial-gradient(circle, var(--accent), transparent); box-shadow: 0 12px 30px rgba(56,189,248,0.35); }
.auth-side { background: linear-gradient(155deg, rgba(56,189,248,.15), transparent 54%), rgba(15,23,42,0.4); padding: 3rem; display: flex; align-items: center; }
.auth-side-inner { max-width: 520px; }
.auth-metrics { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 0.75rem; margin-top: 1.75rem; }
.auth-metrics div { padding: 0.75rem; border-radius: 12px; border: 1px solid var(--border); background: rgba(15,23,42,0.35); font-size: 0.82rem; }
.auth-metrics span { display: block; margin-top: 0.35rem; color: var(--muted); font-weight: 500; font-size: 0.74rem; }
.auth-form label { display: flex; flex-direction: column; gap: 0.35rem; font-size: 0.82rem; margin-bottom: 0.85rem; }
.auth-form input { padding: 0.65rem 0.72rem; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: inherit; }
.demo-hint { margin-top: 0.75rem; font-size: 0.82rem; }
@media(max-width: 960px) { .auth-screen { grid-template-columns: 1fr; } .auth-side { display: none; } }

/* Workspace shell */
.app-shell { flex: 1; display: grid; grid-template-columns: clamp(278px, 28vw, 340px) 1fr; min-height: calc(100vh - 56px); }
.sidebar { padding: 0.95rem 0.82rem 2rem; border-right: 1px solid var(--border); display: flex; flex-direction: column; gap: 0.62rem; background: rgba(2, 6, 23, 0.72); backdrop-filter: blur(16px); }
body[data-theme="light"] .sidebar { background: #fff9; }

.project-rail-scroll { overflow-y: auto; flex: 1; padding-right: 6px; }
.project-chip { padding: 0.78rem 0.74rem; border-radius: 12px; border: 1px solid var(--border); margin-bottom: 0.54rem; background: rgba(15,23,42,0.35); cursor: grab; transition: transform 0.15s ease, border-color 0.15s ease; display: grid; gap: 0.2rem; }
.project-chip.dragging { opacity: 0.55; transform: rotate(-2deg); }
.project-chip-header { display: flex; gap: 0.45rem; align-items: center; justify-content: space-between; }
.badge.hot { padding: 0.12rem 0.45rem; border-radius: 999px; background: rgba(248,113,113,0.2); border: 1px solid rgba(248,113,113,0.45); font-size: 0.66rem; }
.badge.subtle { font-size: 0.74rem; color: var(--muted); padding: 0.1rem 0.42rem; border-radius: 6px; border: 1px solid var(--border); }
.pill { border-radius: 999px; border: 1px solid var(--border); padding: 0.1rem 0.55rem; font-size: 0.73rem; }
.pill.subtle { background: rgba(148,163,184,.12); font-weight: 500; }

.main-stage { display: flex; flex-direction: column; min-height: 0; }
.top-nav { padding: 0.65rem clamp(1rem, 2vw, 1.4rem); border-bottom: 1px solid var(--border); backdrop-filter: blur(12px); display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; justify-content: space-between; background: rgba(2, 6, 23, 0.82); position: sticky; top: 0; z-index: 12; }

.workspace-chrome { position: relative; }
.ws-pill { display: inline-flex; align-items: center; gap: 0.45rem; border-radius: 12px; border: 1px solid var(--border); padding: 0.42rem 0.74rem 0.42rem 0.55rem; background: rgba(148,163,184,0.1); cursor: pointer; font-weight: 600; font-size: 0.93rem; }
.ws-logo { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: radial-gradient(circle at 35% -10%, rgba(255,255,255,0.45), transparent 55%); font-size: 0.78rem; font-weight: 800; letter-spacing: 0.06em; }
.ws-menu { position: absolute; top: calc(100% + 6px); left: 0; min-width: 280px; background: rgba(15,23,42,0.94); border: 1px solid var(--border); border-radius: 14px; padding: 0.45rem; z-index: 25; backdrop-filter: blur(18px); }
.ws-option { width: 100%; text-align: left; border-radius: 10px; border: 1px solid transparent; background: transparent; color: inherit; padding: 0.55rem; display: flex; gap: 0.6rem; align-items: center; cursor: pointer; }
.ws-option.active { border-color: var(--accent); background: rgba(56,189,248,0.12); }

.nav-tools { display: flex; flex-wrap: wrap; gap: 0.45rem; align-items: center; }
.controls select { background: rgba(15,23,42,0.55); border: 1px solid var(--border); color: inherit; padding: 0.35rem 0.62rem; border-radius: 8px; font-size: 0.82rem; }
.notif-chip { padding: 0.28rem 0.74rem; border-radius: 999px; border: 1px solid var(--border); font-size: 0.8rem; }
.gear-wrap { position: relative; z-index: 20; }
.menu-pop { position: absolute; right: 0; top: calc(100% + 10px); min-width: 220px; padding: 0.75rem; border-radius: 12px; border: 1px solid var(--border); background: rgba(15,23,42,0.96); }

.stage-body { padding: clamp(1rem, 2.2vw, 1.5rem); flex: 1; overflow: auto; }
.tab-bar { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 1rem; }
.tab-pill { border-radius: 999px; border: 1px solid var(--border); padding: 0.42rem 0.94rem; background: transparent; color: inherit; cursor: pointer; font-size: 0.82rem; }
.tab-pill.active { border-color: var(--accent); background: rgba(56,189,248,0.15); font-weight: 600; }

.fab-create { position: fixed; bottom: 1.4rem; right: 1.4rem; z-index: 40; border: none; width: 58px; height: 58px; border-radius: 18px; background: linear-gradient(140deg, var(--accent), var(--accent-strong)); color: #071018; font-size: 1.42rem; font-weight: 800; cursor: pointer; box-shadow: 0 28px 50px rgba(15,118,226,0.35); }

#modal-mount { position: fixed; inset: 0; z-index: 50; pointer-events: none; }

/* Modal */
.overlay { position: absolute; inset: 0; background: rgba(2,6,23,.66); backdrop-filter: blur(4px); display: grid; place-items: center; padding: clamp(1rem, 5vw, 2.5rem); pointer-events: auto; }
.modal { width: min(860px, 100%); border-radius: 18px; border: 1px solid var(--border); background: var(--surface-elev); max-height: 92vh; display: flex; flex-direction: column; }
.modal-head, .modal-foot { padding: 1rem 1.35rem; display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; border-block: 1px solid var(--border); }
.modal-foot { justify-content: flex-end; gap: 0.55rem; }
.modal-body { padding: 1.1rem 1.35rem; overflow-y: auto; flex: 1; }
.grid-form { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 0.9rem 1rem; align-items: start; }
.grid-form label { display: flex; flex-direction: column; gap: 0.32rem; font-size: 0.82rem; }
.grid-form input, .grid-form select, .grid-form textarea { border-radius: 10px; border: 1px solid var(--border); background: rgba(15,23,42,.45); color: inherit; padding: 0.55rem 0.72rem; font-family: inherit; }
.span-2 { grid-column: span 2; }
.template-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px,1fr)); gap: 0.6rem; }
.template-card { display: grid; gap: 0.4rem; border-radius: 12px; border: 1px solid var(--border); padding: 0.72rem 0.8rem; background: rgba(15,23,42,0.4); cursor: pointer; transition: border-color 0.16s ease, transform 0.16s ease; }
.template-card:has(input:checked) { border-color: var(--accent); transform: translateY(-1px); }
.template-card strong { font-size: 0.93rem; }
.template-card input[type="radio"] { width: fit-content; }
.template-fieldset { border: none; padding: 0; margin: 0; }
.template-fieldset legend { font-weight: 600; margin-bottom: 0.54rem; }
.inline-form { display: flex; gap: 0.45rem; flex-wrap: wrap; align-items: center; margin-top: 0.82rem; }
.inline-form input { flex: 1 min(160px, 100%); padding: 0.45rem 0.72rem; border-radius: 8px; border: 1px solid var(--border); background: transparent; color: inherit; }
.data-table.slim { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
.data-table td, .data-table th { padding: 0.5rem 0.45rem; border-bottom: 1px solid var(--border); text-align: left; }
.perm-select { background: transparent; border: 1px solid var(--border); color: inherit; border-radius: 8px; padding: 0.25rem 0.45rem; }

/* Dashboard tiles */
.partner-teaser-slot { margin-bottom: 0.82rem; }
.inline-partner-banner { margin-bottom: 1rem; display: flex; flex-wrap: wrap; gap: 0.5rem 0.8rem; align-items: center; font-size: 0.82rem; }
.link-btn { background: transparent; border: none; padding: 0; color: var(--accent); cursor: pointer; text-decoration: underline; font-family: inherit; }
.partner-cards { display: grid; gap: 0.92rem; grid-template-columns: repeat(auto-fit,minmax(240px,1fr)); }
.partner-card { border-radius: 16px; border: 1px solid var(--border); padding: 1rem 1rem 1.1rem; background: radial-gradient(circle at 10% -20%, rgba(255,255,255,0.18), transparent 45%); position: relative; overflow: hidden; }
.partner-card::before { content: ""; position: absolute; inset: 0; background: var(--partner-gradient); opacity: 0.18; pointer-events: none; }
.mini-project { border: 1px solid var(--border); border-radius: 12px; padding: 0.78rem 0.85rem; cursor: pointer; transition: transform 0.15s ease, border-color 0.15s ease; background: rgba(15,23,42,0.35); }
.mini-project:hover { border-color: var(--accent); transform: translateY(-2px); }
.project-grid-mini { display: grid; gap: 0.65rem; grid-template-columns: repeat(auto-fill, minmax(180px,1fr)); margin-top: 1rem; }
.progress { margin: 0.45rem 0; height: 6px; border-radius: 999px; background: rgba(148,163,184,0.18); overflow: hidden; }
.progress span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(120deg,var(--accent),var(--accent-strong)); }
.tile.span-2 { grid-column: span 2; }
.tile.span-3 { grid-column: span 3; }
.dashboard-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px,1fr)); gap: 0.9rem; align-items: start; margin-top: 1rem; }
.spark { height: 120px; border-radius: 12px; background: linear-gradient(120deg,rgba(56,189,248,0.2),transparent 60%); }

/* Chat */
.chat-grid { display: grid; grid-template-columns: 280px 1fr 220px; min-height: 520px; border: 1px solid var(--border); border-radius: 16px; overflow: hidden; background: rgba(2, 6, 23, 0.62); margin-top: 0.82rem; }
.chat-rail { padding: 0.78rem 0.68rem 1rem; display: grid; gap: 0.55rem; align-content: start; overflow-y: auto; }
.chat-rail-head { display: flex; justify-content: space-between; align-items: center; }
.presence-row { border-radius: 10px; border: 1px solid var(--border); padding: 0.52rem 0.65rem; display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.82rem; }
.status-dot { width: 10px; height: 10px; border-radius: 50%; background: #34d399; box-shadow: 0 0 10px rgba(52,211,153,0.8); animation: blink 5s infinite; }
@keyframes blink { 0%,60%,100% {opacity: 1;} 70% {opacity: 0.4;} }

.channel-list, .dm-list { display: grid; gap: 0.35rem; }
.channel-pill, .dm-pill { padding: 0.45rem 0.72rem; border-radius: 10px; border: 1px solid transparent; text-align: left; background: rgba(15,23,42,0.35); cursor: pointer; color: inherit; font-size: 0.85rem; }
.channel-pill.active { border-color: var(--accent); background: rgba(56,189,248,0.15); font-weight: 600; }

.chat-main { display: flex; flex-direction: column; border-inline: 1px solid rgba(148,163,184,0.12); background: rgba(2,12,34,0.35); min-height: 0; min-width: 0; }
.chat-topbar { padding: 0.9rem 1rem; border-bottom: 1px solid var(--border); }
.toolbar { display: inline-flex; flex-wrap: wrap; gap: 0.4rem; }
.pinned-strip { padding: 0.55rem 0.92rem; font-size: 0.8rem; }
.messages { flex: 1; padding: 0.92rem 1rem; gap: 0.92rem; display: grid; overflow-y: auto; min-height: 320px; }
.message-card { border: 1px solid var(--border); border-radius: 12px; padding: 0.78rem 0.85rem 0.9rem; background: rgba(15,23,42,0.45); box-shadow: 0 24px 50px rgba(2,12,38,0.28); font-size: 0.92rem; }
.message-card header { display: flex; justify-content: space-between; gap: 0.5rem; align-items: center; margin-bottom: 0.4rem; }
.message-foot { display: flex; flex-wrap: wrap; gap: 0.4rem 0.6rem; align-items: center; margin-top: 0.45rem; font-size: 0.76rem; }
.thread-block { border-left: 2px solid var(--accent); padding-left: 0.74rem; margin-top: 0.45rem; display: grid; gap: 0.4rem; }
.thread-msg { padding: 0.35rem 0.62rem; border-radius: 8px; background: rgba(148,163,184,0.12); font-size: 0.82rem; }
.thread-reply { gap: 0.35rem; margin-top: 0.3rem; }
.react-pill { border-radius: 999px; border: 1px solid var(--border); background: transparent; cursor: pointer; padding: 0.1rem 0.55rem; font-size: 0.74rem; }

.composer { border-top: 1px solid var(--border); display: grid; gap: 0.4rem; }
.composer textarea { resize: vertical; min-height: 84px; width: 100%; border-radius: 10px; border: 1px solid var(--border); background: rgba(15,23,42,.45); color: inherit; padding: 0.65rem 0.74rem; font-family: inherit; }
.composer-tools { padding: 0.45rem 0.92rem 0; display: flex; gap: 0.42rem; }
.composer-actions { justify-content: space-between !important; }
.composer-form { padding: 0 0.92rem 0.85rem; }

.chat-meta { padding: 0.92rem 0.74rem 1rem; font-size: 0.82rem; line-height: 1.42; overflow-y: auto; }
.hitlist { display: flex; flex-wrap: wrap; gap: 0.38rem; }
.hitpill { border-radius: 999px; border: 1px solid var(--border); background: transparent; cursor: pointer; padding: 0.2rem 0.65rem; color: inherit; font-size: 0.75rem; }
.typing-indicator { padding: 0.45rem 0.92rem; display: inline-flex; align-items: center; gap: 0.45rem; }
.typing-indicator span { width: 6px; height: 6px; border-radius: 999px; background: var(--accent); animation: dot 1.2s infinite; }
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }
@keyframes dot { 0%,70%,100% {opacity: .3;transform:translateY(0);}35%{opacity:1;transform:translateY(-3px);} }

@media (max-width: 1100px) { .chat-grid { grid-template-columns: minmax(0,240px) 1fr; } .chat-meta { display:none; } }

/* Meet */
.meet-shell { border: 1px solid var(--border); border-radius: 16px; padding: 1rem; display: grid; gap: 0.9rem; }
.incoming-call { position: fixed; inset: auto 1rem 90px auto; z-index: 45; opacity: 0; transform: translateY(12px); transition: opacity 0.2s ease, transform 0.2s ease; }
.incoming-call.show { opacity: 1; transform: translateY(0); pointer-events: auto; }
.incoming-card { width: min(430px,calc(100vw - 2rem)); padding: 1rem 1.1rem 1.2rem; border-radius: 16px; border: 1px solid var(--border); background: rgba(15,23,42,0.92); backdrop-filter: blur(18px); display: grid; gap: 0.8rem; }
.incoming-actions { display: inline-flex; justify-content: flex-end; gap: 0.45rem; }
.url-preview { word-break: break-all; opacity: .8; font-size: 0.75rem; }
.call-float { position: fixed; right: 1rem; bottom: calc(92px + 1rem); z-index: 44; padding: 0.9rem 1rem; border-radius: 14px; border: 1px solid var(--border); max-width: 360px; display: grid; gap: 0.5rem; }

/* Board */
.board-toolbar { display: flex; flex-wrap: wrap; gap: 0.45rem; align-items: center; margin-bottom: 0.82rem; }
.board-viewport { position: relative; height: min(calc(100vh - 320px), 640px); border-radius: 16px; border: 1px solid var(--border); overflow: hidden; background: rgba(2,6,23,.55); }
.board-grid { position: absolute; inset: 0; pointer-events: none; background-image: radial-gradient(rgba(148,163,184,0.18) 1px,transparent 1px); background-size: 40px 40px; }
.board-canvas-main { width: 100%; height: 100%; display: block; position: absolute; inset: 0; }
.board-overlays, .live-cursors { position: absolute; inset: 0; transform-origin: 0 0; pointer-events: none; }
.live-cursors { pointer-events: none; }
.board-overlays { pointer-events: auto; }
.board-viewport.grabbing { cursor: grabbing; }
.sticky-card { position: absolute; width: 228px; min-height: 150px; border-radius: 10px; border-width: 2px; padding: 0.45rem 0.55rem; box-shadow: 0 34px 40px rgba(2,18,54,0.35); resize: horizontal; overflow: hidden; }
.sticky-card textarea { margin-top: 0.35rem; width: 100%; background: transparent; border: none; color: inherit; font-family: inherit; min-height: 110px; }
.board-image-chip { position: absolute; border-radius: 14px; box-shadow: 0 38px 50px rgba(2,22,72,0.45); cursor: grab; }
.cursor-badge { position: absolute; font-size: 0.74rem; background: rgba(56,189,248,0.95); padding: 0.2rem 0.45rem; border-radius: 999px; color: #0f172a; transform: translate(8px,-10px); }
.inline-color { font-size: 0.74rem; display: inline-flex; align-items: center; gap: 0.35rem; }

/* Kanban */
.kanban-grid { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(240px,1fr); gap: 0.9rem; overflow-x: auto; padding-bottom: .5rem; }
.lane { display: grid; gap: 0.55rem; align-content: start; padding: .75rem; min-height: 320px; }
.lane-cards { display: grid; gap: .55rem; }
.kanban-card { padding: 0.7rem .75rem; font-size: 0.9rem; }
.card-actions { display: flex; flex-wrap: wrap; gap: .35rem .5rem; margin-top: .42rem; }

/* Pulse / specs */
.pulse-grid { display: grid; gap: 1rem; }
.spec-card { padding: .9rem 1rem 1rem; }
.checklist label { display: flex; align-items: center; gap: .42rem; font-size: .86rem; }

/* Toast */
.toast { position: fixed; right: .9rem; top: calc(76px + 1rem); background: rgba(15,23,42,0.95); border-radius: 10px; border: 1px solid var(--border); padding: .55rem .85rem; z-index: 60; opacity: 0; transform: translateY(-6px); transition: opacity 0.2s ease; max-width: 320px; }
.toast.show { opacity: 1; transform: translateY(0); }

/* Responsive */
@media (max-width: 960px) { .app-shell { grid-template-columns: 1fr; } .sidebar { border-right:none; border-bottom:1px solid var(--border); } }
