:root {
  --bg: #f4f7fb;
  --bg-2: #eef2ff;
  --surface: rgba(255, 255, 255, 0.86);
  --surface-solid: #ffffff;
  --surface-soft: #f8fafc;
  --text: #0f172a;
  --muted: #64748b;
  --subtle: #94a3b8;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;
  --brand: #6d5dfc;
  --brand-2: #9b5cf6;
  --brand-3: #06b6d4;
  --brand-soft: #eef2ff;
  --danger: #e11d48;
  --danger-soft: #fff1f2;
  --success: #059669;
  --success-soft: #ecfdf5;
  --warning: #d97706;
  --note: #fff7d6;
  --shadow: 0 24px 70px rgba(15, 23, 42, 0.12);
  --shadow-soft: 0 12px 34px rgba(15, 23, 42, 0.08);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
textarea {
  font: inherit;
}

button,
.btn,
.uploadBtn {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(109, 93, 252, 0.25);
  outline-offset: 2px;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

p {
  color: var(--muted);
  line-height: 1.65;
}

code {
  display: inline-flex;
  padding: 2px 7px;
  border-radius: 8px;
  color: #334155;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
}

/* Shared components */
.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.brand-icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  color: #fff;
  font-weight: 950;
  letter-spacing: -0.04em;
  background: linear-gradient(135deg, var(--brand), var(--brand-2) 58%, var(--brand-3));
  box-shadow: 0 16px 30px rgba(109, 93, 252, 0.28);
}

.brand-lockup strong {
  display: block;
  font-weight: 950;
  font-size: 18px;
  letter-spacing: -0.04em;
}

.brand-lockup span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.pill,
.mini-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 6px 11px;
  border-radius: 999px;
  color: #4338ca;
  background: var(--brand-soft);
  border: 1px solid #dbeafe;
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0.01em;
}

.surface-card,
.content-card,
.stat-card,
.project-card,
.modal-card {
  background: var(--surface);
  border: 1px solid rgba(226, 232, 240, 0.85);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(18px);
}

.btn,
button,
.uploadBtn,
.ghost-btn,
.icon-btn,
.tool-btn {
  border: 0;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease, background 0.16s ease, color 0.16s ease, opacity 0.16s ease;
}

.btn,
.uploadBtn {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 17px;
  border-radius: 14px;
  color: #1e293b;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.07);
  font-weight: 900;
}

.btn:hover,
.uploadBtn:hover,
.tool-btn:hover,
.ghost-btn:hover,
.icon-btn:hover {
  transform: translateY(-1px);
}

.btn.primary,
.uploadBtn.primary,
.primary {
  color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  border-color: transparent;
  box-shadow: 0 18px 38px rgba(109, 93, 252, 0.28);
}

.btn.secondary {
  color: #334155;
  background: #f8fafc;
}

.btn.save-btn {
  color: #0f172a;
  background: #fff;
  border-color: #dbeafe;
}

.btn.full,
.full {
  width: 100%;
}

button:disabled,
.btn.disabled,
.tool-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
  transform: none;
  box-shadow: none;
}

.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  margin: 16px 0;
  padding: 13px 15px;
  border-radius: 15px;
  font-weight: 800;
  line-height: 1.45;
}

.alert-error,
.alert:not(.alert-success) {
  color: #be123c;
  background: var(--danger-soft);
  border: 1px solid #fecdd3;
}

.alert-success,
.success {
  color: #047857;
  background: var(--success-soft);
  border: 1px solid #bbf7d0;
}

.field label,
label {
  display: block;
  margin: 0 0 8px;
  color: #334155;
  font-size: 13px;
  font-weight: 850;
}

input,
textarea {
  width: 100%;
  color: var(--text);
  background: #fff;
  border: 1px solid #dbe3ef;
  border-radius: 15px;
  padding: 13px 14px;
  outline: none;
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.02);
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

textarea {
  min-height: 116px;
  resize: vertical;
}

input::placeholder,
textarea::placeholder {
  color: #a1aab8;
}

input:focus,
textarea:focus {
  border-color: rgba(109, 93, 252, 0.7);
  box-shadow: 0 0 0 4px rgba(109, 93, 252, 0.12);
}

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

.form-grid.two {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.form-note {
  margin: 20px 0 0;
  color: var(--subtle);
  font-size: 13px;
  text-align: center;
}

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 5px 0;
  color: var(--subtle);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

/* Auth + setup */
.auth {
  min-height: 100vh;
  display: grid;
  place-items: center;
  overflow-x: hidden;
  padding: 26px;
  background: radial-gradient(circle at 20% 16%, rgba(109, 93, 252, 0.20), transparent 28%),
              radial-gradient(circle at 82% 18%, rgba(6, 182, 212, 0.18), transparent 26%),
              linear-gradient(135deg, #f8fafc 0%, #eef2ff 100%);
}

.auth-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(15, 23, 42, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15, 23, 42, 0.035) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(circle at center, #000 0%, transparent 78%);
}

.auth-shell,
.setup-shell {
  position: relative;
  z-index: 1;
  width: min(1160px, 100%);
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(390px, 0.78fr);
  gap: 26px;
  align-items: stretch;
}

.setup-shell {
  grid-template-columns: minmax(0, 0.82fr) minmax(480px, 1fr);
}

.auth-hero,
.setup-intro {
  min-height: 620px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 38px;
  border-radius: 34px;
  color: #fff;
  overflow: hidden;
  background: linear-gradient(135deg, #0f172a 0%, #312e81 54%, #0e7490 110%);
  box-shadow: var(--shadow);
  position: relative;
}

.auth-hero::before,
.setup-intro::before {
  content: "";
  position: absolute;
  inset: -30%;
  background:
    radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.25), transparent 18%),
    radial-gradient(circle at 72% 80%, rgba(6, 182, 212, 0.25), transparent 24%);
  pointer-events: none;
}

.auth-hero > *,
.setup-intro > * {
  position: relative;
  z-index: 1;
}

.auth-hero .brand-lockup span,
.setup-intro .brand-lockup span,
.auth-hero p,
.setup-intro p {
  color: rgba(255, 255, 255, 0.76);
}

.auth-hero .brand-icon,
.setup-intro .brand-icon {
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: none;
}

.hero-copy {
  max-width: 620px;
}

.eyebrow {
  width: max-content;
  padding: 8px 12px;
  margin-bottom: 18px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: rgba(255, 255, 255, 0.86);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.auth-hero h1,
.setup-intro h1 {
  margin: 0 0 18px;
  font-size: clamp(36px, 5vw, 68px);
  line-height: 0.95;
  letter-spacing: -0.07em;
}

.setup-intro h1 {
  font-size: clamp(34px, 4vw, 58px);
}

.auth-hero p,
.setup-intro p {
  max-width: 560px;
  margin-bottom: 0;
  font-size: 17px;
}

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

.hero-grid div,
.setup-list span {
  padding: 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.hero-grid b,
.hero-grid span {
  display: block;
}

.hero-grid b {
  margin-bottom: 5px;
  color: #fff;
}

.hero-grid span {
  color: rgba(255, 255, 255, 0.68);
  font-size: 13px;
  font-weight: 750;
}

.setup-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.setup-list span {
  color: #fff;
  font-weight: 850;
}

.auth-panel {
  align-self: center;
  padding: 32px;
  border-radius: 32px;
}

.setup-panel {
  align-self: stretch;
}

.mobile-brand {
  display: none;
  margin-bottom: 24px;
}

.panel-head {
  margin-bottom: 22px;
}

.panel-head h2 {
  margin: 16px 0 8px;
  font-size: 34px;
  line-height: 1.06;
  letter-spacing: -0.055em;
}

.panel-head p {
  margin-bottom: 0;
}

.locked-card {
  padding: 22px;
  margin: 18px 0;
  border-radius: 20px;
  background: #f8fafc;
  border: 1px solid var(--line);
  text-align: center;
}

.lock-icon {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  margin: 0 auto 14px;
  border-radius: 18px;
  color: #fff;
  background: linear-gradient(135deg, #059669, #10b981);
  font-weight: 950;
}

.locked-card h3 {
  margin: 0 0 8px;
}

.locked-card p {
  margin-bottom: 0;
}

/* Dashboard */
.app-body {
  background: linear-gradient(135deg, #f8fafc 0%, #eef2ff 100%);
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 292px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 22px;
  color: #dbeafe;
  background: linear-gradient(180deg, #0f172a 0%, #111827 72%, #1e1b4b 100%);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-brand {
  padding: 8px 6px 26px;
}

.sidebar .brand-lockup strong {
  color: #fff;
}

.sidebar .brand-lockup span {
  color: #93a4c7;
}

.side-nav {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.side-nav a,
.ghost-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 46px;
  padding: 12px 14px;
  border-radius: 15px;
  color: #cbd5e1;
  background: transparent;
  font-weight: 850;
}

.side-nav a span {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.08);
}

.side-nav a:hover,
.side-nav a.active,
.ghost-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.10);
}

.sidebar-foot {
  margin-top: auto;
  display: grid;
  gap: 12px;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.user-chip > span {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 14px;
  color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  font-weight: 950;
}

.user-chip b,
.user-chip small {
  display: block;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-chip b {
  color: #fff;
  font-size: 13px;
}

.user-chip small {
  color: #93a4c7;
}

.ghost-btn {
  justify-content: center;
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.10);
}

.workspace {
  min-width: 0;
  padding: 30px;
}

.workspace-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 22px;
  margin-bottom: 22px;
}

.workspace-head h1 {
  margin: 12px 0 8px;
  font-size: clamp(34px, 4vw, 54px);
  line-height: 0.95;
  letter-spacing: -0.065em;
}

.workspace-head p {
  max-width: 680px;
  margin: 0;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}

.stat-card {
  min-height: 118px;
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 18px;
  border-radius: 24px;
}

.stat-wide {
  grid-column: span 1;
}

.stat-icon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 17px;
  color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  box-shadow: 0 14px 26px rgba(109, 93, 252, 0.24);
  font-weight: 950;
}

.stat-card b {
  display: block;
  margin-bottom: 4px;
  color: var(--text);
  font-size: 25px;
  line-height: 1.05;
  letter-spacing: -0.045em;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stat-card small {
  color: var(--muted);
  font-weight: 800;
}

.content-card {
  border-radius: 28px;
  padding: 22px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

.section-head h2 {
  margin: 0 0 5px;
  font-size: 24px;
  letter-spacing: -0.045em;
}

.section-head p {
  margin: 0;
}

.search-box {
  min-width: min(340px, 100%);
  position: relative;
}

.search-box span {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--subtle);
  font-weight: 900;
}

.search-box input {
  padding-left: 40px;
  background: #f8fafc;
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(286px, 1fr));
  gap: 16px;
}

.project-card {
  display: flex;
  min-height: 280px;
  flex-direction: column;
  padding: 20px;
  border-radius: 24px;
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.project-card:hover {
  transform: translateY(-3px);
  border-color: rgba(109, 93, 252, 0.35);
  box-shadow: 0 24px 54px rgba(15, 23, 42, 0.12);
}

.project-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.project-icon {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 17px;
  color: #fff;
  background: linear-gradient(135deg, #0f172a, #4f46e5);
  font-weight: 950;
  box-shadow: 0 14px 25px rgba(15, 23, 42, 0.16);
}

.project-card h3 {
  margin: 0 0 10px;
  font-size: 22px;
  letter-spacing: -0.045em;
}

.project-card p {
  display: -webkit-box;
  min-height: 52px;
  margin-bottom: 16px;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.project-meta {
  margin-top: auto;
  color: var(--subtle);
  font-size: 12px;
  font-weight: 800;
}

.project-actions {
  display: flex;
  margin-top: 16px;
}

.project-actions .btn {
  width: 100%;
}

.empty-state,
.canvas-empty {
  text-align: center;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 390px;
  padding: 40px 20px;
  border-radius: 24px;
  background: linear-gradient(135deg, #f8fafc, #eef2ff);
  border: 1px dashed #cbd5e1;
}

.empty-state h2,
.canvas-empty h2 {
  margin: 12px 0 8px;
  letter-spacing: -0.045em;
}

.empty-state p,
.canvas-empty p {
  max-width: 440px;
  margin-left: auto;
  margin-right: auto;
}

.empty-art {
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  margin: 0 auto;
  border-radius: 24px;
  color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  box-shadow: 0 18px 34px rgba(109, 93, 252, 0.25);
  font-size: 32px;
  font-weight: 950;
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.52);
  backdrop-filter: blur(10px);
}

.modal.show {
  display: flex;
}

.modal-card {
  width: min(560px, 96vw);
  max-height: 92vh;
  overflow: auto;
  padding: 26px;
  border-radius: 28px;
  background: #fff;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.modal-card h2 {
  margin: 18px 0 8px;
  font-size: 30px;
  letter-spacing: -0.055em;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.icon-btn {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  color: #334155;
  background: #f1f5f9;
  font-size: 22px;
  font-weight: 800;
}

/* Editor */
.editor {
  height: 100vh;
  overflow: hidden;
  background: #0f172a;
}

.editor-shell {
  height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
}

.editor-top {
  position: relative;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 82px;
  padding: 14px 18px;
  color: #fff;
  background: rgba(15, 23, 42, 0.92);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 18px 36px rgba(15, 23, 42, 0.22);
  backdrop-filter: blur(18px);
}

.editor-titlebar {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 14px;
}

.back-link {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 16px;
  color: #fff;
  background: rgba(255, 255, 255, 0.10);
  border: 1px solid rgba(255, 255, 255, 0.10);
  font-size: 24px;
  font-weight: 900;
}

.back-link:hover {
  background: rgba(255, 255, 255, 0.16);
}

.board-title {
  min-width: 0;
}

.board-title h1 {
  max-width: min(640px, 52vw);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin: 6px 0 0;
  font-size: 21px;
  letter-spacing: -0.04em;
}

.board-title .pill {
  color: #dbeafe;
  background: rgba(255, 255, 255, 0.10);
  border-color: rgba(255, 255, 255, 0.10);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  color: #a5b4fc;
  font-size: 12px;
  font-weight: 850;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.14);
}

.editor-actions,
.editor-main,
.helperbar,
.helper-left,
.helper-right,
.zoom-group {
  display: flex;
  align-items: center;
}

.editor-actions {
  gap: 10px;
}

.editor-actions .btn,
.editor-actions .uploadBtn {
  min-height: 43px;
}

.editor-body {
  min-height: 0;
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr);
}

.tool-rail {
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
  background: #111827;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  overflow-y: auto;
}

.rail-group {
  display: grid;
  gap: 9px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.rail-group:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.tool-btn {
  min-height: 66px;
  display: grid;
  place-items: center;
  gap: 4px;
  padding: 9px 7px;
  border-radius: 18px;
  color: #dbeafe;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.tool-btn span {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  font-size: 15px;
}

.tool-btn b {
  font-size: 11px;
  line-height: 1;
}

.tool-btn:hover,
.tool-btn.active,
.tool-btn.primary {
  color: #fff;
  background: linear-gradient(135deg, rgba(109, 93, 252, 0.95), rgba(155, 92, 246, 0.95));
  box-shadow: 0 16px 28px rgba(79, 70, 229, 0.24);
}

.tool-btn.danger {
  color: #fecdd3;
}

.tool-btn.danger:hover {
  background: linear-gradient(135deg, #be123c, #e11d48);
  color: #fff;
}

.tool-btn.compact {
  min-height: 42px;
  font-size: 22px;
  font-weight: 950;
}

.zoom-group {
  display: grid;
}

.zoom-readout {
  min-height: 34px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: #cbd5e1;
  background: rgba(255, 255, 255, 0.05);
  font-size: 12px;
  font-weight: 900;
}

.editor-main {
  min-width: 0;
  min-height: 0;
  align-items: stretch;
  flex-direction: column;
  background: #f8fafc;
}

.helperbar {
  min-height: 48px;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--line);
  color: #475569;
  backdrop-filter: blur(14px);
  font-size: 12px;
  font-weight: 850;
}

.helper-left,
.helper-right {
  gap: 8px;
  flex-wrap: wrap;
}

.helper-left span,
.helper-right span {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 5px 9px;
  border-radius: 999px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
}

kbd {
  min-width: 25px;
  height: 24px;
  display: inline-grid;
  place-items: center;
  padding: 0 7px;
  border-radius: 7px;
  color: #334155;
  background: #fff;
  border: 1px solid #cbd5e1;
  box-shadow: 0 2px 0 #cbd5e1;
  font-size: 11px;
  font-weight: 900;
}

.canvas-wrap {
  position: relative;
  height: calc(100vh - 130px);
  overflow: auto;
  background-color: #f6f8fc;
  background-image:
    radial-gradient(circle, rgba(15, 23, 42, 0.13) 1px, transparent 1px),
    linear-gradient(rgba(15, 23, 42, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15, 23, 42, 0.045) 1px, transparent 1px);
  background-size: 18px 18px, 72px 72px, 72px 72px;
  background-position: 0 0, 0 0, 0 0;
}

.canvas-wrap.drag-over {
  background-color: #eef2ff;
}

.drop-hint {
  position: fixed;
  left: calc(104px + 50%);
  top: 50%;
  z-index: 30;
  display: none;
  transform: translate(-50%, -50%);
  padding: 16px 20px;
  border-radius: 18px;
  color: #fff;
  background: rgba(15, 23, 42, 0.86);
  box-shadow: var(--shadow);
  font-weight: 900;
  pointer-events: none;
}

.canvas-wrap.drag-over .drop-hint {
  display: block;
}

#canvas {
  position: relative;
  width: 4200px;
  height: 2800px;
  transform-origin: 0 0;
}

#svg {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 4200px;
  height: 2800px;
  overflow: visible;
  pointer-events: none;
}

#svg path.connector {
  fill: none;
  stroke: var(--brand);
  stroke-width: 4.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 8px 10px rgba(109, 93, 252, 0.16));
  cursor: pointer;
  pointer-events: stroke;
}

#svg path.connector.selected-line {
  stroke: #0f172a;
  stroke-width: 7;
  filter: drop-shadow(0 10px 14px rgba(15, 23, 42, 0.22));
}

.item,
.note {
  position: absolute;
  z-index: 3;
  cursor: move;
  overflow: hidden;
  border-radius: 0px;
  border: 1px solid rgba(203, 213, 225, 0.9);
  box-shadow: 0 22px 52px rgba(15, 23, 42, 0.18);
  transition: box-shadow 0.14s ease, outline-color 0.14s ease, transform 0.14s ease;
}

.item {
  background: #fff;
}

.item::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 6px;
  background: linear-gradient(90deg, var(--brand), var(--brand-3));
  opacity: 0;
  transition: opacity 0.14s ease;
  z-index: 2;
}

.item:hover,
.note:hover {
  box-shadow: 0 30px 70px rgba(15, 23, 42, 0.22);
}

.item.selected,
.note.selected {
  outline: 4px solid rgba(109, 93, 252, 0.30);
  box-shadow: 0 34px 78px rgba(79, 70, 229, 0.26);
}

.item.selected::before {
  opacity: 1;
}

.item.line-start,
.note.line-start {
  outline: 4px solid rgba(6, 182, 212, 0.42);
}

.item img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  pointer-events: none;
  background: #fff;
}

.resizer {
  position: absolute;
  right: 8px;
  bottom: 8px;
  z-index: 8;
  width: 20px;
  height: 20px;
  border-radius: 0px;
  cursor: nwse-resize;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  border: 3px solid #fff;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.25);
}

.note {
  min-width: 130px;
  min-height: 92px;
  padding: 16px;
  background: linear-gradient(135deg, #fff8dc, #fff3bf);
  border-color: #fde68a;
}

.note::before {
  content: "Note";
  position: absolute;
  top: 10px;
  right: 12px;
  color: rgba(146, 64, 14, 0.55);
  font-size: 10px;
  font-weight: 950;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  pointer-events: none;
}

.note textarea {
  height: calc(100% - 6px);
  min-height: calc(100% - 6px);
  padding: 0 54px 0 0;
  color: #713f12;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  resize: none;
  font-weight: 750;
  line-height: 1.5;
}

.note textarea:focus {
  box-shadow: none;
}

.canvas-empty {
  position: absolute;
  left: 520px;
  top: 280px;
  z-index: 1;
  width: 460px;
  padding: 34px;
  border-radius: 30px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(226, 232, 240, 0.9);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(18px);
}

.canvas-empty.is-hidden {
  display: none;
}

.upload-panel {
  position: fixed;
  right: 22px;
  top: 98px;
  z-index: 70;
  display: none;
  width: min(360px, calc(100vw - 36px));
  padding: 17px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(226, 232, 240, 0.9);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.upload-panel.show {
  display: block;
}

.up-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.up-head b {
  font-size: 14px;
}

.up-head span {
  color: var(--brand);
  font-weight: 950;
}

.progress {
  height: 11px;
  overflow: hidden;
  border-radius: 999px;
  background: #e2e8f0;
}

.progress div {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand), var(--brand-2), var(--brand-3));
  transition: width 0.2s ease;
}

/* Responsive */
@media (max-width: 1180px) {
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .auth-shell,
  .setup-shell {
    grid-template-columns: 1fr;
  }

  .auth-hero,
  .setup-intro {
    min-height: auto;
    gap: 40px;
  }
}

@media (max-width: 900px) {
  .auth {
    padding: 16px;
  }

  .auth-hero,
  .setup-intro {
    display: none;
  }

  .auth-panel {
    padding: 24px;
  }

  .mobile-brand {
    display: inline-flex;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: relative;
    height: auto;
    padding: 14px;
  }

  .side-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .sidebar-foot {
    margin-top: 16px;
  }

  .workspace {
    padding: 18px;
  }

  .workspace-head,
  .section-head {
    flex-direction: column;
    align-items: stretch;
  }

  .search-box {
    min-width: 0;
  }

  .editor {
    overflow: auto;
  }

  .editor-shell {
    min-height: 100vh;
    height: auto;
  }

  .editor-top {
    align-items: stretch;
    flex-direction: column;
  }

  .board-title h1 {
    max-width: 100%;
  }

  .editor-actions {
    width: 100%;
  }

  .editor-actions .btn,
  .editor-actions .uploadBtn {
    flex: 1;
  }

  .editor-body {
    grid-template-columns: 1fr;
  }

  .tool-rail {
    flex-direction: row;
    overflow-x: auto;
    border-right: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  }

  .rail-group {
    display: flex;
    min-width: max-content;
    border-bottom: 0;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    padding: 0 12px 0 0;
  }

  .tool-btn {
    width: 78px;
  }

  .helperbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .canvas-wrap {
    height: calc(100vh - 285px);
  }

  .drop-hint {
    left: 50%;
  }
}

@media (max-width: 640px) {
  .form-grid.two,
  .stats-grid,
  .hero-grid {
    grid-template-columns: 1fr;
  }

  .panel-head h2 {
    font-size: 28px;
  }

  .workspace-head h1 {
    font-size: 38px;
  }

  .project-grid {
    grid-template-columns: 1fr;
  }

  .modal-actions {
    flex-direction: column-reverse;
  }

  .modal-actions .btn {
    width: 100%;
  }
}
