@import url('https://fonts.googleapis.com/css2?family=DM+Mono:wght@400;500&family=DM+Sans:wght@400;500;600;700&display=swap');

:root {
  --ink: #202428;
  --muted: #7b8589;
  --line: #e3e7e4;
  --paper: #f7f8f5;
  --panel: #ffffff;
  --mint: #d6f6e7;
  --mint-strong: #2a9d72;
  --coral: #f5796d;
  --shadow: 0 14px 45px rgba(61, 78, 73, .11), 0 2px 8px rgba(61, 78, 73, .07);
  font-family: 'DM Sans', ui-sans-serif, system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { overflow: hidden; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }

.app-shell { height: 100%; display: flex; flex-direction: column; background: var(--paper); }
.topbar, .bottombar { flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; padding: 14px 22px; background: rgba(255,255,255,.88); backdrop-filter: blur(16px); border-bottom: 1px solid var(--line); z-index: 20; }
.bottombar { border-top: 1px solid var(--line); border-bottom: 0; padding: 9px 22px; color: var(--muted); font-size: 12px; }
.brand-lockup, .presence-area { display: flex; align-items: center; gap: 11px; }
.brand-mark { width: 31px; height: 31px; display: grid; place-items: center; color: #fff; background: var(--ink); border-radius: 10px; box-shadow: 0 4px 12px rgba(32,36,40,.17); font-size: 17px; }
.brand-name { font-size: 15px; line-height: 1; font-weight: 700; letter-spacing: -.02em; }
.room-caption { margin-top: 4px; font-size: 10px; color: var(--muted); font-family: 'DM Mono', monospace; letter-spacing: .04em; text-transform: uppercase; }
.presence-area { gap: 14px; }
.presence-list { display: flex; align-items: center; min-height: 28px; }
.person-dot { width: 27px; height: 27px; margin-left: -5px; display: grid; place-items: center; border: 2px solid #fff; border-radius: 50%; color: #fff; font-size: 10px; font-weight: 700; box-shadow: 0 1px 4px rgba(0,0,0,.12); }
.person-dot:first-child { margin-left: 0; }
.presence-more { margin-left: 5px; color: var(--muted); font-size: 11px; }
.connection-status { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 11px; }
.connection-status::before { content: ''; width: 7px; height: 7px; display: inline-block; border-radius: 50%; background: #c8d0cc; }
.connection-status.status-online { color: var(--mint-strong); }
.connection-status.status-online::before { background: var(--mint-strong); box-shadow: 0 0 0 3px rgba(42,157,114,.12); }
.connection-status.status-saving::before { background: #e0a84f; }
.connection-status.status-reconnecting::before { background: var(--coral); }
.share-button, .dialog-submit { border: 0; border-radius: 9px; padding: 9px 13px; color: #fff; background: var(--ink); font-size: 12px; font-weight: 700; box-shadow: 0 3px 8px rgba(32,36,40,.14); transition: transform .15s ease, background .15s ease; }
.share-button:hover, .dialog-submit:hover { background: #363d40; transform: translateY(-1px); }
.share-button span { margin-right: 4px; color: var(--mint); }

.workspace { position: relative; display: flex; min-height: 0; flex: 1; }
.tool-rail { width: 78px; flex: 0 0 78px; display: flex; align-items: center; flex-direction: column; gap: 7px; padding: 16px 9px; background: rgba(255,255,255,.9); border-right: 1px solid var(--line); z-index: 10; }
.tool-button { width: 59px; min-height: 48px; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 2px; border: 1px solid transparent; border-radius: 11px; color: #697378; background: transparent; font-size: 20px; line-height: 1; transition: background .15s ease, color .15s ease, border .15s ease; }
.tool-button small { font-size: 9px; font-weight: 600; color: var(--muted); }
.tool-button:hover { color: var(--ink); background: #f0f3ef; border-color: var(--line); }
.tool-button.primary { color: var(--mint-strong); background: var(--mint); border-color: #c1ecd8; font-size: 22px; }
.tool-button.primary small { color: #247b5a; }
.tool-divider { width: 34px; height: 1px; margin: 5px 0; background: var(--line); }
.zoom-readout { min-width: 49px; padding: 2px 0; color: var(--muted); font-family: 'DM Mono', monospace; font-size: 10px; text-align: center; }
.help-tip { position: relative; width: 28px; height: 28px; margin-top: auto; display: grid; place-items: center; color: #9aa3a2; border: 1px solid var(--line); border-radius: 50%; font-size: 12px; }
.help-popover { position: absolute; left: 35px; bottom: -2px; width: 156px; padding: 10px 11px; display: none; color: #697378; background: #fff; border: 1px solid var(--line); border-radius: 9px; box-shadow: var(--shadow); font-size: 11px; line-height: 1.8; }
.help-tip:hover .help-popover { display: block; }
.board-frame { position: relative; min-width: 0; min-height: 0; flex: 1; overflow: hidden; background-color: #f5f7f3; background-image: radial-gradient(#d6ddd8 1px, transparent 1px); background-size: 22px 22px; touch-action: none; }
.board-frame.is-panning { cursor: grabbing; }
.board-world { position: absolute; inset: 0; transform-origin: 0 0; }
.cursor-overlay { position: absolute; inset: 0; pointer-events: none; z-index: 8; }
.remote-cursor { position: absolute; width: 0; height: 0; will-change: transform; transition: opacity .25s ease; }
.remote-arrow { position: absolute; left: 0; top: 0; width: 0; height: 0; border-top: 15px solid var(--cursor-color, #7a7); border-right: 7px solid transparent; transform: rotate(-17deg); filter: drop-shadow(0 1px 1px rgba(0,0,0,.18)); }
.remote-label { position: absolute; left: 9px; top: 17px; max-width: 120px; padding: 4px 7px; overflow: hidden; color: #fff; background: var(--cursor-color, #777); border-radius: 5px 7px 7px 2px; font-size: 10px; font-weight: 700; line-height: 1; white-space: nowrap; text-overflow: ellipsis; box-shadow: 0 2px 5px rgba(0,0,0,.12); }
.text-card { position: absolute; width: 230px; min-height: 93px; padding: 17px 17px 15px; color: var(--ink); background: #fffef9; border: 1px solid #e9e6d7; border-radius: 12px; box-shadow: 0 7px 20px rgba(90, 90, 61, .09); transform-origin: top left; user-select: none; transition: box-shadow .16s ease, border .16s ease; }
.text-card:hover { box-shadow: 0 12px 24px rgba(90, 90, 61, .13); }
.text-card.selected { border-color: #93d9ba; box-shadow: 0 0 0 3px rgba(88,190,145,.16), 0 12px 26px rgba(90, 90, 61, .12); }
.text-card.remote-locked { border-color: #eab2aa; }
.text-card .card-grip { position: absolute; left: 12px; top: 9px; width: 25px; height: 5px; cursor: grab; opacity: 0; border-radius: 4px; background: #c8cec7; transition: opacity .15s ease; }
.text-card:hover .card-grip, .text-card.selected .card-grip { opacity: 1; }
.text-card .card-text { min-height: 45px; color: #424b4a; font-size: 14px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.text-card .card-text.empty { color: #a9b0ad; font-style: italic; }
.text-card textarea { display: block; width: 100%; min-height: 55px; padding: 0; resize: none; border: 0; outline: 0; color: #424b4a; background: transparent; font-size: 14px; line-height: 1.45; }
.card-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 12px; color: #b0b6b0; font-family: 'DM Mono', monospace; font-size: 9px; }
.card-status { color: #c58b55; }
.card-status.saved { color: #62aa87; }
.card-actions { display: flex; gap: 4px; opacity: 0; transition: opacity .15s ease; }
.text-card:hover .card-actions, .text-card.selected .card-actions { opacity: 1; }
.card-action { padding: 2px 4px; border: 0; color: #8c9691; background: transparent; font-size: 11px; }
.card-action:hover { color: var(--ink); }
.lease-pill { position: absolute; top: -11px; right: 11px; padding: 4px 7px; color: #fff; background: #d78b80; border-radius: 5px; font-size: 9px; font-weight: 700; box-shadow: 0 2px 5px rgba(140,73,64,.15); }
.empty-state { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; pointer-events: none; text-align: center; }
.empty-state.hidden { display: none; }
.empty-orbit { width: 44px; height: 44px; display: grid; place-items: center; color: #5caf88; background: var(--mint); border-radius: 15px; font-size: 23px; }
.empty-state h1 { margin: 14px 0 3px; font-size: 19px; letter-spacing: -.03em; }
.empty-state p { margin: 0; color: var(--muted); font-size: 12px; }
.empty-action { pointer-events: auto; margin-top: 17px; padding: 9px 13px; border: 1px solid #caead9; border-radius: 8px; color: #2e815f; background: #effaf4; font-size: 12px; font-weight: 700; }
.empty-action:hover { background: var(--mint); }
.toast-stack { position: absolute; right: 22px; bottom: 20px; z-index: 30; display: flex; align-items: flex-end; flex-direction: column; gap: 8px; }
.toast { max-width: 300px; padding: 10px 12px; color: #fff; background: #2b3233; border-radius: 8px; box-shadow: var(--shadow); font-size: 11px; animation: toast-in .2s ease-out; }
.toast.warning { background: #ad645a; }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.privacy-note { display: flex; align-items: center; gap: 7px; }
.status-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--mint-strong); }
.board-hint { font-family: 'DM Mono', monospace; font-size: 10px; }
kbd { padding: 2px 4px; border: 1px solid #d5dbd7; border-bottom-width: 2px; border-radius: 4px; background: #fff; font-size: 9px; }
.name-dialog { width: min(390px, calc(100% - 32px)); padding: 0; border: 0; border-radius: 16px; box-shadow: 0 20px 70px rgba(32,45,41,.2); color: var(--ink); }
.name-dialog::backdrop { background: rgba(31,42,39,.25); backdrop-filter: blur(3px); }
.name-dialog form { padding: 28px; }
.dialog-kicker { color: var(--mint-strong); font-family: 'DM Mono', monospace; font-size: 10px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; }
.name-dialog h2 { margin: 9px 0 5px; font-size: 23px; letter-spacing: -.04em; }
.name-dialog p { margin: 0 0 22px; color: var(--muted); font-size: 13px; }
.name-dialog label { display: block; margin-bottom: 6px; color: #707a76; font-size: 11px; font-weight: 700; }
.name-dialog input { width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 8px; outline: 0; color: var(--ink); background: #fafcf9; font-size: 14px; }
.name-dialog input:focus { border-color: #7fc8a5; box-shadow: 0 0 0 3px rgba(88,190,145,.15); }
.dialog-submit { width: 100%; margin-top: 17px; padding: 11px 13px; text-align: left; }
.dialog-submit span { float: right; color: var(--mint); }

@media (max-width: 680px) {
  .topbar { padding: 11px 13px; }
  .tool-rail { width: 61px; flex-basis: 61px; padding-left: 3px; padding-right: 3px; }
  .tool-button { width: 53px; }
  .room-caption, .connection-status { display: none; }
  .presence-area { gap: 7px; }
  .bottombar { padding: 8px 13px; }
  .board-hint { display: none; }
}
