/* =============================================================================
   COMPONENT: care-plan — bucket catalog + item rows (v6 reference).
   ========================================================================== */
@layer components {
  .care-plan__hint {
    margin: 0 0 var(--space-md);
    font-size: var(--text-sm);
    color: var(--color-text-muted);
    line-height: var(--leading-normal);
  }

  .rolebanner {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    margin-block-end: var(--space-md);
    padding: var(--space-sm) var(--space-md);
    border: var(--border-width) solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--surface);
    color: var(--color-text-muted);
    font-size: var(--text-sm);
    line-height: var(--leading-normal);
  }

  .rolechip {
    flex: none;
    font-size: var(--text-xs);
    font-weight: var(--weight-bold);
    padding: 0.1875rem 0.5625rem;
    border-radius: var(--radius-pill);
    background: var(--accent-tint);
    color: var(--accent);
  }

  .rolechip--recipient {
    background: color-mix(in oklab, var(--person-2) 16%, var(--surface));
    color: color-mix(in oklab, var(--person-2) 78%, var(--color-text));
  }

  .rolechip--admin {
    background: var(--color-text);
    color: var(--surface);
  }

  .plan-bucket {
    margin-block-end: var(--space-sm);
    border: var(--border-width) solid var(--color-border);
    border-radius: var(--radius-lg);
    background: var(--surface-raised);
    overflow: hidden;
  }

  .plan-bucket > summary {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    list-style: none;
    cursor: pointer;
  }

  .plan-bucket > summary::-webkit-details-marker { display: none; }

  .plan-bucket__name {
    flex: 1;
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
    color: var(--color-text);
    min-inline-size: 0;
  }

  .plan-bucket__count {
    flex: none;
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    color: var(--color-text-muted);
  }

  .plan-bucket__count--on { color: var(--accent); }

  .plan-bucket__chevron {
    flex: none;
    display: inline-flex;
    color: var(--color-text-muted);
    transition: rotate var(--dur-fast) var(--ease);
  }

  .plan-bucket[open] .plan-bucket__chevron { rotate: 180deg; }

  .plan-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    border-block-start: var(--border-width) solid var(--color-border);
  }

  .plan-item--off { opacity: 0.6; }

  .plan-item__main {
    flex: 1;
    min-inline-size: 0;
  }

  .plan-item__name {
    display: flex;
    align-items: center;
    min-block-size: var(--touch-target);
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
    color: var(--color-text);
    text-decoration: none;
  }

  a.plan-item__name:hover { text-decoration: underline; }

  /* Read-only detail trigger for non-admins (ACR-0023/ACR-0054) — a <button>
     styled to match the admin edit link so the row looks the same either way. */
  button.plan-item__name--link {
    background: none;
    border: none;
    padding: 0;
    font-family: inherit;
    text-align: start;
    cursor: pointer;
  }

  button.plan-item__name--link:hover { text-decoration: underline; }

  .plan-item__sub {
    display: flex;
    align-items: center;
    gap: var(--space-2xs);
    margin-block-start: var(--space-3xs);
    font-size: var(--text-xs);
    color: var(--color-text-muted);
  }

  .plan-item__add {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    border: none;
    border-block-start: 1px dashed var(--color-border);
    background: transparent;
    color: var(--color-text-muted);
    font-size: var(--text-sm);
    text-decoration: none;
    min-block-size: var(--touch-target);
  }

  .plan-item__add:hover { color: var(--color-text); }

  .plan-task__toggle-form { display: contents; }
}
