/* KAAVISH: design tokens and the base styles every page shares. */
:root {
  --bg: #F5F4F2;
  --workspace: #FCFBFA;
  --rose: #D8A7B1;
  --blush: #E8C6CD;
  --lavender: #B9AED3;
  --lavender-soft: #D8D1E6;
  --charcoal: #303033;
  --grey: #716D6D;
  --hairline: #DED9D8;
  --pink: #ED709C;
  --pink-soft: #F7D7E4;
  --secondary: #EFEDEB;
  --lavender-deep: #8C7FB8;   /* selection and focus rings: lavender with enough contrast to see */
}
* { margin: 0; padding: 0; box-sizing: border-box; }
/* Class rules that set `display` outbid the browser's [hidden] rule, so panels
   and tool sets stayed visible when script set node.hidden = true. */
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: 'Instrument Sans', ui-sans-serif, system-ui, sans-serif;
  background: var(--bg);
  color: var(--charcoal);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
svg.ic { width: 16px; height: 16px; display: block; }
svg.ic-sm { width: 14px; height: 14px; display: block; }
svg.ic-xs { width: 12px; height: 12px; display: block; }

/* ---- typography ---- */
.label-caps {
  display: inline-block;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--grey);
}
.wordmark {
  display: inline-flex;
  align-items: baseline;
  gap: 12px;
  text-decoration: none;
}
.wordmark b {
  font-weight: 600;
  letter-spacing: 0.24em;
  color: var(--pink);
}
.wordmark span {
  font-size: 0.58em;
  letter-spacing: 0.12em;
  color: var(--grey);
}
.muted { color: var(--grey); }
.pink { color: var(--pink); }

/* ---- top bar ---- */
.topbar {
  display: flex;
  align-items: center;
  gap: 24px;
  border-bottom: 1px solid var(--hairline);
  padding: 12px 24px;
  background: var(--bg);
}
.topbar .brand { flex-shrink: 0; font-size: 16px; }
.topbar .wordmark b { font-size: 1.15em; }
.topbar .center { flex: 1; min-width: 0; }
.topbar .right { display: flex; flex-shrink: 0; align-items: center; gap: 16px; }
.vrule { width: 1px; height: 16px; background: var(--hairline); flex-shrink: 0; }

.quiet {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 13px;
  color: var(--grey);
  transition: color 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0;
  text-decoration: none;
}
.quiet.pad { padding: 4px 8px; }
.quiet:hover { color: var(--charcoal); }
.quiet.on { color: var(--charcoal); }
.quiet.accent { color: var(--pink); }

.btn {
  display: inline-block;
  border: 1px solid var(--charcoal);
  background: none;
  padding: 8px 20px;
  font-size: 15px;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}
.btn:hover { background: var(--charcoal); color: var(--bg); }
.btn-pink { border-color: var(--pink); color: var(--pink); }
.btn-pink:hover { background: var(--pink); color: var(--bg); }
.btn-sm { padding: 5px 14px; font-size: 13px; }

.chip {
  border: 1px solid var(--hairline);
  background: none;
  color: var(--grey);
  padding: 4px 10px;
  font-size: 13px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.chip:hover { color: var(--charcoal); }
.chip.on { border-color: var(--rose); color: var(--charcoal); }

.field {
  width: 100%;
  border: none;
  border-bottom: 1px solid var(--hairline);
  background: transparent;
  padding: 0 0 8px;
  font-size: 15px;
  outline: none;
}
.field:focus { border-color: var(--rose); }
.boxfield {
  width: 100%;
  border: 1px solid var(--hairline);
  background: transparent;
  padding: 7px 10px;
  font-size: 13px;
  outline: none;
}
.boxfield:focus { border-color: var(--pink); }

.notice {
  border: 1px solid var(--rose);
  background: #FBF1F3;
  color: #8A4A56;
  padding: 12px 14px;
  font-size: 14px;
}

/* ---- hint tooltips ---- */
.hint { position: relative; display: inline-flex; }
.hint.full { width: 100%; }
.hint.full > :first-child { width: 100%; }
.hint > .tip {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 60;
  margin-top: 8px;
  width: 256px;
  border: 1px solid var(--hairline);
  background: var(--workspace);
  padding: 12px;
  text-align: left;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.1s;
  box-shadow: 0 10px 30px -18px rgba(0,0,0,0.5);
}
.hint.left > .tip { left: 0; transform: none; }
.hint.right > .tip { left: auto; right: 0; transform: none; }
.hint:hover > .tip { opacity: 1; }
.tip b { display: block; font-size: 12px; font-weight: 500; color: var(--charcoal); }
.tip i { display: block; margin-top: 4px; font-size: 11px; font-style: normal; line-height: 1.6; color: var(--grey); }
.tip u { display: block; margin-top: 6px; font-size: 11px; text-decoration: none; line-height: 1.6; color: var(--pink); }

/* ---- rich text ---- */
.rich {
  width: 100%;
  height: 100%;
  overflow: auto;
  background: transparent;
  outline: none;
  line-height: 1.65;
}
.rich:empty::before,
.rich:has(> br:only-child)::before {
  content: attr(data-placeholder);
  color: color-mix(in srgb, var(--grey) 60%, transparent);
  pointer-events: none;
}
.rich ul { list-style: disc; padding-left: 1.25rem; }
.rich ol { list-style: decimal; padding-left: 1.25rem; }
.rich a { text-decoration: underline; }

/* ---- format toolbar ---- */
.fmtbar { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.fmtbar button.fb {
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  background: none; border: none; cursor: pointer; color: var(--grey);
  transition: color 0.15s;
}
.fmtbar button.fb:hover { color: var(--pink); }
.fmtbar select.fs {
  border: 1px solid var(--hairline);
  background: transparent;
  padding: 2px 6px;
  font-size: 12px;
  color: var(--grey);
  outline: none;
}
.fmtbar label.fc {
  display: flex; align-items: center; gap: 4px; height: 28px;
  border: 1px solid var(--hairline); padding: 0 6px;
  font-size: 12px; color: var(--grey); cursor: pointer;
}
.fmtbar label.fc input[type=color] {
  width: 20px; height: 16px; padding: 0; border: 0; background: none; cursor: pointer;
}
.fmtbar .sep { width: 1px; height: 16px; background: var(--hairline); margin: 0 4px; }

/* ---- slide-over panels ---- */
.panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  max-width: 384px;
  flex-shrink: 0;
  border-left: 1px solid var(--hairline);
  background: var(--workspace);
}
.panel.wide { max-width: 448px; }
.panel > header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--hairline);
  padding: 16px 20px;
}
.panel > header h2 { font-size: 18px; font-weight: 400; margin-top: 4px; }
.panel .panel-body { flex: 1; overflow-y: auto; padding: 20px; }
.panel-x { background: none; border: none; cursor: pointer; color: var(--grey); }
.panel-x:hover { color: var(--charcoal); }
.panel section + section { margin-top: 30px; }
.panel .steps { list-style: none; margin-top: 12px; }
.panel .steps li { display: flex; gap: 12px; font-size: 14px; line-height: 1.65; margin-bottom: 8px; }
.panel .steps li span.n { width: 16px; flex-shrink: 0; color: var(--grey); font-variant-numeric: tabular-nums; }
.panel .steps li span.d { color: var(--rose); }
.panel .quoted { border-left: 1px solid var(--lavender-soft); padding-left: 16px; font-size: 14px; line-height: 1.65; margin-bottom: 12px; list-style: none; }
.panel .phrase { border-left: 1px solid var(--blush); padding-left: 16px; font-size: 14px; font-style: italic; line-height: 1.65; margin-bottom: 8px; list-style: none; }

/* ---- dropdown menus ---- */
.menu-wrap { position: relative; }
.menu {
  position: absolute;
  top: 100%;
  right: 0;
  z-index: 50;
  margin-top: 4px;
  border: 1px solid var(--hairline);
  background: var(--bg);
  padding: 4px 0;
  box-shadow: 0 8px 24px -16px rgba(0,0,0,0.35);
  display: none;
}
.menu.open { display: block; }
.menu.pad { padding: 16px; }
.menu .row {
  display: flex;
  width: 100%;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px 12px;
  text-align: left;
  font-size: 13px;
  text-decoration: none;
}
.menu .row:hover { background: var(--secondary); }
.menu .row .note { flex-shrink: 0; font-size: 11px; color: var(--grey); }

@media print {
  .noprint { display: none !important; }
}
