ZDDC/landing/css/landing.css
ZDDC 7c0b66590c feat(server,shared): tell denied users who can — subtly, before wasted effort
When a user lacks permission, the app should (a) not let them do data entry it
will reject and (b) subtly say who can. General mechanism + the key gates.

Server — compute & expose "who can <verb> here":
- zddc.WhoCan(chain, verb) → Authority{Roles, People}: the acl.permissions
  grantees holding the verb across the cascade (roles + their members) plus the
  admins (who bypass). New whocan.go + whocan_test.go.
- AccessView gains path_who_can (profilehandler.go), populated only for verbs the
  caller LACKS and only when they can read the path (mirrors .zddc readability),
  so one cap.at() answers "can I?" and "if not, who?".
- writeForbiddenWho enriches the 403 body with who_can for the missing verb
  (errors.go); authorizeAction uses it (fileapi.go) as the safety net for denials
  that weren't pre-checked.

Shared — shared/cap.js:
- cap.whoCan(view, verb) + cap.denyHint(view, verb) → {text, title}, role-first
  ("Only the document controller can create here") with the people in the tooltip.
- handleForbidden appends the hint (from the 403 body, else the cached view), so
  every tool that already routes 403s through it (form save, tables save, browse)
  now explains who can — for free.

Key gates:
- Browse party-create (the reported bug): pre-check create authority on ssr/ and
  the slot BEFORE opening the picker — if the user can do neither, show the hint
  instead of the form; if only existing parties are usable, disable "+ New party"
  with the who-can hint. The post-hoc 403 catch now names who can too.
- Tables +Add row disabled state shows the who-can hint.

Plus: subtle /_apps/{browse,archive,classifier}.html links in the landing footer.

Tests: Go WhoCan unit test (role/person split, admin bypass, dedupe); cap.spec.js
(denyHint role-first/people/fallback, whoCan, handleForbidden enrichment) — 5
green; Go handler+zddc+policy suites green. (Pre-existing stale browse toolbar
test browse.spec.js:274 unaffected.)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-12 14:58:20 -05:00

642 lines
15 KiB
CSS

/* Landing page layout */
body {
margin: 0;
font-family: var(--font);
font-size: 14px;
background: var(--bg-secondary);
color: var(--text);
}
.landing-main {
max-width: 880px;
margin: 32px auto;
padding: 0 16px 64px;
}
/* Welcome / hero */
.landing-hero {
margin: 0 0 24px;
padding: 0 4px;
}
.landing-hero h1 {
margin: 0 0 8px;
font-size: 1.5rem;
font-weight: 600;
color: var(--text);
}
.landing-hero-sub {
margin: 0;
color: var(--text-muted);
font-size: 0.95rem;
line-height: 1.5;
max-width: 60ch;
}
/* Access warning banner */
.access-warning-banner {
display: flex;
align-items: center;
justify-content: space-between;
padding: 10px 16px;
background: #fff3cd;
border: 1px solid #ffc107;
border-radius: var(--radius);
color: #664d03;
font-size: 0.875rem;
margin-bottom: 16px;
gap: 12px;
}
.access-warning-banner.hidden { display: none; }
.warning-dismiss-btn {
background: none;
border: none;
cursor: pointer;
color: #664d03;
font-size: 1rem;
padding: 0 4px;
flex-shrink: 0;
}
/* Cards (groups + projects) */
.landing-card {
background: var(--bg);
border: 1px solid var(--border);
border-radius: var(--radius);
overflow: visible;
box-shadow: 0 1px 2px rgba(0,0,0,0.04);
margin-bottom: 16px;
}
.landing-card:last-child { margin-bottom: 0; }
.landing-card-header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 12px 16px;
border-bottom: 1px solid var(--border);
gap: 12px;
flex-wrap: wrap;
}
.landing-card-title {
display: flex;
align-items: baseline;
gap: 8px;
}
.landing-card-header h2 {
margin: 0;
font-size: 1rem;
font-weight: 600;
color: var(--text);
}
.landing-count {
color: var(--text-muted);
font-size: 0.875rem;
}
.landing-header-actions {
display: flex;
align-items: center;
gap: 8px;
flex-wrap: wrap;
}
/* ── Groups card ─────────────────────────────────────────────────────────── */
.groups-container { min-height: 0; }
.groups-empty {
padding: 16px 24px;
color: var(--text-muted);
font-size: 0.9rem;
line-height: 1.5;
}
.groups-table {
width: 100%;
border-collapse: collapse;
font-size: 0.9rem;
}
.groups-row {
cursor: pointer;
transition: background 0.08s;
}
.groups-row:hover { background: var(--bg-hover); }
.groups-row td {
padding: 8px 12px;
border-bottom: 1px solid var(--border);
vertical-align: middle;
}
.groups-row:last-child td { border-bottom: none; }
.groups-row-name {
font-weight: 500;
color: var(--text);
}
.groups-row-count {
color: var(--text-muted);
font-size: 0.85rem;
width: 8em;
white-space: nowrap;
}
.groups-row-actions {
width: 4.5em;
text-align: right;
white-space: nowrap;
}
.groups-btn-edit, .groups-btn-delete {
background: none;
border: 1px solid transparent;
border-radius: 3px;
cursor: pointer;
color: var(--text-muted);
font-size: 0.95rem;
padding: 2px 6px;
line-height: 1;
}
.groups-btn-edit:hover {
background: var(--bg-hover);
color: var(--text);
}
.groups-btn-delete:hover {
background: var(--bg-hover);
color: var(--danger, #c0392b);
}
/* ── Select-mode action bar ──────────────────────────────────────────────── */
.select-action-bar {
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
padding: 10px 16px;
background: var(--bg-secondary);
border-bottom: 1px solid var(--border);
flex-wrap: wrap;
}
.select-action-bar.hidden { display: none; }
.select-action-bar__label {
display: flex;
align-items: center;
gap: 8px;
flex: 1 1 240px;
min-width: 0;
}
.select-action-bar__label > span {
font-weight: 500;
color: var(--text);
flex-shrink: 0;
}
.group-name-input {
flex: 1 1 0;
min-width: 120px;
padding: 5px 10px;
border: 1px solid var(--border);
border-radius: 3px;
font-size: 0.875rem;
background: var(--bg);
color: var(--text);
}
.group-name-input:focus {
outline: none;
border-color: var(--primary);
}
.select-action-bar__buttons {
display: flex;
gap: 6px;
flex-wrap: wrap;
}
/* ── Projects card ───────────────────────────────────────────────────────── */
.project-list-container {
min-height: 80px;
}
/* Empty / error states */
.project-list-empty {
padding: 32px 24px;
text-align: center;
color: var(--text-muted);
}
.project-list-empty h3 {
margin: 0 0 8px;
font-size: 1rem;
font-weight: 600;
color: var(--text);
}
.project-list-empty p {
margin: 4px 0;
font-size: 0.9rem;
line-height: 1.5;
}
.landing-empty-help {
color: var(--text-muted);
font-size: 0.85rem !important;
margin-top: 12px !important;
max-width: 50ch;
margin-left: auto !important;
margin-right: auto !important;
}
/* Loading state */
.project-list-loading {
padding: 32px 16px;
text-align: center;
color: var(--text-muted);
font-size: 0.875rem;
}
/* Project table */
.project-table {
width: 100%;
border-collapse: collapse;
font-size: 0.9rem;
}
.project-table thead {
background: var(--bg-secondary);
}
.project-table-headers th {
padding: 10px 12px;
text-align: left;
font-weight: 600;
color: var(--text);
border-bottom: 1px solid var(--border);
user-select: none;
}
.project-table-headers th[data-sort] {
cursor: pointer;
}
.project-table-headers th[data-sort]:hover {
background: var(--bg-hover);
}
.project-table-checkbox-col {
width: 32px;
padding: 8px 12px;
text-align: center;
}
.project-table-checkbox-col input[type="checkbox"] {
width: 16px;
height: 16px;
cursor: pointer;
accent-color: var(--primary);
margin: 0;
vertical-align: middle;
}
.project-table-name-col {
min-width: 140px;
}
.project-table-title-col {
width: 100%;
}
.sort-indicator {
color: var(--text-muted);
margin-left: 4px;
font-size: 0.75rem;
}
.sort-indicator.active {
color: var(--text);
}
.project-table-filters th {
padding: 6px 12px;
border-bottom: 1px solid var(--border);
background: var(--bg);
}
.project-table-filters .column-filter {
width: 100%;
box-sizing: border-box;
padding: 4px 8px;
border: 1px solid var(--border);
border-radius: 3px;
font-size: 0.85rem;
background: var(--bg);
color: var(--text);
}
.project-table-filters .column-filter:focus {
outline: none;
border-color: var(--primary);
}
.project-table-filters .column-filter.filter-active {
background: var(--bg-secondary);
border-color: var(--primary);
}
.project-table-row {
cursor: pointer;
transition: background 0.08s;
}
.project-table-row:hover {
background: var(--bg-hover);
}
.project-table-row.is-selected {
background: var(--bg-selected, rgba(0, 105, 217, 0.08));
}
.project-table-row.is-selected:hover {
background: var(--bg-selected-hover, rgba(0, 105, 217, 0.15));
}
.project-table-row td {
padding: 8px 12px;
border-bottom: 1px solid var(--border);
vertical-align: middle;
}
.project-table-no-title {
color: var(--text-muted);
}
.project-table-no-match {
padding: 24px 16px !important;
text-align: center;
color: var(--text-muted);
}
/* ── Project mode ──────────────────────────────────────────────────────── */
/* Activated when location.pathname is a single project segment (e.g.
/Project-1). Picker UI is hidden; this block surfaces the four
lifecycle-stage cards and MDL editing instructions. */
.project-title {
font-size: 1.6rem;
margin: 0 0 0.25rem;
font-weight: 600;
}
.project-title__subtle {
color: var(--text-muted);
font-weight: normal;
font-size: 0.9rem;
}
.lead {
color: var(--text-muted);
margin: 0.25rem 0 1.5rem;
}
.stages {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
gap: 0.85rem;
margin: 1rem 0 1.5rem;
}
.stage-card {
display: block;
padding: 1rem 1.1rem;
background: var(--bg);
border: 1px solid var(--border);
border-radius: var(--radius);
text-decoration: none;
color: var(--text);
transition: border-color 0.15s, box-shadow 0.15s, transform 0.05s;
cursor: pointer;
}
.stage-card:hover {
border-color: var(--primary);
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}
.stage-card:active {
transform: translateY(1px);
}
.stage-card h3 {
margin: 0 0 0.3rem;
font-size: 1rem;
color: var(--primary);
font-weight: 600;
}
.stage-card p {
margin: 0;
color: var(--text-muted);
font-size: 0.875rem;
}
/* MDL card variant: same outer styling as a stage card but contains
an interactive control (party <select> + Open button) instead of
navigating on click of the whole card. The :hover lift applies
regardless. */
.stage-card--mdl {
cursor: default;
}
.stage-card--mdl:active {
transform: none;
}
.stage-card__action {
display: flex;
gap: 0.5rem;
align-items: center;
margin-top: 0.65rem;
}
.mdl-party-select {
flex: 1 1 auto;
min-width: 0;
padding: 0.3rem 0.5rem;
font-family: var(--font);
font-size: 0.9rem;
border: 1px solid var(--border);
border-radius: var(--radius);
background: var(--bg-secondary);
color: var(--text);
}
.mdl-party-select:focus {
border-color: var(--primary);
outline: none;
box-shadow: 0 0 0 2px rgba(95, 168, 224, 0.25);
}
.mdl-party-select:disabled {
opacity: 0.55;
cursor: not-allowed;
}
.stage-card__hint {
margin: 0.65rem 0 0 !important;
font-size: 0.78rem !important;
color: var(--text-muted) !important;
line-height: 1.4;
}
.visually-hidden {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
clip: rect(0, 0, 0, 0);
white-space: nowrap;
border: 0;
}
.browse-link {
display: inline-block;
margin-top: 0.25rem;
color: var(--primary);
text-decoration: none;
cursor: pointer;
}
.browse-link:hover {
text-decoration: underline;
}
/* Subtle standalone-tools footer. */
.landing-apps {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 0.75rem;
margin: 2rem auto 1rem;
padding: 0 1rem;
max-width: 60rem;
font-size: 0.82rem;
color: var(--text-muted, #6b7280);
}
.landing-apps__label { color: var(--text-muted, #6b7280); }
.landing-apps .browse-link { margin-top: 0; }
#projectView ol {
padding-left: 1.5rem;
}
#projectView ol li {
margin-bottom: 0.4rem;
}
#projectView code {
font-family: var(--font-mono);
background: var(--bg-secondary);
padding: 0.1em 0.35em;
border-radius: 3px;
font-size: 0.86em;
}
#projectView h2 {
font-size: 1.1rem;
margin: 2.25rem 0 0.5rem;
padding-bottom: 0.3rem;
border-bottom: 1px solid var(--border);
font-weight: 600;
}
.party-list {
padding-left: 1.5rem;
margin: 0.4rem 0 1rem;
}
.party-list li {
margin-bottom: 0.25rem;
}
.party-list a {
color: var(--primary);
text-decoration: none;
}
.party-list a:hover {
text-decoration: underline;
}
.party-list-none-yet {
color: var(--text-muted);
font-style: italic;
}
/* ── New-project dialog ──────────────────────────────────────────────────── */
.np-modal {
position: fixed;
inset: 0;
z-index: 1000;
display: flex;
align-items: flex-start;
justify-content: center;
overflow-y: auto;
padding: 3rem 1rem;
}
.np-modal__backdrop {
position: fixed;
inset: 0;
background: rgba(0, 0, 0, 0.45);
}
.np-modal__dialog {
position: relative;
background: var(--bg);
color: var(--text);
border: 1px solid var(--border);
border-radius: var(--radius);
box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
width: 100%;
max-width: 560px;
padding: 1.25rem 1.5rem 1.5rem;
margin: auto;
}
.np-modal__head {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 0.25rem;
}
.np-modal__head h2 { margin: 0; font-size: 1.25rem; }
.np-modal__close {
background: none;
border: none;
font-size: 1.5rem;
line-height: 1;
color: var(--text-muted);
cursor: pointer;
padding: 0.1rem 0.4rem;
}
.np-modal__close:hover { color: var(--text); }
.np-help { color: var(--text-muted); font-size: 0.85rem; margin: 0 0 1rem; }
.np-field { display: block; margin-bottom: 0.75rem; font-size: 0.85rem; color: var(--text-secondary, var(--text-muted)); }
.np-field input {
display: block;
width: 100%;
margin-top: 0.25rem;
padding: 0.4rem 0.55rem;
border: 1px solid var(--border);
border-radius: var(--radius);
background: var(--bg-secondary, var(--bg));
color: var(--text);
font-size: 0.9rem;
box-sizing: border-box;
}
.np-err { display: block; color: var(--danger); font-size: 0.8rem; margin-top: 0.25rem; }
.np-grouphdr { font-size: 0.95em; margin: 1rem 0 0.3rem; font-weight: 600; }
.np-sub { font-weight: 400; color: var(--text-muted); font-size: 0.8rem; }
.np-list { display: flex; flex-direction: column; gap: 0.35rem; margin-bottom: 0.4rem; }
.np-row { display: flex; gap: 0.4rem; align-items: center; }
.np-row__input { flex: 1; }
.np-row__verbs { flex: 0 0 8rem; }
.np-row input {
padding: 0.35rem 0.5rem;
border: 1px solid var(--border);
border-radius: var(--radius);
background: var(--bg-secondary, var(--bg));
color: var(--text);
font-size: 0.88rem;
box-sizing: border-box;
}
.np-del {
flex: 0 0 auto;
background: none;
border: 1px solid var(--border);
border-radius: var(--radius);
color: var(--text-muted);
cursor: pointer;
width: 1.9rem;
height: 1.9rem;
font-size: 1.1rem;
line-height: 1;
}
.np-del:hover { color: var(--danger); border-color: var(--danger); }
.np-add {
background: none;
border: 1px dashed var(--border);
border-radius: var(--radius);
color: var(--primary);
cursor: pointer;
font-size: 0.82rem;
padding: 0.3rem 0.6rem;
}
.np-add:hover { border-color: var(--primary); }
.np-actions {
display: flex;
justify-content: flex-end;
gap: 0.5rem;
margin-top: 1.25rem;
border-top: 1px solid var(--border);
padding-top: 1rem;
}