/* ============================================================
   ORGANIZATION — the tenancy screen. Borrows the page shell from
   pages.css and the sheet from sheets.css; only the roster, the
   role rows and the permission grid live here.
   ============================================================ */

.org-sec { margin-bottom: 26px; }
.org-sec-head {
  display: flex; align-items: center; gap: 12px;
  margin: 0 0 12px; flex-wrap: wrap;
}
.org-sec-head h2 { font-size: 20px; margin: 0; letter-spacing: -.01em; }
.org-sec-head h3 {
  font-size: 12px; letter-spacing: .14em; text-transform: uppercase;
  margin: 0; opacity: .62; font-weight: 700;
}
.org-sec-head .org-btn-sm { margin-left: auto; }
/* the FIRST small button takes the slack; a second one sits beside it
   rather than splitting the gap and landing in the middle of the row */
.org-sec-head .org-btn-sm ~ .org-btn-sm { margin-left: 0; }

.org-badge {
  font-size: 11px; letter-spacing: .08em; text-transform: uppercase;
  padding: 4px 10px; border-radius: 999px;
  border: 1px solid rgba(255,255,255,.16); opacity: .78;
}
.org-note { font-size: 13.5px; line-height: 1.55; opacity: .62; margin: 0 0 14px; }

/* ---- rows: roles and people share one shape ---- */
.org-list { display: flex; flex-direction: column; gap: 8px; }
.org-row {
  display: flex; align-items: center; gap: 14px; width: 100%;
  padding: 14px 16px; text-align: left;
  background: rgba(255,255,255,.035);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 12px; color: inherit; font: inherit;
}
button.org-row { cursor: pointer; }
button.org-row:disabled { cursor: default; opacity: .72; }
button.org-row:not(:disabled):hover { background: rgba(255,255,255,.06); }
.org-row-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.org-row-main b { font-size: 15px; font-weight: 600; }
.org-row-main small { font-size: 12.5px; opacity: .58; }
.org-row-go { font-size: 12px; opacity: .7; flex: none; }
/* the "3 kinds of work · 3 roles" line under a template's blurb - the
   same size as the blurb, dimmer, so it reads as a footnote to it */
.org-pack-count { opacity: .42 !important; margin-top: 2px; }
.org-row-lock { font-size: 11px; opacity: .38; flex: none; letter-spacing: .06em; text-transform: uppercase; }

/* ---- empty state ---- */
.org-empty {
  max-width: 460px; display: flex; flex-direction: column; gap: 14px;
  padding: 26px 0;
}
.org-empty h2 { font-size: 22px; margin: 0; letter-spacing: -.01em; }
.org-empty p { font-size: 14.5px; line-height: 1.6; opacity: .66; margin: 0; }

/* ---- fields + buttons ---- */
.org-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 4px; }
.org-field span { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; opacity: .55; }
.org-field input {
  font: inherit; font-size: 15px; padding: 12px 14px; color: inherit;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.13); border-radius: 10px;
}
.org-field input:focus-visible { outline: 2px solid rgba(255,255,255,.4); outline-offset: 1px; }

.org-btn {
  font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
  padding: 12px 18px; border-radius: 10px; color: inherit;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.18);
}
.org-btn:hover:not(:disabled) { background: rgba(255,255,255,.15); }
.org-btn:disabled { opacity: .5; cursor: default; }
.org-btn-sm { padding: 7px 13px; font-size: 12.5px; }
.org-btn-danger { background: rgba(226,90,70,.14); border-color: rgba(226,90,70,.36); }
.org-btn-danger:hover:not(:disabled) { background: rgba(226,90,70,.22); }
.org-actions { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }

/* ---- the permission grid ---- */
.org-perms { display: flex; flex-direction: column; gap: 16px; margin-top: 14px; }
.org-perm-group {
  display: flex; flex-direction: column; gap: 6px;
  padding: 14px 16px; border-radius: 12px;
  background: rgba(255,255,255,.035);
  border: 1px solid rgba(255,255,255,.08);
}
.org-perm-group h4 {
  font-size: 11px; letter-spacing: .13em; text-transform: uppercase;
  margin: 0 0 4px; opacity: .55; font-weight: 700;
}
.org-perm {
  display: flex; align-items: center; gap: 12px;
  padding: 7px 0; border-bottom: 1px solid rgba(255,255,255,.055);
}
.org-perm:last-child { border-bottom: none; }
.org-perm span { font-size: 14px; flex: 1; min-width: 0; }
/* the global select in sheets.css is built for a ~56px-tall control and
   pins its chevron at y=22px; this one is half that height, so the arrow
   has to move with it or it floats below the text it belongs to */
.org-perm .org-scope {
  flex: none; width: 140px; font-size: 13.5px;
  padding: 9px 30px 9px 12px; border-radius: 9px; min-height: 0;
  background-position: calc(100% - 18px) 16px, calc(100% - 13px) 16px;
}

/* ---- the work-type builder's field rows ---- */
.org-fieldrow {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  padding: 12px 14px; border-radius: 12px;
  background: rgba(255,255,255,.035);
  border: 1px solid rgba(255,255,255,.08);
}
/* the label is the row's subject, so it takes the space; everything else
   sizes to its content and wraps beneath on a narrow screen */
.org-fieldrow .oft-label { flex: 1 1 160px; min-width: 0; }
.org-fieldrow input[type=text], .org-fieldrow select {
  font-size: 14px; padding: 9px 12px; border-radius: 9px; width: auto; min-height: 0;
}
.org-fieldrow select { padding-right: 30px; background-position: calc(100% - 18px) 16px, calc(100% - 13px) 16px; }
.org-fieldrow .oft-options { flex: 1 1 100%; }
.org-fieldrow .oft-req {
  display: flex; align-items: center; gap: 6px; font-size: 13px; opacity: .72; flex: none;
}
.org-fieldrow .oft-req input { width: auto; margin: 0; }
.org-fieldrow .oft-del { flex: none; }

/* ---- people ---- */
/* An initial, not a photo: the directory holds names and emails, and a
   letter that is always right beats an avatar that is usually missing. */
.org-av, .org-person-av {
  flex: none; display: flex; align-items: center; justify-content: center;
  border-radius: 50%; font-weight: 700; letter-spacing: -.01em;
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.12);
}
.org-av { width: 32px; height: 32px; font-size: 13px; margin-right: 11px; }
.org-person-av { width: 52px; height: 52px; font-size: 21px; }

.org-member { text-align: left; }

.org-person { display: flex; align-items: center; gap: 14px; margin: 0 0 18px; }
.org-person-id { min-width: 0; }
.org-person-id .sheet-title { margin: 0 0 2px; }
.org-person-id p {
  margin: 0; font-size: 13px; opacity: .55;
  overflow: hidden; text-overflow: ellipsis;
}

/* label/value pairs, one per line, so a long email never shoves a value
   off its own row */
.org-facts { display: grid; gap: 1px; margin: 0 0 18px; }
.org-fact {
  display: flex; align-items: baseline; justify-content: space-between; gap: 16px;
  padding: 9px 0; border-bottom: 1px solid rgba(255,255,255,.06);
}
.org-fact:last-child { border-bottom: none; }
.org-fact span { font-size: 12.5px; opacity: .55; flex: none; }
.org-fact b { font-size: 13.5px; font-weight: 600; text-align: right; min-width: 0; }

/* ---- collapsible section ---- */
.org-fold > summary {
  cursor: pointer; list-style: none; padding: 9px 0;
  font-size: 13px; opacity: .62; user-select: none;
  display: flex; align-items: center; gap: 6px;
}
.org-fold > summary::-webkit-details-marker { display: none; }
.org-fold > summary b { font-weight: 700; opacity: .9; }
/* a chevron that points down when open, right when shut */
.org-fold > summary::before {
  content: ""; width: 6px; height: 6px; flex: none; margin-right: 3px;
  border-right: 1.6px solid currentColor; border-bottom: 1.6px solid currentColor;
  transform: rotate(-45deg); transition: transform .16s ease;
}
.org-fold[open] > summary::before { transform: rotate(45deg); }
.org-fold > summary:hover { opacity: .85; }
.org-fold > summary:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; border-radius: 4px; }
@media (prefers-reduced-motion: reduce) {
  .org-fold > summary::before { transition: none; }
}

/* ---- a kind of work, opened ---- */
/* Closed, it reads exactly like the rows around it. Open, it becomes a
   container - so the page gains depth without gaining a new visual
   language for the reader to learn. */
.org-typefold {
  background: rgba(255,255,255,.035);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 12px;
  overflow: hidden;
}
.org-typefold > summary {
  padding: 14px 16px; gap: 14px; opacity: 1;
}
.org-typefold > summary::before { margin-right: 0; opacity: .5; }
.org-typefold > summary:hover { background: rgba(255,255,255,.02); }
.org-typefold[open] > summary { border-bottom: 1px solid rgba(255,255,255,.07); }

.org-typebody { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 4px; }
.org-typebody .org-list { margin-top: 2px; }
.org-typebody .org-note { margin: 2px 0 6px; }
.org-typebody .org-actions { margin-top: 10px; }

.org-sub {
  margin: 12px 0 7px; font-size: 11px; font-weight: 700;
  letter-spacing: .12em; text-transform: uppercase; opacity: .45;
}
.org-typebody > .org-sub:first-child { margin-top: 0; }

/* a field is three facts - what it is called, what it holds, and whether
   it is required - so the chip carries all three rather than making the
   reader open the editor to find out */
.org-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.org-chip {
  display: inline-flex; align-items: baseline; gap: 6px;
  padding: 5px 10px; border-radius: 8px; font-size: 12.5px;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.07);
}
.org-chip i { font-style: normal; font-size: 10.5px; opacity: .45; letter-spacing: .04em; }
.org-chip u {
  text-decoration: none; font-size: 9.5px; letter-spacing: .08em;
  text-transform: uppercase; opacity: .55;
}
/* stages are a sequence, and a row of arrows says so without a diagram */
.org-stages .org-chip + .org-chip { position: relative; margin-left: 12px; }
.org-stages .org-chip + .org-chip::before {
  content: "\2192"; position: absolute; left: -13px; top: 50%;
  transform: translateY(-50%); opacity: .3; font-size: 11px;
}

/* ---- work types, grouped by where they came from ---- */
.org-group { display: flex; flex-direction: column; }
.org-group + .org-group { margin-top: 18px; }
/* the group name sits with its list rather than floating above the gap,
   so which heading owns which rows is never in question */
.org-group-head {
  margin: 0 0 8px 2px; font-size: 11px; font-weight: 700;
  letter-spacing: .12em; text-transform: uppercase; opacity: .38;
}

/* ---- the handoff track editor ---- */
.org-stops { display: flex; flex-direction: column; gap: 10px; }
.org-stop {
  display: flex; align-items: flex-start; gap: 11px;
  padding: 12px; border-radius: 10px;
  background: rgba(255,255,255,.035);
  border: 1px solid rgba(255,255,255,.08);
}
/* the number is the point of a track - it says these happen IN ORDER */
.org-stop-n {
  flex: none; width: 24px; height: 24px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11.5px; font-weight: 700; margin-top: 5px;
  background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.1);
}
.org-stop-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.org-stop .otk-label { width: 100%; }
.org-stop .otk-del { flex: none; margin-top: 3px; }

/* ---- a stop nobody holds ---- */
/* warning, not error: an owner may draw the track before seating anyone,
   and the honest thing is to say what will happen, not to refuse */
.org-warn {
  margin: 8px 0 0; font-size: 12.5px; line-height: 1.5;
  color: #d9a273;
}
.org-chip.gap {
  border-color: rgba(208,138,78,.45);
  background: rgba(208,138,78,.1);
}
.org-stop.gap { border-color: rgba(208,138,78,.4); }

/* ---- narrowing a stop to some of the people in its role ---- */
.otk-who {
  margin-top: 8px; padding: 9px 11px; border-radius: 8px;
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(255,255,255,.06);
}
.otk-who-head {
  margin: 0 0 6px; font-size: 11px; font-weight: 700;
  letter-spacing: .1em; text-transform: uppercase; opacity: .45;
}
.otk-who .wk-check { display: block; font-size: 13px; padding: 2px 0; }
