/* Ledger A - commitments and domains: the quick list in the left column, the Commitment settings
   page, one commitment's own page, and the drag-and-drop highlights they share. Loaded after
   calendar.css. */

/* ---------- the six dots a row is dragged by (quick list and settings page) ---------- */
.grip {
  color: var(--colour-text-muted);
  cursor: grab;
  letter-spacing: var(--letter-spacing-grip);
  padding: 0 var(--space-4);
  font-size: var(--font-size-xl);
  line-height: var(--line-height-none);
  user-select: none;
}

/* ---------- quick list (left column), like files and folders ---------- */
/* Click to open; drag by the six dots (.quick-nav__grip). */
.quick-nav__group {
  border-radius: var(--radius-8);
}
/* the domain-less commitments. The list ends right under them, so "+ Add" never floats; the
   extra empty space that takes drops only appears while a row is being dragged. */
.quick-nav__group--no-domain {
  border-radius: var(--radius-6);
}
.quick-nav:has(.quick-nav__commitment--dragging, .quick-nav__domain--dragging)
  .quick-nav__group--no-domain {
  min-height: var(--size-56);
}
.quick-nav__domain {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  width: 100%;
  margin-top: var(--space-6);
  padding: var(--space-5) var(--space-8);
  border: 0;
  border-radius: var(--radius-6);
  background: var(--colour-folder);
  color: var(--colour-folder-text);
  font-weight: var(--font-weight-medium);
  text-align: left;
  cursor: default; /* clicking opens it; only the six dots are for dragging */
}
.quick-nav__domain:hover {
  background: var(--colour-folder-hover);
}
.quick-nav__arrow {
  width: var(--size-10);
  font-size: var(--font-size-xs);
}
.quick-nav__commitment {
  display: flex;
  align-items: center;
  gap: var(--space-8);
  padding: var(--space-5) var(--space-8);
  border-radius: var(--radius-6);
  cursor: default; /* clicking opens it; only the six dots are for dragging */
}
.quick-nav__commitment--indented {
  padding-left: var(--space-14);
}
.quick-nav__toggle,
.quick-nav__open {
  flex: 1;
  display: flex;
  align-items: center;
  gap: var(--space-8);
  min-width: 0;
  padding: 0;
  border: 0;
  background: none;
  text-align: left;
  color: inherit;
}
.quick-nav__toggle {
  font-weight: var(--font-weight-medium);
  gap: var(--space-6);
}
.quick-nav__commitment:hover {
  background: var(--colour-surface-control);
}
/* the commitment whose page is open; it keeps its shade when hovered */
.quick-nav__commitment--selected,
.quick-nav__commitment--selected:hover {
  background: var(--colour-surface-strong);
  font-weight: var(--font-weight-medium);
}
.quick-nav__grip {
  padding: 0; /* the six dots you drag by sit tight against the row's edge */
}
.quick-nav__commitment--dragging,
.quick-nav__domain--dragging {
  opacity: var(--opacity-40);
}
/* the quiet "+ Add" under the list: muted text, no fill until hovered */
.quick-nav__add {
  display: block;
  width: 100%;
  margin-top: var(--space-4);
  padding: var(--space-5) var(--space-8);
  border: 0;
  border-radius: var(--radius-6);
  background: none;
  color: var(--colour-text-muted);
  text-align: left;
}
.quick-nav__add:hover {
  background: var(--colour-surface-control);
  color: inherit;
}

/* ---------- commitment settings page ---------- */
/* Both add forms share these columns (label, name, colour, domain, button), so their name boxes
   line up; the domain form simply leaves colour and domain empty. */
.add-form {
  display: grid;
  grid-template-columns:
    var(--size-130) minmax(var(--size-160), 1fr) var(--size-30) var(--size-130)
    var(--size-64);
  align-items: center;
  gap: var(--space-8);
  margin-bottom: var(--space-8);
}
.add-form__label {
  font-weight: var(--font-weight-medium);
}
/* the domain form's name box stretches over the colour and domain columns, to the same right edge */
.add-form__name--wide {
  grid-column: 2 / 5;
}
.add-form__button {
  grid-column: 5;
  justify-self: stretch; /* both "+ Add" buttons fill the column, so they are the same width */
}
.settings-list {
  margin-top: var(--space-16);
  display: flex;
  flex-direction: column;
  gap: var(--space-12);
}
/* one commitment's row, or a domain's head */
.settings-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-8);
  padding: var(--space-5) var(--space-8);
  border-radius: var(--radius-8);
}
.settings-row__name {
  flex: 1 1 var(--size-120);
}
.settings-row--dragging {
  opacity: var(--opacity-40);
}
.settings-row--commitment:hover {
  background: var(--colour-surface-frame);
}
.settings-row__built-in {
  color: var(--colour-text-muted);
  font-size: var(--font-size-sm);
}
/* The last cell of a commitment row ("Delete", or "Built in" for General): one fixed width with
   centred text, so the gear and domain boxes line up in every row. */
.settings-row__end {
  width: var(--size-56);
  text-align: center;
}
/* Domains: bland grey collapsible folders (SPEC B.b.vii) */
.domain-block {
  border-radius: var(--radius-10);
}
.domain-block__head {
  background: var(--colour-folder);
  color: var(--colour-folder-text);
}
.domain-block__name {
  font-weight: var(--font-weight-medium);
}
.domain-block__body {
  padding: var(--space-4) 0 var(--space-2) var(--space-22);
}
.domain-block__toggle {
  border: 0;
  background: none;
  width: var(--size-22);
  padding: 0;
}
.domain-block__count {
  color: var(--colour-folder-text);
  font-size: var(--font-size-sm);
}
.domain-block__empty {
  color: var(--colour-text-muted);
  padding: var(--space-6) var(--space-8);
  font-style: italic;
}
/* the "No domain" heading over the domain-less commitments */
.domain-block__label {
  color: var(--colour-text-muted);
  font-size: var(--font-size-sm);
  text-transform: uppercase;
  letter-spacing: var(--letter-spacing-label);
  padding: var(--space-2) var(--space-8);
}
.dropdown--small {
  width: var(--size-130);
  flex: none;
}

/* ---------- one commitment's page ---------- */
.commitment-title {
  display: flex;
  align-items: center;
  gap: var(--space-10);
  margin: var(--space-8) 0 var(--space-14);
  font-size: var(--font-size-3xl);
}
.commitment-card {
  background: var(--colour-surface-frame);
  border-radius: var(--radius-10);
  padding: var(--space-14) var(--space-16);
  display: flex;
  flex-direction: column;
  gap: var(--space-12);
  align-items: flex-start;
}
.commitment-card__field {
  display: flex;
  align-items: center;
  gap: var(--space-12);
  width: 100%;
}
.commitment-card__name {
  flex: 1;
  max-width: var(--size-320);
}

/* ---------- the tabs under the basics (Goals, Schedule windows) ---------- */
.commitment-tabs {
  display: flex;
  flex-direction: column;
  gap: var(--space-10);
  margin-top: var(--space-16);
}
.tab-bar {
  display: flex;
  align-items: baseline;
  gap: var(--space-12);
  padding: var(--space-10) var(--space-16);
  border-radius: var(--radius-10);
  background: var(--colour-surface-frame);
}
.tab-bar__title {
  margin: 0;
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-medium);
}
.tab-bar__note {
  font-size: var(--font-size-sm);
}
/* the bar that opens and closes a tab (a <summary>) */
.tab-bar--clickable {
  cursor: pointer;
}
.tab-bar--clickable:hover {
  background: var(--colour-surface-control);
}
/* The chevron at the right of the bar: a right-angle corner drawn with one even line, pointing
   left while the tab is closed and down while it is open. */
.tab-bar__chevron {
  align-self: center;
  margin: 0 var(--space-4) 0 auto;
  width: var(--size-8);
  height: var(--size-8);
  border-right: var(--border-medium) solid currentcolor;
  border-bottom: var(--border-medium) solid currentcolor;
  transform: rotate(135deg);
}
.tab-bar__chevron--open {
  margin-bottom: var(--space-4);
  transform: rotate(45deg);
}
/* an open tab's body sits in the same soft card as the bar */
.tab-panel[open] {
  padding-bottom: var(--space-12);
  border-radius: var(--radius-10);
  background: var(--colour-surface-frame);
}
.tab-panel__body {
  padding: 0 var(--space-16);
}
/* the row above the hint: the "copy this schedule to other commitments" button and its note */
.tab-panel__tools {
  display: flex;
  align-items: center;
  gap: var(--space-12);
  margin-top: var(--space-8);
}
.tab-panel__note {
  font-size: var(--font-size-sm);
}
.tab-panel__hint {
  margin: var(--space-6) 0 var(--space-14);
  line-height: var(--line-height-body);
}

/* ---------- drop highlights, on the quick list and the settings page alike ---------- */
/* No outlines: a LINE means "lands just before this", a TINT means "goes inside". The classes
   are added by js/ui/commitments/drag-drop.js while something is dragged over. */
.quick-nav__group--drop-before,
.quick-nav__commitment--drop-before,
.settings-row--drop-before,
.domain-block--drop-before {
  position: relative;
}
.quick-nav__group--drop-before::before,
.quick-nav__commitment--drop-before::before,
.settings-row--drop-before::before,
.domain-block--drop-before::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -1px;
  height: var(--size-2);
  border-radius: var(--radius-1);
  background: var(--colour-accent);
  pointer-events: none; /* so the line itself never steals the drag */
}
/* Dropping "into" a folder or the empty area tints the whole thing softly. */
.quick-nav__group--drop-inside,
.domain-block--drop-inside {
  box-shadow: none;
  background: var(--colour-drop-tint);
}
.quick-nav__group--drop-inside > .quick-nav__domain,
.domain-block--drop-inside > .domain-block__head {
  background: color-mix(in srgb, var(--colour-folder) 65%, var(--colour-accent));
}
