/* Adboard Boards.
 *
 * Dark chrome, light canvas. The top bar carries the brand because that is
 * what a client sees when a board is shared; the canvas stays paper-white
 * because that is what a board has to be to read well on a call and to print.
 * Every floating control over the canvas is light for the same reason.
 *
 * Brand tokens come from brand.css. Anything defined here is either a canvas
 * colour, which the brand has no opinion about, or a measurement.
 */

:root {
  --bar: 52px;
  /* The canvas is deliberately a shade darker than the section panels. White
     frames on a white canvas read as one flat sheet; the small step is what
     makes a section look like a card sitting on a desk, which is the thing
     Miro gets right. */
  --paper: #EFF2F0;
  --paper-line: #DDE4E0;
  --ink: #17201C;
  --ink-2: #4A5551;
  --ink-3: #7D8A84;
  --card: #FFFFFF;
  --lift: 0 1px 2px rgba(20,31,27,.08), 0 8px 24px rgba(20,31,27,.10);
  --lift-lo: 0 1px 2px rgba(20,31,27,.10), 0 2px 8px rgba(20,31,27,.07);
  --pick: #6C5CE7;
  --radius: 12px;
}

/* Every floating panel here sets display, which beats the hidden attribute on
   specificity. Without this, hiding something in JS does nothing at all. */
[hidden] { display: none !important; }

html, body { height: 100%; }
body {
  margin: 0;
  overflow: hidden;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--ui);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
}
/* brand.css paints an aurora on every page. A whiteboard needs plain paper. */
body::before { content: none; }

button, input, select { font: inherit; font-family: var(--ui); }

/* ---- top bar ------------------------------------------------------------ */

.chrome {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 60;
  height: var(--bar);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px 0 14px;
  background: var(--void-2);
  border-bottom: 1px solid rgba(255,255,255,.07);
  color: var(--tx);
}

.brand { display: flex; align-items: center; color: var(--vio); text-decoration: none; }
.brand-mark { display: block; }

.board-pick {
  display: flex; align-items: center; gap: 7px;
  max-width: 340px;
  height: 32px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--tx);
  font-size: 14px; font-weight: 500;
  cursor: pointer;
}
.board-pick:hover { background: rgba(255,255,255,.06); border-color: rgba(255,255,255,.10); }
.board-pick span {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.board-pick svg { flex: none; opacity: .6; }

.board-sub {
  margin: 0; font-size: 12px; color: var(--tx-3);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.save-state {
  flex: none;
  font-family: var(--data);
  font-size: 11px;
  color: var(--tx-3);
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.08);
}
.save-state[data-state="saving"] { color: var(--tx-2); }
.save-state[data-state="unsaved"] { color: var(--warn); border-color: rgba(255,180,84,.3); }
.save-state[data-state="offline"] { color: var(--warn); border-color: rgba(255,180,84,.3); }
.save-state[data-state="error"] { color: var(--neg); border-color: rgba(255,107,94,.35); }

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

.btn {
  height: 32px; padding: 0 14px;
  border: 0; border-radius: 9px;
  background: var(--vio); color: #0A0A12;
  font-size: 13px; font-weight: 500; cursor: pointer;
  transition: .14s;
}
.btn:hover { background: var(--vio-hi); }
.btn.ghost {
  background: rgba(255,255,255,.06);
  color: var(--tx);
  border: 1px solid rgba(255,255,255,.10);
}
.btn.ghost:hover { background: rgba(255,255,255,.11); }
.btn.small { height: 26px; padding: 0 10px; font-size: 12px; border-radius: 7px; }
.btn.danger { background: transparent; color: var(--neg); border: 1px solid rgba(255,107,94,.3); }
.btn.danger:hover { background: var(--neg-soft); }

/* the ⋯ menu */
.menu { position: relative; }
.menu > summary {
  list-style: none;
  display: grid; place-items: center;
  width: 32px; height: 32px;
  border-radius: 9px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.10);
  color: var(--tx);
  cursor: pointer;
}
.menu > summary::-webkit-details-marker { display: none; }
.menu > summary:hover { background: rgba(255,255,255,.11); }
.menu-panel {
  position: absolute; right: 0; top: 38px;
  min-width: 210px;
  padding: 6px;
  background: var(--void-2);
  border: 1px solid rgba(255,255,255,.11);
  border-radius: var(--radius);
  box-shadow: 0 18px 50px rgba(0,0,0,.5);
  display: grid; gap: 1px;
}
.menu-panel button {
  text-align: left;
  padding: 8px 10px;
  border: 0; border-radius: 8px;
  background: transparent; color: var(--tx);
  font-size: 13px; cursor: pointer;
}
.menu-panel button:hover { background: rgba(255,255,255,.08); }
.menu-panel hr { border: 0; border-top: 1px solid rgba(255,255,255,.08); margin: 5px 4px; }

/* ---- offline banner ----------------------------------------------------- */

.banner {
  position: fixed; inset: var(--bar) 0 auto 0;
  z-index: 59;
  padding: 7px 16px;
  background: var(--warn-soft);
  color: #4A3208;
  border-bottom: 1px solid rgba(255,180,84,.4);
  font-size: 12.5px;
  text-align: center;
}

/* ---- board switcher ----------------------------------------------------- */

.sidebar {
  position: fixed;
  top: var(--bar); bottom: 0; left: 0;
  z-index: 55;
  width: 296px;
  padding: 14px;
  background: var(--void-2);
  border-right: 1px solid rgba(255,255,255,.08);
  overflow-y: auto;
  transform: translateX(-100%);
  transition: transform .16s ease;
}
.sidebar.open { transform: none; }
.side-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.side-head h2 { font-size: 14px; font-weight: 600; color: var(--tx); }
.side-empty { color: var(--tx-3); font-size: 13px; }

.board-list h4 {
  font-family: var(--data);
  font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--tx-3); font-weight: 400;
  margin: 16px 0 6px 4px;
}
.board-row {
  width: 100%;
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  padding: 8px 10px;
  border: 1px solid transparent; border-radius: 9px;
  background: transparent; color: var(--tx);
  font-size: 13px; text-align: left; cursor: pointer;
}
.board-row:hover { background: rgba(255,255,255,.06); }
.board-row.on { background: var(--vio-soft); border-color: rgba(139,124,255,.35); }
.board-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-when { flex: none; font-family: var(--data); font-size: 10.5px; color: var(--tx-3); }

/* ---- tool island -------------------------------------------------------- */

.tools {
  position: fixed;
  left: 16px; top: 50%;
  transform: translateY(-50%);
  z-index: 40;
  display: grid; gap: 3px;
  padding: 6px;
  background: var(--card);
  border: 1px solid var(--paper-line);
  border-radius: 14px;
  box-shadow: var(--lift);
}
.tools button {
  display: grid; place-items: center;
  width: 38px; height: 38px;
  border: 0; border-radius: 10px;
  background: transparent; color: var(--ink-2);
  cursor: pointer; transition: .12s;
}
.tools button:hover { background: #F1F3F1; color: var(--ink); }
.tools button.on { background: var(--pick); color: #fff; }
.tools hr { border: 0; border-top: 1px solid var(--paper-line); margin: 3px 5px; }

/* ---- pen bar ------------------------------------------------------------ */

.pen-bar {
  position: fixed;
  left: 70px; top: 50%;
  transform: translateY(-50%);
  z-index: 40;
  display: flex; align-items: center; gap: 7px;
  padding: 8px 10px;
  background: var(--card);
  border: 1px solid var(--paper-line);
  border-radius: 12px;
  box-shadow: var(--lift);
}
/* --swatch, not --ink: --ink is the body text colour and reusing the name here
   made the button colour depend on which rule won. */
.ink {
  width: 20px; height: 20px;
  border-radius: 50%;
  border: 2px solid transparent;
  background: var(--swatch, #17201c);
  background-clip: padding-box;
  cursor: pointer;
  padding: 0;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.12);
}
.ink.on { border-color: var(--pick); }
#penWidth { width: 88px; accent-color: var(--pick); background: transparent; border: 0; padding: 0; }

/* ---- selection inspector ------------------------------------------------ */

.inspector {
  position: fixed;
  left: 50%; bottom: 22px;
  transform: translateX(-50%);
  z-index: 45;
  display: flex; align-items: center; gap: 6px;
  padding: 7px 10px;
  background: var(--card);
  border: 1px solid var(--paper-line);
  border-radius: 12px;
  box-shadow: var(--lift);
}
.sel-count { font-family: var(--data); font-size: 11px; color: var(--ink-3); padding: 0 3px; }
.inspector .sep { width: 1px; height: 20px; background: var(--paper-line); }
.chip {
  width: 22px; height: 22px;
  border-radius: 6px;
  border: 1.5px solid;
  cursor: pointer; padding: 0;
}
.icon-btn {
  display: grid; place-items: center;
  width: 28px; height: 28px;
  border: 0; border-radius: 8px;
  background: transparent; color: var(--ink-2);
  cursor: pointer;
}
.icon-btn:hover { background: #F1F3F1; color: var(--ink); }
.icon-btn.danger:hover { background: #FCECEA; color: #B23A2E; }

/* ---- canvas ------------------------------------------------------------- */

.canvas {
  position: fixed;
  inset: var(--bar) 0 0 0;
  overflow: hidden;
  background-color: var(--paper);
  /* A faint dot grid, aligned to the transform so it pans and zooms with it.
     Below roughly 40% the dots are closer together than they are wide and the
     whole canvas reads as flat grey, so the grid is dropped instead. */
  background-image: radial-gradient(circle at 1px 1px, #C8D1CC 1px, transparent 0);
  background-size: var(--grid, 24px) var(--grid, 24px);
  background-position: var(--grid-x, 0) var(--grid-y, 0);
  background-repeat: repeat;
  cursor: default;
  touch-action: none;
}
.canvas.no-grid { background-image: none; }
.canvas.panning, body.space .canvas { cursor: grabbing; }
body[data-tool="hand"] .canvas { cursor: grab; }
body[data-tool="pen"] .canvas { cursor: crosshair; }
body[data-tool="box"] .canvas,
body[data-tool="note"] .canvas,
body[data-tool="frame"] .canvas { cursor: copy; }
body[data-tool="arrow"] .canvas { cursor: crosshair; }
body[data-tool="eraser"] .canvas { cursor: cell; }
.canvas.drop-target { outline: 3px dashed var(--pick); outline-offset: -12px; }

.world { position: absolute; inset: 0; transform-origin: 0 0; }
.layer { position: absolute; inset: 0; overflow: visible; }
.layer.frames, .layer.labels, .layer.nodes, .layer.overlay { pointer-events: none; }
.layer.nodes > * { pointer-events: auto; }
.layer.labels > * { pointer-events: auto; }
svg.layer { width: 100%; height: 100%; pointer-events: none; overflow: visible; }
svg.layer .arrow, svg.layer .stroke { pointer-events: stroke; }

/* ---- sections ----------------------------------------------------------- */

.frame {
  position: absolute;
  background: #fff;
  border: 1px solid #E4E9E6;
  border-radius: 20px;
  box-shadow: 0 1px 3px rgba(20,31,27,.07), 0 8px 20px rgba(20,31,27,.04);
}
.frame.highlight { background: #F6F3FF; border-color: #DDD5FF; }

.section-rule { position: absolute; height: 2px; background: var(--paper-line); }
.section-title {
  position: absolute;
  font-size: 19px; font-weight: 600; letter-spacing: -.01em;
  color: #1B241F;
  outline: none;
}
.section-title:focus { background: #EFEBFF; border-radius: 5px; }

/* ---- boxes -------------------------------------------------------------- */

.node {
  position: absolute;
  display: flex; flex-direction: column;
  padding: 11px 13px;
  border-radius: var(--radius);
  border: 1.5px solid;
  background: #fff;
  overflow: hidden;
  box-shadow: var(--lift-lo);
  transition: box-shadow .12s, border-color .12s;
}
.node:hover { box-shadow: var(--lift); }
.node.selected { outline: 2px solid var(--pick); outline-offset: 2px; }

.node h3 {
  margin: 0 0 5px;
  font-size: 13.5px; font-weight: 600; line-height: 1.28;
  letter-spacing: -.005em;
  outline: none;
}
/* Never scroll. A box that hides half its own text is useless on a map you
   read at a glance, so boxes grow to their content instead — see autofit(). */
.node .body {
  flex: 1;
  min-height: 0;
  font-size: 12px; line-height: 1.45;
  color: var(--ink-2);
  overflow: hidden;
  outline: none;
}
.node .body ul, .node .body ol { margin: 0; padding-left: 15px; }
.node .body li { margin: 1.5px 0; }
.node h3:focus, .node .body:focus { background: rgba(108,92,231,.05); border-radius: 5px; }

/* the six meanings. Colour is the fastest way to read a board at 30%. */
.node.department { background: #EFEBFF; border-color: #B9AAFF; color: #2F2A63; }
.node.skill      { background: #FFF6D6; border-color: #E8C766; color: #5A4400; }
.node.system     { background: #E6F5FC; border-color: #8FCBE3; color: #10465A; }
.node.client     { background: #E8F1FA; border-color: #9CC0DE; color: #17384F; }
.node.approval   { background: #FCE7EE; border-color: #E3A3B9; color: #5E2335; }
.node.action     { background: #FFEDDF; border-color: #F0B287; color: #5F2E15; }
/* Standing rules. Deliberately the only green on the board, and a heavier edge,
   so "this is the rule" is findable from right across a zoomed-out map. */
.node.rule {
  background: #DEF7EF; border-color: #4FBF9B; color: #10493A;
  border-width: 2px;
}
.node.department .body, .node.skill .body, .node.system .body,
.node.client .body, .node.approval .body, .node.action .body,
.node.rule .body { color: inherit; opacity: .82; }

.chip.department { background: #EFEBFF; border-color: #B9AAFF; }
.chip.skill      { background: #FFF6D6; border-color: #E8C766; }
.chip.system     { background: #E6F5FC; border-color: #8FCBE3; }
.chip.client     { background: #E8F1FA; border-color: #9CC0DE; }
.chip.approval   { background: #FCE7EE; border-color: #E3A3B9; }
.chip.action     { background: #FFEDDF; border-color: #F0B287; }
.chip.rule       { background: #DEF7EF; border-color: #4FBF9B; }

/* checklists */
.check-row {
  display: flex; align-items: flex-start; gap: 6px;
  cursor: pointer;
}
.check-row input {
  margin: 2px 0 0; flex: none;
  width: 13px; height: 13px;
  accent-color: var(--pick);
  cursor: pointer;
}
.check-row.done span { text-decoration: line-through; opacity: .55; }
.node .body li[data-check] { list-style: none; margin-left: -15px; }

.progress {
  position: absolute; right: 9px; bottom: 7px;
  font-family: var(--data); font-size: 9.5px;
  color: var(--ink-3);
  background: rgba(255,255,255,.86);
  border-radius: 999px;
  padding: 1px 6px;
  pointer-events: none;
}
.progress.complete { color: #1F7A5C; background: #DFF3EA; }

/* images */
.node.image { padding: 5px; background: #fff; border-color: #DDE3E0; }
.node.image img {
  width: 100%; flex: 1; min-height: 0;
  object-fit: cover;
  border-radius: 8px;
  display: block;
  user-select: none;
}
.image-caption {
  font-size: 11px; color: var(--ink-3);
  padding: 4px 3px 1px;
  outline: none;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.image-caption:focus { background: rgba(108,92,231,.06); border-radius: 4px; }

/* resize grip */
.resize {
  position: absolute; right: 0; bottom: 0;
  width: 15px; height: 15px;
  cursor: nwse-resize;
  opacity: 0;
}
.node:hover .resize, .node.selected .resize { opacity: 1; }
.resize::after {
  content: ""; position: absolute; right: 3px; bottom: 3px;
  width: 7px; height: 7px;
  border-right: 2px solid var(--pick); border-bottom: 2px solid var(--pick);
  border-radius: 0 0 2px 0;
}

/* ---- arrows and ink ----------------------------------------------------- */

/* Width comes from --arrow-w, set on every transform, because the stroke does
   not scale with the canvas. See applyTransform(). */
.arrow { fill: none; stroke: #6E7C76; stroke-width: var(--arrow-w, 2.2px); }
.arrow:hover { stroke: var(--pick); }
.arrow.selected { stroke: var(--pick); stroke-width: calc(var(--arrow-w, 2.2px) + 1.4px); }
.arrow.pending { stroke: var(--pick); stroke-dasharray: 7 6; opacity: .8; }
/* A fat invisible line under each arrow so it can be clicked without needing
   to hit a 2px target. */
.arrow-hit { fill: none; stroke: transparent; stroke-width: 14px; cursor: pointer; }

/* Endpoint grips on a selected arrow: drag one onto another box to move it. */
.arrow-grip {
  fill: #fff; stroke: var(--pick); stroke-width: 2;
  cursor: grab; pointer-events: all;
}
.arrow-grip:hover { fill: var(--pick); }
.node.drop-on { outline: 3px solid var(--pick); outline-offset: 2px; }

/* Arrow captions. */
.arrow-label text {
  font-family: var(--ui); font-size: 12px; font-weight: 500;
  fill: #3B4642; paint-order: stroke;
}
.arrow-label-plate { fill: #FBFCFA; stroke: #E4E9E6; stroke-width: 1; }
.stroke { stroke-linecap: round; stroke-linejoin: round; }
.stroke.selected { outline: none; filter: drop-shadow(0 0 3px rgba(108,92,231,.7)); }

/* ---- overlays ----------------------------------------------------------- */

.marquee {
  position: absolute;
  border: 1.5px solid var(--pick);
  background: rgba(108,92,231,.09);
  border-radius: 3px;
}
.group-box {
  position: absolute;
  border: 1.5px dashed var(--pick);
  border-radius: 10px;
}
.stroke-box {
  position: absolute;
  border: 1.5px solid var(--pick);
  border-radius: 6px;
}

/* ---- zoom --------------------------------------------------------------- */

.zoombar {
  position: fixed;
  left: 16px; bottom: 16px;
  z-index: 40;
  display: flex; align-items: center; gap: 1px;
  padding: 4px;
  background: var(--card);
  border: 1px solid var(--paper-line);
  border-radius: 11px;
  box-shadow: var(--lift);
}
.zoombar button {
  min-width: 30px; height: 30px;
  border: 0; border-radius: 8px;
  background: transparent; color: var(--ink-2);
  font-size: 15px; cursor: pointer;
}
.zoombar button:hover { background: #F1F3F1; color: var(--ink); }
.zoombar .zoom {
  min-width: 52px;
  font-family: var(--data); font-size: 11.5px;
}

.hint {
  position: fixed; right: 16px; bottom: 18px;
  z-index: 30;
  font-size: 11.5px; color: var(--ink-3);
  pointer-events: none;
}

/* ---- toast, dialog ------------------------------------------------------ */

.toast {
  position: fixed;
  left: 50%; top: calc(var(--bar) + 16px);
  transform: translate(-50%, -14px);
  z-index: 90;
  padding: 9px 16px;
  background: #17201C; color: #fff;
  border-radius: 10px;
  font-size: 13px;
  box-shadow: 0 12px 34px rgba(0,0,0,.28);
  opacity: 0; pointer-events: none;
  transition: .18s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
/* Clear the offline banner rather than landing on top of it. */
body.has-banner .toast { top: calc(var(--bar) + 46px); }

.dialog {
  border: 0; border-radius: 16px;
  padding: 22px;
  width: min(540px, 92vw);
  background: var(--void-2);
  color: var(--tx);
  box-shadow: 0 30px 80px rgba(0,0,0,.55);
}
.dialog::backdrop { background: rgba(7,7,10,.55); }
.dialog h3 { font-size: 17px; font-weight: 600; margin-bottom: 6px; }
.dialog .muted { color: var(--tx-2); font-size: 13px; margin-bottom: 14px; }
.share-list { display: grid; gap: 7px; margin-bottom: 16px; }
.share-row {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 11px;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 10px;
}
.share-meta { flex: 1; min-width: 0; display: grid; }
.share-meta strong { font-size: 13px; font-weight: 500; }
.share-meta span { font-family: var(--data); font-size: 10.5px; color: var(--tx-3); }
.dialog-actions { display: flex; gap: 8px; justify-content: flex-end; }

/* ---- present mode ------------------------------------------------------- */

body.presenting .chrome,
body.presenting .tools,
body.presenting .zoombar,
body.presenting .sidebar,
body.presenting .inspector,
body.presenting .pen-bar,
body.presenting .hint { display: none; }
body.presenting .canvas { inset: 0; }

/* ---- read-only ---------------------------------------------------------- */

body.read-only .tools,
body.read-only .inspector,
body.read-only .pen-bar { display: none; }
body.read-only .resize { display: none; }

/* ---- fatal -------------------------------------------------------------- */

.fatal { display: grid; place-items: center; height: 100vh; background: var(--void); }
.fatal-card { text-align: center; max-width: 420px; padding: 30px; }
.fatal-mark {
  width: 34px; height: 34px; margin: 0 auto 18px;
  border-radius: 9px; background: var(--vio);
}
.fatal-card h1 { font-size: 20px; font-weight: 600; margin-bottom: 8px; color: var(--tx); }
.fatal-card p { color: var(--tx-2); font-size: 14px; }

@media (max-width: 720px) {
  .board-sub, .hint { display: none; }
  .tools { top: auto; bottom: 16px; left: 50%; transform: translateX(-50%); grid-auto-flow: column; }
  .inspector { bottom: 74px; }
  .zoombar { display: none; }
}
