/* =============================================================================
   Arodus Dashboard — Edit mode
   Edit is a STATE of the live Dashboard (triggered by the Edit toggle), not a
   separate page. Affordances: row drag-grips, per-row ••• settings, resize-to-
   item-count, drag drop-line, add-row picker, view switcher, Discard / Save.
   Reuses app tokens from arodus-app.css / the page's :root.
   ========================================================================== */

/* rows become editable canvases */
.board-inner > section.row { position: relative; }
.board.editing > .board-inner > section.row {
  outline: 1px dashed var(--border-strong); outline-offset: 3px;
  transition: outline-color .12s, transform .12s, box-shadow .12s;
}
.board.editing > .board-inner > section.row.hero { outline-offset: 6px; }
.board.editing .rh-tools, .board.editing .rowbar { display: none !important; }
.board.editing .viewall { display: none; }

/* drag grip (left) */
.edit-grip { position: absolute; left: -2px; top: 0; bottom: 0; width: 22px; display: none; align-items: center; justify-content: center; color: var(--text-muted); cursor: grab; z-index: 7; }
.board.editing .edit-grip { display: flex; }
.edit-grip:hover { color: var(--text-body); }
.edit-grip:active { cursor: grabbing; }

/* per-row ••• settings (top right) */
.edit-menu-btn { position: absolute; top: 12px; right: 14px; width: 28px; height: 28px; display: none; place-items: center; border-radius: var(--r-sm); color: var(--text-muted); background: var(--surface-2); border: 1px solid var(--border); cursor: pointer; z-index: 8; }
.board.editing .edit-menu-btn { display: grid; }
.edit-menu-btn:hover { color: var(--text); border-color: var(--border-strong); }

/* resize-to-item-count handle (bottom) */
.edit-resize { position: absolute; left: 0; right: 0; bottom: 1px; height: 14px; display: none; align-items: center; justify-content: center; cursor: ns-resize; z-index: 7; }
.board.editing .edit-resize { display: flex; }
.edit-resize .bar { width: 46px; height: 4px; border-radius: 999px; background: var(--border-strong); transition: background .12s, width .12s; }
.edit-resize:hover .bar { background: var(--text-muted); }

/* drag + resize active states */
.board.editing > .board-inner > section.row.dragging { box-shadow: var(--shadow-pop, 0 12px 40px rgba(0,0,0,.5)); transform: translateY(-2px); z-index: 20; background: #18263A; outline-color: var(--border-strong); opacity: .96; }
.board.editing > .board-inner > section.row.dragging .edit-grip { color: var(--text-body); }
.board.editing > .board-inner > section.row.resizing { outline-color: var(--accent); }
.board.editing > .board-inner > section.row.resizing .edit-resize .bar { background: var(--accent); width: 56px; }

/* item-count readout pill (during resize) */
.edit-readout { position: absolute; right: 12px; bottom: -12px; display: inline-flex; align-items: center; gap: 7px; background: var(--accent); color: #fff; font-family: var(--font-mono); font-size: 10.5px; font-weight: 500; padding: 3px 9px; border-radius: 999px; z-index: 9; box-shadow: var(--shadow); pointer-events: none; }
.edit-readout .dots { display: inline-flex; gap: 4px; }
.edit-readout .dots i { width: 4px; height: 4px; border-radius: 999px; background: rgba(255,255,255,.4); }
.edit-readout .dots i.on { background: #fff; transform: scale(1.25); }

/* drop-line between rows */
.edit-dropline { height: 2px; background: var(--accent); border-radius: 2px; position: relative; margin: -9px 0; }
.edit-dropline::before { content: ""; position: absolute; left: -3px; top: -2px; width: 6px; height: 6px; border-radius: 999px; background: var(--accent); }

/* per-row settings popover */
.edit-pop { position: absolute; top: 46px; right: 14px; width: 196px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-md); box-shadow: var(--shadow-pop, 0 12px 40px rgba(0,0,0,.5)); padding: 5px; z-index: 30; }
.edit-pop[hidden] { display: none; }
.edit-pop .mh { font-size: 9.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted); padding: 6px 9px 5px; }
.edit-pop .mi { display: flex; align-items: center; gap: 9px; padding: 8px 9px; border-radius: var(--r-sm); font-size: 12.5px; color: var(--text-body); cursor: pointer; width: 100%; background: transparent; border: 0; text-align: left; font-family: var(--font-ui); }
.edit-pop .mi:hover { background: var(--surface-2); color: var(--text); }
.edit-pop .mi .val { margin-left: auto; color: var(--text-muted); font-family: var(--font-mono); font-size: 11px; }
.edit-pop .mi.danger { color: #F0746E; }
.edit-pop .mi.danger:hover { background: rgba(240,116,110,.1); color: #FF7A7A; }
.edit-pop .mdiv { height: 1px; background: var(--border); margin: 4px 6px; }

/* add-row dashed button + picker */
.edit-addrow { display: none; position: relative; border: 1.5px dashed var(--border-strong); border-radius: var(--r-md); padding: 15px; align-items: center; justify-content: center; gap: 8px; color: var(--text-muted); font-size: 13px; font-weight: 500; cursor: pointer; background: transparent; width: 100%; font-family: var(--font-ui); }
.board.editing ~ .edit-addrow, .edit-addrow.in-edit { display: flex; }
.edit-addrow:hover, .edit-addrow.active { border-color: var(--accent); color: var(--text); }
.edit-addrow .plus { color: var(--accent); font-family: var(--font-mono); font-weight: 600; }
.edit-picker { position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%); width: 340px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-md); box-shadow: var(--shadow-pop, 0 12px 40px rgba(0,0,0,.5)); padding: 7px; z-index: 30; text-align: left; }
.edit-picker[hidden] { display: none; }
.edit-picker .ph { font-family: var(--font-mono); font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted); padding: 6px 9px 8px; }
.edit-pitem { display: flex; align-items: center; gap: 11px; padding: 9px; border-radius: var(--r-sm); cursor: pointer; width: 100%; background: transparent; border: 0; text-align: left; font-family: var(--font-ui); }
.edit-pitem:not(.added):hover { background: var(--surface-2); }
.edit-pitem .pglyph { width: 26px; height: 26px; border-radius: var(--r-sm); background: var(--surface-2); border: 1px solid var(--border); display: grid; place-items: center; color: var(--text-muted); flex: none; }
.edit-pitem .pm { flex: 1; min-width: 0; }
.edit-pitem .pn { font-size: 13px; color: var(--text); font-weight: 500; }
.edit-pitem .pd { font-size: 11px; color: var(--text-muted); }
.edit-pitem .pstate { font-size: 11px; color: var(--text-muted); font-family: var(--font-mono); flex: none; }
.edit-pitem.added { opacity: .5; cursor: default; }
.edit-pitem.added .pstate { color: var(--accent); }

/* chrome: Discard / Save actions (replace normal chrome buttons in edit mode) */
.edit-actions { display: none; align-items: center; gap: 6px; }
.edit-actions.show { display: flex; }
.edit-actions .btn-discard { background: transparent; border: 0; color: var(--text-muted); font-family: var(--font-ui); font-weight: 600; font-size: 13px; padding: 7px 10px; cursor: pointer; border-radius: var(--r-sm); }
.edit-actions .btn-discard:hover { color: var(--text); background: var(--surface); }
.edit-actions .btn-save { background: var(--accent); border: 0; color: #fff; border-radius: var(--r-sm); padding: 8px 15px; font-family: var(--font-ui); font-weight: 600; font-size: 13px; cursor: pointer; }
.edit-actions .btn-save:hover { background: var(--accent-hover); }
/* when editing, hide the non-edit chrome buttons */
.editing-chrome .report-btn, .editing-chrome #saveViewBtn, .editing-chrome .more-wrap { display: none !important; }

/* view switcher menu */
.switcher-wrap { position: relative; }
.vmenu { position: absolute; top: calc(100% + 8px); left: 0; width: 244px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-md); box-shadow: var(--shadow-pop, 0 12px 40px rgba(0,0,0,.5)); padding: 6px; z-index: 40; }
.vmenu[hidden] { display: none; }
.vitem { display: flex; align-items: center; gap: 9px; padding: 8px 10px; border-radius: var(--r-sm); font-size: 13.5px; color: var(--text-body); cursor: pointer; width: 100%; background: transparent; border: 0; text-align: left; font-family: var(--font-ui); }
.vitem:hover { background: var(--surface-2); }
.vitem .chk { width: 14px; color: var(--accent); display: inline-flex; justify-content: center; flex: none; }
.vitem.current { color: var(--text); font-weight: 500; }
.vitem .nm { flex: 1; min-width: 0; }
.vitem .nm-input { flex: 1; background: var(--surface-2); border: 1px solid var(--accent); border-radius: var(--r-sm); color: var(--text); font-family: var(--font-ui); font-size: 13.5px; padding: 4px 7px; outline: none; }
.vitem .edit-aff { color: var(--text-muted); display: inline-flex; padding: 2px; border-radius: 4px; }
.vitem .edit-aff:hover { color: var(--text); background: var(--border); }
.vdiv { height: 1px; background: var(--border); margin: 6px 4px; }
.vitem.new { color: var(--accent); font-weight: 600; }
