:root {
  color-scheme: light;
  --ink: #242927;
  --muted: #7b827f;
  --line: #e5e8e5;
  --paper: #fff;
  --page: #f7f8f7;
  --accent: #186b55;
  --accent-strong: #105340;
  --accent-soft: #e7f3ee;
  --shadow: 0 8px 30px rgba(29, 45, 38, .10);
  font-family: 'DM Sans', Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--ink);
  background: var(--page);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }
html, body, #app { width: 100%; height: 100%; margin: 0; }
body { min-width: 320px; overflow: hidden; }
button, input, textarea { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, textarea:focus-visible { outline: 3px solid rgba(24, 107, 85, .23); outline-offset: 2px; }
.boot { height: 100%; display: grid; place-content: center; justify-items: center; gap: 14px; color: var(--muted); font-size: 14px; }
.brand-mark { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 11px; color: white; background: var(--accent); font-family: Manrope, sans-serif; font-size: 18px; font-weight: 800; }

.app-shell { height: 100%; min-height: 0; display: grid; grid-template-rows: 64px minmax(0, 1fr); }
.topbar { position: relative; z-index: 3; display: flex; align-items: center; gap: 18px; padding: 0 20px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.96); }
.brand { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; padding-right: 17px; border-right: 1px solid var(--line); }
.brand-word { font-family: Manrope, sans-serif; font-weight: 800; font-size: 17px; letter-spacing: 0; }
.board-title-wrap { min-width: 80px; max-width: min(440px, 40vw); flex: 1; }
.board-title { display: block; width: 100%; min-width: 0; padding: 7px 9px; border: 1px solid transparent; border-radius: 7px; background: transparent; color: var(--ink); font-size: 14px; font-weight: 600; }
.board-title:hover, .board-title:focus { border-color: var(--line); background: #fbfcfb; }
.new-board-button { min-width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center; gap: 5px; padding: 0 9px; border: 1px solid var(--line); border-radius: 7px; background: white; color: #68726c; cursor: pointer; font-size: 12px; font-weight: 600; }
.new-board-button:hover { background: #f5f8f6; color: var(--accent-strong); }
.new-board-button > span:first-child { font-size: 18px; line-height: 1; }
.top-spacer { flex: 1; }
.connection { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.connection-dot { width: 7px; height: 7px; border-radius: 50%; background: #c28a34; }
.connection.is-connected .connection-dot { background: #36a179; box-shadow: 0 0 0 3px #e7f3ee; }
.connection.is-offline .connection-dot { background: #d3534d; }
.people { display: flex; align-items: center; padding-left: 2px; }
.person { width: 29px; height: 29px; margin-left: -5px; display: grid; place-items: center; border: 2px solid white; border-radius: 50%; background: #186b55; color: white; font-size: 10px; font-weight: 700; box-shadow: 0 1px 3px #17251d22; }
.person:first-child { margin-left: 0; }
.person[data-color="#252b28"], .color-swatch[data-color="#252b28"] { background-color: #252b28; }
.person[data-color="#186b55"], .color-swatch[data-color="#186b55"] { background-color: #186b55; }
.person[data-color="#3777c8"], .color-swatch[data-color="#3777c8"] { background-color: #3777c8; }
.person[data-color="#a54bce"], .color-swatch[data-color="#a54bce"] { background-color: #a54bce; }
.person[data-color="#d84e5b"], .color-swatch[data-color="#d84e5b"] { background-color: #d84e5b; }
.person[data-color="#e49a35"], .color-swatch[data-color="#e49a35"] { background-color: #e49a35; }
.person[data-color="#e4cf55"], .color-swatch[data-color="#e4cf55"] { background-color: #e4cf55; }
.person[data-color="#ffffff"], .color-swatch[data-color="#ffffff"] { background-color: #ffffff; }
.person-more { background: #747d77; }
.share-button { min-height: 36px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 0 13px; border: 0; border-radius: 7px; background: var(--accent); color: #fff; font-size: 13px; font-weight: 600; cursor: pointer; transition: background .15s ease, transform .15s ease; }
.share-button:hover { background: var(--accent-strong); transform: translateY(-1px); }
.mobile-inspector-toggle { display: none; }

.workspace { min-height: 0; display: grid; grid-template-columns: 58px minmax(0, 1fr) 270px; }
.tool-rail { z-index: 2; display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 12px 7px; border-right: 1px solid var(--line); background: white; }
.tool-button { width: 42px; height: 42px; display: grid; place-items: center; padding: 0; border: 1px solid transparent; border-radius: 8px; background: transparent; color: #626a66; cursor: pointer; font-size: 19px; transition: color .12s ease, background .12s ease, border .12s ease; }
.tool-button:hover { background: #f3f6f4; color: var(--ink); }
.tool-button.active { border-color: #d7e7df; background: var(--accent-soft); color: var(--accent-strong); }
.tool-button .tool-glyph { line-height: 1; }
.rail-divider { width: 28px; height: 1px; margin: 7px 0; background: var(--line); }
.rail-spacer { flex: 1; }
.tool-tip { position: absolute; left: 51px; z-index: 8; pointer-events: none; padding: 5px 8px; border-radius: 5px; background: #26302b; color: white; font-size: 11px; opacity: 0; transform: translateX(-3px); transition: opacity .12s ease; white-space: nowrap; }
.tool-wrap { position: relative; }
.tool-wrap:hover .tool-tip { opacity: 1; }

.canvas-shell { position: relative; min-width: 0; min-height: 0; overflow: hidden; background-color: #f5f7f5; background-image: radial-gradient(#dce2de 0.85px, transparent .85px); background-position: 10px 10px; background-size: 22px 22px; }
.board-svg { width: 100%; height: 100%; display: block; touch-action: none; user-select: none; }
.board-svg.tool-text { cursor: text; }
.board-svg.tool-rect, .board-svg.tool-ellipse { cursor: crosshair; }
.board-svg.tool-arrow { cursor: crosshair; }
.board-svg.tool-select { cursor: default; }
.board-svg.is-panning { cursor: grabbing; }
.canvas-coordinates { position: absolute; right: 14px; bottom: 13px; padding: 5px 8px; border-radius: 5px; background: rgba(255,255,255,.72); color: #8a918d; font-size: 10px; pointer-events: none; }
.zoom-controls { position: absolute; left: 15px; bottom: 14px; display: flex; align-items: center; overflow: hidden; border: 1px solid #e2e7e3; border-radius: 8px; background: rgba(255,255,255,.96); box-shadow: 0 2px 8px #1c302510; }
.zoom-controls button { width: 34px; height: 32px; border: 0; background: transparent; color: #5e6661; cursor: pointer; font-size: 18px; }
.zoom-controls button:hover { background: #f0f4f1; }
.zoom-level { min-width: 48px; color: #717a74; text-align: center; font-size: 11px; }
.empty-hint { color: #a3aaa6; font-family: Manrope, sans-serif; font-size: 17px; font-weight: 600; text-anchor: middle; pointer-events: none; }
.empty-subhint { fill: #adb4b0; font-family: 'DM Sans', sans-serif; font-size: 12px; font-weight: 400; text-anchor: middle; pointer-events: none; }
.object-text { font-family: 'DM Sans', sans-serif; font-weight: 500; pointer-events: none; }
.shape { vector-effect: non-scaling-stroke; }
.selected-outline { fill: none; stroke: #238263; stroke-width: 1.2; stroke-dasharray: 5 4; vector-effect: non-scaling-stroke; pointer-events: none; }
.arrow-line { fill: none; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.collab-cursor { pointer-events: none; }
.collab-label { font: 600 11px 'DM Sans', sans-serif; fill: white; }

.inspector { min-height: 0; overflow: auto; border-left: 1px solid var(--line); background: white; }
.inspector-header { padding: 22px 20px 16px; border-bottom: 1px solid #edf0ed; }
.inspector-eyebrow { margin: 0 0 4px; color: #919993; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0; }
.inspector-title { margin: 0; font-family: Manrope, sans-serif; font-size: 16px; font-weight: 700; }
.inspector-content { padding: 18px 18px 28px; }
.inspector-empty { padding: 13px 12px; border: 1px dashed #dfe5e1; border-radius: 7px; color: #7e8882; font-size: 12px; line-height: 1.55; }
.section-label { display: block; margin: 20px 0 9px; color: #606963; font-size: 11px; font-weight: 700; }
.section-label:first-child { margin-top: 0; }
.field { width: 100%; min-height: 36px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--ink); font-size: 12px; }
.text-field { min-height: 112px; resize: vertical; line-height: 1.5; }
.color-palette { display: flex; flex-wrap: wrap; gap: 8px; }
.color-swatch { width: 25px; height: 25px; padding: 0; border: 2px solid white; border-radius: 50%; background: #186b55; box-shadow: 0 0 0 1px #dfe4e1; cursor: pointer; }
.color-swatch:hover { transform: scale(1.08); }
.color-swatch.active { box-shadow: 0 0 0 2px var(--accent); }
.color-swatch[aria-label="White"] { box-shadow: 0 0 0 1px #dfe4e1, inset 0 0 0 1px #f2f4f2; }
.range-line { display: flex; align-items: center; gap: 10px; }
.range-line input[type="range"] { width: 100%; accent-color: var(--accent); }
.range-value { min-width: 37px; color: #707872; text-align: right; font-size: 11px; }
.inspector-foot { padding-top: 16px; border-top: 1px solid #edf0ed; color: #98a09b; font-size: 10px; line-height: 1.55; }
.delete-button { width: 100%; min-height: 35px; margin-top: 20px; border: 1px solid #efdddb; border-radius: 6px; background: white; color: #b44e47; cursor: pointer; font-size: 12px; font-weight: 600; }
.delete-button:hover { background: #fff6f5; }

.share-overlay { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 20px; background: rgba(26, 36, 31, .30); backdrop-filter: blur(2px); }
.share-dialog { width: min(420px, 100%); padding: 23px; border: 1px solid #e6eae7; border-radius: 12px; background: white; box-shadow: var(--shadow); }
.share-dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; }
.share-dialog h2 { margin: 0; font-family: Manrope, sans-serif; font-size: 18px; }
.share-dialog p { margin: 8px 0 19px; color: #6f7872; font-size: 12px; line-height: 1.5; }
.icon-close { width: 30px; height: 30px; border: 0; border-radius: 6px; background: transparent; color: #7b827d; cursor: pointer; font-size: 19px; }
.icon-close:hover { background: #f2f4f2; }
.share-link-row { display: flex; gap: 8px; }
.share-link-input { min-width: 0; flex: 1; padding: 9px 10px; border: 1px solid var(--line); border-radius: 6px; color: #4e5852; font-size: 11px; }
.copy-button { min-width: 80px; border: 0; border-radius: 6px; background: var(--accent); color: white; cursor: pointer; font-size: 12px; font-weight: 600; }
.share-note { display: flex; align-items: center; gap: 8px; margin-top: 17px; padding: 10px; border-radius: 6px; background: #f5f8f6; color: #65716a; font-size: 11px; }
.share-note .lock-icon { color: var(--accent); font-size: 14px; }
.toast { position: fixed; left: 50%; bottom: 57px; z-index: 30; padding: 9px 13px; border-radius: 7px; background: #26322c; color: white; box-shadow: var(--shadow); font-size: 12px; transform: translateX(-50%); animation: toast-in .18s ease-out; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 6px); } to { opacity: 1; transform: translate(-50%, 0); } }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

@media (max-width: 900px) {
  .workspace { grid-template-columns: 54px minmax(0, 1fr) 238px; }
  .inspector-header { padding: 18px 16px 13px; }
  .inspector-content { padding: 16px 15px 23px; }
  .topbar { gap: 12px; padding: 0 13px; }
  .brand { padding-right: 12px; }
  .connection-label { display: none; }
}

@media (max-width: 640px) {
  .app-shell { grid-template-rows: 56px minmax(0, 1fr); }
  .topbar { gap: 9px; padding: 0 10px; }
  .brand { gap: 7px; padding-right: 0; border: 0; }
  .brand-mark { width: 30px; height: 30px; border-radius: 9px; }
  .brand-word { display: none; }
  .board-title-wrap { max-width: unset; }
  .board-title { padding: 7px 5px; font-size: 13px; }
  .new-board-button { width: 34px; flex: 0 0 34px; padding: 0; }
  .new-board-label { display: none; }
  .connection { gap: 0; }
  .connection-dot { width: 8px; height: 8px; }
  .people { display: none; }
  .share-button { width: 38px; min-width: 38px; height: 36px; padding: 0; font-size: 0; }
  .share-button::before { content: '↗'; font-size: 17px; }
  .share-button span { display: none; }
  .mobile-inspector-toggle { width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 7px; background: white; color: #55605a; cursor: pointer; font-size: 17px; }
  .workspace { position: relative; display: block; }
  .canvas-shell { position: absolute; inset: 0; }
  .tool-rail { position: absolute; right: 10px; bottom: max(12px, env(safe-area-inset-bottom)); left: 10px; height: 56px; flex-direction: row; justify-content: center; gap: 5px; padding: 6px; border: 1px solid #e1e7e2; border-radius: 11px; box-shadow: 0 4px 18px #1830251a; }
  .tool-button { width: 42px; height: 42px; flex: 1; max-width: 51px; }
  .tool-tip, .rail-divider, .rail-spacer { display: none; }
  .inspector { position: fixed; right: 10px; bottom: calc(78px + env(safe-area-inset-bottom)); left: 10px; z-index: 10; display: none; max-height: min(52dvh, 430px); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); }
  .inspector.open { display: block; }
  .inspector-header { padding: 13px 15px 10px; }
  .inspector-content { padding: 13px 14px 20px; }
  .inspector-empty { padding: 9px 10px; }
  .section-label { margin-top: 15px; }
  .zoom-controls { left: 12px; bottom: 82px; }
  .canvas-coordinates { right: 12px; bottom: 88px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
