/* ADMIN-ONLY SURFACES -- the gate and the paint, in ONE file.
 *
 * Extracted from base.html on 2026-11-08. It used to live only there, and a page that does not
 * extend base.html carried its own copy of the GATE and none of the PAINT: the BLI detail page
 * hid admin controls correctly and drew every one of them with no border, so a control only an
 * admin may use looked exactly like one a customer may (Xi, 2026-11-08).
 *
 * Both halves travel together now, and are linked by base.html and by details/_detail_base.html
 * rather than copied into each -- two copies of a rule is how the two drifted apart to begin
 * with.
 */

/* THE GATE. Every admin-only element on every page is hidden unless the Show Admin box is
   ticked. Hiding is all this does: whether the control EXISTS is the server's decision, and
   every endpoint behind one refuses a caller who is not an admin. */
html:not(.admin-on) .admin-only,
html:not(.admin-on) .admin-only-cell { display: none !important; }

/* ============================================================
   ADMIN-ONLY SURFACES
   Anything only a RootPath admin can see is marked, deliberately and unsubtly: light green
   ground, dark dashed green border. It should be impossible to look at a screenshot and wonder
   whether the customer sees a control -- so this is meant to read as scaffolding, not as design.
   Use .admin-only on the element; .admin-only-cell on a table cell (no radius, tighter inset);
   .admin-tag for the small "ADMIN" caption on a column header.
   ============================================================ */
:root { --admin-green: #1b7a3d; --admin-green-bg: #eaf7ee; }
/* THE CLASS IS WRITTEN TWICE ON PURPOSE. `.admin-only` alone is specificity (0,1,0), and the
   detail pages style their own chrome with `.detail-page section { background: #fff; border:
   1px solid ... }` at (0,1,1) -- so the admin surface lost to ordinary page furniture and a
   RootPath-only section drew as a plain white card (Xi, 2026-11-08). Doubling the class makes
   it (0,2,0), which wins over a page's own element-plus-class rule without reaching for
   `!important`, so a component that genuinely needs to adjust one of these still can.

   This surface is meant to be unmissable -- "it should be impossible to look at a screenshot
   and wonder whether the customer sees a control" -- so winning is the point. */
.admin-only.admin-only {
  background: var(--admin-green-bg);
  border: 1.5px dashed var(--admin-green);
  border-radius: 8px;
  padding: 6px 8px;
}
/* THE SAME STATEMENT, WITHOUT THE BOX. For a control too small to box -- a kebab in a table
   cell, an icon in a row of icons -- the colour carries the meaning instead. Always used WITH
   `.admin-only`, which is still the thing that hides it when Show Admin is off, so there is
   exactly one gate and two ways of drawing what it reveals (Xi, 2026-10-12). */
.admin-only.admin-only.admin-ink {
  background: none;
  border: 0;
  padding: 0;
  color: var(--admin-green);
  opacity: 1;
}
.admin-only.admin-ink .material-icons { color: var(--admin-green); }
.admin-only.admin-ink:hover,
tr:hover .admin-only.admin-ink {
  color: var(--admin-green);
  opacity: 1;
}
.admin-only.admin-ink:hover { background: var(--admin-green-bg); }
.admin-only.admin-ink:hover .material-icons { color: var(--admin-green); }

/* THE SAME STATEMENT ON A BUTTON. The third way of drawing what the gate reveals, beside the
   box and the ink, and the ONLY place an admin button is dressed.

   A button already has a shape -- the page's own button class decides it -- and the box above
   reshapes whatever it lands on: 6px padding and an 8px radius turned a 9.5px pill into a tall
   rounded rectangle. On the project cards that made "Enter Data" and "Mark Done", two admin
   buttons side by side, two different shapes: one restated the admin dress locally at a
   specificity that beat the box and stayed a pill, the other restated it at a lower one and
   lost (Xi, 2026-11-09: "there should be a simple, 1 source admin box style. The different
   shapes between these two buttons suggest unnecessary complication").

   So the colours are stated once, here, and the geometry is a pill unless the page says
   otherwise through `--admin-btn-pad` / `--admin-btn-radius` on its own class. A page restating
   the green, the dashes or the background on an admin button is the thing this replaces.
   Always used WITH `.admin-only`, which is still the gate. */
.admin-only.admin-only.admin-btn {
  background: var(--admin-green-bg);
  color: var(--admin-green);
  border: 1px dashed var(--admin-green);
  border-radius: var(--admin-btn-radius, 999px);
  padding: var(--admin-btn-pad, 1px 8px);
}
@media (hover: hover) {
  .admin-only.admin-only.admin-btn:hover { background: #dcf0e3; }
}
.admin-only.admin-only.admin-btn:disabled { opacity: .55; cursor: default; }

.admin-only-cell.admin-only-cell {
  background: var(--admin-green-bg);
  border-left: 1.5px dashed var(--admin-green);
  border-right: 1.5px dashed var(--admin-green);
}
tr:last-child > .admin-only-cell { border-bottom: 1.5px dashed var(--admin-green); }
/* Adjacent admin cells read as one green block rather than two adjoining boxes. */
.admin-only-cell + .admin-only-cell { border-left: 0; }
th.admin-only-cell { border-top: 1.5px dashed var(--admin-green); }
.admin-tag {
  display: inline-block;
  background: var(--admin-green);
  color: #fff;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.6px;
  border-radius: 3px;
  padding: 1px 5px;
  margin-left: 6px;
  vertical-align: 1px;
}


/* THE GREEN ADMIN BAR, for every page that has one (markup: templates/_admin_bar_markup.html).
   Moved out of base.html so the detail pages stop carrying a copy of it. */
.admin-bar { position: fixed; top: 0; left: 0; right: 0; z-index: 5000;
  background: #1B7F4B; color: #fff; font-size: 13px; font-weight: 600;
  padding: 7px 16px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  box-shadow: 0 2px 10px rgba(0,0,0,0.25); font-family: var(--font-primary, 'Figtree', sans-serif); }
.admin-bar .material-icons { font-size: 17px; }
.admin-bar label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  background: rgba(255,255,255,0.16); padding: 3px 10px; border-radius: 20px; }
.admin-bar input { accent-color: #fff; width: 15px; height: 15px; cursor: pointer; }
.admin-bar .admin-who { opacity: .92; font-weight: 700; }
html.has-admin-bar body { padding-top: var(--admin-bar-h, 40px); }
@media print { .admin-bar { display: none; } html.has-admin-bar body { padding-top: 0; } }
