/* =========================================================
   KWARTIER — Custom styles (supplement to Tailwind)
   Only things Tailwind can't express easily:
   - CSS transitions / hover on child elements
   - Absolute-positioned directional buttons
   - Custom scrollbar
   - Reusable component tokens
   ========================================================= */

*, *::before, *::after { box-sizing: border-box; }

/* ---- Fonts ---- */
body { font-family: 'Inter', system-ui, sans-serif; }

/* ---- Canvas ---- */
#canvas {
  position: relative;
  background-color: #fbfaf6;
  background-image:
    repeating-linear-gradient(0deg, rgba(38,36,33,.035) 0, rgba(38,36,33,.035) 1px, transparent 1px, transparent 32px),
    repeating-linear-gradient(90deg, rgba(38,36,33,.035) 0, rgba(38,36,33,.035) 1px, transparent 1px, transparent 32px);
  border: 1px solid rgba(38,36,33,.08);
  border-radius: 4px;
  margin: 24px;
  transform-origin: top left;
  will-change: transform;
}

/* ---- Person node ---- */
.ft-node {
  position: absolute;
  width: 190px;
}

/* Directional + buttons — hidden until node is hovered */
.ft-plus {
  position: absolute;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: #8a6d1f;
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 300;
  line-height: 1;
  padding: 0 0 1px 0;
  opacity: 0;
  transform: scale(.7);
  transition: opacity .15s ease, transform .15s ease;
  z-index: 5;
}
.ft-node:hover .ft-plus { opacity: 1; transform: scale(1); }

.ft-plus-top    { top: -14px;               left: calc(50% - 12px); }
.ft-plus-bottom { bottom: -14px;            left: calc(50% - 12px); }
.ft-plus-left   { top: calc(50% - 12px);    left: -14px; }
.ft-plus-right  { top: calc(50% - 12px);    right: -14px; }

/* ---- Union label on canvas ---- */
.union-label {
  position: absolute;
  z-index: 1;
  transform: translate(-50%, -50%);
  padding: 2px 8px;
  background: #fbfaf6;
  border: 1px solid rgba(38,36,33,.18);
  border-radius: 3px;
  font-size: 10.5px;
  color: #5a564f;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  font-family: 'Inter', sans-serif;
  transition: background .1s;
}
.union-label:hover { background: #f0ede4; }

/* ---- Legend panel (absolute in canvas-container) ---- */
#legend-panel {
  position: absolute;
  bottom: 16px; left: 16px;
  background: #fffdf8;
  border: 1px solid rgba(38,36,33,.15);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(38,36,33,.14);
  padding: 14px 16px;
  z-index: 12;
  width: 232px;
  font-family: 'Inter', sans-serif;
}

/* ---- Nav ---- */
.office-badge {
  width: 26px; height: 26px;
  border-radius: 5px;
  background: #8a6d1f;
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px;
}

.main-nav { display: flex; align-items: center; gap: 22px; height: 52px; margin-left: 8px; }

.nav-link {
  font-size: 13px; color: #8a8577; text-decoration: none;
  display: flex; align-items: center; height: 100%;
  border-bottom: 2px solid transparent;
}
.nav-link.active { color: #8a6d1f; font-weight: 600; border-bottom-color: #8a6d1f; }

.save-status { display: flex; align-items: center; gap: 6px; font-size: 12px; color: #6b675f; }
.save-dot    { width: 6px; height: 6px; border-radius: 50%; background: #3d7a5c; flex: none; }

.avatar { width: 28px; height: 28px; border-radius: 50%; background: #e7e2d8; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 600; color: #4a4740; }

/* ---- Toolbar ---- */
.toolbar-left  { display: flex; align-items: center; gap: 10px; }
.toolbar-right { display: flex; align-items: center; gap: 8px;  }

.tree-title       { font-size: 15px; font-weight: 600; margin: 0; cursor: text; color: #262421; border-bottom: 1px dashed transparent; }
.tree-title:hover { border-bottom-color: rgba(38,36,33,.3); }
.tree-title-input { font-size: 15px; font-weight: 600; width: 280px; border: none; background: transparent; border-bottom: 1px solid rgba(38,36,33,.3); outline: none; font-family: 'Inter', sans-serif; color: #262421; padding: 0; }

.status-pill { font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 20px; border: 1px solid #b9852e; color: #8a5f1e; background: #fbf3e4; white-space: nowrap; }

.zoom-controls { display: flex; align-items: center; border: 1px solid rgba(38,36,33,.15); border-radius: 6px; background: #fffdf8; overflow: hidden; }
.zoom-controls button { width: 26px; height: 26px; border: none; background: transparent; font-size: 15px; cursor: pointer; color: #4a4740; line-height: 1; }
.zoom-controls button:hover { background: #f0ede4; }
.zoom-controls span { width: 40px; text-align: center; font-size: 11.5px; color: #4a4740; border-left: 1px solid rgba(38,36,33,.12); border-right: 1px solid rgba(38,36,33,.12); line-height: 26px; }

/* ---- Buttons ---- */
.ft-btn {
  height: 30px; padding: 0 13px;
  border: 1px solid rgba(38,36,33,.15); border-radius: 6px;
  background: #fffdf8; font-size: 12.5px; color: #4a4740;
  cursor: pointer; font-family: 'Inter', sans-serif;
  transition: background .1s;
  display: inline-flex; align-items: center; gap: 5px;
}
.ft-btn:hover { background: #f0ede4; }
.ft-btn-primary { border: none; background: #8a6d1f; color: #fff; }
.ft-btn-primary:hover { filter: brightness(1.08); }
.ft-btn-primary:disabled { background: #c7c3b8; cursor: not-allowed; filter: none; }
.ft-btn-danger  { border-color: rgba(138,50,38,.3); color: #8a3226; }
.ft-btn-danger:hover { background: #fbf0ee; }
.ft-btn-sm      { height: 26px; padding: 0 10px; font-size: 12px; }

/* ---- Inputs ---- */
.ft-input {
  font-family: 'Inter', sans-serif;
  font-size: 13px; padding: 7px 10px;
  border: 1px solid rgba(38,36,33,.18); border-radius: 6px;
  background: #fff; width: 100%; outline: none;
  color: #262421; transition: border-color .15s;
}
.ft-input:focus { border-color: #8a8577; }

/* ---- Pill toggles ---- */
.pill-toggle { font-size: 11px; font-weight: 600; padding: 3px 11px; border-radius: 20px; border: none; cursor: pointer; font-family: 'Inter', sans-serif; transition: background .12s, color .12s; }
.pill-off     { background: #f0ede4; color: #8a8577; }
.pill-on      { background: #8a6d1f; color: #fff; }
.pill-on-red  { background: #8a3226; color: #fff; }

/* ---- Popovers / overlays ---- */
.ft-popover {
  position: fixed;
  background: #fffdf8; border: 1px solid rgba(38,36,33,.15);
  border-radius: 8px; box-shadow: 0 8px 24px rgba(38,36,33,.18);
  padding: 14px; z-index: 55; width: 248px;
  font-family: 'Inter', sans-serif;
}

/* ---- Side panel ---- */
#side-panel {
  width: 360px; flex: none;
  background: #fffdf8; border-left: 1px solid rgba(38,36,33,.12);
  overflow-y: auto; display: flex; flex-direction: column;
}
#side-panel.hidden { display: none; }

/* ---- Print overlay ---- */
#print-overlay {
  position: fixed; inset: 0; z-index: 80;
  background: #f7f5f0; display: flex; flex-direction: column;
}
#print-overlay.hidden { display: none; }

.print-sidebar {
  width: 320px; flex: none;
  border-right: 1px solid rgba(38,36,33,.08);
  padding: 22px; overflow-y: auto; background: #f7f5f0;
}
.print-preview-area {
  flex: 1; overflow: auto; background: #e2dfd5;
  display: flex; align-items: center; justify-content: center; padding: 30px;
}
.mode-card {
  border: 1.5px solid rgba(38,36,33,.15); border-radius: 8px;
  padding: 12px 14px; background: #fffdf8; cursor: pointer; margin-bottom: 8px;
  transition: border-color .15s, box-shadow .15s;
}
.mode-card.active { border-color: #8a6d1f; box-shadow: 0 0 0 3px rgba(138,109,31,.12); }
.paper-btn {
  flex: 1; height: 30px; border-radius: 6px; border: 1px solid rgba(38,36,33,.15);
  background: #fffdf8; font-size: 12.5px; color: #4a4740; cursor: pointer;
  font-family: 'Inter', sans-serif; transition: background .1s, color .1s, border-color .1s;
}
.paper-btn.active { background: #8a6d1f; color: #fff; border-color: #8a6d1f; }

/* ---- Subtle scrollbar ---- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(38,36,33,.18); border-radius: 3px; }
